BookmarksEditDialog.st
changeset 8262 69dabd2e594a
parent 8023 7fd192f7449e
child 8662 a117da640cb7
equal deleted inserted replaced
8261:caa4bb627c03 8262:69dabd2e594a
     6 	poolDictionaries:''
     6 	poolDictionaries:''
     7 	category:'Interface-Tools-File'
     7 	category:'Interface-Tools-File'
     8 !
     8 !
     9 
     9 
    10 
    10 
       
    11 !BookmarksEditDialog class methodsFor:'help specs'!
       
    12 
       
    13 flyByHelpSpec
       
    14     <resource: #help>
       
    15 
       
    16     ^ super flyByHelpSpec addPairsFrom:#(
       
    17 
       
    18 #moveUp
       
    19 'Move Up'
       
    20 
       
    21 #moveDown
       
    22 'Move Down'
       
    23 
       
    24 ).
       
    25 ! !
       
    26 
    11 !BookmarksEditDialog class methodsFor:'image specs'!
    27 !BookmarksEditDialog class methodsFor:'image specs'!
    12 
    28 
    13 fileIn22x22Icon
    29 fileIn22x22Icon
    14     "This resource specification was automatically generated
    30     "This resource specification was automatically generated
    15      by the ImageEditor of ST/X."
    31      by the ImageEditor of ST/X."
    24     "
    40     "
    25 
    41 
    26     <resource: #image>
    42     <resource: #image>
    27 
    43 
    28     ^Icon
    44     ^Icon
    29         constantNamed:'BookmarksDialog class fileIn22x22Icon'
    45         constantNamed:'BookmarksEditDialog class fileIn22x22Icon'
    30         ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
    46         ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
    31 @@@@@@@@GQ4]GQ4]GQ4]GQ4]GQ4]GP@@@@@@@A4]GQ4]GQ4]GQ4]GQ4]GQ4@@@@@@@@]GQ4]GQ4]GQ4]GQ4]GQ4]@ATUEQTUEQTUEA4]GQ4]GQ4]GQ4]GP@U
    47 GQ4]GQ4]GQ4]GQ4]GQ4]GP@@@@@@@A4]GQ4]GQ4]GQ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@]GQ4]
    51 GQPAB!!<N@ XZFRH]EQ4]GQ4]GQ4]GQ4T@P((C"XFARH"BQT]GQ4]GQ4]GQ4]EAPTEAPTEAPTEAPT@A4]GQ4]GQ4]GQ4]GQ4]GQ4@@@@@@@@]GQ4]GQ4]GQ4]
    36 GQ4]GQ4]GQ4]GQ4]@@@@@@@@@@@@@@@@@A4]GQ4]GQ4]GP@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:'@@@@@@@@@@@@_<@@_>@@_?@@_? @_? @_? @_??@_??@_??@_??@_??@_? @_? @_? @_? @_? @@@@@@@@@@@@@') ; yourself); yourself]
    52 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]
       
    53 !
       
    54 
       
    55 fileOut22x22Icon
       
    56     "This resource specification was automatically generated
       
    57      by the ImageEditor of ST/X."
       
    58 
       
    59     "Do not manually edit this!! If it is corrupted,
       
    60      the ImageEditor may not be able to read the specification."
       
    61 
       
    62     "
       
    63      self fileOut22x22Icon inspect
       
    64      ImageEditor openOnClass:self andSelector:#fileOut22x22Icon
       
    65      Icon flushCachedIcons
       
    66     "
       
    67 
       
    68     <resource: #image>
       
    69 
       
    70     ^Icon
       
    71         constantNamed:'BookmarksEditDialog class fileOut22x22Icon'
       
    72         ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
       
    73 GQ4]GQ4]GQ4]GQ4]GQ4]GP@@@@@@@A4]GQ4]GQ4]GQ4]GQ4]GQ4@@@@@@@@]GQ4]GQ4]GQ4]GQ4]GQ4]@@@@@@@@GQ4]GQ4]GQ4]GQ4]EATUEQTUEQTU@A4]
       
    74 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]
       
    75 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$)
       
    76 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]
       
    77 GQPAB!!<N@ XZFRH]EQ4]GQ4]GQ4]GQ4T@P((C"XFARH"BQT]GQ4]GQ4]GQ4]EAPTEAPTEAPTEAPT@A4]GQ4]GQ4]GQ4]GQ4]GQ4@@@@@@@@]GQ4]GQ4]GQ4]
       
    78 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]
    37 !
    79 !
    38 
    80 
    39 icon
    81 icon
    40 
    82 
    41     ^ ToolbarIconLibrary directoryBookmarksIcon
    83     ^ ToolbarIconLibrary directoryBookmarksIcon
       
    84 !
       
    85 
       
    86 sort22x22Icon
       
    87     "This resource specification was automatically generated
       
    88      by the ImageEditor of ST/X."
       
    89 
       
    90     "Do not manually edit this!! If it is corrupted,
       
    91      the ImageEditor may not be able to read the specification."
       
    92 
       
    93     "
       
    94      self sort22x22Icon inspect
       
    95      ImageEditor openOnClass:self andSelector:#sort22x22Icon
       
    96      Icon flushCachedIcons
       
    97     "
       
    98 
       
    99     <resource: #image>
       
   100 
       
   101     ^Icon
       
   102         constantNamed:'BookmarksEditDialog class sort22x22Icon'
       
   103         ifAbsentPut:[(Depth8Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
       
   104 GQ4]GQ4]GQ4]GQ4]GQ4]GP@@@@@@@A4]GQ4]GQ4]GQ4]GQ4]GQ4@@@@@@@@]GQ4*J"(*GQ4TEQTUEQTUEQTUEQT@GQ4*GQ4]J!!4]EATUEQTUEQTUEQTU@A4]
       
   105 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]
       
   106 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"(*
       
   107 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"(]
       
   108 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]
       
   109 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]
    42 ! !
   110 ! !
    43 
   111 
    44 !BookmarksEditDialog class methodsFor:'interface specs'!
   112 !BookmarksEditDialog class methodsFor:'interface specs'!
    45 
   113 
    46 windowSpec
   114 windowSpec
   155           )
   223           )
   156          (MenuItem
   224          (MenuItem
   157             label: '-'
   225             label: '-'
   158           )
   226           )
   159          (MenuItem
   227          (MenuItem
       
   228             activeHelpKey: moveUp
   160             enabled: upButtonEnabledHolder
   229             enabled: upButtonEnabledHolder
   161             label: 'Up'
   230             label: 'Up'
   162             itemValue: up
   231             itemValue: up
   163             translateLabel: true
   232             translateLabel: true
   164             labelImage: (ResourceRetriever XPToolbarIconLibrary up22x22Icon)
   233             labelImage: (ResourceRetriever XPToolbarIconLibrary up22x22Icon)
   165           )
   234           )
   166          (MenuItem
   235          (MenuItem
       
   236             activeHelpKey: moveDown
   167             enabled: downButtonEnabledHolder
   237             enabled: downButtonEnabledHolder
   168             label: 'Down'
   238             label: 'Down'
   169             itemValue: down
   239             itemValue: down
   170             translateLabel: true
   240             translateLabel: true
   171             labelImage: (ResourceRetriever XPToolbarIconLibrary down22x22Icon)
   241             labelImage: (ResourceRetriever XPToolbarIconLibrary down22x22Icon)
   172           )
   242           )
   173          (MenuItem
   243          (MenuItem
   174             label: '-'
   244             label: '-'
   175           )
   245           )
   176          (MenuItem
   246          (MenuItem
       
   247             enabled: sortButtonEnabledHolder
       
   248             label: 'Sort'
       
   249             itemValue: sort
       
   250             translateLabel: true
       
   251             labelImage: (ResourceRetriever BookmarksEditDialog sort22x22Icon)
       
   252           )
       
   253          (MenuItem
       
   254             label: '-'
       
   255           )
       
   256          (MenuItem
   177             label: 'Import'
   257             label: 'Import'
   178             itemValue: import
   258             itemValue: import
   179             translateLabel: true
   259             translateLabel: true
   180             labelImage: (ResourceRetriever BookmarksEditDialog fileIn22x22Icon)
   260             labelImage: (ResourceRetriever XPToolbarIconLibrary fileIn22x22Icon)
   181           )
   261           )
   182          (MenuItem
   262          (MenuItem
   183             label: 'Export'
   263             label: 'Export'
   184             itemValue: export
   264             itemValue: export
   185             translateLabel: true
   265             translateLabel: true
   186             labelImage: (ResourceRetriever XPToolbarIconLibrary fileIn22x22Icon)
   266             labelImage: (ResourceRetriever BookmarksEditDialog fileOut22x22Icon)
   187           )
   267           )
   188          )
   268          )
   189         nil
   269         nil
   190         nil
   270         nil
   191       )
   271       )
   226 !
   306 !
   227 
   307 
   228 bookmarkList: bookmarkStrings
   308 bookmarkList: bookmarkStrings
   229 
   309 
   230     self bookmarkList contents: bookmarkStrings.
   310     self bookmarkList contents: bookmarkStrings.
       
   311     self sortButtonEnabledHolder value:(bookmarkStrings size > 0).
   231 !
   312 !
   232 
   313 
   233 defaultBookmark
   314 defaultBookmark
   234     ^ defaultBookmark
   315     ^ defaultBookmark
   235 !
   316 !
   309 "/ if your app needs to be notified of changes, uncomment one of the lines below:
   390 "/ if your app needs to be notified of changes, uncomment one of the lines below:
   310 "/       selectedBookmarksHolder addDependent:self.
   391 "/       selectedBookmarksHolder addDependent:self.
   311        selectedBookmarksHolder onChangeSend:#selectedBookmarksChanged to:self.
   392        selectedBookmarksHolder onChangeSend:#selectedBookmarksChanged to:self.
   312     ].
   393     ].
   313     ^ selectedBookmarksHolder.
   394     ^ selectedBookmarksHolder.
       
   395 !
       
   396 
       
   397 sortButtonEnabledHolder
       
   398 
       
   399     ^ builder valueAspectFor:#'sortButtonEnabledHolder' initialValue:false
   314 !
   400 !
   315 
   401 
   316 upButtonEnabledHolder
   402 upButtonEnabledHolder
   317 
   403 
   318     ^ builder valueAspectFor:#'upButtonEnabledHolder' initialValue:false
   404     ^ builder valueAspectFor:#'upButtonEnabledHolder' initialValue:false
   345 export
   431 export
   346 
   432 
   347     | filename bookmarks |
   433     | filename bookmarks |
   348 
   434 
   349     filename := Dialog 
   435     filename := Dialog 
   350         requestFileName:'Select file to export bookmarks:' 
   436         requestFileName:(resources string:'Select file to export bookmarks:') 
   351         default:'.fileBrowserBookmarks'
   437         default:'.fileBrowserBookmarks'
   352         fromDirectory:Filename desktopDirectory. 
   438         fromDirectory:Filename desktopDirectory. 
   353     filename isEmptyOrNil ifTrue:[^ self].
   439     filename isEmptyOrNil ifTrue:[^ self].
   354 
   440 
   355     bookmarks := self bookmarkList.
   441     bookmarks := self bookmarkList.
   356     AbstractFileBrowser saveBookmarks: bookmarks in:filename.
   442     AbstractFileBrowser saveBookmarks: bookmarks in:filename.
   357 !
   443 !
   358 
   444 
   359 import
   445 import
   360 
       
   361     | answer filename bookmarksFromFile bookmarksToAdd bookmarks|
   446     | answer filename bookmarksFromFile bookmarksToAdd bookmarks|
   362 
   447 
   363     answer := Dialog 
   448     answer := Dialog 
   364         requestFileName:'Select file to import bookmarks:' 
   449         requestFileName:(resources string:'Select file to import bookmarks:') 
   365         default:'.fileBrowserBookmarks'
   450         default:'.fileBrowserBookmarks'
   366         fromDirectory:Filename desktopDirectory.
   451         fromDirectory:Filename desktopDirectory.
   367 
   452 
   368     answer isEmptyOrNil ifTrue:[^ self].
   453     answer isEmptyOrNil ifTrue:[^ self].
   369     filename := answer asFilename.
   454     filename := answer asFilename.
   371     bookmarksFromFile := AbstractFileBrowser bookmarksFrom: filename.
   456     bookmarksFromFile := AbstractFileBrowser bookmarksFrom: filename.
   372 
   457 
   373     bookmarks := self bookmarkList.
   458     bookmarks := self bookmarkList.
   374     bookmarksToAdd := bookmarksFromFile reject:[:each | bookmarks includes: each].
   459     bookmarksToAdd := bookmarksFromFile reject:[:each | bookmarks includes: each].
   375     bookmarks addAll: bookmarksToAdd.
   460     bookmarks addAll: bookmarksToAdd.
       
   461 
       
   462     self sortButtonEnabledHolder value:(bookmarks size > 0).
   376 !
   463 !
   377 
   464 
   378 new
   465 new
   379 
   466 
   380     | someBookmarks default index bookmark|
   467     | someBookmarks default index bookmark|
   405     someBookmarks do:[:each | message := message, String lf, (String new: 5) , each].
   492     someBookmarks do:[:each | message := message, String lf, (String new: 5) , each].
   406     ans := Dialog confirm: message.
   493     ans := Dialog confirm: message.
   407     ans ifFalse:[^ self].
   494     ans ifFalse:[^ self].
   408 
   495 
   409     self bookmarkList removeAll: someBookmarks.
   496     self bookmarkList removeAll: someBookmarks.
       
   497 !
       
   498 
       
   499 sort
       
   500     self bookmarkList sort.
   410 !
   501 !
   411 
   502 
   412 up
   503 up
   413 
   504 
   414     | someBookmarks bookmarkToMove index |
   505     | someBookmarks bookmarkToMove index |
   454     ].
   545     ].
   455     ^ super doCancel
   546     ^ super doCancel
   456 !
   547 !
   457 
   548 
   458 selectedBookmarksChanged
   549 selectedBookmarksChanged
   459 
       
   460     | someBookmarks selectedBookmarkIndex |
   550     | someBookmarks selectedBookmarkIndex |
   461 
   551 
   462     someBookmarks := self selectedBookmarks.
   552     someBookmarks := self selectedBookmarks.
   463 
   553 
   464     self upButtonEnabledHolder value: false.
   554     self upButtonEnabledHolder value: false.
   483 ! !
   573 ! !
   484 
   574 
   485 !BookmarksEditDialog class methodsFor:'documentation'!
   575 !BookmarksEditDialog class methodsFor:'documentation'!
   486 
   576 
   487 version
   577 version
   488     ^ '$Header: /cvs/stx/stx/libtool/BookmarksEditDialog.st,v 1.2 2008-03-12 16:50:33 fm Exp $'
   578     ^ '$Header: /cvs/stx/stx/libtool/BookmarksEditDialog.st,v 1.3 2008-09-04 08:04:56 cg Exp $'
   489 ! !
   579 ! !