author | ca |
Tue, 14 Apr 1998 13:33:49 +0200 | |
changeset 775 | 0ead717f3e35 |
parent 761 | 91e524583390 |
child 779 | 2ffa22f97d5d |
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 |
||
750 | 15 |
ToolApplicationModel subclass:#UIHelpTool |
16 |
instanceVariableNames:'specClass specSelector dictionary dictionaries listSelection |
|
17 |
modifiedHolder maxCharsPerLine modified' |
|
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 |
761
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
44 |
window applications. The tool are able to run stand alone or in other master |
740 | 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:] |
|
750 | 52 |
Claus Atzkern, eXept Software AG |
53 |
Thomas Zwick, eXept Software AG |
|
148 | 54 |
" |
55 |
! ! |
|
56 |
||
286 | 57 |
!UIHelpTool class methodsFor:'instance creation'! |
58 |
||
59 |
openOnClass:aClass |
|
60 |
" |
|
750 | 61 |
UIHelpTool openOnClass:self |
286 | 62 |
" |
63 |
||
750 | 64 |
UIHelpTool new openOnClass:aClass |
65 |
||
66 |
! ! |
|
67 |
||
68 |
!UIHelpTool class methodsFor:'accessing'! |
|
69 |
||
70 |
resourceType |
|
71 |
"get the type of resource of the method generated by the Help Tool" |
|
72 |
||
73 |
^#help |
|
74 |
||
286 | 75 |
|
76 |
! ! |
|
77 |
||
78 |
!UIHelpTool class methodsFor:'constants'! |
|
79 |
||
80 |
label |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
81 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
82 |
^'Help' |
286 | 83 |
! ! |
84 |
||
151 | 85 |
!UIHelpTool class methodsFor:'help specs'! |
86 |
||
87 |
helpSpec |
|
740 | 88 |
"This resource specification was automatically generated |
89 |
by the UIHelpTool of ST/X." |
|
90 |
||
91 |
"Do not manually edit this!! If it is corrupted, |
|
92 |
the UIHelpTool may not be able to read the specification." |
|
292 | 93 |
|
172 | 94 |
" |
740 | 95 |
UIHelpTool openOnClass:UIHelpTool |
292 | 96 |
" |
97 |
||
740 | 98 |
<resource: #help> |
99 |
||
100 |
^super helpSpec addPairsFrom:#( |
|
151 | 101 |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
102 |
#addHelpTextKey |
750 | 103 |
'Adds the help text key to the help spec.' |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
104 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
105 |
#currentHelpTexts |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
106 |
'Selected help text key.' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
107 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
108 |
#deleteHelpTextKey |
750 | 109 |
'Deletes the help text key from the help spec.' |
110 |
||
111 |
#fileLoad |
|
112 |
'Opens a dialog for selecting and loading a help spec from a class.' |
|
113 |
||
114 |
#fileSave |
|
115 |
'Saves current help spec.' |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
116 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
117 |
#helpTextView |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
118 |
'Shows the help text.' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
119 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
120 |
#listOfHelpSpecClasses |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
121 |
'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
|
122 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
123 |
#listOfHelpTexts |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
124 |
'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
|
125 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
126 |
#removeHelpTextKey |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
127 |
'Removes the help text key from the widget.' |
172 | 128 |
|
129 |
) |
|
151 | 130 |
! ! |
131 |
||
148 | 132 |
!UIHelpTool class methodsFor:'interface specs'! |
133 |
||
134 |
windowSpec |
|
740 | 135 |
"This resource specification was automatically generated |
136 |
by the UIPainter of ST/X." |
|
148 | 137 |
|
740 | 138 |
"Do not manually edit this!! If it is corrupted, |
139 |
the UIPainter may not be able to read the specification." |
|
148 | 140 |
|
141 |
" |
|
151 | 142 |
UIPainter new openOnClass:UIHelpTool andSelector:#windowSpec |
143 |
UIHelpTool new openInterface:#windowSpec |
|
740 | 144 |
UIHelpTool open |
148 | 145 |
" |
146 |
||
147 |
<resource: #canvas> |
|
148 |
||
149 |
^ |
|
150 |
||
151 |
#(#FullSpec |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
152 |
#window: |
148 | 153 |
#(#WindowSpec |
740 | 154 |
#name: 'Help Tool' |
750 | 155 |
#layout: #(#LayoutFrame 155 0 273 0 440 0 543 0) |
740 | 156 |
#label: 'Help Tool' |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
157 |
#min: #(#Point 10 10) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
158 |
#max: #(#Point 1160 870) |
750 | 159 |
#bounds: #(#Rectangle 155 273 441 544) |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
160 |
#usePreferredExtent: false |
148 | 161 |
) |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
162 |
#component: |
148 | 163 |
#(#SpecCollection |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
164 |
#collection: |
148 | 165 |
#( |
750 | 166 |
#(#VariableVerticalPanelSpec |
167 |
#name: 'VariableVerticalPanel' |
|
168 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
169 |
#component: |
|
170 |
#(#SpecCollection |
|
171 |
#collection: |
|
172 |
#( |
|
173 |
#(#VariableHorizontalPanelSpec |
|
174 |
#name: 'VariableHorizontalPanel' |
|
175 |
#component: |
|
176 |
#(#SpecCollection |
|
177 |
#collection: |
|
178 |
#( |
|
179 |
#(#SequenceViewSpec |
|
180 |
#name: 'listOfHelpKeysView' |
|
181 |
#activeHelpKey: #listOfHelpTexts |
|
182 |
#tabable: true |
|
183 |
#model: #listModel |
|
184 |
#hasHorizontalScrollBar: true |
|
185 |
#hasVerticalScrollBar: true |
|
186 |
#miniScrollerHorizontal: true |
|
187 |
#useIndex: false |
|
188 |
#sequenceList: #listChannel |
|
189 |
) |
|
190 |
#(#ViewSpec |
|
191 |
#name: 'Box' |
|
192 |
#component: |
|
193 |
#(#SpecCollection |
|
194 |
#collection: |
|
195 |
#( |
|
196 |
#(#InputFieldSpec |
|
197 |
#name: 'helpKeyInputField' |
|
198 |
#layout: #(#LayoutFrame 0 0.0 29 0 0 1.0 51 0) |
|
199 |
#activeHelpKey: #currentHelpTexts |
|
200 |
#tabable: true |
|
201 |
#model: #listModel |
|
202 |
#immediateAccept: false |
|
203 |
) |
|
204 |
#(#SequenceViewSpec |
|
205 |
#name: 'listOfHelpSpecClassesView' |
|
206 |
#layout: #(#LayoutFrame 0 0.0 54 0 0 1.0 0 1.0) |
|
207 |
#activeHelpKey: #listOfHelpSpecClasses |
|
208 |
#tabable: true |
|
209 |
#model: #selectionOfHelpSpecClass |
|
210 |
#hasHorizontalScrollBar: true |
|
211 |
#hasVerticalScrollBar: true |
|
212 |
#miniScrollerHorizontal: true |
|
213 |
#miniScrollerVertical: true |
|
214 |
#valueChangeSelector: #helpSpecClassSelected |
|
215 |
#useIndex: false |
|
216 |
#sequenceList: #listOfHelpSpecClasses |
|
217 |
) |
|
218 |
#(#HorizontalPanelViewSpec |
|
219 |
#name: 'HorizontalPanel1' |
|
220 |
#layout: #(#LayoutFrame 0 0.0 2 0 0 1.0 26 0) |
|
221 |
#component: |
|
222 |
#(#SpecCollection |
|
223 |
#collection: |
|
224 |
#( |
|
225 |
#(#ActionButtonSpec |
|
226 |
#name: 'AddButton' |
|
227 |
#activeHelpKey: #addHelpTextKey |
|
228 |
#label: 'Add' |
|
229 |
#tabable: true |
|
230 |
#model: #doAdd |
|
231 |
#extent: #(#Point 44 24) |
|
232 |
) |
|
233 |
#(#ActionButtonSpec |
|
234 |
#name: 'RemoveButton' |
|
235 |
#activeHelpKey: #removeHelpTextKey |
|
236 |
#label: 'Remove' |
|
237 |
#tabable: true |
|
238 |
#model: #doRemove |
|
239 |
#extent: #(#Point 45 24) |
|
240 |
) |
|
241 |
#(#ActionButtonSpec |
|
242 |
#name: 'DeleteButton' |
|
243 |
#activeHelpKey: #deleteHelpTextKey |
|
244 |
#label: 'Delete' |
|
245 |
#tabable: true |
|
246 |
#model: #doDelete |
|
247 |
#extent: #(#Point 45 24) |
|
248 |
) |
|
249 |
) |
|
250 |
) |
|
251 |
#horizontalLayout: #fit |
|
252 |
#verticalLayout: #fit |
|
253 |
#horizontalSpace: 3 |
|
254 |
#verticalSpace: 3 |
|
255 |
) |
|
256 |
) |
|
257 |
) |
|
258 |
) |
|
259 |
) |
|
260 |
) |
|
261 |
#handles: #(#Any 0.5 1.0) |
|
262 |
) |
|
263 |
#(#TextEditorSpec |
|
264 |
#name: 'helpTextView' |
|
265 |
#activeHelpKey: #helpTextView |
|
266 |
#tabable: true |
|
267 |
#hasHorizontalScrollBar: true |
|
268 |
#hasVerticalScrollBar: true |
|
269 |
#miniScrollerHorizontal: true |
|
270 |
#miniScrollerVertical: true |
|
271 |
) |
|
272 |
) |
|
273 |
) |
|
274 |
#handles: #(#Any 0.5 1.0) |
|
148 | 275 |
) |
276 |
) |
|
277 |
) |
|
278 |
) |
|
696
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 |
windowSpecForStandAlone |
740 | 282 |
"This resource specification was automatically generated |
283 |
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
|
284 |
|
740 | 285 |
"Do not manually edit this!! If it is corrupted, |
286 |
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
|
287 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
288 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
289 |
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
|
290 |
UIHelpTool new openInterface:#windowSpecForStandAlone |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
291 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
292 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
293 |
<resource: #canvas> |
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 |
^ |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
296 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
297 |
#(#FullSpec |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
298 |
#window: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
299 |
#(#WindowSpec |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
300 |
#name: 'Help Tool' |
750 | 301 |
#layout: #(#LayoutFrame 191 0 334 0 660 0 663 0) |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
302 |
#label: 'Help Tool' |
750 | 303 |
#min: #(#Point 300 300) |
304 |
#max: #(#Point 1152 900) |
|
305 |
#bounds: #(#Rectangle 191 334 661 664) |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
306 |
#menu: #menu |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
307 |
#usePreferredExtent: false |
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 |
#component: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
310 |
#(#SpecCollection |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
311 |
#collection: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
312 |
#( |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
313 |
#(#UISubSpecification |
750 | 314 |
#name: 'windowSpec' |
315 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -26 1.0) |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
316 |
#minorKey: #windowSpec |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
317 |
) |
750 | 318 |
#(#UISubSpecification |
319 |
#name: 'windowSpecForInfoBar' |
|
320 |
#layout: #(#LayoutFrame 0 0 -24 1 0 1 0 1) |
|
321 |
#majorKey: #ToolApplicationModel |
|
322 |
#minorKey: #windowSpecForInfoBar |
|
323 |
) |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
324 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
325 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
326 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
327 |
! ! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
328 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
329 |
!UIHelpTool class methodsFor:'menu specs'! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
330 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
331 |
menu |
740 | 332 |
"This resource specification was automatically generated |
333 |
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
|
334 |
|
740 | 335 |
"Do not manually edit this!! If it is corrupted, |
336 |
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
|
337 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
338 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
339 |
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
|
340 |
(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
|
341 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
342 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
343 |
<resource: #menu> |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
344 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
345 |
^ |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
346 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
347 |
#(#Menu |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
348 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
349 |
#( |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
350 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
351 |
#label: 'File' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
352 |
#submenu: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
353 |
#(#Menu |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
354 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
355 |
#( |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
356 |
#(#MenuItem |
750 | 357 |
#label: 'Load' |
358 |
#value: #doLoad |
|
359 |
#activeHelpKey: #fileLoad |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
360 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
361 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
362 |
#label: '-' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
363 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
364 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
365 |
#label: 'Save' |
722 | 366 |
#value: #doSave |
750 | 367 |
#activeHelpKey: #fileSave |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
368 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
369 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
370 |
#label: '-' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
371 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
372 |
#(#MenuItem |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
373 |
#label: 'Exit' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
374 |
#value: #closeRequest |
750 | 375 |
#activeHelpKey: #fileExit |
376 |
) |
|
377 |
) nil |
|
378 |
nil |
|
379 |
) |
|
380 |
) |
|
381 |
#(#MenuItem |
|
382 |
#label: 'Edit' |
|
383 |
#submenu: |
|
384 |
#(#Menu |
|
385 |
||
386 |
#( |
|
387 |
#(#MenuItem |
|
388 |
#label: 'Add' |
|
389 |
#value: #doAdd |
|
390 |
#activeHelpKey: #addHelpTextKey |
|
391 |
) |
|
392 |
#(#MenuItem |
|
393 |
#label: '-' |
|
394 |
) |
|
395 |
#(#MenuItem |
|
396 |
#label: 'Delete' |
|
397 |
#value: #doDelete |
|
398 |
#activeHelpKey: #deleteHelpTextKey |
|
399 |
) |
|
400 |
) nil |
|
401 |
nil |
|
402 |
) |
|
403 |
) |
|
404 |
#(#MenuItem |
|
405 |
#label: 'Help' |
|
406 |
#startGroup: #right |
|
407 |
#submenu: |
|
408 |
#(#Menu |
|
409 |
||
410 |
#( |
|
411 |
#(#MenuItem |
|
412 |
#label: 'Documentation' |
|
413 |
#value: #openHTMLDocument: |
|
414 |
#activeHelpKey: #helpHelpTool |
|
415 |
#argument: 'tools/uipainter/HelpTool.html' |
|
416 |
) |
|
417 |
#(#MenuItem |
|
418 |
#label: '-' |
|
419 |
) |
|
420 |
#(#MenuItem |
|
421 |
#label: 'Show Help Texts' |
|
422 |
#activeHelpKey: #helpShowHelp |
|
423 |
#indication: #showHelp: |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
424 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
425 |
) nil |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
426 |
nil |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
427 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
428 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
429 |
) nil |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
430 |
nil |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
431 |
) |
148 | 432 |
! ! |
433 |
||
434 |
!UIHelpTool methodsFor:'accessing'! |
|
435 |
||
710 | 436 |
dictionaries |
722 | 437 |
"get the dictionary of the help dictionaries of the classes having help specs |
438 |
" |
|
710 | 439 |
^dictionaries |
440 |
! |
|
441 |
||
442 |
dictionaries:aDictionaryOfDictionaries |
|
722 | 443 |
"set a dictionary of the help dictionaries of the classes having help specs |
444 |
" |
|
710 | 445 |
(dictionaries := aDictionaryOfDictionaries) isNil ifTrue:[ |
446 |
dictionaries := Dictionary new. |
|
447 |
]. |
|
715 | 448 |
self updateList. |
710 | 449 |
! |
450 |
||
151 | 451 |
dictionary |
722 | 452 |
"get the dictionary of the selected class |
453 |
" |
|
454 |
^dictionary |
|
710 | 455 |
! |
151 | 456 |
|
457 |
dictionary:aDictionary |
|
722 | 458 |
"set dictionary of the selected class |
459 |
" |
|
286 | 460 |
(dictionary := aDictionary) isNil ifTrue:[ |
700 | 461 |
dictionary := Dictionary new. |
286 | 462 |
]. |
463 |
self updateList |
|
464 |
! |
|
465 |
||
466 |
helpKey |
|
722 | 467 |
"get the help key of selected help text |
468 |
" |
|
286 | 469 |
listSelection size ~~ 0 ifTrue:[ |
470 |
^ listSelection asSymbol |
|
151 | 471 |
]. |
286 | 472 |
^ nil |
473 |
! |
|
474 |
||
475 |
helpKey:aKey |
|
722 | 476 |
"set the help key into the selection channel in order to show the help text |
477 |
" |
|
286 | 478 |
|key| |
479 |
aKey size ~~ 0 ifTrue:[ |
|
480 |
key := aKey asString |
|
481 |
]. |
|
482 |
self listModel value:key |
|
459 | 483 |
|
151 | 484 |
! |
485 |
||
740 | 486 |
modified |
722 | 487 |
"answer whether the help tool was modified |
488 |
" |
|
740 | 489 |
^modified |
700 | 490 |
! |
491 |
||
740 | 492 |
modified: aBoolean |
722 | 493 |
"set the help tool as modified |
494 |
" |
|
740 | 495 |
modified := aBoolean |
700 | 496 |
! |
497 |
||
286 | 498 |
modifiedHolder:aValueHolder |
499 |
"set the value holder set to true in case of modifying attributes |
|
148 | 500 |
" |
286 | 501 |
modifiedHolder notNil ifTrue:[ |
502 |
modifiedHolder removeDependent:self. |
|
503 |
]. |
|
148 | 504 |
|
286 | 505 |
(modifiedHolder := aValueHolder) notNil ifTrue:[ |
506 |
modifiedHolder addDependent:self. |
|
459 | 507 |
|
508 |
self editTextView notNil ifTrue: [ |
|
509 |
self editTextView modifiedChannel onChangeSend:#value to:[ |
|
510 |
modifiedHolder notNil ifTrue:[ |
|
511 |
self editTextView modifiedChannel value ifTrue:[ |
|
512 |
modifiedHolder value:true |
|
513 |
] |
|
514 |
] |
|
515 |
] |
|
516 |
] |
|
517 |
] |
|
286 | 518 |
|
519 |
||
715 | 520 |
! |
521 |
||
522 |
specClass |
|
722 | 523 |
"get the class on which the help tool works |
524 |
" |
|
715 | 525 |
^specClass |
354 | 526 |
! ! |
527 |
||
148 | 528 |
!UIHelpTool methodsFor:'aspects'! |
529 |
||
530 |
listChannel |
|
722 | 531 |
"get the value holder of the help texts |
532 |
" |
|
148 | 533 |
|holder| |
534 |
(holder := builder bindingAt:#listChannel) isNil ifTrue:[ |
|
354 | 535 |
builder aspectAt:#listChannel put:(holder := OrderedCollection new asValue). |
148 | 536 |
]. |
537 |
^ holder |
|
538 |
! |
|
539 |
||
286 | 540 |
listModel |
722 | 541 |
"get the value holder of the help key |
542 |
" |
|
148 | 543 |
|holder| |
286 | 544 |
(holder := builder bindingAt:#listModel) isNil ifTrue:[ |
545 |
holder := AspectAdaptor new subject:self; forAspect:#listSelection. |
|
546 |
builder aspectAt:#listModel put:holder. |
|
148 | 547 |
]. |
548 |
^ holder |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
549 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
550 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
551 |
listOfHelpSpecClasses |
722 | 552 |
"get the value holder of the specClass and its superclasses |
553 |
which are subclasses of ApplicationModel |
|
554 |
" |
|
750 | 555 |
|holder| |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
556 |
(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
|
557 |
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
|
558 |
]. |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
559 |
^ holder |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
560 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
561 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
562 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
563 |
selectionOfHelpSpecClass |
722 | 564 |
"get the value holder of the selected help spec class |
565 |
" |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
566 |
|holder| |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
567 |
(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
|
568 |
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
|
569 |
]. |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
570 |
^ holder |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
571 |
|
148 | 572 |
! ! |
573 |
||
750 | 574 |
!UIHelpTool methodsFor:'building'! |
575 |
||
576 |
buildFromClass:aClass |
|
577 |
"read the help dictionary from aClass and find remaining classes |
|
578 |
'between' aClass and ApplicationModel |
|
579 |
" |
|
580 |
modified := false. |
|
581 |
specClass notNil |
|
582 |
ifTrue: |
|
583 |
[ |
|
584 |
dictionary := Dictionary new. |
|
585 |
dictionaries := Dictionary new. |
|
586 |
]. |
|
587 |
specClass := self getHelpSpecClassFromClass:aClass. |
|
588 |
(specClass isClass and: [specClass isLoaded]) |
|
589 |
ifTrue: |
|
590 |
[ |
|
591 |
(specClass class implements:specSelector) ifFalse:[ |
|
592 |
dictionaries at: specClass name put: dictionary |
|
593 |
]. |
|
594 |
self listOfHelpSpecClasses contents: (specClass withAllSuperclasses reverse collect: [:cls| cls name]). |
|
595 |
(self listOfHelpSpecClasses includes: #ApplicationModel) |
|
596 |
ifTrue: [self listOfHelpSpecClasses removeAll: (ApplicationModel withAllSuperclasses collect: [:cls| cls name])]. |
|
597 |
self selectionOfHelpSpecClass value: specClass name. |
|
598 |
(builder componentAt: #listOfHelpSpecClassesView) selection: |
|
599 |
(self listOfHelpSpecClasses value indexOf: specClass name). |
|
600 |
self helpSpecClassSelected. |
|
601 |
]. |
|
602 |
||
603 |
self updateList |
|
604 |
! |
|
605 |
||
606 |
buildFromClass: aClass andSelector: aSelector |
|
607 |
||
608 |
specSelector := aSelector. |
|
609 |
self buildFromClass:aClass |
|
610 |
||
611 |
! ! |
|
612 |
||
740 | 613 |
!UIHelpTool methodsFor:'callbacks'! |
148 | 614 |
|
740 | 615 |
helpSpecClassSelected |
616 |
"extract the help dictionary from the selected class and make it current |
|
148 | 617 |
" |
740 | 618 |
|clsName| |
619 |
||
620 |
clsName := self selectionOfHelpSpecClass value. |
|
621 |
||
622 |
(dictionary := dictionaries at: clsName ifAbsent: nil) isNil |
|
623 |
ifTrue: |
|
624 |
[ |
|
625 |
dictionary := dictionaries at: clsName put: (self extractHelpSpecForClass: (Smalltalk at: clsName)) |
|
626 |
]. |
|
627 |
||
628 |
self updateList. |
|
722 | 629 |
|
740 | 630 |
listSelection notNil |
631 |
ifTrue: |
|
632 |
[ |
|
633 |
(dictionary keys includes: listSelection asSymbol) |
|
634 |
ifTrue: [(builder componentAt: #listOfHelpKeysView) selection: |
|
635 |
(self listChannel value indexOf: (builder componentAt: #helpKeyInputField) contents)] |
|
636 |
ifFalse: [(builder componentAt: #listOfHelpKeysView) selection: nil]. |
|
637 |
]. |
|
638 |
listSelection notNil |
|
639 |
ifTrue: |
|
640 |
[ |
|
641 |
self editTextView contents: (dictionary at: listSelection asSymbol ifAbsent: '') |
|
642 |
] |
|
643 |
||
369 | 644 |
|
286 | 645 |
! ! |
646 |
||
750 | 647 |
!UIHelpTool methodsFor:'help'! |
648 |
||
649 |
defaultInfoLabel |
|
650 |
"get default label for the info bar" |
|
651 |
||
652 |
specClass isClass |
|
653 |
ifTrue: |
|
654 |
[ |
|
655 |
(specClass class implements: specSelector) |
|
656 |
ifFalse: |
|
657 |
[ |
|
658 |
^specSelector isNil |
|
659 |
ifTrue: [specClass name, ' >> ? (no selector defined)'] |
|
660 |
ifFalse: [specClass name, ' >> ', specSelector, ' (not implemented)'] |
|
661 |
]. |
|
662 |
^specClass name, ' >> ', specSelector |
|
663 |
]. |
|
664 |
^'No class and selector defined.' |
|
665 |
||
666 |
||
667 |
||
668 |
! ! |
|
669 |
||
286 | 670 |
!UIHelpTool methodsFor:'private'! |
671 |
||
750 | 672 |
askForModification |
673 |
"ask for modification" |
|
740 | 674 |
|
750 | 675 |
modified |
676 |
ifTrue: |
|
677 |
[ |
|
678 |
((YesNoBox title: 'List was modified!!') |
|
679 |
noText:'Cancel'; |
|
680 |
yesText:'Waste it and proceed'; |
|
681 |
showAtPointer; |
|
682 |
accepted) ifFalse: [^false]. |
|
683 |
modified := false |
|
740 | 684 |
]. |
750 | 685 |
^true |
686 |
||
740 | 687 |
|
688 |
||
689 |
! |
|
690 |
||
286 | 691 |
editTextView |
692 |
"get the editTextView or nil. |
|
693 |
" |
|
694 |
|view| |
|
695 |
||
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
696 |
(view := builder componentAt:#helpTextView) notNil ifTrue:[ |
286 | 697 |
view := view scrolledView. |
698 |
||
699 |
view acceptAction isNil ifTrue:[ |
|
700 |
view acceptAction:[:aList| self accept ]. |
|
701 |
]. |
|
702 |
||
703 |
view left ~~ 0 ifTrue:[ |
|
704 |
(maxCharsPerLine := view extent x // view font width) < 10 ifTrue:[ |
|
705 |
maxCharsPerLine := nil |
|
706 |
] |
|
707 |
]. |
|
454 | 708 |
]. |
286 | 709 |
^ view |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
710 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
711 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
712 |
extractHelpSpecForClass: aClass |
722 | 713 |
"extract the help dictionary of aClass, it current and return it |
714 |
" |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
715 |
|helpSpecSuperClass superHelpSpecKeys helpSpec| |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
716 |
|
750 | 717 |
((aClass class implements: specSelector) |
718 |
and: [(helpSpecSuperClass := aClass allSuperclasses detect: [:cls| cls class implements: specSelector] ifNone: nil) notNil]) |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
719 |
ifTrue: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
720 |
[ |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
721 |
superHelpSpecKeys := helpSpecSuperClass helpSpec keys. |
700 | 722 |
helpSpec := Dictionary new. |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
723 |
aClass helpSpec associationsDo: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
724 |
[:asso| |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
725 |
(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
|
726 |
]. |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
727 |
^dictionary := helpSpec |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
728 |
]. |
700 | 729 |
^dictionary := Dictionary new |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
730 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
731 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
732 |
findHelpSpecForKey: aHelpKey |
722 | 733 |
"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
|
734 |
" |
761
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
735 |
|dictTemp| |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
736 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
737 |
aHelpKey isNil ifTrue: [^nil]. |
700 | 738 |
dictTemp := dictionary. |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
739 |
self listOfHelpSpecClasses value do: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
740 |
[:clsName| |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
741 |
(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
|
742 |
ifTrue: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
743 |
[ |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
744 |
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
|
745 |
]. |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
746 |
(dictionary includesKey: aHelpKey asSymbol) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
747 |
ifTrue: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
748 |
[ |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
749 |
self updateList. |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
750 |
^(builder componentAt: #listOfHelpSpecClassesView) selection: |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
751 |
(self listOfHelpSpecClasses value indexOf: clsName). |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
752 |
] |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
753 |
]. |
700 | 754 |
dictionary := dictTemp |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
755 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
756 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
757 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
758 |
|
750 | 759 |
getHelpSpecClassFromClass:aClass |
760 |
"get application class keeping the associated help text or nil |
|
761 |
" |
|
762 |
|cls| |
|
763 |
||
764 |
((cls := self resolveName:aClass) notNil and:[cls respondsTo: #helpSpecClass]) ifTrue:[ |
|
765 |
^cls helpSpecClass |
|
766 |
]. |
|
767 |
^cls |
|
768 |
||
769 |
||
770 |
! |
|
771 |
||
761
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
772 |
getUnformattedHelpText: aHelpText |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
773 |
"unformats aHelpText and returns it" |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
774 |
|
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
775 |
|helpText| |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
776 |
helpText := aHelpText asString replaceAll: Character cr with: Character space. |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
777 |
(helpText endsWith:Character space) ifTrue:[ |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
778 |
helpText := helpText copyWithoutLast:1 |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
779 |
]. |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
780 |
^helpText |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
781 |
! |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
782 |
|
740 | 783 |
installHelpSpecOnClass:aClass |
784 |
"save the help dicts in aClass which is subclass of ApplicationModel" |
|
785 |
||
786 |
|cls src helpSpec| |
|
787 |
||
750 | 788 |
cls := self getHelpSpecClassFromClass: aClass. |
740 | 789 |
|
790 |
cls isNil ifTrue:[ |
|
791 |
self information:'No application class defined!!'. |
|
792 |
^nil |
|
793 |
]. |
|
794 |
||
795 |
(cls isSubclassOf: ApplicationModel) ifFalse:[ |
|
796 |
self information: 'Cannot save help spec into class ', cls name asBoldText, ',\because it is not a subclass of ApplicationModel!!' withCRs. |
|
797 |
^nil |
|
798 |
]. |
|
799 |
||
800 |
helpSpec := dictionaries |
|
801 |
at: cls name |
|
802 |
ifAbsent: [specClass notNil |
|
803 |
ifTrue: [dictionaries at: aClass put: (self extractHelpSpecForClass: (Smalltalk at: aClass))] |
|
804 |
ifFalse: [dictionary size > 0 ifTrue: [dictionary] ifFalse: [Dictionary new]]]. |
|
805 |
||
761
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
806 |
helpSpec associationsDo: |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
807 |
[:h| |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
808 |
helpSpec at: h key put: (self getUnformattedHelpText: h value) |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
809 |
]. |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
810 |
|
750 | 811 |
(cls class implements: specSelector) |
740 | 812 |
ifTrue: |
813 |
[ |
|
814 |
|superclassHelpKeys implementedHelpSpec hasChanged| |
|
815 |
implementedHelpSpec := Dictionary new. |
|
750 | 816 |
superclassHelpKeys := (cls superclass respondsTo: specSelector) |
740 | 817 |
ifTrue: [cls superclass helpSpec keys] |
818 |
ifFalse: [Array new]. |
|
819 |
||
820 |
cls helpSpec associationsDo: [:h| (superclassHelpKeys includes: h key) |
|
821 |
ifFalse: [implementedHelpSpec at: h key put: h value]]. |
|
822 |
||
823 |
hasChanged := false. |
|
824 |
implementedHelpSpec associationsDo: [:h| (helpSpec includesAssociation: h) ifFalse: [hasChanged := true]]. |
|
825 |
helpSpec associationsDo: [:h| (implementedHelpSpec includesAssociation: h) ifFalse: [hasChanged := true]]. |
|
826 |
||
827 |
(implementedHelpSpec notEmpty and: [hasChanged and: |
|
828 |
[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 ']]) |
|
829 |
ifTrue: |
|
830 |
[ |
|
831 |
implementedHelpSpec associationsDo: [:h| (helpSpec includesKey: h key) |
|
832 |
ifFalse: [helpSpec at: h key put: h value]]. |
|
833 |
] |
|
834 |
]. |
|
835 |
||
836 |
helpSpec isEmpty ifTrue:[ |
|
750 | 837 |
^(cls superclass respondsTo: specSelector) ifTrue: [cls class removeSelector: specSelector]. |
740 | 838 |
]. |
839 |
||
840 |
src := '' writeStream. |
|
841 |
||
842 |
src nextPutAll: |
|
750 | 843 |
specSelector, '\' withCRs, |
740 | 844 |
(ResourceSpecEditor codeGenerationCommentForClass: UIHelpTool) withCRs, |
845 |
'\\' withCRs, |
|
846 |
' "\' withCRs, |
|
847 |
' UIHelpTool openOnClass:', cls name asString ,' |
|
848 |
" |
|
849 |
||
850 |
<resource: #help> |
|
851 |
||
750 | 852 |
^super ', specSelector, ' addPairsFrom:#( |
740 | 853 |
|
854 |
'. |
|
855 |
||
761
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
856 |
helpSpec keys asSortedCollection do: |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
857 |
[:key| |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
858 |
src nextPutLine: key storeString. |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
859 |
src nextPutLine: (helpSpec at: key) storeString; cr. |
740 | 860 |
]. |
861 |
src nextPutLine:')'. |
|
862 |
||
863 |
Compiler |
|
864 |
compile:(src contents) |
|
865 |
forClass:cls class |
|
866 |
inCategory:'help specs'. |
|
867 |
! |
|
868 |
||
869 |
installHelpSpecsOnClass:aClass |
|
870 |
"save the help dicts on aClass and its superclasses which are subclasses of ApplicationModel |
|
871 |
" |
|
872 |
|cls helpSpecClasses| |
|
873 |
||
750 | 874 |
cls := self getHelpSpecClassFromClass:aClass. |
875 |
cls isNil ifTrue: [^self information:'No application class defined!!']. |
|
876 |
||
740 | 877 |
modified ifFalse:[ |
750 | 878 |
masterApplication isNil ifTrue: [self information:'Nothing was modified!!']. |
740 | 879 |
^nil |
880 |
]. |
|
881 |
||
882 |
(helpSpecClasses := self listOfHelpSpecClasses value) notNil |
|
883 |
ifTrue: |
|
750 | 884 |
[ |
885 |
(helpSpecClasses includes: cls name) ifFalse: [helpSpecClasses add: cls name]. |
|
740 | 886 |
helpSpecClasses do: [:clsName| (self installHelpSpecOnClass: clsName) isNil ifTrue: [^modified := false]]. |
887 |
] |
|
888 |
ifFalse: |
|
750 | 889 |
[ |
740 | 890 |
self installHelpSpecOnClass: cls |
891 |
]. |
|
892 |
||
893 |
modified := false. |
|
894 |
||
895 |
! |
|
896 |
||
750 | 897 |
resourceMessage: aString |
898 |
"extract from aString the specClass and the specSelector" |
|
899 |
||
900 |
(aString notNil and: [self askForModification]) |
|
901 |
ifTrue: |
|
902 |
[ |
|
903 |
|msg cls sel| |
|
904 |
msg := aString asCollectionOfWords. |
|
905 |
(msg size == 2 and: |
|
906 |
[(cls := self resolveName:(msg at:1)) notNil]) |
|
907 |
ifTrue: |
|
908 |
[ |
|
909 |
specClass := cls name. |
|
910 |
specSelector := (msg at: 2) asSymbol. |
|
911 |
^true |
|
912 |
] |
|
913 |
]. |
|
914 |
^false |
|
915 |
||
916 |
! |
|
917 |
||
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
918 |
updateList |
722 | 919 |
"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
|
920 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
921 |
self listChannel value: dictionary keys asSortedCollection |
286 | 922 |
! ! |
923 |
||
924 |
!UIHelpTool methodsFor:'selection'! |
|
925 |
||
926 |
listSelection |
|
927 |
"returns current selection |
|
928 |
" |
|
929 |
^ listSelection |
|
930 |
! |
|
931 |
||
932 |
listSelection:aSelection |
|
933 |
"current selection changed |
|
934 |
" |
|
299 | 935 |
|txt view sel| |
286 | 936 |
|
722 | 937 |
aSelection isNil |
938 |
ifTrue: [(builder componentAt: #listOfHelpKeysView) selection: nil] |
|
939 |
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
|
940 |
|
286 | 941 |
aSelection isNumber ifTrue:[ |
942 |
aSelection ~~ 0 ifTrue:[ |
|
943 |
sel := self listChannel value at:aSelection |
|
944 |
] |
|
945 |
] ifFalse:[ |
|
946 |
aSelection size ~~ 0 ifTrue:[ |
|
947 |
sel := aSelection withoutSeparators. |
|
948 |
sel size == 0 ifTrue:[ |
|
949 |
sel := nil |
|
950 |
] |
|
951 |
] |
|
952 |
]. |
|
953 |
||
299 | 954 |
listSelection = sel ifFalse:[ |
955 |
listSelection := sel. |
|
286 | 956 |
|
299 | 957 |
modifiedHolder notNil ifTrue:[ |
958 |
modifiedHolder value:true. |
|
959 |
]. |
|
286 | 960 |
|
299 | 961 |
(view := self editTextView) notNil ifTrue:[ |
962 |
listSelection notNil ifTrue:[ |
|
963 |
txt := dictionary at:(listSelection asSymbol) ifAbsent:nil. |
|
286 | 964 |
|
299 | 965 |
(txt isNil or:[maxCharsPerLine isNil]) ifFalse:[ |
369 | 966 |
txt := UIPainter convertString:(txt asString) maxLineSize:maxCharsPerLine skipLineFeed:false. |
286 | 967 |
] |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
968 |
]. |
459 | 969 |
view contents:txt. |
970 |
view modified:false. |
|
299 | 971 |
] |
972 |
] |
|
286 | 973 |
|
974 |
! ! |
|
975 |
||
369 | 976 |
!UIHelpTool methodsFor:'startup / release'! |
977 |
||
978 |
closeRequest |
|
722 | 979 |
"before closing the help tool, ask for permission |
980 |
" |
|
750 | 981 |
(self masterApplication isNil and:[self askForModification]) ifTrue:[super closeRequest] |
740 | 982 |
! |
983 |
||
984 |
initialize |
|
985 |
"initialize instance variables |
|
986 |
" |
|
987 |
super initialize. |
|
988 |
||
750 | 989 |
specSelector := #helpSpec. |
740 | 990 |
dictionary := Dictionary new. |
991 |
dictionaries := Dictionary new. |
|
992 |
modified := false. |
|
993 |
||
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
994 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
995 |
|
750 | 996 |
loadFromMessage:aString |
997 |
"load a spec from class and selector" |
|
998 |
||
999 |
(aString notNil and: [self askForModification]) |
|
1000 |
ifTrue: |
|
1001 |
[ |
|
1002 |
|msg cls sel| |
|
1003 |
msg := aString asCollectionOfWords. |
|
1004 |
(msg size == 2 and: |
|
1005 |
[(cls := self resolveName:(msg at:1)) notNil and: |
|
1006 |
[cls class implements: (sel := (msg at: 2) asSymbol)]]) |
|
1007 |
ifTrue: |
|
1008 |
[ |
|
1009 |
self buildFromClass: (specClass := cls name) andSelector: (specSelector := sel). |
|
1010 |
^true |
|
1011 |
] |
|
1012 |
]. |
|
1013 |
^false |
|
1014 |
||
1015 |
! |
|
1016 |
||
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
1017 |
openInterface:aSymbol |
750 | 1018 |
"do not open as stand alone |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
1019 |
" |
750 | 1020 |
|
1021 |
||
1022 |
! |
|
1023 |
||
1024 |
openOnClass:aClass |
|
1025 |
"open the UIHelpTool on aClass |
|
1026 |
" |
|
1027 |
||
1028 |
super openInterface: #windowSpecForStandAlone. |
|
1029 |
self masterApplication isNil ifTrue: [(builder componentAt: #RemoveButton) beInvisible]. |
|
1030 |
builder window label: 'Help Tool'. |
|
1031 |
self buildFromClass: aClass |
|
369 | 1032 |
! ! |
1033 |
||
740 | 1034 |
!UIHelpTool methodsFor:'user actions'! |
286 | 1035 |
|
722 | 1036 |
accept |
1037 |
"accept the help text |
|
1038 |
" |
|
1039 |
|view key txt list listChgd| |
|
1040 |
||
1041 |
(listSelection size == 0 or:[(view := self editTextView) isNil]) ifFalse:[ |
|
1042 |
txt := view contents asString. |
|
1043 |
key := listSelection asSymbol. |
|
1044 |
list := self listChannel value. |
|
1045 |
||
1046 |
(listChgd := (dictionary at:key ifAbsent:nil) isNil) ifTrue:[ |
|
1047 |
list add:key. |
|
1048 |
]. |
|
1049 |
dictionary at:key put:txt. |
|
1050 |
||
1051 |
listChgd ifTrue:[ |
|
1052 |
self updateList. |
|
1053 |
(builder componentAt: #listOfHelpKeysView) selection: (list indexOf: key). |
|
1054 |
]. |
|
1055 |
||
740 | 1056 |
modified := true. |
722 | 1057 |
modifiedHolder notNil ifTrue: [modifiedHolder value:true] |
1058 |
] |
|
1059 |
! |
|
1060 |
||
750 | 1061 |
doAdd |
722 | 1062 |
"add help key |
1063 |
" |
|
750 | 1064 |
|helpKey| |
1065 |
(helpKey := (builder componentAt: #helpKeyInputField asSymbol) contents) size > 0 |
|
1066 |
ifTrue: |
|
1067 |
[ |
|
1068 |
self listModel value: helpKey. |
|
1069 |
self accept |
|
1070 |
] |
|
1071 |
ifFalse: |
|
1072 |
[ |
|
1073 |
self warn: 'First define a help key!!' |
|
1074 |
] |
|
722 | 1075 |
! |
1076 |
||
750 | 1077 |
doDelete |
722 | 1078 |
"delete selected help key |
750 | 1079 |
" |
722 | 1080 |
listSelection notNil |
1081 |
ifTrue: |
|
1082 |
[ |
|
1083 |
dictionary removeKey: listSelection asSymbol ifAbsent: nil. |
|
750 | 1084 |
self doRemove. |
722 | 1085 |
self updateList. |
740 | 1086 |
modified := true. |
722 | 1087 |
modifiedHolder notNil ifTrue: [modifiedHolder value:true] |
1088 |
] |
|
750 | 1089 |
ifFalse: |
1090 |
[ |
|
1091 |
self warn: 'First select a help key!!' |
|
1092 |
] |
|
722 | 1093 |
! |
1094 |
||
750 | 1095 |
doLoad |
1096 |
"open a Resource Selection Browser in order to get a resource message" |
|
286 | 1097 |
|
750 | 1098 |
self loadFromMessage: |
1099 |
(ResourceSelectionBrowser |
|
1100 |
request: 'Load ', self class resourceType asUppercaseFirst, ' Spec From Class' |
|
1101 |
onSuperclass: nil |
|
1102 |
andClass: specClass |
|
1103 |
andSelector: specSelector ? self class resourceType |
|
1104 |
withResourceTypes: (Array with: self class resourceType)) |
|
286 | 1105 |
|
750 | 1106 |
! |
286 | 1107 |
|
750 | 1108 |
doNew |
1109 |
"reset the help tool |
|
1110 |
" |
|
1111 |
specClass := listSelection := nil. |
|
1112 |
self dictionary: nil. |
|
1113 |
self dictionaries: nil. |
|
1114 |
self listOfHelpSpecClasses removeAll. |
|
1115 |
modified := false. |
|
286 | 1116 |
! |
1117 |
||
1118 |
doReload |
|
722 | 1119 |
"reload the help dictionaries |
286 | 1120 |
" |
1121 |
|oldSel model| |
|
1122 |
||
1123 |
model := self listModel. |
|
1124 |
oldSel := model value. |
|
1125 |
model value:nil. |
|
1126 |
self helpSpecFrom:specClass. |
|
1127 |
model value:oldSel. |
|
740 | 1128 |
modified := false. |
369 | 1129 |
|
722 | 1130 |
! |
1131 |
||
750 | 1132 |
doRemove |
1133 |
"remove selected help key |
|
1134 |
" |
|
1135 |
listSelection notNil |
|
1136 |
ifTrue: |
|
1137 |
[ |
|
1138 |
self listModel value: nil. |
|
1139 |
self updateList. |
|
1140 |
modifiedHolder notNil ifTrue: [modifiedHolder value:true] |
|
1141 |
] |
|
1142 |
ifFalse: |
|
1143 |
[ |
|
1144 |
self warn: 'First select a help key!!' |
|
1145 |
] |
|
1146 |
! |
|
1147 |
||
722 | 1148 |
doSave |
1149 |
"save the help dictionaries |
|
1150 |
" |
|
1151 |
self installHelpSpecsOnClass:specClass |
|
148 | 1152 |
! ! |
1153 |
||
1154 |
!UIHelpTool class methodsFor:'documentation'! |
|
1155 |
||
1156 |
version |
|
1157 |
^ '$Header$' |
|
1158 |
! ! |