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