author | tz |
Fri, 20 Mar 1998 19:25:20 +0100 | |
changeset 740 | e7362f3ab5e5 |
parent 722 | a1bb632b1e00 |
child 750 | 9b705e31d38e |
permissions | -rw-r--r-- |
156 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by eXept Software AG |
|
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 |
||
14 |
||
148 | 15 |
ApplicationModel subclass:#UIHelpTool |
740 | 16 |
instanceVariableNames:'specClass dictionary dictionaries listSelection modified |
17 |
modifiedHolder maxCharsPerLine' |
|
148 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-UIPainter' |
|
21 |
! |
|
22 |
||
23 |
!UIHelpTool class methodsFor:'documentation'! |
|
24 |
||
156 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1995 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
||
38 |
||
39 |
! |
|
40 |
||
148 | 41 |
documentation |
42 |
" |
|
740 | 43 |
The UIHelpTool allows you to define help dictionaries for the widgets in |
44 |
applications. The tool are able to run stand alone or in other master |
|
45 |
applications like the GUI Painter and the Menu Editor. |
|
46 |
If the application responds to the selector #showHelp:aHelpText for:aView, |
|
47 |
this selector is called by the widget's view when the mouse cursor moves over. |
|
48 |
If the application does not responds to that selector, and the activeHelp mode |
|
49 |
is enabled, an active help bubble is shown at the widget's view. |
|
156 | 50 |
|
51 |
[author:] |
|
52 |
Claus Atzkern |
|
148 | 53 |
" |
54 |
! ! |
|
55 |
||
286 | 56 |
!UIHelpTool class methodsFor:'instance creation'! |
57 |
||
58 |
openOnClass:aClass |
|
59 |
" |
|
60 |
UIHelpTool openOnClass:UIPainter |
|
61 |
" |
|
62 |
||
740 | 63 |
UIHelpTool open helpSpecFrom:aClass |
286 | 64 |
|
65 |
! ! |
|
66 |
||
67 |
!UIHelpTool class methodsFor:'constants'! |
|
68 |
||
69 |
label |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
70 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
71 |
^'Help' |
286 | 72 |
! ! |
73 |
||
151 | 74 |
!UIHelpTool class methodsFor:'help specs'! |
75 |
||
76 |
helpSpec |
|
740 | 77 |
"This resource specification was automatically generated |
78 |
by the UIHelpTool of ST/X." |
|
79 |
||
80 |
"Do not manually edit this!! If it is corrupted, |
|
81 |
the UIHelpTool may not be able to read the specification." |
|
292 | 82 |
|
172 | 83 |
" |
740 | 84 |
UIHelpTool openOnClass:UIHelpTool |
292 | 85 |
" |
86 |
||
740 | 87 |
<resource: #help> |
88 |
||
89 |
^super helpSpec addPairsFrom:#( |
|
151 | 90 |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
91 |
#addHelpTextKey |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
92 |
'Adds help text key.' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
93 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
94 |
#currentHelpTexts |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
95 |
'Selected help text key.' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
96 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
97 |
#deleteHelpTextKey |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
98 |
'Deletes the help text from the help spec.' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
99 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
100 |
#helpTextView |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
101 |
'Shows the help text.' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
102 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
103 |
#listOfHelpSpecClasses |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
104 |
'List of the classes where help specs can be/are implemented.' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
105 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
106 |
#listOfHelpTexts |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
107 |
'List of the help text keys.' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
108 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
109 |
#removeHelpTextKey |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
110 |
'Removes the help text key from the widget.' |
172 | 111 |
|
112 |
) |
|
151 | 113 |
! ! |
114 |
||
148 | 115 |
!UIHelpTool class methodsFor:'interface specs'! |
116 |
||
117 |
windowSpec |
|
740 | 118 |
"This resource specification was automatically generated |
119 |
by the UIPainter of ST/X." |
|
148 | 120 |
|
740 | 121 |
"Do not manually edit this!! If it is corrupted, |
122 |
the UIPainter may not be able to read the specification." |
|
148 | 123 |
|
124 |
" |
|
151 | 125 |
UIPainter new openOnClass:UIHelpTool andSelector:#windowSpec |
126 |
UIHelpTool new openInterface:#windowSpec |
|
740 | 127 |
UIHelpTool open |
148 | 128 |
" |
129 |
||
130 |
<resource: #canvas> |
|
131 |
||
132 |
^ |
|
133 |
||
134 |
#(#FullSpec |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
135 |
#window: |
148 | 136 |
#(#WindowSpec |
740 | 137 |
#name: 'Help Tool' |
138 |
#layout: #(#LayoutFrame 140 0 231 0 425 0 501 0) |
|
139 |
#label: 'Help Tool' |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
140 |
#min: #(#Point 10 10) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
141 |
#max: #(#Point 1160 870) |
740 | 142 |
#bounds: #(#Rectangle 140 231 426 502) |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
143 |
#usePreferredExtent: false |
148 | 144 |
) |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
145 |
#component: |
148 | 146 |
#(#SpecCollection |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
147 |
#collection: |
148 | 148 |
#( |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
149 |
#(#SequenceViewSpec |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
150 |
#name: 'listOfHelpKeysView' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
151 |
#layout: #(#LayoutFrame 3 0 2 0 -1 0.5 -1 0.5) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
152 |
#activeHelpKey: #listOfHelpTexts |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
153 |
#tabable: true |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
154 |
#model: #listModel |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
155 |
#hasHorizontalScrollBar: true |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
156 |
#hasVerticalScrollBar: true |
700 | 157 |
#miniScrollerHorizontal: true |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
158 |
#useIndex: false |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
159 |
#sequenceList: #listChannel |
286 | 160 |
) |
740 | 161 |
#(#ActionButtonSpec |
162 |
#name: 'AddButton' |
|
163 |
#layout: #(#LayoutFrame 2 0.5 2 0 -1 0.67 26 0) |
|
164 |
#activeHelpKey: #addHelpTextKey |
|
165 |
#label: 'Add' |
|
166 |
#tabable: true |
|
167 |
#model: #add |
|
168 |
) |
|
169 |
#(#ActionButtonSpec |
|
170 |
#name: 'RemoveButton' |
|
171 |
#layout: #(#LayoutFrame 1 0.67 2 0 -1 0.83 26 0) |
|
172 |
#activeHelpKey: #removeHelpTextKey |
|
173 |
#label: 'Remove' |
|
174 |
#tabable: true |
|
175 |
#model: #remove |
|
176 |
) |
|
177 |
#(#ActionButtonSpec |
|
178 |
#name: 'DeleteButton' |
|
179 |
#layout: #(#LayoutFrame 1 0.83 2 0 -2 1 26 0) |
|
180 |
#activeHelpKey: #deleteHelpTextKey |
|
181 |
#label: 'Delete' |
|
182 |
#tabable: true |
|
183 |
#model: #delete |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
184 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
185 |
#(#InputFieldSpec |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
186 |
#name: 'helpKeyInputField' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
187 |
#layout: #(#LayoutFrame 1 0.5 29 0 -3 1 51 0) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
188 |
#activeHelpKey: #currentHelpTexts |
740 | 189 |
#tabable: true |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
190 |
#model: #listModel |
722 | 191 |
#immediateAccept: false |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
192 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
193 |
#(#SequenceViewSpec |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
194 |
#name: 'listOfHelpSpecClassesView' |
740 | 195 |
#layout: #(#LayoutFrame 1 0.5 54 0 -3 1 -1 0.5) |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
196 |
#activeHelpKey: #listOfHelpSpecClasses |
740 | 197 |
#tabable: true |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
198 |
#model: #selectionOfHelpSpecClass |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
199 |
#hasHorizontalScrollBar: true |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
200 |
#hasVerticalScrollBar: true |
700 | 201 |
#miniScrollerHorizontal: true |
202 |
#miniScrollerVertical: true |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
203 |
#valueChangeSelector: #helpSpecClassSelected |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
204 |
#useIndex: false |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
205 |
#sequenceList: #listOfHelpSpecClasses |
286 | 206 |
) |
148 | 207 |
#(#TextEditorSpec |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
208 |
#name: 'helpTextView' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
209 |
#layout: #(#LayoutFrame 3 0.0 1 0.5 -1 1.0 -3 1.0) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
210 |
#activeHelpKey: #helpTextView |
740 | 211 |
#tabable: true |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
212 |
#hasHorizontalScrollBar: true |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
213 |
#hasVerticalScrollBar: true |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
214 |
#miniScrollerHorizontal: true |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
215 |
#miniScrollerVertical: true |
148 | 216 |
) |
217 |
) |
|
218 |
) |
|
219 |
) |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
220 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
221 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
222 |
windowSpecForStandAlone |
740 | 223 |
"This resource specification was automatically generated |
224 |
by the UIPainter of ST/X." |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
225 |
|
740 | 226 |
"Do not manually edit this!! If it is corrupted, |
227 |
the UIPainter may not be able to read the specification." |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
228 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
229 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
230 |
UIPainter new openOnClass:UIHelpTool andSelector:#windowSpecForStandAlone |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
231 |
UIHelpTool new openInterface:#windowSpecForStandAlone |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
232 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
233 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
234 |
<resource: #canvas> |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
235 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
236 |
^ |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
237 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
238 |
#(#FullSpec |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
239 |
#window: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
240 |
#(#WindowSpec |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
241 |
#name: 'Help Tool' |
740 | 242 |
#layout: #(#LayoutFrame 534 0 276 0 1033 0 675 0) |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
243 |
#label: 'Help Tool' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
244 |
#min: #(#Point 10 10) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
245 |
#max: #(#Point 1160 870) |
740 | 246 |
#bounds: #(#Rectangle 534 276 1034 676) |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
247 |
#menu: #menu |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
248 |
#usePreferredExtent: false |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
249 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
250 |
#component: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
251 |
#(#SpecCollection |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
252 |
#collection: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
253 |
#( |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
254 |
#(#UISubSpecification |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
255 |
#name: 'UISubSpecification1' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
256 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
257 |
#minorKey: #windowSpec |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
258 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
259 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
260 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
261 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
262 |
! ! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
263 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
264 |
!UIHelpTool class methodsFor:'menu specs'! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
265 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
266 |
menu |
740 | 267 |
"This resource specification was automatically generated |
268 |
by the MenuEditor of ST/X." |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
269 |
|
740 | 270 |
"Do not manually edit this!! If it is corrupted, |
271 |
the MenuEditor may not be able to read the specification." |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
272 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
273 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
274 |
MenuEditor new openOnClass:UIHelpTool andSelector:#menu |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
275 |
(Menu new fromLiteralArrayEncoding:(UIHelpTool menu)) startUp |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
276 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
277 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
278 |
<resource: #menu> |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
279 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
280 |
^ |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
281 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
282 |
#(#Menu |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
283 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
284 |
#( |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
285 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
286 |
#label: 'File' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
287 |
#submenu: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
288 |
#(#Menu |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
289 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
290 |
#( |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
291 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
292 |
#label: 'Reload' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
293 |
#value: #doReload |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
294 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
295 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
296 |
#label: '-' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
297 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
298 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
299 |
#label: 'Save' |
722 | 300 |
#value: #doSave |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
301 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
302 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
303 |
#label: '-' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
304 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
305 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
306 |
#label: 'Define Class...' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
307 |
#value: #doFromClass |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
308 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
309 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
310 |
#label: '-' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
311 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
312 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
313 |
#label: 'Exit' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
314 |
#value: #closeRequest |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
315 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
316 |
) nil |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
317 |
nil |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
318 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
319 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
320 |
) nil |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
321 |
nil |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
322 |
) |
148 | 323 |
! ! |
324 |
||
325 |
!UIHelpTool methodsFor:'accessing'! |
|
326 |
||
710 | 327 |
dictionaries |
722 | 328 |
"get the dictionary of the help dictionaries of the classes having help specs |
329 |
" |
|
710 | 330 |
^dictionaries |
331 |
! |
|
332 |
||
333 |
dictionaries:aDictionaryOfDictionaries |
|
722 | 334 |
"set a dictionary of the help dictionaries of the classes having help specs |
335 |
" |
|
710 | 336 |
(dictionaries := aDictionaryOfDictionaries) isNil ifTrue:[ |
337 |
dictionaries := Dictionary new. |
|
338 |
]. |
|
715 | 339 |
self updateList. |
710 | 340 |
! |
341 |
||
151 | 342 |
dictionary |
722 | 343 |
"get the dictionary of the selected class |
344 |
" |
|
345 |
^dictionary |
|
710 | 346 |
! |
151 | 347 |
|
348 |
dictionary:aDictionary |
|
722 | 349 |
"set dictionary of the selected class |
350 |
" |
|
286 | 351 |
(dictionary := aDictionary) isNil ifTrue:[ |
700 | 352 |
dictionary := Dictionary new. |
286 | 353 |
]. |
354 |
self updateList |
|
355 |
! |
|
356 |
||
357 |
helpKey |
|
722 | 358 |
"get the help key of selected help text |
359 |
" |
|
286 | 360 |
listSelection size ~~ 0 ifTrue:[ |
361 |
^ listSelection asSymbol |
|
151 | 362 |
]. |
286 | 363 |
^ nil |
364 |
! |
|
365 |
||
366 |
helpKey:aKey |
|
722 | 367 |
"set the help key into the selection channel in order to show the help text |
368 |
" |
|
286 | 369 |
|key| |
370 |
aKey size ~~ 0 ifTrue:[ |
|
371 |
key := aKey asString |
|
372 |
]. |
|
373 |
self listModel value:key |
|
459 | 374 |
|
151 | 375 |
! |
376 |
||
196 | 377 |
helpSpecFrom:aClass |
722 | 378 |
"read the help dictionary from aClass and find remaining classes |
379 |
'between' aClass and ApplicationModel |
|
196 | 380 |
" |
286 | 381 |
|help| |
382 |
||
740 | 383 |
modified := false. |
700 | 384 |
specClass notNil |
385 |
ifTrue: |
|
386 |
[ |
|
387 |
dictionary := Dictionary new. |
|
388 |
dictionaries := Dictionary new. |
|
389 |
]. |
|
369 | 390 |
specClass := self applicationClassAssociatedWith:aClass. |
700 | 391 |
(specClass isClass and: [specClass isLoaded]) |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
392 |
ifTrue: |
700 | 393 |
[ |
394 |
(specClass class implements:#helpSpec) ifFalse:[ |
|
395 |
dictionaries at: specClass name put: dictionary |
|
396 |
]. |
|
717
fb90f37268be
bug fixed, if window spec in non application model class implemented
tz
parents:
715
diff
changeset
|
397 |
self listOfHelpSpecClasses contents: (specClass withAllSuperclasses reverse collect: [:cls| cls name]). |
fb90f37268be
bug fixed, if window spec in non application model class implemented
tz
parents:
715
diff
changeset
|
398 |
(self listOfHelpSpecClasses includes: #ApplicationModel) |
fb90f37268be
bug fixed, if window spec in non application model class implemented
tz
parents:
715
diff
changeset
|
399 |
ifTrue: [self listOfHelpSpecClasses removeAll: (ApplicationModel withAllSuperclasses collect: [:cls| cls name])]. |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
400 |
self selectionOfHelpSpecClass value: specClass name. |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
401 |
(builder componentAt: #listOfHelpSpecClassesView) selection: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
402 |
(self listOfHelpSpecClasses value indexOf: specClass name). |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
403 |
self helpSpecClassSelected. |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
404 |
]. |
700 | 405 |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
406 |
self updateList |
196 | 407 |
! |
408 |
||
740 | 409 |
modified |
722 | 410 |
"answer whether the help tool was modified |
411 |
" |
|
740 | 412 |
^modified |
700 | 413 |
! |
414 |
||
740 | 415 |
modified: aBoolean |
722 | 416 |
"set the help tool as modified |
417 |
" |
|
740 | 418 |
modified := aBoolean |
700 | 419 |
! |
420 |
||
286 | 421 |
modifiedHolder:aValueHolder |
422 |
"set the value holder set to true in case of modifying attributes |
|
148 | 423 |
" |
286 | 424 |
modifiedHolder notNil ifTrue:[ |
425 |
modifiedHolder removeDependent:self. |
|
426 |
]. |
|
148 | 427 |
|
286 | 428 |
(modifiedHolder := aValueHolder) notNil ifTrue:[ |
429 |
modifiedHolder addDependent:self. |
|
459 | 430 |
|
431 |
self editTextView notNil ifTrue: [ |
|
432 |
self editTextView modifiedChannel onChangeSend:#value to:[ |
|
433 |
modifiedHolder notNil ifTrue:[ |
|
434 |
self editTextView modifiedChannel value ifTrue:[ |
|
435 |
modifiedHolder value:true |
|
436 |
] |
|
437 |
] |
|
438 |
] |
|
439 |
] |
|
440 |
] |
|
286 | 441 |
|
442 |
||
715 | 443 |
! |
444 |
||
445 |
specClass |
|
722 | 446 |
"get the class on which the help tool works |
447 |
" |
|
715 | 448 |
^specClass |
354 | 449 |
! ! |
450 |
||
148 | 451 |
!UIHelpTool methodsFor:'aspects'! |
452 |
||
453 |
listChannel |
|
722 | 454 |
"get the value holder of the help texts |
455 |
" |
|
148 | 456 |
|holder| |
457 |
(holder := builder bindingAt:#listChannel) isNil ifTrue:[ |
|
354 | 458 |
builder aspectAt:#listChannel put:(holder := OrderedCollection new asValue). |
148 | 459 |
]. |
460 |
^ holder |
|
461 |
! |
|
462 |
||
286 | 463 |
listModel |
722 | 464 |
"get the value holder of the help key |
465 |
" |
|
148 | 466 |
|holder| |
286 | 467 |
(holder := builder bindingAt:#listModel) isNil ifTrue:[ |
468 |
holder := AspectAdaptor new subject:self; forAspect:#listSelection. |
|
469 |
builder aspectAt:#listModel put:holder. |
|
148 | 470 |
]. |
471 |
^ holder |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
472 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
473 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
474 |
listOfHelpSpecClasses |
722 | 475 |
"get the value holder of the specClass and its superclasses |
476 |
which are subclasses of ApplicationModel |
|
477 |
" |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
478 |
|holder| |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
479 |
(holder := builder bindingAt:#listOfHelpSpecClasses) isNil ifTrue:[ |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
480 |
builder aspectAt:#listOfHelpSpecClasses put: (holder := List new) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
481 |
]. |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
482 |
^ holder |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
483 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
484 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
485 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
486 |
selectionOfHelpSpecClass |
722 | 487 |
"get the value holder of the selected help spec class |
488 |
" |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
489 |
|holder| |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
490 |
(holder := builder bindingAt:#selectionOfHelpSpecClass) isNil ifTrue:[ |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
491 |
builder aspectAt:#selectionOfHelpSpecClass put: (holder := ValueHolder new) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
492 |
]. |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
493 |
^ holder |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
494 |
|
148 | 495 |
! ! |
496 |
||
740 | 497 |
!UIHelpTool methodsFor:'callbacks'! |
148 | 498 |
|
740 | 499 |
helpSpecClassSelected |
500 |
"extract the help dictionary from the selected class and make it current |
|
148 | 501 |
" |
740 | 502 |
|clsName| |
503 |
||
504 |
clsName := self selectionOfHelpSpecClass value. |
|
505 |
||
506 |
(dictionary := dictionaries at: clsName ifAbsent: nil) isNil |
|
507 |
ifTrue: |
|
508 |
[ |
|
509 |
dictionary := dictionaries at: clsName put: (self extractHelpSpecForClass: (Smalltalk at: clsName)) |
|
510 |
]. |
|
511 |
||
512 |
self updateList. |
|
722 | 513 |
|
740 | 514 |
listSelection notNil |
515 |
ifTrue: |
|
516 |
[ |
|
517 |
(dictionary keys includes: listSelection asSymbol) |
|
518 |
ifTrue: [(builder componentAt: #listOfHelpKeysView) selection: |
|
519 |
(self listChannel value indexOf: (builder componentAt: #helpKeyInputField) contents)] |
|
520 |
ifFalse: [(builder componentAt: #listOfHelpKeysView) selection: nil]. |
|
521 |
]. |
|
522 |
listSelection notNil |
|
523 |
ifTrue: |
|
524 |
[ |
|
525 |
self editTextView contents: (dictionary at: listSelection asSymbol ifAbsent: '') |
|
526 |
] |
|
527 |
||
369 | 528 |
|
286 | 529 |
! ! |
530 |
||
531 |
!UIHelpTool methodsFor:'private'! |
|
532 |
||
740 | 533 |
applicationClassAssociatedWith:aClass |
534 |
"get application class keeping the associated help text or nil |
|
535 |
" |
|
536 |
|cls| |
|
537 |
||
538 |
((cls := self resolveName:aClass) notNil and:[cls includesBehavior:UISpecification]) ifTrue:[ |
|
539 |
^UISpecificationTool |
|
540 |
]. |
|
541 |
^cls |
|
542 |
||
543 |
||
544 |
! |
|
545 |
||
286 | 546 |
editTextView |
547 |
"get the editTextView or nil. |
|
548 |
" |
|
549 |
|view| |
|
550 |
||
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
551 |
(view := builder componentAt:#helpTextView) notNil ifTrue:[ |
286 | 552 |
view := view scrolledView. |
553 |
||
554 |
view acceptAction isNil ifTrue:[ |
|
555 |
view acceptAction:[:aList| self accept ]. |
|
556 |
]. |
|
557 |
||
558 |
view left ~~ 0 ifTrue:[ |
|
559 |
(maxCharsPerLine := view extent x // view font width) < 10 ifTrue:[ |
|
560 |
maxCharsPerLine := nil |
|
561 |
] |
|
562 |
]. |
|
454 | 563 |
]. |
286 | 564 |
^ view |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
565 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
566 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
567 |
extractHelpSpecForClass: aClass |
722 | 568 |
"extract the help dictionary of aClass, it current and return it |
569 |
" |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
570 |
|helpSpecSuperClass superHelpSpecKeys helpSpec| |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
571 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
572 |
((aClass class implements: #helpSpec) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
573 |
and: [(helpSpecSuperClass := aClass allSuperclasses detect: [:cls| cls class implements: #helpSpec] ifNone: nil) notNil]) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
574 |
ifTrue: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
575 |
[ |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
576 |
superHelpSpecKeys := helpSpecSuperClass helpSpec keys. |
700 | 577 |
helpSpec := Dictionary new. |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
578 |
aClass helpSpec associationsDo: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
579 |
[:asso| |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
580 |
(superHelpSpecKeys includes: asso key) ifFalse: [helpSpec at: asso key put: asso value] |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
581 |
]. |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
582 |
^dictionary := helpSpec |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
583 |
]. |
700 | 584 |
^dictionary := Dictionary new |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
585 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
586 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
587 |
findHelpSpecForKey: aHelpKey |
722 | 588 |
"find the help spec class including aHelpKey in its help dictionary and make it current |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
589 |
" |
700 | 590 |
|dictTemp helpSpecClass superHelpSpecKeys helpSpec| |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
591 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
592 |
aHelpKey isNil ifTrue: [^nil]. |
700 | 593 |
dictTemp := dictionary. |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
594 |
self listOfHelpSpecClasses value do: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
595 |
[:clsName| |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
596 |
(dictionary := dictionaries at: clsName ifAbsent: nil) isNil |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
597 |
ifTrue: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
598 |
[ |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
599 |
dictionary := dictionaries at: clsName put: (self extractHelpSpecForClass: (Smalltalk at: clsName)) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
600 |
]. |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
601 |
(dictionary includesKey: aHelpKey asSymbol) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
602 |
ifTrue: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
603 |
[ |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
604 |
self updateList. |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
605 |
^(builder componentAt: #listOfHelpSpecClassesView) selection: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
606 |
(self listOfHelpSpecClasses value indexOf: clsName). |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
607 |
] |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
608 |
]. |
700 | 609 |
dictionary := dictTemp |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
610 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
611 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
612 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
613 |
|
740 | 614 |
installHelpSpecOnClass:aClass |
615 |
"save the help dicts in aClass which is subclass of ApplicationModel" |
|
616 |
||
617 |
|cls src helpSpec| |
|
618 |
||
619 |
cls := self applicationClassAssociatedWith:aClass. |
|
620 |
||
621 |
cls isNil ifTrue:[ |
|
622 |
self information:'No application class defined!!'. |
|
623 |
^nil |
|
624 |
]. |
|
625 |
||
626 |
(cls isSubclassOf: ApplicationModel) ifFalse:[ |
|
627 |
self information: 'Cannot save help spec into class ', cls name asBoldText, ',\because it is not a subclass of ApplicationModel!!' withCRs. |
|
628 |
^nil |
|
629 |
]. |
|
630 |
||
631 |
helpSpec := dictionaries |
|
632 |
at: cls name |
|
633 |
ifAbsent: [specClass notNil |
|
634 |
ifTrue: [dictionaries at: aClass put: (self extractHelpSpecForClass: (Smalltalk at: aClass))] |
|
635 |
ifFalse: [dictionary size > 0 ifTrue: [dictionary] ifFalse: [Dictionary new]]]. |
|
636 |
||
637 |
(cls class implements: #helpSpec) |
|
638 |
ifTrue: |
|
639 |
[ |
|
640 |
|superclassHelpKeys implementedHelpSpec hasChanged| |
|
641 |
implementedHelpSpec := Dictionary new. |
|
642 |
superclassHelpKeys := (cls superclass respondsTo: #helpSpec) |
|
643 |
ifTrue: [cls superclass helpSpec keys] |
|
644 |
ifFalse: [Array new]. |
|
645 |
||
646 |
cls helpSpec associationsDo: [:h| (superclassHelpKeys includes: h key) |
|
647 |
ifFalse: [implementedHelpSpec at: h key put: h value]]. |
|
648 |
||
649 |
hasChanged := false. |
|
650 |
implementedHelpSpec associationsDo: [:h| (helpSpec includesAssociation: h) ifFalse: [hasChanged := true]]. |
|
651 |
helpSpec associationsDo: [:h| (implementedHelpSpec includesAssociation: h) ifFalse: [hasChanged := true]]. |
|
652 |
||
653 |
(implementedHelpSpec notEmpty and: [hasChanged and: |
|
654 |
[DialogBox confirm: 'Class ', cls name asBoldText, ' already implements\a help spec!!\\Do only replace, if you have removed\help keys in an existing help spec.\' withCRs yesLabel: ' Merge ' noLabel: ' Replace ']]) |
|
655 |
ifTrue: |
|
656 |
[ |
|
657 |
implementedHelpSpec associationsDo: [:h| (helpSpec includesKey: h key) |
|
658 |
ifFalse: [helpSpec at: h key put: h value]]. |
|
659 |
] |
|
660 |
]. |
|
661 |
||
662 |
helpSpec isEmpty ifTrue:[ |
|
663 |
^(cls superclass respondsTo: #helpSpec) ifTrue: [cls class removeSelector: #helpSpec]. |
|
664 |
]. |
|
665 |
||
666 |
src := '' writeStream. |
|
667 |
||
668 |
src nextPutAll: |
|
669 |
'helpSpec\' withCRs, |
|
670 |
(ResourceSpecEditor codeGenerationCommentForClass: UIHelpTool) withCRs, |
|
671 |
'\\' withCRs, |
|
672 |
' "\' withCRs, |
|
673 |
' UIHelpTool openOnClass:', cls name asString ,' |
|
674 |
" |
|
675 |
||
676 |
<resource: #help> |
|
677 |
||
678 |
^super helpSpec addPairsFrom:#( |
|
679 |
||
680 |
'. |
|
681 |
||
682 |
helpSpec keys asSortedCollection |
|
683 |
do:[:key | |
|
684 |
|txt t| |
|
685 |
||
686 |
txt := helpSpec at:key. |
|
687 |
src nextPutLine:key storeString. |
|
688 |
||
689 |
t := txt asString replaceAll:(Character cr) with:(Character space). |
|
690 |
||
691 |
(t endsWith:Character space) ifTrue:[ |
|
692 |
t := t copyWithoutLast:1 |
|
693 |
]. |
|
694 |
src nextPutLine:t storeString; cr. |
|
695 |
]. |
|
696 |
src nextPutLine:')'. |
|
697 |
||
698 |
Compiler |
|
699 |
compile:(src contents) |
|
700 |
forClass:cls class |
|
701 |
inCategory:'help specs'. |
|
702 |
! |
|
703 |
||
704 |
installHelpSpecsOnClass:aClass |
|
705 |
"save the help dicts on aClass and its superclasses which are subclasses of ApplicationModel |
|
706 |
" |
|
707 |
|cls helpSpecClasses| |
|
708 |
||
709 |
modified ifFalse:[ |
|
710 |
^nil |
|
711 |
]. |
|
712 |
||
713 |
cls := aClass isClass ifTrue: [aClass name] ifFalse: [aClass]. |
|
714 |
||
715 |
(helpSpecClasses := self listOfHelpSpecClasses value) notNil |
|
716 |
ifTrue: |
|
717 |
[ |
|
718 |
(helpSpecClasses includes: cls) ifFalse: [helpSpecClasses add: cls]. |
|
719 |
helpSpecClasses do: [:clsName| (self installHelpSpecOnClass: clsName) isNil ifTrue: [^modified := false]]. |
|
720 |
] |
|
721 |
ifFalse: |
|
722 |
[ |
|
723 |
self installHelpSpecOnClass: cls |
|
724 |
]. |
|
725 |
||
726 |
modified := false. |
|
727 |
||
728 |
! |
|
729 |
||
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
730 |
updateList |
722 | 731 |
"update the list channel from dictionary |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
732 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
733 |
self listChannel value: dictionary keys asSortedCollection |
286 | 734 |
! ! |
735 |
||
736 |
!UIHelpTool methodsFor:'selection'! |
|
737 |
||
738 |
listSelection |
|
739 |
"returns current selection |
|
740 |
" |
|
741 |
^ listSelection |
|
742 |
! |
|
743 |
||
744 |
listSelection:aSelection |
|
745 |
"current selection changed |
|
746 |
" |
|
299 | 747 |
|txt view sel| |
286 | 748 |
|
722 | 749 |
aSelection isNil |
750 |
ifTrue: [(builder componentAt: #listOfHelpKeysView) selection: nil] |
|
751 |
ifFalse: [(dictionary includesKey: aSelection asSymbol) ifFalse: [self findHelpSpecForKey: aSelection]]. |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
752 |
|
286 | 753 |
aSelection isNumber ifTrue:[ |
754 |
aSelection ~~ 0 ifTrue:[ |
|
755 |
sel := self listChannel value at:aSelection |
|
756 |
] |
|
757 |
] ifFalse:[ |
|
758 |
aSelection size ~~ 0 ifTrue:[ |
|
759 |
sel := aSelection withoutSeparators. |
|
760 |
sel size == 0 ifTrue:[ |
|
761 |
sel := nil |
|
762 |
] |
|
763 |
] |
|
764 |
]. |
|
765 |
||
299 | 766 |
listSelection = sel ifFalse:[ |
767 |
listSelection := sel. |
|
286 | 768 |
|
299 | 769 |
modifiedHolder notNil ifTrue:[ |
770 |
modifiedHolder value:true. |
|
771 |
]. |
|
286 | 772 |
|
299 | 773 |
(view := self editTextView) notNil ifTrue:[ |
774 |
listSelection notNil ifTrue:[ |
|
775 |
txt := dictionary at:(listSelection asSymbol) ifAbsent:nil. |
|
286 | 776 |
|
299 | 777 |
(txt isNil or:[maxCharsPerLine isNil]) ifFalse:[ |
369 | 778 |
txt := UIPainter convertString:(txt asString) maxLineSize:maxCharsPerLine skipLineFeed:false. |
286 | 779 |
] |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
780 |
]. |
459 | 781 |
view contents:txt. |
782 |
view modified:false. |
|
299 | 783 |
] |
784 |
] |
|
286 | 785 |
|
786 |
! ! |
|
787 |
||
369 | 788 |
!UIHelpTool methodsFor:'startup / release'! |
789 |
||
790 |
closeRequest |
|
722 | 791 |
"before closing the help tool, ask for permission |
792 |
" |
|
740 | 793 |
(modified and:[self masterApplication isNil]) ifTrue:[ |
459 | 794 |
(self confirm:'Exit without saving your modifications?') ifFalse:[ |
369 | 795 |
^ self |
796 |
] |
|
797 |
]. |
|
740 | 798 |
^super closeRequest |
799 |
! |
|
800 |
||
801 |
initialize |
|
802 |
"initialize instance variables |
|
803 |
" |
|
804 |
super initialize. |
|
805 |
||
806 |
dictionary := Dictionary new. |
|
807 |
dictionaries := Dictionary new. |
|
808 |
modified := false. |
|
809 |
||
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
810 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
811 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
812 |
openInterface:aSymbol |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
813 |
"open interface |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
814 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
815 |
super openInterface: #windowSpecForStandAlone |
369 | 816 |
! ! |
817 |
||
740 | 818 |
!UIHelpTool methodsFor:'user actions'! |
286 | 819 |
|
722 | 820 |
accept |
821 |
"accept the help text |
|
822 |
" |
|
823 |
|view key txt list listChgd| |
|
824 |
||
825 |
(listSelection size == 0 or:[(view := self editTextView) isNil]) ifFalse:[ |
|
826 |
txt := view contents asString. |
|
827 |
key := listSelection asSymbol. |
|
828 |
list := self listChannel value. |
|
829 |
||
830 |
(listChgd := (dictionary at:key ifAbsent:nil) isNil) ifTrue:[ |
|
831 |
list add:key. |
|
832 |
]. |
|
833 |
dictionary at:key put:txt. |
|
834 |
||
835 |
listChgd ifTrue:[ |
|
836 |
self updateList. |
|
837 |
(builder componentAt: #listOfHelpKeysView) selection: (list indexOf: key). |
|
838 |
]. |
|
839 |
||
740 | 840 |
modified := true. |
722 | 841 |
modifiedHolder notNil ifTrue: [modifiedHolder value:true] |
842 |
] |
|
843 |
! |
|
844 |
||
845 |
add |
|
846 |
"add help key |
|
847 |
" |
|
848 |
self listModel value: (builder componentAt: #helpKeyInputField asSymbol) contents. |
|
849 |
self accept |
|
850 |
! |
|
851 |
||
852 |
delete |
|
853 |
"delete selected help key |
|
854 |
" |
|
855 |
listSelection notNil |
|
856 |
ifTrue: |
|
857 |
[ |
|
858 |
dictionary removeKey: listSelection asSymbol ifAbsent: nil. |
|
859 |
self remove. |
|
860 |
||
861 |
self updateList. |
|
862 |
||
740 | 863 |
modified := true. |
722 | 864 |
modifiedHolder notNil ifTrue: [modifiedHolder value:true] |
865 |
] |
|
866 |
! |
|
867 |
||
286 | 868 |
doFromClass |
869 |
"setup new specification from a class accessed through to a dialog |
|
870 |
" |
|
701 | 871 |
|cls cls2 accepted| |
286 | 872 |
|
873 |
specClass notNil ifTrue:[cls := specClass name asValue] |
|
874 |
ifFalse:[cls := '' asValue]. |
|
875 |
||
876 |
[true] whileTrue:[ |
|
877 |
accepted := |
|
878 |
(DialogBox new |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
879 |
addTextLabel:'Class name:'; |
286 | 880 |
addInputFieldOn:cls; |
881 |
addAbortButton; |
|
882 |
addOkButton; |
|
883 |
open |
|
884 |
) accepted. |
|
885 |
accepted ifFalse:[^ self]. |
|
701 | 886 |
cls2 := self applicationClassAssociatedWith:cls value. |
286 | 887 |
|
701 | 888 |
(cls2 notNil and: [cls2 respondsTo: #helpSpec]) ifTrue:[ |
889 |
^ self helpSpecFrom:cls2 |
|
286 | 890 |
]. |
701 | 891 |
self warn:'No help spec found in class ', cls value asBoldText, '!!'. |
286 | 892 |
] |
893 |
! |
|
894 |
||
895 |
doReload |
|
722 | 896 |
"reload the help dictionaries |
286 | 897 |
" |
898 |
|oldSel model| |
|
899 |
||
900 |
model := self listModel. |
|
901 |
oldSel := model value. |
|
902 |
model value:nil. |
|
903 |
self helpSpecFrom:specClass. |
|
904 |
model value:oldSel. |
|
740 | 905 |
modified := false. |
369 | 906 |
|
722 | 907 |
! |
908 |
||
909 |
doSave |
|
910 |
"save the help dictionaries |
|
911 |
" |
|
912 |
self installHelpSpecsOnClass:specClass |
|
913 |
! |
|
914 |
||
915 |
remove |
|
916 |
"remove selected help key |
|
917 |
" |
|
918 |
self listModel value: nil. |
|
919 |
self updateList. |
|
920 |
modifiedHolder notNil ifTrue: [modifiedHolder value:true] |
|
740 | 921 |
! |
922 |
||
923 |
reset |
|
924 |
"reset the help tool |
|
925 |
" |
|
926 |
specClass := listSelection := nil. |
|
927 |
self dictionary: nil. |
|
928 |
self dictionaries: nil. |
|
929 |
self listOfHelpSpecClasses removeAll. |
|
930 |
modified := false. |
|
148 | 931 |
! ! |
932 |
||
933 |
!UIHelpTool class methodsFor:'documentation'! |
|
934 |
||
935 |
version |
|
936 |
^ '$Header$' |
|
937 |
! ! |