stx_libview.st
author Claus Gittinger <cg@exept.de>
Tue, 23 Apr 2019 16:30:55 +0200
changeset 8674 e29a561c0fbe
parent 8539 17a394e6308c
child 8731 5506d148b369
permissions -rw-r--r--
#FEATURE by cg class: SimpleView added: #isDialogBox

"
 COPYRIGHT (c) Claus Gittinger / 2006 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libview' }"

"{ NameSpace: Smalltalk }"

LibraryDefinition subclass:#stx_libview
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'* Projects & Packages *'
!

!stx_libview class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) Claus Gittinger / 2006 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    Package Documentation

    This library contains low level interfaces to the underlying graphic system
    and representations of windows, fonts, colors, bitmaps etc.

    It does not contain medium level widget classes or applications/tools,
    but instead provides a device- and operating system independent layer on top of which
    GUI frameworks can be built.

    It currently supports X11 and Windows-API. 
    Native OSX support may be an option if there is sufficient demand for it 
    (i.e. someone is willing to pay for its development).

    [author:]
        cg

    [primary maintainer:]
        cg
"
! !

!stx_libview class methodsFor:'description'!

excludedFromPreRequisites
    ^ #(
        #'stx:libcompat'    "OrderedDither - referenced by Image>>convertToPalette:renderedBy: "
        #'stx:libtool'    "GenericToolbarIconLibrary - referenced by SimpleView class>>readStyleSheet "
        #'stx:libtool2'    "ImageEditor - referenced by Image>>edit "
        #'stx:libui'    "ViewSpec - referenced by SimpleView>>specClass "
        #'stx:libview2'    "TIFFReader - referenced by Image>>saveOn: "
        #'stx:libwidg'    "Button - referenced by ModalBox>>initialize "
        #'stx:libwidg2'    "ImageView - referenced by Form>>show "
        #'stx:goodies/communication'    "HTTPInterface - referenced by ImageReader class>>fromURL:"
    )

    "Modified: / 31-01-2017 / 13:35:51 / stefan"
!

mandatoryPreRequisites
    "list packages which are mandatory as a prerequisite.
     This are packages containing superclasses of my classes and classes which
     are extended by myself.
     They are mandatory, because we need these packages as a prerequisite for loading and compiling.
     This method is generated automatically,
     by searching along the inheritance chain of all of my classes.
     Please take a look at the #referencedPreRequisites method as well."

    ^ #(
        #'stx:libbasic'    "AllocationFailure - superclass of GraphicsDevice::GraphicResourceAllocationFailure"
    )
!

referencedPreRequisites
    "list packages which are a prerequisite, because they contain
     classes which are referenced by my classes.
     These packages are NOT needed as a prerequisite for compiling or loading,
     however, a class from it may be referenced during execution and having it
     unloaded then may lead to a runtime doesNotUnderstand error, unless the caller
     includes explicit checks for the package being present.
     This method is generated automatically,
     by searching all classes (and their packages) which are referenced by my classes.
     Please also take a look at the #mandatoryPreRequisites method"

    ^ #(
        #'stx:libbasic2'    "UUID - referenced by DisplayRootView>>uuid"
    )

    "Modified: / 31-01-2017 / 13:35:33 / stefan"
!

subProjects
    "list packages which are known as subprojects.
     The generated makefile will enter those and make there as well.
     However: they are not forced to be loaded when a package is loaded;
     for those, redefine #referencedPrerequisites or #mandatoryPreRequisites."

    ^ #(
    )
! !

!stx_libview class methodsFor:'description - compilation'!

additionalBaseAddressDefinition_bc_dot_mak
    "this is an optional definition, which (if present) may speed up the dll-loading a little
     on win32 systems."

    ^ '
# see stdHeader_bc for LIBVIEW_BASE
LIB_BASE=$(LIBVIEW_BASE)
'
!

additionalDefinitions_bc_dot_mak
    ^ '
