ImageEditor.st
changeset 1557 78409b670c85
parent 1556 92d3ec7850cd
child 1558 3848cbaaf6d9
equal deleted inserted replaced
1556:92d3ec7850cd 1557:78409b670c85
   700                     #extent: #(#Point 78 22)
   700                     #extent: #(#Point 78 22)
   701                   )
   701                   )
   702                  )
   702                  )
   703                
   703                
   704               )
   704               )
       
   705             )
       
   706            )
       
   707          
       
   708         )
       
   709       )
       
   710 !
       
   711 
       
   712 shiftDialogSpec
       
   713     "This resource specification was automatically generated
       
   714      by the UIPainter of ST/X."
       
   715 
       
   716     "Do not manually edit this!! If it is corrupted,
       
   717      the UIPainter may not be able to read the specification."
       
   718 
       
   719     "
       
   720      UIPainter new openOnClass:ImageEditor andSelector:#shiftDialogSpec
       
   721      ImageEditor new openInterface:#shiftDialogSpec
       
   722     "
       
   723 
       
   724     <resource: #canvas>
       
   725 
       
   726     ^ 
       
   727      #(#FullSpec
       
   728         #name: #shiftDialogSpec
       
   729         #window: 
       
   730        #(#WindowSpec
       
   731           #label: 'Shift'
       
   732           #name: 'Shift'
       
   733           #min: #(#Point 10 10)
       
   734           #max: #(#Point 800 478)
       
   735           #bounds: #(#Rectangle 16 46 261 229)
       
   736         )
       
   737         #component: 
       
   738        #(#SpecCollection
       
   739           #collection: #(
       
   740            #(#LabelSpec
       
   741               #label: 'Amount:'
       
   742               #name: 'AmountLabel'
       
   743               #layout: #(#LayoutFrame 14 0 21 0 90 0 43 0)
       
   744               #translateLabel: true
       
   745               #adjust: #right
       
   746             )
       
   747            #(#InputFieldSpec
       
   748               #name: 'AmountEntryField'
       
   749               #layout: #(#LayoutFrame 95 0 21 0 132 0 43 0)
       
   750               #tabable: true
       
   751               #model: #shiftAmount
       
   752               #type: #number
       
   753               #acceptChannel: #acceptChannel
       
   754               #acceptOnPointerLeave: false
       
   755             )
       
   756            #(#HorizontalPanelViewSpec
       
   757               #name: 'HorizontalPanel1'
       
   758               #layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1)
       
   759               #horizontalLayout: #fitSpace
       
   760               #verticalLayout: #center
       
   761               #horizontalSpace: 3
       
   762               #verticalSpace: 3
       
   763               #reverseOrderIfOKAtLeft: true
       
   764               #component: 
       
   765              #(#SpecCollection
       
   766                 #collection: #(
       
   767                  #(#ActionButtonSpec
       
   768                     #label: 'Cancel'
       
   769                     #name: 'Button1'
       
   770                     #translateLabel: true
       
   771                     #tabable: true
       
   772                     #model: #cancel
       
   773                     #extent: #(#Point 118 22)
       
   774                   )
       
   775                  #(#ActionButtonSpec
       
   776                     #label: 'OK'
       
   777                     #name: 'Button2'
       
   778                     #translateLabel: true
       
   779                     #tabable: true
       
   780                     #model: #accept
       
   781                     #extent: #(#Point 118 22)
       
   782                   )
       
   783                  )
       
   784                
       
   785               )
       
   786             )
       
   787            #(#ArrowButtonSpec
       
   788               #name: 'ArrowButton1'
       
   789               #layout: #(#LayoutFrame 105 0 67 0 127 0 89 0)
       
   790               #model: #shiftUpNow
       
   791               #isTriggerOnDown: true
       
   792               #actionValue: ''
       
   793               #direction: #up
       
   794             )
       
   795            #(#ArrowButtonSpec
       
   796               #name: 'ArrowButton2'
       
   797               #layout: #(#LayoutFrame 88 0 86 0 110 0 108 0)
       
   798               #model: #shiftLeftNow
       
   799               #isTriggerOnDown: true
       
   800               #actionValue: ''
       
   801               #direction: #left
       
   802             )
       
   803            #(#ArrowButtonSpec
       
   804               #name: 'ArrowButton3'
       
   805               #layout: #(#LayoutFrame 122 0 86 0 144 0 108 0)
       
   806               #model: #shiftRightNow
       
   807               #isTriggerOnDown: true
       
   808               #actionValue: ''
       
   809               #direction: #right
       
   810             )
       
   811            #(#ArrowButtonSpec
       
   812               #name: 'ArrowButton4'
       
   813               #layout: #(#LayoutFrame 105 0 103 0 127 0 125 0)
       
   814               #model: #shiftDownNow
       
   815               #isTriggerOnDown: true
       
   816               #actionValue: ''
       
   817               #direction: #down
   705             )
   818             )
   706            )
   819            )
   707          
   820          
   708         )
   821         )
   709       )
   822       )
  1363                     nil
  1476                     nil
  1364                     nil
  1477                     nil
  1365                   )
  1478                   )
  1366                 )
  1479                 )
  1367                #(#MenuItem
  1480                #(#MenuItem
       
  1481                   #label: 'Shift...'
       
  1482                   #translateLabel: true
       
  1483                   #value: #doShiftManual
       
  1484                   #activeHelpKey: #shiftManual
       
  1485                 )
       
  1486                #(#MenuItem
  1368                   #label: 'Ungrop (Add Border)...'
  1487                   #label: 'Ungrop (Add Border)...'
  1369                   #translateLabel: true
  1488                   #translateLabel: true
  1370                   #value: #doUnCropManual
  1489                   #value: #doUnCropManual
  1371                   #activeHelpKey: #uncropManual
  1490                   #activeHelpKey: #uncropManual
  1372                 )
  1491                 )
  3304         imageEditView rotateImageBy:rotation.
  3423         imageEditView rotateImageBy:rotation.
  3305         self updateInfoLabel
  3424         self updateInfoLabel
  3306     ].
  3425     ].
  3307 !
  3426 !
  3308 
  3427 
       
  3428 doShiftManual
       
  3429     "let user specify amount and shift"
       
  3430 
       
  3431     |bindings amount img firstChange shiftAction acceptChannel|
       
  3432 
       
  3433     acceptChannel := TriggerValue new.
       
  3434 
       
  3435     firstChange := true.
       
  3436 
       
  3437     shiftAction := 
       
  3438         [:shiftH :shiftV | 
       
  3439             acceptChannel value:true.
       
  3440 
       
  3441             img := imageEditView image.
       
  3442             firstChange ifTrue:[
       
  3443                 imageEditView makeUndo.
       
  3444                 firstChange := false.
       
  3445             ].
       
  3446             imageEditView shiftImageHorizontal:shiftH value vertical:shiftV value.
       
  3447             self updateInfoLabel
       
  3448         ].
       
  3449 
       
  3450     bindings := IdentityDictionary new.
       
  3451     bindings at:#shiftAmount put:(amount := 1 asValue).
       
  3452     bindings at:#acceptChannel put:acceptChannel.
       
  3453 
       
  3454     bindings at:#shiftLeftNow   put:[ shiftAction value:(-1*amount value) value:0 ].
       
  3455     bindings at:#shiftRightNow  put:[ shiftAction value:amount value value:0 ].
       
  3456     bindings at:#shiftUpNow     put:[ shiftAction value:0 value:(-1*amount value) ].
       
  3457     bindings at:#shiftDownNow   put:[ shiftAction value:0 value:amount value ].
       
  3458 
       
  3459     (self openDialogInterface:#shiftDialogSpec withBindings:bindings) 
       
  3460     ifFalse:[ 
       
  3461         firstChange ~~ true ifTrue:[
       
  3462           imageEditView undo
       
  3463         ]
       
  3464     ].
       
  3465 
       
  3466     "Created: / 7.9.1998 / 18:16:07 / cg"
       
  3467     "Modified: / 7.9.1998 / 18:20:42 / cg"
       
  3468 !
       
  3469 
  3309 doUnCropManual
  3470 doUnCropManual
  3310     "let user specify borders and add them"
  3471     "let user specify borders and add them"
  3311 
  3472 
  3312     |bindings left top right bottom img|
  3473     |bindings left top right bottom img|
  3313 
  3474