Form.st
author sr
Tue, 10 May 2016 15:02:11 +0200
changeset 7355 b54b8aebbb90
parent 7354 4a9f164c4605
child 7365 05f5fe42c919
child 7381 b877572cc0d4
permissions -rw-r--r--
#FEATURE by sr class: Form changed: #width:height:depth: handle pixmap allocation failure in device more graceful
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7354
4a9f164c4605 #BUGFIX by sr
sr
parents: 7260
diff changeset
     1
"{ Encoding: utf8 }"
4a9f164c4605 #BUGFIX by sr
sr
parents: 7260
diff changeset
     2
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     3
"
6
7ee0cfde237d *** empty log message ***
claus
parents: 5
diff changeset
     4
 COPYRIGHT (c) 1989 by Claus Gittinger
78
1c9c22df3251 *** empty log message ***
claus
parents: 71
diff changeset
     5
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    13
"
3192
62b7b6c6419b halt with message arg
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
    14
"{ Package: 'stx:libview' }"
62b7b6c6419b halt with message arg
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
    15
6860
73f5e3b55940 class: Form
Claus Gittinger <cg@exept.de>
parents: 6533
diff changeset
    16
"{ NameSpace: Smalltalk }"
73f5e3b55940 class: Form
Claus Gittinger <cg@exept.de>
parents: 6533
diff changeset
    17
721
ba7861418087 renamed DisplayMedium to Graphicsmedium & changed inheritance
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    18
GraphicsMedium subclass:#Form
412
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
    19
	instanceVariableNames:'depth localColorMap offset data fileName'
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
    20
	classVariableNames:'VeryLightGreyForm LightGreyForm GreyForm DarkGreyForm
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
    21
		VeryDarkGreyForm AdditionalBitmapDirectoryNames
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
    22
		BlackAndWhiteColorMap DitherPatternArray'
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
    23
	poolDictionaries:''
3921
7bc2e9c7d9a4 category
Claus Gittinger <cg@exept.de>
parents: 3891
diff changeset
    24
	category:'Compatibility-ST80-Graphics-Display Objects'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    25
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    26
1907
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
    27
DeviceHandle subclass:#DeviceFormHandle
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
    28
	instanceVariableNames:''
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
    29
	classVariableNames:''
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
    30
	poolDictionaries:''
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
    31
	privateIn:Form
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
    32
!
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
    33
4173
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
    34
Form subclass:#ImageForm
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
    35
	instanceVariableNames:''
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
    36
	classVariableNames:''
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
    37
	poolDictionaries:''
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
    38
	privateIn:Form
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
    39
!
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
    40
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
    41
!Form class methodsFor:'documentation'!
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    42
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    43
copyright
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    44
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    45
 COPYRIGHT (c) 1989 by Claus Gittinger
78
1c9c22df3251 *** empty log message ***
claus
parents: 71
diff changeset
    46
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    47
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    48
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    49
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    50
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    51
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    52
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    53
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    54
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    55
!
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    56
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    57
documentation
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    58
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    59
    Instances of this class represent forms (i.e. bit- and pixmaps)
590
fc18ba574a4d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    60
    which can be created on a drawing device. 
fc18ba574a4d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    61
    In X, these device resources are XPixmaps.
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    62
    Not all devices will support forms.
134
claus
parents: 133
diff changeset
    63
claus
parents: 133
diff changeset
    64
    NOTICE:
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    65
	the Form class is a historic leftover and now only used for real
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    66
	device forms (i.e. on devices which support downloading bitmaps).
590
fc18ba574a4d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 589
diff changeset
    67
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    68
	In your application, you should always use Image, both for compatibility
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    69
	with ST-80 and for device independence, since Form may not be supported
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    70
	by all devices.
589
2c119dc32f8c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
    71
935
e71b1be3eb6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
    72
    WARNING:
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    73
	Forms created on some device may not be recreatable, when an
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    74
	image is restarted on a display with different display capabilities.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    75
	For example, a 24bit truecolor form will be lost when the image is
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    76
	saved and restarted in an 8bit or monochrome display.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    77
	Worse: the information is completely lost.
935
e71b1be3eb6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
    78
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    79
	With images, the original information is always preserved, although
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    80
	the display may be with less resolution, dithered or otherwise
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    81
	approximated.
935
e71b1be3eb6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 927
diff changeset
    82
591
d071af7739db commentary
Claus Gittinger <cg@exept.de>
parents: 590
diff changeset
    83
    [See also:]
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    84
	Image DeviceDrawable
610
f6951a01350f documentation
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
    85
f6951a01350f documentation
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
    86
    [author:]
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    87
	Claus Gittinger
46
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    88
"
7b331e9012fd *** empty log message ***
claus
parents: 35
diff changeset
    89
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    90
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
    91
!Form class methodsFor:'initialization'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    92
889
253efa13c75b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
    93
flushDeviceForms
253efa13c75b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
    94
    "recreate all forms on aDevice; called by Workstation, to
253efa13c75b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
    95
     have all background bitmaps at hand, when views are restored"
253efa13c75b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
    96
253efa13c75b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
    97
    Lobby do:[:aDrawable |
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    98
	aDrawable isForm ifTrue:[
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
    99
	    (aDrawable graphicsDevice notNil) ifTrue:[
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
   100
		"now, try to recreate it"
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
   101
		aDrawable recreate.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
   102
	    ]
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
   103
	]
889
253efa13c75b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   104
    ]
253efa13c75b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   105
253efa13c75b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   106
    "Created: 18.6.1996 / 13:04:59 / cg"
927
c4bc2a7ff733 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   107
    "Modified: 5.7.1996 / 17:56:02 / cg"
889
253efa13c75b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   108
!
253efa13c75b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
   109
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   110
initialize
126
4fc31fd808c8 *** empty log message ***
claus
parents: 118
diff changeset
   111
    "initialize set of dictionaries to look for bitmaps"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   112
