author | Claus Gittinger <cg@exept.de> |
Fri, 25 Mar 2016 20:33:10 +0100 | |
changeset 16201 | 639512eafece |
parent 16165 | c7b29d2a5d8e |
child 16213 | f667b5b42a11 |
child 16313 | 6abedc9963c0 |
permissions | -rw-r--r-- |
16201 | 1 |
"{ Encoding: utf8 }" |
2 |
||
5140 | 3 |
" |
4 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
5 |
All Rights Reserved |
|
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 |
" |
|
4378 | 14 |
"{ Package: 'stx:libtool' }" |
15 |
||
15348 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
4378 | 18 |
ApplicationModel subclass:#SettingsDialog |
13116 | 19 |
instanceVariableNames:'requestor subCanvasApplicationHolder help doReload doSave |
20 |
enableReload enableHelp enableOK selectedItem applicationList |
|
21 |
categoryIcons lastSelection whyDisabledInfoHolder' |
|
22 |
classVariableNames:'ApplicationList IconList' |
|
23 |
poolDictionaries:'' |
|
24 |
category:'Interface-Smalltalk' |
|
4378 | 25 |
! |
26 |
||
27 |
HierarchicalList subclass:#HierarchicalApplicationList |
|
13116 | 28 |
instanceVariableNames:'' |
29 |
classVariableNames:'' |
|
30 |
poolDictionaries:'' |
|
31 |
privateIn:SettingsDialog |
|
4378 | 32 |
! |
33 |
||
6688 | 34 |
HierarchicalItemWithLabelAndIcon subclass:#ApplicationItem |
13116 | 35 |
instanceVariableNames:'application applicationClass nameString' |
36 |
classVariableNames:'' |
|
37 |
poolDictionaries:'' |
|
38 |
privateIn:SettingsDialog::HierarchicalApplicationList |
|
4378 | 39 |
! |
40 |
||
13796 | 41 |
AbstractSettingsApplication subclass:#SettingsFilenameAppl |
14792 | 42 |
instanceVariableNames:'settingsFilenameHolder infoLabelHolder' |
13796 | 43 |
classVariableNames:'' |
44 |
poolDictionaries:'' |
|
45 |
privateIn:SettingsDialog |
|
46 |
! |
|
47 |
||
4378 | 48 |
!SettingsDialog class methodsFor:'documentation'! |
49 |
||
5140 | 50 |
copyright |
51 |
" |
|
52 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
53 |
All Rights Reserved |
|
54 |
||
55 |
This software is furnished under a license and may be used |
|
56 |
only in accordance with the terms of that license and with the |
|
57 |
inclusion of the above copyright notice. This software may not |
|
58 |
be provided or otherwise made available to, or used by, any |
|
59 |
other person. No title to or ownership of the software is |
|
60 |
hereby transferred. |
|
61 |
" |
|
62 |
! |
|
63 |
||
4378 | 64 |
documentation |
65 |
" |
|
6019 | 66 |
This is an application which presents a hierarchy of settings applications. |
67 |
It is used (among others) in the launcher's and filebrowser's settings-dialogs. |
|
13114 | 68 |
|
69 |
However, it is rather generic and can be setup for any application's setting dialog. |
|
70 |
The actual contents (i.e. the arganization tree and tab contents) is provided |
|
71 |
by a spec-array (the settingsList). |
|
72 |
You will find a default settings list here, but in theory, applications may provide |
|
73 |
their own one, or modify a copy of that list for specialized settings dialogs. |
|
13115 | 74 |
See class >> examples, #defaultSettingsApplicationList |
75 |
and AbstractLauncherApplication >> settingsList for more info. |
|
4494 | 76 |
|
4378 | 77 |
[author:] |
78 |
Christian Penk, eXept Software AG |
|
4494 | 79 |
|
80 |
[see also:] |
|
81 |
AbstractLauncherApplication defaultSettingsApplicationList |
|
4378 | 82 |
" |
4400 | 83 |
! |
84 |
||
85 |
examples |
|
86 |
||
87 |
" |
|
4494 | 88 |
start a Settings Dialog with a language Settings Application under root |
4400 | 89 |
[exBegin] |
90 |
| settingsApp | |
|
91 |
||
92 |
settingsApp := self new. |
|
93 |
settingsApp addApplClass:#'AbstractSettingsApplication::LanguageSettingsAppl' |
|
94 |
withName:'Language'. |
|
95 |
settingsApp open. |
|
96 |
[exEnd] |
|
97 |
||
98 |
||
4494 | 99 |
start a Settings Dialog with a language Settings Application under root/Test |
4400 | 100 |
[exBegin] |
101 |
| settingsApp | |
|
102 |
||
103 |
settingsApp := self new. |
|
104 |
settingsApp addApplClass:#'AbstractSettingsApplication::LanguageSettingsAppl' |
|
105 |
withName:'Test/Language'. |
|
106 |
settingsApp open. |
|
107 |
[exEnd] |
|
108 |
||
4494 | 109 |
start a Settings Dialog with a language Settings Application under root/Test |
110 |
with an other category test icon |
|
4400 | 111 |
[exBegin] |
112 |
| settingsApp | |
|
113 |
||
114 |
settingsApp := self new. |
|
115 |
settingsApp addApplClass:#'AbstractSettingsApplication::LanguageSettingsAppl' |
|
116 |
withName:'Test/Language'. |
|
4401 | 117 |
settingsApp addIcon:ToolbarIconLibrary start22x22Icon forCategory:'Test'. |
4400 | 118 |
settingsApp open. |
119 |
[exEnd] |
|
4401 | 120 |
|
4494 | 121 |
start a Settings Dialog with a language and memory Settings Application |
122 |
in different categories |
|
4400 | 123 |
[exBegin] |
124 |
| settingsApp | |
|
125 |
||
126 |
settingsApp := self new. |
|
127 |
settingsApp addIcon:ToolbarIconLibrary start22x22Icon forCategory:'Test'. |
|
128 |
settingsApp addApplClass:#'AbstractSettingsApplication::LanguageSettingsAppl' |
|
129 |
withName:'Test/Language'. |
|
130 |
settingsApp addApplClass:#'AbstractSettingsApplication::MemorySettingsAppl' |
|
131 |
withName:'Test2/Memory'. |
|
132 |
settingsApp open. |
|
133 |
[exEnd] |
|
134 |
" |
|
4378 | 135 |
! ! |
136 |
||
5399 | 137 |
!SettingsDialog class methodsFor:'initialization'! |
138 |
||
139 |
initialize |
|
140 |
AbstractSettingsApplication autoload. |
|
141 |
! ! |
|
142 |
||
4378 | 143 |
!SettingsDialog class methodsFor:'accessing'! |
144 |
||
145 |
itemClass |
|
146 |
||
147 |
^ SettingsDialog::HierarchicalApplicationList::ApplicationItem |
|
148 |
! ! |
|
149 |
||
150 |
!SettingsDialog class methodsFor:'application icons'! |
|
151 |
||
152 |
defaultSettingsAppIcon |
|
153 |
||
15919 | 154 |
^ self settingsIcon2 |
4378 | 155 |
! |
156 |
||
15919 | 157 |
settingsFolderIcon |
4378 | 158 |
"This resource specification was automatically generated |
159 |
by the ImageEditor of ST/X." |
|
160 |
||
161 |
"Do not manually edit this!! If it is corrupted, |
|
162 |
the ImageEditor may not be able to read the specification." |
|
163 |
||
164 |
" |
|
165 |
self settingsIcon inspect |
|
166 |
ImageEditor openOnClass:self andSelector:#settingsIcon |
|
167 |
Icon flushCachedIcons |
|
168 |
" |
|
169 |
||
170 |
<resource: #image> |
|
171 |
||
172 |
^Icon |
|
8476
84fa59f05e50
image resource method fixes (key must be name of method)
Claus Gittinger <cg@exept.de>
parents:
8268
diff
changeset
|
173 |
constantNamed:#'SettingsDialog class settingsIcon' |
4378 | 174 |
ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(8 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
175 |
@@BP#8>O#8>M @@@@@@@@@@@@@@@@BJ%9&Y&Y&Y%R^B@@@@@@@@@@@@@@BI&J^(*J"(*JZTIIFQ$YFQ$YH@@@@@ JN#(:N#(:N#(9.V%)ZV%)ZKZP@@@HOU |
|
176 |
4=OS4=OL3,''I0<B;/]F3*TE?@@BC5MKR4-KM,\^:.MJ:-;21/:1D_@@@ =SR4-KM3<+K/<J01,R20+R+QG0@@HOT4-KR/,^?-\[H1(Q^WW"1*4Q<@@BC5MKR |
|
177 |
,-CO1<>/+(X*F1(S,Z1D_@@@ =SR4-J:2,[J0X TU!!BE+F$GS!!=@HOT,+WK.\J/28\&TV=EKAV1RELG BC5L7H0-KB/HT TV-CKA8>TG@=_H8M ;[H1+:: |
|
178 |
-;8\TWECKBD9)T=0]R40AXOE2;F5-;:/G6)EKBD?ZF5KV#ITJ0M>''*B_''ZF]''5,(KA8)X8ENU#XR@ )L^1$YFQ$YFQ$WBA PE@QMVSDON82S@@@@@@@@@@@@ |
|
179 |
@@A_@F)IU#DQMWH@@@@@@@@@@@@@@@@@@F1JWC\LMJI''^ @@@@@@@@@@@@@@@F9GU28ROGI%+VY4@@@@@@@@@@@@@GIFXC(IL9(@^VR*X''\@@@@@@@@@@@AU |
|
180 |
IPXKP@@@@@A3XZ4#@@@@@@@@@@@@# 8AK90@@@@@@GX"T @a') ; colorMapFromArray:#[0 0 0 0 60 60 0 84 84 4 45 45 21 20 15 38 38 38 38 192 192 43 43 43 45 45 45 45 151 151 46 99 99 46 147 147 46 151 151 47 47 47 47 88 88 47 151 151 48 48 48 48 144 144 48 145 145 56 53 38 57 57 49 59 52 40 62 56 43 65 65 53 65 65 65 67 67 54 68 68 68 70 70 70 72 64 47 72 72 35 72 72 72 73 69 48 73 73 73 74 74 74 80 44 10 80 62 43 81 81 24 84 132 132 85 85 76 86 86 36 86 86 86 87 87 49 87 87 77 87 193 193 88 88 88 91 101 101 92 193 193 94 117 117 97 97 97 97 193 193 98 195 195 99 120 120 101 75 31 101 107 89 101 193 193 102 193 193 103 103 103 104 86 69 106 193 193 107 120 120 107 121 121 109 109 109 110 96 70 111 78 42 111 119 119 113 113 60 113 113 113 115 115 115 116 116 56 116 116 116 116 145 145 118 147 147 119 121 85 121 150 150 122 151 151 122 152 148 124 124 124 124 146 139 124 151 149 127 118 78 127 119 78 128 128 128 129 120 112 133 157 157 135 216 216 137 137 137 139 207 207 140 206 206 141 141 141 141 201 201 141 202 202 142 136 75 142 201 201 143 128 88 143 143 88 144 144 144 144 204 204 145 85 24 146 126 100 147 82 13 148 83 17 148 86 24 148 123 91 148 127 98 149 122 89 150 150 150 151 151 151 152 152 152 152 155 155 153 129 100 154 154 154 156 156 156 156 199 199 157 157 157 158 158 158 159 159 159 160 160 160 162 179 179 163 161 159 163 163 162 164 151 101 164 160 156 164 163 161 165 165 150 165 165 165 168 168 168 169 169 62 171 171 171 172 172 71 174 117 58 177 177 177 178 178 89 185 174 113 186 178 115 186 186 115 189 179 116 189 189 115 189 189 132 190 190 139 192 192 142 192 192 192 193 193 154 194 194 194 196 196 155 197 197 159 200 200 168 202 202 174 202 202 202 204 204 102 205 205 97 206 206 149 210 210 144 210 210 149 213 213 103 213 213 213 215 215 164 215 215 215 227 212 124 227 213 140 227 217 124 227 220 124 227 227 124 234 156 79 236 236 197 239 214 144 243 201 148 243 243 146 243 243 155 244 244 147 245 232 157 247 165 83 248 215 149 248 231 149 255 170 86 255 227 156 255 228 156 255 229 156 255 230 156 255 231 156 255 233 168 255 234 156 255 235 156 255 235 193 255 236 156 255 237 156 255 238 156 255 239 156 255 239 168 255 240 156 255 240 168 255 241 156 255 242 156 255 242 168 255 243 156 255 244 156 255 244 168 255 245 156 255 245 193 255 246 156 255 247 156 255 248 156 255 248 168 255 249 156 255 250 156 255 250 168 255 251 156 255 251 168 255 252 156 255 253 156 255 253 168 255 255 156 255 255 168 255 255 193 255 255 200]; mask:((ImageMask new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'O<@@_>@@???@??? ???0???0???0???0???0???8???8???<???<???<???<???8@B? @A?0@C?8@G=<@G0<@G0\') ; yourself); yourself] |
|
5892 | 181 |
! |
182 |
||
15919 | 183 |
settingsIcon |
184 |
^ self settingsIcon2 |
|
185 |
! |
|
186 |
||
187 |
settingsIcon2 |
|
188 |
"This resource specification was automatically generated |
|
189 |
by the ImageEditor of ST/X." |
|
190 |
||
191 |
"Do not manually edit this!! If it is corrupted, |
|
192 |
the ImageEditor may not be able to read the specification." |
|
193 |
||
194 |
" |
|
195 |
self settingsIcon2 inspect |
|
196 |
ImageEditor openOnClass:self andSelector:#settingsIcon2 |
|
197 |
Icon flushCachedIcons |
|
198 |
" |
|
199 |
||
200 |
<resource: #image> |
|
5892 | 201 |
|
15919 | 202 |
^Icon |
203 |
constantNamed:'SettingsDialog settingsIcon2' |
|
204 |
ifAbsentPut:[(Depth8Image width:22 height:22) bits:(ByteArray fromPackedString:' |
|
205 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@BDW%58@@@@@@@@@@@@@@@@ |
|
206 |
@@@@@@BFJ!!,ZD0@@@@@@@@@@@@@@@@@@@@BHHEEXP!!X@@A48@@@@@@@@@@@@@@BGI%E/QR0U@D!!SA0@@@@@@@@@@@@BEHEE+P20^O%A0OW0@@@@@@@@@@@@@ |
|
207 |
GEE1P20!!NPAO\GT-L@T@@@@@@@@@@A=*QR0!!O6!!-R5(2UB,C@@@@@@@@@@A[JB0^JVNAS%X6D HJS@@@@@@@@@@@E0 XDAPDSU$1C3.L$0@@@@@@@@@@@@@@ |
|
208 |
W0A*RUX1DSU2@@@@@@@@@@@@@@@@@@A,R%07CCR"Y7(@@@@@@@@@@@@@@@A.Q5\.D#12YZ5&]@@@@@@@@@@@@@A2Q&@:BSNZ@G%$*&I7@@@@@@@@@@@@URTF |
|
209 |
B4@@@@@@\6F-H0@@@@@@@@@@@H8N@R>\@@@@@@A6H%H@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
210 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') colorMapFromArray:#[0 0 0 0 60 60 0 84 84 4 45 45 21 20 15 38 38 38 38 192 192 43 43 43 45 45 45 45 151 151 46 99 99 46 147 147 46 151 151 47 47 47 47 88 88 47 151 151 48 48 48 48 144 144 48 145 145 56 53 38 57 57 49 59 52 40 62 56 43 65 65 53 65 65 65 67 67 54 68 68 68 70 70 70 72 64 47 72 72 35 72 72 72 73 69 48 73 73 73 74 74 74 80 44 10 80 62 43 81 81 24 84 132 132 85 85 76 86 86 36 86 86 86 87 87 49 87 87 77 87 193 193 88 88 88 91 101 101 92 193 193 94 117 117 97 97 97 97 193 193 98 195 195 99 120 120 101 75 31 101 107 89 101 193 193 102 193 193 103 103 103 104 86 69 106 193 193 107 120 120 107 121 121 109 109 109 110 96 70 111 78 42 111 119 119 113 113 60 113 113 113 115 115 115 116 116 56 116 116 116 116 145 145 118 147 147 119 121 85 121 150 150 122 151 151 122 152 148 124 124 124 124 146 139 124 151 149 127 118 78 127 119 78 128 128 128 129 120 112 133 157 157 135 216 216 137 137 137 139 207 207 140 206 206 141 141 141 141 201 201 141 202 202 142 136 75 142 201 201 143 128 88 143 143 88 144 144 144 144 204 204 145 85 24 146 126 100 147 82 13 148 83 17 148 86 24 148 123 91 148 127 98 149 122 89 150 150 150 151 151 151 152 152 152 152 155 155 153 129 100 154 154 154 156 156 156 156 199 199 157 157 157 158 158 158 159 159 159 160 160 160 162 179 179 163 161 159 163 163 162 164 151 101 164 160 156 164 163 161 165 165 150 165 165 165 168 168 168 169 169 62 171 171 171 172 172 71 174 117 58 177 177 177 178 178 89 185 174 113 186 178 115 186 186 115 189 179 116 189 189 115 189 189 132 190 190 139 192 192 142 192 192 192 193 193 154 194 194 194 196 196 155 197 197 159 200 200 168 202 202 174 202 202 202 204 204 102 205 205 97 206 206 149 210 210 144 210 210 149 213 213 103 213 213 213 215 215 164 215 215 215 227 212 124 227 213 140 227 217 124 227 220 124 227 227 124 234 156 79 236 236 197 239 214 144 243 201 148 243 243 146 243 243 155 244 244 147 245 232 157 247 165 83 248 215 149 248 231 149 255 170 86] mask:((ImageMask width:22 height:22) bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@O@@@_@@@?L@A?\@C?<@C>?@C??@C??@C?>@@/8@@_<@@?>@A?_@A<O@A<G@@@@@@@@@@@@@@@@@'); yourself); yourself] |
|
211 |
! |
|
212 |
||
213 |
wheelIcon |
|
214 |
"This resource specification was automatically generated |
|
215 |
by the ImageEditor of ST/X." |
|
216 |
||
217 |
"Do not manually edit this!! If it is corrupted, |
|
218 |
the ImageEditor may not be able to read the specification." |
|
219 |
||
220 |
" |
|
221 |
self wheelIcon inspect |
|
222 |
ImageEditor openOnClass:self andSelector:#wheelIcon |
|
223 |
Icon flushCachedIcons |
|
224 |
" |
|
225 |
||
226 |
<resource: #image> |
|
227 |
||
228 |
^Icon |
|
229 |
constantNamed:'SettingsDialog wheelIcon' |
|
230 |
ifAbsentPut:[(Depth4Image width:24 height:24) bits:(ByteArray fromPackedString:' |
|
231 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@CT@@@@@@@@@@@@@@CT@@@@@@@@@@@T0@2H0@5@@@@@@@@D#L" |
|
232 |
H#L!!@@@@@@@@ARH"H"IP@@@@@@@@@2IQURH0@@@@@@@@L"TP@UH#@@@@@@@3H"DDPAH"L0@@@@@QH"TDPEH"DP@@@@@@URH0@2IU@@@@@@@@ARH#L"IP@@@@ |
|
233 |
@@@@@2H"H"H0@@@@@@@@L!!T"H%D#@@@@@@@@TP@2H0@U@@@@@@@@@@@BH@@@@@@@@@@@@@@BH@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
234 |
@@@@@@@@@@@@@@@@@@@@@@@@') colorMapFromArray:#[0 0 0 127 127 127 194 194 194 255 255 255 236 233 216 161 161 165] mask:((ImageMask width:24 height:24) bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@A @@C0@@33@A?? A?? @??@@??@C??0G??8G??8C??0@??@@??@A?? A?? @33@@C0@@A @@@@@@@@@@@@@'); yourself); yourself] |
|
4378 | 235 |
! ! |
236 |
||
16201 | 237 |
!SettingsDialog class methodsFor:'default settingslist'! |
5892 | 238 |
|
8621 | 239 |
defaultSettingsApplicationList |
16201 | 240 |
"unless the settingsDialog is opened with an explicit settings list, |
241 |
this one is used (it is also the one used by the ST/X IDE" |
|
242 |
||
15356 | 243 |
^ OrderedCollection new |
244 |
addAll:#( |
|
245 |
#('Language' #'AbstractSettingsApplication::LanguageSettingsAppl' ) |
|
246 |
#('Keyboard Mappings' #'AbstractSettingsApplication::KbdMappingSettingsAppl' ) |
|
247 |
#('ViewStyle' #'AbstractSettingsApplication::MiscDisplaySettingsAppl' ) |
|
248 |
#('ViewStyle/Style' #'AbstractSettingsApplication::StyleSettingsAppl' ) |
|
249 |
#('ViewStyle/Other' #'AbstractSettingsApplication::MiscDisplay2SettingsAppl' ) |
|
250 |
#('ViewStyle/Fonts' #'Tools::FontSettingsApplication' ) |
|
15919 | 251 |
#('System/System Messages' #'AbstractSettingsApplication::SystemMessageSettingsAppl' ) |
252 |
#('System/Memory' #'AbstractSettingsApplication::MemorySettingsAppl' ) |
|
253 |
#('System/Processor & Scheduler' #'AbstractSettingsApplication::ProcessorSchedulerSettingsAppl' ) |
|
16201 | 254 |
#('System/Autoloaded Packages' #'AbstractSettingsApplication::AutoloadedPackagesSettingsAppl' ) |
15356 | 255 |
#('Tools' #'AbstractSettingsApplication::ToolsSettingsAppl' ) |
256 |
#('Tools/Toolbox' #'AbstractSettingsApplication::ToolboxSettingsAppl' ) |
|
257 |
#('Tools/Editor' #'AbstractSettingsApplication::EditSettingsAppl' ) |
|
258 |
#('Tools/Editor/Code Editor 2' #'Tools::CodeView2SettingsAppl' ) |
|
259 |
#('Tools/Editor/Syntax Color' #'AbstractSettingsApplication::SyntaxColorSettingsAppl' ) |
|
260 |
#('Tools/Editor/Code Format' #'AbstractSettingsApplication::SourceCodeFormatSettingsAppl' ) |
|
261 |
#('Tools/System Browser' #'AbstractSettingsApplication::SystemBrowserSettingsAppl' ) |
|
262 |
#('Tools/System Browser/Code Generator' #'AbstractSettingsApplication::CodeGeneratorSettingsAppl' ) |
|
263 |
#('Tools/Changes' #'AbstractSettingsApplication::ChangeFileSettingsAppl' ) |
|
264 |
#('Tools/Debugger' #'AbstractSettingsApplication::DebuggerSettingsAppl' ) |
|
265 |
#('Tools/Terminal' #'AbstractSettingsApplication::TerminalViewSettingsAppl' ) |
|
266 |
#('Tools/Compiler' #'AbstractSettingsApplication::GeneralCompilerSettingsAppl' ) |
|
267 |
#('Tools/Compiler/ByteCode' #'AbstractSettingsApplication::ByteCodeCompilerSettingsAppl' ) |
|
268 |
#('Tools/Compiler/STC' #'AbstractSettingsApplication::STCCompilerSettingsAppl' ) |
|
269 |
#('Tools/Compiler/Build' #'AbstractSettingsApplication::BuildSettingsAppl' ) |
|
16165 | 270 |
#('Workspace' #'AbstractSettingsApplication::WorkspaceSettingsAppl' ) |
15356 | 271 |
#('Source Code Management' #'AbstractSettingsApplication::SourceCodeManagementSettingsAppl') |
272 |
); |
|
273 |
add: |
|
274 |
"/ see initializeSettingsList for how the following is expanded... |
|
275 |
{ 'Source Code Management/[% managerTypeName]' . |
|
276 |
[ AbstractSourceCodeManager availableManagers |
|
277 |
collect:[:each | each settingsApplicationClass] ] . |
|
278 |
'[% defaultIcon]' }; |
|
279 |
addAll: |
|
280 |
#( |
|
281 |
#('Printer' #'AbstractSettingsApplication::PrinterSettingsAppl' ) |
|
282 |
#('Display' #'AbstractSettingsApplication::DisplaySettingsAppl' ) |
|
283 |
#('Communication' nil #communicationIcon) |
|
9275
bff5fac9e455
changed: #defaultSettingsApplicationList
Claus Gittinger <cg@exept.de>
parents:
9186
diff
changeset
|
284 |
|
15356 | 285 |
#('Communication/Logging' #'AbstractSettingsApplication::CommunicationLoggingSettingsAppl') |
16165 | 286 |
#('Communication/RDoIt & Telnet' #'AbstractSettingsApplication::RDoItServerSettingsAppl' ) |
15356 | 287 |
#('Communication/Misc' #'AbstractSettingsApplication::MiscCommunicationSettingsAppl' ) |
16165 | 288 |
#('Communication/Misc/Bridges' #'AbstractSettingsApplication::MiscBridgeCommunicationSettingsAppl' ) |
289 |
#('Communication/Misc/Smalltalk' #'AbstractSettingsApplication::MiscSmalltalkCommunicationSettingsAppl' ) |
|
290 |
#('Communication/Misc/OSI Protocol' #'AbstractSettingsApplication::OsiSettingsAppl' ) |
|
15356 | 291 |
#('Communication/SQLServer' #'AbstractSettingsApplication::SQLServerSettingsAppl' ) |
292 |
#('Communication/HTTPServer' #'AbstractSettingsApplication::HTTPStartServerSettingsApplication' ) |
|
293 |
); |
|
294 |
yourself |
|
8621 | 295 |
|
296 |
"Modified: / 16-12-2002 / 18:12:28 / penk" |
|
10905
7ec7015ab744
changed: #defaultSettingsApplicationList
Claus Gittinger <cg@exept.de>
parents:
10824
diff
changeset
|
297 |
"Modified: / 25-11-2011 / 15:28:42 / cg" |
13796 | 298 |
"Modified: / 27-02-2013 / 12:08:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
16201 | 299 |
! ! |
300 |
||
301 |
!SettingsDialog class methodsFor:'defaults'! |
|
302 |
||
303 |
defaultIcon |
|
304 |
<resource: #programImage> |
|
305 |
||
306 |
^ ToolbarIconLibrary stxSettings24x24Icon |
|
8621 | 307 |
! |
308 |
||
4397 | 309 |
expandParents |
310 |
||
311 |
^ true |
|
5577 | 312 |
! |
313 |
||
314 |
resourcePackName |
|
7873 | 315 |
"return the name which is used as the fileNameBase of my resource file. |
316 |
Here, use the same resources as the Launcher" |
|
317 |
||
5577 | 318 |
^ AbstractLauncherApplication resourcePackName |
4397 | 319 |
! ! |
320 |
||
12029
fa8f6787ea95
category of: #flyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
11983
diff
changeset
|
321 |
!SettingsDialog class methodsFor:'help specs'! |
11982 | 322 |
|
323 |
flyByHelpSpec |
|
324 |
<resource: #help> |
|
325 |
||
326 |
^ super flyByHelpSpec addPairsFrom:#( |
|
327 |
||
328 |
#acceptChangedSettings |
|
13270 | 329 |
'Accept changed settings for the current ST/X session.\Notice, that these affect the current session only.\To make the current settings the default in the future, save them to the settings file (using the "Save" button).\Also notice, that some values affect new opened windows/tools only.' |
11982 | 330 |
|
331 |
#discardChangedSettings |
|
332 |
'Discard changes and revert to the current active settings values' |
|
333 |
||
334 |
#helpOnSettings |
|
335 |
'Show the online documentation on the shown values in an HTML viewer' |
|
336 |
||
11983 | 337 |
#loadSettingsFromFile |
13270 | 338 |
'Load the settings from a file.\At initial startup, the "settings.stx" file is read automatically.' |
11983 | 339 |
|
340 |
#saveSettingsToFile |
|
13270 | 341 |
'Save the current settings into a file.\The "settings.stx" file is automatically read upon every fresh start of ST/X.' |
11983 | 342 |
|
11982 | 343 |
) |
13270 | 344 |
|
345 |
"Modified: / 31-07-2013 / 09:52:36 / cg" |
|
11982 | 346 |
! ! |
347 |
||
4378 | 348 |
!SettingsDialog class methodsFor:'interface specs'! |
349 |
||
350 |
windowSpec |
|
351 |
"This resource specification was automatically generated |
|
352 |
by the UIPainter of ST/X." |
|
353 |
||
354 |
"Do not manually edit this!! If it is corrupted, |
|
355 |
the UIPainter may not be able to read the specification." |
|
356 |
||
357 |
" |
|
358 |
UIPainter new openOnClass:SettingsDialog andSelector:#windowSpec |
|
359 |
SettingsDialog new openInterface:#windowSpec |
|
360 |
SettingsDialog open |
|
361 |
" |
|
362 |
||
363 |
<resource: #canvas> |
|
364 |
||
365 |
^ |
|
14318 | 366 |
#(FullSpec |
367 |
name: windowSpec |
|
368 |
window: |
|
369 |
(WindowSpec |
|
370 |
label: 'Settings Dialog' |
|
371 |
name: 'Settings Dialog' |
|
372 |
min: (Point 10 10) |
|
373 |
bounds: (Rectangle 0 0 789 642) |
|
374 |
menu: mainMenu |
|
375 |
icon: defaultIcon |
|
376 |
) |
|
377 |
component: |
|
378 |
(SpecCollection |
|
379 |
collection: ( |
|
380 |
(VariableHorizontalPanelSpec |
|
381 |
name: 'VariableHorizontalPanel1' |
|
382 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
383 |
showHandle: true |
|
384 |
snapMode: both |
|
385 |
component: |
|
386 |
(SpecCollection |
|
387 |
collection: ( |
|
388 |
(ViewSpec |
|
389 |
name: 'Box1' |
|
390 |
component: |
|
391 |
(SpecCollection |
|
392 |
collection: ( |
|
393 |
(HierarchicalListViewSpec |
|
394 |
name: 'HierarchicalListView1' |
|
395 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -34 1) |
|
396 |
model: selectedItem |
|
397 |
hasHorizontalScrollBar: true |
|
398 |
hasVerticalScrollBar: true |
|
399 |
listModel: applicationList |
|
400 |
useIndex: false |
|
401 |
highlightMode: label |
|
402 |
showLeftIndicators: false |
|
403 |
indicatorSelector: doIndicatorClick: |
|
404 |
) |
|
405 |
(HorizontalPanelViewSpec |
|
406 |
name: 'HorizontalPanel2' |
|
407 |
layout: (LayoutFrame 0 0.0 -34 1 0 1.0 0 1) |
|
408 |
visibilityChannel: loadAndSaveSettingsItemVisible |
|
409 |
horizontalLayout: fitSpace |
|
410 |
verticalLayout: center |
|
411 |
horizontalSpace: 3 |
|
412 |
verticalSpace: 3 |
|
413 |
component: |
|
414 |
(SpecCollection |
|
415 |
collection: ( |
|
416 |
(ActionButtonSpec |
|
417 |
label: 'Save' |
|
418 |
name: 'Button3' |
|
419 |
activeHelpKey: saveSettingsToFile |
|
420 |
translateLabel: true |
|
421 |
tabable: true |
|
422 |
model: saveSettingsWithoutAskingForFile |
|
423 |
extent: (Point 126 22) |
|
4378 | 424 |
) |
14318 | 425 |
(ActionButtonSpec |
426 |
label: 'Load From...' |
|
427 |
name: 'Button2' |
|
428 |
activeHelpKey: loadSettingsFromFile |
|
429 |
translateLabel: true |
|
430 |
tabable: true |
|
431 |
model: loadSettingsFromFile |
|
432 |
extent: (Point 126 22) |
|
433 |
) |
|
434 |
) |
|
435 |
||
436 |
) |
|
4378 | 437 |
) |
14318 | 438 |
) |
439 |
||
440 |
) |
|
441 |
) |
|
442 |
(ViewSpec |
|
443 |
name: 'Box2' |
|
444 |
component: |
|
445 |
(SpecCollection |
|
446 |
collection: ( |
|
447 |
(ViewSpec |
|
448 |
name: 'DisabledSettingsBox' |
|
449 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
450 |
initiallyInvisible: true |
|
451 |
component: |
|
452 |
(SpecCollection |
|
453 |
collection: ( |
|
454 |
(LabelSpec |
|
455 |
label: 'whyDisabledLabel' |
|
456 |
name: 'whyDisabledLabel' |
|
457 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
458 |
translateLabel: true |
|
459 |
labelChannel: whyDisabledInfoHolder |
|
7609 | 460 |
) |
14318 | 461 |
) |
462 |
||
463 |
) |
|
464 |
) |
|
465 |
(SubCanvasSpec |
|
466 |
name: 'SubCanvas' |
|
467 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -34 1) |
|
468 |
level: -1 |
|
469 |
hasHorizontalScrollBar: true |
|
470 |
hasVerticalScrollBar: true |
|
471 |
miniScrollerHorizontal: false |
|
472 |
miniScrollerVertical: false |
|
473 |
clientHolder: subCanvasApplicationHolder |
|
474 |
createNewBuilder: false |
|
475 |
postBuildCallback: postBuildSubCanvas: |
|
476 |
) |
|
477 |
(HorizontalPanelViewSpec |
|
478 |
name: 'HorizontalPanel1' |
|
479 |
layout: (LayoutFrame 0 0.0 -34 1 -16 1.0 0 1) |
|
480 |
horizontalLayout: fitSpace |
|
481 |
verticalLayout: center |
|
482 |
horizontalSpace: 3 |
|
483 |
verticalSpace: 3 |
|
15348 | 484 |
reverseOrderIfOKAtLeft: true |
14318 | 485 |
component: |
486 |
(SpecCollection |
|
487 |
collection: ( |
|
488 |
(ActionButtonSpec |
|
15348 | 489 |
label: 'Help' |
490 |
name: 'Help' |
|
491 |
activeHelpKey: helpOnSettings |
|
14318 | 492 |
translateLabel: true |
493 |
tabable: true |
|
15348 | 494 |
model: help |
495 |
enableChannel: enableHelp |
|
14318 | 496 |
extent: (Point 163 22) |
4378 | 497 |
) |
14318 | 498 |
(ActionButtonSpec |
499 |
label: 'Discard' |
|
500 |
name: 'Reload' |
|
501 |
activeHelpKey: discardChangedSettings |
|
502 |
translateLabel: true |
|
503 |
tabable: true |
|
504 |
model: doReload |
|
505 |
enableChannel: enableReload |
|
506 |
extent: (Point 163 22) |
|
507 |
) |
|
508 |
(ActionButtonSpec |
|
15348 | 509 |
label: 'Apply' |
510 |
name: 'Apply' |
|
511 |
activeHelpKey: acceptChangedSettings |
|
14318 | 512 |
translateLabel: true |
513 |
tabable: true |
|
15348 | 514 |
model: doSave |
515 |
enableChannel: enableOK |
|
14318 | 516 |
extent: (Point 164 22) |
517 |
) |
|
518 |
) |
|
519 |
||
520 |
) |
|
521 |
keepSpaceForOSXResizeHandleH: true |
|
4378 | 522 |
) |
14318 | 523 |
) |
524 |
||
525 |
) |
|
4378 | 526 |
) |
14318 | 527 |
) |
528 |
||
529 |
) |
|
15348 | 530 |
handles: (Any 0.33750000000000002 1.0) |
4378 | 531 |
) |
14318 | 532 |
) |
533 |
||
534 |
) |
|
535 |
) |
|
4378 | 536 |
! ! |
537 |
||
4548 | 538 |
!SettingsDialog class methodsFor:'menu actions'! |
539 |
||
5465 | 540 |
askForFileAndSaveSettings |
4552
a8df4916183a
saveSettings moved to UserPreferences
Claus Gittinger <cg@exept.de>
parents:
4548
diff
changeset
|
541 |
|fileName resources| |
4548 | 542 |
|
4552
a8df4916183a
saveSettings moved to UserPreferences
Claus Gittinger <cg@exept.de>
parents:
4548
diff
changeset
|
543 |
resources := self classResources. |
4548 | 544 |
|
4552
a8df4916183a
saveSettings moved to UserPreferences
Claus Gittinger <cg@exept.de>
parents:
4548
diff
changeset
|
545 |
fileName := Dialog |
9608 | 546 |
requestFileNameForSave:(resources string:'Save Settings in File') |
4552
a8df4916183a
saveSettings moved to UserPreferences
Claus Gittinger <cg@exept.de>
parents:
4548
diff
changeset
|
547 |
default:'settings.stx' |
a8df4916183a
saveSettings moved to UserPreferences
Claus Gittinger <cg@exept.de>
parents:
4548
diff
changeset
|
548 |
ok:(resources string:'Save') |
a8df4916183a
saveSettings moved to UserPreferences
Claus Gittinger <cg@exept.de>
parents:
4548
diff
changeset
|
549 |
abort:(resources string:'Cancel') |
a8df4916183a
saveSettings moved to UserPreferences
Claus Gittinger <cg@exept.de>
parents:
4548
diff
changeset
|
550 |
pattern:'*.stx' |
a8df4916183a
saveSettings moved to UserPreferences
Claus Gittinger <cg@exept.de>
parents:
4548
diff
changeset
|
551 |
fromDirectory:'.'. |
4548 | 552 |
|
4552
a8df4916183a
saveSettings moved to UserPreferences
Claus Gittinger <cg@exept.de>
parents:
4548
diff
changeset
|
553 |
fileName size ~~ 0 ifTrue:[ |
a8df4916183a
saveSettings moved to UserPreferences
Claus Gittinger <cg@exept.de>
parents:
4548
diff
changeset
|
554 |
"not canceled" |
4826 | 555 |
self saveSettingsTo:fileName. |
4552
a8df4916183a
saveSettings moved to UserPreferences
Claus Gittinger <cg@exept.de>
parents:
4548
diff
changeset
|
556 |
] |
9608 | 557 |
|
558 |
"Modified: / 27-10-2010 / 11:24:54 / cg" |
|
4826 | 559 |
! |
560 |
||
15487 | 561 |
currentSettingsFilename |
8119 | 562 |
| file | |
563 |
||
13796 | 564 |
"JV@2012-02-07: Changed to save preferences back to file from which |
565 |
they have been loaded (if known). If no such file is known, |
|
566 |
save to DEFAULT USER SETTINGS file (default ~/.smalltalk/settings.rc)" |
|
567 |
||
568 |
file := UserPreferences current at: #settingsFilename ifAbsent:[nil]. |
|
569 |
file isNil ifTrue:[ |
|
570 |
file := UserPreferences defaultUserSettingsFile. |
|
571 |
]. |
|
15487 | 572 |
^ file. |
573 |
! |
|
574 |
||
575 |
saveSettingsAsDefaultSettings |
|
576 |
self saveSettingsTo:(self currentSettingsFilename). |
|
13796 | 577 |
|
578 |
"Modified: / 07-02-2012 / 00:45:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
8119 | 579 |
! |
580 |
||
4826 | 581 |
saveSettingsTo:file |
582 |
[ |
|
583 |
UserPreferences current saveIn:file. |
|
584 |
] on:StreamError do:[:ex| |
|
8119 | 585 |
self warn:(self resources |
586 |
stringWithCRs:'Cannot save settings into: %1\(%2)' |
|
11739 | 587 |
with:(file asAbsoluteFilename asString) |
8119 | 588 |
with:ex description). |
4826 | 589 |
] |
590 |
! |
|
591 |
||
5465 | 592 |
saveSettingsWithoutAskingForFile |
8119 | 593 |
self saveSettingsAsDefaultSettings. |
4548 | 594 |
! ! |
595 |
||
4378 | 596 |
!SettingsDialog class methodsFor:'menu specs'! |
597 |
||
598 |
mainMenu |
|
599 |
"This resource specification was automatically generated |
|
600 |
by the MenuEditor of ST/X." |
|
601 |
||
602 |
"Do not manually edit this!! If it is corrupted, |
|
603 |
the MenuEditor may not be able to read the specification." |
|
604 |
||
14792 | 605 |
|
4378 | 606 |
" |
607 |
MenuEditor new openOnClass:SettingsDialog andSelector:#mainMenu |
|
608 |
(Menu new fromLiteralArrayEncoding:(SettingsDialog mainMenu)) startUp |
|
609 |
" |
|
610 |
||
611 |
<resource: #menu> |
|
612 |
||
613 |
^ |
|
5624 | 614 |
#(Menu |
615 |
( |
|
616 |
(MenuItem |
|
7972 | 617 |
label: '&File' |
5624 | 618 |
submenu: |
619 |
(Menu |
|
620 |
( |
|
621 |
(MenuItem |
|
7972 | 622 |
label: '&Load From...' |
5624 | 623 |
itemValue: loadSettingsFromFile |
9021
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
624 |
isVisible: loadAndSaveSettingsItemVisible |
5624 | 625 |
) |
626 |
(MenuItem |
|
627 |
label: '-' |
|
9021
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
628 |
isVisible: loadAndSaveSettingsItemVisible |
4378 | 629 |
) |
5624 | 630 |
(MenuItem |
631 |
label: 'Save' |
|
632 |
itemValue: saveSettingsWithoutAskingForFile |
|
9021
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
633 |
isVisible: loadAndSaveSettingsItemVisible |
4378 | 634 |
) |
5624 | 635 |
(MenuItem |
7972 | 636 |
label: '&Save As...' |
7473 | 637 |
itemValue: askForFileAndSaveSettings |
9021
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
638 |
isVisible: loadAndSaveSettingsItemVisible |
4740 | 639 |
) |
5624 | 640 |
(MenuItem |
641 |
label: '-' |
|
9021
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
642 |
isVisible: loadAndSaveSettingsItemVisible |
5624 | 643 |
) |
644 |
(MenuItem |
|
7972 | 645 |
label: 'E&xit' |
5624 | 646 |
itemValue: closeRequest |
14792 | 647 |
) |
648 |
) |
|
649 |
nil |
|
650 |
nil |
|
651 |
) |
|
652 |
) |
|
653 |
(MenuItem |
|
654 |
label: 'View' |
|
655 |
submenu: |
|
656 |
(Menu |
|
657 |
( |
|
658 |
(MenuItem |
|
659 |
label: 'Expand All' |
|
660 |
itemValue: menuExpandAll |
|
661 |
) |
|
662 |
(MenuItem |
|
663 |
label: 'Collapse All' |
|
664 |
itemValue: menuCollapseAll |
|
4378 | 665 |
) |
666 |
) |
|
667 |
nil |
|
668 |
nil |
|
669 |
) |
|
670 |
) |
|
671 |
) |
|
672 |
nil |
|
673 |
nil |
|
674 |
) |
|
675 |
! ! |
|
676 |
||
14555 | 677 |
!SettingsDialog class methodsFor:'startup'! |
678 |
||
679 |
openWithList:settingsList label:label |
|
680 |
^ self |
|
681 |
openWithList:settingsList |
|
682 |
label:label |
|
683 |
initialSettingsClass:nil |
|
684 |
! |
|
685 |
||
686 |
openWithList:settingsList label:label initialSettingsClass:settingsClassToSelectOrNil |
|
687 |
"given a list of page-label/class pairs, |
|
688 |
open a settings dialog showing that set of items." |
|
689 |
||
690 |
|settingsApp| |
|
691 |
||
692 |
settingsApp := SettingsDialog new. |
|
693 |
settingsApp installSettingsEntries:settingsList. |
|
694 |
settingsApp allButOpen. |
|
695 |
settingsApp showRoot: false. |
|
696 |
settingsApp window label:label. |
|
697 |
settingsClassToSelectOrNil notNil ifTrue:[ |
|
698 |
settingsApp selectItemWithClass: settingsClassToSelectOrNil. |
|
699 |
]. |
|
700 |
settingsApp openWindow. |
|
701 |
^ settingsApp |
|
702 |
! ! |
|
703 |
||
4378 | 704 |
!SettingsDialog methodsFor:'accessing'! |
705 |
||
706 |
requestor |
|
707 |
"return the 'requestor' of the SettingsDialog" |
|
708 |
||
709 |
^ requestor |
|
710 |
! |
|
711 |
||
712 |
requestor:something |
|
713 |
requestor := something. |
|
6124
233e703f84a4
access to rootItem & showRoot
Claus Gittinger <cg@exept.de>
parents:
6024
diff
changeset
|
714 |
! |
233e703f84a4
access to rootItem & showRoot
Claus Gittinger <cg@exept.de>
parents:
6024
diff
changeset
|
715 |
|
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
716 |
rootItem |
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
717 |
^ self applicationList root. |
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
718 |
|
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
719 |
"Created: / 03-11-2007 / 14:23:01 / cg" |
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
720 |
! |
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
721 |
|
6126 | 722 |
rootItemLabel |
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
723 |
^ self rootItem label. |
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
724 |
|
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
725 |
"Modified: / 03-11-2007 / 14:23:18 / cg" |
6126 | 726 |
! |
727 |
||
6124
233e703f84a4
access to rootItem & showRoot
Claus Gittinger <cg@exept.de>
parents:
6024
diff
changeset
|
728 |
rootItemLabel:aString |
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
729 |
self rootItem label:aString. |
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
730 |
|
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
731 |
"Modified: / 03-11-2007 / 14:23:16 / cg" |
6124
233e703f84a4
access to rootItem & showRoot
Claus Gittinger <cg@exept.de>
parents:
6024
diff
changeset
|
732 |
! |
233e703f84a4
access to rootItem & showRoot
Claus Gittinger <cg@exept.de>
parents:
6024
diff
changeset
|
733 |
|
13086 | 734 |
selectedItemsName |
735 |
|sel| |
|
736 |
||
737 |
(sel := self selectedItem value) notNil ifTrue:[ |
|
738 |
^ sel value nameString |
|
739 |
]. |
|
740 |
^ nil. |
|
741 |
! |
|
742 |
||
6124
233e703f84a4
access to rootItem & showRoot
Claus Gittinger <cg@exept.de>
parents:
6024
diff
changeset
|
743 |
showRoot:aBoolean |
10824 | 744 |
|
745 |
self applicationList showRoot:aBoolean. |
|
746 |
aBoolean ifFalse:[ |
|
747 |
self applicationList root children do:[:e|e expand]. |
|
748 |
] |
|
749 |
||
750 |
"Modified: / 15-10-2011 / 12:06:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14306 | 751 |
! |
752 |
||
753 |
subCanvasApplication |
|
754 |
^ self subCanvasApplicationHolder value |
|
4378 | 755 |
! ! |
756 |
||
757 |
!SettingsDialog methodsFor:'actions'! |
|
758 |
||
5026 | 759 |
changeLabelTo:aLabel application:aApplication |
760 |
| item | |
|
761 |
||
762 |
item := self getItemByApplication:aApplication. |
|
5043 | 763 |
item notNil ifTrue:[ |
764 |
item label:aLabel. |
|
765 |
item changed. |
|
766 |
]. |
|
5026 | 767 |
! |
768 |
||
4378 | 769 |
destroyAll |
15487 | 770 |
self realApplicationsDo:[:app | app close ]. |
4378 | 771 |
! |
772 |
||
773 |
doIndicatorClick:index |
|
6127 | 774 |
"handle a click on the indicator" |
4378 | 775 |
|
776 |
(self applicationList at:index) toggleExpand |
|
777 |
! |
|
778 |
||
779 |
doReload |
|
4574 | 780 |
|item| |
4378 | 781 |
|
782 |
item := self selectedItem value. |
|
4574 | 783 |
(item isNil or:[item isCategory or:[item application isNil]]) ifTrue:[ |
784 |
^ self |
|
785 |
]. |
|
786 |
item application readSettings |
|
4378 | 787 |
! |
788 |
||
789 |
doSave |
|
790 |
| item | |
|
791 |
||
792 |
item := self selectedItem value. |
|
793 |
(item isNil or:[item isCategory or:[item application isNil]]) ifTrue:[ ^ self]. |
|
4388 | 794 |
self withWaitCursorDo:[ |
4574 | 795 |
item application saveSettingsIfUnsavedChangesArePresent. |
4388 | 796 |
]. |
4378 | 797 |
! |
798 |
||
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
799 |
expandItemForApplication:aApplication |
6127 | 800 |
| item | |
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
801 |
|
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
802 |
item := self applicationList detect:[:item | item application = aApplication] ifNone:[nil]. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
803 |
item notNil ifTrue:[ |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
804 |
item expand |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
805 |
]. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
806 |
! |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
807 |
|
4378 | 808 |
help |
8034 | 809 |
|item | |
4378 | 810 |
|
811 |
item := self selectedItem value. |
|
812 |
(item isNil or:[item isCategory or:[item application isNil]]) ifTrue:[ ^ self]. |
|
813 |
item application help. |
|
814 |
! |
|
815 |
||
15487 | 816 |
reopenLauncher |
817 |
"force the launcher to reopen an instance of itself. |
|
818 |
Done whenever relevant look&feel settings are changed |
|
819 |
(actually a workaround - a much better solution would be to teach |
|
820 |
all smalltalk applications/views to dynamically update their style)." |
|
821 |
||
14968 | 822 |
|app| |
823 |
||
824 |
(app := self requestor) notNil ifTrue:[ |
|
825 |
app reopenLauncher. |
|
4740 | 826 |
] ifFalse:[ |
827 |
NewLauncher current reopenLauncher. |
|
828 |
]. |
|
829 |
! |
|
830 |
||
4378 | 831 |
sendLoadRequestToAll |
15487 | 832 |
"ask all subApps to reload their idea of the current settings. |
833 |
Do this, after userPrefs have been loaded from a file, |
|
834 |
while a settingsDialog is open" |
|
835 |
||
836 |
self realApplicationsDo:[:app | |
|
837 |
app readSettings. |
|
838 |
app clearDidModifySettings. |
|
4378 | 839 |
]. |
9558 | 840 |
|
841 |
"Modified: / 24-08-2010 / 18:41:36 / sr" |
|
4378 | 842 |
! |
843 |
||
844 |
sendSaveRequestToAll |
|
15487 | 845 |
"give all subapps a chance to apply any changes. |
846 |
No longer needed, as we do this at the time the subApp |
|
847 |
is changed; so only the current app needs this chance again, |
|
848 |
when about to close (seesendSaveRequestToCurrent) " |
|
849 |
||
850 |
self realApplicationsDo:[ :app | |
|
851 |
app saveRequest ifFalse:[ |
|
852 |
^ false |
|
4378 | 853 |
]. |
854 |
]. |
|
855 |
^ true |
|
4659 | 856 |
! |
857 |
||
858 |
sendSaveRequestToCurrent |
|
15487 | 859 |
"when about to close the dialog, give the current |
860 |
subapp a chance to apply any changes" |
|
861 |
||
862 |
| item currentApp | |
|
4659 | 863 |
|
864 |
item := self selectedItem value. |
|
15487 | 865 |
(item isNil |
866 |
or:[item isCategory |
|
867 |
or:[(currentApp := item application) isNil]] |
|
868 |
) ifTrue:[ ^ true]. |
|
869 |
||
4659 | 870 |
self withWaitCursorDo:[ |
15487 | 871 |
^ currentApp saveRequest. |
4659 | 872 |
]. |
873 |
^ true |
|
4378 | 874 |
! ! |
875 |
||
876 |
!SettingsDialog methodsFor:'application list access'! |
|
877 |
||
15356 | 878 |
addApplClass:aClassName forApplication:anApplication label:aLabel expand:aBoolean |
6127 | 879 |
"add an application to the settingsTree, take the icon from the application classes defaultIcon method" |
880 |
||
4898 | 881 |
| class | |
882 |
||
15356 | 883 |
class := Smalltalk classNamed:aClassName. |
4898 | 884 |
class isNil ifTrue:[ |
15356 | 885 |
('SettingsDialog [warning]: can''t find ', aClassName asString, ' to register') infoPrintCR. |
886 |
aClassName isString ifFalse:[ |
|
887 |
thisContext fullPrintAll. |
|
888 |
]. |
|
4898 | 889 |
^ nil |
890 |
]. |
|
891 |
class autoload. |
|
15356 | 892 |
^ self createItemForApplication:anApplication class:aClassName label:aLabel icon:class defaultIcon expandParent:aBoolean replaceExisting:false |
9781 | 893 |
|
894 |
"Modified: / 14-02-2011 / 20:10:11 / cg" |
|
4898 | 895 |
! |
896 |
||
4378 | 897 |
addApplClass:aClass withName:aName |
6127 | 898 |
"add an application to the settingsTree, take the icon from the application classes defaultIcon method" |
4378 | 899 |
|
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
900 |
^ self addApplClass:aClass withName:aName icon:nil. |
4378 | 901 |
! |
902 |
||
4873 | 903 |
addApplClass:aClass withName:aName expand:aBoolean |
6127 | 904 |
"add an application to the settingsTree, take the icon from the application classes defaultIcon method" |
4873 | 905 |
|
906 |
^ self addApplClass:aClass withName:aName icon:nil expand:aBoolean. |
|
907 |
! |
|
908 |
||
4378 | 909 |
addApplClass:aClass withName:aName icon:icon |
4873 | 910 |
^ self addApplClass:aClass withName:aName icon:icon expand:false |
911 |
! |
|
912 |
||
15356 | 913 |
addApplClass:aClassName withName:aName icon:icon expand:doExpand |
4378 | 914 |
|applicationLabel locIcon locClass| |
915 |
||
4879 | 916 |
"/ (self applicationNames includes:aName) ifTrue:[ |
917 |
"/ ^ self getItemForName:aName. |
|
918 |
"/ ]. |
|
4893 | 919 |
|
15356 | 920 |
aClassName isNil ifTrue:[ |
4893 | 921 |
self addIcon:icon forCategory:aName. |
922 |
^ self |
|
923 |
]. |
|
4378 | 924 |
self addCategoriesFor:aName. |
4893 | 925 |
|
4378 | 926 |
locIcon := icon. |
15356 | 927 |
locClass := Smalltalk classNamed:aClassName. |
4469 | 928 |
locClass isNil ifTrue:[ |
15356 | 929 |
('SettingsDialog [warning]: can''t find ', aClassName asString, ' to register') infoPrintCR. |
930 |
aClassName isString ifFalse:[ |
|
931 |
thisContext fullPrintAll. |
|
932 |
]. |
|
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
933 |
^ nil |
4469 | 934 |
]. |
4838
60dfab83c50b
autoload is understood by all classes (dummy if already loaded)
Claus Gittinger <cg@exept.de>
parents:
4826
diff
changeset
|
935 |
locClass autoload. |
60dfab83c50b
autoload is understood by all classes (dummy if already loaded)
Claus Gittinger <cg@exept.de>
parents:
4826
diff
changeset
|
936 |
|
4378 | 937 |
(locIcon isNil and:[locClass respondsTo:#defaultIcon]) ifTrue:[ locIcon := locClass defaultIcon]. |
938 |
applicationLabel := (aName asCollectionOfSubstringsSeparatedBy:$/) last. |
|
5577 | 939 |
|
6325 | 940 |
^ self |
941 |
createItemName:aName |
|
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
942 |
label:applicationLabel |
6325 | 943 |
class:locClass |
944 |
icon:locIcon |
|
945 |
expandParent:doExpand |
|
946 |
replaceExisting:false |
|
9781 | 947 |
|
948 |
"Modified: / 14-02-2011 / 20:10:04 / cg" |
|
4378 | 949 |
! |
950 |
||
951 |
addIcon:aIcon forCategory:aCategoryName |
|
6127 | 952 |
"add a new category Icon for a category" |
4378 | 953 |
|
4401 | 954 |
|existingItem| |
955 |
||
956 |
self categoryIcons at:aCategoryName put:aIcon. |
|
957 |
existingItem := self getItemForName:aCategoryName. |
|
958 |
existingItem notNil ifTrue:[ |
|
959 |
existingItem icon:aIcon |
|
960 |
]. |
|
4378 | 961 |
! |
962 |
||
963 |
applicationNames |
|
964 |
^ self applicationList collect:[:item | item nameString]. |
|
965 |
! |
|
966 |
||
967 |
categoryIcons |
|
968 |
categoryIcons isNil ifTrue:[ |
|
969 |
categoryIcons := Dictionary new. |
|
970 |
]. |
|
971 |
^ categoryIcons |
|
972 |
! |
|
973 |
||
4873 | 974 |
childrenApplicationItemFor:aApplication fromItem:anItem |
975 |
anItem application = aApplication ifTrue:[ |
|
976 |
^ anItem |
|
977 |
]. |
|
978 |
anItem hasChildren ifTrue:[ |
|
979 |
anItem children do:[:aChildItem | |
|
980 |
^ self childrenApplicationItemFor:aApplication fromItem:aChildItem. |
|
981 |
]. |
|
982 |
]. |
|
983 |
^ nil |
|
984 |
! |
|
985 |
||
986 |
getAllChildrenAppsForApplication:aApplication |
|
5026 | 987 |
^ self getAllChildrenAppsForApplication:aApplication matchBlock:nil |
4873 | 988 |
! |
989 |
||
6127 | 990 |
getAllChildrenAppsForApplication:aApplication childrenClass:aClass |
991 |
|matchBlock| |
|
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
992 |
|
6127 | 993 |
matchBlock := [:aSubApplication | aSubApplication class == aClass ]. |
5026 | 994 |
^ self getAllChildrenAppsForApplication:aApplication matchBlock:matchBlock |
995 |
! |
|
996 |
||
997 |
getAllChildrenAppsForApplication:aApplication matchBlock:aMatchBlock |
|
6127 | 998 |
| children | |
5026 | 999 |
|
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1000 |
children := self getAllChildrenByApplication:aApplication. |
5026 | 1001 |
aMatchBlock notNil ifTrue:[ |
1002 |
children := children select:[:aChild | aMatchBlock value:(aChild application)] |
|
4716 | 1003 |
]. |
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1004 |
^ children collect:[:item | item application]. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1005 |
! |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1006 |
|
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1007 |
getAllChildrenByApplication:aApplication |
6127 | 1008 |
| item | |
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1009 |
|
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1010 |
item := self getItemByApplication:aApplication. |
4716 | 1011 |
item isNil ifTrue:[ ^ #()]. |
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1012 |
^ item children. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1013 |
! |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1014 |
|
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1015 |
getApplicationsByClass:aClass |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1016 |
| classEntries| |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1017 |
|
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1018 |
self applicationList isNil ifTrue:[ |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1019 |
self initialize. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1020 |
]. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1021 |
classEntries := self applicationList select:[:aEntry | aEntry application class == aClass]. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1022 |
^ classEntries collect:[:aItem | aItem application]. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1023 |
! |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1024 |
|
4898 | 1025 |
getItemByApplication:anApplication |
4873 | 1026 |
|item| |
1027 |
||
1028 |
self applicationList do:[:anItem | |
|
4898 | 1029 |
item := self childrenApplicationItemFor:anApplication fromItem:anItem. |
4873 | 1030 |
item notNil ifTrue:[ ^ item ]. |
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1031 |
]. |
5043 | 1032 |
^ nil |
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1033 |
! |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1034 |
|
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1035 |
getNameOfApplication:aApplication |
4873 | 1036 |
|item| |
1037 |
||
1038 |
self applicationList do:[:anItem | |
|
1039 |
item := self childrenApplicationItemFor:aApplication fromItem:anItem. |
|
1040 |
item notNil ifTrue:[ ^ item nameString]. |
|
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1041 |
]. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1042 |
^ '' |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1043 |
! |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1044 |
|
4893 | 1045 |
installSettingsEntries:aCollection |
1046 |
aCollection do:[ :entry| |
|
1047 |
self installSettingsEntry:entry. |
|
1048 |
]. |
|
1049 |
! |
|
1050 |
||
10824 | 1051 |
installSettingsEntries: entries expand: expand |
1052 |
||
1053 |
"Installs given settings list. If expand is true, |
|
1054 |
dynamic settings list is expanded" |
|
1055 |
||
1056 |
entries do:[ :entry| |
|
1057 |
self installSettingsEntry:entry expand: expand |
|
1058 |
]. |
|
1059 |
||
1060 |
"Created: / 15-10-2011 / 11:45:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1061 |
! |
|
1062 |
||
4893 | 1063 |
installSettingsEntry:entry |
4895 | 1064 |
|applName applClassOrNil iconHolderOrNil| |
4893 | 1065 |
|
1066 |
applName := entry at:1. |
|
1067 |
applClassOrNil := entry at:2. |
|
4895 | 1068 |
iconHolderOrNil := entry at:3 ifAbsent:nil. |
1069 |
self addApplClass:applClassOrNil withName:applName icon:iconHolderOrNil value |
|
4893 | 1070 |
! |
1071 |
||
10824 | 1072 |
installSettingsEntry:entry expand: expand |
1073 |
||
1074 |
| applName applClassOrNil iconHolderOrNil cookedList className code classList name nameCode nameBlock nameList| |
|
1075 |
||
1076 |
expand ifFalse:[ |
|
1077 |
applName := entry at:1. |
|
1078 |
applClassOrNil := entry at:2. |
|
1079 |
iconHolderOrNil := entry at:3 ifAbsent:nil. |
|
1080 |
self addApplClass:applClassOrNil withName:applName icon:iconHolderOrNil value. |
|
1081 |
^self |
|
1082 |
]. |
|
1083 |
||
1084 |
cookedList := OrderedCollection new. |
|
1085 |
||
1086 |
className := entry at:2 ifAbsent:nil. |
|
1087 |
(className notNil and:[className startsWith:'[']) ifTrue:[ |
|
1088 |
code := className copyFrom:2 to:(className size - 1). |
|
1089 |
classList := (Parser evaluate:code) select:[:clsOrNil | clsOrNil notNil]. |
|
1090 |
name := entry at:1. |
|
1091 |
self assert:(name includesString:'['). |
|
1092 |
||
1093 |
nameCode := name copyFrom:(name indexOf:$[)+1 to:(name indexOf:$])-1. |
|
1094 |
nameCode := '^ [:each | ' , (nameCode copyReplaceString:'%' withString:'each') ,']'. |
|
1095 |
nameBlock := Parser evaluate:nameCode. |
|
1096 |
||
1097 |
nameList := classList collect:nameBlock. |
|
1098 |
nameList sortWith:classList. |
|
1099 |
nameList with:classList do:[:eachName :eachClass | |
|
1100 |
|newEntry| |
|
1101 |
||
1102 |
newEntry := entry copy. |
|
1103 |
newEntry at:1 put:(name copyTo:(name indexOf:$[)-1),eachName. |
|
1104 |
newEntry at:2 put:eachClass name. |
|
1105 |
cookedList add:newEntry. |
|
1106 |
]. |
|
1107 |
] ifFalse:[ |
|
1108 |
(className isNil "a directory entry" |
|
1109 |
or:[ (Smalltalk at:className) notNil "a valid entry"]) ifTrue:[ |
|
1110 |
cookedList add:entry. |
|
1111 |
]. |
|
1112 |
]. |
|
1113 |
||
1114 |
cookedList do:[:eachEntry | |
|
1115 |
|iconCodeOrSelector iconCode iconBlock newEntry| |
|
1116 |
||
1117 |
iconCodeOrSelector := eachEntry at:3 ifAbsent:nil. |
|
1118 |
iconCodeOrSelector isNil ifTrue:[ |
|
1119 |
newEntry := eachEntry |
|
1120 |
] ifFalse:[ |
|
1121 |
newEntry := eachEntry copy. |
|
1122 |
(iconCodeOrSelector startsWith:'[') ifTrue:[ |
|
1123 |
iconCode := iconCodeOrSelector copyFrom:(iconCodeOrSelector indexOf:$[)+1 to:(iconCodeOrSelector indexOf:$])-1. |
|
1124 |
iconCode := '^ [:each | ' , (iconCode copyReplaceString:'%' withString:'each') ,']'. |
|
1125 |
iconBlock := Parser evaluate:iconCode. |
|
1126 |
newEntry at:3 put:(iconBlock value:(Smalltalk classNamed:(eachEntry at:2))). |
|
1127 |
] ifFalse:[ |
|
1128 |
newEntry at:3 put:(self perform:iconCodeOrSelector). |
|
1129 |
]. |
|
1130 |
]. |
|
1131 |
self installSettingsEntry:newEntry expand: false. |
|
1132 |
]. |
|
1133 |
||
1134 |
" |
|
1135 |
self withAllSubclassesDo:[:cls | cls initializeSettingsList ] |
|
1136 |
" |
|
1137 |
||
1138 |
"Modified: / 16-12-2002 / 18:12:50 / penk" |
|
1139 |
"Modified: / 20-04-2011 / 17:03:33 / cg" |
|
1140 |
"Created: / 15-10-2011 / 11:49:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1141 |
! |
|
1142 |
||
5345 | 1143 |
parentApplicationFor:aApplication |
1144 |
|item parent| |
|
1145 |
||
1146 |
item := (self getItemByApplication:aApplication). |
|
1147 |
parent := item parent. |
|
1148 |
parent notNil ifTrue:[ |
|
1149 |
^ parent application. |
|
1150 |
]. |
|
1151 |
^ nil |
|
1152 |
! |
|
1153 |
||
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1154 |
remApplClassByName:aName |
6127 | 1155 |
"remove an application from the settingsTree" |
4378 | 1156 |
|
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1157 |
|item| |
4378 | 1158 |
|
1159 |
item := self getItemForName:aName. |
|
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1160 |
self removeItem:item |
4378 | 1161 |
! |
1162 |
||
4893 | 1163 |
removeAllApplicationsByClass:aClass |
1164 |
|apps| |
|
1165 |
||
1166 |
apps := self getApplicationsByClass:aClass. |
|
1167 |
apps do:[:aApp | |
|
1168 |
self removeByApplication:aApp. |
|
1169 |
]. |
|
1170 |
! |
|
1171 |
||
5050 | 1172 |
removeAllSubApplicationsFor:aApp |
1173 |
|apps| |
|
1174 |
||
1175 |
apps := self getAllChildrenAppsForApplication:aApp. |
|
1176 |
apps do:[:aApp | |
|
1177 |
self removeByApplication:aApp. |
|
1178 |
]. |
|
1179 |
! |
|
1180 |
||
4378 | 1181 |
removeApplicationByClass:aClass |
1182 |
| classEntries| |
|
1183 |
||
1184 |
self applicationList isNil ifTrue:[ |
|
1185 |
self initialize. |
|
1186 |
]. |
|
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1187 |
classEntries := self applicationList select:[:aEntry | aEntry application class == aClass]. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1188 |
classEntries do:[:aItem | |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1189 |
self removeItem:aItem. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1190 |
]. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1191 |
! |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1192 |
|
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1193 |
removeApplicationFromTree:aApplication |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1194 |
| classEntries| |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1195 |
|
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1196 |
self applicationList isNil ifTrue:[ |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1197 |
self initialize. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1198 |
]. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1199 |
classEntries := self applicationList select:[:aEntry | aEntry application == aApplication]. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1200 |
classEntries do:[:aItem | |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1201 |
self removeItem:aItem. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1202 |
]. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1203 |
self applicationList removeAllFoundIn:classEntries. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1204 |
! |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1205 |
|
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1206 |
removeByApplication:aApplication |
6127 | 1207 |
| item | |
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1208 |
|
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1209 |
item := self getItemByApplication:aApplication. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1210 |
item notNil ifTrue:[ |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1211 |
self removeItem:item. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1212 |
] |
5058 | 1213 |
! |
1214 |
||
1215 |
sortSubApplicationsFor:anApplication |
|
5059 | 1216 |
|item| |
5058 | 1217 |
|
1218 |
item := self getItemByApplication:anApplication. |
|
8268 | 1219 |
item sort:[:a :b| a label < b label]. |
4378 | 1220 |
! ! |
1221 |
||
6325 | 1222 |
!SettingsDialog methodsFor:'application list access-private'! |
4378 | 1223 |
|
1224 |
addCategoriesFor:aName |
|
6127 | 1225 |
"create all the categories" |
4378 | 1226 |
|
5253 | 1227 |
(aName includes:$/) ifFalse:[ ^ self]. |
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1228 |
self treeName:aName butLast:1 do:[:currentLabel :currentName| |
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1229 |
|length icon| |
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1230 |
|
4378 | 1231 |
currentLabel notEmpty ifTrue:[ |
1232 |
icon := self categoryIcons at:currentName ifAbsent:[nil]. |
|
4879 | 1233 |
self createItemName:currentName label:currentLabel icon:icon replaceExisting:true. |
4378 | 1234 |
] |
4879 | 1235 |
]. |
4378 | 1236 |
! |
1237 |
||
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1238 |
createItemForApplication:anApplication class:aClass label:aLabel icon:anIcon expandParent:expandParent replaceExisting:doReplaceExisting |
6127 | 1239 |
"create an application item in my application list" |
4898 | 1240 |
|
1241 |
| newItem parent locIcon item| |
|
1242 |
||
1243 |
parent := self getItemByApplication:anApplication. |
|
1244 |
parent isNil ifTrue:[ |
|
1245 |
^ nil |
|
1246 |
]. |
|
1247 |
||
1248 |
doReplaceExisting ifTrue:[ |
|
1249 |
parent children notNil ifTrue:[ |
|
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1250 |
(item := parent children detect:[ :anItem | anItem application == anApplication] ifNone:[nil]) notNil ifTrue:[ |
4898 | 1251 |
^ item. |
1252 |
] |
|
1253 |
] |
|
1254 |
]. |
|
1255 |
||
1256 |
newItem := self class itemClass new. |
|
1257 |
"/ newItem label:(resources string:aLabel) "allBold". |
|
1258 |
newItem label:aLabel "allBold". |
|
1259 |
newItem nameString:(anApplication itemPathName , aLabel). |
|
1260 |
newItem applicationClass:aClass. |
|
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1261 |
locIcon := anIcon. |
4898 | 1262 |
locIcon isNil ifTrue:[ locIcon := self class defaultSettingsAppIcon]. |
1263 |
newItem icon:locIcon. |
|
1264 |
parent add:newItem. |
|
1265 |
expandParent ifTrue:[ |
|
1266 |
parent expand. |
|
1267 |
]. |
|
1268 |
^ newItem |
|
1269 |
! |
|
1270 |
||
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1271 |
createItemName:aNameString label:aLabel class:aClass icon:anIcon |
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1272 |
^ self createItemName:aNameString label:aLabel class:aClass icon:anIcon expandParent:false |
4873 | 1273 |
! |
1274 |
||
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1275 |
createItemName:aNameString label:aLabel class:aClass icon:anIcon expandParent:expandParent |
4879 | 1276 |
^ self |
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1277 |
createItemName:aNameString |
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1278 |
label:aLabel |
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1279 |
class:aClass |
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1280 |
icon:anIcon |
4879 | 1281 |
expandParent:expandParent |
1282 |
replaceExisting:true |
|
1283 |
! |
|
1284 |
||
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1285 |
createItemName:aNameString label:untranslatedLabel class:aClass icon:anIcon expandParent:expandParent replaceExisting:doReplaceExisting |
6127 | 1286 |
"create an application item in my application list" |
4873 | 1287 |
|
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1288 |
|newItem parentsName parent locIcon item| |
4378 | 1289 |
|
5577 | 1290 |
(aNameString includes:$/) ifTrue:[ |
1291 |
parentsName := aNameString copyTo:(aNameString lastIndexOf:$/)-1. |
|
1292 |
parent := self getItemForName:parentsName. |
|
4378 | 1293 |
]. |
1294 |
parent isNil ifTrue:[ |
|
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1295 |
parent := self rootItem. |
4378 | 1296 |
]. |
4879 | 1297 |
|
1298 |
doReplaceExisting ifTrue:[ |
|
1299 |
parent children notNil ifTrue:[ |
|
5577 | 1300 |
(item := parent children detect:[ :anItem | anItem nameString = aNameString] ifNone:[nil]) notNil ifTrue:[ |
4879 | 1301 |
^ item. |
1302 |
] |
|
4378 | 1303 |
] |
1304 |
]. |
|
4879 | 1305 |
|
4378 | 1306 |
newItem := self class itemClass new. |
4740 | 1307 |
"/ newItem label:(resources string:aLabel) "allBold". |
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1308 |
newItem label:(resources string:untranslatedLabel) "allBold". |
4378 | 1309 |
newItem nameString:aNameString. |
1310 |
newItem applicationClass:aClass. |
|
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1311 |
locIcon := anIcon. |
4378 | 1312 |
locIcon isNil ifTrue:[ locIcon := self class defaultSettingsAppIcon]. |
1313 |
newItem icon:locIcon. |
|
4384 | 1314 |
parent add:newItem. |
4873 | 1315 |
expandParent ifTrue:[ |
1316 |
parent expand. |
|
1317 |
]. |
|
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1318 |
^ newItem |
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1319 |
|
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1320 |
"Modified: / 03-11-2007 / 14:23:32 / cg" |
4378 | 1321 |
! |
1322 |
||
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1323 |
createItemName:aNameString label:aLabel icon:anIcon |
6127 | 1324 |
"create an application item in my application list" |
4378 | 1325 |
|
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1326 |
self createItemName:aNameString label:aLabel class:nil icon:anIcon expandParent:false |
4378 | 1327 |
! |
1328 |
||
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1329 |
createItemName:aNameString label:aLabel icon:anIcon replaceExisting:doReplaceExisting |
6127 | 1330 |
"create an application item in my application list" |
4879 | 1331 |
|
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1332 |
self createItemName:aNameString label:aLabel class:nil icon:anIcon expandParent:false replaceExisting:doReplaceExisting |
4879 | 1333 |
! |
1334 |
||
4378 | 1335 |
getItemForName:aName |
1336 |
| searchItem| |
|
1337 |
||
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1338 |
searchItem := self rootItem. |
4378 | 1339 |
self treeName:aName do:[:currentLabel :currentName| |
1340 |
searchItem children isNil ifTrue:[ ^ nil]. |
|
1341 |
searchItem := searchItem children detect:[: item | item nameString = currentName] ifNone:[nil]. |
|
1342 |
searchItem isNil ifTrue:[ ^ nil]. |
|
1343 |
]. |
|
1344 |
^ searchItem |
|
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1345 |
|
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1346 |
"Modified: / 03-11-2007 / 14:23:28 / cg" |
4378 | 1347 |
! |
1348 |
||
15487 | 1349 |
realApplications |
1350 |
"return a collection of all real (non-folder) applications. |
|
1351 |
A helper to avoid code duplication" |
|
1352 |
||
1353 |
^ self applicationList |
|
1354 |
select:[:appItem | appItem isCategory not and:[ appItem application notNil]] |
|
1355 |
thenCollect:[:appItem | appItem application]. |
|
1356 |
! |
|
1357 |
||
1358 |
realApplicationsDo:aBlock |
|
1359 |
"evaluate aBlock for all real (non-folder) applications. |
|
1360 |
A helper to avoid code duplication" |
|
1361 |
||
1362 |
self realApplications do:aBlock. |
|
1363 |
! |
|
1364 |
||
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1365 |
removeItem:anItem |
7895 | 1366 |
"remove an application from the settingsTree" |
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1367 |
|
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1368 |
|parent remParent| |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1369 |
|
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1370 |
anItem application release. |
4893 | 1371 |
|
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1372 |
parent := anItem parent. |
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1373 |
parent isNil ifTrue:[" already removed " ^ self]. |
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1374 |
parent remove:anItem. |
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1375 |
|
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1376 |
[parent isCategory and:[parent children isEmptyOrNil]] whileTrue:[ |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1377 |
remParent := parent. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1378 |
parent := remParent parent. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1379 |
parent remove:remParent. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1380 |
]. |
6505
311c27b13f51
translation of empty (organization-only) items
Claus Gittinger <cg@exept.de>
parents:
6389
diff
changeset
|
1381 |
self applicationList remove:anItem ifAbsent:[nil]. |
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1382 |
self selectedItem value:parent. |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1383 |
! |
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1384 |
|
4879 | 1385 |
treeName:aName butLast:last do:aBlock |
4378 | 1386 |
| tree length| |
1387 |
||
1388 |
tree := aName asCollectionOfSubstringsSeparatedBy:$/. |
|
1389 |
tree from:1 to:(tree size - last) keysAndValuesDo:[:idx :aCategory| | itemName | |
|
1390 |
length := 0. |
|
1391 |
tree from:1 to:idx keysAndValuesDo:[:idx2 : el | |
|
1392 |
length := length + el size. |
|
1393 |
idx2 > 1 ifTrue:[length := length + 1]. |
|
1394 |
]. |
|
1395 |
itemName := aName copyTo:length. |
|
1396 |
aBlock value:aCategory value:itemName. |
|
1397 |
]. |
|
4879 | 1398 |
! |
1399 |
||
1400 |
treeName:aName do:aBlock |
|
1401 |
self treeName:aName butLast:0 do:aBlock |
|
4378 | 1402 |
! ! |
1403 |
||
1404 |
!SettingsDialog methodsFor:'aspects'! |
|
1405 |
||
1406 |
applicationList |
|
1407 |
applicationList isNil ifTrue:[ |
|
1408 |
applicationList := SettingsDialog::HierarchicalApplicationList new. |
|
1409 |
]. |
|
1410 |
^ applicationList. |
|
1411 |
! |
|
1412 |
||
1413 |
enableHelp |
|
1414 |
enableHelp isNil ifTrue:[ |
|
1415 |
enableHelp := true asValue. |
|
1416 |
]. |
|
1417 |
^ enableHelp. |
|
1418 |
! |
|
1419 |
||
1420 |
enableOK |
|
1421 |
enableOK isNil ifTrue:[ |
|
1422 |
enableOK := true asValue. |
|
1423 |
]. |
|
1424 |
^ enableOK. |
|
1425 |
! |
|
1426 |
||
1427 |
enableReload |
|
1428 |
enableReload isNil ifTrue:[ |
|
1429 |
enableReload := true asValue. |
|
1430 |
]. |
|
1431 |
^ enableReload. |
|
1432 |
! |
|
1433 |
||
9021
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
1434 |
loadAndSaveSettingsItemVisible |
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
1435 |
"for now, only show these if I have a requestor |
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
1436 |
(i.e. I am a full settings Dialog as opposed to a DebugView, FileBrowser or other |
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
1437 |
settingsDialog. I think this has to be reworked..." |
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
1438 |
|
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
1439 |
^ requestor notNil "/ loadAndSaveSettingsItemVisible |
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
1440 |
! |
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
1441 |
|
4378 | 1442 |
selectedItem |
1443 |
selectedItem isNil ifTrue:[ |
|
1444 |
selectedItem := ValueHolder new. |
|
1445 |
selectedItem addDependent:self. |
|
1446 |
]. |
|
1447 |
^ selectedItem. |
|
1448 |
! |
|
1449 |
||
1450 |
subCanvasApplicationHolder |
|
1451 |
subCanvasApplicationHolder isNil ifTrue:[ |
|
1452 |
subCanvasApplicationHolder := ValueHolder new. |
|
1453 |
]. |
|
1454 |
^ subCanvasApplicationHolder. |
|
7609 | 1455 |
! |
1456 |
||
1457 |
whyDisabledInfoHolder |
|
1458 |
whyDisabledInfoHolder isNil ifTrue:[ |
|
1459 |
whyDisabledInfoHolder := '' asValue. |
|
1460 |
]. |
|
1461 |
^ whyDisabledInfoHolder. |
|
1462 |
||
1463 |
"Created: / 25-01-2007 / 17:13:50 / cg" |
|
4378 | 1464 |
! ! |
1465 |
||
1466 |
!SettingsDialog methodsFor:'change & update'! |
|
1467 |
||
1468 |
modifiedChanged |
|
14305 | 1469 |
|modified| |
4378 | 1470 |
|
14305 | 1471 |
modified := self subCanvasApplication modifiedChannel value. |
1472 |
self enableOK value:modified. |
|
1473 |
self enableReload value:modified. |
|
4378 | 1474 |
! |
1475 |
||
1476 |
selectionChanged |
|
7613
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1477 |
|item oldAppl noApp lbl window app itemLabel| |
4378 | 1478 |
|
4405 | 1479 |
self selectedItem value == lastSelection ifTrue:[ ^ self]. |
7609 | 1480 |
|
14305 | 1481 |
oldAppl := self subCanvasApplication. |
4378 | 1482 |
oldAppl notNil ifTrue:[ |
4405 | 1483 |
oldAppl saveRequest ifFalse:[ |
1484 |
lastSelection notNil ifTrue:[ |
|
1485 |
self |
|
1486 |
enqueueMessage:#value |
|
9617
7c53e41f20cf
added: #selectItemWithClass:
Claus Gittinger <cg@exept.de>
parents:
9608
diff
changeset
|
1487 |
for:[ self selectedItem value:lastSelection ] |
4405 | 1488 |
arguments:#(). |
1489 |
]. |
|
1490 |
^ self |
|
1491 |
]. |
|
4378 | 1492 |
oldAppl modifiedChannel removeDependent:self. |
1493 |
]. |
|
4435 | 1494 |
|
4378 | 1495 |
item := self selectedItem value. |
13796 | 1496 |
|
1497 |
item isNil ifTrue:[ item := applicationList root ]. |
|
1498 |
||
4405 | 1499 |
lastSelection := item. |
7609 | 1500 |
noApp := (item isNil) ifTrue:true ifFalse:[item isCategory]. |
4378 | 1501 |
self enableOK value:(noApp not). |
1502 |
self enableReload value:(noApp not). |
|
1503 |
self enableHelp value:(noApp not). |
|
7609 | 1504 |
|
4435 | 1505 |
window := self window. |
1506 |
window notNil ifTrue:[ |
|
6126 | 1507 |
lbl := self rootItemLabel ? 'Settings Dialog'. |
4435 | 1508 |
item notNil ifTrue:[ |
14652 | 1509 |
itemLabel := item label. |
1510 |
itemLabel := itemLabel copyReplaceAll:(Character cr) with:(Character space) ifNone:itemLabel. |
|
6126 | 1511 |
itemLabel ~= lbl ifTrue:[ |
1512 |
lbl := lbl , ' [', itemLabel, ']'. |
|
1513 |
] |
|
4435 | 1514 |
]. |
1515 |
window label:lbl. |
|
4406 | 1516 |
]. |
7609 | 1517 |
|
7613
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1518 |
builder notNil ifTrue:[ |box| |
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1519 |
"hide the DisabledSettingsBox" |
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1520 |
box := builder componentAt:#DisabledSettingsBox. |
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1521 |
box notNil ifTrue:[ |
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1522 |
box beInvisible; lower. |
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1523 |
]. |
7609 | 1524 |
]. |
1525 |
||
4378 | 1526 |
noApp ifTrue:[ |
1527 |
self subCanvasApplicationHolder value:nil. |
|
1528 |
^ self |
|
1529 |
]. |
|
7609 | 1530 |
|
1531 |
app := item application. |
|
1532 |
app isNil ifTrue:[ |
|
1533 |
app := item applicationClass basicNew. |
|
1534 |
(app isEnabledInSettingsDialog:self) ifFalse:[ |
|
7613
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1535 |
"raise the DisabledSettingsBox above the settings window" |
7609 | 1536 |
self whyDisabledInfoHolder value:('These Settings are currently disabled, because\',app whyDisabledInSettingsDialogInfo) withCRs. |
7613
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1537 |
builder notNil ifTrue:[ |box| |
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1538 |
box := builder componentAt:#DisabledSettingsBox. |
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1539 |
box notNil ifTrue:[ |
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1540 |
box beVisible; raise. |
7b59de1f0350
Fix race when changing a selection
Stefan Vogel <sv@exept.de>
parents:
7609
diff
changeset
|
1541 |
]. |
7609 | 1542 |
]. |
1543 |
self subCanvasApplicationHolder value:nil. |
|
1544 |
^ self |
|
1545 |
]. |
|
1546 |
||
1547 |
item application:app. |
|
4703
deb516ae2481
a lot of changes - server is running but there is something left to do
penk
parents:
4659
diff
changeset
|
1548 |
app basicInitialize. |
5026 | 1549 |
app settingsDialog:self. |
4378 | 1550 |
]. |
5164 | 1551 |
self withWaitCursorDo:[ |
1552 |
app initialize. |
|
1553 |
app readSettings. |
|
1554 |
]. |
|
4435 | 1555 |
app modifiedChannel addDependent:self. |
1556 |
self subCanvasApplicationHolder value:app. |
|
4378 | 1557 |
self modifiedChanged. |
7609 | 1558 |
|
9617
7c53e41f20cf
added: #selectItemWithClass:
Claus Gittinger <cg@exept.de>
parents:
9608
diff
changeset
|
1559 |
"Modified: / 29-10-2010 / 11:51:13 / cg" |
13796 | 1560 |
"Modified: / 17-02-2012 / 10:24:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4378 | 1561 |
! |
1562 |
||
1563 |
update:something with:aParameter from:changedObject |
|
6293 | 1564 |
|subCanvasApplication| |
4378 | 1565 |
|
1566 |
changedObject == self selectedItem ifTrue:[ |
|
4405 | 1567 |
super update:something with:aParameter from:changedObject. |
4378 | 1568 |
self selectionChanged. |
4405 | 1569 |
^ self. |
4378 | 1570 |
]. |
14305 | 1571 |
subCanvasApplication := self subCanvasApplication. |
6293 | 1572 |
(subCanvasApplication notNil |
1573 |
and:[changedObject == subCanvasApplication modifiedChannel]) ifTrue:[ |
|
1574 |
self modifiedChanged. |
|
4378 | 1575 |
]. |
1576 |
super update:something with:aParameter from:changedObject |
|
1577 |
! ! |
|
1578 |
||
1579 |
!SettingsDialog methodsFor:'initialization & release'! |
|
1580 |
||
1581 |
closeRequest |
|
15048 | 1582 |
"This is a hook method. |
1583 |
It will be invoked when your app/dialog-window is about to be closed. |
|
1584 |
This method has a chance to suppress the close by returning false. |
|
4378 | 1585 |
See also #closeDownViews, which is invoked when the close is really done." |
1586 |
||
4400 | 1587 |
| req | |
6019 | 1588 |
|
4659 | 1589 |
(self sendSaveRequestToCurrent == false) ifTrue:[^ self]. |
15487 | 1590 |
|
1591 |
"/ if any of my subApps has made a change, ask user if he wants |
|
1592 |
"/ to write the settings file |
|
1593 |
(self realApplications contains:[:app | app didModifySettings]) ifTrue:[ |
|
15523 | 1594 |
"D121136 - Filename doesnot understand allBold" |
15487 | 1595 |
(Dialog |
1596 |
confirm:(resources |
|
1597 |
stringWithCRs:'Save your changed settings in the settings file?\(which is: "%1"\\If not saved, these changes only apply to your current session.' |
|
15523 | 1598 |
with:self class currentSettingsFilename asString allBold)) |
15487 | 1599 |
ifTrue:[ |
1600 |
self saveSettingsWithoutAskingForFile. |
|
1601 |
]. |
|
15881 | 1602 |
"D122540 - Dialog opens twice" |
1603 |
self realApplications do:[:each| each clearDidModifySettings ]. |
|
15487 | 1604 |
]. |
1605 |
||
4378 | 1606 |
self destroyAll. |
4400 | 1607 |
|
1608 |
req := self requestor. |
|
1609 |
req notNil ifTrue:[ |
|
1610 |
req settingsClosed. |
|
1611 |
]. |
|
6635 | 1612 |
super closeRequest |
4378 | 1613 |
! |
1614 |
||
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1615 |
createRootItem |
7172 | 1616 |
|rootItem lbl| |
4378 | 1617 |
|
1618 |
resources := AbstractLauncherApplication resources. |
|
1619 |
rootItem := self class itemClass new. |
|
7172 | 1620 |
lbl := resources string:'Settings'. |
1621 |
rootItem label:lbl "allBold". |
|
1622 |
rootItem nameString:lbl. |
|
4378 | 1623 |
rootItem icon:self class settingsIcon. |
13796 | 1624 |
rootItem applicationClass: SettingsFilenameAppl. |
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1625 |
^ rootItem |
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1626 |
|
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1627 |
"Created: / 03-11-2007 / 14:22:01 / cg" |
13796 | 1628 |
"Modified: / 07-02-2012 / 01:03:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1629 |
! |
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1630 |
|
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1631 |
initialize |
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1632 |
|rootItem| |
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1633 |
|
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1634 |
rootItem := self createRootItem. |
6124
233e703f84a4
access to rootItem & showRoot
Claus Gittinger <cg@exept.de>
parents:
6024
diff
changeset
|
1635 |
self applicationList root:rootItem; showRoot:true "false". |
4378 | 1636 |
self selectedItem value:rootItem. |
1637 |
super initialize. |
|
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1638 |
|
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1639 |
"Modified: / 03-11-2007 / 14:22:18 / cg" |
4378 | 1640 |
! |
1641 |
||
1642 |
postBuildSubCanvas:aWidget |
|
1643 |
aWidget keepClientView:true. |
|
1644 |
! |
|
1645 |
||
1646 |
postOpenWith:aBuilder |
|
14327 | 1647 |
|items| |
1648 |
||
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1649 |
self rootItem expand. |
4378 | 1650 |
super postOpenWith:aBuilder. |
14327 | 1651 |
(items := self rootItem children) size == 1 ifTrue:[ |
1652 |
self selectedItem value: items anyOne. |
|
10742
c6c9b272ac55
changed: #postOpenWith: (pre-select settings if there is only one child of the root)
vrany
parents:
10396
diff
changeset
|
1653 |
] |
7880
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1654 |
|
c5e6528bd927
provide access to the rootItem
Claus Gittinger <cg@exept.de>
parents:
7873
diff
changeset
|
1655 |
"Modified: / 03-11-2007 / 14:23:25 / cg" |
10742
c6c9b272ac55
changed: #postOpenWith: (pre-select settings if there is only one child of the root)
vrany
parents:
10396
diff
changeset
|
1656 |
"Modified: / 03-10-2011 / 16:27:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4378 | 1657 |
! ! |
1658 |
||
1659 |
!SettingsDialog methodsFor:'menu actions'! |
|
1660 |
||
5465 | 1661 |
askForFileAndSaveSettings |
1662 |
self class askForFileAndSaveSettings. |
|
15487 | 1663 |
self realApplicationsDo:[:app | app clearDidModifySettings]. |
5465 | 1664 |
! |
1665 |
||
4574 | 1666 |
loadSettingsFromFile |
4378 | 1667 |
"restore settings from a settings-file." |
1668 |
||
1669 |
"a temporary kludge - we need a central systemSettings object for this, |
|
1670 |
which can be saved/restored with a single store/read." |
|
1671 |
||
14081 | 1672 |
|oldFile dir fileName transcript launcher| |
1673 |
||
1674 |
(oldFile := UserPreferences current at:#settingsFilename) notNil ifTrue:[ |
|
1675 |
dir := oldFile asFilename directory. |
|
1676 |
]. |
|
4378 | 1677 |
|
1678 |
fileName := Dialog |
|
4740 | 1679 |
requestFileName:(resources string:'Load Settings from File') |
4378 | 1680 |
default:'settings.stx' |
1681 |
ok:(resources string:'Load') |
|
1682 |
abort:(resources string:'Cancel') |
|
1683 |
pattern:'*.stx' |
|
14081 | 1684 |
fromDirectory:dir. |
4378 | 1685 |
|
1686 |
(fileName size == 0) ifTrue:[ |
|
1687 |
"/ canceled |
|
1688 |
^ self |
|
1689 |
]. |
|
1690 |
||
1691 |
self withWaitCursorDo:[ |
|
1692 |
Smalltalk fileIn:fileName. |
|
5629
2cb05ef96502
care for nonPosStream transcript
Claus Gittinger <cg@exept.de>
parents:
5624
diff
changeset
|
1693 |
|
2cb05ef96502
care for nonPosStream transcript
Claus Gittinger <cg@exept.de>
parents:
5624
diff
changeset
|
1694 |
"/ Transcript current topView model reOpen. |
2cb05ef96502
care for nonPosStream transcript
Claus Gittinger <cg@exept.de>
parents:
5624
diff
changeset
|
1695 |
|
2cb05ef96502
care for nonPosStream transcript
Claus Gittinger <cg@exept.de>
parents:
5624
diff
changeset
|
1696 |
transcript := Transcript current. |
2cb05ef96502
care for nonPosStream transcript
Claus Gittinger <cg@exept.de>
parents:
5624
diff
changeset
|
1697 |
(transcript notNil and:[transcript isExternalStream not]) ifTrue:[ |
2cb05ef96502
care for nonPosStream transcript
Claus Gittinger <cg@exept.de>
parents:
5624
diff
changeset
|
1698 |
launcher := transcript application. |
2cb05ef96502
care for nonPosStream transcript
Claus Gittinger <cg@exept.de>
parents:
5624
diff
changeset
|
1699 |
launcher notNil ifTrue:[ |
2cb05ef96502
care for nonPosStream transcript
Claus Gittinger <cg@exept.de>
parents:
5624
diff
changeset
|
1700 |
launcher reopenLauncher. |
2cb05ef96502
care for nonPosStream transcript
Claus Gittinger <cg@exept.de>
parents:
5624
diff
changeset
|
1701 |
] |
2cb05ef96502
care for nonPosStream transcript
Claus Gittinger <cg@exept.de>
parents:
5624
diff
changeset
|
1702 |
]. |
4378 | 1703 |
self sendLoadRequestToAll. |
1704 |
]. |
|
7100 | 1705 |
|
1706 |
"Modified: / 08-09-2006 / 19:23:15 / cg" |
|
4378 | 1707 |
! |
1708 |
||
14792 | 1709 |
menuCollapseAll |
1710 |
applicationList root children do:[:each | each collapse]. |
|
1711 |
! |
|
1712 |
||
1713 |
menuExpandAll |
|
1714 |
applicationList root children do:[:each | each recursiveExpand]. |
|
1715 |
! |
|
1716 |
||
5465 | 1717 |
saveSettingsWithoutAskingForFile |
1718 |
self class saveSettingsWithoutAskingForFile. |
|
15487 | 1719 |
self realApplicationsDo:[:app | app clearDidModifySettings]. |
4378 | 1720 |
! ! |
1721 |
||
14327 | 1722 |
!SettingsDialog methodsFor:'selection'! |
1723 |
||
1724 |
selectItemWithClass:aClass |
|
1725 |
"select an item based on the sub-settings application class" |
|
1726 |
||
1727 |
|entry| |
|
1728 |
||
1729 |
entry := applicationList root |
|
1730 |
recursiveDetect:[:entry | entry applicationClass = aClass]. |
|
1731 |
entry notNil ifTrue:[ |
|
1732 |
entry makeVisible. |
|
1733 |
self selectedItem value:entry |
|
1734 |
]. |
|
1735 |
||
1736 |
"Created: / 29-10-2010 / 11:54:13 / cg" |
|
1737 |
! |
|
1738 |
||
1739 |
selectItemWithName:aPathString |
|
1740 |
"select an item based on the sub-settings page name. |
|
1741 |
See standardRawSettingsList for a list of names" |
|
1742 |
||
1743 |
|entry| |
|
1744 |
||
1745 |
entry := applicationList root |
|
1746 |
recursiveDetect:[:entry | entry nameString = aPathString]. |
|
1747 |
entry notNil ifTrue:[ |
|
1748 |
entry makeVisible. |
|
1749 |
self selectedItem value:entry |
|
1750 |
]. |
|
1751 |
! ! |
|
1752 |
||
4378 | 1753 |
!SettingsDialog::HierarchicalApplicationList::ApplicationItem methodsFor:'accessing'! |
1754 |
||
1755 |
application |
|
1756 |
"return the value of the instance variable 'application' (automatically generated)" |
|
1757 |
||
1758 |
^ application |
|
1759 |
! |
|
1760 |
||
1761 |
application:something |
|
1762 |
"set the value of the instance variable 'application' (automatically generated)" |
|
1763 |
||
1764 |
application := something. |
|
1765 |
! |
|
1766 |
||
1767 |
applicationClass |
|
1768 |
"return the value of the instance variable 'applicationClass' (automatically generated)" |
|
1769 |
||
1770 |
^ applicationClass |
|
1771 |
! |
|
1772 |
||
1773 |
applicationClass:something |
|
1774 |
"set the value of the instance variable 'applicationClass' (automatically generated)" |
|
1775 |
||
1776 |
applicationClass := something. |
|
1777 |
! |
|
1778 |
||
9425 | 1779 |
label:something |
1780 |
"reset the with in pixels..." |
|
1781 |
width := nil. |
|
1782 |
label := something. |
|
1783 |
! |
|
1784 |
||
4378 | 1785 |
nameString |
1786 |
"return the value of the instance variable 'nameString' (automatically generated)" |
|
1787 |
||
1788 |
^ nameString |
|
1789 |
! |
|
1790 |
||
1791 |
nameString:something |
|
1792 |
"set the value of the instance variable 'nameString' (automatically generated)" |
|
1793 |
||
1794 |
nameString := something. |
|
1795 |
! ! |
|
1796 |
||
5078
9fafc6b058bc
new middleButtonMenu for remove service in SettingsDialog
penk
parents:
5059
diff
changeset
|
1797 |
!SettingsDialog::HierarchicalApplicationList::ApplicationItem methodsFor:'menu'! |
9fafc6b058bc
new middleButtonMenu for remove service in SettingsDialog
penk
parents:
5059
diff
changeset
|
1798 |
|
9fafc6b058bc
new middleButtonMenu for remove service in SettingsDialog
penk
parents:
5059
diff
changeset
|
1799 |
middleButtonMenu |
9fafc6b058bc
new middleButtonMenu for remove service in SettingsDialog
penk
parents:
5059
diff
changeset
|
1800 |
|
9fafc6b058bc
new middleButtonMenu for remove service in SettingsDialog
penk
parents:
5059
diff
changeset
|
1801 |
<resource: #programMenu > |
9fafc6b058bc
new middleButtonMenu for remove service in SettingsDialog
penk
parents:
5059
diff
changeset
|
1802 |
|
5838 | 1803 |
|application| |
1804 |
||
1805 |
(application := self application) isNil ifTrue:[ ^ nil]. |
|
1806 |
^ application settingsDialogPopUpMenu |
|
5078
9fafc6b058bc
new middleButtonMenu for remove service in SettingsDialog
penk
parents:
5059
diff
changeset
|
1807 |
! ! |
9fafc6b058bc
new middleButtonMenu for remove service in SettingsDialog
penk
parents:
5059
diff
changeset
|
1808 |
|
4405 | 1809 |
!SettingsDialog::HierarchicalApplicationList::ApplicationItem methodsFor:'printing & storing'! |
1810 |
||
13322
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1811 |
displayOn:aGCOrStream |
4405 | 1812 |
|
13322
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1813 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1814 |
"/ ST/X (and some old ST80's) mean: draw-yourself on a GC. |
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1815 |
(aGCOrStream isStream) ifFalse:[ |
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1816 |
^ super displayOn:aGCOrStream |
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1817 |
]. |
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1818 |
|
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1819 |
super printOn:aGCOrStream. |
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1820 |
aGCOrStream nextPutAll:' ['. |
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1821 |
label printOn:aGCOrStream. |
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1822 |
aGCOrStream nextPut:$]. |
4405 | 1823 |
! |
1824 |
||
9558 | 1825 |
printOn:aStream |
1826 |
aStream |
|
1827 |
nextPutAll:self class nameWithoutPrefix; |
|
13322
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1828 |
space. |
7932b47dbcc2
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
13270
diff
changeset
|
1829 |
self label printOn:aStream. |
9558 | 1830 |
|
1831 |
"Created: / 24-08-2010 / 18:36:17 / sr" |
|
4405 | 1832 |
! ! |
1833 |
||
4378 | 1834 |
!SettingsDialog::HierarchicalApplicationList::ApplicationItem methodsFor:'queries'! |
1835 |
||
9425 | 1836 |
canCollapse |
1837 |
"the rootItem is cannot be collapsed" |
|
14872 | 1838 |
|
1839 |
"/ first check if we are expanded, if not answer false |
|
15607 | 1840 |
^ (self isExpanded and:[self isRootItem not]) |
9425 | 1841 |
! |
1842 |
||
4378 | 1843 |
isCategory |
1844 |
||
1845 |
^ self applicationClass isNil |
|
1846 |
! ! |
|
1847 |
||
14239 | 1848 |
!SettingsDialog::SettingsFilenameAppl class methodsFor:'help specs'! |
1849 |
||
1850 |
flyByHelpSpec |
|
1851 |
<resource: #help> |
|
1852 |
||
1853 |
^ super flyByHelpSpec addPairsFrom:#( |
|
1854 |
||
1855 |
#openSettingsFile |
|
1856 |
'Click to open a file browser on the settings file' |
|
1857 |
||
1858 |
#reloadSettingsFile |
|
1859 |
'Reload the settings from the file' |
|
1860 |
||
1861 |
#saveAsPrivateSettingsFile |
|
1862 |
'Save the settings into your private settings file' |
|
1863 |
||
1864 |
) |
|
1865 |
! ! |
|
1866 |
||
13796 | 1867 |
!SettingsDialog::SettingsFilenameAppl class methodsFor:'interface specs'! |
1868 |
||
1869 |
windowSpec |
|
1870 |
"This resource specification was automatically generated |
|
1871 |
by the UIPainter of ST/X." |
|
1872 |
||
1873 |
"Do not manually edit this!! If it is corrupted, |
|
1874 |
the UIPainter may not be able to read the specification." |
|
1875 |
||
1876 |
" |
|
1877 |
UIPainter new openOnClass:SettingsDialog::SettingsFilenameAppl andSelector:#windowSpec |
|
1878 |
SettingsDialog::SettingsFilenameAppl new openInterface:#windowSpec |
|
1879 |
SettingsDialog::SettingsFilenameAppl open |
|
1880 |
" |
|
1881 |
||
1882 |
<resource: #canvas> |
|
1883 |
||
1884 |
^ |
|
14081 | 1885 |
#(FullSpec |
1886 |
name: windowSpec |
|
1887 |
window: |
|
1888 |
(WindowSpec |
|
1889 |
label: 'Settings File' |
|
1890 |
name: 'Settings File' |
|
1891 |
min: (Point 10 10) |
|
14239 | 1892 |
bounds: (Rectangle 0 0 426 359) |
14081 | 1893 |
) |
1894 |
component: |
|
1895 |
(SpecCollection |
|
1896 |
collection: ( |
|
1897 |
(LabelSpec |
|
14792 | 1898 |
name: 'InfoLabel' |
1899 |
layout: (LayoutFrame 0 0 -169 0.5 0 1 -45 0.5) |
|
1900 |
translateLabel: true |
|
1901 |
labelChannel: infoLabelHolder |
|
1902 |
) |
|
1903 |
(LabelSpec |
|
14081 | 1904 |
label: 'Preferences are stored in file:' |
1905 |
name: 'Label1' |
|
1906 |
layout: (LayoutFrame 0 0 -30 0.5 0 1 0 0.5) |
|
1907 |
translateLabel: true |
|
1908 |
) |
|
1909 |
(LinkButtonSpec |
|
1910 |
label: 'LinkButton' |
|
1911 |
name: 'EditPreferences' |
|
1912 |
layout: (LayoutFrame 0 0 0 0.5 0 1 30 0.5) |
|
14239 | 1913 |
activeHelpKey: openSettingsFile |
14081 | 1914 |
foregroundColor: (Color 0.0 0.0 100.0) |
1915 |
translateLabel: true |
|
1916 |
labelChannel: settingsFilenameHolder |
|
1917 |
model: openSettingsFile |
|
13796 | 1918 |
) |
14081 | 1919 |
(HorizontalPanelViewSpec |
1920 |
name: 'HorizontalPanel1' |
|
1921 |
layout: (LayoutFrame 0 0 53 0.5 0 1 101 0.5) |
|
14239 | 1922 |
horizontalLayout: centerMax |
14081 | 1923 |
verticalLayout: center |
1924 |
horizontalSpace: 3 |
|
1925 |
verticalSpace: 3 |
|
1926 |
component: |
|
1927 |
(SpecCollection |
|
1928 |
collection: ( |
|
1929 |
(ActionButtonSpec |
|
1930 |
label: 'Reload' |
|
1931 |
name: 'Button2' |
|
14239 | 1932 |
activeHelpKey: reloadSettingsFile |
14081 | 1933 |
translateLabel: true |
1934 |
model: reloadSettingsFile |
|
1935 |
useDefaultExtent: true |
|
1936 |
) |
|
1937 |
(ActionButtonSpec |
|
1938 |
label: 'Save as Private' |
|
1939 |
name: 'Button3' |
|
14239 | 1940 |
activeHelpKey: saveAsPrivateSettingsFile |
14081 | 1941 |
translateLabel: true |
1942 |
model: saveAsPrivateSettingsFile |
|
1943 |
useDefaultExtent: true |
|
1944 |
) |
|
1945 |
(ActionButtonSpec |
|
1946 |
label: 'File Browser' |
|
1947 |
name: 'Button1' |
|
14239 | 1948 |
activeHelpKey: openSettingsFile |
14081 | 1949 |
translateLabel: true |
1950 |
model: openSettingsFile |
|
1951 |
useDefaultExtent: true |
|
1952 |
) |
|
1953 |
) |
|
1954 |
||
1955 |
) |
|
1956 |
) |
|
1957 |
) |
|
1958 |
||
1959 |
) |
|
1960 |
) |
|
13796 | 1961 |
! ! |
1962 |
||
14081 | 1963 |
!SettingsDialog::SettingsFilenameAppl methodsFor:'actions'! |
13796 | 1964 |
|
1965 |
openSettingsFile |
|
14792 | 1966 |
self openSettingsFile: (self settingsFile) |
13796 | 1967 |
|
1968 |
"Created: / 07-02-2012 / 11:15:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1969 |
! |
|
1970 |
||
1971 |
reloadSettingsFile |
|
14792 | 1972 |
self reloadSettingsFile: (self settingsFile) |
13796 | 1973 |
|
1974 |
"Created: / 17-02-2012 / 10:26:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1975 |
! |
|
1976 |
||
14081 | 1977 |
saveAsPrivateSettingsFile |
1978 |
|fn| |
|
1979 |
||
15487 | 1980 |
fn := UserPreferences defaultUserSettingsFile pathName. |
14081 | 1981 |
SettingsDialog saveSettingsTo:fn. |
1982 |
UserPreferences current at:#settingsFilename put:fn. |
|
1983 |
settingsFilenameHolder value:fn. |
|
1984 |
! ! |
|
1985 |
||
1986 |
!SettingsDialog::SettingsFilenameAppl methodsFor:'aspects'! |
|
1987 |
||
14792 | 1988 |
infoLabelHolder |
1989 |
infoLabelHolder isNil ifTrue:[ |
|
1990 |
infoLabelHolder := nil asValue. |
|
1991 |
infoLabelHolder value: |
|
1992 |
(resources |
|
1993 |
stringWithCRs:( |
|
1994 |
'Unless saved via the "Save"-Button,' |
|
1995 |
, '\changes affect the current session only.')). |
|
1996 |
||
1997 |
]. |
|
1998 |
^ infoLabelHolder |
|
1999 |
! |
|
2000 |
||
14081 | 2001 |
settingsFilenameHolder |
2002 |
settingsFilenameHolder isNil ifTrue:[ |
|
2003 |
settingsFilenameHolder := nil asValue. |
|
2004 |
self basicReadSettings. |
|
2005 |
]. |
|
2006 |
^ settingsFilenameHolder |
|
2007 |
||
2008 |
"Created: / 07-02-2012 / 01:08:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2009 |
! ! |
|
2010 |
||
2011 |
!SettingsDialog::SettingsFilenameAppl methodsFor:'private'! |
|
2012 |
||
2013 |
openSettingsFile: filename |
|
2014 |
||
14792 | 2015 |
UserPreferences fileBrowserClass |
14081 | 2016 |
openOnFileNamed:filename editing:true |
2017 |
||
2018 |
"Created: / 07-02-2012 / 01:08:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2019 |
! |
|
2020 |
||
13796 | 2021 |
reloadSettingsFile: filename |
2022 |
||
2023 |
filename asFilename fileIn. |
|
2024 |
UserPreferences current at: #settingsFilename put: filename asFilename pathName |
|
2025 |
||
2026 |
"Created: / 17-02-2012 / 10:27:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2027 |
! ! |
|
2028 |
||
2029 |
!SettingsDialog::SettingsFilenameAppl methodsFor:'protocol'! |
|
2030 |
||
2031 |
basicReadSettings |
|
14081 | 2032 |
|filename| |
13796 | 2033 |
|
14792 | 2034 |
filename := self settingsFile. |
14081 | 2035 |
"/ filename := filename asText |
2036 |
"/ colorizeAllWith: Color blue; |
|
2037 |
"/ actionForAll:[ self openSettingsFile: filename ]. |
|
2038 |
self settingsFilenameHolder value:filename. |
|
13796 | 2039 |
! |
2040 |
||
2041 |
basicSaveSettings |
|
2042 |
^self |
|
2043 |
||
2044 |
"Modified: / 07-02-2012 / 01:03:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14792 | 2045 |
! |
2046 |
||
2047 |
editorHelpRelativeWikiURL |
|
2048 |
"the relative URL of the dialog-description in the Wiki" |
|
2049 |
||
2050 |
^ 'Settings' |
|
2051 |
! |
|
2052 |
||
2053 |
helpFilename |
|
2054 |
"subclasses must return the relative name of a helpFile |
|
2055 |
in the doc/online/<language>/help directory. |
|
2056 |
Or nil, if no help is available." |
|
2057 |
||
2058 |
^ nil. |
|
13796 | 2059 |
! ! |
2060 |
||
2061 |
!SettingsDialog::SettingsFilenameAppl methodsFor:'queries'! |
|
2062 |
||
2063 |
hasUnsavedChanges |
|
2064 |
^false |
|
2065 |
||
2066 |
"Modified: / 07-02-2012 / 01:03:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14792 | 2067 |
! |
2068 |
||
2069 |
settingsFile |
|
15487 | 2070 |
^ SettingsDialog currentSettingsFilename |
13796 | 2071 |
! ! |
2072 |
||
4378 | 2073 |
!SettingsDialog class methodsFor:'documentation'! |
2074 |
||
2075 |
version |
|
15881 | 2076 |
^ '$Header$' |
9021
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
2077 |
! |
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
2078 |
|
7fe0760c4554
added: #loadAndSaveSettingsItemVisible
Claus Gittinger <cg@exept.de>
parents:
8624
diff
changeset
|
2079 |
version_CVS |
15881 | 2080 |
^ '$Header$' |
4378 | 2081 |
! ! |
4469 | 2082 |
|
12765 | 2083 |
|
4469 | 2084 |
SettingsDialog initialize! |