ImageEditor.st
changeset 756 52a76ec8828d
parent 737 ed5b109a0f91
child 763 19b3e479e0b8
equal deleted inserted replaced
755:cfbbec0a33c6 756:52a76ec8828d
    57 
    57 
    58 !ImageEditor class methodsFor:'instance creation'!
    58 !ImageEditor class methodsFor:'instance creation'!
    59 
    59 
    60 openModalOnClass: aClass andSelector: aSelector
    60 openModalOnClass: aClass andSelector: aSelector
    61 
    61 
    62     "self openModalOnClass: self andSelector: #newImageIcon"
    62     "self openModalOnClass: self andSelector: #leftMouseKeyIcon"
    63 
    63 
    64     |imageEditor imageEditView className resourceClassName resourceSelector|                      
    64     |imageEditor imageEditView className resourceClassName resourceSelector|                      
    65     imageEditor := self new.
    65     imageEditor := self new.
    66     aClass isClass ifTrue: [className := aClass name].
    66     aClass isClass ifTrue: [className := aClass name].
    67     aClass isString ifTrue: [className := aClass].      
    67     aClass isString ifTrue: [className := aClass].      
    77         ifFalse:[^nil]
    77         ifFalse:[^nil]
    78 !
    78 !
    79 
    79 
    80 openOnClass: aClass andSelector: aSelector
    80 openOnClass: aClass andSelector: aSelector
    81 
    81 
    82     "self openOnClass: self andSelector: #newImageIcon"
    82     "self openOnClass: self andSelector: #leftMouseKeyIcon"
    83 
    83 
    84     ^self open loadFromMessage: aClass name, ' ', aSelector
    84     ^self open loadFromMessage: aClass name, ' ', aSelector
    85 !
    85 !
    86 
    86 
    87 openOnFile: image
    87 openOnFile: image
   311      
   311      
   312        #(#FullSpec
   312        #(#FullSpec
   313           #window: 
   313           #window: 
   314            #(#WindowSpec
   314            #(#WindowSpec
   315               #name: 'Image Editor'
   315               #name: 'Image Editor'
   316               #layout: #(#LayoutFrame 392 0 309 0 891 0 654 0)
   316               #layout: #(#LayoutFrame 188 0 318 0 687 0 663 0)
   317               #label: 'Image Editor'
   317               #label: 'Image Editor'
   318               #min: #(#Point 400 320)
   318               #min: #(#Point 400 320)
   319               #max: #(#Point 1152 900)
   319               #max: #(#Point 1152 900)
   320               #bounds: #(#Rectangle 392 309 892 655)
   320               #bounds: #(#Rectangle 188 318 688 664)
   321               #menu: #menu
   321               #menu: #menu
   322               #usePreferredExtent: false
   322               #usePreferredExtent: false
   323           )
   323           )
   324           #component: 
   324           #component: 
   325            #(#SpecCollection
   325            #(#SpecCollection
   371                                                             #style: #(#FontDescription #helvetica #medium #roman 10)
   371                                                             #style: #(#FontDescription #helvetica #medium #roman 10)
   372                                                             #hasHorizontalScrollBar: true
   372                                                             #hasHorizontalScrollBar: true
   373                                                             #hasVerticalScrollBar: true
   373                                                             #hasVerticalScrollBar: true
   374                                                             #miniScrollerHorizontal: true
   374                                                             #miniScrollerHorizontal: true
   375                                                             #miniScrollerVertical: true
   375                                                             #miniScrollerVertical: true
       
   376                                                             #level: -1
   376                                                             #dataList: #listOfColors
   377                                                             #dataList: #listOfColors
   377                                                             #level: -1
       
   378                                                             #has3Dsepartors: true
   378                                                             #has3Dsepartors: true
   379                                                             #verticalSpacing: 1
   379                                                             #verticalSpacing: 1
   380                                                             #columns: 
   380                                                             #columns: 
   381                                                              #(
   381                                                              #(
   382                                                                #(#DataSetColumnSpec
   382                                                                #(#DataSetColumnSpec
   437                                      #(#LabelSpec
   437                                      #(#LabelSpec
   438                                         #name: 'coordLabel'
   438                                         #name: 'coordLabel'
   439                                         #layout: #(#LayoutFrame 2 0.0 -22 1 -83 1.0 0 1.0)
   439                                         #layout: #(#LayoutFrame 2 0.0 -22 1 -83 1.0 0 1.0)
   440                                         #level: -1
   440                                         #level: -1
   441                                         #adjust: #left
   441                                         #adjust: #left
       
   442                                         #resizeForLabel: false
   442                                     )
   443                                     )
   443                                      #(#ArrowButtonSpec
   444                                      #(#ArrowButtonSpec
   444                                         #name: 'magnifyDownButton'
   445                                         #name: 'magnifyDownButton'
   445                                         #layout: #(#LayoutFrame -80 1 -22 1 -58 1 0 1)
   446                                         #layout: #(#LayoutFrame -80 1 -22 1 -58 1 0 1)
   446                                         #activeHelpKey: #magnifyImageDown
   447                                         #activeHelpKey: #magnifyImageDown
   814                     ) nil
   815                     ) nil
   815                     nil
   816                     nil
   816                 )
   817                 )
   817             )
   818             )
   818              #(#MenuItem
   819              #(#MenuItem
   819                 #label: 'History'
       
   820                 #activeHelpKey: #history
       
   821                 #submenuChannel: #menuHistory
       
   822             )
       
   823              #(#MenuItem
       
   824                 #label: 'Settings'
   820                 #label: 'Settings'
   825                 #submenu: 
   821                 #submenu: 
   826                  #(#Menu
   822                  #(#Menu
   827                     
   823                     
   828                      #(
   824                      #(
   831                           #submenuChannel: #menuFont
   827                           #submenuChannel: #menuFont
   832                       )
   828                       )
   833                     ) nil
   829                     ) nil
   834                     nil
   830                     nil
   835                 )
   831                 )
       
   832             )
       
   833              #(#MenuItem
       
   834                 #label: 'History'
       
   835                 #activeHelpKey: #history
       
   836                 #submenuChannel: #menuHistory
   836             )
   837             )
   837              #(#MenuItem
   838              #(#MenuItem
   838                 #label: 'Help'
   839                 #label: 'Help'
   839                 #startGroup: #right
   840                 #startGroup: #right
   840                 #activeHelpKey: #help
   841                 #activeHelpKey: #help
  1177     self listOfColors isEmpty
  1178     self listOfColors isEmpty
  1178     ifTrue:
  1179     ifTrue:
  1179     [   
  1180     [   
  1180          self colorMapMode: colorMapMode value: nil
  1181          self colorMapMode: colorMapMode value: nil
  1181     ].       
  1182     ].       
  1182     self imageEditView selectColor: (Array with: (self listOfColors at: 1) with: (self listOfColors at: 2)).
  1183     self imageEditView selectColor: (Array with: (self listOfColors at: 1) with: (self listOfColors at: 2 ifAbsent: [self listOfColors at: 1])).
  1183     self image mask notNil
  1184     self image mask notNil
  1184     ifTrue:
  1185     ifTrue:
  1185     [
  1186     [
  1186         colorMapMode := colorMapMode, ' + mask'.
  1187         colorMapMode := colorMapMode, ' + mask'.
  1187         self listOfColors addFirst: (Color basicNew setColorId:0).
  1188         self listOfColors addFirst: (Color basicNew setColorId:0).
  1188         self imageEditView selectColor: (Array with: (self listOfColors at: 2) with: (self listOfColors at: 1)).
  1189         self imageEditView selectColor: (Array with: (self listOfColors at: 1 ifAbsent: [self listOfColors at: 2]) with: (self listOfColors at: 1)).
  1189     ].
  1190     ].
  1190     self selectionOfColor value: 0.
  1191     self selectionOfColor value: 0.
  1191     self selectionOfColor value: (self listOfColors indexOf: self imageEditView selectedColor).
  1192     self selectionOfColor value: (self listOfColors indexOf: self imageEditView selectedColor).
  1192 !
  1193 !
  1193 
  1194 
  1373 
  1374 
  1374 loadFromFile
  1375 loadFromFile
  1375 
  1376 
  1376     self loadFromFile:
  1377     self loadFromFile:
  1377         (FileSelectionBrowser
  1378         (FileSelectionBrowser
  1378             request: 'Load Image From' 
  1379             request: 'Load Image From'
  1379             fileFilters: FileSelectionBrowser loadImageFileNameFilters)
  1380             fileName: (self image notNil ifTrue: [self image fileName] ifFalse: [nil])
       
  1381             withFileFilters: FileSelectionBrowser loadImageFileNameFilters)
  1380 !
  1382 !
  1381 
  1383 
  1382 loadFromFile: aFileName
  1384 loadFromFile: aFileName
  1383 
  1385 
  1384     (self imageEditView loadFromFile: aFileName) notNil
  1386     (self imageEditView loadFromFile: aFileName) notNil