ImageEditor.st
changeset 1490 08f46b59ef9b
parent 1489 e1ca3c840420
child 1491 4249a6a1b252
equal deleted inserted replaced
1489:e1ca3c840420 1490:08f46b59ef9b
   502      #(#FullSpec
   502      #(#FullSpec
   503         #name: #gropDialogSpec
   503         #name: #gropDialogSpec
   504         #window: 
   504         #window: 
   505        #(#WindowSpec
   505        #(#WindowSpec
   506           #label: 'Crop Border(s)'
   506           #label: 'Crop Border(s)'
   507           #name: 'Crop Borders'
   507           #name: 'Crop Border(s)'
   508           #min: #(#Point 10 10)
   508           #min: #(#Point 10 10)
   509           #max: #(#Point 800 478)
   509           #max: #(#Point 800 478)
   510           #bounds: #(#Rectangle 16 46 261 229)
   510           #bounds: #(#Rectangle 16 46 261 229)
   511         )
   511         )
   512         #component: 
   512         #component: 
   523               #name: 'EntryField1'
   523               #name: 'EntryField1'
   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               #acceptOnPointerLeave: false
   527               #acceptOnPointerLeave: false
       
   528               #acceptChannel: #acceptChannel
   528             )
   529             )
   529            #(#LabelSpec
   530            #(#LabelSpec
   530               #label: 'Right:'
   531               #label: 'Right:'
   531               #name: 'Label2'
   532               #name: 'Label2'
   532               #layout: #(#LayoutFrame 14 0 51 0 90 0 73 0)
   533               #layout: #(#LayoutFrame 14 0 51 0 90 0 73 0)
   537               #name: 'EntryField2'
   538               #name: 'EntryField2'
   538               #layout: #(#LayoutFrame 95 0 51 0 132 0 73 0)
   539               #layout: #(#LayoutFrame 95 0 51 0 132 0 73 0)
   539               #model: #right
   540               #model: #right
   540               #type: #number
   541               #type: #number
   541               #acceptOnPointerLeave: false
   542               #acceptOnPointerLeave: false
       
   543               #acceptChannel: #acceptChannel
   542             )
   544             )
   543            #(#LabelSpec
   545            #(#LabelSpec
   544               #label: 'Top:'
   546               #label: 'Top:'
   545               #name: 'Label3'
   547               #name: 'Label3'
   546               #layout: #(#LayoutFrame 14 0 81 0 90 0 103 0)
   548               #layout: #(#LayoutFrame 14 0 81 0 90 0 103 0)
   551               #name: 'EntryField3'
   553               #name: 'EntryField3'
   552               #layout: #(#LayoutFrame 95 0 81 0 132 0 103 0)
   554               #layout: #(#LayoutFrame 95 0 81 0 132 0 103 0)
   553               #model: #top
   555               #model: #top
   554               #type: #number
   556               #type: #number
   555               #acceptOnPointerLeave: false
   557               #acceptOnPointerLeave: false
       
   558               #acceptChannel: #acceptChannel
   556             )
   559             )
   557            #(#LabelSpec
   560            #(#LabelSpec
   558               #label: 'Bottom:'
   561               #label: 'Bottom:'
   559               #name: 'Label4'
   562               #name: 'Label4'
   560               #layout: #(#LayoutFrame 14 0 111 0 90 0 133 0)
   563               #layout: #(#LayoutFrame 14 0 111 0 90 0 133 0)
   565               #name: 'EntryField4'
   568               #name: 'EntryField4'
   566               #layout: #(#LayoutFrame 95 0 111 0 132 0 133 0)
   569               #layout: #(#LayoutFrame 95 0 111 0 132 0 133 0)
   567               #model: #bottom
   570               #model: #bottom
   568               #type: #number
   571               #type: #number
   569               #acceptOnPointerLeave: false
   572               #acceptOnPointerLeave: false
       
   573               #acceptChannel: #acceptChannel
   570             )
   574             )
   571            #(#HorizontalPanelViewSpec
   575            #(#HorizontalPanelViewSpec
   572               #name: 'HorizontalPanel1'
   576               #name: 'HorizontalPanel1'
   573               #layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1)
   577               #layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1)
   574               #horizontalLayout: #fitSpace
   578               #horizontalLayout: #fitSpace
   582                  #(#ActionButtonSpec
   586                  #(#ActionButtonSpec
   583                     #label: 'Cancel'
   587                     #label: 'Cancel'
   584                     #name: 'Button1'
   588                     #name: 'Button1'
   585                     #translateLabel: true
   589                     #translateLabel: true
   586                     #model: #cancel
   590                     #model: #cancel
   587                     #extent: #(#Point 118 22)
   591                     #extent: #(#Point 77 22)
       
   592                   )
       
   593                  #(#ActionButtonSpec
       
   594                     #label: 'Apply'
       
   595                     #name: 'Button3'
       
   596                     #translateLabel: true
       
   597                     #model: #applyAction
       
   598                     #extent: #(#Point 78 22)
   588                   )
   599                   )
   589                  #(#ActionButtonSpec
   600                  #(#ActionButtonSpec
   590                     #label: 'OK'
   601                     #label: 'OK'
   591                     #name: 'Button2'
   602                     #name: 'Button2'
   592                     #translateLabel: true
   603                     #translateLabel: true
   593                     #model: #accept
   604                     #model: #accept
   594                     #extent: #(#Point 118 22)
   605                     #extent: #(#Point 78 22)
   595                   )
   606                   )
   596                  )
   607                  )
   597                
   608                
   598               )
   609               )
   599             )
   610             )
  2951 !
  2962 !
  2952 
  2963 
  2953 doCropManual
  2964 doCropManual
  2954     "let user specify borders and cut them off"
  2965     "let user specify borders and cut them off"
  2955 
  2966 
  2956     |bindings left top right bottom img|
  2967     |bindings left top right bottom img firstChange applyAction acceptChannel|
       
  2968 
       
  2969     firstChange := true.
       
  2970 
       
  2971     applyAction := [
       
  2972         |l r t b|
       
  2973 
       
  2974         acceptChannel value:true.
       
  2975         l := left value.
       
  2976         r := right value.
       
  2977         t := top value.
       
  2978         b := bottom value.
       
  2979         img := imageEditView image.
       
  2980         firstChange ifTrue:[
       
  2981             imageEditView makeUndo.
       
  2982             firstChange := false.
       
  2983         ].
       
  2984         imageEditView
       
  2985             makeSubImageX:l y:t 
       
  2986             width:(img width - l - r)
       
  2987             height:(img height - t - b).
       
  2988         self updateInfoLabel
       
  2989     ].
  2957 
  2990 
  2958     bindings := IdentityDictionary new.
  2991     bindings := IdentityDictionary new.
  2959     bindings at:#left put:(left := 0 asValue).
  2992     bindings at:#left put:(left := 0 asValue).
  2960     bindings at:#right put:(right := 0 asValue).
  2993     bindings at:#right put:(right := 0 asValue).
  2961     bindings at:#top put:(top := 0 asValue).
  2994     bindings at:#top put:(top := 0 asValue).
  2962     bindings at:#bottom put:(bottom := 0 asValue).
  2995     bindings at:#bottom put:(bottom := 0 asValue).
  2963     (self openDialogInterface:#gropDialogSpec withBindings:bindings)
  2996     bindings at:#acceptChannel put:(acceptChannel := TriggerValue new).
  2964     ifTrue:[
  2997 
  2965         left := left value.
  2998     bindings at:#applyAction put:applyAction.
  2966         right := right value.
  2999 
  2967         top := top value.
  3000     (self openDialogInterface:#gropDialogSpec withBindings:bindings) 
  2968         bottom := bottom value.
  3001         ifFalse:[ imageEditView undo ].
  2969         img := imageEditView image.
       
  2970         imageEditView
       
  2971             makeSubImageX:left y:top 
       
  2972             width:(img width - left - right)
       
  2973             height:(img height - top - bottom).
       
  2974         self updateInfoLabel
       
  2975     ].
       
  2976 
  3002 
  2977     "Created: / 7.9.1998 / 18:16:07 / cg"
  3003     "Created: / 7.9.1998 / 18:16:07 / cg"
  2978     "Modified: / 7.9.1998 / 18:20:42 / cg"
  3004     "Modified: / 7.9.1998 / 18:20:42 / cg"
  2979 !
  3005 !
  2980 
  3006