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