list all images from the retriever in a list
authortz
Mon, 29 Jun 1998 16:42:47 +0200
changeset 879 9f1a94815f07
parent 878 a00ba144e64f
child 880 a344e9ef09dc
list all images from the retriever in a list
MenuEditor.st
--- a/MenuEditor.st	Mon Jun 29 15:51:55 1998 +0200
+++ b/MenuEditor.st	Mon Jun 29 16:42:47 1998 +0200
@@ -892,17 +892,25 @@
           #window: 
            #(#WindowSpec
               #name: 'Image Item'
-              #layout: #(#LayoutFrame 473 0 301 0 717 0 442 0)
+              #layout: #(#LayoutFrame 252 0 359 0 647 0 635 0)
               #label: 'Image Item'
               #min: #(#Point 10 10)
               #max: #(#Point 1280 1024)
-              #bounds: #(#Rectangle 473 301 718 443)
+              #bounds: #(#Rectangle 252 359 648 636)
               #usePreferredExtent: false
           )
           #component: 
            #(#SpecCollection
               #collection: 
                #(
+                 #(#CheckBoxSpec
+                    #name: 'iconAndLabelCheckBox'
+                    #layout: #(#LayoutOrigin 20 0 215 0)
+                    #activeHelpKey: #imageImageAndLabel
+                    #tabable: true
+                    #model: #iconAndLabel
+                    #label: 'Image & Label'
+                )
                  #(#LabelSpec
                     #name: 'retrieverLabel'
                     #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5)
@@ -939,19 +947,22 @@
                 )
                  #(#ActionButtonSpec
                     #name: 'imageEditorButton'
-                    #layout: #(#LayoutFrame 110 0 66 0 -5 1 90 0)
+                    #layout: #(#LayoutFrame 5 0.6 67 0 -5 1 91 0)
                     #activeHelpKey: #imageImageEditor
                     #label: 'Image Editor'
                     #tabable: true
                     #model: #doEditImage
                 )
-                 #(#CheckBoxSpec
-                    #name: 'iconAndLabel'
-                    #layout: #(#LayoutOrigin 20 0 104 0)
-                    #activeHelpKey: #imageImageAndLabel
-                    #tabable: true
-                    #model: #iconAndLabel
-                    #label: 'Image & Label'
+                 #(#SequenceViewSpec
+                    #name: 'systemOrUserImagesList'
+                    #layout: #(#LayoutFrame 110 0 66 0 0 0.6 200 0)
+                    #model: #selectionOfImage
+                    #hasHorizontalScrollBar: true
+                    #hasVerticalScrollBar: true
+                    #miniScrollerHorizontal: true
+                    #valueChangeSelector: #imageSelected
+                    #useIndex: false
+                    #sequenceList: #listOfImages
                 )
               )
           )
@@ -1432,21 +1443,21 @@
                 #isButton: true
                 #value: #doNew
                 #activeHelpKey: #fileNew
-                #labelImage: #(#ResourceRetriever nil #newIcon)
+                #labelImage: #(#ResourceRetriever #Icon #newIcon)
             )
              #(#MenuItem
                 #label: 'Load'
                 #isButton: true
                 #value: #doLoad
                 #activeHelpKey: #fileLoad
-                #labelImage: #(#ResourceRetriever nil #loadIcon)
+                #labelImage: #(#ResourceRetriever #Icon #loadIcon)
             )
              #(#MenuItem
                 #label: 'Save'
                 #isButton: true
                 #value: #doSave
                 #activeHelpKey: #fileSave
-                #labelImage: #(#ResourceRetriever nil #saveIcon)
+                #labelImage: #(#ResourceRetriever #Icon #saveIcon)
             )
              #(#MenuItem
                 #label: ''
@@ -1457,7 +1468,7 @@
                 #value: #doCut
                 #activeHelpKey: #editCut
                 #enabled: #hasValidSelection
-                #labelImage: #(#ResourceRetriever nil #cutIcon)
+                #labelImage: #(#ResourceRetriever #Icon #cutIcon)
             )
              #(#MenuItem
                 #label: 'Copy'
@@ -1465,7 +1476,7 @@
                 #value: #doCopy
                 #activeHelpKey: #editCopy
                 #enabled: #hasValidSelection
-                #labelImage: #(#ResourceRetriever nil #copyIcon)
+                #labelImage: #(#ResourceRetriever #Icon #copyIcon)
             )
              #(#MenuItem
                 #label: 'Paste'
@@ -1473,7 +1484,7 @@
                 #value: #doPaste
                 #activeHelpKey: #editPaste
                 #enabled: #valueOfCanPaste
-                #labelImage: #(#ResourceRetriever nil #pasteIcon)
+                #labelImage: #(#ResourceRetriever #Icon #pasteIcon)
             )
              #(#MenuItem
                 #label: 'Delete'
@@ -1481,7 +1492,7 @@
                 #value: #doDelete
                 #activeHelpKey: #editDelete
                 #enabled: #hasValidSelection