48194c26a46c Initial revision
claus
parents:
diff changeset
   113
    AdditionalBitmapDirectoryNames isNil ifTrue:[
4437
735d7db913eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   114
        OperatingSystem isMSWINDOWSlike ifTrue:[
6860
73f5e3b55940 class: Form
Claus Gittinger <cg@exept.de>
parents: 6533
diff changeset
   115
            AdditionalBitmapDirectoryNames := #().
4437
735d7db913eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   116
        ] ifFalse:[
735d7db913eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   117
            AdditionalBitmapDirectoryNames := #('/usr/lib/X11/bitmaps').
735d7db913eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   118
        ].
6860
73f5e3b55940 class: Form
Claus Gittinger <cg@exept.de>
parents: 6533
diff changeset
   119
73f5e3b55940 class: Form
Claus Gittinger <cg@exept.de>
parents: 6533
diff changeset
   120
        "want to be informed when returning from snapshot"
73f5e3b55940 class: Form
Claus Gittinger <cg@exept.de>
parents: 6533
diff changeset
   121
        ObjectMemory addDependent:self.
4437
735d7db913eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   122
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   123
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   124
48194c26a46c Initial revision
claus
parents:
diff changeset
   125
reinitializeAllOn:aDevice
48194c26a46c Initial revision
claus
parents:
diff changeset
   126
    "recreate all forms on aDevice; called by Workstation, to
48194c26a46c Initial revision
claus
parents:
diff changeset
   127
     have all background bitmaps at hand, when views are restored"
48194c26a46c Initial revision
claus
parents:
diff changeset
   128
127
98b0725782bd *** empty log message ***
claus
parents: 126
diff changeset
   129
    Lobby do:[:aDrawable |
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
   130
	(aDrawable graphicsDevice == aDevice) ifTrue:[
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
   131
	    aDrawable isForm ifTrue:[
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
   132
		"now, try to recreate it"
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
   133
		aDrawable recreate.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
   134
	    ]
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
   135
	]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   136
    ]
927
c4bc2a7ff733 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   137
c4bc2a7ff733 use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   138
    "Modified: 5.7.1996 / 17:55:58 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   139
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   140
870
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   141
update:something with:aParameter from:changedObject
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   142
    "sent just before snapOut and just after a snapIn"
48194c26a46c Initial revision
claus
parents:
diff changeset
   143
48194c26a46c Initial revision
claus
parents:
diff changeset
   144
    (something == #save) ifTrue:[
2823
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   145
        "get all bits from the device into saveable arrays"
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   146
        Lobby do:[:aDrawable |
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   147
            aDrawable isForm ifTrue:[
4612
4c7d5914930b oops - did not work when no XWorkstation was available
Claus Gittinger <cg@exept.de>
parents: 4563
diff changeset
   148
                (PrimitiveFailureSignal , DeviceWorkstation drawingOnClosedDeviceSignal) handle:[:ex |
2823
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   149
                    'Form [warning]: cannot fetch form bits from device' errorPrintCR
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   150
                ] do:[
2933
fd5033d6a182 ask device, if it wants to be made persistent in the snapshot image
Claus Gittinger <cg@exept.de>
parents: 2850
diff changeset
   151
                    |dev|
fd5033d6a182 ask device, if it wants to be made persistent in the snapshot image
Claus Gittinger <cg@exept.de>
parents: 2850
diff changeset
   152
fd5033d6a182 ask device, if it wants to be made persistent in the snapshot image
Claus Gittinger <cg@exept.de>
parents: 2850
diff changeset
   153
                    ((dev := aDrawable device) isNil   
fd5033d6a182 ask device, if it wants to be made persistent in the snapshot image
Claus Gittinger <cg@exept.de>
parents: 2850
diff changeset
   154
                    or:[dev isPersistentInSnapshot]) ifTrue:[
fd5033d6a182 ask device, if it wants to be made persistent in the snapshot image
Claus Gittinger <cg@exept.de>
parents: 2850
diff changeset
   155
                        aDrawable getBits
fd5033d6a182 ask device, if it wants to be made persistent in the snapshot image
Claus Gittinger <cg@exept.de>
parents: 2850
diff changeset
   156
                    ]
2823
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   157
                ]
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   158
            ]
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   159
        ]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   160
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
   161
    (something == #restarted) ifTrue:[
2823
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   162
        "remove all left-over device info"
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   163
        Lobby do:[:aDrawable |
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   164
            aDrawable isForm ifTrue:[
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   165
                aDrawable flushDeviceHandles.
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   166
                Lobby registerChange:aDrawable 
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   167
            ]
c10e30bad607 catch form-fetch bit error during save
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
   168
        ]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   169
    ]
870
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   170
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   171
    "Modified: 15.6.1996 / 15:44:09 / cg"
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   172
    "Created: 15.6.1996 / 15:47:50 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   173
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   174
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   175
!Form class methodsFor:'instance creation'!
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   176
2964
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   177
dotOfSize:size
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   178
    "create and return a form which contains a dot (filled circle)
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   179
     of the given size."
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   180
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   181
    |f|
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   182
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   183
    f := self extent:size asPoint onDevice:Screen current.
2964
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   184
    f clear.
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   185
    f fillCircle:(f center) radius:(f width min:f height) // 2.
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   186
    ^ f
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   187
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   188
    "
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   189
     (Form dotOfSize:8) inspect
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   190
     (Form dotOfSize:20) inspect
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   191
    "
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   192
!
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   193
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   194
extent:ext
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   195
    "create a new, cleared form, take dimensions from ext.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   196
     Smalltalk-80 compatibility"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   197
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   198
    |newForm|
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   199
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   200
    newForm := self width:(ext x) height:(ext y).
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   201
    newForm fill:(Color colorId:0).
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   202
    newForm paint:(Color colorId:1).
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   203
    ^ newForm
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   204
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   205
1278
85b4c4898265 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   206
extent:ext depth:d
85b4c4898265 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   207
    "create a new, cleared form.
85b4c4898265 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   208
     Smalltalk-80 compatibility"
85b4c4898265 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   209
85b4c4898265 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   210
    ^ self width:ext x height:ext y depth:d
85b4c4898265 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   211
85b4c4898265 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   212
    "Created: 27.1.1997 / 16:08:37 / cg"
85b4c4898265 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   213
    "Modified: 27.1.1997 / 16:08:50 / cg"
85b4c4898265 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   214
!
85b4c4898265 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
   215
3452
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   216
extent:ext depth:d onDevice:aDevice
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   217
    "create a new form on device, aDevice; depth is what device likes most"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   218
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   219
    ^ self width:ext x height:ext y depth:d onDevice:aDevice
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   220
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   221
    "Created: 4.4.1997 / 20:23:32 / cg"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   222
    "Modified: 4.4.1997 / 20:25:28 / cg"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   223
!
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   224
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   225
extent:ext fromArray:data
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   226
    "create a new form, take dimensions from ext, bits from data.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   227
     Smalltalk-80 compatibility."
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   228
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   229
    ^ self width:(ext x) height:(ext y) offset:0@0 fromArray:data
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   230
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   231
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   232
extent:ext fromArray:data offset:offs
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   233
    "create a new form, take dimensions from ext, bits from data.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   234
     Smalltalk-80 compatibility."
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   235
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   236
    ^ self width:(ext x) height:(ext y) offset:offs fromArray:data
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   237
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   238
3452
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   239
extent:ext fromArray:data offset:offs onDevice:aDevice
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   240
    "create a new form, take dimensions from ext, bits from data."
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   241
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   242
    ^ self width:(ext x) height:(ext y) offset:offs fromArray:data onDevice:aDevice
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   243
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   244
    "Created: 10.4.1997 / 15:36:31 / cg"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   245
!
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   246
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   247
extent:ext fromArray:data onDevice:aDevice
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   248
    "create a new form, take dimensions from ext, bits from data."
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   249
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   250
    ^ self width:(ext x) height:(ext y) fromArray:data onDevice:aDevice
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   251
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   252
    "Created: 10.4.1997 / 15:34:34 / cg"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   253
    "Modified: 10.4.1997 / 15:36:04 / cg"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   254
!
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   255
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   256
extent:ext offset:anOffset
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   257
    "create a new, cleared form, take dimensions from ext.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   258
     Smalltalk-80 compatibility"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   259
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   260
    ^ (self extent:ext) offset:anOffset.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   261
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   262
3452
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   263
extent:ext onDevice:aDevice
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   264
    "create a new form on device, aDevice; depth is what device likes most"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   265
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   266
    ^ self width:ext x height:ext y onDevice:aDevice
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   267
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   268
    "Modified: 4.4.1997 / 20:25:07 / cg"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   269
!
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   270
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   271
width:w height:h
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   272
    "create a new form on the default device"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   273
3135
f9304f22f07b handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents: 3106
diff changeset
   274
    |scr|
f9304f22f07b handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents: 3106
diff changeset
   275
f9304f22f07b handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents: 3106
diff changeset
   276
    Screen notNil ifTrue:[scr := Screen current].
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   277
    ^ self width:w height:h onDevice:scr
789
9566544d68a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   278
9566544d68a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   279
    "Modified: 4.6.1996 / 22:16:33 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   280
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   281
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   282
width:w height:h depth:d
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   283
    "create a new form on the default device"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   284
3135
f9304f22f07b handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents: 3106
diff changeset
   285
    |scr|
f9304f22f07b handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents: 3106
diff changeset
   286
f9304f22f07b handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents: 3106
diff changeset
   287
    Screen notNil ifTrue:[scr := Screen current].
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   288
    ^ self width:w height:h depth:d onDevice:scr
789
9566544d68a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   289
9566544d68a1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 746
diff changeset
   290
    "Modified: 4.6.1996 / 22:16:51 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   291
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   292
3452
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   293
width:w height:h depth:d onDevice:aDevice
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   294
    "create a new form with depth d on device, aDevice"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   295
7354
4a9f164c4605 #BUGFIX by sr
sr
parents: 7260
diff changeset
   296
    ^ (self onDevice:aDevice) width:w height:h depth:d.
3452
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   297
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   298
    "Modified: 18.1.1997 / 18:26:03 / cg"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   299
!
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   300
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   301
width:w height:h fromArray:anArray
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   302
    "create a new form on the default device"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   303
3135
f9304f22f07b handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents: 3106
diff changeset
   304
    |scr|
f9304f22f07b handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents: 3106
diff changeset
   305
f9304f22f07b handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents: 3106
diff changeset
   306
    Screen notNil ifTrue:[scr := Screen current].
4768
f61bf4ab2fba ...:on: -> ...:onDevice:
Claus Gittinger <cg@exept.de>
parents: 4642
diff changeset
   307
    ^ self width:w height:h fromArray:anArray onDevice:scr
f61bf4ab2fba ...:on: -> ...:onDevice:
Claus Gittinger <cg@exept.de>
parents: 4642
diff changeset
   308
f61bf4ab2fba ...:on: -> ...:onDevice:
Claus Gittinger <cg@exept.de>
parents: 4642
diff changeset
   309
    "Modified: / 29-05-2007 / 19:31:14 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   310
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   311
3452
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   312
width:w height:h fromArray:anArray onDevice:aDevice
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   313
    "create a new form on device, aDevice and
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   314
     initialize the pixels from anArray"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   315
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   316
    ^ (self onDevice:aDevice) width:w height:h fromArray:anArray
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   317
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   318
    "Modified: 18.1.1997 / 18:26:24 / cg"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   319
!
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   320
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   321
width:w height:h offset:offs fromArray:anArray
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   322
    "create a new form on the default device"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   323
3135
f9304f22f07b handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents: 3106
diff changeset
   324
    |scr|
f9304f22f07b handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents: 3106
diff changeset
   325
f9304f22f07b handle the case, where not Screen is available
Claus Gittinger <cg@exept.de>
parents: 3106
diff changeset
   326
    Screen notNil ifTrue:[scr := Screen current].
4774
3cf14143cbad more obsolete selector usage ...
Stefan Vogel <sv@exept.de>
parents: 4770
diff changeset
   327
    ^ self width:w height:h offset:offs fromArray:anArray onDevice:scr
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   328
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   329
3452
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   330
width:w height:h offset:offs fromArray:anArray onDevice:aDevice
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   331
    "create a new form on the default device"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   332
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   333
    ^ (self onDevice:aDevice) width:w height:h offset:offs fromArray:anArray
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   334
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   335
    "Modified: 18.1.1997 / 18:26:28 / cg"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   336
    "Created: 10.4.1997 / 15:35:07 / cg"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   337
!
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   338
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   339
width:w height:h onDevice:aDevice
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   340
    "create a new form on device, aDevice; depth is what device likes most"
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   341
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   342
    ^ (self onDevice:aDevice) width:w height:h
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   343
58e757c27a76 compatibility methods
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
   344
    "Modified: 18.1.1997 / 18:26:31 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   345
! !
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   346
3891
48c1f9ab83e3 category
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   347
!Form class methodsFor:'Compatibility-ST80'!
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   348
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   349
and
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   350
    "return a constant usable as bitblt-combinationrule.
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   351
     In ST-80rel2.x, these used to be numeric constants; in ST/X,
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   352
     these are symbolic."
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   353
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   354
    ^ #and
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   355
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   356
    "Modified: 2.5.1996 / 11:41:23 / cg"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   357
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   358
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   359
black
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   360
    "ST80 compatibility;
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   361
     In old st80, you could use `Form black' for drawing 
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   362
     - here we return the black color."
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   363
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   364
    ^ Color black
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   365
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   366
    "Modified: 2.5.1996 / 11:44:17 / cg"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   367
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   368
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   369
darkGray
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   370
    "ST80 compatibility;
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   371
     In old st80, you could use `Form darkGray' for drawing 
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   372
     - here we return the darkGray color."
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   373
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   374
    ^ Color darkGray
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   375
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   376
    "Modified: 2.5.1996 / 11:44:06 / cg"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   377
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   378
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   379
darkGrey
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   380
    "ST80 compatibility;
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   381
     In old st80, you could use `Form darkGrey' for drawing 
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   382
     - here we return the darkGrey color."
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   383
746
f5479d603f64 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
   384
    ^ Color darkGray
f5479d603f64 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
   385
f5479d603f64 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
   386
    "Modified: 28.5.1996 / 20:47:54 / cg"
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   387
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   388
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   389
gray
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   390
    "ST80 compatibility;
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   391
     In old st80, you could use `Form gray' for drawing 
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   392
     - here we return the grey color."
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   393
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   394
    ^ Color gray
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   395
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   396
    "Modified: 2.5.1996 / 11:43:44 / cg"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   397
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   398
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   399
grey
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   400
    "ST80 compatibility;
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   401
     In old st80, you could use `Form grey' for drawing 
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   402
     - here we return the grey color."
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   403
6533
560075ecc897 class: Form
Claus Gittinger <cg@exept.de>
parents: 6483
diff changeset
   404
    ^ Color gray
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   405
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   406
    "Modified: 2.5.1996 / 11:43:17 / cg"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   407
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   408
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   409
lightGray
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   410
    "ST80 compatibility;
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   411
     In old st80, you could use `Form lightGray' for drawing 
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   412
     - here we return the lightGray color."
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   413
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   414
    ^ Color lightGray
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   415
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   416
    "Created: 2.5.1996 / 11:40:07 / cg"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   417
    "Modified: 2.5.1996 / 11:43:21 / cg"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   418
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   419
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   420
lightGrey
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   421
    "ST80 compatibility;
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   422
     In old st80, you could use `Form lightGray' for drawing 
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   423
     - here we return the lightGray color."
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   424
746
f5479d603f64 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
   425
    ^ Color lightGray
f5479d603f64 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
   426
f5479d603f64 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
   427
    "Modified: 28.5.1996 / 20:53:28 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   428
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   429
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   430
over
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   431
    "return a constant usable as bitblt-combinationrule.
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   432
     In ST-80rel2.x, these used to be numeric constants; in ST/X,
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   433
     these are symbolic."
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   434
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   435
    ^ #copy
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   436
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   437
    "Modified: 2.5.1996 / 11:41:31 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   438
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   439
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   440
paint
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   441
    "return a constant usable as bitblt-combinationrule.
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   442
     In ST-80rel2.x, these used to be numeric constants; in ST/X,
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   443
     these are symbolic."
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   444
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   445
    ^ #copy
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   446
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   447
    "Modified: 2.5.1996 / 11:41:40 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   448
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   449
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   450
reverse
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   451
    "return a constant usable as bitblt-combinationrule.
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   452
     In ST-80rel2.x, these used to be numeric constants; in ST/X,
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   453
     these are symbolic."
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   454
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   455
    ^ #xor
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   456
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   457
    "Modified: 2.5.1996 / 11:41:45 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   458
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   459
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   460
under
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   461
    "return a constant usable as bitblt-combinationrule.
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   462
     In ST-80rel2.x, these used to be numeric constants; in ST/X,
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   463
     these are symbolic."
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   464
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   465
    ^ #or
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   466
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   467
    "Modified: 2.5.1996 / 11:41:49 / cg"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   468
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   469
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   470
white
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   471
    "ST80rel2.x compatibility;
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   472
     In old st80, you could use `Form white' for drawing 
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   473
     - here we return the white color."
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   474
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   475
    ^ Color white
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   476
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   477
    "Modified: 2.5.1996 / 11:42:50 / cg"
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
   478
! !
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
   479
3891
48c1f9ab83e3 category
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   480
!Form class methodsFor:'Compatibility-Squeak'!
3142
4b5c726c0630 category renamining
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   481
4768
f61bf4ab2fba ...:on: -> ...:onDevice:
Claus Gittinger <cg@exept.de>
parents: 4642
diff changeset
   482
extent:ext depth:d bits:data
f61bf4ab2fba ...:on: -> ...:onDevice:
Claus Gittinger <cg@exept.de>
parents: 4642
diff changeset
   483
    ^ self width:(ext x) height:(ext y) offset:0 fromArray:data
f61bf4ab2fba ...:on: -> ...:onDevice:
Claus Gittinger <cg@exept.de>
parents: 4642
diff changeset
   484
f61bf4ab2fba ...:on: -> ...:onDevice:
Claus Gittinger <cg@exept.de>
parents: 4642
diff changeset
   485
    "Created: / 26-05-2007 / 22:35:12 / cg"
f61bf4ab2fba ...:on: -> ...:onDevice:
Claus Gittinger <cg@exept.de>
parents: 4642
diff changeset
   486
!
f61bf4ab2fba ...:on: -> ...:onDevice:
Claus Gittinger <cg@exept.de>
parents: 4642
diff changeset
   487
3142
4b5c726c0630 category renamining
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   488
extent:ext depth:d fromArray:data offset:offs
4b5c726c0630 category renamining
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   489
4165
b24a5c2adcb2 Do not use obsolete method #readFromFile: in #onDevice.
Stefan Vogel <sv@exept.de>
parents: 3921
diff changeset
   490
    d ~~ 1 ifTrue:[self error:'unsupported depth' mayProceed:true].       
b24a5c2adcb2 Do not use obsolete method #readFromFile: in #onDevice.
Stefan Vogel <sv@exept.de>
parents: 3921
diff changeset
   491
    ^ self width:(ext x) height:(ext y) offset:offs fromArray:data
3142
4b5c726c0630 category renamining
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   492
! !
4b5c726c0630 category renamining
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   493
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   494
!Form class methodsFor:'cleanup'!
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   495
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   496
lowSpaceCleanup
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   497
    "cleanup in low-memory situations"
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   498
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   499
    DitherPatternArray := nil
12
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   500
! !
9f0995fac1fa *** empty log message ***
claus
parents: 6
diff changeset
   501
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   502
!Form class methodsFor:'file search'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   503
48194c26a46c Initial revision
claus
parents:
diff changeset
   504
findBitmapFile:fileName
6227
72c2836e3151 class: Form
Stefan Vogel <sv@exept.de>
parents: 6143
diff changeset
   505
    <resource: #obsolete>
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   506
    "find the bitmap file in one of the standard places;
48194c26a46c Initial revision
claus
parents:
diff changeset
   507
     return the pathName or nil"
48194c26a46c Initial revision
claus
parents:
diff changeset
   508
4642
9eb7fed99649 bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   509
    |path|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   510
48194c26a46c Initial revision
claus
parents:
diff changeset
   511
    ((fileName at:1) == $/) ifTrue:[^ fileName].
48194c26a46c Initial revision
claus
parents:
diff changeset
   512
    (fileName startsWith:'../') ifTrue:[^ fileName].
48194c26a46c Initial revision
claus
parents:
diff changeset
   513
    (fileName startsWith:'./') ifTrue:[^ fileName].
127
98b0725782bd *** empty log message ***
claus
parents: 126
diff changeset
   514
    fileName asFilename exists ifTrue:[^ fileName].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   515
4642
9eb7fed99649 bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   516
    path := Smalltalk getBitmapFileName:fileName.
9eb7fed99649 bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   517
    path notNil ifTrue:[
9eb7fed99649 bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   518
        ^ path
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   519
    ].
4642
9eb7fed99649 bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   520
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   521
    AdditionalBitmapDirectoryNames notNil ifTrue:[
4642
9eb7fed99649 bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   522
        AdditionalBitmapDirectoryNames do:[:aPath |
9eb7fed99649 bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   523
            path := aPath , '/' , fileName.
9eb7fed99649 bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   524
            (OperatingSystem isReadable:path) ifTrue:[
9eb7fed99649 bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   525
                ^ path
9eb7fed99649 bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   526
            ]
9eb7fed99649 bitmap file finding cleanup
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   527
        ]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   528
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
   529
    ^ nil
48194c26a46c Initial revision
claus
parents:
diff changeset
   530
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   531
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   532
!Form class methodsFor:'fileIn/Out'!
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
   533
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   534
fromFile:filename
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   535
    "create a new form taking the bits from a file on the default device.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   536
     WARNING:
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   537
     Please do no longer use this, since it will not work
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   538
     correctly in multi-display applications (creates the form on the
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   539
     default Display).
7106
52956049570c #DOCUMENTATION
mawalch
parents: 6860
diff changeset
   540
     Use #fromFile:on: and pass the device as argument."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   541
3431
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
   542
    <resource:#obsolete>
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
   543
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   544
    self obsoleteMethodWarning:'please use Image>>fromFile:'.
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   545
    ^ self fromFile:filename on:Screen current
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   546
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   547
    "Modified: 19.12.1996 / 13:59:09 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   548
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   549
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   550
fromFile:filename on:aDevice
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   551
    "create a new form on device, aDevice and
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   552
     initialize the pixels from the file filename"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   553
3431
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
   554
    <resource:#obsolete>
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
   555
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   556
    self obsoleteMethodWarning:'please use Image>>fromFile:'.
1741
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
   557
    ^ (self onDevice:aDevice) readFromFile:filename
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   558
1741
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
   559
    "Modified: 5.6.1997 / 21:05:59 / cg"
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   560
!
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
   561
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   562
fromFile:filename resolution:dpi
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   563
    "create a new form taking the bits from a file on the default device
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   564
     the data in the file is assumed to be for dpi resolution;
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   565
     if it is different from the displays resolution, magnify or
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   566
     shrink the picture (but only in integer magnification steps).
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   567
     WARNING:
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   568
     Please do no longer use this, since it will not work
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   569
     correctly in multi-display applications (creates the form on the
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   570
     default Display).
7106
52956049570c #DOCUMENTATION
mawalch
parents: 6860
diff changeset
   571
     Use #fromFile:resolution:on: and pass the device as argument."
98
cd6af625d477 *** empty log message ***
claus
parents: 89
diff changeset
   572
3431
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
   573
    <resource:#obsolete>
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
   574
1145
d3dc78117036 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
   575
    self obsoleteMethodWarning:'please use Image>>fromFile:'.
1741
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
   576
    ^ (self onDevice:Screen current) readFromFile:filename resolution:dpi
1145
d3dc78117036 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1142
diff changeset
   577
1741
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
   578
    "Modified: 5.6.1997 / 21:06:03 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   579
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   580
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   581
fromFile:filename resolution:dpi on:aDevice
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   582
    "create a new form on device, aDevice and
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   583
     initialize the pixels from the file filename;
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   584
     the data in the file is assumed to be for dpi resolution;
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   585
     if it is different from the displays resolution, magnify or
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   586
     shrink the picture (but only in integer magnification steps)"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   587
3431
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
   588
    <resource:#obsolete>
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
   589
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   590
    self obsoleteMethodWarning:'please use Image>>fromFile:'.
1741
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
   591
    ^ (self onDevice:aDevice) readFromFile:filename resolution:dpi
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   592
1741
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
   593
    "Modified: 5.6.1997 / 21:05:54 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   594
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   595
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   596
readFrom:fileName
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   597
    "same as Form>>fromFile: - for ST-80 compatibility.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   598
     WARNING:
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   599
     Please do no longer use this, since it will not work
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   600
     correctly in multi-display applications (creates the form on the
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   601
     default Display).
4165
b24a5c2adcb2 Do not use obsolete method #readFromFile: in #onDevice.
Stefan Vogel <sv@exept.de>
parents: 3921
diff changeset
   602
     Use #fromFile:on: and pass the device as argument."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   603
3431
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
   604
    <resource:#obsolete>
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
   605
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   606
    self obsoleteMethodWarning:'please use Image>>fromFile:'.
5915
8b58c9e08f9e changed: #readFrom:
Stefan Vogel <sv@exept.de>
parents: 5213
diff changeset
   607
    ^ (self onDevice:Screen current) readFromFile:fileName.
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   608
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   609
    "Modified: 19.12.1996 / 13:59:50 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   610
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   611
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   612
!Form class methodsFor:'obsolete instance creation'!
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   613
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   614
darkGreyFormOn:aDevice
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   615
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   616
    "return a darkGrey form"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   617
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   618
    |f|
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   619
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   620
    ((aDevice == Display) and:[DarkGreyForm notNil]) ifTrue:[
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   621
        ^ DarkGreyForm
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   622
    ].
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   623
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   624
    f := self width:8 height:4 fromArray:(self darkGreyFormBits) onDevice:aDevice.
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   625
    (aDevice == Display) ifTrue:[
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   626
        DarkGreyForm := f
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   627
    ].
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   628
    ^ f
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   629
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   630
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   631
extent:ext depth:d on:aDevice
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   632
    <resource: #obsolete>
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   633
    "create a new form on device, aDevice; depth is what device likes most"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   634
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   635
    self obsoleteMethodWarning:'use #extent:depth:onDevice:'.
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   636
    ^ self width:ext x height:ext y depth:d onDevice:aDevice
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   637
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   638
    "Created: / 04-04-1997 / 20:23:32 / cg"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   639
    "Modified: / 27-05-2007 / 12:39:51 / cg"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   640
!
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   641
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   642
extent:ext fromArray:data offset:offs on:aDevice
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   643
    <resource: #obsolete>
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   644
    "create a new form, take dimensions from ext, bits from data."
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   645
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   646
    self obsoleteMethodWarning:'use #extent:fromArray:offset:onDevice:'.
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   647
    ^ self width:(ext x) height:(ext y) offset:offs fromArray:data onDevice:aDevice
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   648
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   649
    "Created: / 10-04-1997 / 15:36:31 / cg"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   650
    "Modified: / 27-05-2007 / 12:42:26 / cg"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   651
!
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   652
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   653
extent:ext fromArray:data on:aDevice
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   654
    <resource: #obsolete>
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   655
    "create a new form, take dimensions from ext, bits from data."
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   656
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   657
    self obsoleteMethodWarning:'use #extent:fromArray:onDevice:'.
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   658
    ^ self width:(ext x) height:(ext y) fromArray:data onDevice:aDevice
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   659
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   660
    "Created: / 10-04-1997 / 15:34:34 / cg"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   661
    "Modified: / 27-05-2007 / 12:41:57 / cg"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   662
!
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   663
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   664
extent:ext on:aDevice
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   665
    <resource: #obsolete>
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   666
    "create a new form on device, aDevice; depth is what device likes most"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   667
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   668
    self obsoleteMethodWarning:'use #extent:onDevice:'.
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   669
    ^ self width:ext x height:ext y onDevice:aDevice
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   670
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   671
    "Modified: / 27-05-2007 / 12:41:42 / cg"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   672
!
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   673
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   674
grey:percent on:aDevice
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   675
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   676
    "return a form for dithering"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   677
2827
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
   678
    (percent < 20) ifTrue:[^ Color black onDevice:aDevice].
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   679
    (percent < 40) ifTrue:[^ self darkGreyFormOn:aDevice].
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   680
    (percent < 60) ifTrue:[^ self mediumGreyFormOn:aDevice].
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   681
    (percent < 80) ifTrue:[^ self lightGreyFormOn:aDevice].
2827
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
   682
    ^ Color white onDevice:aDevice
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   683
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   684
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   685
lightGreyFormOn:aDevice
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   686
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   687
    "return a lightGrey form"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   688
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   689
    |f|
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   690
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   691
    ((aDevice == Display) and:[LightGreyForm notNil]) ifTrue:[
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   692
        ^ LightGreyForm
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   693
    ].
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   694
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   695
    f := self width:8 height:4 fromArray:(self lightGreyFormBits) onDevice:aDevice.
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   696
    (aDevice == Display) ifTrue:[
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   697
        LightGreyForm := f
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   698
    ].
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   699
    ^ f
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   700
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   701
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   702
mediumGreyFormOn:aDevice
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   703
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   704
    "return a grey form"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   705
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   706
    |f|
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   707
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   708
    ((aDevice == Display) and:[GreyForm notNil]) ifTrue:[
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   709
        ^ GreyForm
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   710
    ].
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   711
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   712
    f := self width:8 height:4 fromArray:(self greyFormBits) onDevice:aDevice.
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   713
    (aDevice == Display) ifTrue:[
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   714
        GreyForm := f
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   715
    ].
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   716
    ^ f
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   717
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   718
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   719
veryDarkGreyFormOn:aDevice
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   720
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   721
    "return a veryDarkGrey form"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   722
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   723
    |f|
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   724
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   725
    ((aDevice == Display) and:[VeryDarkGreyForm notNil]) ifTrue:[
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   726
        ^ VeryDarkGreyForm
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   727
    ].
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   728
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   729
    f := self width:8 height:4 fromArray:(self veryDarkGreyFormBits) onDevice:aDevice.
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   730
    (aDevice == Display) ifTrue:[
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   731
        VeryDarkGreyForm := f
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   732
    ].
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   733
    ^ f
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   734
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   735
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   736
veryLightGreyFormOn:aDevice
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   737
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   738
    "return a veryLightGrey form"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   739
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   740
    |f|
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   741
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   742
    ((aDevice == Display) and:[VeryLightGreyForm notNil]) ifTrue:[
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   743
        ^ VeryLightGreyForm
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   744
    ].
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   745
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   746
    f := self width:8 height:4 fromArray:(self veryLightGreyFormBits) onDevice:aDevice.
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   747
    (aDevice == Display) ifTrue:[
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
   748
        VeryLightGreyForm := f
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   749
    ].
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   750
    ^ f
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   751
!
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   752
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   753
width:w height:h depth:d on:aDevice
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   754
    <resource: #obsolete>
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   755
    "create a new form with depth d on device, aDevice"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   756
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   757
    self obsoleteMethodWarning:'use #width:height:depth:onDevice:'.
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   758
    ^ (self onDevice:aDevice) width:w height:h depth:d
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   759
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   760
    "Modified: / 27-05-2007 / 12:40:25 / cg"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   761
!
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   762
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   763
width:w height:h fromArray:anArray on:aDevice
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   764
    <resource: #obsolete>
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   765
    "create a new form on device, aDevice and
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   766
     initialize the pixels from anArray"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   767
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   768
    self obsoleteMethodWarning:'use #width:height:fromArray:onDevice:'.
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   769
    ^ (self onDevice:aDevice) width:w height:h fromArray:anArray
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   770
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   771
    "Modified: / 27-05-2007 / 12:40:41 / cg"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   772
!
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   773
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   774
width:w height:h offset:offs fromArray:anArray on:aDevice
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   775
    <resource: #obsolete>
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   776
    "create a new form on the default device"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   777
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   778
    self obsoleteMethodWarning:'use #width:height:offset:fromArray:onDevice:'.
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   779
    ^ (self onDevice:aDevice) width:w height:h offset:offs fromArray:anArray
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   780
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   781
    "Created: / 10-04-1997 / 15:35:07 / cg"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   782
    "Modified: / 27-05-2007 / 12:41:17 / cg"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   783
!
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   784
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   785
width:w height:h on:aDevice
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   786
    <resource: #obsolete>
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   787
    "create a new form on device, aDevice; depth is what device likes most"
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   788
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   789
    self obsoleteMethodWarning:'use #width:height:onDevice:'.
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   790
    ^ (self onDevice:aDevice) width:w height:h
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   791
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   792
    "Modified: / 27-05-2007 / 12:40:57 / cg"
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   793
! !
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   794
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   795
!Form class methodsFor:'obsolete patterns'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   796
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   797
darkGreyFormBits
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   798
    <resource: #obsolete>
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   799
    "return a pattern usable to simulate darkGray on monochrome device"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   800
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   801
    ^ #(2r10111011
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   802
	2r11101110
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   803
	2r10111011
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   804
	2r11101110)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   805
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   806
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   807
grey12Bits
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   808
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   809
    "return a pattern with 12% grey, usable for dithering"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   810
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   811
    ^ #(2r00010001
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   812
	2r00000000
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   813
	2r01000100
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   814
	2r00000000)
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   815
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   816
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   817
grey25Bits
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   818
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   819
    "return a pattern with 25% grey, usable for dithering"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   820
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   821
    ^ #(2r00010001
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   822
	2r01000100
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   823
	2r00010001
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   824
	2r01000100)
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   825
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   826
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   827
grey37Bits
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   828
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   829
    "return a pattern with 37% grey, usable for dithering"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   830
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   831
    ^ #(2r00010001
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   832
	2r10101010
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   833
	2r01000100
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   834
	2r10101010)
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   835
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   836
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   837
grey50Bits
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   838
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   839
    "return a pattern with 50% grey, usable for dithering"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   840
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   841
    ^ #(2r01010101
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   842
	2r10101010
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   843
	2r01010101
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   844
	2r10101010)
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   845
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   846
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   847
grey6Bits
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   848
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   849
    "return a pattern with 6% grey, usable for dithering"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   850
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   851
    ^ #(2r00000001
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   852
	2r00000000
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   853
	2r00010000
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   854
	2r00000000)
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   855
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   856
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   857
greyFormBits
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   858
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   859
    "return a pattern usable to simulate gray on monochrome device"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   860
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   861
    ^ #(2r01010101
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   862
	2r10101010
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   863
	2r01010101
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   864
	2r10101010)
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   865
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   866
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   867
lightGreyFormBits
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   868
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   869
    "return a pattern usable to simulate lightGray on monochrome device"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   870
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   871
    ^ #(2r01000100
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   872
	2r00010001
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   873
	2r01000100
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   874
	2r00010001
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   875
	2r01000100)
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   876
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   877
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   878
veryDarkGreyFormBits
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   879
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   880
    "return a pattern usable to simulate veryDarkGray on monochrome device"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   881
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   882
    ^ #(2r01110111
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   883
	2r11111111
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   884
	2r11011101
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   885
	2r11111111)
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   886
!
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   887
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   888
veryLightGreyFormBits
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
   889
    <resource: #obsolete>
