ImageEditor.st
changeset 1713 088ff38c03a5
parent 1708 3737c6e1c72d
child 1715 9eebdb3802aa
equal deleted inserted replaced
1712:4badda593e48 1713:088ff38c03a5
  1092               #translateLabel: true
  1092               #translateLabel: true
  1093               #adjust: #right
  1093               #adjust: #right
  1094             )
  1094             )
  1095            #(#InputFieldSpec
  1095            #(#InputFieldSpec
  1096               #name: 'AmountEntryField'
  1096               #name: 'AmountEntryField'
  1097               #layout: #(#LayoutFrame 95 0 21 0 132 0 43 0)
  1097               #layout: #(#LayoutFrame 95 0 21 0 139 0 43 0)
  1098               #tabable: true
  1098               #tabable: true
  1099               #model: #shiftAmount
  1099               #model: #shiftAmount
  1100               #type: #number
  1100               #type: #number
  1101               #acceptChannel: #acceptChannel
  1101               #acceptChannel: #acceptChannel
  1102               #acceptOnPointerLeave: false
  1102               #acceptOnPointerLeave: false
  1135            #(#ArrowButtonSpec
  1135            #(#ArrowButtonSpec
  1136               #name: 'upArrowButton'
  1136               #name: 'upArrowButton'
  1137               #layout: #(#LayoutFrame 105 0 63 0 127 0 85 0)
  1137               #layout: #(#LayoutFrame 105 0 63 0 127 0 85 0)
  1138               #model: #shiftUpNow
  1138               #model: #shiftUpNow
  1139               #isTriggerOnDown: true
  1139               #isTriggerOnDown: true
       
  1140               #autoRepeat: true
  1140               #actionValue: ''
  1141               #actionValue: ''
  1141               #direction: #up
  1142               #direction: #up
  1142             )
  1143             )
  1143            #(#ArrowButtonSpec
  1144            #(#ArrowButtonSpec
  1144               #name: 'leftArrowButton'
  1145               #name: 'leftArrowButton'
  1145               #layout: #(#LayoutFrame 84 0 86 0 106 0 108 0)
  1146               #layout: #(#LayoutFrame 84 0 86 0 106 0 108 0)
  1146               #model: #shiftLeftNow
  1147               #model: #shiftLeftNow
  1147               #isTriggerOnDown: true
  1148               #isTriggerOnDown: true
       
  1149               #autoRepeat: true
  1148               #actionValue: ''
  1150               #actionValue: ''
  1149               #direction: #left
  1151               #direction: #left
  1150             )
  1152             )
  1151            #(#ArrowButtonSpec
  1153            #(#ArrowButtonSpec
  1152               #name: 'rightArrowButton'
  1154               #name: 'rightArrowButton'
  1153               #layout: #(#LayoutFrame 126 0 86 0 148 0 108 0)
  1155               #layout: #(#LayoutFrame 126 0 86 0 148 0 108 0)
  1154               #model: #shiftRightNow
  1156               #model: #shiftRightNow
  1155               #isTriggerOnDown: true
  1157               #isTriggerOnDown: true
       
  1158               #autoRepeat: true
  1156               #actionValue: ''
  1159               #actionValue: ''
  1157               #direction: #right
  1160               #direction: #right
  1158             )
  1161             )
  1159            #(#ArrowButtonSpec
  1162            #(#ArrowButtonSpec
  1160               #name: 'downArrowButton'
  1163               #name: 'downArrowButton'
  1161               #layout: #(#LayoutFrame 105 0 107 0 127 0 129 0)
  1164               #layout: #(#LayoutFrame 105 0 107 0 127 0 129 0)
  1162               #model: #shiftDownNow
  1165               #model: #shiftDownNow
  1163               #isTriggerOnDown: true
  1166               #isTriggerOnDown: true
       
  1167               #autoRepeat: true
  1164               #actionValue: ''
  1168               #actionValue: ''
  1165               #direction: #down
  1169               #direction: #down
       
  1170             )
       
  1171            #(#CheckBoxSpec
       
  1172               #label: 'Wrap'
       
  1173               #name: 'CheckBox1'
       
  1174               #layout: #(#LayoutFrame 153 0 22 0 289 0 44 0)
       
  1175               #model: #wrap
       
  1176               #translateLabel: true
  1166             )
  1177             )
  1167            )
  1178            )
  1168          
  1179          
  1169         )
  1180         )
  1170       )
  1181       )
  1705                   #label: 'Save as Button to File...'
  1716                   #label: 'Save as Button to File...'
  1706                   #itemValue: #doSaveButtonImageToFileAs
  1717                   #itemValue: #doSaveButtonImageToFileAs
  1707                   #translateLabel: true
  1718                   #translateLabel: true
  1708                 )
  1719                 )
  1709                #(#MenuItem
  1720                #(#MenuItem
       
  1721                   #enabled: #imageIsLoaded
  1710                   #label: 'Copy to Clipboard'
  1722                   #label: 'Copy to Clipboard'
  1711                   #itemValue: #doCopyImageToClipboard
  1723                   #itemValue: #doCopyImageToClipboard
  1712                   #enabled: #imageIsLoaded
       
  1713                   #translateLabel: true
  1724                   #translateLabel: true
  1714                 )
  1725                 )
  1715                #(#MenuItem
  1726                #(#MenuItem
  1716                   #label: '-'
  1727                   #label: '-'
  1717                 )
  1728                 )
  1883                     nil
  1894                     nil
  1884                     nil
  1895                     nil
  1885                   )
  1896                   )
  1886                 )
  1897                 )
  1887                #(#MenuItem
  1898                #(#MenuItem
       
  1899                   #activeHelpKey: #uncropManual
       
  1900                   #label: 'Uncrop (Add Border)...'
       
  1901                   #itemValue: #doUnCropManual
       
  1902                   #translateLabel: true
       
  1903                 )
       
  1904                #(#MenuItem
  1888                   #activeHelpKey: #shiftManual
  1905                   #activeHelpKey: #shiftManual
  1889                   #label: 'Shift...'
  1906                   #label: 'Shift...'
  1890                   #itemValue: #doShiftManual
  1907                   #itemValue: #doShiftManual
  1891                   #translateLabel: true
       
  1892                 )
       
  1893                #(#MenuItem
       
  1894                   #activeHelpKey: #uncropManual
       
  1895                   #label: 'Uncrop (Add Border)...'
       
  1896                   #itemValue: #doUnCropManual
       
  1897                   #translateLabel: true
  1908                   #translateLabel: true
  1898                 )
  1909                 )
  1899                )
  1910                )
  1900               nil
  1911               nil
  1901               nil
  1912               nil
  4289 !
  4300 !
  4290 
  4301 
  4291 doShiftManual
  4302 doShiftManual
  4292     "let user specify amount and shift"
  4303     "let user specify amount and shift"
  4293 
  4304 
  4294     |bindings amount img firstChange shiftAction acceptChannel|
  4305     |bindings amount img firstChange shiftAction acceptChannel wrapHolder|
  4295 
  4306 
  4296     acceptChannel := TriggerValue new.
  4307     acceptChannel := TriggerValue new.
       
  4308     wrapHolder := false asValue.
  4297 
  4309 
  4298     firstChange := true.
  4310     firstChange := true.
  4299 
  4311 
  4300     shiftAction := 
  4312     shiftAction := 
  4301         [:shiftH :shiftV | 
  4313         [:shiftH :shiftV | 
  4304             img := imageEditView image.
  4316             img := imageEditView image.
  4305             firstChange ifTrue:[
  4317             firstChange ifTrue:[
  4306                 imageEditView makeUndo.
  4318                 imageEditView makeUndo.
  4307                 firstChange := false.
  4319                 firstChange := false.
  4308             ].
  4320             ].
  4309             imageEditView shiftImageHorizontal:shiftH value vertical:shiftV value.
  4321             imageEditView shiftImageHorizontal:(shiftH value) vertical:(shiftV value) wrap:(wrapHolder value).
  4310             self updateInfoLabel
  4322             self updateInfoLabel
  4311         ].
  4323         ].
  4312 
  4324 
  4313     bindings := IdentityDictionary new.
  4325     bindings := IdentityDictionary new.
  4314     bindings at:#shiftAmount put:(amount := 1 asValue).
  4326     bindings at:#shiftAmount put:(amount := 1 asValue).
       
  4327     bindings at:#wrap put:wrapHolder.
  4315     bindings at:#acceptChannel put:acceptChannel.
  4328     bindings at:#acceptChannel put:acceptChannel.
  4316 
  4329 
  4317     bindings at:#shiftLeftNow   put:[ shiftAction value:(-1*amount value) value:0 ].
  4330     bindings at:#shiftLeftNow   put:[ shiftAction value:(-1*amount value) value:0 ].
  4318     bindings at:#shiftRightNow  put:[ shiftAction value:amount value value:0 ].
  4331     bindings at:#shiftRightNow  put:[ shiftAction value:amount value value:0 ].
  4319     bindings at:#shiftUpNow     put:[ shiftAction value:0 value:(-1*amount value) ].
  4332     bindings at:#shiftUpNow     put:[ shiftAction value:0 value:(-1*amount value) ].