--- a/ImageEditor.st Wed Oct 10 16:08:49 2001 +0200
+++ b/ImageEditor.st Fri Oct 12 15:00:21 2001 +0200
@@ -514,63 +514,91 @@
#collection: #(
#(#LabelSpec
#label: 'Left:'
- #name: 'Label1'
+ #name: 'GropLeftLabel'
#layout: #(#LayoutFrame 14 0 21 0 90 0 43 0)
#translateLabel: true
#adjust: #right
)
#(#InputFieldSpec
- #name: 'EntryField1'
+ #name: 'GropLeftEntryField'
#layout: #(#LayoutFrame 95 0 21 0 132 0 43 0)
#model: #left
#type: #number
+ #acceptChannel: #acceptChannel
#acceptOnPointerLeave: false
- #acceptChannel: #acceptChannel
+ )
+ #(#ActionButtonSpec
+ #label: 'Now'
+ #name: 'GropLeftNowButton'
+ #layout: #(#LayoutFrame 148 0 21 0 221 0 43 0)
+ #translateLabel: true
+ #model: #gropLeftNow
)
#(#LabelSpec
#label: 'Right:'
- #name: 'Label2'
+ #name: 'GropRightLabel'
#layout: #(#LayoutFrame 14 0 51 0 90 0 73 0)
#translateLabel: true
#adjust: #right
)
#(#InputFieldSpec
- #name: 'EntryField2'
+ #name: 'GropRightEntryField'
#layout: #(#LayoutFrame 95 0 51 0 132 0 73 0)
#model: #right
#type: #number
+ #acceptChannel: #acceptChannel
#acceptOnPointerLeave: false
- #acceptChannel: #acceptChannel
+ )
+ #(#ActionButtonSpec
+ #label: 'Now'
+ #name: 'GropRightButton'
+ #layout: #(#LayoutFrame 148 0 51 0 221 0 73 0)
+ #translateLabel: true
+ #model: #gropRightNow
)
#(#LabelSpec
#label: 'Top:'
- #name: 'Label3'
+ #name: 'GropTopLabel'
#layout: #(#LayoutFrame 14 0 81 0 90 0 103 0)
#translateLabel: true
#adjust: #right
)
#(#InputFieldSpec
- #name: 'EntryField3'
+ #name: 'GropTopEntryField'
#layout: #(#LayoutFrame 95 0 81 0 132 0 103 0)
#model: #top
#type: #number
+ #acceptChannel: #acceptChannel
#acceptOnPointerLeave: false
- #acceptChannel: #acceptChannel
+ )
+ #(#ActionButtonSpec
+ #label: 'Now'
+ #name: 'GropTopButton'
+ #layout: #(#LayoutFrame 148 0 81 0 221 0 103 0)
+ #translateLabel: true
+ #model: #gropTopNow
)
#(#LabelSpec
#label: 'Bottom:'
- #name: 'Label4'
+ #name: 'GropBottomLabel'
#layout: #(#LayoutFrame 14 0 111 0 90 0 133 0)
#translateLabel: true
#adjust: #right
)
#(#InputFieldSpec
- #name: 'EntryField4'
+ #name: 'GropBottomEntryField'
#layout: #(#LayoutFrame 95 0 111 0 132 0 133 0)
#model: #bottom
#type: #number
+ #acceptChannel: #acceptChannel
#acceptOnPointerLeave: false
- #acceptChannel: #acceptChannel
+ )
+ #(#ActionButtonSpec
+ #label: 'Now'
+ #name: 'GropBottomButton'
+ #layout: #(#LayoutFrame 148 0 111 0 221 0 133 0)
+ #translateLabel: true
+ #model: #gropBottomNow
)
#(#HorizontalPanelViewSpec
#name: 'HorizontalPanel1'
@@ -2966,38 +2994,49 @@
doCropManual
"let user specify borders and cut them off"
- |bindings left top right bottom img firstChange applyAction acceptChannel|
+ |bindings left top right bottom img firstChange gropAction acceptChannel|
+
+ acceptChannel := TriggerValue new.
firstChange := true.
- applyAction := [
- |l r t b|
-
- acceptChannel value:true.
- l := left value.
- r := right value.
- t := top value.
- b := bottom value.
- img := imageEditView image.
- firstChange ifTrue:[
- imageEditView makeUndo.
- firstChange := false.
+ gropAction :=
+ [:lV :rV :tV :bV | |l r t b|
+ acceptChannel value:true.
+
+ l := lV value.
+ r := rV value.
+ t := tV value.
+ b := bV value.
+ (l + r + t + b) == 0 ifTrue:[
+ Screen current beep
+ ] ifFalse:[
+ img := imageEditView image.
+ firstChange ifTrue:[
+ imageEditView makeUndo.
+ firstChange := false.
+ ].
+ imageEditView
+ makeSubImageX:l y:t
+ width:(img width - l - r)
+ height:(img height - t - b).
+ self updateInfoLabel
+ ].
].
- imageEditView
- makeSubImageX:l y:t
- width:(img width - l - r)
- height:(img height - t - b).
- self updateInfoLabel
- ].
bindings := IdentityDictionary new.
bindings at:#left put:(left := 0 asValue).
bindings at:#right put:(right := 0 asValue).
bindings at:#top put:(top := 0 asValue).
bindings at:#bottom put:(bottom := 0 asValue).
- bindings at:#acceptChannel put:(acceptChannel := TriggerValue new).
-
- bindings at:#applyAction put:applyAction.
+ bindings at:#acceptChannel put:acceptChannel.
+
+ bindings at:#gropLeftNow put:[ gropAction value:left value:0 value:0 value:0 ].
+ bindings at:#gropRightNow put:[ gropAction value:0 value:right value:0 value:0 ].
+ bindings at:#gropTopNow put:[ gropAction value:0 value:0 value:top value:0 ].
+ bindings at:#gropBottomNow put:[ gropAction value:0 value:0 value:0 value:bottom ].
+
+ bindings at:#applyAction put:[ gropAction value:left value:right value:top value:bottom ].
(self openDialogInterface:#gropDialogSpec withBindings:bindings)
ifFalse:[ imageEditView undo ].