ImageEditor.st
changeset 1491 4249a6a1b252
parent 1490 08f46b59ef9b
child 1496 15253ecf71c8
equal deleted inserted replaced
1490:08f46b59ef9b 1491:4249a6a1b252
  1794     (listOfColors := self listOfColors) isEmpty ifTrue:[   
  1794     (listOfColors := self listOfColors) isEmpty ifTrue:[   
  1795         self colorMapMode: colorMapMode value.
  1795         self colorMapMode: colorMapMode value.
  1796         listOfColors := self listOfColors.
  1796         listOfColors := self listOfColors.
  1797         image := self image.
  1797         image := self image.
  1798     ].                               
  1798     ].                               
  1799     imageEditView selectColors: (Array 
  1799     imageEditView drawingColors:(Array
  1800                                     with: (listOfColors at:1) 
  1800                                     with: (listOfColors at:1) 
  1801                                     with: (listOfColors at:2 ifAbsent:[listOfColors at:1])).
  1801                                     with: (listOfColors at:2 ifAbsent:[listOfColors at:1])).
  1802 
  1802 
  1803     image mask notNil ifTrue: [             
  1803     image mask notNil ifTrue: [             
  1804         colorMapMode value:(colorMapMode value, ' + mask').
  1804         colorMapMode value:(colorMapMode value, ' + mask').
  1805 
  1805 
  1806         (listOfColors detect: [:clr| clr = (Color basicNew setColorId:0)] ifNone: nil) isNil
  1806         (listOfColors detect: [:clr| clr = (Color colorId:0)] ifNone: nil) isNil
  1807         ifTrue:[
  1807         ifTrue:[
  1808             listOfColors addFirst: (Color basicNew setColorId:0).
  1808             listOfColors addFirst:(Color colorId:0).
  1809             imageEditView selectColors: (Array 
  1809             imageEditView drawingColors: (Array 
  1810                                             with:(listOfColors at:2 ifAbsent:[listOfColors at: 1]) 
  1810                                             with:(listOfColors at:2 ifAbsent:[listOfColors at:1]) 
  1811                                             with: (listOfColors at: 1)).
  1811                                             with:(listOfColors at:1)).
  1812         ]
  1812         ]
  1813     ].
  1813     ].
  1814     self selectionOfColor 
  1814     self selectionOfColor 
  1815         setValue: 0;
  1815         setValue: 0;
  1816         value: (self listOfColors indexOf: imageEditView selectedColor).
  1816         value: (self listOfColors indexOf: imageEditView selectedColor).
  1817 !
  1817 !
  1818 
  1818 
  1819 update:something with:aParameter from:changedObject
  1819 update:something with:aParameter from:changedObject
  1820     |clrIndex img|
  1820     |clrIndex img |
  1821 
  1821 
  1822     img := self image.
  1822     img := self image.
  1823     changedObject == self listOfColors ifTrue:[
  1823     changedObject == self listOfColors ifTrue:[
  1824         something == #at: ifTrue:[
  1824         something == #at: ifTrue:[
  1825             "/ colormap entry changed at aParameter
  1825             "/ colormap entry changed at aParameter
  1857                 self halt:'should not happen'.
  1857                 self halt:'should not happen'.
  1858             ].
  1858             ].
  1859             self imagePreView redraw:aParameter.
  1859             self imagePreView redraw:aParameter.
  1860             ^ self.
  1860             ^ self.
  1861         ].
  1861         ].
  1862 
  1862         something == #selectedColor ifTrue:[
       
  1863             (aParameter = (Color colorId:0)) ifTrue:[
       
  1864                 self halt.
       
  1865             ].
       
  1866             clrIndex := self listOfColors indexOf:aParameter.
       
  1867             self selectionOfColor value:clrIndex.
       
  1868             ^ self.
       
  1869         ].
  1863         ^ self.
  1870         ^ self.
  1864     ].
  1871     ].
  1865 
  1872 
  1866     changedObject == imageEditView image ifTrue:[
  1873     changedObject == imageEditView image ifTrue:[
  1867         self halt:'to be implemented'.
  1874         self halt:'to be implemented'.
  2224     "after opening, sets the masterApplication of the imageEditView to self"
  2231     "after opening, sets the masterApplication of the imageEditView to self"
  2225 
  2232 
  2226     super open.
  2233     super open.
  2227 
  2234 
  2228     imageEditView := (builder componentAt: #imageEditView) subViews first.
  2235     imageEditView := (builder componentAt: #imageEditView) subViews first.
  2229     imageEditView masterApplication: self.
       
  2230 
       
  2231 !
  2236 !
  2232 
  2237 
  2233 postOpenWith:aBuilder
  2238 postOpenWith:aBuilder
  2234     "after opening, sets the masterApplication of the imageEditView to self;
  2239     "after opening, sets the masterApplication of the imageEditView to self;
  2235      evaluate the postOpenAction"
  2240      evaluate the postOpenAction"
  2236 
  2241 
  2237     imageEditView masterApplication: self.
       
  2238     imageEditView undoImages addDependent:self.
  2242     imageEditView undoImages addDependent:self.
  2239     imageEditView imageInfoHolder:(self imageInfoHolder).
  2243     imageEditView imageInfoHolder:(self imageInfoHolder).
  2240     imageEditView activityInfoHolder:(self activityInfoHolder).
  2244     imageEditView activityInfoHolder:(self activityInfoHolder).
  2241     imageEditView clickInfoCallBack:[:button :point | 
  2245     imageEditView clickInfoCallBack:[:button :point | 
  2242                         |mouseButtonColorToolBar|
  2246                         |mouseButtonColorToolBar|