!!ifdef USEBC
X11_LIBS=..\libbc\X11OMF.lib ..\libbc\XextOMF.lib
!!else
!! ifdef USEVC
# X11_LIBS=..\libvc\X11.lib ..\libvc\Xext.lib
!! else
!! endif
!!endif
'

    "Modified: / 27-09-2011 / 18:25:27 / cg"
!

additionalDefinitions_make_dot_proto
    ^ '
LOCAL_SHARED_LIBS=-L$(X_LIB_DIR) $(LIB_XEXT) $(LIB_XINERAMA) $(LIB_XFT) $(LIB_X) $(LIBRUN_LINK_LIB)
'
!

additionalRules_bc_dot_mak
    ^ '#

..\libbc\X11OMF.lib: ..\support\win32\borland\X11OMF.lib
        copy ..\support\win32\borland\X11OMF.lib ..\libbc

..\libbc\XextOMF.lib: ..\support\win32\borland\XextOMF.lib
        copy ..\support\win32\borland\XextOMF.lib ..\libbc

..\libvc\X11.lib: ..\support\win32\msc\X11.lib
        copy ..\support\win32\msc\X11.lib ..\libvc

..\libvc\Xext.lib: ..\support\win32\msc\Xext.lib
        copy ..\support\win32\msc\Xext.lib ..\libvc

'

    "Modified: / 27-09-2011 / 18:10:19 / cg"
!

additionalRules_make_dot_proto
    ^ '
postMake:: $(LIBVIEW_EXTRA_TARGETS)

clean::
            @-mv $(OUTDIR)XWorkstation.o $(OUTDIR)XWorkstation.o.sav
            @-mv $(OUTDIR)GLXWorkstation.o $(OUTDIR)GLXWorkstation.o.sav
            @-rm -f [A-Z]*.$(O) *.s *.s2 *.c *.$(H)
            @-mv $(OUTDIR)XWorkstation.o.sav $(OUTDIR)XWorkstation.o
            @-mv $(OUTDIR)GLXWorkstation.o.sav $(OUTDIR)GLXWorkstation.o
            @-touch $(OUTDIR)XWorkstation.st $(OUTDIR)GLXWorkstation.st

#
# XWorkstatation and GLXWorkstatation are separate (shared) Objects - compile without sepInitCode
# and without -Zlibview (to speedup ld.so on SGI, by avoiding conflicts)
#

XWorkstation.$(O): XWorkstation.st $(INCLUDE_TOP)/stx/libview/DeviceWorkstation.$(H) $(INCLUDE_TOP)/stx/libview/HostGraphicsDevice.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsDevice.$(H)
        $(MAKE) $(BIG_STFILE_RULE) BIG_FILE=XWorkstation \
                CC="$(CC)" OPT="$(OPT)" \
                CLASSLIB_CC="$(CLASSLIB_CC)" \
                CLASSLIB_OPT="$(CLASSLIB_OPT) -primitiveStackSize=64000" \
                SEPINITCODE=-sepInitCode ZFLAG=

xw:
        $(MAKE) XWorkstation.c \
                CC="$(CC)" OPT="$(OPT)" \
                CLASSLIB_CC="$(CLASSLIB_CC)" \
                CLASSLIB_OPT="$(CLASSLIB_OPT) -primitiveStackSize: 64000 -V" \
                SEPINITCODE=-sepInitCode ZFLAG=

XWorkstation.$(SO): XWorkstation.$(O)
        $(MAKE) $(SHAREDLIBRULE) \
            LIB=XWorkstation.$(SO) \
            OBJS="XWorkstation.$(O)" \
            LOCAL_SHARED_LIBS="-L$(X_LIB_DIR) $(LIB_XEXT) $(LIB_XINERAMA) $(LIB_XFT) $(LIB_X) $(LIBRUN_LINK_LIB) "

#            LOCAL_SHARED_LIBS="-L$(TOP)/librun -lrun -L$(X_LIB_DIR) $(LIB_XEXT) $(LIB_XINERAMA) $(LIB_X) "



