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