class: UIPainter
authorClaus Gittinger <cg@exept.de>
Wed, 24 Jun 2015 10:31:49 +0200
changeset 3218 16b714603368
parent 3217 af9fd0c681e0
child 3219 2395b33f653e
class: UIPainter added: #askForMoveByStep #delta #setMoveByStep: changed: #flyByHelpSpec #helpSpec #menuToolbar2
UIPainter.st
--- a/UIPainter.st	Tue Jun 23 15:41:27 2015 +0200
+++ b/UIPainter.st	Wed Jun 24 10:31:49 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1995-1998 by eXept Software AG
               All Rights Reserved
@@ -11,6 +13,8 @@
 "
 "{ Package: 'stx:libtool2' }"
 
+"{ NameSpace: Smalltalk }"
+
 ResourceSpecEditor subclass:#UIPainter
 	instanceVariableNames:'specSuperclassName treeView selectionPanel specTool layoutTool
 		helpTool painterView painter lastPort lastPage'
@@ -257,16 +261,19 @@
 'Centers the selected widgets vertically within their containing widget'
 
 #changePositionDown
-'Moves the selected widget(s) towards the bottom'
+'Moves the selected widget(s) towards the bottom (by %1 pixels)'
 
 #changePositionLeft
-'Moves the selected widget(s) towards the left'
+'Moves the selected widget(s) towards the left (by %1 pixels)'
 
 #changePositionRight
-'Moves the selected widget(s) towards the right'
+'Moves the selected widget(s) towards the right (by %1 pixels)'
 
 #changePositionUp
-'Moves the selected widget(s) towards the top'
+'Moves the selected widget(s) towards the top (by %1 pixels)'
+
+#'changeMoveDelta'
+'Click to change the delta by which the buttons to the left move the selected widget(s)'
 
 #drawEdit
 ''
@@ -696,6 +703,28 @@
     "Modified: / 17-09-2007 / 11:36:33 / cg"
 !
 
+delta
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self delta inspect
+     ImageEditor openOnClass:self andSelector:#delta
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'UIPainter delta'
+        ifAbsentPut:[(Depth1Image new) width:11; height:11; bits:(ByteArray fromPackedString:'?>C?8O? >>C@XLA 0VB;(H@ ?"C?8@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width:11; height:11; bits:(ByteArray fromPackedString:'
+@@@@@@@@A@@J@AD@HHA@PG?@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself]
+!
+
 editTableIcon
     <resource: #programImage>
 
@@ -2998,6 +3027,7 @@
     "Do not manually edit this!! If it is corrupted,
      the MenuEditor may not be able to read the specification."
 
+
     "
      MenuEditor new openOnClass:UIPainter andSelector:#menuToolbar2
      (Menu new fromLiteralArrayEncoding:(UIPainter menuToolbar2)) startUp
@@ -3013,7 +3043,6 @@
             enabled: canMoveOrAlignSelection
             label: 'Align Left'
             itemValue: alignSelectionLeft
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever nil iconAlignL)
           )
@@ -3022,7 +3051,6 @@
             enabled: canMoveOrAlignSelection
             label: 'Align Right'
             itemValue: alignSelectionRight
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever nil iconAlignR)
           )
@@ -3031,7 +3059,6 @@
             enabled: canMoveOrAlignSelection
             label: 'Align Top'
             itemValue: alignSelectionTop
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever nil iconAlignT)
           )
@@ -3040,7 +3067,6 @@
             enabled: canMoveOrAlignSelection
             label: 'Align Bottom'
             itemValue: alignSelectionBottom
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever nil iconAlignB)
           )
@@ -3049,7 +3075,6 @@
             enabled: canResizeSelection
             label: 'Align Left & Right'
             itemValue: alignSelectionLeftAndRight
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever nil iconResizeLR)
           )
@@ -3058,7 +3083,6 @@
             enabled: canResizeSelection
             label: 'Align Top & Bottom'
             itemValue: alignSelectionTopAndBottom
-            translateLabel: true
             isButton: true
             labelImage: (ResourceRetriever nil iconResizeTB)
           )
@@ -3070,7 +3094,6 @@
             enabled: canMoveOrAlignSelection
             label: 'Move Left'
             itemValue: moveSelectionLeft
-            translateLabel: true
             isButton: true
             hideMenuOnActivated: false
             triggerOnDown: true
@@ -3081,7 +3104,6 @@
             enabled: canMoveOrAlignSelection
             label: 'Move Right'
             itemValue: moveSelectionRight