__GLXWorkstation.$(O): GLXWorkstation.st $(INCLUDE_TOP)/stx/libview/XWorkstation.$(H) $(INCLUDE_TOP)/stx/libview/DeviceWorkstation.$(H) $(INCLUDE_TOP)/stx/libview/HostGraphicsDevice.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsDevice.$(H) $(INCLUDE)/stc.h
        $(MAKE) $(BIG_STFILE_RULE) BIG_FILE=GLXWorkstation \
                CC="$(CC)" OPT="$(OPT)" \
                CLASSLIB_CC="$(CLASSLIB_CC)" CLASSLIB_OPT="$(CLASSLIB_OPT)" \
                SEPINITCODE=-sepInitCode ZFLAG=
        mv GLXWorkstation.$(O) __GLXWorkstation.$(O)

GLXWorkstation.$(O): glLib __GLXWorkstation.$(O)
        @if [ "$(NO_PRELINK_LIBGL)" = "" ]; \
        then\
            echo $(CLASSLIB_LD) $(LD_REL_FLAG) -o GLXWorkstation.$(O) __GLXWorkstation.$(O) $(LIB_GL); \
            $(CLASSLIB_LD) $(LD_REL_FLAG) -o GLXWorkstation.$(O) __GLXWorkstation.$(O) $(LIB_GL); \
        else \
            echo cp __GLXWorkstation.$(O) GLXWorkstation.$(O); \
            cp __GLXWorkstation.$(O) GLXWorkstation.$(O); \
        fi

glLib:
        @-if [ -d ../support/VGL ]; then \
            (cd ../support/VGL ; $(MAKE) ) ; \
        fi

DeviceWorkstation.$(O):
        $(MAKE) $(BIG_STFILE_RULE) BIG_FILE=DeviceWorkstation \
                CC="$(CC)" OPT="$(OPT)" SEPINITCODE="$(SEPINITCODE)" \
                CLASSLIB_CC="$(CLASSLIB_CC)" CLASSLIB_OPT="$(CLASSLIB_OPT)"

SimpleView.$(O):
        $(MAKE) $(BIG_STFILE_RULE) BIG_FILE=SimpleView \
                CC="$(CC)" OPT="$(OPT)" SEPINITCODE="$(SEPINITCODE)" \
                CLASSLIB_CC="$(CLASSLIB_CC)" CLASSLIB_OPT="$(CLASSLIB_OPT)"

Image.$(O):
        $(MAKE) $(BIG_STFILE_RULE) BIG_FILE=Image \
                CC="$(CC)" OPT="$(OPT)" SEPINITCODE="$(SEPINITCODE)" \
                CLASSLIB_CC="$(CLASSLIB_CC)" CLASSLIB_OPT="$(CLASSLIB_OPT)"

#OGLWorkstation.$(O): OGLWorkstation.st
#       $(MAKE) $(BIG_STFILE_RULE) BIG_FILE=OGLWorkstation CC=$(CC) OPT="$(OPT)" \
#               XDEFS="-DOPENGL -I$(MESA_DIR)/include" SEPINITCODE=-sepInitCode ZFLAG=
#       $(CLASSLIB_LD) -r -o ttt.$(O) OGLWorkstation.$(O) \
#               $(MESA_DIR)/lib/libMesaGL.a \
#               $(MESA_DIR)/lib/libMesaGLU.a \
#               $(MESA_DIR)/lib/libMesaaux.a
#       mv ttt.$(O) OGLWorkstation.$(O)

OGLWorkstation.$(O): GLXWorkstation.st
        cp GLXWorkstation.st OGLWorkstation.st
        $(MAKE) $(BIG_STFILE_RULE) BIG_FILE=OGLWorkstation \
                CC="$(CC)" OPT="$(OPT)" \
                CLASSLIB_CC="$(CLASSLIB_CC)" CLASSLIB_OPT="$(CLASSLIB_OPT)" \
                CC_VOGL_FLAGS="$(CC_MESA_INCLUDE) -DOPENGL -DMESA -UVGL -UGLX"\
                SEPINITCODE=-sepInitCode ZFLAG=
        $(CLASSLIB_LD) -r -o ttt.$(O) OGLWorkstation.$(O) \
                $(MESA_DIR)/lib/libMesaGL.a \
                $(MESA_DIR)/lib/libMesaGLU.a \
                $(MESA_DIR)/lib/libMesaaux.a
        mv ttt.$(O) OGLWorkstation.$(O)
        rm -f OGLWorkstation.st

