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