--- a/UIPainter.st Mon Jul 15 14:46:15 2013 +0200
+++ b/UIPainter.st Mon Jul 15 14:46:39 2013 +0200
@@ -204,12 +204,21 @@
#align
'Widget alignment functions'
+#alignResizeSelectionBottom
+'Resize the selected widgets'' bottom edges to align them with the bottom of the dominant widget'
+
+#alignResizeSelectionLeft
+'Resize the selected widgets'' left edges to align them with the left edge of the dominant widget'
+
+#alignResizeSelectionRight
+'Resize the selected widgets'' right edges to align them with the right edge of the dominant widget'
+
+#alignResizeSelectionTop
+'Resize the selected widgets'' top edges to align them with the top edge of the dominant widget'
+
#alignSelectionBottom
'Aligns the selected widgets'' bottom edges with the bottom of the dominant widget'
-#alignResizeSelectionBottom
-'Resize the selected widgets'' bottom edges to align them with the bottom of the dominant widget'
-
#alignSelectionCenterHor
'Aligns the selected widgets'' centers vertically with the center of the dominant widget'
@@ -219,27 +228,21 @@
#alignSelectionLeft
'Aligns the selected widgets'' left edges with the left edge of the dominant widget'
-#alignResizeSelectionLeft
-'Resize the selected widgets'' left edges to align them with the left edge of the dominant widget'
-
#alignSelectionLeftAndRight
'Aligns the selected widgets'' left & right edges with the dominant widget'
#alignSelectionRight
'Aligns the selected widgets'' right edges with the right edge of the dominant widget'
-#alignResizeSelectionRight
-'Resize the selected widgets'' right edges to align them with the right edge of the dominant widget'
-
#alignSelectionTop
'Aligns the selected widgets'' top edges with the top edge of the dominant widget'
-#alignResizeSelectionTop
-'Resize the selected widgets'' top edges to align them with the top edge of the dominant widget'
-
#alignSelectionTopAndBottom
'Aligns the selected widgets'' top and bottom edges with the dominant widget'
+#alignToGrid
+'Am Raster ausrichten'
+
#centerSelectionHor
'Centers the selected widgets horizontally within their containing widget'
@@ -300,6 +303,9 @@
#editOpenSpecDocumentation
'Opens the documentation of the selected widget'
+#editSaveSpecForSelection
+'Generate a sub-spec method for the selected element only.\Useful when refactoring an existing spec into sub specifications.'
+
#fileBrowseAspectMethods
'Opens a System Browser on the application''s aspect methods'
@@ -333,8 +339,8 @@
#generateHookMethods
'Generates startup/release methods. (#closeRequest, #postBuildWith:, #postOpenWith:)'
-#group
-''
+"/ #group
+"/ ''
#helpExamples
'Show some examples uses of the GUI Painter'
@@ -366,13 +372,22 @@
#moveWidgetUp
'Moves the selected widget up in the list (brings it to the back)'
+#openColorEditor
+'Open a color editor'
+
#pasteBuffer
'Pastes the widgets of the clipboard at the current mouse position'
#pasteWithLayout
'Pastes the widgets of the clipboard without changing their layouts'
-#referToCOnfigDatabase
+#pickColorFromScreen
+'Pick a color from the screen'
+
+#recentlyUsedColors
+'Pick a recently used color'
+
+#referToConfigDatabase
''
#settingsAspectsAsInstances
@@ -385,7 +400,7 @@
'Shows or hides the gallery window'
#settingsGenerateCommentedCode
-''
+'Enables/disables comments in the generated code, especially in aspect and hook methods'
#settingsGridManager
'Opens a dialog to toggle grid display or to change the grids spacing'
@@ -399,12 +414,30 @@
#settingsUndoManager
'Opens a dialog to undo modifications'
+#shadesOfBlue
+'Blue color tones'
+
+#shadesOfCyan
+'Cyan color tones'
+
+#shadesOfGray
+'Gray color tones'
+
+#shadesOfGreen
+'Green color tones'
+
+#shadesOfMagenta
+'Magenta color tones'
+
+#shadesOfRed
+'Red color tones'
+
+#shadesOfYellow
+'Yellow color tones'
+
#showGrid
'Raster zeigen'
-#alignToGrid
-'Am Raster ausrichten'
-
#sortItems
'Sort the selected items by position (left to right, top to bottom)'
@@ -420,42 +453,10 @@
#testStartApplication
'Starts the application with the current window spec'
-shadesOfRed
-'Red color tones'
-
-shadesOfGreen
-'Green color tones'
-
-shadesOfBlue
-'Blue color tones'
-
-shadesOfCyan
-'Cyan color tones'
-
-shadesOfMagenta
-'Magenta color tones'
-
-shadesOfYellow
-'Yellow color tones'
-
-shadesOfGray
-'Gray color tones'
-
-openColorEditor
-'Open a color editor'
-
-pickColorFromScreen
-'Pick a color from the screen'
-
-recentlyUsedColors
-'Pick a recently used color'
-
-useDefaultColorToggle
+#useDefaultColorToggle
'Toggle between default and explicit color'
)
-
- "Modified: / 09-08-2012 / 09:40:53 / cg"
! !
!UIPainter class methodsFor:'helpers'!
@@ -2152,6 +2153,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:#menuEdit
(Menu new fromLiteralArrayEncoding:(UIPainter menuEdit)) startUp
@@ -2168,7 +2170,6 @@
label: 'Undo'
itemValue: undoLast
nameKey: undo
- translateLabel: true
)
(MenuItem
label: '-'
@@ -2178,49 +2179,42 @@
enabled: canCutHolder
label: 'Cut'
itemValue: deleteSelection
- translateLabel: true
)
(MenuItem
activeHelpKey: editCopy
enabled: canCopyHolder
label: 'Copy'
itemValue: copySelection
- translateLabel: true
)
(MenuItem
activeHelpKey: editPaste
enabled: canPasteHolder
label: 'Paste'
itemValue: pasteBuffer
- translateLabel: true
)
(MenuItem
activeHelpKey: pasteWithLayout
enabled: canPasteKeepingLayoutHolder
label: 'Paste with Layout'
itemValue: pasteWithLayout
- translateLabel: true
)
(MenuItem
activeHelpKey: editPaste
enabled: canPasteKeepingLayoutHolder
label: 'Paste Keeping Absolute Position'
itemValue: pasteKeepingPosition
- translateLabel: true
)
(MenuItem
activeHelpKey: editDelete
enabled: canCutHolder
label: 'Delete'
itemValue: deleteTotalSelection
- translateLabel: true
)
(MenuItem
activeHelpKey: replaceBy
enabled: canReplaceSelection
label: 'Replace By...'
itemValue: doAskAndReplaceWidgetBy
- translateLabel: true
)
(MenuItem
label: '-'
@@ -2228,19 +2222,16 @@
(MenuItem
enabled: canMoveSelection
label: 'Move'
- translateLabel: true
submenuChannel: menuMove
)
(MenuItem
enabled: canMoveOrAlignSelection
label: 'Align'
- translateLabel: true
submenuChannel: menuAlign
)
(MenuItem
enabled: hasSelection
label: 'Dimension'
- translateLabel: true
submenu:
(Menu
(
@@ -2249,21 +2240,18 @@
enabled: hasSingleSelection
label: 'Copy Layout'
itemValue: copyLayout
- translateLabel: true
)
(MenuItem
activeHelpKey: editDimensionPasteLayout
enabled: canMoveOrAlignSelection
label: 'Paste Layout'
itemValue: pasteLayout
- translateLabel: true
)
(MenuItem
activeHelpKey: editDimensionExchangeLayouts
enabled: canExchangeSelectionLayouts
label: 'Exchange Layouts'
itemValue: exchangeLayouts
- translateLabel: true
)
(MenuItem
label: '-'
@@ -2273,28 +2261,24 @@
enabled: hasSingleSelection
label: 'Copy Extent'
itemValue: copyExtent
- translateLabel: true
)
(MenuItem
activeHelpKey: editDimensionPasteExtent
enabled: canMoveOrAlignSelection
label: 'Paste Extent'
itemValue: pasteExtent
- translateLabel: true
)
(MenuItem
activeHelpKey: editDimensionPasteWidth
enabled: canMoveOrAlignSelection
label: 'Paste Width'
itemValue: pasteWidth
- translateLabel: true
)
(MenuItem
activeHelpKey: editDimensionPasteHeight
enabled: canMoveOrAlignSelection
label: 'Paste Height'
itemValue: pasteHeight
- translateLabel: true
)
(MenuItem
label: '-'
@@ -2304,21 +2288,18 @@
enabled: canMoveOrAlignSelection
label: 'Set Default Extent'
itemValue: setToDefaultExtent
- translateLabel: true
)
(MenuItem
activeHelpKey: editDimensionDefaultWidth
enabled: canMoveOrAlignSelection
label: 'Set Default Width'
itemValue: setToDefaultWidth
- translateLabel: true
)
(MenuItem
activeHelpKey: editDimensionDefaultHeight
enabled: canMoveOrAlignSelection
label: 'Set Default Height'
itemValue: setToDefaultHeight
- translateLabel: true
)
)
nil
@@ -2332,13 +2313,11 @@
activeHelpKey: editOpenSpecDocumentation
label: 'Open Widget Documentation'
itemValue: doOpenWidgetDocumentation
- translateLabel: true
)
(MenuItem
- activeHelpKey: referToCOnfigDatabase
+ activeHelpKey: referToConfigDatabase
label: 'Refer to Config Database'
itemValue: configSelection
- translateLabel: true
isVisible: false
)
(MenuItem
@@ -2349,7 +2328,6 @@
activeHelpKey: drawEdit
label: 'Draw Edit'
itemValue: shapeEdit
- translateLabel: true
isVisible: false
)
(MenuItem
@@ -2359,32 +2337,24 @@
activeHelpKey: sortItems
label: 'Sort Selected Items by Position'
itemValue: doSortItems
- translateLabel: true
)
-"/ (MenuItem
-"/ label: 'Action'
-"/ translateLabel: true
-"/ )
(MenuItem
activeHelpKey: groupWithLayout
enabled: canGroup
label: 'Group with Layout'
itemValue: groupWithLayout
- translateLabel: true
)
(MenuItem
activeHelpKey: ungroup
enabled: canUngroup
label: 'Ungroup'
itemValue: ungroup
- translateLabel: true
)
(MenuItem
activeHelpKey: ungroupWithLayout
enabled: canGroup
label: 'Ungroup with Layout'
itemValue: ungroupWithLayout
- translateLabel: true
)
(MenuItem
label: '-'
@@ -2394,26 +2364,31 @@
enabled: hasOneSelectionOtherThanCanvas
label: 'Browse Widget Class'
itemValue: doBrowseViewClass
- translateLabel: true
)
(MenuItem
activeHelpKey: editInspectView
enabled: hasOneSelectionOtherThanCanvas
label: 'Inspect Widget'
itemValue: doInspectView
- translateLabel: true
)
(MenuItem
activeHelpKey: editBrowseViewClass
label: 'Browse Specification Class'
itemValue: doBrowseSpecificationClass
- translateLabel: true
)
(MenuItem
activeHelpKey: editInspectSpec
label: 'Inspect Spec'
itemValue: doInspectSpec
- translateLabel: true
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
+ activeHelpKey: editSaveSpecForSelection
+ enabled: hasOneSelectionOtherThanCanvas
+ label: 'Save Spec of Selection...'
+ itemValue: doSaveElementSpecAs
)
)
nil
@@ -5519,7 +5494,7 @@
self loadFromMessage:
(ResourceSelectionBrowser
- request: 'Load Window Spec From Class'
+ request: 'Load Window Spec from Class'
onSuperclass: nil
andClass: self specClass
andSelector: specSelector ? #windowSpec
@@ -5536,7 +5511,7 @@
self askForSectionModification.
classAndSelector := ResourceSelectionBrowser
- request: 'Load Subspec From Class'
+ request: 'Load Subspec from Class'
onSuperclass: nil
andClass: self specClass
andSelector: specSelector
@@ -5624,7 +5599,7 @@
specClass := self resolveName:specClassName.
(specClass notNil and:[ specClass isClass ]) ifFalse:[
- self warn:('Oops - cannot save - class not found: ' , specClassName).
+ self warn:('Oops - cannot save. Class not found: ' , specClassName).
^ nil
].
@@ -5674,7 +5649,7 @@
"/ ].
classAndSelector := ResourceSelectionBrowser
- request: 'Save Window Spec In Class'
+ request: 'Save Window Spec in Class'
onSuperclass: #Object
andClass: (specClassName ? #ApplicationModel) asSymbol
andSelector: specSelector ? #windowSpec
@@ -5693,6 +5668,51 @@
^ true
!
+doSaveElementSpecAs
+ "opens a ResourceSelectionBrowser for saving a spec for the selected
+ elements on a class.
+ Useful to save parts for refactoring a spec into
+ subSpecifications, for example when putting parts into a tab"
+
+ |spec fullSpec classAndSelector subSpecClass subSpecClassName subSpecSelector code|
+
+ self askForSectionModification.
+
+ (spec := self painter specForSelection) isNil ifTrue:[
+ self warn:('Select a single item first').
+ ^ false
+ ].
+
+ classAndSelector := ResourceSelectionBrowser
+ request: 'Save Subspec in Class'
+ onSuperclass: #Object
+ andClass: specClassName
+ andSelector: #subSpec
+ withResourceTypes: #(canvas).
+
+ classAndSelector isNil ifTrue:[^ false].
+
+ self clearModified.
+ self painter resetModification.
+
+ subSpecClass := classAndSelector methodClass.
+ subSpecClassName := classAndSelector methodClass name.
+ subSpecSelector := classAndSelector methodSelector.
+
+ subSpecClass := self resolveName:subSpecClassName.
+ (subSpecClass notNil and:[ subSpecClass isClass ]) ifFalse:[
+ self warn:('Oops - cannot save - class not found: ' , subSpecClassName).
+ ^ false
+ ].
+
+ spec := painter fullSpecFor:(painter singleSelection).
+
+ fullSpec := treeView generateFullSpecForComponents:(Array with:spec) named:subSpecSelector asUppercaseFirst.
+ code := painter generateWindowSpecMethodSourceFor:fullSpec class:subSpecClassName selector:subSpecSelector.
+ (ReadStream on:code) fileIn.
+ ^ true
+!
+
doSelectAspectMethod:aspectSelector
"open a dialog to select an existing aspect method and enter in the field"