# HG changeset patch # User Claus Gittinger # Date 1016456839 -3600 # Node ID 78409b670c8595971644414dcf1ff8909462e36b # Parent 92d3ec7850cd46f9478fdc562e853b2d81bb495e added shift operation diff -r 92d3ec7850cd -r 78409b670c85 ImageEditor.st --- a/ImageEditor.st Fri Mar 15 23:20:39 2002 +0100 +++ b/ImageEditor.st Mon Mar 18 14:07:19 2002 +0100 @@ -709,6 +709,119 @@ ) ! +shiftDialogSpec + "This resource specification was automatically generated + by the UIPainter of ST/X." + + "Do not manually edit this!! If it is corrupted, + the UIPainter may not be able to read the specification." + + " + UIPainter new openOnClass:ImageEditor andSelector:#shiftDialogSpec + ImageEditor new openInterface:#shiftDialogSpec + " + + + + ^ + #(#FullSpec + #name: #shiftDialogSpec + #window: + #(#WindowSpec + #label: 'Shift' + #name: 'Shift' + #min: #(#Point 10 10) + #max: #(#Point 800 478) + #bounds: #(#Rectangle 16 46 261 229) + ) + #component: + #(#SpecCollection + #collection: #( + #(#LabelSpec + #label: 'Amount:' + #name: 'AmountLabel' + #layout: #(#LayoutFrame 14 0 21 0 90 0 43 0) + #translateLabel: true + #adjust: #right + ) + #(#InputFieldSpec + #name: 'AmountEntryField' + #layout: #(#LayoutFrame 95 0 21 0 132 0 43 0) + #tabable: true + #model: #shiftAmount + #type: #number + #acceptChannel: #acceptChannel + #acceptOnPointerLeave: false + ) + #(#HorizontalPanelViewSpec + #name: 'HorizontalPanel1' + #layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1) + #horizontalLayout: #fitSpace + #verticalLayout: #center + #horizontalSpace: 3 + #verticalSpace: 3 + #reverseOrderIfOKAtLeft: true + #component: + #(#SpecCollection + #collection: #( + #(#ActionButtonSpec + #label: 'Cancel' + #name: 'Button1' + #translateLabel: true + #tabable: true + #model: #cancel + #extent: #(#Point 118 22) + ) + #(#ActionButtonSpec + #label: 'OK' + #name: 'Button2' + #translateLabel: true + #tabable: true + #model: #accept + #extent: #(#Point 118 22) + ) + ) + + ) + ) + #(#ArrowButtonSpec + #name: 'ArrowButton1' + #layout: #(#LayoutFrame 105 0 67 0 127 0 89 0) + #model: #shiftUpNow + #isTriggerOnDown: true + #actionValue: '' + #direction: #up + ) + #(#ArrowButtonSpec + #name: 'ArrowButton2' + #layout: #(#LayoutFrame 88 0 86 0 110 0 108 0) + #model: #shiftLeftNow + #isTriggerOnDown: true + #actionValue: '' + #direction: #left + ) + #(#ArrowButtonSpec + #name: 'ArrowButton3' + #layout: #(#LayoutFrame 122 0 86 0 144 0 108 0) + #model: #shiftRightNow + #isTriggerOnDown: true + #actionValue: '' + #direction: #right + ) + #(#ArrowButtonSpec + #name: 'ArrowButton4' + #layout: #(#LayoutFrame 105 0 103 0 127 0 125 0) + #model: #shiftDownNow + #isTriggerOnDown: true + #actionValue: '' + #direction: #down + ) + ) + + ) + ) +! + ungropDialogSpec "This resource specification was automatically generated by the UIPainter of ST/X." @@ -1365,6 +1478,12 @@ ) ) #(#MenuItem + #label: 'Shift...' + #translateLabel: true + #value: #doShiftManual + #activeHelpKey: #shiftManual + ) + #(#MenuItem #label: 'Ungrop (Add Border)...' #translateLabel: true #value: #doUnCropManual @@ -3306,6 +3425,48 @@ ]. ! +doShiftManual + "let user specify amount and shift" + + |bindings amount img firstChange shiftAction acceptChannel| + + acceptChannel := TriggerValue new. + + firstChange := true. + + shiftAction := + [:shiftH :shiftV | + acceptChannel value:true. + + img := imageEditView image. + firstChange ifTrue:[ + imageEditView makeUndo. + firstChange := false. + ]. + imageEditView shiftImageHorizontal:shiftH value vertical:shiftV value. + self updateInfoLabel + ]. + + bindings := IdentityDictionary new. + bindings at:#shiftAmount put:(amount := 1 asValue). + bindings at:#acceptChannel put:acceptChannel. + + bindings at:#shiftLeftNow put:[ shiftAction value:(-1*amount value) value:0 ]. + bindings at:#shiftRightNow put:[ shiftAction value:amount value value:0 ]. + bindings at:#shiftUpNow put:[ shiftAction value:0 value:(-1*amount value) ]. + bindings at:#shiftDownNow put:[ shiftAction value:0 value:amount value ]. + + (self openDialogInterface:#shiftDialogSpec withBindings:bindings) + ifFalse:[ + firstChange ~~ true ifTrue:[ + imageEditView undo + ] + ]. + + "Created: / 7.9.1998 / 18:16:07 / cg" + "Modified: / 7.9.1998 / 18:20:42 / cg" +! + doUnCropManual "let user specify borders and add them"