HostGraphicsDevice.st
author Stefan Vogel <sv@exept.de>
Wed, 05 Feb 2020 13:55:32 +0100
changeset 8985 b4d006b79f84
parent 8776 7b28d7a6f3cb
permissions -rw-r--r--
#BUGFIX by stefan class: ModalBox changed: #show #showAt: #showAt:centerX:centerY: #ensure: block to destroy box on abort (e.g. via Timeout-Pin - see 15_Standard_Library_Test.ets)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8776
7b28d7a6f3cb #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 7625
diff changeset
     1
"{ Encoding: utf8 }"
7b28d7a6f3cb #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 7625
diff changeset
     2
1284
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
2840
c8f5ba536263 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2839
diff changeset
     5
	      All Rights Reserved
1284
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 This software is furnished under a license and may be used
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
 hereby transferred.
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"
3285
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
    14
"{ Package: 'stx:libview' }"
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
    15
6884
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
    16
"{ NameSpace: Smalltalk }"
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
    17
1284
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
GraphicsDevice subclass:#HostGraphicsDevice
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
    19
	instanceVariableNames:'graphicsContexts deviceColors deviceFonts deviceCursors'
1284
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	classVariableNames:''
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	poolDictionaries:''
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	category:'Interface-Graphics'
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!HostGraphicsDevice class methodsFor:'documentation'!
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
copyright
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
"
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
2840
c8f5ba536263 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2839
diff changeset
    30
	      All Rights Reserved
1284
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 This software is furnished under a license and may be used
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 only in accordance with the terms of that license and with the
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 be provided or otherwise made available to, or used by, any
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 other person.  No title to or ownership of the software is
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
 hereby transferred.
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
"
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
!
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
documentation
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
"
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    this abstract class was inserted to provide a home for ST-80 classes
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    (previously, DeviceWorkstation was directly under Object).
2813
913aca399962 preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
    47
    We will (over time) move common functionality from there into this class.
1284
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    In ST/X, this is mostly dummy.
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    [see also:]
2840
c8f5ba536263 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2839
diff changeset
    52
	DeviceWorkstation XWorkstation
1284
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    [author:]
2840
c8f5ba536263 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2839
diff changeset
    55
	Claus Gittinger
1284
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
"
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
! !
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
3880
c4c8268a2d9f method category rename
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
    61
!HostGraphicsDevice methodsFor:'Compatibility-Squeak'!
2961
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    62
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    63
deferUpdates: aBoolean
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    64
    "Set the deferUpdates flag in the virtual machine. 
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    65
     When this flag is true, BitBlt operations on the Display are not 
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    66
     automatically propagated to the screen. 
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    67
     If this underlying platform does not support deferred updates, 
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    68
     this primitive will fail. 
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    69
     Answer the receiver if the primitive succeeds, nil if it fails."
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    70
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    71
"/    <primitive: 126>
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    72
    ^ nil  "answer nil if primitive fails"
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    73
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    74
!
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    75
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    76
forceDisplayUpdate
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    77
    "On platforms that buffer screen updates, 
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    78
     force the screen to be updated immediately. 
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    79
     On other platforms, or if the primitive is not implemented, do nothing."
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    80
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    81
"/     <primitive: 231>
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    82
    "do nothing if primitive fails"
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    83
! !
3f5a60b6e06c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2847
diff changeset
    84
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
    85
!HostGraphicsDevice methodsFor:'accessing'!
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
    86
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
    87
deviceColors
1371
22f586987cd1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
    88
    "return the registry keeping track of colors which were allocated
2813
913aca399962 preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
    89
     on this device."
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
    90
6212
3c308b5defa7 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 4541
diff changeset
    91
    ^ deviceColors ? #()
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
    92
6212
3c308b5defa7 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 4541
diff changeset
    93
    "Created: / 24-02-1997 / 18:01:41 / cg"
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
    94
!
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
    95
2843
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
    96
deviceCursors
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
    97
    "return the registry keeping track of cursors which were allocated
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
    98
     on this device."
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
    99
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
   100
    ^ deviceCursors
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
   101
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
   102
    "Created: 24.2.1997 / 18:01:41 / cg"
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
   103
!
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
   104
1371
22f586987cd1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   105
deviceFonts
22f586987cd1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   106
    "return the registry keeping track of fonts which were allocated
