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