author | Claus Gittinger <cg@exept.de> |
Mon, 15 Jul 2019 18:47:18 +0200 | |
changeset 18902 | c2dea21fb224 |
parent 18297 | af0fa308ea09 |
child 19129 | ba7f0ea254da |
permissions | -rw-r--r-- |
18297 | 1 |
"{ Encoding: utf8 }" |
2 |
||
8812 | 3 |
" |
4 |
COPYRIGHT (c) 2008 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 |
" |
|
8014 | 14 |
"{ Package: 'stx:libtool' }" |
15 |
||
17164 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
8014 | 18 |
SimpleDialog subclass:#BookmarksEditDialog |
19 |
instanceVariableNames:'selectedBookmarksHolder bookmarkListHolder defaultBookmark answer' |
|
20 |
classVariableNames:'' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'Interface-Tools-File' |
|
23 |
! |
|
24 |
||
8812 | 25 |
!BookmarksEditDialog class methodsFor:'documentation'! |
26 |
||
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 2008 by eXept Software AG |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! ! |
|
8014 | 40 |
|
8262 | 41 |
!BookmarksEditDialog class methodsFor:'help specs'! |
42 |
||
17909 | 43 |
helpSpec |
8262 | 44 |
<resource: #help> |
45 |
||
17909 | 46 |
^ super helpSpec addPairsFrom:#( |
8262 | 47 |
|
48 |
#moveUp |
|
17164 | 49 |
'Move the selected bookmark up in the list' |
8262 | 50 |
|
51 |
#moveDown |
|
17164 | 52 |
'Move the selected bookmark down in the list' |
53 |
||
54 |
#exportBookmarks |
|
55 |
'Export bookmarks to a file' |
|
56 |
||
57 |
#importBookmarks |
|
58 |
'Import bookmarks from a file' |
|
59 |
||
60 |
#newBookmark |
|
61 |
'Add a new bookmark' |
|
62 |
||
63 |
#removeBookmark |
|
64 |
'Remove the selected bookmark' |
|
65 |
||
66 |
#sortBookmarks |
|
67 |
'Sort bookmarks alphabetically' |
|
8262 | 68 |
|
69 |
). |
|
70 |
! ! |
|
71 |
||
8014 | 72 |
!BookmarksEditDialog class methodsFor:'image specs'! |
73 |
||
74 |
fileIn22x22Icon |
|
75 |
"This resource specification was automatically generated |
|
76 |
by the ImageEditor of ST/X." |
|
77 |
||
78 |
"Do not manually edit this!! If it is corrupted, |
|
79 |
the ImageEditor may not be able to read the specification." |
|
80 |
||
81 |
" |
|
82 |
self fileIn22x22Icon inspect |
|
83 |
ImageEditor openOnClass:self andSelector:#fileIn22x22Icon |
|
84 |
Icon flushCachedIcons |
|
85 |
" |
|
86 |
||
87 |
<resource: #image> |
|
88 |
||
89 |
^Icon |
|
8262 | 90 |
constantNamed:'BookmarksEditDialog class fileIn22x22Icon' |
8014 | 91 |
ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
8262 | 92 |
GQ4]GQ4]GQ4]GQ4]GQ4]GP@@@@@@@A4]GQ4]GQ4]GQ4]GQ4]GQ4@@@@@@@@]GQ4]GQ4]GQ4]GQ4]GQ4]@@@@@@@@GQ4]GQ4]GQ4]GQ4]EATUEQTUEQTU@A4] |
93 |
GQ4]GQ4]GQ4]EAT&I0PQGQ4]EP@]GQ4]GQ4]GQ4]EA8UI HKBQ4]GQT@GQ4]GQ4]GQ4]EAPTEBXFDP$]GQ4U@A4]GQ4]GQ4@GQP!!JQ<&AQDOGQ4]EP@]GQ4] |
|
94 |
GQ4@@A4TE2$)F1$ID14]GQT@GQ4]GR$)JR$)JR$)JR$"BQ4]GQ4U@A4]GQ4)JR$)JR$)JR$)JPPQD14]EP@]GP@@JR$)JR$)JR$)JR$)F@<SGQT@GQ4@GR$) |
|
95 |
JR$)JR$)JR$)F1(QGQ4U@A4]@@@)JR$)JR$)JR$)I XEC@<]EQ4]GQ4]GQ4@@A4T@R$)C"XFARH@GQT]GQ4]GQ4]@@@]E@D)J@8[F T"AA4UGQ4]GQ4]GQ4] |
|
96 |
GQPAB!!<N@ XZFRH]EQ4]GQ4]GQ4]GQ4T@P((C"XFARH"BQT]GQ4]GQ4]GQ4]EAPTEAPTEAPTEAPT@A4]GQ4]GQ4]GQ4]GQ4]GQ4@@@@@@@@]GQ4]GQ4]GQ4] |
|
97 |
GQ4]GQ4]@@@@@@@@GQ4]GQ4]GQ4]@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[250 250 255 225 225 237 236 236 244 213 213 228 245 245 252 241 241 248 239 239 246 216 216 230 210 210 224 252 252 255 229 229 239 248 248 254 244 244 250 219 219 232 234 234 243 253 253 255 232 232 241 249 249 254 224 224 236 254 254 255 156 156 182 208 208 223 206 206 221 204 204 219 246 246 253 242 242 249 240 240 247 238 238 245 215 215 229 255 255 255 211 211 225 230 230 240 228 228 238 201 201 218 243 243 249 222 222 235 220 220 233 218 218 231 235 235 244 233 233 242 231 231 240 248 0 0]; mask:((ImageMask new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@?8@A?8@C?8@G?8@G?8@G?8C??8C??8C??8C??8C??8@G?8@G?8@G?8@G?8@G?8@@@@@@@@@@@@') ; yourself); yourself] |
|
98 |
! |
|
99 |
||
100 |
fileOut22x22Icon |
|
101 |
"This resource specification was automatically generated |
|
102 |
by the ImageEditor of ST/X." |
|
103 |
||
104 |
"Do not manually edit this!! If it is corrupted, |
|
105 |
the ImageEditor may not be able to read the specification." |
|
106 |
||
107 |
" |
|
108 |
self fileOut22x22Icon inspect |
|
109 |
ImageEditor openOnClass:self andSelector:#fileOut22x22Icon |
|
110 |
Icon flushCachedIcons |
|
111 |
" |
|
112 |
||
113 |
<resource: #image> |
|
114 |
||
115 |
^Icon |
|
116 |
constantNamed:'BookmarksEditDialog class fileOut22x22Icon' |
|
117 |
ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
118 |
GQ4]GQ4]GQ4]GQ4]GQ4]GP@@@@@@@A4]GQ4]GQ4]GQ4]GQ4]GQ4@@@@@@@@]GQ4]GQ4]GQ4]GQ4]GQ4]@@@@@@@@GQ4]GQ4]GQ4]GQ4]EATUEQTUEQTU@A4] |
|
119 |
GQ4]GQ4]GQ4]EAT&I0PQGQ4]EP@]GQ4]GQ4]GQ4]EA8UI HKBQ4]GQT@GQ4]GQ4]GQ4]EAPTEBXFDP$]GQ4U@A4]GQ4]GQ4@GQP!!JQ<&AQDOGQ4]EP@]GQ4] |
|
120 |
GQ4@@A4TE2$)F1$ID14]GQT@GQ4]GR$)JR$)JR$)JR$"BQ4]GQ4U@A4]GQ4)JR$)JR$)JR$)JPPQD14]EP@]GP@@JR$)JR$)JR$)JR$)F@<SGQT@GQ4@GR$) |
|
121 |
JR$)JR$)JR$)F1(QGQ4U@A4]@@@)JR$)JR$)JR$)I XEC@<]EQ4]GQ4]GQ4@@A4T@R$)C"XFARH@GQT]GQ4]GQ4]@@@]E@D)J@8[F T"AA4UGQ4]GQ4]GQ4] |
|
122 |
GQPAB!!<N@ XZFRH]EQ4]GQ4]GQ4]GQ4T@P((C"XFARH"BQT]GQ4]GQ4]GQ4]EAPTEAPTEAPTEAPT@A4]GQ4]GQ4]GQ4]GQ4]GQ4@@@@@@@@]GQ4]GQ4]GQ4] |
|
123 |
GQ4]GQ4]@@@@@@@@GQ4]GQ4]GQ4]@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[250 250 255 225 225 237 236 236 244 213 213 228 245 245 252 241 241 248 239 239 246 216 216 230 210 210 224 252 252 255 229 229 239 248 248 254 244 244 250 219 219 232 234 234 243 253 253 255 232 232 241 249 249 254 224 224 236 254 254 255 156 156 182 208 208 223 206 206 221 204 204 219 246 246 253 242 242 249 240 240 247 238 238 245 215 215 229 255 255 255 211 211 225 230 230 240 228 228 238 201 201 218 243 243 249 222 222 235 220 220 233 218 218 231 235 235 244 233 233 242 231 231 240 248 0 0]; mask:((ImageMask new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@?8@A?8@C?8@G?8@G?8@G?8C??8C??8C??8C??8C??8@G?8@G?8@G?8@G?8@G?8@@@@@@@@@@@@') ; yourself); yourself] |
|
8014 | 124 |
! |
125 |
||
126 |
icon |
|
18297 | 127 |
<resource: #programImage> |
8014 | 128 |
|
129 |
^ ToolbarIconLibrary directoryBookmarksIcon |
|
18297 | 130 |
|
131 |
"Modified: / 28-07-2018 / 09:59:24 / Claus Gittinger" |
|
8262 | 132 |
! |
133 |
||
134 |
sort22x22Icon |
|
135 |
"This resource specification was automatically generated |
|
136 |
by the ImageEditor of ST/X." |
|
137 |
||
138 |
"Do not manually edit this!! If it is corrupted, |
|
139 |
the ImageEditor may not be able to read the specification." |
|
140 |
||
141 |
" |
|
142 |
self sort22x22Icon inspect |
|
143 |
ImageEditor openOnClass:self andSelector:#sort22x22Icon |
|
144 |
Icon flushCachedIcons |
|
145 |
" |
|
146 |
||
147 |
<resource: #image> |
|
148 |
||
149 |
^Icon |
|
150 |
constantNamed:'BookmarksEditDialog class sort22x22Icon' |
|
151 |
ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
152 |
GQ4]GQ4]GQ4]GQ4]GQ4]GP@@@@@@@A4]GQ4]GQ4]GQ4]GQ4]GQ4@@@@@@@@]GQ4*J"(*GQ4TEQTUEQTUEQTUEQT@GQ4*GQ4]J!!4]EATUEQTUEQTUEQTU@A4] |
|
153 |
J!!4]GR(]GQP&I"X&I0PQGQ4]EP@]GR(]GQ4*GQ4TI"(*I HKBQ4]GQT@GQ4]J"(*J"(]EBX&I"XFDP$]GQ4U@A4]GQ4]GP@@GQPAJ"(*AQDOGQ4]EP@]GQ4] |
|
154 |
J @@@@@T@PTEF1$ID14]GQT@GQ4]GR()JR$)E@D*J"(*BQ4]GQ4U@A4]@@@*JR$)JQPAAPTEAPPQD14]EP@]GP@]J"$)JR$T@R(*J"(*F@<SGQT@GQ4*J"(* |
|
155 |
J"$)E@DEAPTEF1(QGQ4UGQ4]GR(*J @@GQPAJ"(*J"(*C@<]EQ4]GQ4]J!!4@@A4T@PTEC"XFARH@GQT]GQ4]GQ4]GQ4]E@D*J"(*J"(*AA4UGQ4]J"(*J"(] |
|
156 |
GQPAB!!<N@ XZFRH]EQ4]GQ4]GR(@GQ4T@R(*J"(*J"(*GQT@GQ4]GR(@GQ4]E@DJJ@8&A T"H $U@A4]@B(]GQ4]GQPTEAPTEAPTEAPTE@@]GR(*J"(*GQ4] |
|
157 |
GQ4]GQ4]@@@@@@@@GQ4@@@@@@@@]@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[250 250 255 225 225 237 236 236 244 213 213 228 245 245 252 241 241 248 239 239 246 216 216 230 210 210 224 252 252 255 229 229 239 248 248 254 244 244 250 219 219 232 234 234 243 253 253 255 232 232 241 249 249 254 224 224 236 254 254 255 156 156 182 208 208 223 206 206 221 204 204 219 246 246 253 242 242 249 240 240 247 238 238 245 215 215 229 255 255 255 211 211 225 230 230 240 228 228 238 201 201 218 243 243 249 222 222 235 220 220 233 218 218 231 235 235 244 233 233 242 231 231 240 248 0 0 0 0 0]; mask:((ImageMask new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@G @@H''?8H''?8H''?8G7?8@G?8BG?8BG?8BG?8BG?8O''?8GG?8BG?8@G?8O''?8AG?8BG?8DG?8O @@@@@@') ; yourself); yourself] |
|
8014 | 158 |
! ! |
159 |
||
160 |
!BookmarksEditDialog class methodsFor:'interface specs'! |
|
161 |
||
162 |
windowSpec |
|
163 |
"This resource specification was automatically generated |
|
164 |
by the UIPainter of ST/X." |
|
165 |
||
166 |
"Do not manually edit this!! If it is corrupted, |
|
167 |
the UIPainter may not be able to read the specification." |
|
168 |
||
169 |
" |
|
170 |
UIPainter new openOnClass:BookmarksDialog andSelector:#windowSpec |
|
171 |
BookmarksDialog new openInterface:#windowSpec |
|
172 |
BookmarksDialog open |
|
173 |
" |
|
174 |
||
175 |
<resource: #canvas> |
|
176 |
||
177 |
^ |
|
178 |
#(FullSpec |
|
179 |
name: windowSpec |
|
180 |
window: |
|
181 |
(WindowSpec |
|
182 |
label: 'Edit Bookmarks' |
|
183 |
name: 'Edit Bookmarks' |
|
184 |
min: (Point 0 0) |
|
185 |
bounds: (Rectangle 0 0 450 296) |
|
186 |
) |
|
187 |
component: |
|
188 |
(SpecCollection |
|
189 |
collection: ( |
|
190 |
(MenuPanelSpec |
|
191 |
name: 'ToolBar' |
|
192 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
193 |
menu: toolBarMenu |
|
194 |
textDefault: true |
|
195 |
) |
|
196 |
(SequenceViewSpec |
|
197 |
name: 'BookmarkList' |
|
198 |
layout: (LayoutFrame 0 0 30 0 0 1 -30 1) |
|
199 |
model: selectedBookmarksHolder |
|
200 |
hasHorizontalScrollBar: true |
|
201 |
hasVerticalScrollBar: true |
|
202 |
isMultiSelect: true |
|
203 |
useIndex: false |
|
204 |
sequenceList: bookmarkListHolder |
|
205 |
) |
|
206 |
(HorizontalPanelViewSpec |
|
207 |
name: 'HorizontalPanel1' |
|
208 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
209 |
horizontalLayout: center |
|
210 |
verticalLayout: center |
|
211 |
horizontalSpace: 3 |
|
212 |
verticalSpace: 3 |
|
213 |
component: |
|
214 |
(SpecCollection |
|
215 |
collection: ( |
|
216 |
(ActionButtonSpec |
|
217 |
label: 'OK' |
|
218 |
name: 'Button1' |
|
219 |
translateLabel: true |
|
220 |
model: doAccept |
|
221 |
extent: (Point 125 22) |
|
222 |
) |
|
223 |
(ActionButtonSpec |
|
224 |
label: 'Cancel' |
|
225 |
name: 'Button2' |
|
226 |
translateLabel: true |
|
227 |
model: doCancel |
|
228 |
extent: (Point 125 22) |
|
229 |
) |
|
230 |
) |
|
231 |
||
232 |
) |
|
233 |
) |
|
234 |
) |
|
235 |
||
236 |
) |
|
237 |
) |
|
238 |
! ! |
|
239 |
||
240 |
!BookmarksEditDialog class methodsFor:'menu specs'! |
|
241 |
||
242 |
toolBarMenu |
|
243 |
"This resource specification was automatically generated |
|
244 |
by the MenuEditor of ST/X." |
|
245 |
||
246 |
"Do not manually edit this!! If it is corrupted, |
|
247 |
the MenuEditor may not be able to read the specification." |
|
248 |
||
17164 | 249 |
|
8014 | 250 |
" |
251 |
MenuEditor new openOnClass:BookmarksEditDialog andSelector:#toolBarMenu |
|
252 |
(Menu new fromLiteralArrayEncoding:(BookmarksEditDialog toolBarMenu)) startUp |
|
253 |
" |
|
254 |
||
255 |
<resource: #menu> |
|
256 |
||
257 |
^ |
|
258 |
#(Menu |
|
259 |
( |
|
260 |
(MenuItem |
|
17164 | 261 |
activeHelpKey: newBookmark |
9686 | 262 |
label: 'New...' |
8014 | 263 |
itemValue: new |
9679 | 264 |
isButton: true |
8014 | 265 |
labelImage: (ResourceRetriever XPToolbarIconLibrary newBookmark22x22Icon) |
266 |
) |
|
267 |
(MenuItem |
|
17164 | 268 |
activeHelpKey: removeBookmark |
8014 | 269 |
enabled: removeButtonEnabledHolder |
9686 | 270 |
label: 'Remove...' |
8014 | 271 |
itemValue: remove |
9679 | 272 |
isButton: true |
8014 | 273 |
labelImage: (ResourceRetriever XPToolbarIconLibrary close22x22Icon) |
274 |
) |
|
275 |
(MenuItem |
|
276 |
label: '-' |
|
277 |
) |
|
278 |
(MenuItem |
|
8262 | 279 |
activeHelpKey: moveUp |
8014 | 280 |
enabled: upButtonEnabledHolder |
281 |
label: 'Up' |
|
282 |
itemValue: up |
|
9679 | 283 |
isButton: true |
8014 | 284 |
labelImage: (ResourceRetriever XPToolbarIconLibrary up22x22Icon) |
285 |
) |
|
286 |
(MenuItem |
|
8262 | 287 |
activeHelpKey: moveDown |
8014 | 288 |
enabled: downButtonEnabledHolder |
289 |
label: 'Down' |
|
290 |
itemValue: down |
|
9679 | 291 |
isButton: true |
8014 | 292 |
labelImage: (ResourceRetriever XPToolbarIconLibrary down22x22Icon) |
293 |
) |
|
294 |
(MenuItem |
|
295 |
label: '-' |
|
296 |
) |
|
297 |
(MenuItem |
|
17164 | 298 |
activeHelpKey: sortBookmarks |
8262 | 299 |
enabled: sortButtonEnabledHolder |
300 |
label: 'Sort' |
|
301 |
itemValue: sort |
|
9679 | 302 |
isButton: true |
8262 | 303 |
labelImage: (ResourceRetriever BookmarksEditDialog sort22x22Icon) |
304 |
) |
|
305 |
(MenuItem |
|
306 |
label: '-' |
|
307 |
) |
|
308 |
(MenuItem |
|
17164 | 309 |
activeHelpKey: importBookmarks |
9686 | 310 |
label: 'Import...' |
8014 | 311 |
itemValue: import |
9679 | 312 |
isButton: true |
8262 | 313 |
labelImage: (ResourceRetriever XPToolbarIconLibrary fileIn22x22Icon) |
8014 | 314 |
) |
315 |
(MenuItem |
|
17164 | 316 |
activeHelpKey: exportBookmarks |
9686 | 317 |
label: 'Export...' |
8014 | 318 |
itemValue: export |
9679 | 319 |
isButton: true |
8262 | 320 |
labelImage: (ResourceRetriever BookmarksEditDialog fileOut22x22Icon) |
8014 | 321 |
) |
322 |
) |
|
323 |
nil |
|
324 |
nil |
|
325 |
) |
|
326 |
! ! |
|
327 |
||
328 |
!BookmarksEditDialog class methodsFor:'opening'! |
|
329 |
||
330 |
openWith: bookmarks |
|
331 |
||
332 |
^ self openWith: bookmarks defaultBookmark: '' |
|
333 |
! |
|
334 |
||
8662
a117da640cb7
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8262
diff
changeset
|
335 |
openWith:bookmarks defaultBookmark:aFilename |
8014 | 336 |
| dialog bookmarkStrings | |
337 |
||
17203 | 338 |
dialog := self new. |
8014 | 339 |
|
340 |
dialog allButOpenInterface:#windowSpec. |
|
341 |
||
17203 | 342 |
aFilename notNil ifTrue:[dialog defaultBookmark: aFilename asString]. |
8014 | 343 |
bookmarkStrings := bookmarks collect:[:each | each asString]. |
344 |
dialog bookmarkList: bookmarkStrings. |
|
345 |
dialog openWindow. |
|
346 |
^ dialog answer |
|
8662
a117da640cb7
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8262
diff
changeset
|
347 |
|
a117da640cb7
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8262
diff
changeset
|
348 |
" |
a117da640cb7
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8262
diff
changeset
|
349 |
Dialog aboutToOpenBoxNotificationSignal handle:[:ex | |
a117da640cb7
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8262
diff
changeset
|
350 |
self halt. |
a117da640cb7
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8262
diff
changeset
|
351 |
ex proceed |
a117da640cb7
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8262
diff
changeset
|
352 |
] do:[ |
a117da640cb7
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8262
diff
changeset
|
353 |
self openWith:#() defaultBookmark:nil |
a117da640cb7
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8262
diff
changeset
|
354 |
]. |
a117da640cb7
AboutToOpenBoxNotificationSignal moved to SimpleView and now raised
Claus Gittinger <cg@exept.de>
parents:
8262
diff
changeset
|
355 |
" |
8014 | 356 |
! ! |
357 |
||
358 |
!BookmarksEditDialog methodsFor:'accessing'! |
|
359 |
||
360 |
answer |
|
361 |
^ answer |
|
362 |
! |
|
363 |
||
364 |
bookmarkList |
|
365 |
||
366 |
^ self bookmarkListHolder. |
|
367 |
! |
|
368 |
||
369 |
bookmarkList: bookmarkStrings |
|
370 |
||
371 |
self bookmarkList contents: bookmarkStrings. |
|
8262 | 372 |
self sortButtonEnabledHolder value:(bookmarkStrings size > 0). |
8014 | 373 |
! |
374 |
||
375 |
defaultBookmark |
|
376 |
^ defaultBookmark |
|
377 |
! |
|
378 |
||
379 |
defaultBookmark:something |
|
380 |
defaultBookmark := something. |
|
381 |
! |
|
382 |
||
383 |
indexForNewBookmark |
|
384 |
||
385 |
| index | |
|
386 |
index := self selectedBookmarkIndex. |
|
387 |
index = 0 ifTrue:[^ self bookmarkList size]. |
|
388 |
^ index |
|
389 |
! |
|
390 |
||
391 |
indexOfBookmark: aString |
|
392 |
||
393 |
^ self bookmarkList indexOf: aString |
|
394 |
! |
|
395 |
||
396 |
selectBookmark: bookmark |
|
397 |
||
398 |
self selectedBookmarks: (Array with: bookmark). |
|
399 |
! |
|
400 |
||
401 |
selectedBookmarkIndex |
|
402 |
||
403 |
| someBookmarks | |
|
404 |
||
405 |
someBookmarks := self selectedBookmarks. |
|
406 |
someBookmarks size = 1 ifTrue:[ |
|
407 |
^ self indexOfBookmark: someBookmarks first |
|
408 |
]. |
|
409 |
^ 0 |
|
410 |
! |
|
411 |
||
412 |
selectedBookmarks |
|
413 |
||
414 |
^ self selectedBookmarksHolder value |
|
415 |
! |
|
416 |
||
417 |
selectedBookmarks: aCollection |
|
418 |
||
419 |
^ self selectedBookmarksHolder value: aCollection |
|
420 |
! ! |
|
421 |
||
422 |
!BookmarksEditDialog methodsFor:'aspects'! |
|
423 |
||
424 |
bookmarkListHolder |
|
425 |
<resource: #uiAspect> |
|
426 |
||
427 |
bookmarkListHolder isNil ifTrue:[ |
|
428 |
bookmarkListHolder := List new. |
|
429 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
430 |
"/ bookmarkListHolder addDependent:self. |
|
431 |
"/ bookmarkListHolder onChangeSend:#bookmarkListChanged to:self. |
|
432 |
]. |
|
433 |
^ bookmarkListHolder. |
|
434 |
! |
|
435 |
||
436 |
downButtonEnabledHolder |
|
437 |
||
438 |
^ builder valueAspectFor:#'downButtonEnabledHolder' initialValue:false |
|
439 |
! |
|
440 |
||
441 |
removeButtonEnabledHolder |
|
442 |
||
443 |
^ builder valueAspectFor:#'removeButtonEnabledHolder' initialValue:false |
|
444 |
! |
|
445 |
||
446 |
selectedBookmarksHolder |
|
447 |
<resource: #uiAspect> |
|
448 |
||
449 |
selectedBookmarksHolder isNil ifTrue:[ |
|
450 |
selectedBookmarksHolder := #() asValue. |
|
451 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
452 |
"/ selectedBookmarksHolder addDependent:self. |
|
453 |
selectedBookmarksHolder onChangeSend:#selectedBookmarksChanged to:self. |
|
454 |
]. |
|
455 |
^ selectedBookmarksHolder. |
|
456 |
! |
|
457 |
||
8262 | 458 |
sortButtonEnabledHolder |
459 |
||
460 |
^ builder valueAspectFor:#'sortButtonEnabledHolder' initialValue:false |
|
461 |
! |
|
462 |
||
8014 | 463 |
upButtonEnabledHolder |
464 |
||
465 |
^ builder valueAspectFor:#'upButtonEnabledHolder' initialValue:false |
|
466 |
! ! |
|
467 |
||
9354 | 468 |
!BookmarksEditDialog methodsFor:'initialization'! |
8014 | 469 |
|
470 |
initialize |
|
471 |
||
472 |
defaultBookmark := ''. |
|
473 |
^ super initialize. |
|
474 |
! ! |
|
475 |
||
476 |
!BookmarksEditDialog methodsFor:'menu actions'! |
|
477 |
||
478 |
down |
|
479 |
||
480 |
| someBookmarks bookmarkToMove index | |
|
481 |
||
482 |
someBookmarks := self selectedBookmarks. |
|
483 |
someBookmarks size = 1 ifFalse:[^ self]. |
|
484 |
bookmarkToMove := someBookmarks first. |
|
485 |
index := self indexOfBookmark: bookmarkToMove. |
|
486 |
index = self bookmarkList size ifTrue:[^self]. |
|
487 |
self bookmarkList remove: bookmarkToMove. |
|
488 |
self bookmarkList add: bookmarkToMove afterIndex: index. |
|
489 |
self selectBookmark: bookmarkToMove. |
|
490 |
! |
|
491 |
||
492 |
export |
|
493 |
||
494 |
| filename bookmarks | |
|
495 |
||
496 |
filename := Dialog |
|
9605 | 497 |
requestFileNameForSave:(resources string:'Select file to export bookmarks:') |
8014 | 498 |
default:'.fileBrowserBookmarks' |
499 |
fromDirectory:Filename desktopDirectory. |
|
500 |
filename isEmptyOrNil ifTrue:[^ self]. |
|
501 |
||
502 |
bookmarks := self bookmarkList. |
|
503 |
AbstractFileBrowser saveBookmarks: bookmarks in:filename. |
|
9605 | 504 |
|
505 |
"Modified: / 27-10-2010 / 11:29:02 / cg" |
|
8014 | 506 |
! |
507 |
||
508 |
import |
|
509 |
| answer filename bookmarksFromFile bookmarksToAdd bookmarks| |
|
510 |
||
511 |
answer := Dialog |
|
8262 | 512 |
requestFileName:(resources string:'Select file to import bookmarks:') |
8014 | 513 |
default:'.fileBrowserBookmarks' |
514 |
fromDirectory:Filename desktopDirectory. |
|
515 |
||
516 |
answer isEmptyOrNil ifTrue:[^ self]. |
|
517 |
filename := answer asFilename. |
|
518 |
(filename isDirectory or:[filename exists not]) ifTrue:[^ self]. |
|
519 |
bookmarksFromFile := AbstractFileBrowser bookmarksFrom: filename. |
|
520 |
||
521 |
bookmarks := self bookmarkList. |
|
522 |
bookmarksToAdd := bookmarksFromFile reject:[:each | bookmarks includes: each]. |
|
523 |
bookmarks addAll: bookmarksToAdd. |
|
8262 | 524 |
|
525 |
self sortButtonEnabledHolder value:(bookmarks size > 0). |
|
8014 | 526 |
! |
527 |
||
528 |
new |
|
529 |
||
530 |
| someBookmarks default index bookmark| |
|
531 |
||
532 |
someBookmarks := self selectedBookmarks. |
|
533 |
||
534 |
default := someBookmarks isEmpty |
|
535 |
ifTrue:[defaultBookmark] |
|
536 |
ifFalse:[someBookmarks first]. |
|
537 |
||
538 |
bookmark := Dialog request:'New Bookmark' title:'Enter a directory' initialAnswer:default. |
|
539 |
bookmark isEmptyOrNil ifTrue:[^ self]. |
|
540 |
(self bookmarkList includes: bookmark) ifTrue:[^ self]. |
|
541 |
||
542 |
index := self indexForNewBookmark. |
|
543 |
self bookmarkList add: bookmark afterIndex: index. |
|
544 |
self selectBookmark: bookmark. |
|
545 |
! |
|
546 |
||
547 |
remove |
|
548 |
||
549 |
| someBookmarks message ans | |
|
550 |
||
551 |
someBookmarks := self selectedBookmarks. |
|
552 |
someBookmarks isEmpty ifTrue:[^ self]. |
|
553 |
||
554 |
message := 'Really remove bookmarks: ', String lf. |
|
555 |
someBookmarks do:[:each | message := message, String lf, (String new: 5) , each]. |
|
556 |
ans := Dialog confirm: message. |
|
557 |
ans ifFalse:[^ self]. |
|
558 |
||
559 |
self bookmarkList removeAll: someBookmarks. |
|
560 |
! |
|
561 |
||
8262 | 562 |
sort |
563 |
self bookmarkList sort. |
|
564 |
! |
|
565 |
||
8014 | 566 |
up |
567 |
||
568 |
| someBookmarks bookmarkToMove index | |
|
569 |
||
570 |
someBookmarks := self selectedBookmarks. |
|
571 |
someBookmarks size = 1 ifFalse:[^ self]. |
|
572 |
bookmarkToMove := someBookmarks first. |
|
573 |
index := self indexOfBookmark: bookmarkToMove. |
|
574 |
index = 1 ifTrue:[^self]. |
|
575 |
self bookmarkList remove: bookmarkToMove. |
|
576 |
self bookmarkList add: bookmarkToMove beforeIndex: index - 1. |
|
577 |
self selectBookmark: bookmarkToMove. |
|
578 |
! ! |
|
579 |
||
580 |
!BookmarksEditDialog methodsFor:'queries'! |
|
581 |
||
582 |
hasChanges |
|
583 |
||
584 |
|oldDirectoryBookmarks| |
|
585 |
||
586 |
oldDirectoryBookmarks := AbstractFileBrowser directoryBookmarks collect:[:each | each asString]. |
|
8023 | 587 |
^ self bookmarkList asOrderedCollection ~= oldDirectoryBookmarks |
8014 | 588 |
! ! |
589 |
||
590 |
!BookmarksEditDialog methodsFor:'user actions'! |
|
591 |
||
592 |
doAccept |
|
593 |
||
594 |
| filenames | |
|
595 |
||
596 |
filenames := self bookmarkList collect:[:each | each asFilename]. |
|
597 |
answer := filenames. |
|
598 |
^ super doAccept |
|
599 |
! |
|
600 |
||
601 |
doCancel |
|
602 |
| ans | |
|
603 |
||
604 |
self hasChanges ifTrue:[ |
|
9680 | 605 |
ans := Dialog confirm:(resources string:'Really forget all changes?'). |
8014 | 606 |
ans ifFalse:[^ self]. |
607 |
]. |
|
608 |
^ super doCancel |
|
9680 | 609 |
|
610 |
"Modified: / 13-01-2011 / 12:59:20 / cg" |
|
8014 | 611 |
! |
612 |
||
613 |
selectedBookmarksChanged |
|
614 |
| someBookmarks selectedBookmarkIndex | |
|
615 |
||
616 |
someBookmarks := self selectedBookmarks. |
|
617 |
||
618 |
self upButtonEnabledHolder value: false. |
|
619 |
self downButtonEnabledHolder value: false. |
|
620 |
self removeButtonEnabledHolder value: false. |
|
621 |
||
622 |
someBookmarks isEmpty ifTrue:[^ self]. |
|
623 |
||
624 |
someBookmarks size = 1 ifTrue:[ |
|
625 |
selectedBookmarkIndex := self selectedBookmarkIndex. |
|
626 |
selectedBookmarkIndex = 1 ifFalse:[ |
|
627 |
self upButtonEnabledHolder value: true. |
|
628 |
]. |
|
629 |
selectedBookmarkIndex = self bookmarkList size ifFalse:[ |
|
630 |
self downButtonEnabledHolder value: true. |
|
631 |
]. |
|
632 |
] ifFalse:[ |
|
633 |
self upButtonEnabledHolder value: false. |
|
634 |
self downButtonEnabledHolder value: false. |
|
635 |
]. |
|
636 |
self removeButtonEnabledHolder value: true. |
|
637 |
! ! |
|
638 |
||
639 |
!BookmarksEditDialog class methodsFor:'documentation'! |
|
640 |
||
641 |
version |
|
17164 | 642 |
^ '$Header$' |
8812 | 643 |
! |
644 |
||
645 |
version_CVS |
|
17164 | 646 |
^ '$Header$' |
8014 | 647 |
! ! |
17164 | 648 |