author | ca |
Tue, 26 Mar 1996 16:11:57 +0100 | |
changeset 179 | 14271a2e3625 |
parent 173 | 6bb37093ea47 |
child 193 | daaaf4594c9e |
permissions | -rw-r--r-- |
77 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
Object subclass:#Icon |
|
173
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
14 |
instanceVariableNames:'image mask' |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
15 |
classVariableNames:'KnownIcons' |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
16 |
poolDictionaries:'' |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
17 |
category:'Graphics-Images' |
77 | 18 |
! |
19 |
||
20 |
!Icon class methodsFor:'documentation'! |
|
21 |
||
173
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
22 |
copyright |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
23 |
" |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
24 |
COPYRIGHT (c) 1995 by Claus Gittinger |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
25 |
All Rights Reserved |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
26 |
|
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
27 |
This software is furnished under a license and may be used |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
28 |
only in accordance with the terms of that license and with the |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
29 |
inclusion of the above copyright notice. This software may not |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
30 |
be provided or otherwise made available to, or used by, any |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
31 |
other person. No title to or ownership of the software is |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
32 |
hereby transferred. |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
33 |
" |
77 | 34 |
! |
35 |
||
36 |
documentation |
|
37 |
" |
|
111 | 38 |
ST-80 Compatibility mimicri for Icon. |
39 |
Implements the #constantNamed: message which is used by some ST-80 PD |
|
77 | 40 |
classes and returns corresponding ST/X icons. |
111 | 41 |
|
42 |
If you like the original ST-80 icons, install the xbm files in the bitmap |
|
77 | 43 |
directory under a name foo.xbm, where foo corresponds to the icons |
44 |
name symbol (i.e. for Icon constantNamed:#foo, a 'foo.xbm' file is required). |
|
111 | 45 |
You can grab those icons from manchester or from the PrimeTime Freeware CD. |
46 |
A copy of the PTF-CD is also in goodies/bitmaps/st80bitmaps. |
|
47 |
Then, change the replacementName method to return an empty array. |
|
48 |
||
105 | 49 |
Caveat: |
50 |
masks are not yet implemented |
|
77 | 51 |
" |
52 |
! ! |
|
53 |
||
54 |
!Icon class methodsFor:'initialization'! |
|
55 |
||
173
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
56 |
initialize |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
57 |
KnownIcons isNil ifTrue:[ |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
58 |
KnownIcons := IdentityDictionary new |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
59 |
] |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
60 |
|
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
61 |
" |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
62 |
Icon initialize |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
63 |
" |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
64 |
! |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
65 |
|
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
66 |
replacementNameFor:aName |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
67 |
"return a replacement ST/X name for an ST80 icon name." |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
68 |
|
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
69 |
self replacementNames do:[:aPair | |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
70 |
(aPair at:1) == aName ifTrue:[^ aPair at:2]. |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
71 |
]. |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
72 |
^ nil |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
73 |
! |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
74 |
|
77 | 75 |
replacementNames |
105 | 76 |
"return an ST-80 constant name to ST/X file name translation." |
77 | 77 |
|
78 |
^ #( |
|
79 |
#(file FBrowser) |
|
80 |
#(debugger Debugger) |
|
81 |
#(systembrowser SBrowser) |
|
82 |
#(classbrowser SBrowser) |
|
83 |
#(categoryBrowser SBrowser) |
|
84 |
#(hierarchyBrowser SBrowser) |
|
85 |
#(methodBrowser SBrowser) |
|
86 |
#(launcher SmalltalkX) |
|
87 |
#(workspace SmalltalkX) |
|
88 |
#(transcript SmalltalkX) |
|
89 |
#(inspector Inspector) |
|
90 |
#(default SmalltalkX) |
|
91 |
) |
|
92 |
! ! |
|
93 |
||
94 |
!Icon class methodsFor:'instance creation'! |
|
95 |
||
96 |
constantNamed:aName |
|
97 |
|icon nm| |
|
98 |
||
99 |
icon := KnownIcons at:aName ifAbsent:[]. |
|
100 |
icon isNil ifTrue:[ |
|
173
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
101 |
nm := self replacementNameFor:aName. |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
102 |
nm notNil ifTrue:[ |
179 | 103 |
icon := Image fromFile:('bitmaps/' , nm). |
104 |
icon isNil ifTrue:[ |
|
105 |
icon := Image fromFile:('bitmaps/' , nm , '.xbm'). |
|
106 |
] |
|
173
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
107 |
]. |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
108 |
icon isNil ifTrue:[ |
179 | 109 |
icon := Image fromFile:('bitmaps/' , aName). |
110 |
icon isNil ifTrue:[ |
|
111 |
icon := Image fromFile:('bitmaps/' , aName , '.xbm'). |
|
112 |
]. |
|
173
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
113 |
icon isNil ifTrue:[ |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
114 |
('ICON: no icon named ' , aName) infoPrintNL. |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
115 |
^ nil |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
116 |
]. |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
117 |
icon := icon on:Screen default. |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
118 |
]. |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
119 |
KnownIcons at:aName put:icon. |
77 | 120 |
]. |
121 |
^ icon |
|
122 |
||
123 |
" |
|
124 |
Icon constantNamed:#file |
|
125 |
Icon constantNamed:#debugger |
|
126 |
Icon constantNamed:#systembrowser |
|
84 | 127 |
Icon constantNamed:#SBrowser |
105 | 128 |
Icon constantNamed:#SBrowser |
77 | 129 |
" |
173
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
130 |
|
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
131 |
"Modified: 7.3.1996 / 19:17:15 / cg" |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
132 |
! |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
133 |
|
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
134 |
constantNamed:aName put:anIcon |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
135 |
KnownIcons at:aName put:anIcon |
77 | 136 |
! ! |
137 |
||
173
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
138 |
!Icon class methodsFor:'documentation'! |
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
139 |
|
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
140 |
version |
179 | 141 |
^ '$Header: /cvs/stx/stx/libview2/Icon.st,v 1.8 1996-03-26 15:11:57 ca Exp $' |
173
6bb37093ea47
nicer message / changed category
Claus Gittinger <cg@exept.de>
parents:
158
diff
changeset
|
142 |
! ! |
77 | 143 |
Icon initialize! |