UIPainter.st
changeset 3218 16b714603368
parent 3155 4e93da30717e
child 3222 85db156be933
equal deleted inserted replaced
3217:af9fd0c681e0 3218:16b714603368
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 1995-1998 by eXept Software AG
     4  COPYRIGHT (c) 1995-1998 by eXept Software AG
     3               All Rights Reserved
     5               All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
     9  other person.  No title to or ownership of the software is
    11  other person.  No title to or ownership of the software is
    10  hereby transferred.
    12  hereby transferred.
    11 "
    13 "
    12 "{ Package: 'stx:libtool2' }"
    14 "{ Package: 'stx:libtool2' }"
    13 
    15 
       
    16 "{ NameSpace: Smalltalk }"
       
    17 
    14 ResourceSpecEditor subclass:#UIPainter
    18 ResourceSpecEditor subclass:#UIPainter
    15 	instanceVariableNames:'specSuperclassName treeView selectionPanel specTool layoutTool
    19 	instanceVariableNames:'specSuperclassName treeView selectionPanel specTool layoutTool
    16 		helpTool painterView painter lastPort lastPage'
    20 		helpTool painterView painter lastPort lastPage'
    17 	classVariableNames:'SelectionPanelClass UseViewScroller LastPort LastPage
    21 	classVariableNames:'SelectionPanelClass UseViewScroller LastPort LastPage
    18 		DefaultEditToolBarVisible DefaultToolBarVisible'
    22 		DefaultEditToolBarVisible DefaultToolBarVisible'
   255 
   259 
   256 #centerSelectionVer
   260 #centerSelectionVer
   257 'Centers the selected widgets vertically within their containing widget'
   261 'Centers the selected widgets vertically within their containing widget'
   258 
   262 
   259 #changePositionDown
   263 #changePositionDown
   260 'Moves the selected widget(s) towards the bottom'
   264 'Moves the selected widget(s) towards the bottom (by %1 pixels)'
   261 
   265 
   262 #changePositionLeft
   266 #changePositionLeft
   263 'Moves the selected widget(s) towards the left'
   267 'Moves the selected widget(s) towards the left (by %1 pixels)'
   264 
   268 
   265 #changePositionRight
   269 #changePositionRight
   266 'Moves the selected widget(s) towards the right'
   270 'Moves the selected widget(s) towards the right (by %1 pixels)'
   267 
   271 
   268 #changePositionUp
   272 #changePositionUp
   269 'Moves the selected widget(s) towards the top'
   273 'Moves the selected widget(s) towards the top (by %1 pixels)'
       
   274 
       
   275 #'changeMoveDelta'
       
   276 'Click to change the delta by which the buttons to the left move the selected widget(s)'
   270 
   277 
   271 #drawEdit
   278 #drawEdit
   272 ''
   279 ''
   273 
   280 
   274 #editBrowseViewClass
   281 #editBrowseViewClass
   692 
   699 
   693     ^ ToolbarIconLibrary startUIPainterIcon
   700     ^ ToolbarIconLibrary startUIPainterIcon
   694 
   701 
   695     "Created: / 10-02-2007 / 14:45:56 / cg"
   702     "Created: / 10-02-2007 / 14:45:56 / cg"
   696     "Modified: / 17-09-2007 / 11:36:33 / cg"
   703     "Modified: / 17-09-2007 / 11:36:33 / cg"
       
   704 !
       
   705 
       
   706 delta
       
   707     "This resource specification was automatically generated
       
   708      by the ImageEditor of ST/X."
       
   709 
       
   710     "Do not manually edit this!! If it is corrupted,
       
   711      the ImageEditor may not be able to read the specification."
       
   712 
       
   713     "
       
   714      self delta inspect
       
   715      ImageEditor openOnClass:self andSelector:#delta
       
   716      Icon flushCachedIcons
       
   717     "
       
   718 
       
   719     <resource: #image>
       
   720 
       
   721     ^Icon
       
   722         constantNamed:'UIPainter delta'
       
   723         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:'
       
   724 @@@@@@@@A@@J@AD@HHA@PG?@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
       
   725 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself]
   697 !
   726 !
   698 
   727 
   699 editTableIcon
   728 editTableIcon
   700     <resource: #programImage>
   729     <resource: #programImage>
   701 
   730 
  2996      by the MenuEditor of ST/X."
  3025      by the MenuEditor of ST/X."
  2997 
  3026 
  2998     "Do not manually edit this!! If it is corrupted,
  3027     "Do not manually edit this!! If it is corrupted,
  2999      the MenuEditor may not be able to read the specification."
  3028      the MenuEditor may not be able to read the specification."
  3000 
  3029 
       
  3030 
  3001     "
  3031     "
  3002      MenuEditor new openOnClass:UIPainter andSelector:#menuToolbar2
  3032      MenuEditor new openOnClass:UIPainter andSelector:#menuToolbar2
  3003      (Menu new fromLiteralArrayEncoding:(UIPainter menuToolbar2)) startUp
  3033      (Menu new fromLiteralArrayEncoding:(UIPainter menuToolbar2)) startUp
  3004     "
  3034     "
  3005 
  3035 
  3011          (MenuItem
  3041          (MenuItem
  3012             activeHelpKey: alignSelectionLeft
  3042             activeHelpKey: alignSelectionLeft
  3013             enabled: canMoveOrAlignSelection
  3043             enabled: canMoveOrAlignSelection
  3014             label: 'Align Left'
  3044             label: 'Align Left'
  3015             itemValue: alignSelectionLeft
  3045             itemValue: alignSelectionLeft
  3016             translateLabel: true
       
  3017             isButton: true
  3046             isButton: true
  3018             labelImage: (ResourceRetriever nil iconAlignL)
  3047             labelImage: (ResourceRetriever nil iconAlignL)
  3019           )
  3048           )
  3020          (MenuItem
  3049          (MenuItem
  3021             activeHelpKey: alignSelectionRight
  3050             activeHelpKey: alignSelectionRight
  3022             enabled: canMoveOrAlignSelection
  3051             enabled: canMoveOrAlignSelection
  3023             label: 'Align Right'
  3052             label: 'Align Right'
  3024             itemValue: alignSelectionRight
  3053             itemValue: alignSelectionRight
  3025             translateLabel: true
       
  3026             isButton: true
  3054             isButton: true
  3027             labelImage: (ResourceRetriever nil iconAlignR)
  3055             labelImage: (ResourceRetriever nil iconAlignR)
  3028           )
  3056           )
  3029          (MenuItem
  3057          (MenuItem
  3030             activeHelpKey: alignSelectionTop
  3058             activeHelpKey: alignSelectionTop
  3031             enabled: canMoveOrAlignSelection
  3059             enabled: canMoveOrAlignSelection
  3032             label: 'Align Top'
  3060             label: 'Align Top'
  3033             itemValue: alignSelectionTop
  3061             itemValue: alignSelectionTop
  3034             translateLabel: true
       
  3035             isButton: true
  3062             isButton: true
  3036             labelImage: (ResourceRetriever nil iconAlignT)
  3063             labelImage: (ResourceRetriever nil iconAlignT)
  3037           )
  3064           )
  3038          (MenuItem
  3065          (MenuItem
  3039             activeHelpKey: alignSelectionBottom
  3066             activeHelpKey: alignSelectionBottom
  3040             enabled: canMoveOrAlignSelection
  3067             enabled: canMoveOrAlignSelection
  3041             label: 'Align Bottom'
  3068             label: 'Align Bottom'
  3042             itemValue: alignSelectionBottom
  3069             itemValue: alignSelectionBottom
  3043             translateLabel: true
       
  3044             isButton: true
  3070             isButton: true
  3045             labelImage: (ResourceRetriever nil iconAlignB)
  3071             labelImage: (ResourceRetriever nil iconAlignB)
  3046           )
  3072           )
  3047          (MenuItem
  3073          (MenuItem
  3048             activeHelpKey: alignSelectionLeftAndRight
  3074             activeHelpKey: alignSelectionLeftAndRight
  3049             enabled: canResizeSelection
  3075             enabled: canResizeSelection
  3050             label: 'Align Left & Right'
  3076             label: 'Align Left & Right'
  3051             itemValue: alignSelectionLeftAndRight
  3077             itemValue: alignSelectionLeftAndRight
  3052             translateLabel: true
       
  3053             isButton: true
  3078             isButton: true
  3054             labelImage: (ResourceRetriever nil iconResizeLR)
  3079             labelImage: (ResourceRetriever nil iconResizeLR)
  3055           )
  3080           )
  3056          (MenuItem
  3081          (MenuItem
  3057             activeHelpKey: alignSelectionTopAndBottom
  3082             activeHelpKey: alignSelectionTopAndBottom
  3058             enabled: canResizeSelection
  3083             enabled: canResizeSelection
  3059             label: 'Align Top & Bottom'
  3084             label: 'Align Top & Bottom'
  3060             itemValue: alignSelectionTopAndBottom
  3085             itemValue: alignSelectionTopAndBottom
  3061             translateLabel: true
       
  3062             isButton: true
  3086             isButton: true
  3063             labelImage: (ResourceRetriever nil iconResizeTB)
  3087             labelImage: (ResourceRetriever nil iconResizeTB)
  3064           )
  3088           )
  3065          (MenuItem
  3089          (MenuItem
  3066             label: ''
  3090             label: ''
  3068          (MenuItem
  3092          (MenuItem
  3069             activeHelpKey: changePositionLeft
  3093             activeHelpKey: changePositionLeft
  3070             enabled: canMoveOrAlignSelection
  3094             enabled: canMoveOrAlignSelection
  3071             label: 'Move Left'
  3095             label: 'Move Left'
  3072             itemValue: moveSelectionLeft
  3096             itemValue: moveSelectionLeft
  3073             translateLabel: true
       
  3074             isButton: true
  3097             isButton: true
  3075             hideMenuOnActivated: false
  3098             hideMenuOnActivated: false
  3076             triggerOnDown: true
  3099             triggerOnDown: true
  3077             labelImage: (ResourceRetriever nil arrowLeft)
  3100             labelImage: (ResourceRetriever nil arrowLeft)
  3078           )
  3101           )
  3079          (MenuItem
  3102          (MenuItem
  3080             activeHelpKey: changePositionRight
  3103             activeHelpKey: changePositionRight
  3081             enabled: canMoveOrAlignSelection
  3104             enabled: canMoveOrAlignSelection
  3082             label: 'Move Right'
  3105             label: 'Move Right'
  3083             itemValue: moveSelectionRight
  3106             itemValue: moveSelectionRight
  3084             translateLabel: true
       
  3085             isButton: true
  3107             isButton: true
  3086             hideMenuOnActivated: false
  3108             hideMenuOnActivated: false
  3087             triggerOnDown: true
  3109             triggerOnDown: true
  3088             labelImage: (ResourceRetriever nil arrowRight)
  3110             labelImage: (ResourceRetriever nil arrowRight)
  3089           )
  3111           )
  3090          (MenuItem
  3112          (MenuItem
  3091             activeHelpKey: changePositionUp
  3113             activeHelpKey: changePositionUp
  3092             enabled: canMoveOrAlignSelection
  3114             enabled: canMoveOrAlignSelection
  3093             label: 'Move Up'
  3115             label: 'Move Up'
  3094             itemValue: moveSelectionUp
  3116             itemValue: moveSelectionUp
  3095             translateLabel: true
       
  3096             isButton: true
  3117             isButton: true
  3097             hideMenuOnActivated: false
  3118             hideMenuOnActivated: false
  3098             triggerOnDown: true
  3119             triggerOnDown: true
  3099             labelImage: (ResourceRetriever nil arrowUp)
  3120             labelImage: (ResourceRetriever nil arrowUp)
  3100           )
  3121           )
  3101          (MenuItem
  3122          (MenuItem
  3102             activeHelpKey: changePositionDown
  3123             activeHelpKey: changePositionDown
  3103             enabled: canMoveOrAlignSelection
  3124             enabled: canMoveOrAlignSelection
  3104             label: 'Move Down'
  3125             label: 'Move Down'
  3105             itemValue: moveSelectionDown
  3126             itemValue: moveSelectionDown
  3106             translateLabel: true
       
  3107             isButton: true
  3127             isButton: true
  3108             hideMenuOnActivated: false
  3128             hideMenuOnActivated: false
  3109             triggerOnDown: true
  3129             triggerOnDown: true
  3110             labelImage: (ResourceRetriever nil arrowDown)
  3130             labelImage: (ResourceRetriever nil arrowDown)
  3111           )
  3131           )
  3112          (MenuItem
  3132          (MenuItem
       
  3133             activeHelpKey: changeMoveDelta
       
  3134             label: 'Move by'
       
  3135             nameKey: MoveByMenu
       
  3136             isButton: true
       
  3137             submenu: 
       
  3138            (Menu
       
  3139               (
       
  3140                (MenuItem
       
  3141                   label: '1'
       
  3142                   itemValue: setMoveByStep:
       
  3143                   argument: 1
       
  3144                 )
       
  3145                (MenuItem
       
  3146                   label: '5'
       
  3147                   itemValue: setMoveByStep:
       
  3148                   argument: 5
       
  3149                 )
       
  3150                (MenuItem
       
  3151                   label: '10'
       
  3152                   itemValue: setMoveByStep:
       
  3153                   argument: 10
       
  3154                 )
       
  3155                (MenuItem
       
  3156                   label: '24'
       
  3157                   itemValue: setMoveByStep:
       
  3158                   argument: 24
       
  3159                 )
       
  3160                (MenuItem
       
  3161                   label: '30'
       
  3162                   itemValue: setMoveByStep:
       
  3163                   argument: 30
       
  3164                 )
       
  3165                (MenuItem
       
  3166                   label: '100'
       
  3167                   itemValue: setMoveByStep:
       
  3168                   argument: 100
       
  3169                 )
       
  3170                (MenuItem
       
  3171                   label: '-'
       
  3172                 )
       
  3173                (MenuItem
       
  3174                   label: 'Enter Value...'
       
  3175                   itemValue: askForMoveByStep
       
  3176                 )
       
  3177                )
       
  3178               nil
       
  3179               nil
       
  3180             )
       
  3181             labelImage: (ResourceRetriever UIPainter delta)
       
  3182           )
       
  3183          (MenuItem
  3113             activeHelpKey: editOpenSpecDocumentation
  3184             activeHelpKey: editOpenSpecDocumentation
  3114             label: 'Widget Documentation'
  3185             label: 'Widget Documentation'
  3115             itemValue: doOpenWidgetDocumentation
  3186             itemValue: doOpenWidgetDocumentation
  3116             translateLabel: true
       
  3117             isButton: true
  3187             isButton: true
  3118             startGroup: right
  3188             startGroup: right
  3119             labelImage: (ResourceRetriever Icon helpIcon)
  3189             labelImage: (ResourceRetriever Icon helpIcon)
  3120           )
  3190           )
  3121          )
  3191          )
  3122         nil
  3192         nil
  3123         nil
  3193         nil
  3124       )
  3194       )
  3125 
       
  3126     "Modified: / 18-07-2011 / 17:25:31 / cg"
       
  3127 !
  3195 !
  3128 
  3196 
  3129 moveInListMenuSlice
  3197 moveInListMenuSlice
  3130     "This resource specification was automatically generated
  3198     "This resource specification was automatically generated
  3131      by the MenuEditor of ST/X."
  3199      by the MenuEditor of ST/X."
  4004 
  4072 
  4005     ^ specification helpSpec at:aKey ifAbsent:nil
  4073     ^ specification helpSpec at:aKey ifAbsent:nil
  4006 !
  4074 !
  4007 
  4075 
  4008 flyByHelpSpec
  4076 flyByHelpSpec
  4009     |spec|
  4077     |spec painter|
       
  4078 
       
  4079     painter := self painter.
  4010 
  4080 
  4011     spec := self class flyByHelpSpec.
  4081     spec := self class flyByHelpSpec.
  4012     spec at:#editUndo put:(resources string:'Undo (%1)' 
  4082     spec at:#editUndo put:(resources string:'Undo (%1)' 
  4013                         with:(resources string:self painter undoHistory labelOfLastUndo)).
  4083                         with:(resources string:painter undoHistory labelOfLastUndo)).
       
  4084 
       
  4085     spec at:#changePositionDown put:(resources string:
       
  4086                 (spec at:#changePositionDown) with:painter nPixelsForMoveSelection).
       
  4087 
       
  4088     spec at:#changePositionLeft put:(resources string:
       
  4089                 (spec at:#changePositionLeft) with:painter nPixelsForMoveSelection). 
       
  4090 
       
  4091     spec at:#changePositionRight put:(resources string:
       
  4092                 (spec at:#changePositionRight) with:painter nPixelsForMoveSelection). 
       
  4093 
       
  4094     spec at:#changePositionUp put:(resources string:
       
  4095                 (spec at:#changePositionUp) with:painter nPixelsForMoveSelection). 
       
  4096 
  4014     ^ spec
  4097     ^ spec
  4015 !
  4098 !
  4016 
  4099 
  4017 helpSpec
  4100 helpSpec
  4018     |spec|
  4101     |spec|
  5197     ]
  5280     ]
  5198 
  5281 
  5199     "Modified: / 05-09-2006 / 18:37:12 / cg"
  5282     "Modified: / 05-09-2006 / 18:37:12 / cg"
  5200 !
  5283 !
  5201 
  5284 
       
  5285 askForMoveByStep
       
  5286     "open a dialog to ask for a number"
       
  5287 
       
  5288     |s nPixels|
       
  5289 
       
  5290     s := Dialog request:'Number of Pixels to Move: '
       
  5291                 initialAnswer:painter nPixelsForMoveSelection asString.
       
  5292     s isEmptyOrNil ifTrue:[^ self].
       
  5293     nPixels := Integer readFrom:s onError:nil.
       
  5294     nPixels isNil ifTrue:[^ self].
       
  5295 
       
  5296     self painter nPixelsForMoveSelection:nPixels
       
  5297 !
       
  5298 
  5202 cancel
  5299 cancel
  5203     "cancels all modifications done to the attributes of the current section; 
  5300     "cancels all modifications done to the attributes of the current section; 
  5204      reread the old attributes"
  5301      reread the old attributes"
  5205 
  5302 
  5206     |spec key view|
  5303     |spec key view|
  6274     self painter replaceSelectionBy:newSpec.
  6371     self painter replaceSelectionBy:newSpec.
  6275 
  6372 
  6276     "Modified: / 05-09-2012 / 19:24:40 / cg"
  6373     "Modified: / 05-09-2012 / 19:24:40 / cg"
  6277 !
  6374 !
  6278 
  6375 
       
  6376 setMoveByStep:nPixels
       
  6377     "change the number of pixels by which the step-buttons move the selected widget(s)"
       
  6378 
       
  6379     self painter nPixelsForMoveSelection:nPixels
       
  6380 !
       
  6381 
  6279 specClassFromUsersSpecOrWidgetClass:aSpecOrWidgetClass
  6382 specClassFromUsersSpecOrWidgetClass:aSpecOrWidgetClass
  6280     |newSpecClass|
  6383     |newSpecClass|
  6281 
  6384 
  6282     (aSpecOrWidgetClass isSubclassOf:UISpecification) ifTrue:[
  6385     (aSpecOrWidgetClass isSubclassOf:UISpecification) ifTrue:[
  6283         newSpecClass := aSpecOrWidgetClass.
  6386         newSpecClass := aSpecOrWidgetClass.