#ogl:
#       $(MAKE) OGLWorkstation.o XDEFS="-DOPENGL -I$(VOGL_DIR) -DSHAPE" SEPINITCODE=-sepInitCode ZFLAG=
#       mv OGLWorkstation.o ttt.o
#       $(CLASSLIB_LD) -r -o OGLWorkstation.o ttt.o \
#               $(TOP)/support/MESA/Mesa1.2.5/lib/libMesaGL.a   \
#               $(TOP)/support/MESA/Mesa1.2.5/lib/libMesaGLU.a  \
#               $(TOP)/support/MESA/Mesa1.2.5/lib/libMesaaux.a  \
#               /lib/libc.so.4

#
# on my 320H, do not compile DeviceWorkstation with -O2;
# compiler is running out of space ...
#
#AIX_BIGGIES:
#       $(MAKE) GraphicsContext.$(O)
#       $(MAKE) DeviceGraphicsContext.$(O)
#       $(MAKE) OPT= DeviceWorkstation.$(O)
#       $(MAKE) OPT= XWorkstation.$(O)
#       $(MAKE) OPT= Image.$(O)
#       $(MAKE) OPT= SimpleView.$(O)

#
# prelink those - cannot mix non-shared with shared objects (sigh)
#
AIX_SHARED_XWORKSTATION:
        $(MAKE) GraphicsDevice.$(O) HostGraphicsDevice.$(O) DeviceWorkstation.$(O)
        $(MAKE) aix_exports LIBNAME=XWorkstation ENTRY=XWorkstation
        @-echo "__XErrorHandler__" >> XWorkstation.exp
        @-echo "__XIOErrorHandler__" >> XWorkstation.exp
        $(MAKE) XWorkstation$(O_EXT) \
                ENTRY_INIT=XWorkstation \
                AIX_LOCAL_LIBS="$(LIBX)"

AIX_SHARED_GLXWORKSTATION:
        $(MAKE) GraphicsDevice.$(O) HostGraphicsDevice.$(O) DeviceWorkstation.$(O)
        $(MAKE) aix_exports LIBNAME=XWorkstation ENTRY=XWorkstation
        @-echo "__XErrorHandler__" >> XWorkstation.exp
        @-echo "__XIOErrorHandler__" >> XWorkstation.exp
        $(MAKE) GLXWorkstation$(O_EXT) \
                ENTRY_INIT=GLXWorkstation \
                AIX_LOCAL_LIBS="-bI:XWorkstation.exp $(LIB_GL) $(LIBX) -lm"
        rm -f XWorkstation.exp

#
# in (my) aix system, those cannot be compiled with
# the optimizer - running out of space ...
#
AIX::   GraphicsContext.$(O) DeviceGraphicsContext.$(O) GraphicsMedium.$(O) DisplaySurface.$(O)
        $(MAKE) OPT="" SimpleView.$(O)
        $(MAKE) OPT="" Image.$(O)
        $(MAKE) $(AIX_XWORKSTATION_RULE) $(AIX_GLXWORKSTATION_RULE)

#
# on HP, big classes blow the C-preprocessor (stops with "too much defining" error)
#
#HP::
#
#HPbigFiles:
#       $(MAKE) $(BIG_STFILE_RULE) BIG_FILE=Color CC=$(CC) OPT="$(OPT)"
#       $(MAKE) $(BIG_STFILE_RULE) BIG_FILE=DeviceGraphicsContext CC=$(CC) OPT="$(OPT)"
'

    "Modified: / 14-09-2011 / 13:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 23-10-2018 / 18:49:34 / Claus Gittinger"
!

localDefines_unix
    ^ '$(XINCLUDE) $(XDEFS) $(CC_3D_FLAGS)'
!

