MenuEditor.st
changeset 1301 dc5c4a8e6e6e
parent 1299 2e9c6d67fed8
child 1321 7894e542c64b
equal deleted inserted replaced
1300:7514e12ff1b8 1301:dc5c4a8e6e6e
  1088        #(#WindowSpec
  1088        #(#WindowSpec
  1089           #label: 'Image Item'
  1089           #label: 'Image Item'
  1090           #name: 'Image Item'
  1090           #name: 'Image Item'
  1091           #min: #(#Point 10 10)
  1091           #min: #(#Point 10 10)
  1092           #max: #(#Point 1280 1024)
  1092           #max: #(#Point 1280 1024)
  1093           #bounds: #(#Rectangle 11 177 407 454)
  1093           #bounds: #(#Rectangle 15 153 411 430)
  1094         )
  1094         )
  1095         #component: 
  1095         #component: 
  1096        #(#SpecCollection
  1096        #(#SpecCollection
  1097           #collection: #(
  1097           #collection: #(
  1098            #(#CheckBoxSpec
       
  1099               #label: 'Image & Label'
       
  1100               #name: 'iconAndLabelCheckBox'
       
  1101               #layout: #(#LayoutOrigin 20 0 215 0)
       
  1102               #activeHelpKey: #imageImageAndLabel
       
  1103               #tabable: true
       
  1104               #model: #iconAndLabel
       
  1105             )
       
  1106            #(#LabelSpec
  1098            #(#LabelSpec
  1107               #label: 'Retriever:'
  1099               #label: 'Retriever:'
  1108               #name: 'retrieverLabel'
  1100               #name: 'retrieverLabel'
  1109               #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5)
  1101               #layout: #(#AlignmentOrigin 107 0 26 0 1 0.5)
  1110               #activeHelpKey: #imageRetriever
  1102               #activeHelpKey: #imageRetriever
  1111               #resizeForLabel: true
  1103               #resizeForLabel: true
  1112               #adjust: #right
  1104               #adjust: #right
  1113             )
  1105             )
  1114            #(#ComboBoxSpec
  1106            #(#ComboBoxSpec
       
  1107               #attributes: 
       
  1108              #(#tabable
       
  1109                 true
       
  1110               )
  1115               #name: 'retrieverField'
  1111               #name: 'retrieverField'
  1116               #layout: #(#LayoutFrame 110 0 15 0 0 1.0 37 0)
  1112               #layout: #(#LayoutFrame 110 0 15 0 0 1.0 37 0)
  1117               #activeHelpKey: #imageRetriever
  1113               #activeHelpKey: #imageRetriever
  1118               #tabable: true
  1114               #tabable: true
  1119               #model: #retriever
  1115               #model: #retriever
  1131               #activeHelpKey: #imageSelector
  1127               #activeHelpKey: #imageSelector
  1132               #resizeForLabel: true
  1128               #resizeForLabel: true
  1133               #adjust: #right
  1129               #adjust: #right
  1134             )
  1130             )
  1135            #(#InputFieldSpec
  1131            #(#InputFieldSpec
       
  1132               #attributes: 
       
  1133              #(#tabable
       
  1134                 true
       
  1135               )
  1136               #name: 'iconField'
  1136               #name: 'iconField'
  1137               #layout: #(#LayoutFrame 110 0 40 0 -31 1.0 62 0)
  1137               #layout: #(#LayoutFrame 110 0 40 0 -31 1.0 62 0)
  1138               #activeHelpKey: #imageSelector
  1138               #activeHelpKey: #imageSelector
  1139               #tabable: true
  1139               #tabable: true
  1140               #model: #icon
  1140               #model: #icon
  1145               #acceptChannel: #acceptChannel
  1145               #acceptChannel: #acceptChannel
  1146               #modifiedChannel: #modifiedChannel
  1146               #modifiedChannel: #modifiedChannel
  1147               #acceptOnPointerLeave: false
  1147               #acceptOnPointerLeave: false
  1148             )
  1148             )
  1149            #(#ActionButtonSpec
  1149            #(#ActionButtonSpec
  1150               #label: 'Image Editor'
  1150               #attributes: 
  1151               #name: 'imageEditorButton'
  1151              #(#tabable
  1152               #layout: #(#LayoutFrame 19 0.6 128 0 -5 1 152 0)
  1152                 true
  1153               #activeHelpKey: #imageImageEditor
  1153               )
       
  1154               #label: '...'
       
  1155               #name: 'browseButton'
       
  1156               #layout: #(#LayoutFrame -26 1 41 0 -2 1 63 0)
       
  1157               #activeHelpKey: #browseResource
  1154               #tabable: true
  1158               #tabable: true
  1155               #model: #doEditImage
  1159               #model: #doBrowseForImageResource
  1156             )
  1160             )
  1157            #(#SequenceViewSpec
  1161            #(#SequenceViewSpec
  1158               #name: 'systemOrUserImagesList'
  1162               #name: 'systemOrUserImagesList'
  1159               #layout: #(#LayoutFrame 22 0 67 0 11 0.6 200 0)
  1163               #layout: #(#LayoutFrame 22 0 67 0 11 0.6 200 0)
  1160               #activeHelpKey: #imageImageList
  1164               #activeHelpKey: #imageImageList
       
  1165               #tabable: true
  1161               #model: #selectionOfImage
  1166               #model: #selectionOfImage
  1162               #menu: #menuEditImage
  1167               #menu: #menuEditImage
  1163               #hasHorizontalScrollBar: true
  1168               #hasHorizontalScrollBar: true
  1164               #hasVerticalScrollBar: true
  1169               #hasVerticalScrollBar: true
  1165               #miniScrollerHorizontal: true
  1170               #miniScrollerHorizontal: true
  1167               #valueChangeSelector: #imageSelected
  1172               #valueChangeSelector: #imageSelected
  1168               #useIndex: false
  1173               #useIndex: false
  1169               #sequenceList: #listOfImages
  1174               #sequenceList: #listOfImages
  1170             )
  1175             )
  1171            #(#ActionButtonSpec
  1176            #(#ActionButtonSpec
  1172               #label: '...'
  1177               #attributes: 
  1173               #name: 'browseButton'
  1178              #(#tabable
  1174               #layout: #(#LayoutFrame -26 1 41 0 -2 1 63 0)
  1179                 true
  1175               #activeHelpKey: #browseResource
  1180               )
  1176               #model: #doBrowseForImageResource
  1181               #label: 'Image Editor'
       
  1182               #name: 'imageEditorButton'
       
  1183               #layout: #(#LayoutFrame 19 0.6 128 0 -5 1 152 0)
       
  1184               #activeHelpKey: #imageImageEditor
       
  1185               #tabable: true
       
  1186               #model: #doEditImage
       
  1187             )
       
  1188            #(#CheckBoxSpec
       
  1189               #attributes: 
       
  1190              #(#tabable
       
  1191                 true
       
  1192               )
       
  1193               #label: 'Image & Label'
       
  1194               #name: 'iconAndLabelCheckBox'
       
  1195               #layout: #(#LayoutOrigin 20 0 215 0)
       
  1196               #activeHelpKey: #imageImageAndLabel
       
  1197               #tabable: true
       
  1198               #model: #iconAndLabel
  1177             )
  1199             )
  1178            )
  1200            )
  1179          
  1201          
  1180         )
  1202         )
  1181       )
  1203       )
  2000     "keep the canvas for the current selected item or nil
  2022     "keep the canvas for the current selected item or nil
  2001     "
  2023     "
  2002     |holder|
  2024     |holder|
  2003 
  2025 
  2004     (holder := builder bindingAt:#tabCanvasHolder) isNil ifTrue:[
  2026     (holder := builder bindingAt:#tabCanvasHolder) isNil ifTrue:[
  2005         builder aspectAt:#tabCanvasHolder put: (holder := nil asValue).
  2027         builder aspectAt:#tabCanvasHolder put: (holder := ValueHolder new).
  2006     ].
  2028     ].
  2007     ^ holder
  2029     ^ holder
  2008 
  2030 
  2009 
  2031 
  2010 !
  2032 !
  2233 ! !
  2255 ! !
  2234 
  2256 
  2235 !MenuEditor methodsFor:'selection'!
  2257 !MenuEditor methodsFor:'selection'!
  2236 
  2258 
  2237 clearSelection
  2259 clearSelection
  2238     tabSelection := 0.
  2260 
       
  2261     tabSelection ~~ 0 ifTrue:[
       
  2262         tabSelection := 0.
       
  2263         self tabCanvasHolder value:nil
       
  2264     ].
  2239     typeOfCanvas := nil.
  2265     typeOfCanvas := nil.
  2240 !
  2266 !
  2241 
  2267 
  2242 imageSelected
  2268 imageSelected
  2243     |imgSel|
  2269     |imgSel|
  2302     self updateChannels.
  2328     self updateChannels.
  2303     aspects do:[:a| a addDependent:self].
  2329     aspects do:[:a| a addDependent:self].
  2304 
  2330 
  2305 !
  2331 !
  2306 
  2332 
  2307 tabSelection: aSelection
  2333 tabSelection:aSelection
  2308     "put the section aSelection into the note book
  2334     "put the section aSelection into the note book
  2309     "
  2335     "
  2310     |view canvasView|
  2336     |view spec|
  2311 
  2337 
  2312     tabSelection = aSelection ifTrue:[
  2338     aSelection == tabSelection ifTrue:[^self].
  2313         ^ self
  2339 
  2314     ].
  2340     (tabSelection := aSelection) isNil ifTrue:[
  2315     typeOfCanvas := nil.
  2341         tabSelection == 0 ifTrue:[^ self].
  2316 
  2342         tabSelection := 0.
  2317     (tabSelection := aSelection) ~~ 0 ifTrue:[
       
  2318         typeOfCanvas := (slices at:tabSelection) last.
       
  2319 
       
  2320         self isHelpToolSelected ifTrue:[
       
  2321             view := self helpTool window.
       
  2322         ] ifFalse:[
       
  2323             self updateImageView.
       
  2324             view := listOfCanvas at:typeOfCanvas ifAbsentPut:[View new client:self spec:typeOfCanvas].
       
  2325         ]
       
  2326     ].
  2343     ].
  2327 
  2344 
  2328     "/ before bringing up the new notebook page,
  2345     "/ before bringing up the new notebook page,
  2329     "/ we must disable all now invisible input fields ...
  2346     "/ we must disable all now invisible input fields ...
  2330     "/ (otherwise, those would fire on #accept.
  2347     "/ (otherwise, those would fire on #accept.
  2331 
  2348 
  2332     canvasView := self tabCanvasHolder value.
  2349     (view := self tabCanvasHolder value) notNil ifTrue:[
  2333 
  2350         view allSubViewsDo:[:aComponent |
  2334     canvasView notNil ifTrue:[
       
  2335         canvasView unmap.
       
  2336 
       
  2337         canvasView allSubViewsDo:[:aComponent |
       
  2338             aComponent isInputField ifTrue:[
  2351             aComponent isInputField ifTrue:[
  2339                 aComponent disableIfInvisible:true
  2352                 aComponent disableIfInvisible:true
  2340             ]
  2353             ]
  2341         ]
  2354         ]
  2342     ].
  2355     ].
  2343 
  2356 
       
  2357     tabSelection == 0 ifTrue:[
       
  2358         ^ self tabCanvasHolder value:nil.
       
  2359     ].
       
  2360 
       
  2361     typeOfCanvas := (slices at:tabSelection) last.
       
  2362 
       
  2363     self isHelpToolSelected ifTrue:[
       
  2364         view := self helpTool window.
       
  2365     ] ifFalse:[
       
  2366         self updateImageView.
       
  2367 
       
  2368         view := listOfCanvas at:typeOfCanvas
       
  2369                     ifAbsentPut:[SimpleView new client:self spec:typeOfCanvas builder:(self builder)].
       
  2370     ].
  2344     self tabCanvasHolder value:view.
  2371     self tabCanvasHolder value:view.
  2345 
  2372 
  2346 ! !
  2373 ! !
  2347 
  2374 
  2348 !MenuEditor methodsFor:'startup / release'!
  2375 !MenuEditor methodsFor:'startup / release'!