ImageEditor.st
changeset 1502 f5baa791b8cb
parent 1499 0c57ab09156b
child 1507 e65674cad5e5
equal deleted inserted replaced
1501:f760ccab7a35 1502:f5baa791b8cb
   512         #component: 
   512         #component: 
   513        #(#SpecCollection
   513        #(#SpecCollection
   514           #collection: #(
   514           #collection: #(
   515            #(#LabelSpec
   515            #(#LabelSpec
   516               #label: 'Left:'
   516               #label: 'Left:'
   517               #name: 'Label1'
   517               #name: 'GropLeftLabel'
   518               #layout: #(#LayoutFrame 14 0 21 0 90 0 43 0)
   518               #layout: #(#LayoutFrame 14 0 21 0 90 0 43 0)
   519               #translateLabel: true
   519               #translateLabel: true
   520               #adjust: #right
   520               #adjust: #right
   521             )
   521             )
   522            #(#InputFieldSpec
   522            #(#InputFieldSpec
   523               #name: 'EntryField1'
   523               #name: 'GropLeftEntryField'
   524               #layout: #(#LayoutFrame 95 0 21 0 132 0 43 0)
   524               #layout: #(#LayoutFrame 95 0 21 0 132 0 43 0)
   525               #model: #left
   525               #model: #left
   526               #type: #number
   526               #type: #number
       
   527               #acceptChannel: #acceptChannel
   527               #acceptOnPointerLeave: false
   528               #acceptOnPointerLeave: false
   528               #acceptChannel: #acceptChannel
   529             )
       
   530            #(#ActionButtonSpec
       
   531               #label: 'Now'
       
   532               #name: 'GropLeftNowButton'
       
   533               #layout: #(#LayoutFrame 148 0 21 0 221 0 43 0)
       
   534               #translateLabel: true
       
   535               #model: #gropLeftNow
   529             )
   536             )
   530            #(#LabelSpec
   537            #(#LabelSpec
   531               #label: 'Right:'
   538               #label: 'Right:'
   532               #name: 'Label2'
   539               #name: 'GropRightLabel'
   533               #layout: #(#LayoutFrame 14 0 51 0 90 0 73 0)
   540               #layout: #(#LayoutFrame 14 0 51 0 90 0 73 0)
   534               #translateLabel: true
   541               #translateLabel: true
   535               #adjust: #right
   542               #adjust: #right
   536             )
   543             )
   537            #(#InputFieldSpec
   544            #(#InputFieldSpec
   538               #name: 'EntryField2'
   545               #name: 'GropRightEntryField'
   539               #layout: #(#LayoutFrame 95 0 51 0 132 0 73 0)
   546               #layout: #(#LayoutFrame 95 0 51 0 132 0 73 0)
   540               #model: #right
   547               #model: #right
   541               #type: #number
   548               #type: #number
       
   549               #acceptChannel: #acceptChannel
   542               #acceptOnPointerLeave: false
   550               #acceptOnPointerLeave: false
   543               #acceptChannel: #acceptChannel
   551             )
       
   552            #(#ActionButtonSpec
       
   553               #label: 'Now'
       
   554               #name: 'GropRightButton'
       
   555               #layout: #(#LayoutFrame 148 0 51 0 221 0 73 0)
       
   556               #translateLabel: true
       
   557               #model: #gropRightNow
   544             )
   558             )
   545            #(#LabelSpec
   559            #(#LabelSpec
   546               #label: 'Top:'
   560               #label: 'Top:'
   547               #name: 'Label3'
   561               #name: 'GropTopLabel'
   548               #layout: #(#LayoutFrame 14 0 81 0 90 0 103 0)
   562               #layout: #(#LayoutFrame 14 0 81 0 90 0 103 0)
   549               #translateLabel: true
   563               #translateLabel: true
   550               #adjust: #right
   564               #adjust: #right
   551             )
   565             )
   552            #(#InputFieldSpec
   566            #(#InputFieldSpec
   553               #name: 'EntryField3'
   567               #name: 'GropTopEntryField'
   554               #layout: #(#LayoutFrame 95 0 81 0 132 0 103 0)
   568               #layout: #(#LayoutFrame 95 0 81 0 132 0 103 0)
   555               #model: #top
   569               #model: #top
   556               #type: #number
   570               #type: #number
       
   571               #acceptChannel: #acceptChannel
   557               #acceptOnPointerLeave: false
   572               #acceptOnPointerLeave: false
   558               #acceptChannel: #acceptChannel
   573             )
       
   574            #(#ActionButtonSpec
       
   575               #label: 'Now'
       
   576               #name: 'GropTopButton'
       
   577               #layout: #(#LayoutFrame 148 0 81 0 221 0 103 0)
       
   578               #translateLabel: true
       
   579               #model: #gropTopNow
   559             )
   580             )
   560            #(#LabelSpec
   581            #(#LabelSpec
   561               #label: 'Bottom:'
   582               #label: 'Bottom:'
   562               #name: 'Label4'
   583               #name: 'GropBottomLabel'
   563               #layout: #(#LayoutFrame 14 0 111 0 90 0 133 0)
   584               #layout: #(#LayoutFrame 14 0 111 0 90 0 133 0)
   564               #translateLabel: true
   585               #translateLabel: true
   565               #adjust: #right
   586               #adjust: #right
   566             )
   587             )
   567            #(#InputFieldSpec
   588            #(#InputFieldSpec
   568               #name: 'EntryField4'
   589               #name: 'GropBottomEntryField'
   569               #layout: #(#LayoutFrame 95 0 111 0 132 0 133 0)
   590               #layout: #(#LayoutFrame 95 0 111 0 132 0 133 0)
   570               #model: #bottom
   591               #model: #bottom
   571               #type: #number
   592               #type: #number
       
   593               #acceptChannel: #acceptChannel
   572               #acceptOnPointerLeave: false
   594               #acceptOnPointerLeave: false
   573               #acceptChannel: #acceptChannel
   595             )
       
   596            #(#ActionButtonSpec
       
   597               #label: 'Now'
       
   598               #name: 'GropBottomButton'
       
   599               #layout: #(#LayoutFrame 148 0 111 0 221 0 133 0)
       
   600               #translateLabel: true
       
   601               #model: #gropBottomNow
   574             )
   602             )
   575            #(#HorizontalPanelViewSpec
   603            #(#HorizontalPanelViewSpec
   576               #name: 'HorizontalPanel1'
   604               #name: 'HorizontalPanel1'
   577               #layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1)
   605               #layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1)
   578               #horizontalLayout: #fitSpace
   606               #horizontalLayout: #fitSpace
  2964 !
  2992 !
  2965 
  2993 
  2966 doCropManual
  2994 doCropManual
  2967     "let user specify borders and cut them off"
  2995     "let user specify borders and cut them off"
  2968 
  2996 
  2969     |bindings left top right bottom img firstChange applyAction acceptChannel|
  2997     |bindings left top right bottom img firstChange gropAction acceptChannel|
       
  2998 
       
  2999     acceptChannel := TriggerValue new.
  2970 
  3000 
  2971     firstChange := true.
  3001     firstChange := true.
  2972 
  3002 
  2973     applyAction := [
  3003     gropAction := 
  2974         |l r t b|
  3004         [:lV :rV :tV :bV | |l r t b|
  2975 
  3005             acceptChannel value:true.
  2976         acceptChannel value:true.
  3006 
  2977         l := left value.
  3007             l := lV value.
  2978         r := right value.
  3008             r := rV value.
  2979         t := top value.
  3009             t := tV value.
  2980         b := bottom value.
  3010             b := bV value.
  2981         img := imageEditView image.
  3011             (l + r + t + b) == 0 ifTrue:[
  2982         firstChange ifTrue:[
  3012                 Screen current beep
  2983             imageEditView makeUndo.
  3013             ] ifFalse:[
  2984             firstChange := false.
  3014                 img := imageEditView image.
       
  3015                 firstChange ifTrue:[
       
  3016                     imageEditView makeUndo.
       
  3017                     firstChange := false.
       
  3018                 ].
       
  3019                 imageEditView
       
  3020                     makeSubImageX:l y:t 
       
  3021                     width:(img width - l - r)
       
  3022                     height:(img height - t - b).
       
  3023                 self updateInfoLabel
       
  3024             ].
  2985         ].
  3025         ].
  2986         imageEditView
       
  2987             makeSubImageX:l y:t 
       
  2988             width:(img width - l - r)
       
  2989             height:(img height - t - b).
       
  2990         self updateInfoLabel
       
  2991     ].
       
  2992 
  3026 
  2993     bindings := IdentityDictionary new.
  3027     bindings := IdentityDictionary new.
  2994     bindings at:#left put:(left := 0 asValue).
  3028     bindings at:#left put:(left := 0 asValue).
  2995     bindings at:#right put:(right := 0 asValue).
  3029     bindings at:#right put:(right := 0 asValue).
  2996     bindings at:#top put:(top := 0 asValue).
  3030     bindings at:#top put:(top := 0 asValue).
  2997     bindings at:#bottom put:(bottom := 0 asValue).
  3031     bindings at:#bottom put:(bottom := 0 asValue).
  2998     bindings at:#acceptChannel put:(acceptChannel := TriggerValue new).
  3032     bindings at:#acceptChannel put:acceptChannel.
  2999 
  3033 
  3000     bindings at:#applyAction put:applyAction.
  3034     bindings at:#gropLeftNow   put:[ gropAction value:left value:0 value:0 value:0 ].
       
  3035     bindings at:#gropRightNow  put:[ gropAction value:0 value:right value:0 value:0 ].
       
  3036     bindings at:#gropTopNow    put:[ gropAction value:0 value:0 value:top value:0 ].
       
  3037     bindings at:#gropBottomNow put:[ gropAction value:0 value:0 value:0 value:bottom ].
       
  3038 
       
  3039     bindings at:#applyAction   put:[ gropAction value:left value:right value:top value:bottom ].
  3001 
  3040 
  3002     (self openDialogInterface:#gropDialogSpec withBindings:bindings) 
  3041     (self openDialogInterface:#gropDialogSpec withBindings:bindings) 
  3003         ifFalse:[ imageEditView undo ].
  3042         ifFalse:[ imageEditView undo ].
  3004 
  3043 
  3005     "Created: / 7.9.1998 / 18:16:07 / cg"
  3044     "Created: / 7.9.1998 / 18:16:07 / cg"