# HG changeset patch # User Claus Gittinger # Date 1017170252 -3600 # Node ID 3848cbaaf6d9b353abb4d4ba20fcc3e1cd3c9942 # Parent 78409b670c8595971644414dcf1ff8909462e36b *** empty log message *** diff -r 78409b670c85 -r 3848cbaaf6d9 ImageEditor.st --- a/ImageEditor.st Mon Mar 18 14:07:19 2002 +0100 +++ b/ImageEditor.st Tue Mar 26 20:17:32 2002 +0100 @@ -956,210 +956,211 @@ - ^ - - #(#FullSpec - #window: - #(#WindowSpec - #name: 'Image Editor' - #layout: #(#LayoutFrame 507 0 28 0 1004 0 371 0) - #level: 0 - #label: 'Image Editor' - #min: #(#Point 400 320) - #bounds: #(#Rectangle 507 28 1005 372) - #menu: #menu - #usePreferredExtent: false - #returnIsOKInDialog: true - #escapeIsCancelInDialog: true - ) - #component: - #(#SpecCollection - #collection: - #( - #(#MenuPanelSpec - #name: 'menuToolbarView' - #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) - #menu: #menuToolbar - #style: #(#FontDescription #helvetica #medium #roman 10) - #showSeparatingLines: true - ) - #(#VariableHorizontalPanelSpec - #name: 'variableHorizontalPanel1' - #layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0) + ^ + #(#FullSpec + #name: #windowSpec + #window: + #(#WindowSpec + #label: 'Image Editor' + #name: 'Image Editor' + #min: #(#Point 400 320) + #bounds: #(#Rectangle 16 42 514 386) + #menu: #menu + ) + #component: + #(#SpecCollection + #collection: #( + #(#MenuPanelSpec + #name: 'menuToolbarView' + #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) + #menu: #menuToolbar + #style: #(#FontDescription #helvetica #medium #roman 10) + #showSeparatingLines: true + ) + #(#VariableHorizontalPanelSpec + #name: 'variableHorizontalPanel1' + #layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0) + #component: + #(#SpecCollection + #collection: #( + #(#ViewSpec + #name: 'view1' #component: - #(#SpecCollection - #collection: - #( - #(#ViewSpec - #name: 'view1' - #component: + #(#SpecCollection + #collection: #( + #(#VariableVerticalPanelSpec + #name: 'VariableVerticalPanel1' + #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #component: + #(#SpecCollection + #collection: #( + #(#ViewSpec + #name: 'View1' + #component: #(#SpecCollection - #collection: - #( - #(#VariableVerticalPanelSpec - #name: 'VariableVerticalPanel1' - #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) - #component: - #(#SpecCollection - #collection: - #( - #(#ViewSpec - #name: 'View1' - #component: - #(#SpecCollection - #collection: - #( - #(#MenuPanelSpec - #name: 'MouseButtonColorToolBar' - #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 24 0) - #menu: #menuMouseButtonColors - ) - #(#DataSetSpec - #name: 'colorDataSetView' - #layout: #(#LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0) - #activeHelpKey: #colorMapTable - #model: #selectionOfColor - #menu: #colorMapMenu - #style: #(#FontDescription #helvetica #medium #roman 10) - #hasHorizontalScrollBar: true - #hasVerticalScrollBar: true - #miniScrollerHorizontal: true - #miniScrollerVertical: true - #dataList: #listOfColors - #has3Dsepartors: true - #has3Dseparators: true - #verticalSpacing: 1 - #columns: - #( - #(#DataSetColumnSpec - #rendererType: #rowSelector - #backgroundSelector: #theColorItSelf: - ) - #(#DataSetColumnSpec - #label: 'R' - #labelAlignment: #left - #columnAlignment: #right - #editorType: #InputField - #type: #number - #model: #redFromColor: - #writeSelector: #redAtColor:put: - #selectSelector: #canSelectRedInColor: - ) - #(#DataSetColumnSpec - #label: 'G' - #labelAlignment: #left - #columnAlignment: #right - #editorType: #InputField - #type: #number - #model: #greenFromColor: - #writeSelector: #greenAtColor:put: - #selectSelector: #canSelectGreenInColor: - ) - #(#DataSetColumnSpec - #label: 'B' - #labelAlignment: #left - #columnAlignment: #right - #editorType: #InputField - #type: #number - #model: #blueFromColor: - #writeSelector: #blueAtColor:put: - #selectSelector: #canSelectBlueInColor: - ) - ) - #columnAdaptor: #colorColumnAdaptor - ) - ) - ) - ) - #(#ArbitraryComponentSpec - #name: 'imagePreView' - #activeHelpKey: #previewView - #hasHorizontalScrollBar: true - #hasVerticalScrollBar: true - #miniScrollerHorizontal: true - #miniScrollerVertical: true - #component: #ImageView - #hasBorder: false - ) - ) + #collection: #( + #(#MenuPanelSpec + #name: 'MouseButtonColorToolBar' + #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 24 0) + #menu: #menuMouseButtonColors + ) + #(#DataSetSpec + #name: 'colorDataSetView' + #layout: #(#LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0) + #activeHelpKey: #colorMapTable + #model: #selectionOfColor + #menu: #colorMapMenu + #style: #(#FontDescription #helvetica #medium #roman 10) + #hasHorizontalScrollBar: true + #hasVerticalScrollBar: true + #miniScrollerHorizontal: true + #miniScrollerVertical: true + #dataList: #listOfColors + #has3Dsepartors: true + #has3Dseparators: true + #verticalSpacing: 1 + #columns: + #(#OrderedCollection + + #(#DataSetColumnSpec + #labelButtonType: #Button + #rendererType: #rowSelector + #backgroundSelector: #theColorItSelf: + ) + #(#DataSetColumnSpec + #label: 'R' + #labelAlignment: #left + #labelButtonType: #Button + #columnAlignment: #right + #editorType: #InputField + #type: #number + #model: #redFromColor: + #writeSelector: #redAtColor:put: + #selectSelector: #canSelectRedInColor: + ) + + #(#DataSetColumnSpec + #label: 'G' + #labelAlignment: #left + #labelButtonType: #Button + #columnAlignment: #right + #editorType: #InputField + #type: #number + #model: #greenFromColor: + #writeSelector: #greenAtColor:put: + #selectSelector: #canSelectGreenInColor: + ) + #(#DataSetColumnSpec + #label: 'B' + #labelAlignment: #left + #labelButtonType: #Button + #columnAlignment: #right + #editorType: #InputField + #type: #number + #model: #blueFromColor: + #writeSelector: #blueAtColor:put: + #selectSelector: #canSelectBlueInColor: ) - #handles: #(#Any 0.723776 1.0) - ) - ) - ) - ) - #(#ViewSpec - #name: 'view2' - #level: -1 - #component: - #(#SpecCollection - #collection: - #( - #(#ArbitraryComponentSpec - #name: 'imageEditView' - #layout: #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0) - #hasHorizontalScrollBar: true - #hasVerticalScrollBar: true - #component: #ImageEditView - #hasBorder: false - ) - #(#LabelSpec - #name: 'coordLabel' - #layout: #(#LayoutFrame 2 0.0 -22 1 -83 1.0 0 1.0) - #level: -1 - #labelChannel: #imageInfoHolder - #resizeForLabel: false - #adjust: #left - ) - #(#ArrowButtonSpec - #name: 'magnifyDownButton' - #layout: #(#LayoutFrame -80 1 -22 1 -58 1 0 1) - #activeHelpKey: #magnifyImageDown - #model: #doMagnifyDown - #enableChannel: #imageIsLoaded - #isTriggerOnDown: true - #direction: #left + ) + #columnAdaptor: #colorColumnAdaptor ) - #(#ArrowButtonSpec - #name: 'magnifyUpButton' - #layout: #(#LayoutFrame -24 1 -22 1 -2 1 0 1) - #activeHelpKey: #magnifyImageUp - #model: #doMagnifyUp - #enableChannel: #imageIsLoaded - #isTriggerOnDown: true - #direction: #right - ) - #(#InputFieldSpec - #name: 'magnificationInputField' - #layout: #(#LayoutFrame -57 1 -22 1 -26 1 0 1) - #activeHelpKey: #magnificationNumber - #enableChannel: #imageIsLoaded - #model: #valueOfMagnification - #type: #numberInRange - #acceptOnReturn: false - #acceptOnTab: false - #numChars: 2 - #minValue: 1 - #maxValue: 99 - ) - ) + ) + + ) + ) + #(#ArbitraryComponentSpec + #name: 'imagePreView' + #activeHelpKey: #previewView + #menu: #previewMenu + #hasHorizontalScrollBar: true + #hasVerticalScrollBar: true + #miniScrollerHorizontal: true + #miniScrollerVertical: true + #hasBorder: false + #component: #ImageView ) + ) + ) + #handles: #(#Any 0.723776 1.0) ) + ) + ) - #handles: #(#Any 0.276 1.0) - ) - #(#UISubSpecification - #name: 'infoBarSubSpec' - #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) - #majorKey: #ToolApplicationModel - #minorKey: #windowSpecForInfoBar - ) + ) + #(#ViewSpec + #name: 'view2' + #level: -1 + #component: + #(#SpecCollection + #collection: #( + #(#ArbitraryComponentSpec + #name: 'imageEditView' + #layout: #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0) + #hasHorizontalScrollBar: true + #hasVerticalScrollBar: true + #hasBorder: false + #component: #ImageEditView + ) + #(#LabelSpec + #name: 'coordLabel' + #layout: #(#LayoutFrame 2 0.0 -22 1 -83 1.0 0 1.0) + #level: -1 + #labelChannel: #imageInfoHolder + #resizeForLabel: false + #adjust: #left + ) + #(#ArrowButtonSpec + #name: 'magnifyDownButton' + #layout: #(#LayoutFrame -80 1 -22 1 -58 1 0 1) + #activeHelpKey: #magnifyImageDown + #model: #doMagnifyDown + #enableChannel: #imageIsLoaded + #isTriggerOnDown: true + #direction: #left + ) + #(#ArrowButtonSpec + #name: 'magnifyUpButton' + #layout: #(#LayoutFrame -24 1 -22 1 -2 1 0 1) + #activeHelpKey: #magnifyImageUp + #model: #doMagnifyUp + #enableChannel: #imageIsLoaded + #isTriggerOnDown: true + #direction: #right + ) + #(#InputFieldSpec + #name: 'magnificationInputField' + #layout: #(#LayoutFrame -57 1 -22 1 -26 1 0 1) + #activeHelpKey: #magnificationNumber + #enableChannel: #imageIsLoaded + #model: #valueOfMagnification + #type: #numberInRange + #acceptOnReturn: false + #acceptOnTab: false + #numChars: 2 + #minValue: 1 + #maxValue: 99 + #acceptOnPointerLeave: false + ) + ) + + ) + ) + ) + ) - ) + #handles: #(#Any 0.276 1.0) + ) + #(#UISubSpecification + #name: 'infoBarSubSpec' + #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) + #majorKey: #ToolApplicationModel + #minorKey: #windowSpecForInfoBar + ) + ) + + ) ) - - "Modified: / 12.3.1999 / 00:15:05 / cg" ! ! !ImageEditor class methodsFor:'menu specs'! @@ -1822,6 +1823,34 @@ nil nil ) +! + +previewMenu + "This resource specification was automatically generated + by the MenuEditor of ST/X." + + "Do not manually edit this!! If it is corrupted, + the MenuEditor may not be able to read the specification." + + " + MenuEditor new openOnClass:ImageEditor andSelector:#previewMenu + (Menu new fromLiteralArrayEncoding:(ImageEditor previewMenu)) startUp + " + + + + ^ + #(#Menu + #( + #(#MenuItem + #label: 'TileMode' + #translateLabel: true + #indication: #tileModeHolder + ) + ) + nil + nil + ) ! ! !ImageEditor methodsFor:'accessing'! @@ -1979,6 +2008,15 @@ ^ holder ! +tileModeHolder + |holder| + (holder := builder bindingAt:#tileModeHolder) isNil ifTrue:[ + builder aspectAt:#tileModeHolder put:(holder := false asValue). + holder addDependent:self. + ]. + ^ holder +! + valueOfMagnification "returns current magnification of the image as an AspectAdaptor" @@ -2035,6 +2073,13 @@ |clrIndex img | img := self image. + + changedObject == self tileModeHolder ifTrue:[ + self imagePreView tileMode:(changedObject value) tileOffset:(img extent). + self imagePreView clear; invalidate. + ^ self + ]. + changedObject == self listOfColors ifTrue:[ something == #at: ifTrue:[ "/ colormap entry changed at aParameter @@ -2065,13 +2110,20 @@ self imagePreView image:img. self listOfColors contents:img colorMap. self findColorMapMode. + self tileModeHolder value ifTrue:[ + self imagePreView tileMode:true tileOffset:(img extent). + ]. ^ self. ]. something == #subImageIn ifTrue:[ self imagePreView image ~~ img ifTrue:[ self halt:'should not happen'. ]. - self imagePreView redraw:aParameter. + self tileModeHolder value ifTrue:[ + self imagePreView invalidate. + ] ifFalse:[ + self imagePreView invalidate:aParameter. + ]. ^ self. ]. something == #selectedColor ifTrue:[ @@ -2371,6 +2423,14 @@ "Modified: / 10.2.2000 / 23:16:42 / cg" ! ! +!ImageEditor methodsFor:'private'! + +updateImagePreView + self tileModeHolder value ifTrue:[ + self imagePreView tileMode:true tileOffset:(self image extent). + ] +! ! + !ImageEditor methodsFor:'queries'! hasMask @@ -3250,7 +3310,8 @@ (self openDialogInterface:#gropDialogSpec withBindings:bindings) ifFalse:[ firstChange ~~ true ifTrue:[ - imageEditView undo + imageEditView undo. + self updateImagePreView. ] ]. @@ -3404,7 +3465,6 @@ ifTrue:[ imageEditView resizeImageTo:newSize. ]. - ! doRotateImage @@ -3421,7 +3481,7 @@ (box accepted and: [(rotation := Object readFromString: box contents onError:nil) notNil]) ifTrue:[ imageEditView rotateImageBy:rotation. - self updateInfoLabel + self updateInfoLabel. ]. !