ImageEditor.st
changeset 942 4b47d3d652ad
parent 941 6d75430a8120
child 945 cb689f3971ab
equal deleted inserted replaced
941:6d75430a8120 942:4b47d3d652ad
   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 216 0 173 0 715 0 518 0)
   464               #layout: #(#LayoutFrame 362 0 221 0 861 0 566 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 216 173 716 519)
   468               #bounds: #(#Rectangle 362 221 862 567)
   469               #menu: #menu
   469               #menu: #menu
   470               #usePreferredExtent: false
   470               #usePreferredExtent: false
   471           )
   471           )
   472           #component: 
   472           #component: 
   473            #(#SpecCollection
   473            #(#SpecCollection
   532                                                                   #backgroundSelector: #yourself
   532                                                                   #backgroundSelector: #yourself
   533                                                               )
   533                                                               )
   534                                                                #(#DataSetColumnSpec
   534                                                                #(#DataSetColumnSpec
   535                                                                   #label: 'R'
   535                                                                   #label: 'R'
   536                                                                   #labelAlignment: #left
   536                                                                   #labelAlignment: #left
       
   537                                                                   #columnAlignment: #right
       
   538                                                                   #editorType: #InputField
       
   539                                                                   #type: #number
   537                                                                   #model: #redFromColor:
   540                                                                   #model: #redFromColor:
       
   541                                                                   #writeSelector: #redAtColor:put:
   538                                                                   #canSelect: false
   542                                                                   #canSelect: false
   539                                                               )
   543                                                               )
   540                                                                #(#DataSetColumnSpec
   544                                                                #(#DataSetColumnSpec
   541                                                                   #label: 'G'
   545                                                                   #label: 'G'
   542                                                                   #labelAlignment: #left
   546                                                                   #labelAlignment: #left
       
   547                                                                   #columnAlignment: #right
       
   548                                                                   #editorType: #InputField
       
   549                                                                   #type: #number
   543                                                                   #model: #greenFromColor:
   550                                                                   #model: #greenFromColor:
       
   551                                                                   #writeSelector: #greenAtColor:put:
   544                                                                   #canSelect: false
   552                                                                   #canSelect: false
   545                                                               )
   553                                                               )
   546                                                                #(#DataSetColumnSpec
   554                                                                #(#DataSetColumnSpec
   547                                                                   #label: 'B'
   555                                                                   #label: 'B'
   548                                                                   #labelAlignment: #left
   556                                                                   #labelAlignment: #left
       
   557                                                                   #columnAlignment: #right
       
   558                                                                   #editorType: #InputField
       
   559                                                                   #type: #number
   549                                                                   #model: #blueFromColor:
   560                                                                   #model: #blueFromColor:
       
   561                                                                   #writeSelector: #blueAtColor:put:
   550                                                                   #canSelect: false
   562                                                                   #canSelect: false
   551                                                               )
   563                                                               )
   552                                                             )
   564                                                             )
   553                                                             #columnAdaptor: #colorColumnAdaptor
   565                                                             #columnAdaptor: #colorColumnAdaptor
   554                                                         )
   566                                                         )
   640                     #minorKey: #windowSpecForInfoBar
   652                     #minorKey: #windowSpecForInfoBar
   641                 )
   653                 )
   642               )
   654               )
   643           )
   655           )
   644       )
   656       )
   645 
       
   646     "Modified: / 29.7.1998 / 18:31:38 / cg"
       
   647 ! !
   657 ! !
   648 
   658 
   649 !ImageEditor class methodsFor:'menu specs'!
   659 !ImageEditor class methodsFor:'menu specs'!
   650 
   660 
   651 menu
   661 menu
  1207     "returns the list of colors in a List"
  1217     "returns the list of colors in a List"
  1208 
  1218 
  1209     |holder|
  1219     |holder|
  1210     (holder := builder bindingAt:#listOfColors) isNil ifTrue:[
  1220     (holder := builder bindingAt:#listOfColors) isNil ifTrue:[
  1211         builder aspectAt:#listOfColors put:(holder :=  List new).
  1221         builder aspectAt:#listOfColors put:(holder :=  List new).
       
  1222         holder addDependent:self.
  1212     ].
  1223     ].
  1213     ^ holder
  1224     ^ holder
  1214 !
  1225 !
  1215 
  1226 
  1216 selectionOfColor
  1227 selectionOfColor
  1262     ].
  1273     ].
  1263     self selectionOfColor value: 0.
  1274     self selectionOfColor value: 0.
  1264     self selectionOfColor value: (self listOfColors indexOf: imageEditView selectedColor).
  1275     self selectionOfColor value: (self listOfColors indexOf: imageEditView selectedColor).
  1265 !
  1276 !
  1266 
  1277 
       
  1278 update:something with:aParameter from:changedObject
       
  1279     super update:something with:aParameter from:changedObject
       
  1280 
       
  1281 !
       
  1282 
  1267 updateForNoneImage
  1283 updateForNoneImage
  1268     "updates channels and view, if image is loaded"
  1284     "updates channels and view, if image is loaded"
  1269 
  1285 
  1270     self imageIsLoaded value: false.
  1286     self imageIsLoaded value: false.
  1271     self listOfColors removeAll.
  1287     self listOfColors removeAll.
  1295 
  1311 
  1296 ! !
  1312 ! !
  1297 
  1313 
  1298 !ImageEditor methodsFor:'data access'!
  1314 !ImageEditor methodsFor:'data access'!
  1299 
  1315 
       
  1316 blueAtColor:aColor put:newBlue
       
  1317     "helper used to return a new row element, when blue is changed"
       
  1318 
       
  1319     |byte|
       
  1320 
       
  1321     aColor isNil ifTrue:[^ aColor].  "/ mask cannot be changed
       
  1322     byte := newBlue clampBetween:0 and:255.
       
  1323     ^ Color redByte:(aColor redByte) greenByte:(aColor greenByte) blueByte:byte
       
  1324 !
       
  1325 
  1300 blueFromColor:aColor
  1326 blueFromColor:aColor
  1301     "helper used to access a color as a row in the dataSet view"
  1327     "helper used to access a color as a row in the dataSet view"
  1302 
  1328 
  1303     aColor isNil ifTrue:[^ 'none'].
  1329     aColor isNil ifTrue:[^ 'none'].
  1304     ^ aColor blueByte ? 'mask'
  1330     ^ aColor blueByte ? 'mask'
  1305 
  1331 
  1306     "Created: / 26.7.1998 / 12:30:35 / cg"
  1332     "Created: / 26.7.1998 / 12:30:35 / cg"
  1307     "Modified: / 31.7.1998 / 01:11:18 / cg"
  1333     "Modified: / 31.7.1998 / 01:11:18 / cg"
  1308 !
  1334 !
  1309 
  1335 
       
  1336 greenAtColor:aColor put:newGreen
       
  1337     "helper used to return a new row element, when green is changed"
       
  1338 
       
  1339     |byte|
       
  1340 
       
  1341     aColor isNil ifTrue:[^ aColor].  "/ mask cannot be changed
       
  1342     byte := newGreen clampBetween:0 and:255.
       
  1343     ^ Color redByte:(aColor redByte) greenByte:byte blueByte:(aColor blueByte)
       
  1344 !
       
  1345 
  1310 greenFromColor:aColor
  1346 greenFromColor:aColor
  1311     "helper used to access a color as a row in the dataSet view"
  1347     "helper used to access a color as a row in the dataSet view"
  1312 
  1348 
  1313     aColor isNil ifTrue:[^ 'none'].
  1349     aColor isNil ifTrue:[^ 'none'].
  1314     ^ aColor greenByte ? 'mask'
  1350     ^ aColor greenByte ? 'mask'
  1315 
  1351 
  1316     "Created: / 26.7.1998 / 12:30:29 / cg"
  1352     "Created: / 26.7.1998 / 12:30:29 / cg"
  1317     "Modified: / 31.7.1998 / 01:11:31 / cg"
  1353     "Modified: / 31.7.1998 / 01:11:31 / cg"
       
  1354 !
       
  1355 
       
  1356 redAtColor:aColor put:newRed
       
  1357     "helper used to return a new row element, when red is changed"
       
  1358 
       
  1359     |byte|
       
  1360 
       
  1361     aColor isNil ifTrue:[^ aColor].  "/ mask cannot be changed
       
  1362     byte := newRed clampBetween:0 and:255.
       
  1363     ^ Color redByte:byte greenByte:(aColor greenByte) blueByte:(aColor blueByte)
  1318 !
  1364 !
  1319 
  1365 
  1320 redFromColor:aColor
  1366 redFromColor:aColor
  1321     "helper used to access a color as a row in the dataSet view"
  1367     "helper used to access a color as a row in the dataSet view"
  1322 
  1368