-                #labelImage: #(#ResourceRetriever nil #deleteIcon)
+                #labelImage: #(#ResourceRetriever #Icon #deleteIcon)
             )
              #(#MenuItem
                 #label: ''
@@ -1527,7 +1538,7 @@
                 #value: #doStepUp
                 #activeHelpKey: #editMoveUp
                 #enabled: #valueOfEnableMovingUpOrDown
-                #labelImage: #(#ResourceRetriever nil #upIcon)
+                #labelImage: #(#ResourceRetriever #Icon #upIcon)
             )
              #(#MenuItem
                 #label: 'Move Down'
@@ -1535,7 +1546,7 @@
                 #value: #doStepDown
                 #activeHelpKey: #editMoveDown
                 #enabled: #valueOfEnableMovingUpOrDown
-                #labelImage: #(#ResourceRetriever nil #downIcon)
+                #labelImage: #(#ResourceRetriever #Icon #downIcon)
             )
              #(#MenuItem
                 #label: 'Move In'
@@ -1543,7 +1554,7 @@
                 #value: #doStepIn
                 #activeHelpKey: #editMoveIn
                 #enabled: #valueOfEnableMovingIn
-                #labelImage: #(#ResourceRetriever nil #downRightIcon)
+                #labelImage: #(#ResourceRetriever #Icon #downRightIcon)
             )
              #(#MenuItem
                 #label: 'Move Out'
@@ -1551,7 +1562,7 @@
                 #value: #doStepOut
                 #activeHelpKey: #editMoveOut
                 #enabled: #valueOfEnableMovingOut
-                #labelImage: #(#ResourceRetriever nil #leftDownIcon)
+                #labelImage: #(#ResourceRetriever #Icon #leftDownIcon)
             )
           ) nil
           nil
@@ -1648,6 +1659,19 @@
     ^builder booleanValueAspectFor: #hasValidSingleSelection
 !
 
+listOfImages
+    "get a list of the images"
+
+    |holder|
+    (holder := builder bindingAt:#listOfImages) isNil ifTrue:[
+        builder aspectAt:#listOfImages put: (holder := List new).
+        self updateListOfImages    
+    ].
+    ^ holder
+
+
+!
+
 noteBookView
     "create the note book view containing the attibute sections and the help tool"
 
@@ -1670,6 +1694,18 @@
     ^ noteBook
 !
 
+selectionOfImage
+    "get selection of list of the images as value"
+
+    |holder|
+    (holder := builder bindingAt:#selectionOfImage) isNil ifTrue:[
+        builder aspectAt:#selectionOfImage put: (holder := nil asValue).
+    ].
+    ^ holder
+
+
+!
+
 tabList
     "get a value holder with the list of the attribute sections (slices)"
 
@@ -1724,6 +1760,7 @@
     |node parent next state|
 
     state := false.   
+    self updateSelectionOfImage.
 
     (node  := self treeView selectedNode) notNil
     ifTrue:
@@ -1755,6 +1792,35 @@
     self hasValidSingleSelection     value:false.
     self hasValidSelection           value:state.     
     self valueOfCanPaste             value:(self hasValidSingleSelection value or: [node == self treeView root]) & self valueOfCanPaste value. 
+
+!
+
+updateListAndSelectionOfImage
+    "updates the list and selection of image"
+
+    self updateListOfImages.
+    self updateSelectionOfImage
+!
+
+updateListOfImages
+    "updates the list of images"
+
+    |iconClass|
+    iconClass := Smalltalk at: (aspects at: #retriever) value ? specClass.
+    self listOfImages contents:
+        ((self class getAllImageSelectorsFrom: iconClass)
+            collect: [:sel| |image| image := iconClass perform: sel. LabelAndIcon icon:(image magnifiedBy: 22/image extent y ) string: sel]).
+
+
+!
+
+updateSelectionOfImage
+    "updates the selection of image"
+
+    self selectionOfImage value: nil.
+    self updateListOfImages.
+    self selectionOfImage value: (self listOfImages detect: [:im| im string == (aspects at: #icon) value] ifNone: nil).
+
 ! !
 
 !MenuEditor methodsFor:'event handling'!
@@ -1810,6 +1876,12 @@
 
 !MenuEditor methodsFor:'selection'!
 
+imageSelected
+
+    (aspects at: #icon) value: self selectionOfImage value string
+
+!
+
 menuChanged
 
     |node item slc sel old|
@@ -1892,8 +1964,7 @@
         aspects do: [:holder| holder addDependent:self].
         self updateFonts.
         specCanvas raise.
-    ]    
-
+    ]
 ! !
 
 !MenuEditor methodsFor:'startup / release'!
@@ -1954,7 +2025,8 @@
             specSelector := self treeView selectorName.
         ]
     ].   
-    self updateInfoLabel
+    self updateInfoLabel.
+    self updateListAndSelectionOfImage
 !
 
 cancel
@@ -1972,6 +2044,13 @@
     modified := false
 !
 
+doEditImage
+
+    super doEditImage.
+
+    self updateListAndSelectionOfImage
+!
+
 doNew
 
     super doNew ifTrue: [self helpTool doNew]