# HG changeset patch # User Claus Gittinger # Date 1487519962 -3600 # Node ID 52d0f1ff020d0139ef7f8377de4586f27303d87b # Parent bd8ab9274cbdb2a158af5b33993e6b786a7c79cc #OTHER by cg crop-manual now as inline spec diff -r bd8ab9274cbd -r 52d0f1ff020d ImageEditor.st --- a/ImageEditor.st Sun Feb 19 11:06:36 2017 +0100 +++ b/ImageEditor.st Sun Feb 19 16:59:22 2017 +0100 @@ -465,19 +465,19 @@ #floodFillMaxError 'Specify the max. allowed deviation from the clicked pixel in a flood-fill operation.\Pixels where the hue/light values differ less than that fraction\will be included in the fill.\The range must be between 0 and 1. With 0, only areas with exactly the same pixel will be filled.\With 1, every other pixel is included.\\When filling gradiented areas, start with small values, such as 0.05, and increase slowly.' -#gropAll +#cropAll 'Crop (cut off) all four sides by the amounts entered into the above fields.' -#gropBottom +#cropBottom 'Cut off the specified number of pixels at the bottom' -#gropLeft +#cropLeft 'Cut off the specified number of pixels at the left' -#gropRight +#cropRight 'Cut off the specified number of pixels at the right' -#gropTop +#cropTop 'Cut off the specified number of pixels at the top' #magnificationNumber @@ -554,7 +554,7 @@ ) - "Modified: / 17-02-2017 / 15:32:45 / cg" + "Modified: / 19-02-2017 / 15:10:03 / cg" ! helpSpec @@ -1445,7 +1445,7 @@ ) ! -cropDialogSpec +cropSpec "This resource specification was automatically generated by the UIPainter of ST/X." @@ -1453,15 +1453,15 @@ the UIPainter may not be able to read the specification." " - UIPainter new openOnClass:ImageEditor andSelector:#cropDialogSpec - ImageEditor new openInterface:#cropDialogSpec + UIPainter new openOnClass:ImageEditor andSelector:#cropSpec + ImageEditor new openInterface:#cropSpec " ^ #(FullSpec - name: cropDialogSpec + name: cropSpec window: (WindowSpec label: 'Crop Border(s)' @@ -1474,121 +1474,121 @@ collection: ( (LabelSpec label: 'Left:' - name: 'GropLeftLabel' + name: 'CropLeftLabel' layout: (LayoutFrame 14 0 24 0 90 0 46 0) - activeHelpKey: gropLeft + activeHelpKey: cropLeft translateLabel: true adjust: left ) (InputFieldSpec - name: 'GropLeftEntryField' + name: 'CropLeftEntryField' layout: (LayoutFrame 95 0 24 0 125 0 46 0) - activeHelpKey: gropLeft + activeHelpKey: cropLeft tabable: true - model: gropLeftAmount + model: cropLeftAmount type: number acceptChannel: acceptChannel acceptOnPointerLeave: false ) (ActionButtonSpec - label: 'Now' - name: 'GropLeftNowButton' - layout: (LayoutFrame 133 0 21 0 187 0 50 0) - activeHelpKey: gropLeft + label: 'Crop Now' + name: 'CropLeftNowButton' + layout: (LayoutFrame 133 0 21 0 232 0 50 0) + activeHelpKey: cropLeft translateLabel: true resizeForLabel: true tabable: true - model: gropLeftNow + model: cropLeftNow autoRepeat: true usePreferredWidth: true ) (LabelSpec label: 'Right:' - name: 'GropRightLabel' + name: 'CropRightLabel' layout: (LayoutFrame 14 0 55 0 90 0 77 0) - activeHelpKey: gropRight + activeHelpKey: cropRight translateLabel: true adjust: left ) (InputFieldSpec - name: 'GropRightEntryField' + name: 'CropRightEntryField' layout: (LayoutFrame 95 0 55 0 125 0 77 0) - activeHelpKey: gropRight + activeHelpKey: cropRight tabable: true - model: gropRightAmount + model: cropRightAmount type: number acceptChannel: acceptChannel acceptOnPointerLeave: false ) (ActionButtonSpec - label: 'Now' - name: 'GropRightButton' - layout: (LayoutFrame 133 0 51 0 187 0 80 0) - activeHelpKey: gropRight + label: 'Crop Now' + name: 'CropRightButton' + layout: (LayoutFrame 133 0 51 0 232 0 80 0) + activeHelpKey: cropRight translateLabel: true resizeForLabel: true tabable: true - model: gropRightNow + model: cropRightNow autoRepeat: true usePreferredWidth: true ) (LabelSpec label: 'Top:' - name: 'GropTopLabel' + name: 'CropTopLabel' layout: (LayoutFrame 14 0 85 0 90 0 107 0) - activeHelpKey: gropTop + activeHelpKey: cropTop translateLabel: true adjust: left ) (InputFieldSpec - name: 'GropTopEntryField' + name: 'CropTopEntryField' layout: (LayoutFrame 95 0 85 0 125 0 107 0) - activeHelpKey: gropTop + activeHelpKey: cropTop tabable: true - model: gropTopAmount + model: cropTopAmount type: number acceptChannel: acceptChannel acceptOnPointerLeave: false ) (ActionButtonSpec - label: 'Now' - name: 'GropTopButton' - layout: (LayoutFrame 133 0 81 0 187 0 110 0) - activeHelpKey: gropTop + label: 'Crop Now' + name: 'CropTopButton' + layout: (LayoutFrame 133 0 81 0 232 0 110 0) + activeHelpKey: cropTop translateLabel: true resizeForLabel: true tabable: true - model: gropTopNow + model: cropTopNow autoRepeat: true usePreferredWidth: true ) (LabelSpec label: 'Bottom:' - name: 'GropBottomLabel' + name: 'CropBottomLabel' layout: (LayoutFrame 14 0 115 0 90 0 137 0) - activeHelpKey: gropBottom + activeHelpKey: cropBottom translateLabel: true adjust: left ) (InputFieldSpec - name: 'GropBottomEntryField' + name: 'CropBottomEntryField' layout: (LayoutFrame 95 0 115 0 125 0 137 0) - activeHelpKey: gropBottom + activeHelpKey: cropBottom tabable: true - model: gropBottomAmount + model: cropBottomAmount type: number acceptChannel: acceptChannel acceptOnPointerLeave: false ) (ActionButtonSpec - label: 'Now' - name: 'GropBottomButton' - layout: (LayoutFrame 133 0 111 0 187 0 140 0) - activeHelpKey: gropBottom + label: 'Crop Now' + name: 'CropBottomButton' + layout: (LayoutFrame 133 0 111 0 232 0 140 0) + activeHelpKey: cropBottom translateLabel: true resizeForLabel: true tabable: true - model: gropBottomNow + model: cropBottomNow autoRepeat: true usePreferredWidth: true ) @@ -1596,8 +1596,7 @@ label: 'Crop All' name: 'Button4' layout: (LayoutFrame 133 0 148 0 237 0 176 0) - activeHelpKey: gropAll - visibilityChannel: cropBoxIsNotDialog + activeHelpKey: cropAll translateLabel: true resizeForLabel: true tabable: true @@ -1605,7 +1604,7 @@ ) (HorizontalPanelViewSpec name: 'HorizontalPanel1' - layout: (LayoutFrame 0 0.0 -30 1 -16 1.0 0 1) + layout: (LayoutFrame 0 0.0 -30 1 0 1.0 0 1) visibilityChannel: cropBoxIsDialog horizontalLayout: fitSpace verticalLayout: center @@ -1622,7 +1621,7 @@ resizeForLabel: true tabable: true model: cancel - extent: (Point 110 28) + extent: (Point 116 28) ) (ActionButtonSpec label: 'Apply' @@ -1631,7 +1630,7 @@ resizeForLabel: true tabable: true model: applyCropAction - extent: (Point 111 28) + extent: (Point 116 28) ) (ActionButtonSpec label: 'OK' @@ -1640,61 +1639,11 @@ resizeForLabel: true tabable: true model: accept - extent: (Point 111 28) + extent: (Point 116 28) ) ) ) - keepSpaceForOSXResizeHandleH: true - ) - (LabelSpec - label: 'Floodfill Tolerance:' - name: 'Label1' - layout: (LayoutFrame 14 0 192 0 242 0 214 0) - activeHelpKey: floodFillMaxError - visibilityChannel: cropBoxIsNotDialog - translateLabel: true - adjust: left - ) - (LabelSpec - label: 'Hue:' - name: 'Label2' - layout: (LayoutFrame 51 0 220 0 127 0 242 0) - activeHelpKey: floodFillMaxError - visibilityChannel: cropBoxIsNotDialog - translateLabel: true - adjust: left - ) - (InputFieldSpec - name: 'EntryField2' - layout: (LayoutFrame 132 0 220 0 190 0 242 0) - activeHelpKey: floodFillMaxError - visibilityChannel: cropBoxIsNotDialog - tabable: true - model: floodFillMaxHueError - type: number - acceptChannel: acceptChannel - acceptOnPointerLeave: true - ) - (LabelSpec - label: 'Light:' - name: 'Label3' - layout: (LayoutFrame 51 0 246 0 127 0 268 0) - activeHelpKey: floodFillMaxError - visibilityChannel: cropBoxIsNotDialog - translateLabel: true - adjust: left - ) - (InputFieldSpec - name: 'EntryField3' - layout: (LayoutFrame 132 0 246 0 190 0 268 0) - activeHelpKey: floodFillMaxError - visibilityChannel: cropBoxIsNotDialog - tabable: true - model: floodFillMaxLightError - type: number - acceptChannel: acceptChannel - acceptOnPointerLeave: true ) ) @@ -1796,6 +1745,131 @@ ) ! +floodFillToleranceSpec + "This resource specification was automatically generated + by the UIPainter of ST/X." + + "Do not manually edit this!! If it is corrupted, + the UIPainter may not be able to read the specification." + + " + UIPainter new openOnClass:ImageEditor andSelector:#floodFillToleranceSpec + ImageEditor new openInterface:#floodFillToleranceSpec + " + + + + ^ + #(FullSpec + name: floodFillToleranceSpec + window: + (WindowSpec + label: 'Flood Fill Tolerance' + name: 'Flood Fill Tolerance' + min: (Point 10 10) + bounds: (Rectangle 0 0 364 312) + ) + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Flood Fill Tolerance:' + name: 'Label1' + layout: (LayoutFrame 14 0 10 0 242 0 32 0) + activeHelpKey: floodFillMaxError + visibilityChannel: cropBoxIsNotDialog + translateLabel: true + adjust: left + ) + (LabelSpec + label: 'Hue:' + name: 'Label2' + layout: (LayoutFrame 51 0 38 0 127 0 60 0) + activeHelpKey: floodFillMaxError + visibilityChannel: cropBoxIsNotDialog + translateLabel: true + adjust: left + ) + (InputFieldSpec + name: 'EntryField2' + layout: (LayoutFrame 132 0 38 0 190 0 60 0) + activeHelpKey: floodFillMaxError + visibilityChannel: cropBoxIsNotDialog + tabable: true + model: floodFillMaxHueError + type: number + acceptChannel: acceptChannel + acceptOnPointerLeave: true + ) + (LabelSpec + label: 'Light:' + name: 'Label3' + layout: (LayoutFrame 51 0 64 0 127 0 86 0) + activeHelpKey: floodFillMaxError + visibilityChannel: cropBoxIsNotDialog + translateLabel: true + adjust: left + ) + (InputFieldSpec + name: 'EntryField3' + layout: (LayoutFrame 132 0 64 0 190 0 86 0) + activeHelpKey: floodFillMaxError + visibilityChannel: cropBoxIsNotDialog + tabable: true + model: floodFillMaxLightError + type: number + acceptChannel: acceptChannel + acceptOnPointerLeave: true + ) + (HorizontalPanelViewSpec + name: 'HorizontalPanel1' + layout: (LayoutFrame 0 0.0 -30 1 0 1.0 0 1) + visibilityChannel: cropBoxIsDialog + horizontalLayout: fitSpace + verticalLayout: center + horizontalSpace: 3 + verticalSpace: 3 + reverseOrderIfOKAtLeft: true + component: + (SpecCollection + collection: ( + (ActionButtonSpec + label: 'Cancel' + name: 'Button1' + translateLabel: true + resizeForLabel: true + tabable: true + model: cancel + extent: (Point 116 28) + ) + (ActionButtonSpec + label: 'Apply' + name: 'Button3' + translateLabel: true + resizeForLabel: true + tabable: true + model: applyCropAction + extent: (Point 116 28) + ) + (ActionButtonSpec + label: 'OK' + name: 'Button2' + translateLabel: true + resizeForLabel: true + tabable: true + model: accept + extent: (Point 116 28) + ) + ) + + ) + ) + ) + + ) + ) +! + shiftDialogSpec "This resource specification was automatically generated by the UIPainter of ST/X." @@ -1919,7 +1993,7 @@ ) ! -uncropDialogSpec +uncropSpec "This resource specification was automatically generated by the UIPainter of ST/X." @@ -1927,117 +2001,115 @@ the UIPainter may not be able to read the specification." " - UIPainter new openOnClass:ImageEditor andSelector:#uncropDialogSpec - ImageEditor new openInterface:#uncropDialogSpec + UIPainter new openOnClass:ImageEditor andSelector:#uncropSpec + ImageEditor new openInterface:#uncropSpec " ^ - #(FullSpec - name: uncropDialogSpec - window: - (WindowSpec - label: 'Add Border(s)' - name: 'Add Border(s)' - min: (Point 10 10) - max: (Point 800 478) - bounds: (Rectangle 0 0 261 228) - ) - component: - (SpecCollection - collection: ( - (LabelSpec - label: 'Left:' - name: 'Label1' - layout: (LayoutFrame 14 0 21 0 90 0 43 0) - translateLabel: true - adjust: right - ) - (InputFieldSpec - name: 'EntryField1' - layout: (LayoutFrame 95 0 21 0 132 0 43 0) - model: gropLeftAmount - type: number - acceptOnPointerLeave: false - ) - (LabelSpec - label: 'Right:' - name: 'Label2' - layout: (LayoutFrame 14 0 51 0 90 0 73 0) - translateLabel: true - adjust: right - ) - (InputFieldSpec - name: 'EntryField2' - layout: (LayoutFrame 95 0 51 0 132 0 73 0) - model: gropRightAmount - type: number - acceptOnPointerLeave: false - ) - (LabelSpec - label: 'Top:' - name: 'Label3' - layout: (LayoutFrame 14 0 81 0 90 0 103 0) - translateLabel: true - adjust: right - ) - (InputFieldSpec - name: 'EntryField3' - layout: (LayoutFrame 95 0 81 0 132 0 103 0) - model: gropTopAmount - type: number - acceptOnPointerLeave: false - ) - (LabelSpec - label: 'Bottom:' - name: 'Label4' - layout: (LayoutFrame 14 0 111 0 90 0 133 0) - translateLabel: true - adjust: right - ) - (InputFieldSpec - name: 'EntryField4' - layout: (LayoutFrame 95 0 111 0 132 0 133 0) - model: gropBottomAmount - type: number - acceptOnPointerLeave: false - ) - (HorizontalPanelViewSpec - name: 'HorizontalPanel1' - layout: (LayoutFrame 0 0.0 -30 1 0 1.0 0 1) - horizontalLayout: fitSpace - verticalLayout: center - horizontalSpace: 3 - verticalSpace: 3 - reverseOrderIfOKAtLeft: true - component: - (SpecCollection - collection: ( - (ActionButtonSpec - label: 'Cancel' - name: 'Button1' - translateLabel: true - model: cancel - extent: (Point 118 22) - ) - (ActionButtonSpec - label: 'OK' - name: 'Button2' - translateLabel: true - model: accept - extent: (Point 118 22) - ) + #(FullSpec + name: uncropSpec + window: + (WindowSpec + label: 'Add Border(s)' + name: 'Add Border(s)' + min: (Point 10 10) + max: (Point 800 478) + bounds: (Rectangle 0 0 261 228) + ) + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Left:' + name: 'Label1' + layout: (LayoutFrame 14 0 21 0 90 0 43 0) + translateLabel: true + adjust: right + ) + (InputFieldSpec + name: 'EntryField1' + layout: (LayoutFrame 95 0 21 0 132 0 43 0) + model: cropLeftAmount + type: number + acceptOnPointerLeave: false + ) + (LabelSpec + label: 'Right:' + name: 'Label2' + layout: (LayoutFrame 14 0 51 0 90 0 73 0) + translateLabel: true + adjust: right + ) + (InputFieldSpec + name: 'EntryField2' + layout: (LayoutFrame 95 0 51 0 132 0 73 0) + model: cropRightAmount + type: number + acceptOnPointerLeave: false + ) + (LabelSpec + label: 'Top:' + name: 'Label3' + layout: (LayoutFrame 14 0 81 0 90 0 103 0) + translateLabel: true + adjust: right + ) + (InputFieldSpec + name: 'EntryField3' + layout: (LayoutFrame 95 0 81 0 132 0 103 0) + model: cropTopAmount + type: number + acceptOnPointerLeave: false + ) + (LabelSpec + label: 'Bottom:' + name: 'Label4' + layout: (LayoutFrame 14 0 111 0 90 0 133 0) + translateLabel: true + adjust: right + ) + (InputFieldSpec + name: 'EntryField4' + layout: (LayoutFrame 95 0 111 0 132 0 133 0) + model: cropBottomAmount + type: number + acceptOnPointerLeave: false + ) + (HorizontalPanelViewSpec + name: 'HorizontalPanel1' + layout: (LayoutFrame 0 0.0 -30 1 0 1.0 0 1) + horizontalLayout: fitSpace + verticalLayout: center + horizontalSpace: 3 + verticalSpace: 3 + reverseOrderIfOKAtLeft: true + component: + (SpecCollection + collection: ( + (ActionButtonSpec + label: 'Cancel' + name: 'Button1' + translateLabel: true + model: cancel + extent: (Point 124 22) ) - - ) - ) + (ActionButtonSpec + label: 'OK' + name: 'Button2' + translateLabel: true + model: accept + extent: (Point 125 22) + ) + ) + + ) ) - - ) - ) - - "Modified: / 13-02-2017 / 14:53:08 / cg" + ) + + ) + ) ! windowSpec @@ -2104,9 +2176,69 @@ component: (SpecCollection collection: ( + (TabViewSpec + name: 'TabHeader1' + layout: (LayoutFrame 0 0 0 0 0 1 36 0) + model: colorCropTabSelectionIndexHolder + menu: colorCropTabLabelList + useIndex: true + translateLabel: true + ) + (ViewSpec + name: 'ColorBox' + layout: (LayoutFrame 0 0 36 0 0 1 0 1) + visibilityChannel: colorBoxVisibleHolder + component: + (SpecCollection + collection: ( + (MenuPanelSpec + name: 'MouseButtonColorToolBar' + layout: (LayoutFrame 0 0.0 0 0 0 1.0 24 0) + level: 0 + menu: menuMouseButtonColors + ) + (DataSetSpec + name: 'colorDataSetView' + layout: (LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0) + activeHelpKey: colorMapTable + style: (FontDescription helvetica medium roman 10) + model: selectedColors + menu: colorMapMenu + hasHorizontalScrollBar: true + hasVerticalScrollBar: true + miniScrollerHorizontal: true + miniScrollerVertical: true + dataList: listOfColors + has3Dseparators: true + doubleClickSelector: doubleClickOnColor: + columnHolder: colorTableColumns + multipleSelectOk: true + verticalSpacing: 1 + columnAdaptor: colorColumnAdaptor + ) + ) + + ) + ) + (ViewSpec + name: 'FloodFillBox' + layout: (LayoutFrame 0 0 36 0 0 1 0 1) + visibilityChannel: floodFillBoxVisibleHolder + component: + (SpecCollection + collection: ( + (UISubSpecification + name: 'SubSpecification2' + layout: (LayoutFrame 0 0 0 0 0 1 0 1) + minorKey: floodFillToleranceSpec + ) + ) + + ) + ) (ViewSpec name: 'CropBox' - layout: (LayoutFrame 0 0 0 0 0 1 0 1) + layout: (LayoutFrame 0 0 36 0 0 1 0 1) visibilityChannel: cropBoxVisibleHolder component: (SpecCollection @@ -2114,39 +2246,12 @@ (UISubSpecification name: 'SubSpecification1' layout: (LayoutFrame 0 0 0 0 0 1 0 1) - minorKey: cropDialogSpec + minorKey: cropSpec ) ) ) ) - (MenuPanelSpec - name: 'MouseButtonColorToolBar' - layout: (LayoutFrame 0 0.0 0 0 0 1.0 24 0) - level: 0 - visibilityChannel: colorBoxVisibleHolder - menu: menuMouseButtonColors - ) - (DataSetSpec - name: 'colorDataSetView' - layout: (LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0) - activeHelpKey: colorMapTable - style: (FontDescription helvetica medium roman 10) - visibilityChannel: colorBoxVisibleHolder - model: selectedColors - menu: colorMapMenu - hasHorizontalScrollBar: true - hasVerticalScrollBar: true - miniScrollerHorizontal: true - miniScrollerVertical: true - dataList: listOfColors - has3Dseparators: true - doubleClickSelector: doubleClickOnColor: - columnHolder: colorTableColumns - multipleSelectOk: true - verticalSpacing: 1 - columnAdaptor: colorColumnAdaptor - ) ) ) @@ -2805,6 +2910,7 @@ "Do not manually edit this!! If it is corrupted, the MenuEditor may not be able to read the specification." + " MenuEditor new openOnClass:ImageEditor andSelector:#menuEdit (Menu new fromLiteralArrayEncoding:(ImageEditor menuEdit)) startUp @@ -2820,7 +2926,6 @@ enabled: canUndoHolder label: 'Undo' itemValue: doUndo - translateLabel: true ) (MenuItem label: '-' @@ -2829,7 +2934,6 @@ enabled: imageIsLoadedHolder label: 'Copy to Clipboard' itemValue: doCopyImageToClipboard - translateLabel: true ) (MenuItem label: '-' @@ -2839,40 +2943,34 @@ enabled: imageIsLoadedAndAllowedToChangeImageDimensionAndDepth label: 'Resize...' itemValue: doResizeImage - translateLabel: true ) (MenuItem activeHelpKey: editMagnifyImage enabled: imageIsLoadedAndAllowedToChangeImageDimensionAndDepth label: 'Magnify...' itemValue: doMagnifyImage - translateLabel: true ) (MenuItem activeHelpKey: editMagnifyImage enabled: imageIsLoadedAndAllowedToChangeImageDimensionAndDepth label: 'Magnify By...' itemValue: doMagnifyImageBy - translateLabel: true ) (MenuItem activeHelpKey: editRotate enabled: imageIsLoadedAndAllowedToChangeImageDimensionAndDepth label: 'Rotate...' itemValue: doRotateImage - translateLabel: true ) (MenuItem activeHelpKey: edit3DProjection enabled: imageIsLoadedAndAllowedToChangeImageDimensionAndDepth label: '3D Projection...' itemValue: do3DProjection - translateLabel: true ) (MenuItem enabled: imageIsLoadedAndAllowedToFlipHolder label: 'Flip' - translateLabel: true submenu: (Menu ( @@ -2881,7 +2979,6 @@ enabled: imageIsLoadedAndNotReadonlyHolder label: 'Flip - Vertical' itemValue: doFlipVertical - translateLabel: true labelImage: (ResourceRetriever ImageEditor flipVerticalIcon 'Flip - Vertical') ) (MenuItem @@ -2889,7 +2986,6 @@ enabled: imageIsLoadedAndNotReadonlyHolder label: 'Flip - Horizontal' itemValue: doFlipHorizontal - translateLabel: true labelImage: (ResourceRetriever ImageEditor flipHorizontalIcon 'Flip - Horizontal') ) ) @@ -2903,7 +2999,6 @@ (MenuItem enabled: imageIsLoadedAndAllowedToChangeImageDimension label: 'Crop' - translateLabel: true submenu: (Menu ( @@ -2911,16 +3006,16 @@ activeHelpKey: cropManual label: 'Manual...' itemValue: doCropManual - translateLabel: true + isVisible: false ) (MenuItem label: '-' + isVisible: false ) (MenuItem activeHelpKey: cropAll label: 'All' itemValue: doCropAll - translateLabel: true ) (MenuItem label: '-' @@ -2929,25 +3024,21 @@ activeHelpKey: cropLeft label: 'Left' itemValue: doCropLeft - translateLabel: true ) (MenuItem activeHelpKey: cropRight label: 'Right' itemValue: doCropRight - translateLabel: true ) (MenuItem activeHelpKey: cropTop label: 'Top' itemValue: doCropTop - translateLabel: true ) (MenuItem activeHelpKey: cropBottom label: 'Bottom' itemValue: doCropBottom - translateLabel: true ) ) nil @@ -2959,14 +3050,12 @@ enabled: imageIsLoadedAndAllowedToChangeImageDimensionAndDepth label: 'Uncrop (Add Border)...' itemValue: doUnCropManual - translateLabel: true ) (MenuItem activeHelpKey: shiftManual enabled: imageIsLoadedAndAllowedToChangeImageDimension label: 'Shift...' itemValue: doShiftManual - translateLabel: true ) (MenuItem label: '-' @@ -2976,13 +3065,11 @@ enabled: hasMaskHolder label: 'Edit Mask' itemValue: doEditMask - translateLabel: true ) (MenuItem enabled: imageIsLoadedAndNotReadonlyHolder label: 'Text...' itemValue: doInsertTextFromUser - translateLabel: true ) (MenuItem label: '-' @@ -2990,7 +3077,6 @@ (MenuItem enabled: imageIsLoadedHolder label: 'Animation Sequence' - translateLabel: true submenu: (Menu ( @@ -2998,13 +3084,11 @@ enabled: imageHasNextImageHolder label: 'Next in Sequence' itemValue: nextImageInSequence - translateLabel: true ) (MenuItem enabled: imageHasPreviousImageHolder label: 'Previous in Sequence' itemValue: previousImageInSequence - translateLabel: true ) (MenuItem label: '-' @@ -3013,7 +3097,6 @@ enabled: imageHasImageSequenceHolder label: 'Edit each from Sequence' itemValue: editEachImageFromSequence - translateLabel: true ) ) nil @@ -3024,8 +3107,6 @@ nil nil ) - - "Modified: / 18-02-2017 / 00:41:45 / cg" ! menuFile @@ -4003,6 +4084,61 @@ ^ imagePreViewSubViews first ! ! +!ImageEditor methodsFor:'actions'! + +applyCropAction + self cropLeft:(self cropLeftAmount value) right:(self cropRightAmount value) + top:(self cropTopAmount value) bottom:(self cropBottomAmount value) + + "Created: / 17-02-2017 / 14:34:35 / cg" + "Modified: / 19-02-2017 / 15:11:41 / cg" +! + +cropBottomNow + self cropLeft:0 right:0 top:0 bottom:(self cropBottomAmount value) + + "Created: / 19-02-2017 / 15:07:36 / cg" +! + +cropLeft:left right:right top:top bottom:bottom + |img| + + img := imageEditView image. + img isNil ifTrue:[^ self]. + + true "firstChange" ifTrue:[ + imageEditView makeUndo. + "/ firstChange := false. + ]. + imageEditView + makeSubImageX:left y:top + width:(img width - left - right) + height:(img height - top - bottom). + + self updateImagePreView. + self updateInfoLabel + + "Created: / 19-02-2017 / 15:07:58 / cg" +! + +cropLeftNow + self cropLeft:(self cropLeftAmount value) right:0 top:0 bottom:0 + + "Created: / 19-02-2017 / 15:08:06 / cg" +! + +cropRightNow + self cropLeft:0 right:(self cropRightAmount value) top:0 bottom:0 + + "Created: / 19-02-2017 / 15:08:12 / cg" +! + +cropTopNow + self cropLeft:0 right:0 top:(self cropTopAmount value) bottom:0 + + "Created: / 19-02-2017 / 15:08:29 / cg" +! ! + !ImageEditor methodsFor:'aspects'! activityInfoHolder @@ -4032,10 +4168,51 @@ "Created: / 26.7.1998 / 12:17:03 / cg" ! +colorCropTabLabelList + ^ resources array:(self colorCropTabSpecList collect:#first) + + "Created: / 19-02-2017 / 14:58:25 / cg" +! + +colorCropTabSelectionIndexHolder + |holder| + + (holder := builder bindingAt:#colorCropTabSelectionIndexHolder) isNil ifTrue:[ + builder aspectAt:#colorCropTabSelectionIndexHolder put:(holder := 1 asValue). + holder onChangeSend:#colorCropTabSelectionIndexChanged to:self. + ]. + ^ holder + + "Created: / 19-02-2017 / 14:59:11 / cg" +! + +colorCropTabSpecList + ^ #( + ('Colors' colors) + ('Crop' crop) + ('Fill' fill) + ) + + "Created: / 19-02-2017 / 15:34:33 / cg" +! + +colorCropTabSymbolList + ^ self colorCropTabSpecList collect:#second + + "Created: / 19-02-2017 / 15:34:54 / cg" +! + +cropBottomAmount + ^ builder valueAspectFor:'cropBottomAmount' initialValue:1 + + "Created: / 19-02-2017 / 15:09:09 / cg" +! + cropBoxIsDialog - ^ true + ^ false "Created: / 03-02-2017 / 11:23:50 / cg" + "Modified: / 19-02-2017 / 15:24:07 / cg" ! cropBoxIsNotDialog @@ -4055,6 +4232,35 @@ "Created: / 03-02-2017 / 11:20:13 / cg" ! +cropLeftAmount + ^ builder valueAspectFor:'cropLeftAmount' initialValue:1 + + "Created: / 19-02-2017 / 15:09:23 / cg" +! + +cropRightAmount + ^ builder valueAspectFor:'cropRightAmount' initialValue:1 + + "Created: / 19-02-2017 / 15:09:29 / cg" +! + +cropTopAmount + ^ builder valueAspectFor:'cropTopAmount' initialValue:1 + + "Created: / 19-02-2017 / 15:09:35 / cg" +! + +floodFillBoxVisibleHolder + |holder| + + (holder := builder bindingAt:#floodFillBoxVisibleHolder) isNil ifTrue:[ + builder aspectAt:#floodFillBoxVisibleHolder put:(holder := false asValue). + ]. + ^ holder + + "Created: / 19-02-2017 / 15:28:40 / cg" +! + floodFillMaxHueError |holder| @@ -4212,61 +4418,6 @@ "Modified: / 04-07-2010 / 10:15:14 / cg" ! -imageIsLoadedAndAllowedToChangeImageDimension - "returns whether an image is loaded as value holder" - - ^ [ - self imageIsLoadedHolder value - and:[ self allowedToChangeImageDimension ] - ] - - "Created: / 16-02-2017 / 01:58:41 / cg" -! - -imageIsLoadedAndAllowedToChangeImageDimensionAndDepth - "returns whether an image is loaded as value holder" - - ^ [ - self imageIsLoadedHolder value - and:[ self allowedToChangeImageDimensionAndDepth ] - ] - - "Modified: / 04-07-2010 / 10:15:43 / cg" -! - -imageIsLoadedAndClassDefined - "returns whether an image is loaded as value holder" - - ^ [self hasClassAndSelectorDefinedHolder value - and:[self imageIsLoadedHolder value]] - - "Created: / 31-07-1998 / 02:04:18 / cg" - "Modified: / 04-07-2010 / 10:15:48 / cg" -! - -imageIsLoadedAndNotReadonlyHolder - "returns whether an image is loaded and editable as value holder" - - ^ BlockValue - with:[:loaded | loaded and:[ self readOnly not ]] - argument:(self imageIsLoadedHolder) - - "Modified: / 16-02-2017 / 12:11:31 / cg" -! - -imageIsLoadedHolder - "returns whether an image is loaded as value holder" - - |holder| - - (holder := builder bindingAt:#imageIsLoaded) isNil ifTrue:[ - builder aspectAt:#imageIsLoaded put:(holder := false asValue). - ]. - ^ holder - - "Created: / 04-07-2010 / 10:15:38 / cg" -! - listOfColors "returns the list of colors" @@ -4377,6 +4528,19 @@ !ImageEditor methodsFor:'change & update'! +colorCropTabSelectionIndexChanged + |selIndex sym| + + selIndex := self colorCropTabSelectionIndexHolder value. + sym := self colorCropTabSymbolList at:selIndex. + + self colorBoxVisibleHolder value:(sym == #colors). + self cropBoxVisibleHolder value:(sym == #crop). + self floodFillBoxVisibleHolder value:(sym == #fill). + + "Created: / 19-02-2017 / 15:01:05 / cg" +! + findColorMapMode "finds the colorMapMode for a new image" @@ -5025,10 +5189,65 @@ "Created: / 16-02-2017 / 01:44:47 / cg" ! +imageIsLoadedAndAllowedToChangeImageDimension + "returns whether an image is loaded as value holder" + + ^ [ + self imageIsLoadedHolder value + and:[ self allowedToChangeImageDimension ] + ] + + "Created: / 16-02-2017 / 01:58:41 / cg" +! + +imageIsLoadedAndAllowedToChangeImageDimensionAndDepth + "returns whether an image is loaded as value holder" + + ^ [ + self imageIsLoadedHolder value + and:[ self allowedToChangeImageDimensionAndDepth ] + ] + + "Modified: / 04-07-2010 / 10:15:43 / cg" +! + imageIsLoadedAndAllowedToFlipHolder ^ self imageIsLoadedAndNotReadonlyHolder "Created: / 16-02-2017 / 01:57:02 / cg" +! + +imageIsLoadedAndClassDefined + "returns whether an image is loaded as value holder" + + ^ [self hasClassAndSelectorDefinedHolder value + and:[self imageIsLoadedHolder value]] + + "Created: / 31-07-1998 / 02:04:18 / cg" + "Modified: / 04-07-2010 / 10:15:48 / cg" +! + +imageIsLoadedAndNotReadonlyHolder + "returns whether an image is loaded and editable as value holder" + + ^ BlockValue + with:[:loaded | loaded and:[ self readOnly not ]] + argument:(self imageIsLoadedHolder) + + "Modified: / 16-02-2017 / 12:11:31 / cg" +! + +imageIsLoadedHolder + "returns whether an image is loaded as value holder" + + |holder| + + (holder := builder bindingAt:#imageIsLoaded) isNil ifTrue:[ + builder aspectAt:#imageIsLoaded put:(holder := false asValue). + ]. + ^ holder + + "Created: / 04-07-2010 / 10:15:38 / cg" ! ! !ImageEditor methodsFor:'menu item visibility'! @@ -6875,13 +7094,13 @@ doCropManual "let user specify borders and cut them off" - |bindings left top right bottom img firstChange gropAction acceptChannel| + |bindings left top right bottom img firstChange cropAction acceptChannel| acceptChannel := TriggerValue new. firstChange := true. - gropAction := + cropAction := [:lV :rV :tV :bV | |l r t b| acceptChannel value:true. @@ -6910,20 +7129,21 @@ ]. bindings := IdentityDictionary new. - bindings at:#gropLeftAmount put:(left := 1 asValue). - bindings at:#gropRightAmount put:(right := 1 asValue). - bindings at:#gropTopAmount put:(top := 1 asValue). - bindings at:#gropBottomAmount put:(bottom := 1 asValue). + bindings at:#cropLeftAmount put:(left := 1 asValue). + bindings at:#cropRightAmount put:(right := 1 asValue). + bindings at:#cropTopAmount put:(top := 1 asValue). + bindings at:#cropBottomAmount put:(bottom := 1 asValue). 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:#applyCropAction put:[ gropAction value:left value:right value:top value:bottom ]. - - (self openDialogInterface:#cropDialogSpec withBindings:bindings) + bindings at:#cropLeftNow put:[ cropAction value:left value:0 value:0 value:0 ]. + bindings at:#cropRightNow put:[ cropAction value:0 value:right value:0 value:0 ]. + bindings at:#cropTopNow put:[ cropAction value:0 value:0 value:top value:0 ]. + bindings at:#cropBottomNow put:[ cropAction value:0 value:0 value:0 value:bottom ]. + + bindings at:#applyCropAction put:[ cropAction value:left value:right value:top value:bottom ]. + bindings at:#cropBoxIsDialog put:true. + + (self openDialogInterface:#cropSpec withBindings:bindings) ifFalse:[ firstChange ~~ true ifTrue:[ imageEditView undo. @@ -6932,7 +7152,7 @@ ]. "Created: / 07-09-1998 / 18:16:07 / cg" - "Modified: / 17-02-2017 / 14:33:19 / cg" + "Modified: / 19-02-2017 / 15:43:50 / cg" ! doCropRight @@ -7243,30 +7463,32 @@ doUnCropManual "let user specify borders and add them" - |bindings left top right bottom img| + |bindings leftAmount topAmount rightAmount bottomAmount img| bindings := IdentityDictionary new. - bindings at:#gropLeftAmount put:(left := 1 asValue). - bindings at:#gropRightAmount put:(right := 1 asValue). - bindings at:#gropTopAmount put:(top := 1 asValue). - bindings at:#gropBottomAmount put:(bottom := 1 asValue). - (self openDialogInterface:#uncropDialogSpec withBindings:bindings) + bindings at:#cropLeftAmount put:(leftAmount := 1 asValue). + bindings at:#cropRightAmount put:(rightAmount := 1 asValue). + bindings at:#cropTopAmount put:(topAmount := 1 asValue). + bindings at:#cropBottomAmount put:(bottomAmount := 1 asValue). + bindings at:#cropBoxIsDialog put:true. + + (self openDialogInterface:#uncropSpec withBindings:bindings) ifTrue:[ - left := left value. - right := right value. - top := top value. - bottom := bottom value. + leftAmount := leftAmount value. + rightAmount := rightAmount value. + topAmount := topAmount value. + bottomAmount := bottomAmount value. img := imageEditView image. imageEditView - makeBorderedImageX:left y:top - width:(img width + left + right) - height:(img height + top + bottom). + makeBorderedImageX:leftAmount y:topAmount + width:(img width + leftAmount + rightAmount) + height:(img height + topAmount + bottomAmount). self updateInfoLabel ]. "Created: / 07-09-1998 / 18:16:07 / cg" - "Modified: / 13-02-2017 / 14:51:35 / cg" + "Modified: / 19-02-2017 / 15:31:00 / cg" ! doUndo