632
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   890
    "return a pattern usable to simulate veryDarkGray on monochrome device"
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   891
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   892
    ^ #(2r10001000
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   893
	2r00000000
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   894
	2r00100010
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   895
	2r00000000)
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   896
! !
28cbc6517090 marked some obsolete; grey/gray (sigh)
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   897
3880
c4c8268a2d9f method category rename
Claus Gittinger <cg@exept.de>
parents: 3812
diff changeset
   898
!Form methodsFor:'Compatibility-ST80'!
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   899
1520
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   900
destroy
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   901
    "destroy my underlying device resource(s)"
1436
c64b7abfc5fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
   902
1520
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   903
    |id|
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   904
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   905
    (id := gcId) notNil ifTrue:[
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   906
        gcId := nil.
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   907
        device destroyGC:id.
1508
5d9b6b2524c9 release device resource in close.
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
   908
    ].
5d9b6b2524c9 release device resource in close.
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
   909
1520
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   910
    (id := drawableId) notNil ifTrue:[
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   911
        drawableId := nil.
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   912
        device destroyPixmap:id.
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   913
    ].
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   914
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   915
    Lobby unregister:self.
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   916
bc88c7620d72 #close moved up.
Claus Gittinger <cg@exept.de>
parents: 1508
diff changeset
   917
    "Modified: 2.4.1997 / 19:39:52 / cg"
