ImageEditor.st
changeset 945 cb689f3971ab
parent 942 4b47d3d652ad
child 951 457d94e33e93
equal deleted inserted replaced
944:bffc1f3625e1 945:cb689f3971ab
   459      
   459      
   460        #(#FullSpec
   460        #(#FullSpec
   461           #window: 
   461           #window: 
   462            #(#WindowSpec
   462            #(#WindowSpec
   463               #name: 'Image Editor'
   463               #name: 'Image Editor'
   464               #layout: #(#LayoutFrame 362 0 221 0 861 0 566 0)
   464               #layout: #(#LayoutFrame 176 0 156 0 675 0 501 0)
   465               #label: 'Image Editor'
   465               #label: 'Image Editor'
   466               #min: #(#Point 400 320)
   466               #min: #(#Point 400 320)
   467               #max: #(#Point 1152 900)
   467               #max: #(#Point 1152 900)
   468               #bounds: #(#Rectangle 362 221 862 567)
   468               #bounds: #(#Rectangle 176 156 676 502)
   469               #menu: #menu
   469               #menu: #menu
   470               #usePreferredExtent: false
   470               #usePreferredExtent: false
   471           )
   471           )
   472           #component: 
   472           #component: 
   473            #(#SpecCollection
   473            #(#SpecCollection
   537                                                                   #columnAlignment: #right
   537                                                                   #columnAlignment: #right
   538                                                                   #editorType: #InputField
   538                                                                   #editorType: #InputField
   539                                                                   #type: #number
   539                                                                   #type: #number
   540                                                                   #model: #redFromColor:
   540                                                                   #model: #redFromColor:
   541                                                                   #writeSelector: #redAtColor:put:
   541                                                                   #writeSelector: #redAtColor:put:
   542                                                                   #canSelect: false
   542                                                                   #selectSelector: #canSelectRedInColor:
   543                                                               )
   543                                                               )
   544                                                                #(#DataSetColumnSpec
   544                                                                #(#DataSetColumnSpec
   545                                                                   #label: 'G'
   545                                                                   #label: 'G'
   546                                                                   #labelAlignment: #left
   546                                                                   #labelAlignment: #left
   547                                                                   #columnAlignment: #right
   547                                                                   #columnAlignment: #right
   548                                                                   #editorType: #InputField
   548                                                                   #editorType: #InputField
   549                                                                   #type: #number
   549                                                                   #type: #number
   550                                                                   #model: #greenFromColor:
   550                                                                   #model: #greenFromColor:
   551                                                                   #writeSelector: #greenAtColor:put:
   551                                                                   #writeSelector: #greenAtColor:put:
   552                                                                   #canSelect: false
   552                                                                   #selectSelector: #canSelectGreenInColor:
   553                                                               )
   553                                                               )
   554                                                                #(#DataSetColumnSpec
   554                                                                #(#DataSetColumnSpec
   555                                                                   #label: 'B'
   555                                                                   #label: 'B'
   556                                                                   #labelAlignment: #left
   556                                                                   #labelAlignment: #left
   557                                                                   #columnAlignment: #right
   557                                                                   #columnAlignment: #right
   558                                                                   #editorType: #InputField
   558                                                                   #editorType: #InputField
   559                                                                   #type: #number
   559                                                                   #type: #number
   560                                                                   #model: #blueFromColor:
   560                                                                   #model: #blueFromColor:
   561                                                                   #writeSelector: #blueAtColor:put:
   561                                                                   #writeSelector: #blueAtColor:put:
   562                                                                   #canSelect: false
   562                                                                   #selectSelector: #canSelectBlueInColor:
   563                                                               )
   563                                                               )
   564                                                             )
   564                                                             )
   565                                                             #columnAdaptor: #colorColumnAdaptor
   565                                                             #columnAdaptor: #colorColumnAdaptor
   566                                                         )
   566                                                         )
   567                                                       )
   567                                                       )
   652                     #minorKey: #windowSpecForInfoBar
   652                     #minorKey: #windowSpecForInfoBar
   653                 )
   653                 )
   654               )
   654               )
   655           )
   655           )
   656       )
   656       )
       
   657 
       
   658     "Modified: / 7.8.1998 / 22:52:28 / cg"
   657 ! !
   659 ! !
   658 
   660 
   659 !ImageEditor class methodsFor:'menu specs'!
   661 !ImageEditor class methodsFor:'menu specs'!
   660 
   662 
   661 menu
   663 menu
  1274     self selectionOfColor value: 0.
  1276     self selectionOfColor value: 0.
  1275     self selectionOfColor value: (self listOfColors indexOf: imageEditView selectedColor).
  1277     self selectionOfColor value: (self listOfColors indexOf: imageEditView selectedColor).
  1276 !
  1278 !
  1277 
  1279 
  1278 update:something with:aParameter from:changedObject
  1280 update:something with:aParameter from:changedObject
       
  1281     changedObject == self listOfColors ifTrue:[
       
  1282         something == #at: ifTrue:[
       
  1283             "/ colormap entry changed at aParameter
       
  1284             self image colorMap at:aParameter put:(changedObject at:aParameter).
       
  1285             self colorMapChanged.
       
  1286             ^ self
       
  1287         ].
       
  1288     ].
  1279     super update:something with:aParameter from:changedObject
  1289     super update:something with:aParameter from:changedObject
  1280 
  1290 
       
  1291     "Modified: / 7.8.1998 / 22:32:09 / cg"
  1281 !
  1292 !
  1282 
  1293 
  1283 updateForNoneImage
  1294 updateForNoneImage
  1284     "updates channels and view, if image is loaded"
  1295     "updates channels and view, if image is loaded"
  1285 
  1296 
  1329     aColor isNil ifTrue:[^ 'none'].
  1340     aColor isNil ifTrue:[^ 'none'].
  1330     ^ aColor blueByte ? 'mask'
  1341     ^ aColor blueByte ? 'mask'
  1331 
  1342 
  1332     "Created: / 26.7.1998 / 12:30:35 / cg"
  1343     "Created: / 26.7.1998 / 12:30:35 / cg"
  1333     "Modified: / 31.7.1998 / 01:11:18 / cg"
  1344     "Modified: / 31.7.1998 / 01:11:18 / cg"
       
  1345 !
       
  1346 
       
  1347 canSelectBlueInColor:aColor
       
  1348     ^ aColor blueByte notNil
       
  1349 
       
  1350     "Created: / 7.8.1998 / 22:50:34 / cg"
       
  1351     "Modified: / 7.8.1998 / 22:52:57 / cg"
       
  1352 !
       
  1353 
       
  1354 canSelectGreenInColor:aColor
       
  1355     ^ aColor greenByte notNil
       
  1356 
       
  1357     "Created: / 7.8.1998 / 22:50:22 / cg"
       
  1358     "Modified: / 7.8.1998 / 22:52:46 / cg"
       
  1359 !
       
  1360 
       
  1361 canSelectRedInColor:aColor
       
  1362     ^ aColor redByte notNil
       
  1363 
       
  1364     "Created: / 7.8.1998 / 22:50:00 / cg"
       
  1365     "Modified: / 7.8.1998 / 22:51:03 / cg"
  1334 !
  1366 !
  1335 
  1367 
  1336 greenAtColor:aColor put:newGreen
  1368 greenAtColor:aColor put:newGreen
  1337     "helper used to return a new row element, when green is changed"
  1369     "helper used to return a new row element, when green is changed"
  1338 
  1370 
  1593 
  1625 
  1594     "Modified: / 29.7.1998 / 18:49:20 / cg"
  1626     "Modified: / 29.7.1998 / 18:49:20 / cg"
  1595 ! !
  1627 ! !
  1596 
  1628 
  1597 !ImageEditor methodsFor:'user actions - colormap'!
  1629 !ImageEditor methodsFor:'user actions - colormap'!
       
  1630 
       
  1631 colorMapChanged
       
  1632     |img|
       
  1633 
       
  1634     img := self image.
       
  1635     img release.
       
  1636     (imageEditView image:img) notNil ifTrue:
       
  1637     [
       
  1638         self updateLabelsAndHistory.
       
  1639         self imagePreView image:img
       
  1640     ]
       
  1641 
       
  1642     "Created: / 7.8.1998 / 22:26:10 / cg"
       
  1643     "Modified: / 7.8.1998 / 22:37:29 / cg"
       
  1644 !
  1598 
  1645 
  1599 colorMapMode:aMode value: aValue
  1646 colorMapMode:aMode value: aValue
  1600     "calculates a new color map for the image from aMode"
  1647     "calculates a new color map for the image from aMode"
  1601 
  1648 
  1602     |depth numColors newColorMap newImage 
  1649     |depth numColors newColorMap newImage