ImageEditor.st
changeset 487 6c336c183330
parent 475 0d5a50fe59f4
child 488 147bf8fe5456
equal deleted inserted replaced
486:2a1024483349 487:6c336c183330
   160   ^ super helpSpec addPairsFrom:#(
   160   ^ super helpSpec addPairsFrom:#(
   161 
   161 
   162 #colorMap
   162 #colorMap
   163 'Increases or reduces size of color map of the image.'
   163 'Increases or reduces size of color map of the image.'
   164 
   164 
       
   165 #colorMapTable
       
   166 'Shows a list of used colors of the current image.'
       
   167 
   165 #drawModeBox
   168 #drawModeBox
   166 'Switches to mode drawing boxes.'
   169 'Switches to mode drawing boxes.'
   167 
   170 
   168 #drawModeCopy
   171 #drawModeCopy
   169 'Switches to mode copying areas.'
   172 'Switches to mode copying areas.'
   240 #inputFieldOfClass
   243 #inputFieldOfClass
   241 'Class implementing the image method.'
   244 'Class implementing the image method.'
   242 
   245 
   243 #inputFieldOfSelector
   246 #inputFieldOfSelector
   244 'Selector of the class returning the image.'
   247 'Selector of the class returning the image.'
       
   248 
       
   249 #magnificationNumber
       
   250 'Shows current number of magnification.'
       
   251 
       
   252 #magnifyImageDown
       
   253 'Magnifies down current image.'
       
   254 
       
   255 #magnifyImageUp
       
   256 'Magnifies up current image.'
       
   257 
       
   258 #mouseKeyColorMode
       
   259 'Toggles between left and right mouse key color.'
       
   260 
       
   261 #previewView
       
   262 'Shows preview of the current image.'
   245 
   263 
   246 )
   264 )
   247 ! !
   265 ! !
   248 
   266 
   249 !ImageEditor class methodsFor:'interface specs'!
   267 !ImageEditor class methodsFor:'interface specs'!
   662      
   680      
   663        #(#FullSpec
   681        #(#FullSpec
   664           #'window:' 
   682           #'window:' 
   665            #(#WindowSpec
   683            #(#WindowSpec
   666               #'name:' 'Image Editor'
   684               #'name:' 'Image Editor'
   667               #'layout:' #(#LayoutFrame 127 0 279 0 626 0 624 0)
   685               #'layout:' #(#LayoutFrame 70 0 346 0 569 0 691 0)
   668               #'label:' 'Image Editor'
   686               #'label:' 'Image Editor'
   669               #'min:' #(#Point 400 320)
   687               #'min:' #(#Point 400 320)
   670               #'max:' #(#Point 1152 900)
   688               #'max:' #(#Point 1152 900)
   671               #'bounds:' #(#Rectangle 127 279 627 625)
   689               #'bounds:' #(#Rectangle 70 346 570 692)
   672               #'menu:' #menu
   690               #'menu:' #menu
   673               #'usePreferredExtent:' false
   691               #'usePreferredExtent:' false
   674           )
   692           )
   675           #'component:' 
   693           #'component:' 
   676            #(#SpecCollection
   694            #(#SpecCollection
   704                                             #'collection:' 
   722                                             #'collection:' 
   705                                              #(
   723                                              #(
   706                                                #(#ArrowButtonSpec
   724                                                #(#ArrowButtonSpec
   707                                                   #'name:' 'magnifyDownButton'
   725                                                   #'name:' 'magnifyDownButton'
   708                                                   #'layout:' #(#LayoutFrame 13 0 20 0 35 0 42 0)
   726                                                   #'layout:' #(#LayoutFrame 13 0 20 0 35 0 42 0)
       
   727                                                   #'activeHelpKey:' #magnifyImageDown
   709                                                   #'model:' #magnifyDown
   728                                                   #'model:' #magnifyDown
   710                                                   #'enableChannel:' #imageIsLoaded
   729                                                   #'enableChannel:' #imageIsLoaded
   711                                                   #'isTriggerOnDown:' true
   730                                                   #'isTriggerOnDown:' true
   712                                                   #'direction:' #left
   731                                                   #'direction:' #left
   713                                               )
   732                                               )
   714                                                #(#ArrowButtonSpec
   733                                                #(#ArrowButtonSpec
   715                                                   #'name:' 'magnifyUpButton'
   734                                                   #'name:' 'magnifyUpButton'
   716                                                   #'layout:' #(#LayoutFrame 73 0 20 0 95 0 42 0)
   735                                                   #'layout:' #(#LayoutFrame 73 0 20 0 95 0 42 0)
       
   736                                                   #'activeHelpKey:' #magnifyImageUp
   717                                                   #'model:' #magnifyUp
   737                                                   #'model:' #magnifyUp
   718                                                   #'enableChannel:' #imageIsLoaded
   738                                                   #'enableChannel:' #imageIsLoaded
   719                                                   #'isTriggerOnDown:' true
   739                                                   #'isTriggerOnDown:' true
   720                                                   #'direction:' #right
   740                                                   #'direction:' #right
   721                                               )
   741                                               )
   722                                                #(#InputFieldSpec
   742                                                #(#InputFieldSpec
   723                                                   #'name:' 'magnificationInputField'
   743                                                   #'name:' 'magnificationInputField'
   724                                                   #'layout:' #(#LayoutFrame 36 0 20 0.0 72 0 42 0)
   744                                                   #'layout:' #(#LayoutFrame 36 0 20 0.0 72 0 42 0)
       
   745                                                   #'activeHelpKey:' #magnificationNumber
   725                                                   #'enableChannel:' #imageIsLoaded
   746                                                   #'enableChannel:' #imageIsLoaded
   726                                                   #'model:' #valueOfMagnification
   747                                                   #'model:' #valueOfMagnification
   727                                                   #'type:' #number
   748                                                   #'type:' #number
   728                                                   #'acceptOnReturn:' false
   749                                                   #'acceptOnReturn:' false
   729                                                   #'acceptOnTab:' false
   750                                                   #'acceptOnTab:' false
   743                                             #'collection:' 
   764                                             #'collection:' 
   744                                              #(
   765                                              #(
   745                                                #(#DataSetSpec
   766                                                #(#DataSetSpec
   746                                                   #'name:' 'colorDataSetView'
   767                                                   #'name:' 'colorDataSetView'
   747                                                   #'layout:' #(#LayoutFrame 11 0.0 19 0.0 20 1.0 -10 1.0)
   768                                                   #'layout:' #(#LayoutFrame 11 0.0 19 0.0 20 1.0 -10 1.0)
       
   769                                                   #'activeHelpKey:' #colorMapTable
   748                                                   #'model:' #selectionOfColor
   770                                                   #'model:' #selectionOfColor
   749                                                   #'style:' #(#FontDescription #helvetica #medium #roman 12)
   771                                                   #'style:' #(#FontDescription #helvetica #medium #roman 12)
   750                                                   #'hasHorizontalScrollBar:' true
   772                                                   #'hasHorizontalScrollBar:' true
   751                                                   #'hasVerticalScrollBar:' true
   773                                                   #'hasVerticalScrollBar:' true
   752                                                   #'miniScrollerHorizontal:' true
   774                                                   #'miniScrollerHorizontal:' true
   778                                                   )
   800                                                   )
   779                                               )
   801                                               )
   780                                                #(#MenuPanelSpec
   802                                                #(#MenuPanelSpec
   781                                                   #'name:' 'menuColorAssignmentPanel'
   803                                                   #'name:' 'menuColorAssignmentPanel'
   782                                                   #'layout:' #(#LayoutFrame 11 0 -10 1 18 1 17 1)
   804                                                   #'layout:' #(#LayoutFrame 11 0 -10 1 18 1 17 1)
       
   805                                                   #'activeHelpKey:' #mouseKeyColorMode
   783                                                   #'enableChannel:' #imageIsLoaded
   806                                                   #'enableChannel:' #imageIsLoaded
   784                                                   #'menu:' #menuColorAssignment
   807                                                   #'menu:' #menuColorAssignment
   785                                                   #'style:' #(#FontDescription #helvetica #medium #roman 10)
   808                                                   #'style:' #(#FontDescription #helvetica #medium #roman 10)
   786                                               )
   809                                               )
   787                                             )
   810                                             )
   832                                                #(#InputFieldSpec
   855                                                #(#InputFieldSpec
   833                                                   #'name:' 'resourceClassInputField'
   856                                                   #'name:' 'resourceClassInputField'
   834                                                   #'activeHelpKey:' #inputFieldOfClass
   857                                                   #'activeHelpKey:' #inputFieldOfClass
   835                                                   #'model:' #valueOfResourceClass
   858                                                   #'model:' #valueOfResourceClass
   836                                                   #'immediateAccept:' false
   859                                                   #'immediateAccept:' false
   837                                                   #'extent:' #(#Point 129 21)
   860                                                   #'extent:' #(#Point 153 21)
   838                                               )
   861                                               )
   839                                                #(#InputFieldSpec
   862                                                #(#InputFieldSpec
   840                                                   #'name:' 'resourceSelectorInputField'
   863                                                   #'name:' 'resourceSelectorInputField'
   841                                                   #'activeHelpKey:' #inputFieldOfSelector
   864                                                   #'activeHelpKey:' #inputFieldOfSelector
   842                                                   #'model:' #valueOfResourceSelector
   865                                                   #'model:' #valueOfResourceSelector
   843                                                   #'immediateAccept:' false
   866                                                   #'immediateAccept:' false
   844                                                   #'acceptOnTab:' false
   867                                                   #'acceptOnTab:' false
   845                                                   #'extent:' #(#Point 129 20)
   868                                                   #'extent:' #(#Point 153 20)
   846                                               )
   869                                               )
   847                                                #(#InputFieldSpec
   870                                                #(#InputFieldSpec
   848                                                   #'name:' 'fileNameInputField'
   871                                                   #'name:' 'fileNameInputField'
   849                                                   #'activeHelpKey:' #inputFieldFileName
   872                                                   #'activeHelpKey:' #inputFieldFileName
   850                                                   #'model:' #valueOfFileName
   873                                                   #'model:' #valueOfFileName
   851                                                   #'immediateAccept:' false
   874                                                   #'immediateAccept:' false
   852                                                   #'acceptOnTab:' false
   875                                                   #'acceptOnTab:' false
   853                                                   #'extent:' #(#Point 129 21)
   876                                                   #'extent:' #(#Point 153 21)
   854                                               )
   877                                               )
   855                                             )
   878                                             )
   856                                         )
   879                                         )
   857                                         #'horizontalLayout:' #fit
   880                                         #'horizontalLayout:' #fit
   858                                         #'verticalLayout:' #fit
   881                                         #'verticalLayout:' #fit
   860                                         #'verticalSpace:' 3
   883                                         #'verticalSpace:' 3
   861                                     )
   884                                     )
   862                                      #(#ArbitraryComponentSpec
   885                                      #(#ArbitraryComponentSpec
   863                                         #'name:' 'imagePreView'
   886                                         #'name:' 'imagePreView'
   864                                         #'layout:' #(#LayoutFrame 111 0.0 9 0.0 -6 1 60 0)
   887                                         #'layout:' #(#LayoutFrame 111 0.0 9 0.0 -6 1 60 0)
       
   888                                         #'activeHelpKey:' #previewView
   865                                         #'hasHorizontalScrollBar:' true
   889                                         #'hasHorizontalScrollBar:' true
   866                                         #'hasVerticalScrollBar:' true
   890                                         #'hasVerticalScrollBar:' true
   867                                         #'miniScrollerHorizontal:' true
   891                                         #'miniScrollerHorizontal:' true
   868                                         #'miniScrollerVertical:' true
   892                                         #'miniScrollerVertical:' true
   869                                         #'component:' #ImageView
   893                                         #'component:' #ImageView
   879                                #(#SpecCollection
   903                                #(#SpecCollection
   880                                   #'collection:' 
   904                                   #'collection:' 
   881                                    #(
   905                                    #(
   882                                      #(#ArbitraryComponentSpec
   906                                      #(#ArbitraryComponentSpec
   883                                         #'name:' 'imageEditView'
   907                                         #'name:' 'imageEditView'
   884                                         #'layout:' #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 1 1.0)
   908                                         #'layout:' #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0)
   885                                         #'hasHorizontalScrollBar:' true
   909                                         #'hasHorizontalScrollBar:' true
   886                                         #'hasVerticalScrollBar:' true
   910                                         #'hasVerticalScrollBar:' true
   887                                         #'component:' #ImageEditView
   911                                         #'component:' #ImageEditView
   888                                         #'hasBorder:' false
   912                                         #'hasBorder:' false
       
   913                                     )
       
   914                                      #(#LabelSpec
       
   915                                         #'name:' 'coordLabel'
       
   916                                         #'layout:' #(#LayoutFrame 2 0.0 -22 1 -4 1.0 0 1.0)
       
   917                                         #'level:' -1
       
   918                                         #'adjust:' #left
   889                                     )
   919                                     )
   890                                   )
   920                                   )
   891                               )
   921                               )
   892                               #'level:' -1
   922                               #'level:' -1
   893                           )
   923                           )
   894                         )
   924                         )
   895                     )
   925                     )
   896                     #'level:' 1
   926                     #'level:' 1
   897                     #'handles:' #(#Any 0.45082 1.0)
   927                     #'handles:' #(#Any 0.5 1.0)
   898                 )
   928                 )
   899                  #(#LabelSpec
   929                  #(#UISubSpecification
   900                     #'name:' 'infoLabel'
   930                     #'name:' 'infoBarSubSpec'
   901                     #'layout:' #(#LayoutFrame 0 0 -22 1 -170 1 0 1.0)
   931                     #'layout:' #(#LayoutFrame 0 0.0 -22 1 0 1.0 0 1.0)
   902                     #'labelChannel:' #valueOfInfoLabel
   932                     #'majorKey:' #ToolApplicationModel
   903                     #'level:' 1
   933                     #'minorKey:' #windowSpecForInfoBar
   904                     #'adjust:' #left
       
   905                 )
       
   906                  #(#LabelSpec
       
   907                     #'name:' 'timeLabel'
       
   908                     #'layout:' #(#LayoutFrame -80 1 -22 1 0 1.0 0 1.0)
       
   909                     #'labelChannel:' #valueOfTimeLabel
       
   910                     #'level:' 1
       
   911                     #'adjust:' #right
       
   912                 )
       
   913                  #(#LabelSpec
       
   914                     #'name:' 'coordLabel'
       
   915                     #'layout:' #(#LayoutFrame -170 1 -22 1 -80 1 0 1.0)
       
   916                     #'labelChannel:' #valueOfCoordLabel
       
   917                     #'level:' 1
       
   918                     #'adjust:' #left
       
   919                 )
   934                 )
   920               )
   935               )
   921           )
   936           )
   922       )
   937       )
   923 !
   938 !
  1087     postOpenAction := anAction
  1102     postOpenAction := anAction
  1088 ! !
  1103 ! !
  1089 
  1104 
  1090 !ImageEditor methodsFor:'accessing - views'!
  1105 !ImageEditor methodsFor:'accessing - views'!
  1091 
  1106 
       
  1107 coordLabel
       
  1108 
       
  1109     ^builder componentAt: #coordLabel
       
  1110 !
       
  1111 
  1092 fileNameInputField
  1112 fileNameInputField
  1093 
  1113 
  1094     ^builder componentAt: #fileNameInputField
  1114     ^builder componentAt: #fileNameInputField
  1095 !
  1115 !
  1096 
  1116 
  1405     self imageIsLoaded value: self image notNil.
  1425     self imageIsLoaded value: self image notNil.
  1406 
  1426 
  1407     self image isNil ifTrue: [^nil].
  1427     self image isNil ifTrue: [^nil].
  1408 
  1428 
  1409     self updateInfoLabel.
  1429     self updateInfoLabel.
  1410     self imageEditView coordInfoBlock: [:value| self valueOfCoordLabel value: value].
       
  1411 
  1430 
  1412     self valueOfFileName removeDependent: self.
  1431     self valueOfFileName removeDependent: self.
  1413     self valueOfFileName value: self image fileName.
  1432     self valueOfFileName value: self image fileName.
  1414     self valueOfFileName addDependent: self.
  1433     self valueOfFileName addDependent: self.
  1415 
  1434