1436
c64b7abfc5fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
   918
!
c64b7abfc5fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
   919
2964
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   920
displayAt:aPoint
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   921
    "show the receiver on the current display screen"
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   922
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   923
    self displayOn:Screen current rootView at:aPoint
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   924
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   925
    "
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   926
     (Form dotOfSize:8) displayAt:10@10
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   927
    "
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   928
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   929
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   930
!
d9b5700dbfda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2939
diff changeset
   931
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   932
displayOn:aGC at:aPoint rule:rule
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   933
    "draw in aGC.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   934
     Smalltalk-80 (2.x) compatibility"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   935
672
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   936
    self displayOn:aGC x:aPoint x y:aPoint y rule:rule
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   937
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   938
    "Modified: 12.5.1996 / 20:16:02 / cg"
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   939
!
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   940
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   941
displayOn:aGC rule:rule
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   942
    "draw in aGC.
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   943
     Smalltalk-80 (2.x) compatibility"
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   944
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   945
    ^ self displayOn:aGC x:0 y:0 rule:rule
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   946
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   947
    "Modified: 12.5.1996 / 20:15:41 / cg"
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   948
!
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   949
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   950
displayOn:aGC x:x y:y
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   951
    "draw in aGC.
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   952
     Smalltalk-80 (2.x) compatibility"
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   953
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   954
    ^ self displayOn:aGC x:x y:y rule:#copy
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   955
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   956
    "Created: 12.5.1996 / 20:15:05 / cg"
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   957
!
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   958
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   959
displayOn:aGC x:x y:y rule:rule
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   960
    "draw in aGC.
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   961
     Smalltalk-80 (2.x) compatibility"
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   962
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   963
    |f|
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   964
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   965
    f := aGC function.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   966
    aGC function:rule.
672
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   967
    aGC displayOpaqueForm:self x:x y:y.
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   968
    aGC function:f.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   969
672
01d7c8b9d2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 632
diff changeset
   970
    "Created: 12.5.1996 / 20:15:26 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   971
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   972
1325
3c09b139de30 more st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
   973
isOpen
3c09b139de30 more st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
   974
    ^ true
3c09b139de30 more st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
   975
3c09b139de30 more st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
   976
    "Created: 10.2.1997 / 12:43:49 / cg"
3c09b139de30 more st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
   977
!
3c09b139de30 more st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
   978
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   979
offset
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   980
    "set the offset.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   981
     Smalltalk-80 compatibility"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   982
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   983
    ^ offset
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   984
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   985
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   986
offset:org
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   987
    "set the offset.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   988
     Smalltalk-80 compatibility"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   989
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   990
    offset := org
1325
3c09b139de30 more st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
   991
!
3c09b139de30 more st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
   992
3c09b139de30 more st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
   993
preferredBounds
3c09b139de30 more st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
   994
    ^ self bounds
3c09b139de30 more st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
   995
3c09b139de30 more st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
   996
    "Created: 10.2.1997 / 12:43:00 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   997
! !
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   998
3880
c4c8268a2d9f method category rename
Claus Gittinger <cg@exept.de>
parents: 3812
diff changeset
   999
!Form methodsFor:'Compatibility-Squeak'!
3020
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1000
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1001
colormapIfNeededForDepth:destDepth
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1002
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1003
    ^nil
3025
11d768e415c2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  1004
!
11d768e415c2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  1005
11d768e415c2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  1006
magnify:aRectangle by:scale smoothing:smooth
11d768e415c2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  1007
    ^ ((Image fromSubForm:aRectangle in:self) magnifiedBy:scale) asFormOn:device.
3020
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1008
! !
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1009
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1010
!Form methodsFor:'accessing'!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1011
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1012
bits
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1013
    "return a ByteArray filled with my bits -
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1014
     for depth 8 forms, 1 pixel/byte is filled;
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1015
     for depth 1 forms, 8 pixels/byte are filled
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1016
     for depth 4 forms, 2 pixels/byte are filled.
1645
67ea694c219d comment
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1017
     Padding is done row-wise to the next BYTE-boundary 
67ea694c219d comment
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1018
     If multiple pixels are contained in a single byte,
67ea694c219d comment
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1019
     left bits are in the most significant bit positions.
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1020
     (i.e. for width==13 and depth==1 it will return 2 bytes per scanline)"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1021
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1022
    |bytesPerLine   "{ Class: SmallInteger }"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1023
     bytesPerLineIn "{ Class: SmallInteger }"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1024
     inData tmpData info
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1025
     srcIndex "{ Class: SmallInteger }"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1026
     dstIndex "{ Class: SmallInteger }"
2060
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1027
     buffer spaceBitsPerPixel|
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1028
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1029
    data notNil ifTrue:[
1458
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1030
        ^ data
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1031
    ].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1032
    drawableId isNil ifTrue:[
1458
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1033
        fileName notNil ifTrue:[
3624
7996877d60fb Do not use obsolete methods.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  1034
            ^ (self onDevice:Screen current) bits
1458
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1035
        ].
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1036
        ^ nil
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1037
    ].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1038
2060
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1039
    spaceBitsPerPixel := depth.
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1040
    (depth > 8) ifTrue:[
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1041
        spaceBitsPerPixel := 16.
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1042
        (depth > 16) ifTrue:[
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1043
            spaceBitsPerPixel := 32.
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1044
            (depth > 32) ifTrue:[
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1045
                spaceBitsPerPixel := depth.
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1046
            ]
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1047
        ]
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1048
    ].
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1049
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1050
    bytesPerLine := (width * spaceBitsPerPixel + 31) // 32 * 4.
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1051
    inData := ByteArray uninitializedNew:(bytesPerLine * height).
1461
6d8b022bfcd8 renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
  1052
    info := device getBitsFromPixmapId:drawableId x:0 y:0 width:width height:height into:inData. 