localIncludes
    ^ '$(OPTIONAL_SUPPORT_XLIB_INCLUDE)'
!

stcOptimizationOptions
    ^ '+optinline +optinline2'
!

stcWarningOptions
    ^ '-warnNonStandard -warnUnused'
! !

!stx_libview class methodsFor:'description - contents'!

classNamesAndAttributes
    "lists the classes which are to be included in the project.
     Each entry in the list may be: a single class-name (symbol),
     or an array-literal consisting of class name and attributes.
     Attributes are: #autoload or #<os> where os is one of win32, unix,..."

    ^ #(
        "<className> or (<className> attributes...) in load order"
        AbstractBackground
        AbstractBorder
        Color
        Colormap
        Controller
        Cursor
        DeviceHandle
        DisplayTransform
        Event
        FillStyle
        FontDescription
        GraphicsContext
        GraphicsDevice
        GraphicsMedium
        Image
        ImageReader
        KeyboardForwarder
        KeyboardMap
        ResourcePack
        WindowGroup
        WindowSensor
        #'stx_libview'
        BeveledBorder
        BitmapFillStyle
        BitmapFont
        Border
        ColorPalette
        CompoundFont
        Depth16Image
        Depth1Image
        Depth24Image
        Depth2Image
        Depth32Image
        Depth48Image
        Depth4Image
        Depth64Image
        Depth8Image
        DeviceGraphicsContext
        DisplaySurface
        Font
        Form
        GradientBackground
        GradientFillStyle
        HostGraphicsDevice
        ImageBackground
        MacButtonBorder
        NoBackground
        OrientedFillStyle
        RoundButtonBorder
        ScaleTransform
        SimpleBorder
        SolidBackground
        SolidFillStyle
        SynchronousWindowSensor
        TranslationTransform
        TranslucentColor
        ViewStyle
        WindowEvent
        (XftFontDescription unix)
        DeviceWorkstation
        DisplayRootView
        FixedPalette
        ImageMask
        MacFlatButtonBorder
        MappedPalette
        RoundedBorder
        SimpleView
        WidgetEvent
        WindowingTransformation
        FixedPaletteWithAlpha
        MonoMappedPalette
        ShadowView
        View
        (XEmbedContainerView unix)
        (XWorkstation unix)
        (X11GraphicsContext unix)
        (GLXWorkstation unix)
        TopView
        PopUpView
        StandardSystemView
        ModalBox
        (AlphaMask autoload)
        (ControllerWithMenu autoload)
        (GraphicsAttributes autoload)
        (GuiServerWorkstation autoload)
        (MDIChildView autoload)
        (NeXTWorkstation autoload)
        (WinWorkstation win32)
    )

    "Modified (format): / 31-01-2017 / 13:35:18 / stefan"
    "Modified: / 22-06-2018 / 11:57:09 / Stefan Vogel"
!

extensionMethodNames
    "lists the extension methods which are to be included in the project.
     Entries are 2-element array literals, consisting of class-name and selector.
     A correponding method with real names must be present in my concrete subclasses
     if it has extensions."

    ^ #(
        Object isColormap
    )
! !

!stx_libview class methodsFor:'description - project information'!

companyName
    "Return a companyname which will appear in <lib>.rc"

    ^ 'Claus Gittinger / eXept Software AG'

    "Modified: / 18-11-2016 / 11:47:54 / cg"
!

description
    "Return a description string which will appear in nt.def / bc.def"

    ^ 'Smalltalk/X Low Level Graphic Interfacing'

    "Modified: / 14-09-2006 / 10:54:54 / cg"
!

legalCopyright
    "Return a copyright string which will appear in <lib>.rc"

    ^ 'Copyright Claus Gittinger 1988\nCopyright eXept Software AG 2012'

    "Modified: / 18-11-2016 / 12:19:05 / cg"
!

productName
    "Return a product name which will appear in <lib>.rc"

    ^ 'Smalltalk/X'
! !

!stx_libview class methodsFor:'documentation'!

version
    ^ '$Header$'
!

version_CVS
    ^ '$Header$'
! !