author | Claus Gittinger <cg@exept.de> |
Thu, 23 Oct 2003 22:12:30 +0200 | |
changeset 1756 | 3b033fe4ad5c |
parent 1737 | de6abd3c55d2 |
child 1772 | e33aee13defe |
permissions | -rw-r--r-- |
156 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by eXept Software AG |
|
1669 | 3 |
All Rights Reserved |
156 | 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 |
||
1554
d5e4612bf7cf
implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents:
1506
diff
changeset
|
13 |
"{ Package: 'stx:libtool2' }" |
d5e4612bf7cf
implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents:
1506
diff
changeset
|
14 |
|
750 | 15 |
ToolApplicationModel subclass:#UIHelpTool |
1669 | 16 |
instanceVariableNames:'specClass specSelector classItemList classItemModel keyItemModel |
17 |
helpTextView modifiedHolder contentsModifiedChannel editModel' |
|
148 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-UIPainter' |
|
21 |
! |
|
22 |
||
1669 | 23 |
HierarchicalItem subclass:#ClassItem |
24 |
instanceVariableNames:'theClass list modified' |
|
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
privateIn:UIHelpTool |
|
28 |
! |
|
29 |
||
30 |
HierarchicalItem subclass:#KeyItem |
|
1681 | 31 |
instanceVariableNames:'helpKey helpText flyByText modified icon' |
1669 | 32 |
classVariableNames:'' |
33 |
poolDictionaries:'' |
|
34 |
privateIn:UIHelpTool |
|
35 |
! |
|
36 |
||
148 | 37 |
!UIHelpTool class methodsFor:'documentation'! |
38 |
||
156 | 39 |
copyright |
40 |
" |
|
41 |
COPYRIGHT (c) 1995 by eXept Software AG |
|
1669 | 42 |
All Rights Reserved |
156 | 43 |
|
44 |
This software is furnished under a license and may be used |
|
45 |
only in accordance with the terms of that license and with the |
|
46 |
inclusion of the above copyright notice. This software may not |
|
47 |
be provided or otherwise made available to, or used by, any |
|
48 |
other person. No title to or ownership of the software is |
|
49 |
hereby transferred. |
|
50 |
" |
|
51 |
! |
|
52 |
||
148 | 53 |
documentation |
54 |
" |
|
779 | 55 |
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
|
56 |
window applications. The tool are able to run stand alone or in other master |
740 | 57 |
applications like the GUI Painter and the Menu Editor. |
58 |
If the application responds to the selector #showHelp:aHelpText for:aView, |
|
59 |
this selector is called by the widget's view when the mouse cursor moves over. |
|
60 |
If the application does not responds to that selector, and the activeHelp mode |
|
61 |
is enabled, an active help bubble is shown at the widget's view. |
|
156 | 62 |
|
779 | 63 |
[instance variables:] |
1669 | 64 |
specClass <Symbol> class implementing the help spec |
65 |
specSelector <Symbol> selector returning the help spec |
|
66 |
classItemList the list of classItems |
|
67 |
classItemModel keeps the selected class |
|
68 |
keyItemModel keeps the selected helpKey |
|
69 |
modifiedHolder <ValueHolder> true if the editField or contents changed |
|
70 |
editModel keeps the current helpKey |
|
71 |
helpTextView the view which shows the helpText |
|
72 |
contentsModifiedChannel true if the helpText is modified |
|
779 | 73 |
|
156 | 74 |
[author:] |
1669 | 75 |
Claus Atzkern, eXept Software AG |
76 |
Thomas Zwick, eXept Software AG |
|
148 | 77 |
" |
78 |
! ! |
|
79 |
||
286 | 80 |
!UIHelpTool class methodsFor:'instance creation'! |
81 |
||
832
2c5b61b168e8
allow #open (its in the docu !)
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
82 |
open |
833 | 83 |
^ self openOnClass:nil. |
832
2c5b61b168e8
allow #open (its in the docu !)
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
84 |
! |
2c5b61b168e8
allow #open (its in the docu !)
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
85 |
|
286 | 86 |
openOnClass:aClass |
1669 | 87 |
"opens a Help Tool on aClass |
286 | 88 |
" |
1669 | 89 |
^ self openOnClass:aClass andSelector:#helpSpec |
940 | 90 |
! |
91 |
||
92 |
openOnClass:aClass andSelector: aSelector |
|
1669 | 93 |
"opens a Help Tool on aClass and aSelector |
94 |
" |
|
95 |
^ self new openOnClass:aClass andSelector:aSelector |
|
750 | 96 |
! ! |
97 |
||
286 | 98 |
!UIHelpTool class methodsFor:'constants'! |
99 |
||
100 |
label |
|
1669 | 101 |
"returns the label; used if embedded as sub canvas in the GUI Painter or Menu Editor |
102 |
" |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
103 |
^'Help' |
286 | 104 |
! ! |
105 |
||
151 | 106 |
!UIHelpTool class methodsFor:'help specs'! |
107 |
||
108 |
helpSpec |
|
740 | 109 |
"This resource specification was automatically generated |
110 |
by the UIHelpTool of ST/X." |
|
111 |
||
112 |
"Do not manually edit this!! If it is corrupted, |
|
113 |
the UIHelpTool may not be able to read the specification." |
|
292 | 114 |
|
172 | 115 |
" |
740 | 116 |
UIHelpTool openOnClass:UIHelpTool |
292 | 117 |
" |
118 |
||
740 | 119 |
<resource: #help> |
120 |
||
1669 | 121 |
^ super helpSpec addPairsFrom:#( |
151 | 122 |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
123 |
#addHelpTextKey |
1340
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
124 |
'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
|
125 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
126 |
#currentHelpTexts |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
127 |
'Selected help text key.' |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
128 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
129 |
#deleteHelpTextKey |
1340
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
130 |
'Deletes the key from the help spec.' |
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
131 |
|
750 | 132 |
#fileLoad |
133 |
'Opens a dialog for selecting and loading a help spec from a class.' |
|
134 |
||
135 |
#fileSave |
|
1340
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
136 |
'Saves the current help spec.' |
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
137 |
|
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
138 |
#fileUpdate |
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
139 |
'Reload the help spec.' |
696
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 |
#helpTextView |
1622 | 142 |
'Shows the help text. Menu action ''Accept'' commits changes' |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
143 |
|
1646 | 144 |
#listOfClasses |
1340
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
145 |
'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
|
146 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
147 |
#listOfHelpTexts |
1340
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
148 |
'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
|
149 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
150 |
#removeHelpTextKey |
1340
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
151 |
'Removes the help message from the widget.' |
172 | 152 |
|
1646 | 153 |
#updateHelpTextKey |
154 |
'Refetch the help spec.' |
|
155 |
||
172 | 156 |
) |
151 | 157 |
! ! |
158 |
||
148 | 159 |
!UIHelpTool class methodsFor:'interface specs'! |
160 |
||
161 |
windowSpec |
|
740 | 162 |
"This resource specification was automatically generated |
163 |
by the UIPainter of ST/X." |
|
148 | 164 |
|
740 | 165 |
"Do not manually edit this!! If it is corrupted, |
166 |
the UIPainter may not be able to read the specification." |
|
148 | 167 |
|
168 |
" |
|
151 | 169 |
UIPainter new openOnClass:UIHelpTool andSelector:#windowSpec |
170 |
UIHelpTool new openInterface:#windowSpec |
|
740 | 171 |
UIHelpTool open |
148 | 172 |
" |
173 |
||
174 |
<resource: #canvas> |
|
175 |
||
1302 | 176 |
^ |
1737
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
177 |
#(FullSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
178 |
name: windowSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
179 |
window: |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
180 |
(WindowSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
181 |
label: 'UIHelpTool' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
182 |
name: 'UIHelpTool' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
183 |
min: (Point 10 10) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
184 |
bounds: (Rectangle 14 46 475 339) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
185 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
186 |
component: |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
187 |
(SpecCollection |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
188 |
collection: ( |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
189 |
(VariableVerticalPanelSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
190 |
name: 'PanelVrt' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
191 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
192 |
component: |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
193 |
(SpecCollection |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
194 |
collection: ( |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
195 |
(VariableHorizontalPanelSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
196 |
name: 'PanelHrz' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
197 |
component: |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
198 |
(SpecCollection |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
199 |
collection: ( |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
200 |
(HierarchicalListViewSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
201 |
name: 'keyItemModel' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
202 |
model: keyItemModel |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
203 |
menu: keyItemMenu |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
204 |
hasHorizontalScrollBar: true |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
205 |
hasVerticalScrollBar: true |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
206 |
miniScrollerHorizontal: true |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
207 |
miniScrollerVertical: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
208 |
listModel: keyItemListHolder |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
209 |
useIndex: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
210 |
highlightMode: label |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
211 |
showLines: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
212 |
showIndicators: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
213 |
showLeftIndicators: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
214 |
useDefaultIcons: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
215 |
autoScrollHorizontal: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
216 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
217 |
(ViewSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
218 |
name: 'classItemList' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
219 |
component: |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
220 |
(SpecCollection |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
221 |
collection: ( |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
222 |
(InputFieldSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
223 |
name: 'editModel' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
224 |
layout: (LayoutFrame 0 0.0 2 0 -1 1.0 25 0) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
225 |
activeHelpKey: currentHelpTexts |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
226 |
model: editModel |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
227 |
immediateAccept: true |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
228 |
acceptOnReturn: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
229 |
acceptOnTab: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
230 |
acceptOnLostFocus: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
231 |
acceptOnPointerLeave: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
232 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
233 |
(SelectionInListModelViewSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
234 |
name: 'classItemModel' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
235 |
layout: (LayoutFrame 0 0.0 27 0.0 0 1.0 0 1.0) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
236 |
model: classItemModel |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
237 |
hasHorizontalScrollBar: true |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
238 |
hasVerticalScrollBar: true |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
239 |
miniScrollerHorizontal: true |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
240 |
miniScrollerVertical: true |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
241 |
autoHideScrollBars: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
242 |
listModel: classItemListHolder |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
243 |
useIndex: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
244 |
highlightMode: label |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
245 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
246 |
) |
1340
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
247 |
|
1737
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
248 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
249 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
250 |
) |
1646 | 251 |
|
1737
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
252 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
253 |
handles: (Any 0.607375 1.0) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
254 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
255 |
(ArbitraryComponentSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
256 |
name: 'helpTextView' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
257 |
hasHorizontalScrollBar: true |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
258 |
hasVerticalScrollBar: true |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
259 |
miniScrollerHorizontal: true |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
260 |
miniScrollerVertical: true |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
261 |
hasBorder: false |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
262 |
component: helpTextView |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
263 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
264 |
) |
1302 | 265 |
|
1737
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
266 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
267 |
handles: (Any 0.679181 1.0) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
268 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
269 |
) |
1302 | 270 |
|
1737
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
271 |
) |
148 | 272 |
) |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
273 |
! |
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 |
windowSpecForStandAlone |
740 | 276 |
"This resource specification was automatically generated |
277 |
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
|
278 |
|
740 | 279 |
"Do not manually edit this!! If it is corrupted, |
280 |
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
|
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 |
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
|
284 |
UIHelpTool new openInterface:#windowSpecForStandAlone |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
285 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
286 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
287 |
<resource: #canvas> |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
288 |
|
1646 | 289 |
^ |
1737
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
290 |
#(FullSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
291 |
name: windowSpecForStandAlone |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
292 |
window: |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
293 |
(WindowSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
294 |
label: 'Help Tool' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
295 |
name: 'Help Tool' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
296 |
min: (Point 300 300) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
297 |
bounds: (Rectangle 14 46 512 475) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
298 |
menu: menu |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
299 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
300 |
component: |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
301 |
(SpecCollection |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
302 |
collection: ( |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
303 |
(UISubSpecification |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
304 |
name: 'windowSpec' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
305 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -50 1.0) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
306 |
minorKey: windowSpec |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
307 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
308 |
(UISubSpecification |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
309 |
name: 'windowSpecForCommit' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
310 |
layout: (LayoutFrame 0 0.0 -50 1.0 0 1.0 -24 1.0) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
311 |
majorKey: ToolApplicationModel |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
312 |
minorKey: windowSpecForCommit |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
313 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
314 |
(UISubSpecification |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
315 |
name: 'windowSpecForInfoBar' |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
316 |
layout: (LayoutFrame 0 0 -24 1 0 1 0 1) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
317 |
majorKey: ToolApplicationModel |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
318 |
minorKey: windowSpecForInfoBar |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
319 |
) |
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
320 |
) |
1646 | 321 |
|
1737
de6abd3c55d2
Delete #max: (- windowsize) in windowSpecs
Stefan Vogel <sv@exept.de>
parents:
1735
diff
changeset
|
322 |
) |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
323 |
) |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
324 |
! ! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
325 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
326 |
!UIHelpTool class methodsFor:'menu specs'! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
327 |
|
1646 | 328 |
helpTextMenu |
329 |
"This resource specification was automatically generated |
|
330 |
by the MenuEditor of ST/X." |
|
331 |
||
332 |
"Do not manually edit this!! If it is corrupted, |
|
333 |
the MenuEditor may not be able to read the specification." |
|
334 |
||
335 |
" |
|
336 |
MenuEditor new openOnClass:UIHelpTool andSelector:#helpTextMenu |
|
337 |
(Menu new fromLiteralArrayEncoding:(UIHelpTool helpTextMenu)) startUp |
|
338 |
" |
|
339 |
||
340 |
<resource: #menu> |
|
341 |
||
342 |
^ |
|
343 |
#(#Menu |
|
1669 | 344 |
#( |
345 |
#(#MenuItem |
|
346 |
#activeHelpKey: #commitOK |
|
347 |
#enabled: #contentsModifiedChannel |
|
348 |
#label: 'Accept' |
|
349 |
#itemValue: #accept |
|
350 |
#translateLabel: true |
|
351 |
) |
|
352 |
#(#MenuItem |
|
353 |
#activeHelpKey: #commitCancel |
|
354 |
#enabled: #contentsModifiedChannel |
|
355 |
#label: 'Cancel' |
|
356 |
#itemValue: #cancel |
|
357 |
#translateLabel: true |
|
358 |
) |
|
359 |
) |
|
360 |
nil |
|
361 |
nil |
|
362 |
) |
|
363 |
! |
|
364 |
||
365 |
keyItemMenu |
|
366 |
"This resource specification was automatically generated |
|
367 |
by the MenuEditor of ST/X." |
|
368 |
||
369 |
"Do not manually edit this!! If it is corrupted, |
|
370 |
the MenuEditor may not be able to read the specification." |
|
371 |
||
372 |
" |
|
373 |
MenuEditor new openOnClass:UIHelpTool andSelector:#keyItemMenu |
|
374 |
(Menu new fromLiteralArrayEncoding:(UIHelpTool keyItemMenu)) startUp |
|
375 |
" |
|
376 |
||
377 |
<resource: #menu> |
|
378 |
||
379 |
^ |
|
380 |
#(#Menu |
|
381 |
#( |
|
382 |
#(#MenuItem |
|
383 |
#activeHelpKey: #deleteHelpTextKey |
|
384 |
#label: 'Delete' |
|
385 |
#itemValue: #doDelete |
|
386 |
#translateLabel: true |
|
387 |
) |
|
388 |
) |
|
389 |
nil |
|
390 |
nil |
|
1646 | 391 |
) |
392 |
! |
|
393 |
||
394 |
listOfKeysMenu |
|
395 |
"This resource specification was automatically generated |
|
396 |
by the MenuEditor of ST/X." |
|
397 |
||
398 |
"Do not manually edit this!! If it is corrupted, |
|
399 |
the MenuEditor may not be able to read the specification." |
|
400 |
||
401 |
" |
|
402 |
MenuEditor new openOnClass:UIHelpTool andSelector:#listOfKeysMenu |
|
403 |
(Menu new fromLiteralArrayEncoding:(UIHelpTool listOfKeysMenu)) startUp |
|
404 |
" |
|
405 |
||
406 |
<resource: #menu> |
|
407 |
||
408 |
^ |
|
409 |
#(#Menu |
|
1669 | 410 |
#( |
411 |
#(#MenuItem |
|
412 |
#activeHelpKey: #deleteHelpTextKey |
|
413 |
#label: 'Delete' |
|
414 |
#itemValue: #doDelete |
|
415 |
#translateLabel: true |
|
416 |
) |
|
417 |
) |
|
418 |
nil |
|
419 |
nil |
|
1646 | 420 |
) |
421 |
! |
|
422 |
||
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
423 |
menu |
740 | 424 |
"This resource specification was automatically generated |
425 |
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
|
426 |
|
740 | 427 |
"Do not manually edit this!! If it is corrupted, |
428 |
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
|
429 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
430 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
431 |
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
|
432 |
(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
|
433 |
" |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
434 |
|
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
435 |
<resource: #menu> |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
436 |
|
1646 | 437 |
^ |
438 |
#(#Menu |
|
1669 | 439 |
#( |
440 |
#(#MenuItem |
|
441 |
#label: 'File' |
|
442 |
#translateLabel: true |
|
443 |
#submenu: |
|
444 |
#(#Menu |
|
445 |
#( |
|
446 |
#(#MenuItem |
|
447 |
#activeHelpKey: #fileLoad |
|
448 |
#label: 'Load...' |
|
449 |
#itemValue: #doLoad |
|
450 |
#translateLabel: true |
|
451 |
) |
|
452 |
#(#MenuItem |
|
453 |
#activeHelpKey: #fileSave |
|
454 |
#label: 'Save' |
|
455 |
#itemValue: #doSave |
|
456 |
#translateLabel: true |
|
457 |
) |
|
458 |
#(#MenuItem |
|
459 |
#label: 'New' |
|
460 |
#itemValue: #doNew |
|
461 |
#translateLabel: true |
|
462 |
) |
|
463 |
#(#MenuItem |
|
464 |
#label: '-' |
|
465 |
) |
|
466 |
#(#MenuItem |
|
467 |
#activeHelpKey: #fileExit |
|
468 |
#label: 'Exit' |
|
469 |
#itemValue: #closeRequest |
|
470 |
#translateLabel: true |
|
471 |
) |
|
472 |
) |
|
473 |
nil |
|
474 |
nil |
|
475 |
) |
|
476 |
) |
|
477 |
#(#MenuItem |
|
478 |
#activeHelpKey: #history |
|
479 |
#label: 'History' |
|
480 |
#translateLabel: true |
|
481 |
#submenuChannel: #menuHistory |
|
482 |
) |
|
483 |
#(#MenuItem |
|
484 |
#label: 'Edit' |
|
485 |
#translateLabel: true |
|
486 |
#submenuChannel: #keyItemMenu |
|
487 |
#keepLinkedMenu: true |
|
488 |
) |
|
489 |
#(#MenuItem |
|
490 |
#activeHelpKey: #help |
|
491 |
#label: 'Help' |
|
492 |
#translateLabel: true |
|
493 |
#startGroup: #right |
|
494 |
#submenuChannel: #menuHelp |
|
495 |
) |
|
496 |
) |
|
497 |
nil |
|
498 |
nil |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
499 |
) |
148 | 500 |
! ! |
501 |
||
502 |
!UIHelpTool methodsFor:'accessing'! |
|
503 |
||
1669 | 504 |
helpKey |
505 |
"returns the helpKey as symbol or nil |
|
506 |
" |
|
507 |
|key| |
|
710 | 508 |
|
1669 | 509 |
key := editModel value. |
151 | 510 |
|
1669 | 511 |
key size ~~ 0 ifTrue:[ |
512 |
key := key withoutSeparators. |
|
513 |
key notEmpty ifTrue:[ ^ key asSymbol ] |
|
151 | 514 |
]. |
286 | 515 |
^ nil |
516 |
! |
|
517 |
||
518 |
helpKey:aKey |
|
1669 | 519 |
"change the helpKey without any change notification (modifiedHolder). |
520 |
" |
|
286 | 521 |
|key| |
1646 | 522 |
|
1669 | 523 |
self withoutModifyDo:[ |
524 |
aKey size ~~ 0 ifTrue:[ |
|
525 |
key := aKey withoutSeparators. |
|
526 |
key isEmpty ifTrue:[ key := nil ] |
|
527 |
] ifFalse:[ |
|
528 |
key := nil |
|
529 |
]. |
|
530 |
editModel value:key. |
|
286 | 531 |
]. |
1646 | 532 |
self cancel. |
151 | 533 |
! |
534 |
||
740 | 535 |
modified |
1669 | 536 |
"true if any items are added, deleted or modified |
1646 | 537 |
" |
1669 | 538 |
classItemList do:[:aClassItem| |
539 |
aClassItem modified ifTrue:[^ true]. |
|
540 |
]. |
|
541 |
^ false |
|
700 | 542 |
! |
543 |
||
1669 | 544 |
modified:aBoolean |
545 |
"true if any items are added, deleted or modified |
|
1646 | 546 |
" |
1669 | 547 |
classItemList do:[:aClassItem| aClassItem modified:aBoolean ]. |
548 |
! |
|
549 |
||
550 |
modifiedHolder |
|
551 |
"boolean holder which is set to true if the helpKey or contents changed |
|
552 |
" |
|
553 |
^ modifiedHolder |
|
700 | 554 |
! |
555 |
||
286 | 556 |
modifiedHolder:aValueHolder |
1669 | 557 |
"boolean holder which is set to true if the helpKey or contents changed |
558 |
" |
|
286 | 559 |
modifiedHolder notNil ifTrue:[ |
1669 | 560 |
modifiedHolder removeDependent:self. |
286 | 561 |
]. |
1646 | 562 |
modifiedHolder := aValueHolder. |
459 | 563 |
|
1646 | 564 |
modifiedHolder notNil ifTrue:[ |
1669 | 565 |
modifiedHolder addDependent:self. |
566 |
]. |
|
1604 | 567 |
! |
568 |
||
715 | 569 |
specClass |
1669 | 570 |
"returns the class on which the help tool works on |
1646 | 571 |
" |
572 |
^ specClass |
|
573 |
! |
|
779 | 574 |
|
1646 | 575 |
specSelector |
1681 | 576 |
"returns the selector of the edited helpSpec method |
1646 | 577 |
" |
1681 | 578 |
^ specSelector ? #helpSpec |
354 | 579 |
! ! |
580 |
||
148 | 581 |
!UIHelpTool methodsFor:'aspects'! |
582 |
||
1669 | 583 |
classItemListHolder |
584 |
"returns the holder which keeps the class items |
|
585 |
" |
|
586 |
|holder| |
|
587 |
||
588 |
holder := builder bindingAt:#classItemListHolder. |
|
589 |
||
590 |
holder isNil ifTrue:[ |
|
591 |
holder := nil asValue. |
|
592 |
holder value:classItemList. |
|
593 |
builder aspectAt:#classItemListHolder put:holder. |
|
594 |
]. |
|
595 |
^ holder |
|
596 |
! |
|
597 |
||
598 |
classItemModel |
|
599 |
"returns the holder which keeps the current selected class |
|
600 |
" |
|
601 |
^ classItemModel |
|
602 |
! |
|
603 |
||
1646 | 604 |
contentsModifiedChannel |
1669 | 605 |
"boolean holder, which is set to true if the contents assigned to the |
606 |
helpKey changed |
|
1646 | 607 |
" |
608 |
^ contentsModifiedChannel |
|
609 |
! |
|
779 | 610 |
|
1646 | 611 |
editModel |
1669 | 612 |
"string holder, which keeps the current editing helpKey as string |
1646 | 613 |
" |
1669 | 614 |
^ editModel. |
1646 | 615 |
! |
616 |
||
1669 | 617 |
helpTextView |
618 |
"the editView which keeps the current help contents assigned to the key |
|
1646 | 619 |
" |
1669 | 620 |
^ helpTextView |
148 | 621 |
! |
622 |
||
1669 | 623 |
keyItemListHolder |
624 |
"holder, which keeps the current hierarchical list |
|
625 |
assigned to the selected class item |
|
1646 | 626 |
" |
1669 | 627 |
|holder| |
628 |
||
629 |
holder := builder bindingAt:#keyItemListHolder. |
|
630 |
||
631 |
holder isNil ifTrue:[ |
|
632 |
holder := nil asValue. |
|
633 |
holder value:(classItemList last list). |
|
634 |
builder aspectAt:#keyItemListHolder put:holder. |
|
635 |
]. |
|
636 |
^ holder |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
637 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
638 |
|
1669 | 639 |
keyItemModel |
640 |
"model which keeps the current selected helpKey or nil |
|
1646 | 641 |
" |
1669 | 642 |
^ keyItemModel. |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
643 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
644 |
|
1669 | 645 |
valueOfEnablingCommitButtons |
646 |
"returns the enabling of the commit of this tool as value holder |
|
1646 | 647 |
" |
1669 | 648 |
masterApplication notNil ifTrue:[ |
649 |
^ masterApplication valueOfEnablingCommitButtons |
|
650 |
]. |
|
651 |
^ contentsModifiedChannel |
|
1336
3c84dc6f8d4b
delegate valueOfInfoLabel to masterApplication if exists
ca
parents:
1329
diff
changeset
|
652 |
! |
3c84dc6f8d4b
delegate valueOfInfoLabel to masterApplication if exists
ca
parents:
1329
diff
changeset
|
653 |
|
3c84dc6f8d4b
delegate valueOfInfoLabel to masterApplication if exists
ca
parents:
1329
diff
changeset
|
654 |
valueOfInfoLabel |
1669 | 655 |
"returns the info label as value holder |
656 |
" |
|
1336
3c84dc6f8d4b
delegate valueOfInfoLabel to masterApplication if exists
ca
parents:
1329
diff
changeset
|
657 |
masterApplication notNil ifTrue:[ |
1669 | 658 |
^ masterApplication valueOfInfoLabel |
1336
3c84dc6f8d4b
delegate valueOfInfoLabel to masterApplication if exists
ca
parents:
1329
diff
changeset
|
659 |
]. |
3c84dc6f8d4b
delegate valueOfInfoLabel to masterApplication if exists
ca
parents:
1329
diff
changeset
|
660 |
^ super valueOfInfoLabel |
148 | 661 |
! ! |
662 |
||
750 | 663 |
!UIHelpTool methodsFor:'building'! |
664 |
||
1663 | 665 |
buildAndMergeFromClass:aClass |
1669 | 666 |
"setup a new specClass, merge the current items into |
667 |
" |
|
668 |
|root mergeItems| |
|
1663 | 669 |
|
1669 | 670 |
root := classItemList first. |
671 |
||
672 |
root isUnspecified ifTrue:[ mergeItems := root children ] |
|
673 |
ifFalse:[ mergeItems := nil ]. |
|
674 |
||
675 |
self buildFromClass:aClass. |
|
1663 | 676 |
|
1669 | 677 |
mergeItems size ~~ 0 ifTrue:[ |
678 |
root := classItemList first. |
|
679 |
||
680 |
mergeItems do:[:anItem| |item hkey| |
|
681 |
hkey := anItem helpKey. |
|
682 |
item := root detectItemWithKey:hkey. |
|
1663 | 683 |
|
1669 | 684 |
item isNil ifTrue:[ |
685 |
item := KeyItem helpKey:hkey helpText:(anItem helpText). |
|
686 |
root add:item sortBlock:[:a :b| a label < b label ]. |
|
687 |
] ifFalse:[ |
|
688 |
item helpText:(anItem helpText). |
|
689 |
] |
|
690 |
] |
|
1663 | 691 |
]. |
692 |
! |
|
693 |
||
750 | 694 |
buildFromClass:aClass |
779 | 695 |
"reads the help dictionary from aClass and find remaining classes |
1669 | 696 |
'between' aClass and ApplicationModel |
697 |
" |
|
1681 | 698 |
|lastContents root list resource helpSpecSelector| |
779 | 699 |
|
1681 | 700 |
helpSpecSelector := self specSelector. |
1646 | 701 |
specClass := self getHelpSpecClassFromClass:aClass. |
702 |
||
1669 | 703 |
list := OrderedCollection new. |
704 |
||
705 |
(specClass isClass and:[specClass isLoaded]) ifTrue:[ |
|
1670 | 706 |
lastContents := nil. |
1681 | 707 |
resource := specClass name, ' ', helpSpecSelector. |
1670 | 708 |
self addToHistory:(Association key:resource value:#'loadFromMessage:'). |
1669 | 709 |
|
1670 | 710 |
specClass withAllSuperclasses reverse do:[:aClass| |value name| |
711 |
lastContents isNil ifTrue:[ |
|
712 |
aClass == ApplicationModel ifTrue:[ |
|
713 |
lastContents := IdentityDictionary new |
|
714 |
]. |
|
715 |
] ifFalse:[ |
|
716 |
root := ClassItem onClass:aClass. |
|
1669 | 717 |
|
1681 | 718 |
(aClass class includesSelector:helpSpecSelector) ifTrue:[ |
719 |
value := aClass perform:helpSpecSelector. |
|
1669 | 720 |
|
1670 | 721 |
value keysAndValuesDo:[:k :v| |cval| |
722 |
cval := lastContents at:k ifAbsent:self. |
|
723 |
cval = v ifFalse:[ root add:(KeyItem helpKey:k helpText:v) ]. |
|
724 |
]. |
|
725 |
lastContents := value. |
|
726 |
]. |
|
727 |
root sort:[:a :b| a label < b label ]. |
|
728 |
root modified:false. |
|
729 |
list add:root. |
|
730 |
] |
|
731 |
] |
|
1669 | 732 |
]. |
733 |
list isEmpty ifTrue:[ |
|
1670 | 734 |
list add:(ClassItem onClass:nil) |
1646 | 735 |
]. |
736 |
||
1669 | 737 |
self withoutModifyDo:[ |
1670 | 738 |
classItemList contents:list. |
739 |
self updateIcons. |
|
740 |
classItemModel value:(list last) |
|
1646 | 741 |
]. |
1340
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
742 |
! |
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
743 |
|
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
744 |
buildFromClass: aClass andSelector: aSelector |
1669 | 745 |
"sets aSelector and reads the help dictionary from aClass |
746 |
" |
|
1340
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
747 |
specSelector := aSelector. |
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
748 |
self buildFromClass:aClass |
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
749 |
! |
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
750 |
|
1646 | 751 |
buildFromHelpTool:aHelpTool |
1669 | 752 |
"build from another helpTool |
753 |
" |
|
754 |
specClass := aHelpTool specClass. |
|
755 |
specSelector := aHelpTool specSelector. |
|
756 |
classItemList := aHelpTool classItemListHolder value. |
|
1646 | 757 |
|
1669 | 758 |
self classItemListHolder value:classItemList. |
1646 | 759 |
|
1669 | 760 |
classItemModel triggerValue:(classItemList last). |
1646 | 761 |
! ! |
1340
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
762 |
|
1646 | 763 |
!UIHelpTool methodsFor:'change & update'! |
764 |
||
765 |
editModelChanged |
|
1669 | 766 |
"called if the editModel changed |
1646 | 767 |
" |
768 |
|key| |
|
1340
4276358d937b
added update function; changed layout
Claus Gittinger <cg@exept.de>
parents:
1336
diff
changeset
|
769 |
|
1646 | 770 |
key := self helpKey. |
771 |
||
1669 | 772 |
modifiedHolder notNil ifTrue:[ |
773 |
modifiedHolder value:true |
|
774 |
]. |
|
963
62cdb7923a3b
care for setup, before view components are built
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
775 |
|
1669 | 776 |
contentsModifiedChannel value:false. |
963
62cdb7923a3b
care for setup, before view components are built
Claus Gittinger <cg@exept.de>
parents:
946
diff
changeset
|
777 |
|
1646 | 778 |
key notNil ifTrue:[ |
1669 | 779 |
keyItemModel value = key ifTrue:[^ self]. |
780 |
||
781 |
classItemList reverseDo:[:root| |item| |
|
782 |
item := root detectItemWithKey:key. |
|
1646 | 783 |
|
1669 | 784 |
item notNil ifTrue:[ |
785 |
classItemModel value:root. |
|
786 |
keyItemModel value:item. |
|
787 |
^ self. |
|
788 |
]. |
|
789 |
]. |
|
790 |
||
791 |
masterApplication isNil ifTrue:[ |
|
792 |
"entered a new helpKey |
|
793 |
" |
|
794 |
self valueOfEnablingCommitButtons value:true. |
|
795 |
]. |
|
750 | 796 |
]. |
1669 | 797 |
keyItemModel value:nil. |
1646 | 798 |
! |
779 | 799 |
|
1646 | 800 |
update:something with:aParameter from:changedObject |
1669 | 801 |
"Invoked when an object that I depend upon sends a change notification. |
802 |
" |
|
803 |
|root item list| |
|
722 | 804 |
|
1669 | 805 |
changedObject == keyItemModel ifTrue:[ |
806 |
item := keyItemModel value. |
|
1597
b670ad8c30e1
builder componentAt: -> self componentAt:
Claus Gittinger <cg@exept.de>
parents:
1554
diff
changeset
|
807 |
|
1669 | 808 |
item notNil ifTrue:[ |
809 |
editModel value:(item helpKey). |
|
810 |
]. |
|
811 |
self cancel. |
|
812 |
^ self |
|
1646 | 813 |
]. |
814 |
||
1669 | 815 |
changedObject == classItemModel ifTrue:[ |
816 |
root := classItemModel value. |
|
817 |
||
818 |
root notNil ifTrue:[ |
|
819 |
item := root detectItemWithKey:(self helpKey). |
|
820 |
list := root list. |
|
821 |
] ifFalse:[ |
|
822 |
list := item := nil. |
|
823 |
]. |
|
824 |
||
825 |
item notNil ifTrue:[ |
|
826 |
keyItemModel value:nil withoutNotifying:self. |
|
827 |
]. |
|
828 |
self keyItemListHolder value:list. |
|
829 |
keyItemModel value:item. |
|
830 |
^ self |
|
740 | 831 |
]. |
1646 | 832 |
|
1669 | 833 |
changedObject == editModel ifTrue:[ |
834 |
self editModelChanged. |
|
835 |
^ self |
|
836 |
]. |
|
750 | 837 |
|
1669 | 838 |
changedObject == contentsModifiedChannel ifTrue:[ |
839 |
modifiedHolder notNil ifTrue:[ |
|
840 |
modifiedHolder value:true |
|
841 |
]. |
|
842 |
^ self |
|
843 |
]. |
|
844 |
super update:something with:aParameter from:changedObject |
|
845 |
! |
|
904 | 846 |
|
1669 | 847 |
withoutModifyDo:aBlock |
848 |
"discard modifications; trigger not the modifiedHolder during |
|
1723
30d20151ed81
Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents:
1681
diff
changeset
|
849 |
the action is active" |
30d20151ed81
Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents:
1681
diff
changeset
|
850 |
|
1669 | 851 |
|holder| |
852 |
||
1723
30d20151ed81
Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents:
1681
diff
changeset
|
853 |
modifiedHolder isNil ifTrue:[ |
30d20151ed81
Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents:
1681
diff
changeset
|
854 |
^ aBlock value |
30d20151ed81
Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents:
1681
diff
changeset
|
855 |
]. |
1669 | 856 |
holder := modifiedHolder. |
1723
30d20151ed81
Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents:
1681
diff
changeset
|
857 |
^ aBlock ensure:[modifiedHolder := holder] |
750 | 858 |
! ! |
859 |
||
286 | 860 |
!UIHelpTool methodsFor:'private'! |
861 |
||
750 | 862 |
askForModification |
1669 | 863 |
"asks for modification; launch a dialog if something is modified; |
864 |
returns true if the modifications are accepted by user otherwise |
|
865 |
false. |
|
866 |
" |
|
867 |
|dialog| |
|
740 | 868 |
|
1669 | 869 |
self modified ifTrue:[ |
870 |
dialog := YesNoBox title:(resources string:'List was modified !!') |
|
871 |
yesText:(resources string:'Forget it and proceed') |
|
872 |
noText:(resources string:'Cancel'). |
|
873 |
||
874 |
dialog showAtPointer. |
|
875 |
dialog accepted ifFalse:[^ false]. |
|
876 |
self modified:false. |
|
740 | 877 |
]. |
1646 | 878 |
^ true |
740 | 879 |
! |
880 |
||
1669 | 881 |
extractResourceFrom:aString |
882 |
"extracts class and selector from a resource string. On success |
|
883 |
an association with the key a class and the selector as value |
|
884 |
is returned. Otherwise nil is returned |
|
1646 | 885 |
" |
1669 | 886 |
|words newClass newSel| |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
887 |
|
1669 | 888 |
aString size ~~ 0 ifTrue:[ |
889 |
words := aString asCollectionOfWords. |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
890 |
|
1669 | 891 |
words size == 2 ifTrue:[ |
892 |
newClass := self resolveName:(words first). |
|
1646 | 893 |
|
1669 | 894 |
(newClass isClass and:[newClass isLoaded]) ifTrue:[ |
895 |
newSel := words last asSymbol. |
|
1646 | 896 |
|
1669 | 897 |
(newClass class includesSelector:newSel) ifTrue:[ |
898 |
^ Association key:newClass value:newSel |
|
899 |
]. |
|
900 |
]. |
|
901 |
]. |
|
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
902 |
]. |
1669 | 903 |
^ nil |
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
904 |
! |
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
905 |
|
750 | 906 |
getHelpSpecClassFromClass:aClass |
1669 | 907 |
"oops |
908 |
" |
|
750 | 909 |
|cls| |
910 |
||
1669 | 911 |
aClass notNil ifTrue:[ |
912 |
cls := self resolveName:aClass. |
|
750 | 913 |
|
1669 | 914 |
cls notNil ifTrue:[ |
915 |
cls := cls perform:#helpSpecClass ifNotUnderstood:cls. |
|
750 | 916 |
|
1669 | 917 |
(cls isClass and:[cls isLoaded]) ifTrue:[ |
918 |
^ cls |
|
919 |
]. |
|
920 |
]. |
|
761
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
921 |
]. |
1669 | 922 |
^ nil |
761
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
923 |
! |
91e524583390
do not save, if help texts have not changed (unformatting)
tz
parents:
750
diff
changeset
|
924 |
|
1669 | 925 |
loadFromMessage:aString |
926 |
"Set and rebuild the specClass and specSelector from a resource string. |
|
927 |
On success true is returned otherwise false. If the current spec is |
|
928 |
modified, a dialog is launched. |
|
929 |
" |
|
930 |
|association| |
|
740 | 931 |
|
1669 | 932 |
association := self extractResourceFrom:aString. |
740 | 933 |
|
1669 | 934 |
association notNil ifTrue:[ |
935 |
self askForModification ifTrue:[ |
|
936 |
self buildFromClass:(association key) andSelector:(association value). |
|
937 |
^ true |
|
938 |
]. |
|
740 | 939 |
]. |
1669 | 940 |
^ false |
740 | 941 |
! |
942 |
||
1669 | 943 |
resourceMessage:aString |
944 |
"Set the specClass and specSelector from a resource string. On |
|
945 |
success true is returned otherwise false. |
|
946 |
" |
|
947 |
|association| |
|
740 | 948 |
|
1669 | 949 |
association := self extractResourceFrom:aString. |
750 | 950 |
|
1669 | 951 |
association notNil ifTrue:[ |
952 |
specClass := association key. |
|
953 |
specSelector := association value. |
|
954 |
^ true |
|
750 | 955 |
]. |
1669 | 956 |
^ false |
1670 | 957 |
! |
958 |
||
959 |
updateIcons |
|
960 |
"update all icons (redefinitions below above or both) |
|
961 |
" |
|
962 |
|iconBelow iconAbove iconAboveAndBelow isBehind redefinedAbove redefinedBelow icon| |
|
963 |
||
964 |
"/ if only one class exists, its not possible to have redefinitions |
|
965 |
classItemList size > 1 ifFalse:[ ^ self ]. |
|
966 |
||
967 |
iconBelow := SystemBrowser medium_methodRedefinedBelowIcon. |
|
968 |
iconAbove := SystemBrowser medium_methodInheritedFromAboveIcon. |
|
969 |
iconAboveAndBelow := SystemBrowser medium_methodInheritedFromAboveAndRedefinedBelowIcon. |
|
970 |
||
971 |
classItemList do:[:runClass| |
|
972 |
runClass do:[:aKeyItem| |
|
973 |
isBehind := redefinedBelow := redefinedAbove := false. |
|
974 |
||
975 |
classItemList do:[:testClass| |
|
976 |
testClass == runClass ifTrue:[ |
|
977 |
isBehind := true |
|
978 |
] ifFalse:[ |
|
979 |
(testClass detectItemWithKey:(aKeyItem helpKey)) notNil ifTrue:[ |
|
980 |
isBehind ifTrue:[ redefinedBelow := true ] |
|
981 |
ifFalse:[ redefinedAbove := true ]. |
|
982 |
] |
|
983 |
] |
|
984 |
]. |
|
985 |
||
986 |
redefinedBelow ifTrue:[ |
|
987 |
redefinedAbove ifTrue:[ icon := iconAboveAndBelow ] |
|
988 |
ifFalse:[ icon := iconBelow ] |
|
989 |
] ifFalse:[ |
|
990 |
redefinedAbove ifTrue:[ icon := iconAbove ] |
|
991 |
ifFalse:[ icon := nil ] |
|
992 |
]. |
|
993 |
aKeyItem icon:icon. |
|
994 |
] |
|
995 |
]. |
|
286 | 996 |
! ! |
997 |
||
1669 | 998 |
!UIHelpTool methodsFor:'startup & release'! |
369 | 999 |
|
1000 |
closeRequest |
|
1669 | 1001 |
"asks for permission before closing |
1002 |
" |
|
1003 |
(masterApplication isNil and:[self askForModification]) ifTrue:[ |
|
1004 |
super closeRequest. |
|
1005 |
]. |
|
740 | 1006 |
! |
1007 |
||
1008 |
initialize |
|
1669 | 1009 |
"setup default attributes |
1010 |
" |
|
1011 |
super initialize. |
|
1012 |
self createBuilder. |
|
779 | 1013 |
|
1669 | 1014 |
specSelector := #helpSpec. |
1015 |
||
1016 |
classItemList := List new. |
|
740 | 1017 |
|
1669 | 1018 |
classItemModel := nil asValue. |
1019 |
classItemModel addDependent:self. |
|
1020 |
||
1021 |
keyItemModel := nil asValue. |
|
1022 |
keyItemModel addDependent:self. |
|
1023 |
||
1024 |
contentsModifiedChannel := false asValue. |
|
1025 |
contentsModifiedChannel addDependent:self. |
|
1026 |
||
1027 |
helpTextView := EditTextView new. |
|
1028 |
helpTextView acceptAction:[:dummy| self accept ]. |
|
1029 |
helpTextView modifiedChannel:contentsModifiedChannel. |
|
1646 | 1030 |
|
1031 |
editModel := nil asValue. |
|
1032 |
editModel addDependent:self. |
|
740 | 1033 |
|
1669 | 1034 |
self buildFromClass:nil. |
750 | 1035 |
! |
1036 |
||
696
e91402372900
popup menu replaced by a list + supporting of help specs from different classes
tz
parents:
479
diff
changeset
|
1037 |
openInterface:aSymbol |
1669 | 1038 |
"do not open as stand alone |
1039 |
" |
|
750 | 1040 |
! |
1041 |
||
1042 |
openOnClass:aClass |
|
1669 | 1043 |
"opens the UIHelpTool on aClass |
1044 |
" |
|
1597
b670ad8c30e1
builder componentAt: -> self componentAt:
Claus Gittinger <cg@exept.de>
parents:
1554
diff
changeset
|
1045 |
self openOnClass:aClass andSelector:nil |
940 | 1046 |
! |
1047 |
||
1048 |
openOnClass:aClass andSelector: aSelector |
|
1049 |
"opens the UIHelpTool on aClass and aSelector" |
|
1050 |
||
1669 | 1051 |
super openInterface:#windowSpecForStandAlone. |
1597
b670ad8c30e1
builder componentAt: -> self componentAt:
Claus Gittinger <cg@exept.de>
parents:
1554
diff
changeset
|
1052 |
|
940 | 1053 |
builder window label: 'Help Tool'. |
1597
b670ad8c30e1
builder componentAt: -> self componentAt:
Claus Gittinger <cg@exept.de>
parents:
1554
diff
changeset
|
1054 |
self buildFromClass:aClass andSelector:aSelector |
369 | 1055 |
! ! |
1056 |
||
740 | 1057 |
!UIHelpTool methodsFor:'user actions'! |
286 | 1058 |
|
722 | 1059 |
accept |
1669 | 1060 |
"accepts the help text |
1061 |
" |
|
1062 |
|helpKey helpItem root| |
|
779 | 1063 |
|
1669 | 1064 |
helpKey := self helpKey. |
1065 |
helpKey isNil ifTrue:[^ self]. |
|
1646 | 1066 |
|
1669 | 1067 |
root := classItemModel value. |
1068 |
root isNil ifTrue:[^ self]. |
|
1069 |
||
1070 |
helpItem := root detectItemWithKey:helpKey. |
|
1648
d88ec5777284
empty help string - add key anyway
Claus Gittinger <cg@exept.de>
parents:
1646
diff
changeset
|
1071 |
|
1669 | 1072 |
helpItem isNil ifTrue:[ |
1670 | 1073 |
helpItem := KeyItem helpKey:helpKey helpText:(helpTextView contents). |
1074 |
root add:helpItem sortBlock:[:a :b| a label < b label ]. |
|
1075 |
self updateIcons. |
|
1669 | 1076 |
] ifFalse:[ |
1670 | 1077 |
helpItem helpText:(helpTextView contents). |
1646 | 1078 |
]. |
722 | 1079 |
|
1669 | 1080 |
contentsModifiedChannel value:false. |
1081 |
keyItemModel triggerValue:helpItem. |
|
722 | 1082 |
! |
1083 |
||
1646 | 1084 |
cancel |
1669 | 1085 |
"cancel modifications, reload helpText |
1086 |
" |
|
1087 |
|item contents modified| |
|
1646 | 1088 |
|
1669 | 1089 |
item := keyItemModel value. |
1090 |
modified := false. |
|
779 | 1091 |
|
1669 | 1092 |
item notNil ifTrue:[ |
1093 |
contents := item helpText. |
|
1094 |
] ifFalse:[ |
|
1095 |
contents := nil. |
|
1096 |
||
1097 |
modifiedHolder isNil ifTrue:[ |
|
1098 |
modified := self helpKey notNil |
|
1099 |
] |
|
1646 | 1100 |
]. |
1669 | 1101 |
helpTextView contents:contents. |
1102 |
contentsModifiedChannel value:modified. |
|
722 | 1103 |
! |
1104 |
||
750 | 1105 |
doDelete |
1646 | 1106 |
"deletes the selected help key |
1107 |
" |
|
1669 | 1108 |
|item| |
1646 | 1109 |
|
1669 | 1110 |
item := keyItemModel value. |
1670 | 1111 |
|
1112 |
item notNil ifTrue:[ |
|
1113 |
item remove. |
|
1114 |
item icon notNil ifTrue:[ self updateIcons ]. |
|
1115 |
]. |
|
1669 | 1116 |
editModel value:nil. |
722 | 1117 |
! |
1118 |
||
750 | 1119 |
doLoad |
1669 | 1120 |
"opens a Resource Selection Browser in order to get a resource message |
1121 |
" |
|
750 | 1122 |
self loadFromMessage: |
1681 | 1123 |
(ResourceSelectionBrowser |
1124 |
request: 'Load Help Spec From Class' |
|
1125 |
onSuperclass: nil |
|
1126 |
andClass: specClass |
|
1127 |
andSelector: (self specSelector) |
|
1128 |
withResourceTypes: (Array with: #help)). |
|
779 | 1129 |
|
1130 |
self updateInfoLabel |
|
750 | 1131 |
! |
286 | 1132 |
|
750 | 1133 |
doNew |
1669 | 1134 |
"reset all to empty |
1135 |
" |
|
1136 |
contentsModifiedChannel value:false. |
|
1137 |
self helpKey:nil. |
|
1138 |
self buildFromClass:nil. |
|
750 | 1139 |
! |
1140 |
||
722 | 1141 |
doSave |
1669 | 1142 |
"save the help spec to the spec-class(es) |
1143 |
" |
|
1144 |
specClass isNil ifTrue:[ |
|
1145 |
self information:(resources string:'No class specified !!'). |
|
1146 |
^ nil |
|
1147 |
]. |
|
1148 |
(specClass isSubclassOf:ApplicationModel) ifFalse:[ |
|
1735 | 1149 |
self information:(resources string:'Cannot save help into non-Application class'). |
1669 | 1150 |
^ nil |
1151 |
]. |
|
1152 |
||
1681 | 1153 |
classItemList do:[:aClassItem| |
1154 |
aClassItem createHelpMethodNamed:(self specSelector) |
|
1155 |
]. |
|
1669 | 1156 |
! |
1157 |
||
1158 |
openDocumentation |
|
1159 |
"opens the documentation file of the Help Tool |
|
1160 |
" |
|
1161 |
self openHTMLDocument: 'tools/uipainter/HelpTool.html' |
|
1162 |
! ! |
|
1163 |
||
1164 |
!UIHelpTool::ClassItem class methodsFor:'instance creation'! |
|
1165 |
||
1166 |
onClass:aClass |
|
1167 |
|root| |
|
1168 |
||
1169 |
root := self new. |
|
1170 |
root onClass:aClass. |
|
1171 |
^ root |
|
1172 |
! ! |
|
1173 |
||
1174 |
!UIHelpTool::ClassItem methodsFor:'accessing'! |
|
1175 |
||
1176 |
list |
|
1177 |
"returns the hierarchical list assigned to the classItem; the |
|
1178 |
list contains the keyItems |
|
1179 |
" |
|
1180 |
list isNil ifTrue:[ |
|
1181 |
list := HierarchicalList new. |
|
1182 |
list showRoot:false. |
|
1183 |
list root:self. |
|
1184 |
]. |
|
1185 |
^ list |
|
1186 |
! |
|
1187 |
||
1188 |
theClass |
|
1189 |
"returns the class or nil if unspecified |
|
1190 |
" |
|
1191 |
^ theClass |
|
1192 |
! ! |
|
1193 |
||
1194 |
!UIHelpTool::ClassItem methodsFor:'change & update'! |
|
1195 |
||
1196 |
helpTextChangedFor:anItem |
|
1197 |
"called if an helpKey changed its contents |
|
1198 |
" |
|
1199 |
self model notNil ifTrue:[ |
|
1200 |
self modified:true. |
|
1201 |
anItem modified:true. |
|
1202 |
]. |
|
1203 |
! ! |
|
1204 |
||
1205 |
!UIHelpTool::ClassItem methodsFor:'code generation'! |
|
1206 |
||
1207 |
createHelpMethodNamed:aMethodName |
|
1208 |
|stream| |
|
1209 |
||
1210 |
(modified and:[theClass notNil]) ifFalse:[ |
|
1211 |
^ self |
|
1212 |
]. |
|
1213 |
stream := '' writeStream. |
|
1214 |
||
1215 |
stream nextPutAll: |
|
1216 |
aMethodName, '\' withCRs, |
|
1217 |
(ResourceSpecEditor codeGenerationCommentForClass:UIHelpTool) withCRs, |
|
1218 |
'\\' withCRs, |
|
1219 |
' "\' withCRs, |
|
1220 |
' UIHelpTool openOnClass:', theClass name asString ,' |
|
1221 |
" |
|
1222 |
||
1223 |
<resource: #help> |
|
1224 |
||
1225 |
^ super ', aMethodName, ' addPairsFrom:#( |
|
1226 |
||
1227 |
'. |
|
1228 |
||
1229 |
self do:[:aKeyItem| |helpText| |
|
1230 |
helpText := aKeyItem helpText. |
|
1231 |
helpText isNil ifTrue:[ helpText := '' ]. |
|
1232 |
||
1233 |
stream nextPutLine:(aKeyItem helpKey storeString). |
|
1234 |
stream nextPutLine:(helpText storeString); cr. |
|
1235 |
]. |
|
1236 |
stream nextPutLine:')'. |
|
1237 |
||
1238 |
Compiler |
|
1239 |
compile:(stream contents) |
|
1240 |
forClass:theClass class |
|
1241 |
inCategory:'help specs'. |
|
1242 |
||
1243 |
self modified:false. |
|
1244 |
! ! |
|
1245 |
||
1246 |
!UIHelpTool::ClassItem methodsFor:'displaying'! |
|
1247 |
||
1248 |
icon |
|
1249 |
"returns the display icon (always nil) |
|
1250 |
" |
|
1251 |
^ nil |
|
1252 |
! |
|
1253 |
||
1254 |
label |
|
1255 |
"returns the display label |
|
1256 |
" |
|
1257 |
|label| |
|
1258 |
||
1259 |
theClass notNil ifTrue:[ label := theClass name ] |
|
1260 |
ifFalse:[ label := '** not yet defined **' ]. |
|
1261 |
||
1262 |
modified ifTrue:[ |
|
1263 |
label := Text string:label color:(Color red). |
|
1264 |
]. |
|
1265 |
^ label |
|
1266 |
! ! |
|
1267 |
||
1268 |
!UIHelpTool::ClassItem methodsFor:'instance creation'! |
|
1269 |
||
1270 |
initialize |
|
1271 |
"setup defaults |
|
1272 |
" |
|
1273 |
super initialize. |
|
1274 |
||
1275 |
children := OrderedCollection new. |
|
1276 |
isExpanded := true. |
|
1277 |
modified := false. |
|
1278 |
! |
|
1279 |
||
1280 |
onClass:aClass |
|
1281 |
"the class the ys are assigned to; if the class is nil, |
|
1282 |
the class is not yet specified. |
|
1283 |
" |
|
1284 |
theClass := aClass. |
|
1285 |
! ! |
|
1286 |
||
1287 |
!UIHelpTool::ClassItem methodsFor:'private'! |
|
1288 |
||
1289 |
basicAdd:aChild sortBlock:aBlock |
|
1290 |
"catch low-level add to update the modification flag |
|
1291 |
" |
|
1292 |
self modified:true. |
|
1293 |
aChild modified:true. |
|
1294 |
||
1295 |
^ super basicAdd:aChild sortBlock:aBlock. |
|
1296 |
! |
|
1297 |
||
1298 |
basicAddAll:aList beforeIndex:anIndex |
|
1299 |
"catch low-level add to update the modification flag |
|
1300 |
" |
|
1301 |
self modified:true. |
|
1302 |
||
1303 |
aList do:[:el| el modified:true ]. |
|
1304 |
^ super basicAddAll:aList beforeIndex:anIndex. |
|
1305 |
! |
|
779 | 1306 |
|
1669 | 1307 |
basicRemoveFromIndex:startIndex toIndex:stopIndex |
1308 |
"catch low-level remove to update the modification flag |
|
1309 |
" |
|
1310 |
self isUnspecified ifFalse:[ |
|
1311 |
self modified:true. |
|
1312 |
]. |
|
1313 |
^ super basicRemoveFromIndex:startIndex toIndex:stopIndex |
|
1314 |
! ! |
|
1315 |
||
1316 |
!UIHelpTool::ClassItem methodsFor:'queries'! |
|
1317 |
||
1318 |
isUnspecified |
|
1319 |
"true if the class is unspecified |
|
1320 |
" |
|
1321 |
^ theClass isNil |
|
1322 |
! |
|
1323 |
||
1324 |
modified |
|
1325 |
"true, if any item is modified, created or deleted |
|
1326 |
" |
|
1327 |
^ modified |
|
1328 |
! |
|
1329 |
||
1330 |
modified:aBoolean |
|
1331 |
"true, if any item is modified, created or deleted |
|
1332 |
" |
|
1333 |
modified ~~ aBoolean ifTrue:[ |
|
1334 |
modified := aBoolean. |
|
1335 |
||
1336 |
modified ifFalse:[ |
|
1337 |
self do:[:el| el modified:false ]. |
|
1338 |
]. |
|
1339 |
]. |
|
1340 |
! ! |
|
1341 |
||
1342 |
!UIHelpTool::ClassItem methodsFor:'searching'! |
|
1343 |
||
1344 |
detectItemWithKey:aKey |
|
1345 |
"returns the item assigned to a helpKey or nil |
|
1346 |
" |
|
1347 |
|key| |
|
1348 |
||
1349 |
aKey size ~~ 0 ifTrue:[ |
|
1350 |
key := aKey asSymbol. |
|
1351 |
||
1352 |
self do:[:anItem| |
|
1353 |
anItem helpKey == key ifTrue:[ ^ anItem ]. |
|
1354 |
] |
|
1355 |
]. |
|
1356 |
^ nil |
|
1357 |
! ! |
|
1358 |
||
1359 |
!UIHelpTool::KeyItem class methodsFor:'instance creation'! |
|
1360 |
||
1681 | 1361 |
helpKey:aKey helpText:aText |
1669 | 1362 |
|key| |
1363 |
||
1364 |
key := self new. |
|
1365 |
key helpKey:aKey helpText:aText. |
|
1366 |
^ key |
|
1367 |
! ! |
|
1368 |
||
1369 |
!UIHelpTool::KeyItem methodsFor:'accessing'! |
|
1370 |
||
1371 |
helpKey |
|
1372 |
"returns the helpKey, a symbol |
|
1373 |
" |
|
1374 |
^ helpKey |
|
1375 |
! |
|
1376 |
||
1377 |
helpText |
|
1378 |
"returns the contents assigned to the helpKey or nil |
|
1379 |
" |
|
1380 |
^ helpText |
|
1381 |
! |
|
1382 |
||
1383 |
helpText:aText |
|
1681 | 1384 |
"set the contents assigned to the helpKey; if the contents changes, |
1669 | 1385 |
a notification is raised. |
1386 |
" |
|
1387 |
|text| |
|
1388 |
||
1389 |
text := self formatText:aText. |
|
1390 |
||
1391 |
text ~= helpText ifTrue:[ |
|
1681 | 1392 |
helpText := text. |
1669 | 1393 |
|
1681 | 1394 |
(modified or:[parent isNil]) ifFalse:[ |
1395 |
parent helpTextChangedFor:self. |
|
1396 |
] |
|
1669 | 1397 |
]. |
1398 |
! ! |
|
1399 |
||
1400 |
!UIHelpTool::KeyItem methodsFor:'displaying'! |
|
1401 |
||
1402 |
icon |
|
1403 |
"returns the display icon (always nil) |
|
1404 |
" |
|
1670 | 1405 |
^ icon |
1406 |
! |
|
1407 |
||
1408 |
icon:anIcon |
|
1409 |
||
1410 |
icon ~= anIcon ifTrue:[ |
|
1411 |
icon := anIcon. |
|
1412 |
self changed:#icon. |
|
1413 |
]. |
|
1669 | 1414 |
! |
1415 |
||
1416 |
label |
|
1417 |
"returns the display label |
|
1418 |
" |
|
1419 |
modified ifTrue:[ |
|
1420 |
^ Text string:helpKey color:(Color red) |
|
1421 |
]. |
|
1422 |
^ helpKey |
|
1423 |
! ! |
|
1424 |
||
1425 |
!UIHelpTool::KeyItem methodsFor:'instance creation'! |
|
1426 |
||
1427 |
helpKey:aKey helpText:aText |
|
1428 |
"set the key and contents without a change notification |
|
1429 |
" |
|
1430 |
helpKey := aKey asSymbol. |
|
1431 |
helpText := self formatText:aText. |
|
1432 |
! |
|
1433 |
||
1434 |
initialize |
|
1435 |
"setup defaults |
|
1436 |
" |
|
1437 |
super initialize. |
|
1438 |
children := #(). |
|
1439 |
modified := false. |
|
1440 |
! ! |
|
1441 |
||
1442 |
!UIHelpTool::KeyItem methodsFor:'private'! |
|
1443 |
||
1444 |
formatText:aText |
|
1445 |
"format the text, replace carriage return by spaces and compress spaces |
|
1446 |
" |
|
1447 |
|text result| |
|
1448 |
||
1449 |
aText size ~~ 0 ifTrue:[ |
|
1450 |
text := aText asString asCollectionOfWords. |
|
1451 |
||
1452 |
text notEmpty ifTrue:[ |
|
1453 |
result := text first. |
|
1454 |
||
1455 |
text from:2 do:[:t| result := result, ' ', t ]. |
|
1456 |
^ result |
|
1457 |
]. |
|
1458 |
]. |
|
1459 |
^ nil |
|
1460 |
! ! |
|
1461 |
||
1462 |
!UIHelpTool::KeyItem methodsFor:'queries'! |
|
1463 |
||
1464 |
modified |
|
1465 |
"returns true if the helpText is modified |
|
1466 |
" |
|
1467 |
^ modified |
|
1468 |
! |
|
1469 |
||
1470 |
modified:aBoolean |
|
1471 |
"set the modification flag |
|
1472 |
" |
|
1473 |
aBoolean == modified ifFalse:[ |
|
1474 |
modified := aBoolean. |
|
1475 |
self changed:#redraw. |
|
1476 |
]. |
|
148 | 1477 |
! ! |
1478 |
||
1479 |
!UIHelpTool class methodsFor:'documentation'! |
|
1480 |
||
1481 |
version |
|
1482 |
^ '$Header$' |
|
1483 |
! ! |