398
2b35bb58a82b changes for new returned info from getBits
Claus Gittinger <cg@exept.de>
parents: 278
diff changeset
  1053
    bytesPerLineIn := (info at:#bytesPerLine).                    "what I got"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1054
    bytesPerLine := (width * depth + 7) // 8.                     "what I want"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1055
    (bytesPerLine ~~ bytesPerLineIn) ifTrue:[
1458
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1056
        "
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1057
         different padding - have to copy over row-wise
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1058
        "
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1059
        tmpData := inData.
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1060
        inData := ByteArray uninitializedNew:(bytesPerLine * height).
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1061
        srcIndex := 1.
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1062
        dstIndex := 1.
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1063
        1 to:height do:[:hi |
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1064
            inData replaceFrom:dstIndex to:(dstIndex + bytesPerLine - 1)
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1065
                          with:tmpData startingAt:srcIndex.
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1066
            dstIndex := dstIndex + bytesPerLine.
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1067
            srcIndex := srcIndex + bytesPerLineIn
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1068
        ]
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1069
    ] ifFalse:[
1458
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1070
        "
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1071
         same padding - copy over all in one chunk
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1072
        "
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1073
        (bytesPerLine * height) ~~ inData size ifTrue:[
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1074
            tmpData := inData.
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1075
            inData := ByteArray uninitializedNew:(bytesPerLine * height).
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1076
            inData replaceFrom:1 to:bytesPerLine * height with:tmpData startingAt:1
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1077
        ]
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1078
    ].
1645
67ea694c219d comment
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1079
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1080
    "
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1081
     have to reverse bytes, if not msbFirst ?
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1082
    "
915
1ac3e38e6da5 oops - accessing a forms device bits was wrong for
ca
parents: 910
diff changeset
  1083
1ac3e38e6da5 oops - accessing a forms device bits was wrong for
ca
parents: 910
diff changeset
  1084
"/    (info at:#byteOrder) ~~ #msbFirst ifTrue:[
1ac3e38e6da5 oops - accessing a forms device bits was wrong for
ca
parents: 910
diff changeset
  1085
"/        buffer := ByteArray new:bytesPerLine.
1ac3e38e6da5 oops - accessing a forms device bits was wrong for
ca
parents: 910
diff changeset
  1086
"/        dstIndex := 1.
1ac3e38e6da5 oops - accessing a forms device bits was wrong for
ca
parents: 910
diff changeset
  1087
"/        1 to:height do:[:hi |
1ac3e38e6da5 oops - accessing a forms device bits was wrong for
ca
parents: 910
diff changeset
  1088
"/            buffer replaceFrom:1 to:bytesPerLine with:inData startingAt:dstIndex.
1ac3e38e6da5 oops - accessing a forms device bits was wrong for
ca
parents: 910
diff changeset
  1089
"/            buffer reverse.
1ac3e38e6da5 oops - accessing a forms device bits was wrong for
ca
parents: 910
diff changeset
  1090
"/            inData replaceFrom:dstIndex to:dstIndex+bytesPerLine-1 with:buffer startingAt:1.
1ac3e38e6da5 oops - accessing a forms device bits was wrong for
ca
parents: 910
diff changeset
  1091
"/            dstIndex := dstIndex + bytesPerLine
1ac3e38e6da5 oops - accessing a forms device bits was wrong for
ca
parents: 910
diff changeset
  1092
"/        ]
1ac3e38e6da5 oops - accessing a forms device bits was wrong for
ca
parents: 910
diff changeset
  1093
"/    ].
1645
67ea694c219d comment
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1094
67ea694c219d comment
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1095
    "
67ea694c219d comment
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1096
     have to reverse bits, if not msbFirst ?
67ea694c219d comment
Claus Gittinger <cg@exept.de>
parents: 1571
diff changeset
  1097
    "
398
2b35bb58a82b changes for new returned info from getBits
Claus Gittinger <cg@exept.de>
parents: 278
diff changeset
  1098
    (info at:#bitOrder) ~~ #msbFirst ifTrue:[
1458
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1099
        buffer := ByteArray new:bytesPerLine.
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1100
        dstIndex := 1.
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1101
        1 to:height do:[:hi |
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1102
            buffer replaceFrom:1 to:bytesPerLine with:inData startingAt:dstIndex.
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1103
            buffer expandPixels:8 width:bytesPerLine height:1 into:buffer
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1104
                                mapping:(ImageReader reverseBits).  "/ translate only
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1105
            inData replaceFrom:dstIndex to:dstIndex+bytesPerLine-1 with:buffer startingAt:1.
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1106
            dstIndex := dstIndex + bytesPerLine
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1107
        ]
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1108
    ].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1109
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1110
    ^ inData.
1458
612420702141 splitted getBitsFrom into getBitsFromPixmap
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1111
2060
effcaa60f42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  1112
    "Modified: / 19.2.1998 / 14:47:06 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1113
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1114
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1115
bits:aByteArray
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1116
    "set the forms bits; 
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1117
     for depth-8 forms, 1 pixel/byte is expected;
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1118
     for depth-1 forms, 8 pixels/byte are expected
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1119
     for depth-4 forms, 2 pixels/byte are expected.
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1120
     Padding is expected to the next byte-boundary 
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1121
     (i.e. for width==13 and depth==1 2 bytes per scanline are expected)"
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1122
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1123
    data := aByteArray
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1124
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1125
    "Modified: 23.4.1996 / 10:06:01 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1126
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1127
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1128
bitsPerSample
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1129
    "for compatibility with Image class ..."
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1130
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1131
    ^ Array with:depth
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1132
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1133
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1134
colorMap
7238
f3b9554e8095 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7106
diff changeset
  1135
    "return the receiver's colormap"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1136
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1137
    ^ localColorMap
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1138
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1139
1436
c64b7abfc5fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  1140
colorMap:anArrayOrColorMap
7238
f3b9554e8095 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7106
diff changeset
  1141
    "set the receiver's colormap"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1142
1446
3007549e3d5e never convert a colorArray to a colorMap
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  1143
    localColorMap := anArrayOrColorMap
1436
c64b7abfc5fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  1144
1446
3007549e3d5e never convert a colorArray to a colorMap
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  1145
    "Modified: 7.3.1997 / 21:26:11 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1146
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1147
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1148
depth
7238
f3b9554e8095 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7106
diff changeset
  1149
    "return the receiver's depth"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1150
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1151
    ^ depth
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1152
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1153
2456
43f9a6f0c1e5 + #fileName
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  1154
fileName
43f9a6f0c1e5 + #fileName
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  1155
    "return the filename, from which the receiver was created,
43f9a6f0c1e5 + #fileName
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  1156
     or nil, if it was not read from a file"
43f9a6f0c1e5 + #fileName
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  1157
43f9a6f0c1e5 + #fileName
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  1158
    ^ fileName
43f9a6f0c1e5 + #fileName
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  1159
!
43f9a6f0c1e5 + #fileName
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  1160
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1161
filename
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1162
    "return the filename, from which the receiver was created,
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1163
     or nil, if it was not read from a file"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1164
2456
43f9a6f0c1e5 + #fileName
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  1165
    "/ going to be obsoleted - use #fileName
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1166
    ^ fileName
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1167
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1168
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1169
forgetBits
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1170
    "for image, which also keeps the bits - so there is
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1171
     no need to hold them again here"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1172
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1173
    data := nil
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1174
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1175
897
ad8ff0206343 mask access
Claus Gittinger <cg@exept.de>
parents: 889
diff changeset
  1176
mask
ad8ff0206343 mask access
Claus Gittinger <cg@exept.de>
parents: 889
diff changeset
  1177
    "for compatibility with images; forms have no mask/alpha channel"
ad8ff0206343 mask access
Claus Gittinger <cg@exept.de>
parents: 889
diff changeset
  1178
ad8ff0206343 mask access
Claus Gittinger <cg@exept.de>
parents: 889
diff changeset
  1179
    ^ nil
ad8ff0206343 mask access
Claus Gittinger <cg@exept.de>
parents: 889
diff changeset
  1180
ad8ff0206343 mask access
Claus Gittinger <cg@exept.de>
parents: 889
diff changeset
  1181
    "Created: 21.6.1996 / 12:52:42 / cg"
ad8ff0206343 mask access
Claus Gittinger <cg@exept.de>
parents: 889
diff changeset
  1182
!
ad8ff0206343 mask access
Claus Gittinger <cg@exept.de>
parents: 889
diff changeset
  1183
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1184
photometric
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1185
    "for compatibility with Image class ..."
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1186
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1187
    depth == 1 ifTrue:[
4938
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1188
        localColorMap isNil ifTrue:[
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1189
            ^ #whiteIs0
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1190
        ].
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1191
        ((localColorMap at:1) = Color white) ifTrue:[
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1192
            ((localColorMap at:2) = Color black) ifTrue:[
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1193
                ^ #whiteIs0
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1194
            ].
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1195
        ].
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1196
        ((localColorMap at:1) = Color black) ifTrue:[
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1197
            ((localColorMap at:2) = Color white) ifTrue:[
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1198
                ^ #blackIs0
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1199
            ].
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1200
        ].
6483
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  1201
    ] ifFalse:[depth > 8 ifTrue:[
4938
65df50a477bc photometric fix
Claus Gittinger <cg@exept.de>
parents: 4786
diff changeset
  1202
        ^ #rgb
6483
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  1203
    ]].
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  1204
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1205
    ^ #palette
872
ae232ece067d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 871
diff changeset
  1206
ae232ece067d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 871
diff changeset
  1207
    "Modified: 17.6.1996 / 11:45:16 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1208
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1209
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1210
samplesperPixel
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1211
    "for compatibility with Image class ..."
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1212
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1213
    ^ 1
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1214
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1215
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1216
valueAt:aPoint
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1217
    "return the pixel at aPoint; the coordinates start with 0@0
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1218
     in the upper left, increasing to the lower right"
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1219
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1220
    ^ self at:aPoint
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1221
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1222
    "Modified: 23.4.1996 / 10:06:55 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1223
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1224
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1225
valueAt:aPoint put:value
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1226
    "set the pixel at aPoint; the coordinates start with 0@0
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1227
     in the upper left, increasing to the lower right."
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1228
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1229
    ^ self at:aPoint put:value
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1230
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1231
    "
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1232
     |f|
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1233
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1234
     f := Form width:10 height:10 depth:1.
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1235
     f clear.
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1236
     1 to:10 do:[:i |
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1237
	f valueAt:(i @ i) put:1
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1238
     ].
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1239
     f inspect
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1240
    "
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1241
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1242
    "Modified: 23.4.1996 / 10:12:48 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1243
! !
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1244
5213
638447e61970 Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 4938
diff changeset
  1245
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1246
!Form methodsFor:'converting'!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1247
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1248
asForm
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1249
    "convert & return the receiver into a Form instance - nothing to be done here"
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1250
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1251
    ^ self
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1252
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1253
    "Modified: 23.4.1996 / 10:14:11 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1254
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1255
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1256
asImage
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1257
    "convert & return the receiver into an Image instance"
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1258
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1259
    ^ Image fromForm:self
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1260
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1261
    "Modified: 23.4.1996 / 10:13:56 / cg"
4173
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1262
!
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1263
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1264
asImageForm
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1265
    "convert & return the receiver into a ImageForm instance"
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1266
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1267
    |imageForm|
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1268
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1269
    imageForm := ImageForm cloneFrom:self.
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1270
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1271
    "kludge: have to unregister. Otherwise the form will be destroyed when
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1272
     we are garbage collected"
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1273
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1274
    Lobby unregister:self.
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1275
    Lobby registerChange:imageForm.
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  1276
    ^ imageForm.
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1277
! !
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1279
!Form methodsFor:'copying'!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1280
2849
8d0631de6985 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1281
executor
8d0631de6985 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1282
    "redefined for faster creation of finalization copies
8d0631de6985 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1283
     (only device, gcId and drawableId are needed)"
8d0631de6985 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1284
8d0631de6985 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1285
    ^ DeviceFormHandle basicNew setDevice:device id:drawableId gcId:gcId.
8d0631de6985 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1286
!
8d0631de6985 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2827
diff changeset
  1287
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1288
postCopy
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1289
    "redefined to copy the colorMap as well"
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1290
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1291
    super postCopy.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1292
    localColorMap := localColorMap copy.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1293
    data := data copy
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1294
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1295
    "Modified: 23.4.1996 / 10:14:46 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1296
! !
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1297
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1298
!Form methodsFor:'editing'!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1299
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1300
show
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1301
    "open an imageView on the receiver"
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1302
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1303
    ImageView openOnImage:self
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1304
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1305
    "
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1306
     (Form fromFile:'bitmaps/SBrowser.xbm') show
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1307
    "
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1308
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1309
    "Modified: 23.4.1996 / 10:16:12 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1310
! !
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1311
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1312
!Form methodsFor:'getting a device form'!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1313
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1314
asFormOn:aDevice
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1315
    "convert & return the receiver into a Form instance
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1316
     and associate it to a device (i.e. download its bits).
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1317
     Added for protocol compatibility with Image."
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1318
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1319
    aDevice == device ifTrue:[
1889
8e24afd8174e Send #onDevice instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents: 1745
diff changeset
  1320
        ^ self
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1321
    ].
1889
8e24afd8174e Send #onDevice instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents: 1745
diff changeset
  1322
    ^ self onDevice:aDevice
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1323
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1324
    "Modified: 23.4.1996 / 10:17:26 / cg"
1889
8e24afd8174e Send #onDevice instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents: 1745
diff changeset
  1325
    "Modified: 26.8.1997 / 10:29:14 / stefan"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1326
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1327
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1328
asMonochromeFormOn:aDevice
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1329
    "added for protocol compatiblity with Image"
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1330
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1331
    aDevice == device ifTrue:[
2191
7be9c2c6c66f use #onDevice: in #asMono
Claus Gittinger <cg@exept.de>
parents: 2074
diff changeset
  1332
        depth == 1 ifTrue:[
7be9c2c6c66f use #onDevice: in #asMono
Claus Gittinger <cg@exept.de>
parents: 2074
diff changeset
  1333
            ^ self
7be9c2c6c66f use #onDevice: in #asMono
Claus Gittinger <cg@exept.de>
parents: 2074
diff changeset
  1334
        ].
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1335
    ].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1336
    (depth == 1) ifTrue:[
2191
7be9c2c6c66f use #onDevice: in #asMono
Claus Gittinger <cg@exept.de>
parents: 2074
diff changeset
  1337
        ^ self onDevice:aDevice
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1338
    ].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1339
    ^ nil
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1340
2191
7be9c2c6c66f use #onDevice: in #asMono
Claus Gittinger <cg@exept.de>
parents: 2074
diff changeset
  1341
    "Modified: / 27.7.1998 / 20:04:37 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1342
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1343
3104
edc88b280153 added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3068
diff changeset
  1344
exactOn:aDevice
3106
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1345
    "for compatibility with color protocol - here, the same as #onDevice."
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1346
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1347
    ^ self onDevice:aDevice
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1348
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1349
!
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1350
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1351
exactOrNearestOn:aDevice
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1352
    "for compatibility with color protocol - here, the same as #onDevice."
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1353
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1354
    ^ self onDevice:aDevice
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1355
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1356
!
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1357
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1358
nearestOn:aDevice
d6333a2bd850 more Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3104
diff changeset
  1359
    "for compatibility with color protocol - here, the same as #onDevice."
3104
edc88b280153 added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3068
diff changeset
  1360
edc88b280153 added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3068
diff changeset
  1361
    ^ self onDevice:aDevice
edc88b280153 added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3068
diff changeset
  1362
edc88b280153 added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3068
diff changeset
  1363
!
edc88b280153 added #exactOn: - for Color-protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 3068
diff changeset
  1364
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1365
on:aDevice
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1366
    "associate the receiver to a device (i.e. download its bits);
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1367
     return a deviceForm (possibly different from the receiver)."
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1368
1741
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1369
    "/ send out a warning: #on: is typically used to create views
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1370
    "/ operating on a model.
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1371
    "/ Please use #onDevice: to avoid confusion.
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1372
3431
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
  1373
    <resource:#obsolete>
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
  1374
1741
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1375
    self obsoleteMethodWarning:'use #onDevice:'.
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1376
    ^ self onDevice:aDevice
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1377
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1378
    "Modified: 5.6.1997 / 21:05:34 / cg"
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1379
!
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1380
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1381
onDevice:aDevice
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1382
    "associate the receiver to a device (i.e. download its bits);
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1383
     return a deviceForm (possibly different from the receiver)."
b84a2f4317e9 warn #on: vs. #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1645
diff changeset
  1384
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1385
    aDevice == device ifTrue:[
1436
c64b7abfc5fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  1386
        ^ self
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1387
    ].
2980
409e9547a45c ignore nil device in #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2964
diff changeset
  1388
    aDevice isNil ifTrue:[^ self].
409e9547a45c ignore nil device in #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2964
diff changeset
  1389
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1390
    "create a new form ..."
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1391
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1392
    data notNil ifTrue:[
2191
7be9c2c6c66f use #onDevice: in #asMono
Claus Gittinger <cg@exept.de>
parents: 2074
diff changeset
  1393
        "/ 'Form [info]: create from data' printCR.
4770
770e19fa6f50 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 4768
diff changeset
  1394
        ^ self class width:width height:height fromArray:data onDevice:aDevice
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1395
    ].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1396
    fileName notNil ifTrue:[
2191
7be9c2c6c66f use #onDevice: in #asMono
Claus Gittinger <cg@exept.de>
parents: 2074
diff changeset
  1397
        "/ 'Form [info]: create from file' printCR.
4165
b24a5c2adcb2 Do not use obsolete method #readFromFile: in #onDevice.
Stefan Vogel <sv@exept.de>
parents: 3921
diff changeset
  1398
        ^ (Image fromFile:fileName) asFormOn:aDevice
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1399
    ].
2191
7be9c2c6c66f use #onDevice: in #asMono
Claus Gittinger <cg@exept.de>
parents: 2074
diff changeset
  1400
    'Form [warning]: no bit data in #onDevice: - returning a black form.' infoPrintCR.
4786
0a24601e3f0e Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents: 4774
diff changeset
  1401
    ^ (self class width:width height:height onDevice:aDevice) clear
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1402
2191
7be9c2c6c66f use #onDevice: in #asMono
Claus Gittinger <cg@exept.de>
parents: 2074
diff changeset
  1403
    "Modified: / 27.7.1998 / 20:05:20 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1404
! !
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1405
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1406
!Form methodsFor:'image manipulations'!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1407
3655
1521a53dba17 +clearMaskedPixels
Claus Gittinger <cg@exept.de>
parents: 3624
diff changeset
  1408
clearMaskedPixels
1521a53dba17 +clearMaskedPixels
Claus Gittinger <cg@exept.de>
parents: 3624
diff changeset
  1409
    "Added for protocol compatibility with Image."
1521a53dba17 +clearMaskedPixels
Claus Gittinger <cg@exept.de>
parents: 3624
diff changeset
  1410
1521a53dba17 +clearMaskedPixels
Claus Gittinger <cg@exept.de>
parents: 3624
diff changeset
  1411
    ^ self
1521a53dba17 +clearMaskedPixels
Claus Gittinger <cg@exept.de>
parents: 3624
diff changeset
  1412
!
1521a53dba17 +clearMaskedPixels
Claus Gittinger <cg@exept.de>
parents: 3624
diff changeset
  1413
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1414
darkened
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1415
    "return a darkened version of the receiver.
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1416
     Added for protocol compatibility with Color and Image.
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1417
     Here, the receiver is returned as a kludge 
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1418
     - actually should return a darkened image (or Color black ?) .."
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1419
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1420
    ^ self
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1421
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1422
    "Modified: 23.4.1996 / 10:19:52 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1423
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1424
3334
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1425
easyMagnifiedBy:extent into: newForm
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1426
    "return a new form magnified by extent, aPoint.
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1427
     If non-integral magnify is asked for, pass the work on to 'hardMagnifiedBy:'"
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1428
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1429
    |mX mY dstX dstY ext 
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1430
     factor "{ Class: SmallInteger }"
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1431
     n      "{ Class: SmallInteger }" |
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1432
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1433
    ext := extent asPoint.
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1434
    mX := ext x.
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1435
    mY := ext y.
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1436
    ((mX = 1) and:[mY = 1]) ifTrue:[^ self].
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1437
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1438
    "expand rows"
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1439
    (mY > 1) ifTrue:[
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1440
        dstY := 0.
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1441
        n := height.
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1442
        factor := mY.
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1443
        0 to:(n - 1) do:[:srcY |
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1444
            1 to:factor do:[:i |
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1445
                newForm copyFrom:self
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1446
                               x:0 y:srcY
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1447
                             toX:0 y:dstY
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1448
                           width:width height:1.
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1449
                dstY := dstY + 1
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1450
            ]
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1451
        ]
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1452
    ].
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1453
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1454
    "expand cols"
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1455
    (mX > 1) ifTrue:[
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1456
        n := width.
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1457
        factor := mX.
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1458
        dstX := (n * factor) - 1.
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1459
        (n - 1) to:0 by:-1 do:[:srcX |
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1460
            1 to:factor do:[:i |
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1461
                newForm copyFrom:newForm
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1462
                               x:srcX y:0
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1463
                             toX:dstX y:0
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1464
                           width:1 height:(height * mY).
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1465
                dstX := dstX - 1
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1466
            ]
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1467
        ]
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1468
    ].
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1469
    ^ newForm
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1470
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1471
    "
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1472
     (ArrowButton upArrowButtonForm:#iris on:Display) magnifiedBy:(2 @ 2)
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1473
     (Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(2 @ 2)
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1474
     (Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(0.4 @ 0.4)
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1475
    "
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1476
!
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1477
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1478
flipHorizontal
4206
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1479
    "return a new form flipped vertically"
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1480
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1481
    |dstX newForm |
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1482
3624
7996877d60fb Do not use obsolete methods.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  1483
    newForm := (self class onDevice:device)
2827
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1484
                                width:width
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1485
                                height:height
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1486
                                depth:depth.
4206
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1487
    dstX := width - 1.
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1488
    0 to:dstX do:[:srcX |
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1489
        newForm copyFrom:self
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1490
                       x:srcX y:0
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1491
                     toX:dstX y:0
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1492
                   width:1 height:height.
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1493
        dstX := dstX - 1
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1494
    ].
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1495
    newForm colorMap:localColorMap.
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1496
    ^ newForm
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1497
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1498
    "
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1499
     |testForm|
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1500
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1501
     testForm _ Form 
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1502
                    extent: 8@8 
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1503
                    depth: 1 
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1504
                    fromArray:
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1505
                     #( 2r10000000
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1506
                        2r11000000 
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1507
                        2r11100000
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1508
                        2r11110000 
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1509
                        2r11111000
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1510
                        2r11111100 
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1511
                        2r11111110
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1512
                        2r11111111)
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1513
                    offset: 0@0.
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1514
     testForm inspect.
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1515
     testForm flipVertical inspect.
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1516
     testForm flipHorizontal inspect.
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1517
    "
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1518
!
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1519
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1520
flipVertical
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1521
    "return a new form flipped horizontally"
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1522
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1523
    |dstY newForm |
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1524
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1525
    newForm := (self class onDevice:device)
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1526
                                width:width
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1527
                                height:height
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1528
                                depth:depth.
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1529
    dstY := height - 1.
4206
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1530
    0 to:dstY do:[:srcY |
2827
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1531
        newForm copyFrom:self
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1532
                       x:0 y:srcY
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1533
                     toX:0 y:dstY
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1534
                   width:width height:1.
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1535
        dstY := dstY - 1
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1536
    ].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1537
    newForm colorMap:localColorMap.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1538
    ^ newForm
4206
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1539
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1540
    "
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1541
     |testForm|
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1542
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1543
     testForm _ Form 
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1544
                    extent: 8@8 
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1545
                    depth: 1 
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1546
                    fromArray:
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1547
                     #( 2r10000000
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1548
                        2r11000000 
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1549
                        2r11100000
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1550
                        2r11110000 
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1551
                        2r11111000
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1552
                        2r11111100 
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1553
                        2r11111110
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1554
                        2r11111111)
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1555
                    offset: 0@0.
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1556
     testForm inspect.
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1557
     testForm flipVertical inspect.
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1558
     testForm flipHorizontal inspect.
4d3273b10f37 flip fixed
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  1559
    "
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1560
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1561
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1562
hardMagnifiedBy:extent
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1563
    "return a new form magnified by extent, aPoint.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1564
     This method handles non-integral factors."
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1565
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1566
    "
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1567
     since Form will be replaced by Image in the long run,
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1568
     and this operation is slow anyway, use the implementation
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1569
     in Image for this."
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1570
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1571
    ^ ((Image fromForm:self) magnifiedBy:extent) asFormOn:device.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1572
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1573
    "
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1574
     (Form fromFile:'OutputOn.64') magnifiedBy:0.5@0.5
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1575
     (Form fromFile:'OutputOn.64') magnifiedBy:1.5@1.5
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1576
    "
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1577
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1578
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1579
lightened
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1580
    "return a lightened version of the receiver.
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1581
     Added for protocol compatibility with Color and Image.
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1582
     Here, the receiver is returned as a kludge 
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1583
     - actually should return a lightened image (or Color white ?) .."
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1584
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1585
    ^ self
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1586
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1587
    "Modified: 23.4.1996 / 10:20:14 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1588
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1589
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1590
magnifiedBy:extent
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1591
    "return a new form magnified by extent, aPoint.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1592
     If non-integral magnify is asked for, pass the work on to 'hardMagnifiedBy:'"
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1593
3624
7996877d60fb Do not use obsolete methods.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  1594
    |mX mY newForm ext|
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1595
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1596
    ext := extent asPoint.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1597
    mX := ext x.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1598
    mY := ext y.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1599
    ((mX = 1) and:[mY = 1]) ifTrue:[^ self].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1600
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1601
    ((mX isMemberOf:SmallInteger) and:[mY isMemberOf:SmallInteger]) ifFalse:[
2827
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1602
        ^ self hardMagnifiedBy:ext
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1603
    ].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1604
3624
7996877d60fb Do not use obsolete methods.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  1605
    newForm := (self class onDevice:device)
2827
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1606
                                width:(width * mX)
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1607
                                height:(height * mY)
4f30d3aa96e5 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 2823
diff changeset
  1608
                                depth:depth.
3334
952a3553df45 st80 bitblt
martin
parents: 3300
diff changeset
  1609
    self easyMagnifiedBy:extent into:newForm.
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1610
    newForm colorMap:localColorMap.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1611
    ^ newForm
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1612
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1613
    "
3624
7996877d60fb Do not use obsolete methods.
Stefan Vogel <sv@exept.de>
parents: 3611
diff changeset
  1614
     (ArrowButton upArrowButtonForm:#iris on:Screen current) magnifiedBy:(2 @ 2)
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1615
     (Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(2 @ 2)
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1616
     (Form fromFile:'bitmaps/SBrowser.xbm') magnifiedBy:(0.4 @ 0.4)
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1617
    "
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1618
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1619
569
7dee80bce37b added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  1620
magnifiedTo:anExtent 
7dee80bce37b added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  1621
    "return a new form magnified to have the size specified by extent.
7dee80bce37b added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  1622
     This may distort the image if the arguments ratio is not the images ratio.
7dee80bce37b added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  1623
     See also #magnifiedPreservingRatioTo: and #magnifiedBy:"
7dee80bce37b added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  1624
7dee80bce37b added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  1625
    ^ self magnifiedBy:(anExtent / self extent)
7dee80bce37b added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  1626
7dee80bce37b added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  1627
    "Created: 18.4.1996 / 16:17:52 / cg"
7dee80bce37b added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  1628
!
7dee80bce37b added #magnifiedTo: (protocol compatibility with Image)
Claus Gittinger <cg@exept.de>
parents: 425
diff changeset
  1629
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1630
magnifyBy:scale
5213
638447e61970 Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 4938
diff changeset
  1631
    <resource: #obsolete>
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1632
    "obsolete: has been renamed to magnifiedBy: for ST-80 compatibility
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1633
     and name consistency ..."
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1634
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1635
    self obsoleteMethodWarning.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1636
    ^ self magnifiedBy:scale
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1637
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1638
48194c26a46c Initial revision
claus
parents:
diff changeset
  1639
!Form methodsFor:'initialization'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1640
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1641
createGC
1452
c76c6637903c commentary
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
  1642
    "physically create a device GC.
c76c6637903c commentary
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
  1643
     Since we do not need a gc-object for the drawable until something is
c76c6637903c commentary
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
  1644
     really drawn, none is created up to the first draw.
c76c6637903c commentary
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
  1645
     This method is sent, when the first drawing happens.
c76c6637903c commentary
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
  1646
     Redefined here to create a bitmap GC (some devices (i.e. windows) require
c76c6637903c commentary
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
  1647
     different GC's for different canvases."
c76c6637903c commentary
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
  1648
6232
3dcb1d72eac1 class: Form
Stefan Vogel <sv@exept.de>
parents: 6230
diff changeset
  1649
    self createGCForBitmap.
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1650
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1651
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1652
initGC
48194c26a46c Initial revision
claus
parents:
diff changeset
  1653
    "stop server from sending exposure events for Forms -
48194c26a46c Initial revision
claus
parents:
diff changeset
  1654
     (will fill up stream-queue on some stupid (i.e. sco) systems"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1655
951
ebedf8da0e89 initGC stuff fixed
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  1656
    "/ depth-1 forms draw differently ...
ebedf8da0e89 initGC stuff fixed
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  1657
ebedf8da0e89 initGC stuff fixed
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  1658
    depth == 1 ifTrue:[
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1659
	foreground isNil ifTrue:[
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1660
	    foreground := paint := Color colorId:1.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1661
	].
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1662
	background isNil ifTrue:[
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1663
	    background := bgPaint := Color colorId:0
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1664
	]
951
ebedf8da0e89 initGC stuff fixed
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  1665
    ].
126
4fc31fd808c8 *** empty log message ***
claus
parents: 118
diff changeset
  1666
    super initGC.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1667
    self setGraphicsExposures:false
836
d6eb406b1c04 dither bitmaps moved to Color
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
  1668
951
ebedf8da0e89 initGC stuff fixed
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  1669
    "Modified: 17.7.1996 / 13:21:24 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1670
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1671
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1672
initialize
951
ebedf8da0e89 initGC stuff fixed
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  1673
    foreground := paint := Color colorId:1.
ebedf8da0e89 initGC stuff fixed
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  1674
    background := bgPaint := Color colorId:0.
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1675
    depth := 1.
836
d6eb406b1c04 dither bitmaps moved to Color
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
  1676
6232
3dcb1d72eac1 class: Form
Stefan Vogel <sv@exept.de>
parents: 6230
diff changeset
  1677
    super initialize.
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1678
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1679
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1680
recreate
3300
d7b046ccbb33 comment
Claus Gittinger <cg@exept.de>
parents: 3192
diff changeset
  1681
    "reconstruct the form after a snapin or a migration"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1682
6230
22cbdd5e9a35 class: Form
Stefan Vogel <sv@exept.de>
parents: 6227
diff changeset
  1683
    self device isNil ifTrue:[^ self].
2473
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1684
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1685
    data notNil ifTrue:[
2473
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1686
        "
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1687
         create one from data
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1688
        "
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1689
        (depth == 1 or:[depth == device depth]) ifTrue:[
6230
22cbdd5e9a35 class: Form
Stefan Vogel <sv@exept.de>
parents: 6227
diff changeset
  1690
            self createBitmapFromArray:data width:width height:height.
2473
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1691
            Lobby registerChange:self. 
6230
22cbdd5e9a35 class: Form
Stefan Vogel <sv@exept.de>
parents: 6227
diff changeset
  1692
            self drawableId notNil ifTrue:[
2473
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1693
                ^ self
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1694
            ]
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1695
        ].
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1696
        'FORM: cannot recreate form' errorPrintCR.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1697
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1698
    fileName notNil ifTrue:[
2473
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1699
        "
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1700
         create one from a file (mhmh - this seems X-specific and will vanish)
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1701
        "
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1702
        self readFromFile:fileName.
871
c078c33c51ac recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
  1703
c078c33c51ac recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
  1704
"/        drawableId := device createBitmapFromFile:fileName for:self.
c078c33c51ac recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
  1705
"/        Lobby registerChange:self.
6230
22cbdd5e9a35 class: Form
Stefan Vogel <sv@exept.de>
parents: 6227
diff changeset
  1706
        self drawableId notNil ifTrue:[
2473
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1707
            ^ self
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1708
        ].
2d4b51e6eb48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2456
diff changeset
  1709
        'FORM: cannot recreate file form: ' errorPrint. fileName errorPrintCR.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1710
    ].
871
c078c33c51ac recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
  1711
c078c33c51ac recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
  1712
    ^ self.
c078c33c51ac recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
  1713
3474
2043444bdc24 statements after return
Claus Gittinger <cg@exept.de>
parents: 3452
diff changeset
  1714
"/    "
2043444bdc24 statements after return
Claus Gittinger <cg@exept.de>
parents: 3452
diff changeset
  1715
"/     create an empty one
2043444bdc24 statements after return
Claus Gittinger <cg@exept.de>
parents: 3452
diff changeset
  1716
"/    "
2043444bdc24 statements after return
Claus Gittinger <cg@exept.de>
parents: 3452
diff changeset
  1717
"/    depth == 1 ifTrue:[
2043444bdc24 statements after return
Claus Gittinger <cg@exept.de>
parents: 3452
diff changeset
  1718
"/        drawableId := device createBitmapWidth:width height:height
2043444bdc24 statements after return
Claus Gittinger <cg@exept.de>
parents: 3452
diff changeset
  1719
"/    ] ifFalse:[
2043444bdc24 statements after return
Claus Gittinger <cg@exept.de>
parents: 3452
diff changeset
  1720
"/        drawableId := device createPixmapWidth:width height:height depth:device depth
2043444bdc24 statements after return
Claus Gittinger <cg@exept.de>
parents: 3452
diff changeset
  1721
"/    ].
2043444bdc24 statements after return
Claus Gittinger <cg@exept.de>
parents: 3452
diff changeset
  1722
"/    Lobby registerChange:self
871
c078c33c51ac recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
  1723
c078c33c51ac recreate was somehow corrupted ?!
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
  1724
    "Modified: 15.6.1996 / 16:18:12 / cg"
4217
7786f64f5926 New: #releaseFromDevice
Stefan Vogel <sv@exept.de>
parents: 4206
diff changeset
  1725
!
7786f64f5926 New: #releaseFromDevice
Stefan Vogel <sv@exept.de>
parents: 4206
diff changeset
  1726
7786f64f5926 New: #releaseFromDevice
Stefan Vogel <sv@exept.de>
parents: 4206
diff changeset
  1727
releaseFromDevice
7786f64f5926 New: #releaseFromDevice
Stefan Vogel <sv@exept.de>
parents: 4206
diff changeset
  1728
    "flush device data.
7786f64f5926 New: #releaseFromDevice
Stefan Vogel <sv@exept.de>
parents: 4206
diff changeset
  1729
     The sender has to take care that the Form has been
7786f64f5926 New: #releaseFromDevice
Stefan Vogel <sv@exept.de>
parents: 4206
diff changeset
  1730
     unregistered from (Finalization-)Lobby"
7786f64f5926 New: #releaseFromDevice
Stefan Vogel <sv@exept.de>
parents: 4206
diff changeset
  1731
7786f64f5926 New: #releaseFromDevice
Stefan Vogel <sv@exept.de>
parents: 4206
diff changeset
  1732
    device := drawableId := gcId := nil.
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
  1733
! !
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
  1734
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
  1735
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1736
!Form methodsFor:'printing & storing'!
107
ef48048a8b34 *** empty log message ***
claus
parents: 99
diff changeset
  1737
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1738
storeOn:aStream
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1739
    "append an ascii representation of the receiver to aStream,
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1740
     from which a copy of the receiver can be reconstructed"
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1741
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1742
    aStream nextPutAll:'(Form width:'.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1743
    width storeOn:aStream.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1744
    aStream nextPutAll:' height:'.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1745
    height storeOn:aStream.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1746
    aStream nextPutAll:' fromArray:('.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1747
    self bits storeOn:aStream.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1748
    aStream nextPutAll:'))'
588
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1749
8aee1c8800c9 commentary
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
  1750
    "Modified: 23.4.1996 / 10:21:10 / cg"
107
ef48048a8b34 *** empty log message ***
claus
parents: 99
diff changeset
  1751
! !
ef48048a8b34 *** empty log message ***
claus
parents: 99
diff changeset
  1752
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1753
!Form methodsFor:'private'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1754
412
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1755
beImmediateForm
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1756
    "read the pixels from the device into a local data array. 
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1757
     This makes certain that a fileName form is independent of
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1758
     its fileName.
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1759
     To make the image smaller (i.e. not keep all those bitmaps),
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1760
     this is NOT done by default."
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1761
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1762
    data isNil ifTrue:[
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1763
	data := self bits.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1764
	data notNil ifTrue:[
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1765
	    fileName := nil
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1766
	]
412
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1767
    ]
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1768
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1769
    "
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1770
     Form allInstances:[:f |
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1058
diff changeset
  1771
	f beImmediateForm
412
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1772
     ]
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1773
    "
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1774
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1775
    "Created: 7.2.1996 / 16:04:18 / cg"
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1776
!
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1777
870
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
  1778
flushDeviceHandles
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
  1779
    "flush device handles (sent after a restart)"
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
  1780
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
  1781
    drawableId := nil.
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
  1782
    gcId := nil.
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
  1783
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
  1784
    "Created: 15.6.1996 / 15:44:28 / cg"
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
  1785
!
2b7db80e7ad1 oops - restart mechanism got corrupted
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
  1786
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1787
getBits
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1788
    "if the receiver was not created from a file, or
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1789
     an array (i.e. it was drawn), read the pixels from the
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1790
     device into a local data array. This has to be done before
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1791
     an image is saved, or the receiver is storedBinary, since
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1792
     the information present in the device is lost after restart/reload"
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1793
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1794
    (data isNil and:[fileName isNil]) ifTrue:[
78
1c9c22df3251 *** empty log message ***
claus
parents: 71
diff changeset
  1795
	data := self bits
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1796
    ]
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1797
!
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1798
412
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1799
readFromFile:fn
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1800
    "read a monochrome form from a file (in xbm-format).
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1801
     The fileName argument, fn should be a relative pathname
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1802
     such as bitmaps/foo.xbm and the corresponding file
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1803
     will be searched in the standard places (i.e. along the SEARCHPATH).
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1804
     Notice, when saving an image, only that fileName is kept with the
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1805
     form, and the file is reloaded at image startup time.
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1806
     You should therefore make certain, that the file is present at image
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1807
     reload time. (this is done to make the image smaller ...)
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1808
     If you dont like that behavior (or your application should be able to
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1809
     restart fully standAlone), send #beImmediateForm to all instances of
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1810
     Form - this will set the data instance variable to a ByteArray containing
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1811
     the actual bits and  will therefore no longer depend on the file being present.
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1812
     "
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1813
3431
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
  1814
    <resource:#obsolete>
afd71b27768d Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 3339
diff changeset
  1815
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1816
    |pathName|
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1817
3067
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1818
    "/ this method is a historic leftover; it uses
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1819
    "/ the X-libs bitmap file reading function, which is not
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1820
    "/ available with other windowing systems ...
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1821
    self obsoleteMethodWarning:'use Image fromFile:'.
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1822
412
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1823
    pathName := self class findBitmapFile:fn.
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1824
    pathName notNil ifTrue:[
3067
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1825
        drawableId := device createBitmapFromFile:pathName for:self.
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1826
        drawableId isNil ifTrue:[^ nil].
412
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1827
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1828
"/        fileName := pathName. "/ keep the actual name (wrong)
3067
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1829
        fileName := fn.         "/ keep the relative name (better - SEARCHPATH may be different at restart)
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1830
3067
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1831
        offset := 0@0.
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1832
        realized := true.
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1833
        BlackAndWhiteColorMap isNil ifTrue:[
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1834
            BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1835
        ].
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1836
        localColorMap := BlackAndWhiteColorMap.
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1837
        Lobby registerChange:self.
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1838
        ^ self
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1839
    ].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1840
    ^ nil
412
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1841
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1842
    "Modified: 7.2.1996 / 16:04:25 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1843
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1844
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1845
readFromFile:filename resolution:dpi
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1846
    "read a monochrome form from a file, which is assumed to have data for a dpi-resolution;
412
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1847
     if the actual resolution of the device differs, magnify the form.
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1848
     Read the comment in #readFromFile: on what happenes if the file is no longer present
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1849
     after an image reload."
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1850
4217
7786f64f5926 New: #releaseFromDevice
Stefan Vogel <sv@exept.de>
parents: 4206
diff changeset
  1851
    <resource:#obsolete>
7786f64f5926 New: #releaseFromDevice
Stefan Vogel <sv@exept.de>
parents: 4206
diff changeset
  1852
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1853
    |dpiH mag dev|
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1854
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1855
    (self readFromFile:filename) isNil ifTrue:[^ nil].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1856
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1857
    "if the device is within +- 50% of dpi, no magnify is needed"
6227
72c2836e3151 class: Form
Stefan Vogel <sv@exept.de>
parents: 6143
diff changeset
  1858
    dev := self device.
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1859
    dev isNil ifTrue:[
3067
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1860
        "should not happen ..."
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1861
        dev := Screen current
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1862
    ].
3067
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1863
    dpiH := dev isNil ifTrue:[90] ifFalse:[dev horizontalPixelPerInch].
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1864
    ((dpi >= (dpiH * 0.75)) and:[dpi <= (dpiH * 1.5)]) ifTrue:[^ self].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1865
    mag := (dpiH / dpi) rounded.
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1866
    mag == 0 ifTrue:[
3067
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1867
        ^ self
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1868
    ].
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1869
    ^ self magnifiedBy:(mag @ mag)
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1870
6227
72c2836e3151 class: Form
Stefan Vogel <sv@exept.de>
parents: 6143
diff changeset
  1871
    "
72c2836e3151 class: Form
Stefan Vogel <sv@exept.de>
parents: 6143
diff changeset
  1872
        Form fromFile:'SBrowser.icn' resolution:50
72c2836e3151 class: Form
Stefan Vogel <sv@exept.de>
parents: 6143
diff changeset
  1873
    "
412
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1874
766ba454c23d keep the relative fileName; added #beImmediateForm to avoid problems if bitmap files are not present at startup
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1875
    "Modified: 7.2.1996 / 16:03:45 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1876
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1877
1058
103860173cb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 951
diff changeset
  1878
restored
103860173cb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 951
diff changeset
  1879
    "flush device data, when restored (sent after a binaryLoad)"
103860173cb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 951
diff changeset
  1880
103860173cb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 951
diff changeset
  1881
    self release
103860173cb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 951
diff changeset
  1882
103860173cb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 951
diff changeset
  1883
    "Modified: 16.9.1996 / 21:08:57 / cg"
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1884
!
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  1885
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1886
width:w height:h
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1887
    "actual create of a monochrome form"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1888
6227
72c2836e3151 class: Form
Stefan Vogel <sv@exept.de>
parents: 6143
diff changeset
  1889
    ^ self width:w height:h depth:1.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1890
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1891
48194c26a46c Initial revision
claus
parents:
diff changeset
  1892
width:w height:h depth:d
7355
b54b8aebbb90 #FEATURE by sr
sr
parents: 7354
diff changeset
  1893
    "actual create of an arbitrary deep form (but, must be supported by device).
b54b8aebbb90 #FEATURE by sr
sr
parents: 7354
diff changeset
  1894
     Return nil (after raising a notification) if the allocation failed"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1895
6227
72c2836e3151 class: Form
Stefan Vogel <sv@exept.de>
parents: 6143
diff changeset
  1896
    ((w == 0) or:[h == 0]) ifTrue:[
72c2836e3151 class: Form
Stefan Vogel <sv@exept.de>
parents: 6143
diff changeset
  1897
        self error:'invalid form extent'.
72c2836e3151 class: Form
Stefan Vogel <sv@exept.de>
parents: 6143
diff changeset
  1898
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1899
    width := w.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1900
    height := h.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1901
    offset := 0@0.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1902
    depth := d.
6227
72c2836e3151 class: Form
Stefan Vogel <sv@exept.de>
parents: 6143
diff changeset
  1903
    depth == 1 ifTrue:[
6483
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  1904
        localColorMap isNil ifTrue:[
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  1905
            BlackAndWhiteColorMap isNil ifTrue:[
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  1906
                BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  1907
            ].
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  1908
            localColorMap := BlackAndWhiteColorMap.
6227
72c2836e3151 class: Form
Stefan Vogel <sv@exept.de>
parents: 6143
diff changeset
  1909
        ].
72c2836e3151 class: Form
Stefan Vogel <sv@exept.de>
parents: 6143
diff changeset
  1910
    ].
7260
5b9f9cbd2435 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7238
diff changeset
  1911
    device notNil ifTrue:[
7355
b54b8aebbb90 #FEATURE by sr
sr
parents: 7354
diff changeset
  1912
        (gc createPixmapWidth:w height:h depth:d) isNil ifTrue:[^nil].
b54b8aebbb90 #FEATURE by sr
sr
parents: 7354
diff changeset
  1913
        realized := drawableId notNil.
3067
908e910e6c94 allow forms to be created without a device.
Claus Gittinger <cg@exept.de>
parents: 3025
diff changeset
  1914
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1915
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1916
2773
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1917
width:wIn height:hIn fromArray:anArray
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1918
    "actual create of a monochrome form from array.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1919
     This method is somewhat more complicated as it should be due to 
48194c26a46c Initial revision
claus
parents:
diff changeset
  1920
     supporting both byte-wise (ST/X-type) and short-word-wise (ST-80-type)
48194c26a46c Initial revision
claus
parents:
diff changeset
  1921
     Arrays; in the later case, the shorts are first converted to bytes in
48194c26a46c Initial revision
claus
parents:
diff changeset
  1922
     a ByteArray, then passed to the device."
48194c26a46c Initial revision
claus
parents:
diff changeset
  1923
134
claus
parents: 133
diff changeset
  1924
    |bytes bits 
claus
parents: 133
diff changeset
  1925
     srcPerRow "{ Class: SmallInteger }"
claus
parents: 133
diff changeset
  1926
     dstPerRow "{ Class: SmallInteger }"
claus
parents: 133
diff changeset
  1927
     srcStart  "{ Class: SmallInteger }"
claus
parents: 133
diff changeset
  1928
     srcIndex  "{ Class: SmallInteger }"
claus
parents: 133
diff changeset
  1929
     dstIndex  "{ Class: SmallInteger }"
2773
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1930
     w         "{ Class: SmallInteger }" 
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1931
     h         "{ Class: SmallInteger }"
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1932
     sz        "{ Class: SmallInteger }" |
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1933
2773
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1934
    w := wIn.
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1935
    h := hIn.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1936
    bytes := anArray.
2773
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1937
    sz := anArray size.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1938
2773
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1939
    sz ~~ (((w + 7) // 8) * h) ifTrue:[
3020
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1940
        "/ not bytes ...
2773
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1941
        sz == (((w + 15) // 16) * h) ifTrue:[
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1942
            "I want the bytes but got shorts (ST-80)"
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1943
            bytes := ByteArray uninitializedNew:(((w + 7) // 8) * h).
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1944
            srcPerRow := (w + 15) // 16.
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1945
            dstPerRow := (w + 7) // 8.
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1946
            srcStart := 1.
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1947
            dstIndex := 1.
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1948
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1949
            1 to:h do:[:hi |
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1950
                srcIndex := srcStart.
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1951
                bits := anArray at:srcIndex.
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1952
                1 to:dstPerRow do:[:di |
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1953
                    di odd ifTrue:[
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1954
                        bits := anArray at:srcIndex.
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1955
                        bytes at:dstIndex put:(bits bitShift:-8)
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1956
                    ] ifFalse:[
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1957
                        bytes at:dstIndex put:(bits bitAnd:16rFF).
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1958
                        srcIndex := srcIndex + 1
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1959
                    ].
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1960
                    dstIndex := dstIndex + 1
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1961
                ].
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1962
                srcStart := srcStart + srcPerRow
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1963
            ]
3020
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1964
        ] ifFalse:[
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1965
            sz == (((w + 31) // 32) * h) ifTrue:[
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1966
                "I want the bytes but got longs (Squeak)"
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1967
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1968
                bytes := ByteArray uninitializedNew:(((w + 7) // 8) * h).
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1969
                srcPerRow := (w + 31) // 32.
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1970
                dstPerRow := (w + 7) // 8.
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1971
                srcStart := 1.
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1972
                dstIndex := 1.
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1973
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1974
                1 to:h do:[:hi |
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1975
                    |ss|
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1976
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1977
                    srcIndex := srcStart.
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1978
                    bits := anArray at:srcIndex.
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1979
                    ss := 0.
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1980
                    1 to:dstPerRow do:[:di |
3025
11d768e415c2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  1981
                        ss == 0 ifTrue:[
11d768e415c2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  1982
                            bits := anArray at:srcIndex.
11d768e415c2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  1983
                        ].
3020
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1984
                        bytes at:dstIndex put:((bits bitShift:-24) bitAnd:16rFF).
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1985
                        bits := bits bitShift:8.
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1986
                        ss := ss + 1.
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1987
                        ss == 4 ifTrue:[
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1988
                            srcIndex := srcIndex + 1.
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1989
                            ss := 0.
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1990
                        ].
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1991
                        dstIndex := dstIndex + 1
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1992
                    ].
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1993
                    srcStart := srcStart + srcPerRow
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1994
                ]
e043c3d30613 more Squeak compatibility stuff
ps
parents: 2980
diff changeset
  1995
            ]
2773
8aefa2576a50 a few more smallInteger type hints
Claus Gittinger <cg@exept.de>
parents: 2473
diff changeset
  1996
        ]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1997
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1998
    data := bytes.
6230
22cbdd5e9a35 class: Form
Stefan Vogel <sv@exept.de>
parents: 6227
diff changeset
  1999
    width := w.
22cbdd5e9a35 class: Form
Stefan Vogel <sv@exept.de>
parents: 6227
diff changeset
  2000
    height := h.
22cbdd5e9a35 class: Form
Stefan Vogel <sv@exept.de>
parents: 6227
diff changeset
  2001
    depth := 1.
22cbdd5e9a35 class: Form
Stefan Vogel <sv@exept.de>
parents: 6227
diff changeset
  2002
    offset := 0@0.
6483
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  2003
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  2004
    localColorMap isNil ifTrue:[
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  2005
        BlackAndWhiteColorMap isNil ifTrue:[
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  2006
            BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  2007
        ].
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  2008
        localColorMap := BlackAndWhiteColorMap.
6230
22cbdd5e9a35 class: Form
Stefan Vogel <sv@exept.de>
parents: 6227
diff changeset
  2009
    ].
6483
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  2010
7260
5b9f9cbd2435 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 7238
diff changeset
  2011
    device notNil ifTrue:[
6483
10d4084f12cc class: Form
Stefan Vogel <sv@exept.de>
parents: 6257
diff changeset
  2012
        gc createBitmapFromArray:bytes width:w height:h.
6230
22cbdd5e9a35 class: Form
Stefan Vogel <sv@exept.de>
parents: 6227
diff changeset
  2013
        realized := true.
22cbdd5e9a35 class: Form
Stefan Vogel <sv@exept.de>
parents: 6227
diff changeset
  2014
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2015
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2016
48194c26a46c Initial revision
claus
parents:
diff changeset
  2017
width:w height:h offset:offs fromArray:anArray
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2018
    "actual create of a monochrome form from array"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2019
48194c26a46c Initial revision
claus
parents:
diff changeset
  2020
    self width:w height:h fromArray:anArray.
48194c26a46c Initial revision
claus
parents:
diff changeset
  2021
    offset := offs
48194c26a46c Initial revision
claus
parents:
diff changeset
  2022
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2023
3177
8aa3c800394a category rename
Claus Gittinger <cg@exept.de>
parents: 3142
diff changeset
  2024
!Form methodsFor:'queries'!
99
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2025
3812
377a6198fcfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  2026
ascentOn:aGC
377a6198fcfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  2027
    "displayOn: does not draw above baseline"
377a6198fcfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  2028
377a6198fcfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  2029
    ^ 0
377a6198fcfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  2030
!
377a6198fcfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3811
diff changeset
  2031
680
a905d02dcb82 added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2032
bounds
a905d02dcb82 added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2033
    "return my bounds (added to make forms usable as VisualComponents)"
a905d02dcb82 added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2034
a905d02dcb82 added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2035
    ^ Rectangle left:0 top:0 width:width height:height
a905d02dcb82 added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2036
a905d02dcb82 added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2037
    "Modified: 13.5.1996 / 10:26:13 / cg"
a905d02dcb82 added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2038
!
a905d02dcb82 added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2039
910
6a19a80f66b4 added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2040
colorFromValue:pixel
1200
b77327efe724 comment
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2041
    "given a pixelValue, return the corresponding color.
b77327efe724 comment
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2042
     For compatibility with Images"
b77327efe724 comment
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2043
910
6a19a80f66b4 added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2044
    localColorMap notNil ifTrue:[
1200
b77327efe724 comment
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2045
        ^ localColorMap at:(pixel + 1)
910
6a19a80f66b4 added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2046
    ].
6a19a80f66b4 added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2047
    depth == 1 ifTrue:[
1200
b77327efe724 comment
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2048
        pixel == 0 ifTrue:[^ White].
910
6a19a80f66b4 added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2049
    ].
951
ebedf8da0e89 initGC stuff fixed
Claus Gittinger <cg@exept.de>
parents: 935
diff changeset
  2050
    ^ Black
910
6a19a80f66b4 added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2051
6a19a80f66b4 added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2052
    "Created: 28.6.1996 / 16:10:13 / cg"
1200
b77327efe724 comment
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  2053
    "Modified: 13.1.1997 / 23:06:25 / cg"
910
6a19a80f66b4 added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2054
!
6a19a80f66b4 added colorFromValue: for Image compatibility
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
  2055
925
1467e7850045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
  2056
hasBits
1467e7850045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
  2057
    "return true, if the receiver has its pixel data available.
1467e7850045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
  2058
     For forms, which were created from data, this is always true.
1467e7850045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
  2059
     For forms, which were created as off-screen device forms on some
1467e7850045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
  2060
     device, this is always false."
1467e7850045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
  2061
1467e7850045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
  2062
    ^ data notNil
1467e7850045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
  2063
1467e7850045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
  2064
    "Created: 5.7.1996 / 16:21:20 / cg"
1467e7850045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
  2065
!
1467e7850045 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
  2066
673
c755f681e169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2067
heightOn:aGC
674
e0f6bd36a99d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 673
diff changeset
  2068
    "return my height, if displayed on aGC;
e0f6bd36a99d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 673
diff changeset
  2069
     since my height is independent of the device (the number of pixels),
e0f6bd36a99d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 673
diff changeset
  2070
     return the pixel-height"
e0f6bd36a99d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 673
diff changeset
  2071
680
a905d02dcb82 added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2072
    ^ height
673
c755f681e169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2073
c755f681e169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2074
    "Created: 12.5.1996 / 21:35:33 / cg"
680
a905d02dcb82 added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2075
    "Modified: 13.5.1996 / 10:26:09 / cg"
673
c755f681e169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2076
!
c755f681e169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2077
3700
9b40f1e55270 dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
  2078
isDithered
9b40f1e55270 dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
  2079
    "for compatibility with color protocol"
9b40f1e55270 dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
  2080
9b40f1e55270 dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
  2081
    ^ false
9b40f1e55270 dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
  2082
!
9b40f1e55270 dummy isDithered - for color compatibility
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
  2083
99
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2084
isForm
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2085
    "return true, if the receiver is some kind of form;
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2086
     true is returned here - the method is redefined from Object."
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2087
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2088
    ^ true
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2089
!
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2090
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2091
isImageOrForm
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2092
    "return true, if the receiver is some kind of image or form;
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2093
     true is returned here - the method is redefined from Object."
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2094
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2095
    ^ true
673
c755f681e169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2096
!
c755f681e169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2097
c755f681e169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2098
widthOn:aGC
674
e0f6bd36a99d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 673
diff changeset
  2099
    "return my width, if displayed on aGC;
e0f6bd36a99d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 673
diff changeset
  2100
     since my width is independent of the device (the number of pixels),
e0f6bd36a99d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 673
diff changeset
  2101
     return the pixel-width"
e0f6bd36a99d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 673
diff changeset
  2102
680
a905d02dcb82 added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2103
    ^ width
673
c755f681e169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2104
c755f681e169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 672
diff changeset
  2105
    "Created: 12.5.1996 / 21:35:29 / cg"
680
a905d02dcb82 added #bounds (for VisualComponent protocol compatibility)
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
  2106
    "Modified: 13.5.1996 / 10:26:05 / cg"
99
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2107
! !
c40b8a508283 *** empty log message ***
claus
parents: 98
diff changeset
  2108
1907
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2109
!Form::DeviceFormHandle class methodsFor:'documentation'!
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2110
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2111
documentation
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2112
"
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2113
    This is used as a finalization handle for forms - in previous systems,
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2114
    a shallowCopy of a form was responsible to destroy the underlying
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2115
    devices bitmap. To make the memory requirements smaller and to speed up
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2116
    bitmap creation a bit, this lightweight class is used now, which only
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2117
    keeps the device handle for finalization.
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2118
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2119
    [see also:]
4487
796ec0172973 comment
Claus Gittinger <cg@exept.de>
parents: 4437
diff changeset
  2120
        DeviceHandle Form
1907
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2121
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2122
    [author:]
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2123
        Claus Gittinger
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2124
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2125
"
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2126
! !
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2127
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2128
!Form::DeviceFormHandle methodsFor:'finalization'!
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2129
3611
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  2130
finalize
1907
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2131
    "the Form for which I am a handle has been collected - tell it to the x-server"
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2132
2074
6a63604051a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
  2133
    |id|
6a63604051a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
  2134
1907
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2135
    drawableId notNil ifTrue:[
3611
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  2136
        (id := gcId) notNil ifTrue:[
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  2137
            gcId := nil.
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  2138
            device destroyGC:id.
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  2139
        ].
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  2140
        id := drawableId.
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  2141
        drawableId := nil.
8b4384c9e660 Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  2142
        device destroyPixmap:id.
1907
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2143
    ]
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2144
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2145
    "Created: 25.9.1997 / 10:03:05 / stefan"
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2146
! !
61fdff318175 Make Device*Handles (used for finalization) private in their resp. classes.
Stefan Vogel <sv@exept.de>
parents: 1889
diff changeset
  2147
4173
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2148
!Form::ImageForm class methodsFor:'documentation'!
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2149
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2150
documentation
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2151
"
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2152
    ImageForm is used for Forms, that have been created from an image and do not
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2153
    hold the image bits.
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2154
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2155
    It does not fetch the image bits when doing a snapshot.
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2156
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2157
    [author:]
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2158
        Stefan Vogel (stefan@zwerg)
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2159
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2160
    [instance variables:]
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2161
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2162
    [class variables:]
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2163
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2164
    [see also:]
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2165
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2166
"
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2167
! !
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2168
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2169
!Form::ImageForm methodsFor:'private'!
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2170
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2171
getBits
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2172
    "do nothing. The image, that created the ImageForm, has the bits"
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2173
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2174
    ^ self
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2175
!
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2176
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2177
recreate
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2178
    "nothing to do here. The image recreates the form if needed"
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2179
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2180
    ^ self
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2181
! !
100ca435fb0e New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents: 4165
diff changeset
  2182
1142
2a83bf7d5627 Form>>readFrom: are going to be obsoleted.
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  2183
!Form class methodsFor:'documentation'!
134
claus
parents: 133
diff changeset
  2184
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2185
version
7106
52956049570c #DOCUMENTATION
mawalch
parents: 6860
diff changeset
  2186
    ^ '$Header$'
7355
b54b8aebbb90 #FEATURE by sr
sr
parents: 7354
diff changeset
  2187
!
b54b8aebbb90 #FEATURE by sr
sr
parents: 7354
diff changeset
  2188
b54b8aebbb90 #FEATURE by sr
sr
parents: 7354
diff changeset
  2189
version_CVS
b54b8aebbb90 #FEATURE by sr
sr
parents: 7354
diff changeset
  2190
    ^ '$Header$'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2191
! !
3811
cfea9bc25737 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
  2192
6046
66cadbdbe9cf class: Form
Claus Gittinger <cg@exept.de>
parents: 5915
diff changeset
  2193
278
15e2959e1e58 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
  2194
Form initialize!