2813
913aca399962 preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
   107
     on this device."
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   108
4541
a2ff52d645ea *** empty log message ***
fm
parents: 4222
diff changeset
   109
    ^ deviceFonts ? #()
a2ff52d645ea *** empty log message ***
fm
parents: 4222
diff changeset
   110
a2ff52d645ea *** empty log message ***
fm
parents: 4222
diff changeset
   111
    "Modified: / 28-07-2006 / 19:48:23 / fm"
2813
913aca399962 preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
   112
!
913aca399962 preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents: 2809
diff changeset
   113
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   114
graphicsContexts
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   115
    "return the registry keeping track of graphics contexts which were allocated
2839
36f61177428c color release
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   116
     on this device."
36f61177428c color release
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   117
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   118
    ^ graphicsContexts
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   119
! !
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   120
3444
850728294356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3289
diff changeset
   121
!HostGraphicsDevice methodsFor:'accessing & queries'!
850728294356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3289
diff changeset
   122
850728294356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3289
diff changeset
   123
defaultExtentForTopViews
3447
ca607acad796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3444
diff changeset
   124
    |w h|
ca607acad796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3444
diff changeset
   125
ca607acad796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3444
diff changeset
   126
    w := self width.
ca607acad796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3444
diff changeset
   127
    h := self height.
ca607acad796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3444
diff changeset
   128
ca607acad796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3444
diff changeset
   129
    self isPDA ifTrue:[
ca607acad796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3444
diff changeset
   130
        ^ (w - 16) @ (h - 20)
ca607acad796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3444
diff changeset
   131
    ].