-            translateLabel: true
             isButton: true
             hideMenuOnActivated: false
             triggerOnDown: true
@@ -3092,7 +3114,6 @@
             enabled: canMoveOrAlignSelection
             label: 'Move Up'
             itemValue: moveSelectionUp
-            translateLabel: true
             isButton: true
             hideMenuOnActivated: false
             triggerOnDown: true
@@ -3103,17 +3124,66 @@
             enabled: canMoveOrAlignSelection
             label: 'Move Down'
             itemValue: moveSelectionDown
-            translateLabel: true
             isButton: true
             hideMenuOnActivated: false
             triggerOnDown: true
             labelImage: (ResourceRetriever nil arrowDown)
           )
          (MenuItem
+            activeHelpKey: changeMoveDelta
+            label: 'Move by'
+            nameKey: MoveByMenu
+            isButton: true
+            submenu: 
+           (Menu
+              (
+               (MenuItem
+                  label: '1'
+                  itemValue: setMoveByStep:
+                  argument: 1
+                )
+               (MenuItem
+                  label: '5'
+                  itemValue: setMoveByStep:
+                  argument: 5
+                )
+               (MenuItem
+                  label: '10'
+                  itemValue: setMoveByStep:
+                  argument: 10
+                )
+               (MenuItem
+                  label: '24'
+                  itemValue: setMoveByStep:
+                  argument: 24
+                )
+               (MenuItem
+                  label: '30'
+                  itemValue: setMoveByStep:
+                  argument: 30
+                )
+               (MenuItem
+                  label: '100'
+                  itemValue: setMoveByStep:
+                  argument: 100
+                )
+               (MenuItem
+                  label: '-'
+                )
+               (MenuItem
+                  label: 'Enter Value...'
+                  itemValue: askForMoveByStep
+                )
+               )
+              nil
+              nil
+            )
+            labelImage: (ResourceRetriever UIPainter delta)
+          )
+         (MenuItem
             activeHelpKey: editOpenSpecDocumentation
             label: 'Widget Documentation'
             itemValue: doOpenWidgetDocumentation
-            translateLabel: true
             isButton: true
             startGroup: right
             labelImage: (ResourceRetriever Icon helpIcon)
@@ -3122,8 +3192,6 @@
         nil
         nil
       )
-
-    "Modified: / 18-07-2011 / 17:25:31 / cg"
 !
 
 moveInListMenuSlice
@@ -4006,11 +4074,26 @@
 !
 
 flyByHelpSpec
-    |spec|
+    |spec painter|
+
+    painter := self painter.
 
     spec := self class flyByHelpSpec.
     spec at:#editUndo put:(resources string:'Undo (%1)' 
-                        with:(resources string:self painter undoHistory labelOfLastUndo)).
+                        with:(resources string:painter undoHistory labelOfLastUndo)).
+
+    spec at:#changePositionDown put:(resources string:
+                (spec at:#changePositionDown) with:painter nPixelsForMoveSelection).
+
+    spec at:#changePositionLeft put:(resources string:
+                (spec at:#changePositionLeft) with:painter nPixelsForMoveSelection). 
+
+    spec at:#changePositionRight put:(resources string:
+                (spec at:#changePositionRight) with:painter nPixelsForMoveSelection). 
+
+    spec at:#changePositionUp put:(resources string:
+                (spec at:#changePositionUp) with:painter nPixelsForMoveSelection). 
+
     ^ spec
 !
 
@@ -5199,6 +5282,20 @@
     "Modified: / 05-09-2006 / 18:37:12 / cg"
 !
 
+askForMoveByStep
+    "open a dialog to ask for a number"
+
+    |s nPixels|
+
+    s := Dialog request:'Number of Pixels to Move: '
+                initialAnswer:painter nPixelsForMoveSelection asString.
+    s isEmptyOrNil ifTrue:[^ self].
+    nPixels := Integer readFrom:s onError:nil.
+    nPixels isNil ifTrue:[^ self].
+
+    self painter nPixelsForMoveSelection:nPixels
+!
+
 cancel
     "cancels all modifications done to the attributes of the current section; 
      reread the old attributes"
@@ -6276,6 +6373,12 @@
     "Modified: / 05-09-2012 / 19:24:40 / cg"
 !
 
+setMoveByStep:nPixels
+    "change the number of pixels by which the step-buttons move the selected widget(s)"
+
+    self painter nPixelsForMoveSelection:nPixels
+!
+
 specClassFromUsersSpecOrWidgetClass:aSpecOrWidgetClass
     |newSpecClass|