UIPainter.st
changeset 466 daba7254ed49
parent 453 6fe8c481bab0
child 482 00acfc336304
equal deleted inserted replaced
465:1b55cc13793b 466:daba7254ed49
   114 
   114 
   115     "
   115     "
   116     UIHelpTool openOnClass:UIPainter    
   116     UIHelpTool openOnClass:UIPainter    
   117     "
   117     "
   118 
   118 
   119     <resource: #help>
       
   120 
       
   121   ^ super helpSpec addPairsFrom:#(
   119   ^ super helpSpec addPairsFrom:#(
       
   120 
       
   121 #accept
       
   122 'write back changes'
       
   123 
       
   124 #alignSelectionBottom
       
   125 'align selected widgets to the bottom edge of the dominant widget'
       
   126 
       
   127 #alignSelectionCenterHor
       
   128 'align selected widgets vertical to the center of the dominant widget'
       
   129 
       
   130 #alignSelectionCenterVer
       
   131 'align selected widgets horizontal to the center of the dominant widget'
       
   132 
       
   133 #alignSelectionLeft
       
   134 'align selected widgets to the left edge of the dominant widget'
       
   135 
       
   136 #alignSelectionLeftAndRight
       
   137 'align selected widgets to the right and left edge of the dominant widget'
       
   138 
       
   139 #alignSelectionRight
       
   140 'align selected widgets to the right edge of the dominant widget'
       
   141 
       
   142 #alignSelectionTop
       
   143 'align selected widgets to the top edge of the dominant widget'
       
   144 
       
   145 #alignSelectionTopAndBottom
       
   146 'align selected widgets to the top and bottom edge of the dominant widget'
       
   147 
       
   148 #cancel
       
   149 'reread specification and layout'
       
   150 
       
   151 #centerSelectionHor
       
   152 'center widgets horizontal to their top widget'
       
   153 
       
   154 #centerSelectionVer
       
   155 'center vertical horizontal in contained view'
       
   156 
       
   157 #copyExtent
       
   158 'copy extent of the selected widget'
       
   159 
       
   160 #copyLayout
       
   161 'copy layout of the selected widget'
       
   162 
       
   163 #galleryShown
       
   164 'show or hide gallery view'
       
   165 
       
   166 #menuAlignment
       
   167 'provides a set of alignment operation on the current selected widgets'
       
   168 
       
   169 #menuChangeHierarchy
       
   170 'change hierarchy of the selected widget'
       
   171 
       
   172 #moveSelectionDown
       
   173 'move selected widgets down while pressing the button'
   122 
   174 
   123 #moveSelectionLeft
   175 #moveSelectionLeft
   124 'move selected widgets left while pressing the button'
   176 'move selected widgets left while pressing the button'
   125 
   177 
       
   178 #moveSelectionRight
       
   179 'move selected widgets right while pressing the button'
       
   180 
       
   181 #moveSelectionUp
       
   182 'move selected widgets up while pressing the button'
       
   183 
       
   184 #painterShown
       
   185 'show or hide painter view'
       
   186 
       
   187 #pasteBuffer
       
   188 'paste widgets at current mouse position'
       
   189 
       
   190 #pasteExtent
       
   191 'change extent of all selected widgets to the last copied extent'
       
   192 
       
   193 #pasteHeight
       
   194 'change height of all selected widgets to the last copied extent height'
       
   195 
       
   196 #pasteLayout
       
   197 'change layout of all selected widgets to the last copied layout'
       
   198 
       
   199 #pasteWidth
       
   200 'change width of all selected widgets to the last copied extent width'
       
   201 
       
   202 #pasteWithLayout
       
   203 'paste widgets without changing their layouts'
       
   204 
       
   205 #setToDefaultExtent
       
   206 'set selected widgets to their default extent'
       
   207 
       
   208 #setToDefaultHeight
       
   209 'set selected widgets to their default height'
       
   210 
   126 #setToDefaultWidth
   211 #setToDefaultWidth
   127 'set selected widgets to their default width'
   212 'set selected widgets to their default width'
   128 
   213 
   129 #pasteBuffer
   214 #spreadSelectionHor
   130 'paste widgets at current mouse position'
   215 'horizontal spacing between selected widgets is made the same'
   131 
       
   132 #moveSelectionUp
       
   133 'move selected widgets up while pressing the button'
       
   134 
       
   135 #galleryShown
       
   136 'show or hide gallery view'
       
   137 
       
   138 #moveSelectionDown
       
   139 'move selected widgets down while pressing the button'
       
   140 
   216 
   141 #spreadSelectionVer
   217 #spreadSelectionVer
   142 'vertical spacing between selected widgets is made the same'
   218 'vertical spacing between selected widgets is made the same'
   143 
   219 
   144 #menuChangeHierarchy
       
   145 'change hierarchy of the selected widget'
       
   146 
       
   147 #copyExtent
       
   148 'copy extent of the selected widget'
       
   149 
       
   150 #moveSelectionRight
       
   151 'move selected widgets right while pressing the button'
       
   152 
       
   153 #cancel
       
   154 'reread specification and layout'
       
   155 
       
   156 #pasteWithLayout
       
   157 'paste widgets without changing their layouts'
       
   158 
       
   159 #alignSelectionRight
       
   160 'align selected widgets to the right edge of the dominant widget'
       
   161 
       
   162 #alignSelectionLeftAndRight
       
   163 'align selected widgets to the right and left edge of the dominant widget'
       
   164 
       
   165 #pasteWidth
       
   166 'change width of all selected widgets to the last copied extent width'
       
   167 
       
   168 #alignSelectionTopAndBottom
       
   169 'align selected widgets to the top and bottom edge of the dominant widget'
       
   170 
       
   171 #copyLayout
       
   172 'copy layout of the selected widget'
       
   173 
       
   174 #painterShown
       
   175 'show or hide painter view'
       
   176 
       
   177 #pasteExtent
       
   178 'change extent of all selected widgets to the last copied extent'
       
   179 
       
   180 #pasteHeight
       
   181 'change height of all selected widgets to the last copied extent height'
       
   182 
       
   183 #accept
       
   184 'write back changes'
       
   185 
       
   186 #centerSelectionVer
       
   187 'center vertical horizontal in contained view'
       
   188 
       
   189 #centerSelectionHor
       
   190 'center widgets horizontal to their top widget'
       
   191 
       
   192 #menuAlignment
       
   193 'provides a set of alignment operation on the current selected widgets'
       
   194 
       
   195 #alignSelectionCenterVer
       
   196 'align selected widgets horizontal to the center of the dominant widget'
       
   197 
       
   198 #pasteLayout
       
   199 'change layout of all selected widgets to the last copied layout'
       
   200 
       
   201 #alignSelectionLeft
       
   202 'align selected widgets to the left edge of the dominant widget'
       
   203 
       
   204 #spreadSelectionHor
       
   205 'horizontal spacing between selected widgets is made the same'
       
   206 
       
   207 #alignSelectionBottom
       
   208 'align selected widgets to the bottom edge of the dominant widget'
       
   209 
       
   210 #setToDefaultExtent
       
   211 'set selected widgets to their default extent'
       
   212 
       
   213 #alignSelectionCenterHor
       
   214 'align selected widgets vertical to the center of the dominant widget'
       
   215 
       
   216 #alignSelectionTop
       
   217 'align selected widgets to the top edge of the dominant widget'
       
   218 
       
   219 #setToDefaultHeight
       
   220 'set selected widgets to their default height'
       
   221 
       
   222 )
   220 )
   223 
       
   224     "Modified: / 29.10.1997 / 03:19:58 / cg"
       
   225 ! !
   221 ! !
   226 
   222 
   227 !UIPainter class methodsFor:'helpers'!
   223 !UIPainter class methodsFor:'helpers'!
   228 
   224 
   229 convertString:aString maxLineSize:maxCharactersPerLine skipLineFeed:skipLineFeed
   225 convertString:aString maxLineSize:maxCharactersPerLine skipLineFeed:skipLineFeed
   704                       )
   700                       )
   705                        #(#MenuItem
   701                        #(#MenuItem
   706                           #'label:' '-'
   702                           #'label:' '-'
   707                       )
   703                       )
   708                        #(#MenuItem
   704                        #(#MenuItem
       
   705                           #'label:' 'Save'
       
   706                           #'value:' #doInstallSpec
       
   707                       )
       
   708                        #(#MenuItem
       
   709                           #'label:' '-'
       
   710                       )
       
   711                        #(#MenuItem
   709                           #'label:' 'Define Class And Selector...'
   712                           #'label:' 'Define Class And Selector...'
   710                           #'value:' #defineClassAndSelector
   713                           #'value:' #defineClassAndSelector
   711                       )
       
   712                        #(#MenuItem
       
   713                           #'label:' '-'
       
   714                       )
       
   715                        #(#MenuItem
       
   716                           #'label:' 'Save Window Spec'
       
   717                           #'value:' #doInstallSpec
       
   718                       )
       
   719                        #(#MenuItem
       
   720                           #'label:' 'Save Help Spec'
       
   721                           #'value:' #doInstallHelp
       
   722                           #'enabled:' #hasSpecClass
       
   723                       )
   714                       )
   724                        #(#MenuItem
   715                        #(#MenuItem
   725                           #'label:' '-'
   716                           #'label:' '-'
   726                       )
   717                       )
   727                        #(#MenuItem
   718                        #(#MenuItem
   779                 #'label:' 'Test'
   770                 #'label:' 'Test'
   780                 #'submenu:' 
   771                 #'submenu:' 
   781                  #(#Menu
   772                  #(#Menu
   782                     
   773                     
   783                      #(
   774                      #(
       
   775                        #(#MenuItem
       
   776                           #'label:' 'Start Application'
       
   777                           #'value:' #doStartApplication
       
   778                       )
       
   779                        #(#MenuItem
       
   780                           #'label:' '-'
       
   781                       )
   784                        #(#MenuItem
   782                        #(#MenuItem
   785                           #'label:' 'Geometry Test Mode'
   783                           #'label:' 'Geometry Test Mode'
   786                           #'indication:' #'testMode:'
   784                           #'indication:' #'testMode:'
   787                       )
   785                       )
   788                     ) nil
   786                     ) nil
  1232 
  1230 
  1233 iconAlignCenterH
  1231 iconAlignCenterH
  1234     "ImageEditor openOnClass:self andSelector:#iconAlignCenterH"
  1232     "ImageEditor openOnClass:self andSelector:#iconAlignCenterH"
  1235 
  1233 
  1236     <resource: #image>
  1234     <resource: #image>
  1237     ^(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[85 85 85 85 85 80 85 85 85 85 85 80 85 85 85 85 85 80 84 0 0 0 5 80 84 170 170 170 165 80 85 85 89 85 85 80 85 85 42 21 85 90 85 84 170 133 85 88 85 82 170 161 85 80 85 74 170 168 85 80 85 69 85 85 85 80 85 85 85 85 85 88 84 0 0 0 5 80 84 170 170 170 165 80 85 85 89 85 85 88 85 85 42 21 85 80 85 84 170 133 85 80 85 82 170 161 85 80 85 74 170 168 85 80 85 85 85 85 85 80 85 85 85 85 85 80 85 85 85 85 85 88]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:49.9977 blue:49.9977); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 0 0 31 255 192 31 255 224 15 255 224 0 248 0 1 252 0 3 254 0 7 255 0 7 255 0 0 0 0 31 255 192 31 255 224 15 255 224 0 248 0 1 252 0 3 254 0 7 255 0 3 255 0 0 0 0 0 0 0]) ; yourself); yourself!
  1235     ^(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[85 85 85 85 85 80 85 85 85 85 85 80 85 85 85 85 85 80 90 170 170 170 170 80 90 170 170 170 170 80 85 85 77 85 85 80 85 85 63 85 85 80 85 84 255 213 85 92 85 83 255 245 85 87 85 79 255 253 85 80 85 69 85 85 85 80 85 85 85 85 85 80 90 170 170 170 170 80 90 170 170 170 170 80 85 85 77 85 85 80 85 85 63 85 85 80 85 84 255 213 85 80 85 83 255 245 85 80 85 79 255 253 85 87 85 69 85 85 85 80 85 85 85 85 85 80 85 85 85 85 85 80]) ; colorMap:(((Array new:4) at:1 put:((Color white)); at:2 put:((Color black)); at:3 put:((Color red:0.0 green:0.0 blue:49.9977)); at:4 put:((Color grey:49.9977)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 0 2 63 255 240 63 255 240 0 112 0 0 248 0 1 252 0 3 254 0 7 255 0 7 255 0 0 0 0 63 255 240 63 255 243 0 112 0 0 248 0 1 252 0 3 254 0 7 255 0 7 255 0 0 0 0 0 0 0]) ; yourself); yourself!
  1238 
  1236 
  1239 iconAlignCenterV
  1237 iconAlignCenterV
  1240     "ImageEditor openOnClass:self andSelector:#iconAlignCenterV"
  1238     "ImageEditor openOnClass:self andSelector:#iconAlignCenterV"
  1241 
  1239 
  1242     <resource: #image>
  1240     <resource: #image>
  1243     ^(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[85 85 85 85 85 80 85 85 85 85 85 80 85 85 85 85 85 80 85 84 21 85 5 80 85 84 149 85 37 80 80 84 148 21 37 80 82 20 148 133 37 80 82 132 148 161 37 80 82 160 148 168 37 82 82 168 148 170 37 80 82 170 148 170 165 80 82 169 148 170 101 80 82 164 148 169 37 80 82 148 148 165 37 80 82 84 148 149 37 80 85 84 149 85 37 88 85 84 149 85 37 80 85 84 149 85 37 80 85 85 85 85 85 80 85 85 85 85 85 88 85 85 85 85 85 80 85 85 85 85 85 80]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:49.9992 blue:49.9992); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 0 1 1 128 192 1 192 224 49 216 224 57 220 224 61 222 224 63 223 224 63 223 224 63 223 224 63 223 224 63 223 224 61 222 224 57 220 224 17 200 227 1 192 224 1 192 224 0 192 96 0 0 0 0 0 3 0 0 0]) ; yourself); yourself!
  1241     ^(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[85 85 85 85 85 80 85 85 85 85 85 80 85 85 165 85 105 80 85 85 165 85 105 80 85 85 165 85 105 80 80 85 164 21 105 80 83 213 164 245 105 80 83 245 164 253 105 80 83 253 164 255 105 87 83 255 164 255 233 80 83 255 164 255 233 95 83 253 164 255 105 80 83 245 164 253 105 80 83 213 164 245 105 80 83 85 164 213 105 87 85 85 165 85 105 80 85 85 165 85 105 80 85 85 165 85 105 95 85 85 165 85 105 87 85 85 165 85 105 80 85 85 85 85 85 80 85 85 85 85 85 81]) ; colorMap:(((Array new:4) at:1 put:((Color white)); at:2 put:((Color black)); at:3 put:((Color red:0.0 green:0.0 blue:49.9977)); at:4 put:((Color grey:49.9977)); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 192 97 0 192 96 0 192 96 48 216 96 56 220 96 60 222 96 62 223 96 63 223 224 63 223 224 63 223 224 62 223 96 60 222 96 56 220 96 16 200 99 0 192 96 0 192 96 0 192 96 0 192 96 0 0 3 0 0 0]) ; yourself); yourself!
  1244 
  1242 
  1245 iconAlignL
  1243 iconAlignL
  1246     "ImageEditor openOnClass:self andSelector:#iconAlignL"
  1244     "ImageEditor openOnClass:self andSelector:#iconAlignL"
  1247 
  1245 
  1248     <resource: #image>
  1246     <resource: #image>
  2238     code := self painter generateAspectMethods.
  2236     code := self painter generateAspectMethods.
  2239     (ReadStream on:code) fileIn.
  2237     (ReadStream on:code) fileIn.
  2240 
  2238 
  2241 !
  2239 !
  2242 
  2240 
  2243 doInstallHelp
       
  2244     "install help text
       
  2245     "
       
  2246     self helpTool installHelpSpecInto:specClass
       
  2247 !
       
  2248 
       
  2249 doInstallHooks
  2241 doInstallHooks
  2250     "install application hooks
  2242     "install application hooks
  2251     "
  2243     "
  2252     |code|
  2244     |code|
  2253 
  2245 
  2300 
  2292 
  2301     code := painter generateWindowSpecMethodSource withCRs.
  2293     code := painter generateWindowSpecMethodSource withCRs.
  2302     painter resetModification.
  2294     painter resetModification.
  2303     (ReadStream on:code) fileIn.
  2295     (ReadStream on:code) fileIn.
  2304 
  2296 
  2305     "Modified: / 26.10.1997 / 15:47:48 / cg"
  2297     self helpTool installHelpSpecInto:specClass
  2306 !
  2298 !
  2307 
  2299 
  2308 doNew
  2300 doNew
  2309     "remove all components and associated resources
  2301     "remove all components and associated resources
  2310     "
  2302     "
  2372             ^ self
  2364             ^ self
  2373         ]
  2365         ]
  2374     ].
  2366     ].
  2375 
  2367 
  2376     (specClass isNil or:[specSelector size < 2]) ifTrue:[
  2368     (specClass isNil or:[specSelector size < 2]) ifTrue:[
  2377         infoMessage := 'No class or selector defined!!'.
  2369         infoMessage := 'No class and selector defined!!'.
  2378     ] ifFalse:[
  2370     ] ifFalse:[
  2379         cls := self resolveName:specClass.
  2371         cls := self resolveName:specClass.
  2380 
  2372 
  2381         cls isNil ifTrue:[
  2373         cls isNil ifTrue:[
  2382             infoMessage := 'Class not existant!!'.
  2374             infoMessage := 'Class does not exist!!'.
  2383         ] ifFalse:[
  2375         ] ifFalse:[
  2384             (cls respondsTo:specSelector) ifFalse:[
  2376             (cls respondsTo:specSelector) ifFalse:[
  2385                 infoMessage := ('No method for: #' 
  2377                 infoMessage := ('No method for: #' 
  2386                                 , specSelector , ' in ' , cls name
  2378                                 , specSelector , ' in ' , cls name
  2387                                 , '\\(did you install the interface?)') withCRs.
  2379                                 , '\\(did you install the interface?)') withCRs.