ca607acad796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3444
diff changeset
   132
    ^ (w // 3 * 2) @ (h // 3 * 2)
3444
850728294356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3289
diff changeset
   133
! !
850728294356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3289
diff changeset
   134
3883
4e01a59afccb method category rename
Claus Gittinger <cg@exept.de>
parents: 3880
diff changeset
   135
!HostGraphicsDevice methodsFor:'initialization & release'!
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   136
1367
84941299a4df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   137
initializeDeviceResourceTables
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   138
    graphicsContexts := Registry new.
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   139
    deviceColors := Registry new.
2843
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
   140
    deviceCursors := Registry new.
8776
7b28d7a6f3cb #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 7625
diff changeset
   141
    deviceFonts := CachingRegistry new:75.
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   142
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   143
    "Created: 24.2.1997 / 18:29:53 / cg"
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   144
!
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   145
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   146
releaseDeviceColors
6884
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   147
    deviceColors notNil ifTrue:[
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   148
        deviceColors do:[:aColor |
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   149
            aColor releaseFromDevice
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   150
        ].
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   151
        deviceColors := Registry new.
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   152
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   153
        "TrueColors are not registered.
7546
830c4ba33493 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 7475
diff changeset
   154
         Release them the hard way"
6884
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   155
        Color flushDeviceColorsFor:self.
2839
36f61177428c color release
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   156
    ].
4222
4fee2e231633 Take care to relases the device of TrueColors.
Stefan Vogel <sv@exept.de>
parents: 3927
diff changeset
   157
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   158
    "Created: 24.2.1997 / 18:07:49 / cg"
1371
22f586987cd1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   159
!
22f586987cd1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   160
2843
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
   161
releaseDeviceCursors
6884
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   162
    deviceCursors notNil ifTrue:[
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   163
        deviceCursors do:[:aCursor |
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   164
            aCursor releaseFromDevice
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   165
        ].
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   166
        deviceCursors := Registry new.
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   167
    ]
2843
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
   168
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
   169
    "Created: 24.2.1997 / 18:07:49 / cg"
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
   170
!
e13e0c53924a keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents: 2840
diff changeset
   171
1371
22f586987cd1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   172
releaseDeviceFonts
6884
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   173
    deviceFonts notNil ifTrue:[
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   174
        deviceFonts do:[:aFont |
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   175
            aFont releaseFromDevice.
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   176
        ].
7578
91189b5e373e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 7572
diff changeset
   177
        deviceFonts := CachingRegistry new:20.
2846
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   178
    ].
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   179
!
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   180
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   181
releaseGraphicsContexts
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   182
    graphicsContexts notNil ifTrue:[
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   183
        graphicsContexts unregisterAllForWhichHandle:[:eachHandle |
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   184
            eachHandle finalize. 
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   185
            true
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   186
        ].
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   187
    ]
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   188
! !
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1315
diff changeset
   189
3285
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   190
!HostGraphicsDevice methodsFor:'misc'!
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   191
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   192
recolorCursorsToFgColor:fgColor defaultBgColor:bgColor
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   193
    "change the colors of all existing cursors"
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   194
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   195
    "/ recolor existing cursors
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   196
    deviceCursors do:[:eachCursor | eachCursor foreground:fgColor background:bgColor].
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   197
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   198
    "
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   199
     Display recolorCursorsToFgColor:(Color red) defaultBgColor:(Color white)
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   200
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   201
     Display recolorCursorsToFgColor:(Color blue) defaultBgColor:(Color white)
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   202
     Display recolorCursorsToFgColor:(Color blue) defaultBgColor:(Color black)
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   203
     Display recolorCursorsToFgColor:(Color white) defaultBgColor:(Color black)
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   204
     Display recolorCursorsToFgColor:(Color white) defaultBgColor:(Color red)
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   205
    "
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   206
! !
b39fff2bf608 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   207
2846
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   208
!HostGraphicsDevice methodsFor:'registration'!
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   209
7475
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   210
cleanupLobbyForChildrenOfViewWithId:anId
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   211
    "recursively clean all the subcomponents of the handle with id anId.
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   212
     This must be done on finalization, because descendent handles
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   213
     are destroyed implicitly when a parent handle is destroyed."
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   214
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   215
    |parents newChildren|
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   216
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   217
    parents := Array with:anId address.
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   218
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   219
    [
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   220
        newChildren := Set new.
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   221
        graphicsContexts unregisterAllForWhichHandle:[:handle |
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   222
            |parentId|
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   223
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   224
            handle notNil
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   225
                and:[(parentId := handle parentId) notNil
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   226
                and:[(parents includes:parentId)
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   227
                and:[newChildren add:handle id. true]]].
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   228
        ].
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   229
        parents := newChildren.
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   230
    ] doWhile:[parents notEmpty].
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   231
!
3acd8db4f044 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 7443
diff changeset
   232
2846
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   233
registerColor:aColor
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   234
    deviceColors register:aColor.
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   235
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   236
    "Created: 24.2.1997 / 18:29:10 / cg"
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   237
!
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   238
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   239
registerCursor:aCursor
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   240
    deviceCursors register:aCursor.
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   241
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   242
    "Created: 24.2.1997 / 18:29:10 / cg"
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   243
!
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   244
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   245
registerFont:aFont
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   246
    deviceFonts register:aFont.
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   247
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   248
    "Created: 24.2.1997 / 18:29:10 / cg"
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   249
!
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   250
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   251
registerGraphicsContext:aGC 
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   252
    graphicsContexts register:aGC
2846
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   253
!
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   254
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   255
unregisterColor:aColor
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   256
    deviceColors unregister:aColor.
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   257
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   258
    "Created: 24.2.1997 / 18:29:14 / cg"
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   259
!
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   260
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   261
unregisterCursor:aCursor
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   262
    deviceCursors unregister:aCursor.
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   263
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   264
    "Created: 24.2.1997 / 18:29:14 / cg"
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   265
!
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   266
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   267
unregisterFont:aFont
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   268
    deviceFonts unregister:aFont.
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   269
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   270
    "Created: 24.2.1997 / 18:29:14 / cg"
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   271
!
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   272
7443
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   273
unregisterGraphicsContext:aGC
e2d05b756727 Use devices registry
Stefan Vogel <sv@exept.de>
parents: 6884
diff changeset
   274
    graphicsContexts unregister:aGC
2846
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   275
! !
05c5fdd17641 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2845
diff changeset
   276
1284
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
!HostGraphicsDevice class methodsFor:'documentation'!
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
version
6884
a66985ff01e9 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 6212
diff changeset
   280
    ^ '$Header$'
1284
d17f4d91174d intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
! !
6212
3c308b5defa7 class: HostGraphicsDevice
Claus Gittinger <cg@exept.de>
parents: 4541
diff changeset
   282