--- a/ImageEditor.st Thu Sep 13 10:34:51 2001 +0200
+++ b/ImageEditor.st Fri Sep 14 14:30:43 2001 +0200
@@ -504,7 +504,7 @@
#window:
#(#WindowSpec
#label: 'Crop Border(s)'
- #name: 'Crop Borders'
+ #name: 'Crop Border(s)'
#min: #(#Point 10 10)
#max: #(#Point 800 478)
#bounds: #(#Rectangle 16 46 261 229)
@@ -525,6 +525,7 @@
#model: #left
#type: #number
#acceptOnPointerLeave: false
+ #acceptChannel: #acceptChannel
)
#(#LabelSpec
#label: 'Right:'
@@ -539,6 +540,7 @@
#model: #right
#type: #number
#acceptOnPointerLeave: false
+ #acceptChannel: #acceptChannel
)
#(#LabelSpec
#label: 'Top:'
@@ -553,6 +555,7 @@
#model: #top
#type: #number
#acceptOnPointerLeave: false
+ #acceptChannel: #acceptChannel
)
#(#LabelSpec
#label: 'Bottom:'
@@ -567,6 +570,7 @@
#model: #bottom
#type: #number
#acceptOnPointerLeave: false
+ #acceptChannel: #acceptChannel
)
#(#HorizontalPanelViewSpec
#name: 'HorizontalPanel1'
@@ -584,14 +588,21 @@
#name: 'Button1'
#translateLabel: true
#model: #cancel
- #extent: #(#Point 118 22)
+ #extent: #(#Point 77 22)
+ )
+ #(#ActionButtonSpec
+ #label: 'Apply'
+ #name: 'Button3'
+ #translateLabel: true
+ #model: #applyAction
+ #extent: #(#Point 78 22)
)
#(#ActionButtonSpec
#label: 'OK'
#name: 'Button2'
#translateLabel: true
#model: #accept
- #extent: #(#Point 118 22)
+ #extent: #(#Point 78 22)
)
)
@@ -2953,26 +2964,41 @@
doCropManual
"let user specify borders and cut them off"
- |bindings left top right bottom img|
+ |bindings left top right bottom img firstChange applyAction acceptChannel|
+
+ 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.
+ ].
+ 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).
- (self openDialogInterface:#gropDialogSpec withBindings:bindings)
- ifTrue:[
- left := left value.
- right := right value.
- top := top value.
- bottom := bottom value.
- img := imageEditView image.
- imageEditView
- makeSubImageX:left y:top
- width:(img width - left - right)
- height:(img height - top - bottom).
- self updateInfoLabel
- ].
+ bindings at:#acceptChannel put:(acceptChannel := TriggerValue new).
+
+ bindings at:#applyAction put:applyAction.
+
+ (self openDialogInterface:#gropDialogSpec withBindings:bindings)
+ ifFalse:[ imageEditView undo ].
"Created: / 7.9.1998 / 18:16:07 / cg"
"Modified: / 7.9.1998 / 18:20:42 / cg"