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