--- a/UIPainter.st Thu Apr 02 21:12:46 1998 +0200
+++ b/UIPainter.st Thu Apr 02 21:16:00 1998 +0200
@@ -1,5 +1,5 @@
"
- COPYRIGHT (c) 1995 by eXept Software AG
+ COPYRIGHT (c) 1995-1998 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
@@ -12,9 +12,8 @@
ToolApplicationModel subclass:#UIPainter
- instanceVariableNames:'treeView selectionPanel tabSelection specClass specSelector
- specSuperclass aspects layoutCanvas helpCanvas specCanvas
- transcript modified'
+ instanceVariableNames:'specClass specSelector specSuperclass aspects treeView specCanvas
+ selectionPanel tabSelection layoutCanvas helpCanvas modified'
classVariableNames:''
poolDictionaries:''
category:'Interface-UIPainter'
@@ -31,7 +30,7 @@
copyright
"
- COPYRIGHT (c) 1995 by eXept Software AG
+ COPYRIGHT (c) 1995-1998 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
@@ -46,12 +45,12 @@
documentation
"
- The GUI Painter allows the user to build its own applications providing a graphical
- user interface to building components and to define the behavior of the components
- during runtime. The resulting specifications can be installed as methods on
- classes, typically subclasses of an ApplicationModel. These specifications
- are used by the UIBuilder to generate the application window and its component
- structues when open the application.
+ The GUI Painter provides the user with a graphical user interface for building own
+ interfaces by interactively assembling widgets and defining the behavior of the widgets.
+ The resulting interface specifications can be saved as methods on the application
+ classes, typically subclasses of the class ApplicationModel. These specifications
+ are used by the UIBuilder to generate the application window and its widgets when
+ opening the application.
[start with:]
UIPainter open
@@ -59,6 +58,7 @@
[author:]
Claus Gittinger, eXept Software AG
Claus Atzkern, eXept Software AG
+ Thomas Zwick, eXept Software AG
[see also:]
UIBuilder
@@ -74,16 +74,6 @@
"open a GUI Painter on aClass and (windowSpec) aSelector
"
^ self new openOnClass:aClass andSelector:aSelector
-!
-
-painter:aBuilderView
- "set the painter
- "
- |application|
-
- application := self new.
- application painter:aBuilderView.
- ^ application open
! !
!UIPainter class methodsFor:'ST-80 queries'!
@@ -96,11 +86,11 @@
! !
-!UIPainter class methodsFor:'accessing-defaults'!
+!UIPainter class methodsFor:'accessing'!
defaultNameOfCanvas
- "returns the default name (id) of the application
- "
+ "returns the default name of the application"
+
^'NewApplication'
! !
@@ -466,7 +456,7 @@
"This resource specification was automatically generated
by the UIPainter of ST/X."
- "Do not manually edit this. If it is corrupted,
+ "Do not manually edit this!! If it is corrupted,
the UIPainter may not be able to read the specification."
"
@@ -482,11 +472,11 @@
#window:
#(#WindowSpec
#name: 'GUI Painter'
- #layout: #(#LayoutFrame 575 0 296 0 921 0 455 0)
+ #layout: #(#LayoutFrame 240 0 345 0 586 0 504 0)
#label: 'GUI Painter'
- #min: #(#Point 10 10)
- #max: #(#Point 1152 900)
- #bounds: #(#Rectangle 575 296 922 456)
+ #min: #(#Point 350 160)
+ #max: #(#Point 500 160)
+ #bounds: #(#Rectangle 240 345 587 505)
#usePreferredExtent: false
)
#component:
@@ -560,7 +550,7 @@
"This resource specification was automatically generated
by the UIPainter of ST/X."
- "Do not manually edit this. If it is corrupted,
+ "Do not manually edit this!! If it is corrupted,
the UIPainter may not be able to read the specification."
"
@@ -576,11 +566,11 @@
#window:
#(#WindowSpec
#name: 'GUI Painter'
- #layout: #(#LayoutFrame 575 0 296 0 856 0 493 0)
+ #layout: #(#LayoutFrame 240 0 345 0 521 0 542 0)
#label: 'GUI Painter'
- #min: #(#Point 10 10)
- #max: #(#Point 1280 1024)
- #bounds: #(#Rectangle 575 296 857 494)
+ #min: #(#Point 300 200)
+ #max: #(#Point 300 200)
+ #bounds: #(#Rectangle 240 345 522 543)
#usePreferredExtent: false
)
#component:
@@ -669,11 +659,11 @@
#window:
#(#WindowSpec
#name: 'GUI Painter'
- #layout: #(#LayoutFrame 123 0 269 0 662 0 743 0)
+ #layout: #(#LayoutFrame 106 0 256 0 625 0 730 0)
#label: 'GUI Painter'
- #min: #(#Point 540 490)
+ #min: #(#Point 560 460)
#max: #(#Point 1160 870)
- #bounds: #(#Rectangle 123 269 663 744)
+ #bounds: #(#Rectangle 106 256 626 731)
#menu: #menu
#usePreferredExtent: false
)
@@ -785,7 +775,7 @@
#activeHelpKey: #editOpenSpecDocumentation
#hasCharacterOrientedLabel: false
#label: 'helpIcon'
- #model: #openWidgetDocumentation
+ #model: #doOpenWidgetDocumentation
)
#(#ActionButtonSpec
#name: 'cancelButton'
@@ -823,206 +813,6 @@
)
)
)
-!
-
-windowSpecWithTranscriptHelp
- "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:UIPainter andSelector:#windowSpecWithTranscriptHelp
- UIPainter new openInterface:#windowSpecWithTranscriptHelp
- "
-
- <resource: #canvas>
-
- ^
-
- #(#FullSpec
- #window:
- #(#WindowSpec
- #name: 'GUI Painter'
- #layout: #(#LayoutFrame 177 0 249 0 716 0 723 0)
- #label: 'GUI Painter'
- #min: #(#Point 10 10)
- #max: #(#Point 1160 870)
- #bounds: #(#Rectangle 177 249 717 724)
- #menu: #menu
- #usePreferredExtent: false
- )
- #component:
- #(#SpecCollection
- #collection:
- #(
- #(#MenuPanelSpec
- #name: 'menuToolbarView'
- #layout: #(#LayoutFrame -1 0.0 0 0 -1 1.0 32 0)
- #tabable: true
- #menu: #menuToolbar
- )
- #(#VariableVerticalPanelSpec
- #name: 'vpanel'
- #layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0)
- #component:
- #(#SpecCollection
- #collection:
- #(
- #(#VariableHorizontalPanelSpec
- #name: 'hpanel'
- #component:
- #(#SpecCollection
- #collection:
- #(
- #(#ArbitraryComponentSpec
- #name: 'treeView'
- #tabable: true
- #menu: #menuEdit
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: true
- #miniScrollerHorizontal: true
- #miniScrollerVertical: true
- #component: #treeView
- #hasBorder: false
- )
- #(#ViewSpec
- #name: 'specHolderView'
- #component:
- #(#SpecCollection
- #collection:
- #(
- #(#MenuPanelSpec
- #name: 'menuToolbar2View'
- #layout: #(#LayoutFrame -1 0.0 -2 0 -1 1.0 30 0)
- #enableChannel: #canMoveOrAlignSelection
- #tabable: true
- #menu: #menuToolbar2
- )
- #(#NoteBookViewSpec
- #name: 'noteBook'
- #layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -30 1.0)
- #enableChannel: #enableChannel
- #tabable: true
- #model: #tabModel
- #menu: #tabList
- #style: #(#FontDescription #helvetica #medium #roman 10)
- #canvas: #noteBookView
- )
- #(#HorizontalPanelViewSpec
- #name: 'horizontalPanelView1'
- #layout: #(#LayoutFrame -128 1 -1 0 0 1.0 31 0)
- #component:
- #(#SpecCollection
- #collection:
- #(
- #(#ArrowButtonSpec
- #name: 'MoveLeftButton'
- #activeHelpKey: #changePositionLeft
- #tabable: true
- #model: #moveSelectionLeft
- #enableChannel: #canMoveOrAlignSelection
- #isTriggerOnDown: true
- #direction: #left
- #extent: #(#Point 32 32)
- )
- #(#ArrowButtonSpec
- #name: 'MoveRightButton'
- #activeHelpKey: #changePositionRight
- #model: #moveSelectionRight
- #enableChannel: #canMoveOrAlignSelection
- #isTriggerOnDown: true
- #direction: #right
- #extent: #(#Point 32 32)
- )
- #(#ArrowButtonSpec
- #name: 'MoveDownButton'
- #activeHelpKey: #changePositionDown
- #model: #moveSelectionDown
- #enableChannel: #canMoveOrAlignSelection
- #isTriggerOnDown: true
- #direction: #down
- #extent: #(#Point 32 32)
- )
- #(#ArrowButtonSpec
- #name: 'MoveUpButton'
- #activeHelpKey: #changePositionUp
- #model: #moveSelectionUp
- #enableChannel: #canMoveOrAlignSelection
- #isTriggerOnDown: true
- #direction: #up
- #extent: #(#Point 32 32)
- )
- )
- )
- #horizontalLayout: #fit
- #verticalLayout: #fit
- #horizontalSpace: 0
- #verticalSpace: 0
- )
- #(#HorizontalPanelViewSpec
- #name: 'modifyPanel'
- #layout: #(#LayoutFrame 0 0.0 -30 1.0 0 1.0 0 1.0)
- #component:
- #(#SpecCollection
- #collection:
- #(
- #(#ActionButtonSpec
- #name: 'cancelButton'
- #activeHelpKey: #cancel
- #label: 'Cancel'
- #tabable: true
- #model: #cancel
- #enableChannel: #modifiedChannel
- #extent: #(#Point 178 24)
- )
- #(#ActionButtonSpec
- #name: 'acceptButton'
- #activeHelpKey: #accept
- #label: 'OK'
- #tabable: true
- #model: #accept
- #enableChannel: #modifiedChannel
- #extent: #(#Point 179 24)
- )
- )
- )
- #horizontalLayout: #fitSpace
- #verticalLayout: #fitSpace
- #horizontalSpace: 3
- #verticalSpace: 3
- )
- )
- )
- #borderWidth: 1
- )
- )
- )
- #level: 1
- #handles: #(#Any 0.318264 1.0)
- )
- #(#TextEditorSpec
- #name: 'HelpTranscript'
- #hasHorizontalScrollBar: true
- #hasVerticalScrollBar: true
- #miniScrollerHorizontal: true
- #miniScrollerVertical: true
- #isReadOnly: true
- )
- )
- )
- #handles: #(#Any 0.880597 1.0)
- )
- #(#UISubSpecification
- #name: 'infoBarSubSpec'
- #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
- #majorKey: #ToolApplicationModel
- #minorKey: #windowSpecForInfoBar
- )
- )
- )
- )
! !
!UIPainter class methodsFor:'menu specs'!
@@ -1216,11 +1006,6 @@
#indication: #redefineAspectMethods:
)
#(#MenuItem
- #label: 'Transcript Help'
- #activeHelpKey: #settingsTranscriptHelp
- #indication: #transcriptHelp:
- )
- #(#MenuItem
#label: '-'
)
#(#MenuItem
@@ -1580,7 +1365,7 @@
)
#(#MenuItem
#label: 'Open Widget Documentation'
- #value: #openWidgetDocumentation
+ #value: #doOpenWidgetDocumentation
#activeHelpKey: #editOpenSpecDocumentation
)
#(#MenuItem
@@ -1588,13 +1373,13 @@
)
#(#MenuItem
#label: 'Inspect View'
- #value: #inspectView
+ #value: #doInspectView
#activeHelpKey: #editInspectView
#enabled: #hasOneSelectionOtherThanCanvas
)
#(#MenuItem
#label: 'Inspect Spec'
- #value: #inspectSpec
+ #value: #doInspectSpec
#activeHelpKey: #editInspectSpec
)
) nil
@@ -1861,270 +1646,60 @@
)
! !
-!UIPainter methodsFor:'accessing'!
-
-redefineAspectMethods
- "redefine methods yes or no. If a method is defined in super class
- should the message be reinstalled ?
- "
- ^ UIPainterView redefineAspectMethods
-
-
-!
-
-redefineAspectMethods:aBoolean
- "redefine methods yes or no. If a method is defined in super class
- should the message be reinstalled ?
- "
- UIPainterView redefineAspectMethods:aBoolean
-
-
-!
-
-transcriptHelp
- "answer whether the help transcript is turned on/off
- "
- ^self class settings at: #TranscriptHelp
- ifAbsent: [self class settings at: #TranscriptHelp put: false]
-!
-
-transcriptHelp:aBoolean
- "turn on/off the help transcript
- "
- self class settings at: #TranscriptHelp put: aBoolean
-
-! !
-
-!UIPainter methodsFor:'actions'!
-
-accept
- "accept changes done to the specification. The component assigned to the
- specification will change immediately dependant on the attributes derived
- from the specification.
- "
- |layout spec prop key layoutTool|
-
- self isLayoutToolSelected ifTrue:[
- layoutTool := self layoutTool.
-
- (layout := layoutTool layout) notNil ifTrue:[
- layoutTool layoutType == #Extent ifTrue:[
- layoutTool layoutView == self painter topView ifTrue:[
- layoutTool layoutView extent:layout
- ] ifFalse:[
- self painter setExtent:layout
- ]
- ] ifFalse:[
- self painter setLayout:layout
- ]
- ]
- ] ifFalse:[
- spec := self specTool specification.
-
- self isHelpToolSelected ifTrue:[
- self helpTool accept.
- key := self helpTool helpKey.
- prop := treeView propertySelected.
-
- prop notNil ifTrue:[
- prop spec activeHelpKey:key
- ].
- spec activeHelpKey:key.
- ] ifFalse:[
- self painter updateFromSpec:spec.
- ]
- ].
- self modifiedChannel value:false.
- modified := true.
-!
-
-addWidget: aSpecClass
-
- self addWidgetOfSpec: (Array with: (Smalltalk at: aSpecClass) new)
-
-!
-
-addWidgetOfSpec: aSpec
-
- |newSel|
- (newSel := self pasteSpecifications:aSpec keepLayout:false at:0@0) notNil
- ifTrue:
- [
- self select: newSel
- ]
- ifFalse:
- [
- ((treeView selection size = 0) or: [treeView selectedNode isNil])
- ifTrue:
- [
- treeView selection: #(1).
- ]
- ifFalse:
- [
- treeView selectNode: (treeView detectNode: [:n| n = treeView selectedNode parent])
- ].
- self addWidgetOfSpec: aSpec
- ]
-
-!
-
-cancel
- "cancel all changes done to the specification; reread attributes from the
- assigned component
- "
- |spec key view|
-
- self isModified ifTrue:[
- (spec := self painter specForSelection) notNil ifTrue:[
- key := spec activeHelpKey.
- ].
- self helpTool helpKey:key.
-
- treeView isCanvasSelected ifTrue: [
- spec := treeView canvasSpec.
- ].
- self specTool specification:spec.
- view := self layoutTool layoutView.
-
- self setViewInLayoutTool:view.
- spec class == DataSetSpec ifTrue:[
- view columnDescriptors:(spec columns)
- ].
- self modifiedChannel value:false.
- modified := false
- ]
-!
-
-inspectSpec
- "inspect the selected specification"
-
- |spec|
-
- (spec := self specForSelection) isNil ifTrue:[
- treeView isCanvasSelected ifTrue:[
- spec := treeView canvasSpec.
- ]
- ].
- spec notNil ifTrue:[
- spec inspect
- ]
-
-
-!
-
-inspectView
- "inspect the view of the selected specification"
-
- |selection view|
-
- ((selection := self painter selection) isCollection and: [selection size >= 1]) ifTrue:[
- selection first inspect
- ] ifFalse: [
- selection inspect
- ]
-
-!
-
-moveSelectionDown
- "move selected components down
- "
- self painter moveSelectionDown
-!
-
-moveSelectionLeft
- "move selected components left
- "
- self painter moveSelectionLeft
-
-!
-
-moveSelectionRight
- "move selected components right
- "
- self painter moveSelectionRight
-
-!
-
-moveSelectionUp
- "move selected components up
- "
- self painter moveSelectionUp
-
-!
-
-openWidgetDocumentation
- "open documentation for the selected widget"
-
- |spec document|
-
- (spec := self specForSelection) isNil ifTrue:[
- treeView isCanvasSelected ifTrue:[
- spec := nil
- ]
- ].
- spec notNil ifTrue:[
- document := 'tools/uipainter/Widgets/', spec userFriendlyName,'.html'
- ] ifFalse: [
- document := 'tools/uipainter/TOP.html#THEWIDGETSANDHOWDOTHEYWORK'
- ].
- HTMLDocumentView openFullOnDocumentationFile: document
-
-
-! !
-
!UIPainter methodsFor:'aspects'!
aspectFor:aKey
- "aspect for a key
- "
- ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
+ "returns the aspect for aKey"
+
+ ^aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
!
canChangeOrderInContainer
- "returns a boolean value holder which is true if the component order can be changed within their container.
- "
+ "returns a boolean value holder which is true if the widget order can be changed
+ within their container"
+
^ builder booleanValueAspectFor:#canChangeOrderInContainer
!
canMoveOrAlignSelection
"returns a boolean value holder which is true in case that any selection exists
and all widgets in the selection can change its layout through to a move or
- align operation
- "
+ align operation"
+
^ builder booleanValueAspectFor:#canMoveOrAlignSelection
!
canMoveSelection
- ^self canChangeOrderInContainer value |
- self canMoveSelectionOutOfContainer value |
- self canMoveSelectionOutOfContainer value
+ ^self canChangeOrderInContainer value or: [
+ self canMoveSelectionOutOfContainer value or: [
+ self canMoveSelectionOutOfContainer value]]
!
canMoveSelectionIntoContainer
- "returns a boolean value holder which is true in case that one component is selected
+ "returns a boolean value holder which is true in case that one widget is selected
and can change its container widget to the next element in the list which will have
- the same container.
- "
+ the same container"
+
^ builder booleanValueAspectFor:#canMoveSelectionIntoContainer
!
canMoveSelectionOutOfContainer
- "returns a boolean value holder which is true in case that one component is selected
- which is contained within another component
- "
+ "returns a boolean value holder which is true in case that one widget is selected
+ which is contained within another component"
+
^ builder booleanValueAspectFor:#canMoveSelectionOutOfContainer
!
enableChannel
- "true if modifications are allowed otherwise running test
- "
- ^ self painter enableChannel
+ "true if modifications are allowed otherwise running test"
+
+ ^ self painter enableChannel
!
galleryShown
- "returns a boolean value holder which is set to true if the gallery is shown
- "
+ "returns a boolean value holder which is set to true if the gallery is shown"
+
|holder|
(holder := builder bindingAt:#galleryShown) isNil ifTrue:[
@@ -2136,22 +1711,22 @@
!
hasOneSelectionOtherThanCanvas
- "returns a value holder which is true in case that one component is selected
- other than the canvas.
- "
+ "returns a value holder which is true in case that one widget is selected
+ other than the root"
+
^ builder booleanValueAspectFor:#hasOneSelectionOtherThanCanvas
!
modifiedChannel
"returns a boolean value holder which is set to true if something is modified
- and not accepted
- "
+ and not accepted"
+
^ builder booleanValueAspectFor:#modifiedChannel
!
noteBookView
- "returns the notebook view; initialize components within the notebook
- "
+ "returns the notebook view; initialize the tools embedded in the notebook"
+
|noteBook channel helpTool layoutTool specTool|
(noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
@@ -2188,8 +1763,8 @@
!
painterShown
- "returns a boolean value holder which is set to true if the painter is shown
- "
+ "returns a boolean value holder which is set to true if the painter is shown"
+
|holder|
(holder := builder bindingAt:#painterShown) isNil ifTrue:[
@@ -2201,8 +1776,8 @@
!
tabList
- "returns a value holder which keeps a list of labels assigned to the tabs
- "
+ "returns a value holder which keeps a list of the section labels in the notebook"
+
|holder|
(holder := builder bindingAt:#tabList) isNil ifTrue:[
@@ -2212,8 +1787,8 @@
!
tabModel
- "returns a value holder which keeps the current name of the tab selected
- "
+ "returns a value holder which keeps the label of the current section in the notebook"
+
|holder|
(holder := builder bindingAt:#tabModel) isNil ifTrue:[
@@ -2224,8 +1799,8 @@
!
treeView
- "returns the selection tree view which holds all widget identifiers
- "
+ "returns the tree view which holds all widget"
+
^ treeView
!
@@ -2244,20 +1819,17 @@
!UIPainter methodsFor:'building editors'!
openDataSetColumnEditor
- "opens a column editor
- "
- |cls aspect editor columns|
-
- cls := self resolveName:specClass.
-
- cls isNil ifTrue:[
+ "opens a Table Column Editor on current widget"
+
+ |editor|
+
+ (self resolveName:specClass) isNil ifTrue:[
^ self information:'No application class defined yet!!'
].
- aspect := self specTool specification columns.
editor := DataSetBuilder new.
editor masterApplication:self.
- editor columns:aspect fromView:(self layoutTool layoutView).
+ editor columns:self specTool specification columns fromView:(self layoutTool layoutView).
editor rowClassName:(self specTool specification rowClassName).
editor openModal.
@@ -2269,13 +1841,11 @@
!
openEditMenu
- "opens a menu editor on current widget
- "
+ "opens a Menu Editor on current widget"
+
|cls selectorOrMenu editor selectedSpec|
- cls := self resolveName:specClass.
-
- cls isNil ifTrue:[
+ (cls := self resolveName:specClass) isNil ifTrue:[
^ self warn:'No application class defined yet!!'
].
@@ -2316,25 +1886,23 @@
!
openHierarchicalListEditor
- "opens a hierarchical list editor editor on current widget
- "
- |cls aspect editor|
-
- cls := self resolveName:specClass.
-
- cls isNil ifTrue:[
+ "opens a Hierarchical List Editor on current widget"
+
+ |selector editor|
+
+ (self resolveName:specClass) isNil ifTrue:[
^ self information:'No application class defined yet!!'
].
- (aspect := self specTool specification hierarchicalList) notNil ifTrue:[
- aspect := aspect asSymbol
+ (selector := self specTool specification hierarchicalList) notNil ifTrue:[
+ selector := selector asSymbol
].
editor := HierarchicalListEditor new.
editor masterApplication:self.
- editor openModalOnClass:cls andSelector:aspect.
-
- editor specSelector ~= aspect ifTrue:[
+ editor openModalOnClass:specClass andSelector:selector.
+
+ editor specSelector ~= selector ifTrue:[
editor hasSaved ifTrue:[
self specTool specification hierarchicalList:editor specSelector.
self modifiedChannel value:true.
@@ -2367,29 +1935,26 @@
self class openOnClass:meta soleInstance andSelector:spec minorKey.
- "Created: / 6.2.1998 / 13:03:59 / stefan"
- "Modified: / 6.2.1998 / 13:59:30 / stefan"
!
openTabListEditor
- "open a TabListEditor
- "
- |cls aspect editor columns|
-
- cls := self resolveName:specClass.
-
- cls isNil ifTrue:[
+ "opens a Tab List Editor on current widget"
+
+ |selector editor|
+
+ (self resolveName:specClass) isNil ifTrue:[
^ self information:'No application class defined yet!!'
].
- aspect := self specTool specification listSelector.
+
+ selector := self specTool specification listSelector.
editor := TabListEditor new.
editor masterApplication:self.
- editor openModalOnClass:cls andSelector:aspect.
-
- editor specSelector ~= aspect ifTrue:[
+ editor openModalOnClass:specClass andSelector:selector.
+
+ editor specSelector ~= selector ifTrue:[
editor hasSaved ifTrue:[
- self specTool specification listSelector:(editor specSelector).
+ self specTool specification listSelector:editor specSelector.
self modifiedChannel value:true.
self accept.
]
@@ -2400,8 +1965,8 @@
layoutChanged
"called by the painter/canvas whenever the layout of the current selected
- widget changed
- "
+ widget has changed"
+
self isModified ifFalse:[
self layoutTool update.
self modifiedChannel value:false
@@ -2410,13 +1975,13 @@
propertyChanged
"called by the painter/canvas whenever the property of the current selected
- widget changed
- "
- |p|
-
- (p := treeView propertySelected) notNil ifTrue:[
- self specTool specification:(p spec copy).
- self setViewInLayoutTool:(p view).
+ widget has changed"
+
+ |property|
+
+ (property := treeView propertySelected) notNil ifTrue:[
+ self specTool specification:(property spec copy).
+ self setViewInLayoutTool:(property view).
self modifiedChannel value:false
] ifFalse:[
self layoutTool layoutView notNil ifTrue:[
@@ -2427,8 +1992,8 @@
!
update:something with:aParameter from:someObject
- "catch change notifications
- "
+ "catches change notifications"
+
someObject == treeView model ifTrue:[
(something == #selection
or:[something == #selectionIndex]) ifTrue:[self treeSelection].
@@ -2459,6 +2024,7 @@
!UIPainter methodsFor:'event handling'!
doesNotUnderstand:aMessage
+ "if does not understand incoming messages, detour them to painter"
|painter|
@@ -2474,55 +2040,18 @@
!UIPainter methodsFor:'help'!
defaultInfoLabel
+ "returns the default info label"
specClass isNil ifTrue: [^'No class and selector defined.'].
^specClass printString, ' >> ', specSelector
-!
-
-show:aHelpText
-
- (self transcriptHelp and: [transcript notNil])
- ifFalse:
- [
- super showHelp:aHelpText for:self
- ]
- ifTrue:
- [
- transcript hideCursor; contents:aHelpText
- ]
-!
-
-showHelp:aHelpText for:view
- "display active help texts in my own info area."
-
- (self transcriptHelp and: [transcript notNil])
- ifFalse:
- [
- ^super showHelp:aHelpText for:view.
- ]
- ifTrue:
- [
- |txt|
- aHelpText isNil ifTrue:[
- txt := nil
- ] ifFalse:[
- txt := self class
- convertString:(aHelpText asString)
- maxLineSize:(transcript width // transcript font width)
- skipLineFeed:true
- ].
- transcript hideCursor; contents:txt.
- ^true
- ]
! !
!UIPainter methodsFor:'private'!
askForModification
- "check interface modification
- "
-
- self treeSelection. "accept modifications"
+ "asks for window spec modification"
+
+ self askForSectionModification.
(modified or: [self painter isModified or: [self helpTool modified]])
ifTrue:
@@ -2538,8 +2067,20 @@
^true
!
+askForSectionModification
+ "asks for section modification in the notebook"
+
+ self isModified ifTrue:[
+ (self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[
+ self accept
+ ] ifFalse: [
+ self cancel
+ ]
+ ]
+!
+
checkClassAndSelector
- "check for class & superclass"
+ "checks for class & superclass"
|superclass cls|
@@ -2603,25 +2144,9 @@
"Modified: 12.8.1997 / 23:39:10 / cg"
!
-checkModified
- "check interface modification
- "
- (self isModified and: [self isModified or: [self helpTool modified]])
- ifTrue:
- [
- ((YesNoBox title:'Window Spec was modified!!')
- noText:'Cancel';
- yesText:'Waste it and proceed';
- showAtPointer;
- accepted) ifFalse: [^false].
- self painter resetModification
- ].
- ^true
-!
-
hideUIView:aView
- "hide the view which is an application or top view
- "
+ "hides the view which is an application or top view"
+
aView beIndependent.
aView unmap.
!
@@ -2641,13 +2166,14 @@
!
raiseUIView:aView
- "raise the view which is an application or top view
- "
+ "raise the view which is an application or top view"
+
aView map.
aView bePartner.
!
resourceMessage: aString
+ "reads the specClass and the specSelector by evaluating aString"
(aString notNil and: [self askForModification])
ifTrue:
@@ -2668,9 +2194,8 @@
!
setClass:cls selector:selector
- "set the application class and the selector under which the
- window specification should be stored
- "
+ "sets the specClass and the specSelector under which the window spec should be saved"
+
|clsName superClassName|
clsName := cls name.
@@ -2698,8 +2223,8 @@
!
setViewInLayoutTool:aView
- "set view for layout tool
- "
+ "sets view for layout tool"
+
|type|
self painter topView == aView ifTrue:[
@@ -2710,6 +2235,7 @@
!
specClass:aClass
+ "sets the specClass and updates the Help Tool"
specClass := aClass isBehavior ifTrue:[aClass name]
ifFalse:[aClass].
@@ -2723,8 +2249,8 @@
!UIPainter methodsFor:'private tools'!
helpTool
- "returns the help tool
- "
+ "returns the help tool"
+
helpCanvas isNil ifTrue:[
self noteBookView
].
@@ -2732,8 +2258,8 @@
!
layoutTool
- "returns the layout tool
- "
+ "returns the layout tool"
+
layoutCanvas isNil ifTrue:[
self noteBookView
].
@@ -2741,14 +2267,14 @@
!
painter
- "returns the painter/canvas view
- "
+ "returns the canvas view"
+
^ treeView canvas
!
specTool
- "returns the spec tool
- "
+ "returns the spec tool"
+
specCanvas isNil ifTrue:[
self noteBookView
].
@@ -2758,59 +2284,55 @@
!UIPainter methodsFor:'queries'!
hasSpecClass
- "checks whether an application class is defined
- "
+ "answers whether an application class is defined"
+
^ (self resolveName:specClass) notNil
!
hasSpecClassAndSelector
- "checks whether an application class and a selector under which
- the window specification is stored is defined.
- "
+ "answers whether an application class and a selector under which
+ the window spec is stored is defined"
+
specSelector size > 1 ifTrue:[
^ self hasSpecClass
].
- ^ false
+ ^ false
!
isHelpToolSelected
- "returns true if current selected tab in the noteBook is assigned
- to the 'Help' tool
- "
+ "answers whether the current selected section in the noteBook is the Help Tool"
+
^ tabSelection = UIHelpTool label
-
!
isLayoutToolSelected
- "returns true if current selected tab in the noteBook is assigned
- to the 'Layout' tool
- "
+ "answers whether the current selected section in the noteBook is the Layout Tool"
+
^ tabSelection = UILayoutTool label
!
isModified
- "return true if current specification or layout is modified
- "
+ "answers whether the current window spec or a layout is modified"
+
^ self modifiedChannel value
!
isPainterEnabled
- "returns true if not running in test mode
- "
+ "answers whether I am running in test mode"
+
^ self painter enabled
! !
!UIPainter methodsFor:'selection'!
tabSelection
- "returns name of current selected tab in the notebook.
- "
+ "returns the label of the current section in the notebook"
+
^ tabSelection
!
tabSelection:something
- "the tab selection of the notebook changed
- "
+ "called whenever the section of the notebook has changed"
|whatToDo|
@@ -2820,7 +2342,7 @@
self isModified ifTrue:[
whatToDo := DialogBox
- confirmWithCancel:'Accept modifications in section ' , tabSelection printString , '?'
+ confirmWithCancel:'Accept modifications in section ' , tabSelection printString asBoldText, '?'
labels:#('Cancel' 'Ignore' 'Accept')
default:3.
whatToDo isNil ifTrue:[^self].
@@ -2838,8 +2360,8 @@
!
treeSelection
- "called whenever the selection of the treeview changed
- "
+ "called whenever the selection of the treeview has changed"
+
|view list spec slices size property tabComponent canCutOrCopy canPaste clipboard sel|
self isModified ifTrue:[
@@ -2894,7 +2416,7 @@
self treeView isCanvasSelected ifFalse: [list at:(size + 1) put:(UIHelpTool label)].
self tabList value:list.
- self show:(spec class name).
+ self showHelp:spec class name for:self.
tabComponent enabled:true.
(tabSelection := tabComponent selection) isNil ifTrue:[
@@ -2904,7 +2426,7 @@
] ifFalse:[
self helpTool helpKey:nil.
tabComponent enabled:false.
- self show:nil.
+ self defaultInfoLabel.
].
self modifiedChannel value:false.
@@ -2931,17 +2453,35 @@
! !
+!UIPainter methodsFor:'settings'!
+
+redefineAspectMethods
+ "redefine methods yes or no. If a method is defined in super class
+ should the message be reinstalled ?
+ "
+ ^ UIPainterView redefineAspectMethods
+
+
+!
+
+redefineAspectMethods:aBoolean
+ "redefine methods yes or no. If a method is defined in super class
+ should the message be reinstalled ?
+ "
+ UIPainterView redefineAspectMethods:aBoolean
+
+
+! !
+
!UIPainter methodsFor:'startup / release'!
closeRequest
- "close all windows open by builder
- "
+ "close request"
self askForModification ifFalse:[^self].
treeView model removeDependent:self.
self painter release.
- ColorMenu releaseResources.
selectionPanel notNil ifTrue:[
selectionPanel masterApplication:nil.
@@ -2950,21 +2490,16 @@
selectionPanel := nil.
treeView := nil.
- ActiveHelp stopFor:self.
-
super closeRequest.
- "Modified: / 27.10.1997 / 00:01:30 / cg"
!
closeRequestFor:aTopView
- "handle a close request for a specific view
- "
+ "handles a close request for a specific view"
+
|topView|
- topView := self window.
-
- topView == aTopView ifTrue:[
+ (topView := self window) == aTopView ifTrue:[
super closeRequestFor:aTopView
] ifFalse:[
aTopView = selectionPanel window ifTrue:[
@@ -2981,6 +2516,7 @@
!
loadFromMessage: aMessage
+ "loads a window spec by evaluating aMessage"
((aMessage size > 0) and: [self askForModification])
ifTrue:
@@ -3003,9 +2539,9 @@
!
openInterface:aSymbol
- "open interfaces
- "
- |painterView painter cls topView|
+ "opens the interface on the selector aSymbol"
+
+ |cls painterView painter topView|
modified := false.
@@ -3045,58 +2581,51 @@
painter treeView:treeView.
treeView model addDependent:self.
- self transcriptHelp
- ifFalse:
- [
- super openInterface:aSymbol.
- ]
- ifTrue:
- [
- super openInterface:#windowSpecWithTranscriptHelp.
- transcript := (self builder componentAt:#HelpTranscript) scrolledView.
- ].
+ super openInterface:aSymbol.
topView := self window.
topView label:'GUI Painter'.
- painterView openInGroup:(topView windowGroup).
- painterView open.
- painterView application:self.
-
- painterView application:self.
- selectionPanel := UISelectionPanel new.
- selectionPanel allButOpenInterface:#windowSpec.
- selectionPanel window openInGroup:(topView windowGroup).
-
- selectionPanel openWindow.
- selectionPanel masterApplication:self.
-
- topView iconLabel:'GUI Painter'.
- topView icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
-
- painterView iconLabel:'GUI Painter'.
- painterView icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
-
- topView bePartner.
- painterView bePartner.
- selectionPanel window bePartner.
-
- selectionPanel window iconLabel:'GUI Painter'.
- selectionPanel window icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
-
+ "take care for those who do close very quickly after launching"
+ Object errorSignal handle: [:ex|] do:
+ [
+ painterView openInGroup:(topView windowGroup).
+ painterView open.
+ painterView application:self.
+
+ painterView application:self.
+ selectionPanel := UISelectionPanel new.
+ selectionPanel allButOpenInterface:#windowSpec.
+ selectionPanel window openInGroup:(topView windowGroup).
+
+ selectionPanel openWindow.
+ selectionPanel masterApplication:self.
+
+ topView iconLabel:'GUI Painter'.
+ topView icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
+
+ painterView iconLabel:'GUI Painter'.
+ painterView icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
+
+ topView bePartner.
+ painterView bePartner.
+ selectionPanel window bePartner.
+
+ selectionPanel window iconLabel:'GUI Painter'.
+ selectionPanel window icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
+ ]
!
openOnClass:aClass
- "open up an interface builder
- "
+ "opens the GUI Painter on aClass and #windowSpec"
+
self openOnClass:aClass andSelector:#windowSpec
!
openOnClass:aClass andSelector:aSelector
- "open up an interface builder, fetching a spec from someClass
- via some selector
- "
+ "opens the GUI Painter on aClass and aSelector"
+
|painter|
aClass isNil ifTrue:[
@@ -3106,105 +2635,179 @@
self openInterface.
- aClass notNil ifTrue:[
- painter := self painter.
- self setClass:aClass selector:aSelector.
- (aClass respondsTo:aSelector) ifTrue:[
- "take care for those who do close very quickly"
- Object errorSignal handle: [:ex|] do:
- [
+ "take care for those who do close very quickly after launching"
+ Object errorSignal handle: [:ex|] do:
+ [
+ aClass notNil ifTrue:[
+ painter := self painter.
+ self setClass:aClass selector:aSelector.
+ (aClass respondsTo:aSelector) ifTrue:[
painter setupFromSpec:(aClass perform:aSelector).
treeView selection: #(1)
- ].
+ ]
]
]
-
- "Modified: / 25.10.1997 / 19:11:51 / cg"
- "Modified: / 5.2.1998 / 09:48:15 / stefan"
!
postOpenWith: aBuilder
+ "sets the root of the tree view as first selection;
+ sets the grid parameters, if defined"
|painter settings gridPara hspace vspace|
super postOpenWith: aBuilder.
- treeView selection: (Array with: 1).
- self treeSelection.
-
- painter := self painter.
- settings := self class settings.
- gridPara := painter gridParameters copy.
- hspace := settings at: #HGridSpace ifAbsent: [10].
- vspace := settings at: #VGridSpace ifAbsent: [10].
- gridPara at:1 put:hspace; at:2 put:vspace; at:5 put:hspace; at:6 put:vspace.
- painter gridParameters:gridPara.
- painter gridShown: (settings at: #GridShown ifAbsent: [false]).
- painter gridAlign: (settings at: #GridAlign ifAbsent: [false]).
- painter clear.
-
+ "take care for those who do close very quickly after launching"
+ Object errorSignal handle: [:ex|] do:
+ [
+ treeView selection: (Array with: 1).
+
+ painter := self painter.
+ settings := self class settings.
+ gridPara := painter gridParameters copy.
+ hspace := settings at: #HGridSpace ifAbsent: [10].
+ vspace := settings at: #VGridSpace ifAbsent: [10].
+ gridPara at:1 put:hspace; at:2 put:vspace; at:5 put:hspace; at:6 put:vspace.
+ painter gridParameters:gridPara.
+ painter gridShown: (settings at: #GridShown ifAbsent: [false]).
+ painter gridAlign: (settings at: #GridAlign ifAbsent: [false]).
+ painter clear.
+ ]
! !
!UIPainter methodsFor:'user actions'!
+accept
+ "accepts all modifications done to the attributes of the current section"
+
+ |painter layout spec prop key layoutTool|
+
+ painter := self painter.
+
+ self isLayoutToolSelected ifTrue:[
+ layoutTool := self layoutTool.
+
+ (layout := layoutTool layout) notNil ifTrue:[
+ layoutTool layoutType == #Extent ifTrue:[
+ layoutTool layoutView == painter topView ifTrue:[
+ layoutTool layoutView extent:layout
+ ] ifFalse:[
+ painter setExtent:layout
+ ]
+ ] ifFalse:[
+ painter setLayout:layout
+ ]
+ ]
+ ] ifFalse:[
+ spec := self specTool specification.
+
+ self isHelpToolSelected ifTrue:[
+ self helpTool accept.
+ key := self helpTool helpKey.
+ prop := treeView propertySelected.
+
+ prop notNil ifTrue:[
+ prop spec activeHelpKey:key
+ ].
+ spec activeHelpKey:key.
+ ] ifFalse:[
+ painter updateFromSpec:spec.
+ ]
+ ].
+ self modifiedChannel value:false.
+ modified := true.
+!
+
+addWidget: aSpecClass
+ "adds a widget from aSpecClass to the current widget"
+
+ self addWidgetOfSpec: (Array with: (Smalltalk at: aSpecClass) new)
+
+!
+
+addWidgetOfSpec: aSpec
+ "adds a widget from aSpec to the current widget"
+
+ |newSel|
+ (newSel := self pasteSpecifications:aSpec keepLayout:false at:0@0) notNil
+ ifTrue:
+ [
+ self select: newSel
+ ]
+ ifFalse:
+ [
+ ((treeView selection size = 0) or: [treeView selectedNode isNil])
+ ifTrue:
+ [
+ treeView selection: #(1).
+ ]
+ ifFalse:
+ [
+ treeView selectNode: (treeView detectNode: [:n| n = treeView selectedNode parent])
+ ].
+ self addWidgetOfSpec: aSpec
+ ]
+
+!
+
+cancel
+ "cancels all modifications done to the attributes of the current section;
+ reread the old attributes"
+
+ |spec key view|
+
+ self isModified ifTrue:[
+ (spec := self painter specForSelection) notNil ifTrue:[
+ key := spec activeHelpKey.
+ ].
+ self helpTool helpKey:key.
+
+ treeView isCanvasSelected ifTrue: [
+ spec := treeView canvasSpec.
+ ].
+ self specTool specification:spec.
+ view := self layoutTool layoutView.
+
+ self setViewInLayoutTool:view.
+ spec class == DataSetSpec ifTrue:[
+ view columnDescriptors:(spec columns)
+ ].
+ self modifiedChannel value:false.
+ modified := false
+ ]
+!
+
doBrowseAspectMethods
- "open a browser on the aspect methods"
-
- |cls methods|
+ "opens a browser on the aspect methods"
+
+ |methods|
self painter isModified ifTrue:[
self warn:'The current window spec has not yet been saved!!\\The System Browser may show the code of the old aspect methods.' withCRs.
].
- cls := self resolveName:specClass.
-
- cls notNil ifTrue:[
- methods := self painter aspectMethods.
- methods isEmpty ifTrue:[
- self warn:'No aspect methods have been saved yet!!'.
- ^ self.
- ].
- SystemBrowser browseMethods:methods title:'Aspect methods'.
- ] ifFalse:[
- self information:'No class defined!!'.
+
+ (methods := self painter aspectMethods) isEmpty ifTrue:[
+ self warn:'No aspect methods found!!'.
+ ^ self.
].
-
- "Created: / 25.10.1997 / 19:07:55 / cg"
+ SystemBrowser browseMethods:methods title:'Aspect methods'.
+
!
doBrowseClass
- "open a System Browser on the class"
-
- |cls|
+ "opens a System Browser on the specClass"
self painter isModified ifTrue:[
self warn:'The current window spec has not yet been saved!!\\The System Browser will show the code of the old window spec.' withCRs.
].
- cls := self resolveName:specClass.
-
- cls notNil ifTrue:[
- SystemBrowser openInClass:cls
- ] ifFalse:[
- self information:'No class defined!!'.
- ].
-
-!
-
-doChooseTreeViewFont
-
- |font|
- (font := FontPanel
- fontFromUserInitial: treeView class defaultFont
- title: 'Choose Tree View Font') notNil
- ifTrue:
- [
- treeView class defaultFont: (font on: device).
- treeView font: treeView class defaultFont
- ]
+
+ SystemBrowser openInClass:(self resolveName:specClass)
+
!
doDefineClassAndSelector
- "launch a dialog to define class, superclass, and selector"
+ "launches a dialog for defining class, superclass, and selector of the application"
|again tmp helpDict helpKey|
@@ -3251,11 +2854,13 @@
self helpTool helpKey: helpKey.
self modifiedChannel value: false.
self helpTool modified: true.
+
+ self updateInfoLabel
!
doDefineGrid
- "open a dialog for grip parameters configuration
- "
+ "opens a dialog for the grid parameters"
+
|hspace vspace bindings painter gridPara settings|
painter := self painter.
@@ -3294,55 +2899,55 @@
!
doGenerateAspectMethods
- "generate aspect and action methods
- "
- |code|
-
- self treeSelection. "accept modifications"
-
- self hasSpecClassAndSelector ifFalse:[
- self doDefineClassAndSelector
- ].
-
- self checkClassAndSelector ifFalse:[
- ^ self
- ].
-
- self painter className:specClass
- superclassName:specSuperclass
- selector:specSelector.
-
- code := self painter generateAspectMethods.
- (ReadStream on:code) fileIn.
+ "generates aspect and action methods for the application class"
+
+ self askForSectionModification.
+
+ (ReadStream on:self painter generateAspectMethods) fileIn.
!
doGenerateHookMethods
- "generate hook methods for the application class
- "
- |code|
-
- self treeSelection. "accept modifications"
-
- self hasSpecClassAndSelector ifFalse:[
- self doDefineClassAndSelector
+ "generates hook methods for the application class"
+
+ self askForSectionModification.
+
+ (ReadStream on:self painter generateHookMethods) fileIn.
+
+!
+
+doInspectSpec
+ "opens an inspector on the spec of the selected widget"
+
+ |spec|
+
+ (spec := self specForSelection) isNil ifTrue:[
+ treeView isCanvasSelected ifTrue:[
+ spec := treeView canvasSpec.
+ ]
].
-
- self checkClassAndSelector ifFalse:[
- ^ self
- ].
-
- self painter className:specClass
- superclassName:specSuperclass
- selector:specSelector.
-
- code := self painter generateHookMethods.
- (ReadStream on:code) fileIn.
-
- "Created: / 31.10.1997 / 17:37:54 / cg"
+ spec notNil ifTrue:[
+ spec inspect
+ ]
+
+
+!
+
+doInspectView
+ "opens an inspector on the view of the selected widget"
+
+ |selection|
+
+ ((selection := self painter selection) isCollection and: [selection size >= 1]) ifTrue:[
+ selection first inspect
+ ] ifFalse: [
+ selection inspect
+ ]
+
!
doLoad
+ "opens a ResourceSelectionBrowser for loading a window spec from a class"
self askForModification ifFalse: [^nil].
@@ -3356,10 +2961,11 @@
!
doLoadSubspec
+ "opens a ResourceSelectionBrowser for loading a sub spec from a class"
|subSpecMessage|
- self treeSelection. "ask for modification"
+ self askForSectionModification.
(subSpecMessage := ResourceSelectionBrowser
request: 'Load Subspec From Class'
@@ -3386,8 +2992,7 @@
!
doNew
- "remove all components and associated resources
- "
+ "removes all widgets, specClass, and specSelector"
self askForModification ifFalse: [^nil].
specClass := specSelector := nil.
@@ -3396,32 +3001,39 @@
treeView canvas topView label: UIPainter defaultNameOfCanvas.
self helpTool doNew.
treeView selection:#(1).
- self treeSelection.
self updateInfoLabel.
!
+doOpenWidgetDocumentation
+ "opens documentation for the selected widget"
+
+ |spec document|
+
+ (spec := self specForSelection) isNil ifTrue:[
+ treeView isCanvasSelected ifTrue:[
+ spec := nil
+ ]
+ ].
+ spec notNil ifTrue:[
+ document := 'tools/uipainter/', spec userFriendlyName,'.html'
+ ] ifFalse: [
+ document := 'tools/uipainter/TOP.html#THEWIDGETSANDHOWDOTHEYWORK'
+ ].
+ HTMLDocumentView openFullOnDocumentationFile: document
+
+
+!
+
doPickAView
- "pick a view and setup specifications
- "
- |painter view cls spec app|
+ "changes the cursor for picking a view and builds a window spec from it"
+
+ |view|
self askForModification ifFalse: [^nil].
(view := Screen current viewFromUser) notNil ifTrue:[
view == Screen current rootView ifFalse:[
- painter := self painter.
- spec := UISpecification fromView:view topView.
-
- "/ ok, got it
-
- " (app := view application) notNil ifTrue:[
- cls := app class
- ] ifFalse:[
- cls := view class
- ].
- self setClass:cls selector:nil.
- "
- painter setupFromSpec:spec.
+ self painter setupFromSpec:(UISpecification fromView:view topView).
]
].
@@ -3430,14 +3042,14 @@
!
doSave
- "install window spec
- "
+ "saves the window spec"
+
|code painter|
- self treeSelection. "ask for modification"
+ self askForSectionModification.
self hasSpecClassAndSelector ifFalse:[
- (self doDefineClassAndSelector) isNil ifTrue: [^nil]
+ self doDefineClassAndSelector isNil ifTrue: [^nil]
].
(specClass notNil and: [(Smalltalk at: specClass asSymbol) isClass])
@@ -3446,16 +3058,6 @@
^nil
].
- self isModified ifTrue:[
- (self confirm:'Accept modifications in section ' , tabSelection printString , '?') ifTrue:[
- self accept
- ] ifFalse:[
- (self confirm:'Load old window spec?') ifFalse:[
- ^ self
- ]
- ]
- ].
-
painter := self painter.
painter className:specClass
@@ -3482,11 +3084,11 @@
!
doSaveAs
- "launch a dialog to define class, superclass and method"
+ "opens a ResourceSelectionBrowser for saving the window spec on a class"
|resourceMessage|
- self treeSelection. "ask for modification"
+ self askForSectionModification.
(resourceMessage := ResourceSelectionBrowser
request: 'Save Window Spec In Class'
@@ -3509,101 +3111,64 @@
!
doStartApplication
- "start current edited application
- "
- |cls app infoMessage|
-
- self treeSelection. "accept modifications"
-
- (specClass isNil or:[specSelector size < 2]) ifTrue:[
- self painter isModified ifTrue:[
- infoMessage := 'Class and selector must be defined,\and the window spec must be saved first!!' withCRs.
- ] ifFalse:[
- infoMessage := 'No class and selector defined!!'.
- ]
- ] ifFalse:[
- cls := self resolveName:specClass.
-
- cls isNil ifTrue:[
- infoMessage := 'Class does not exist!!'.
- ] ifFalse:[
- (cls respondsTo:specSelector) ifFalse:[
- infoMessage := ('No method for: #'
- , specSelector , ' in ' , cls name
- , '\\(did you save the window spec?)') withCRs.
- ]
+ "starts the application on the editing window spec"
+
+ |application|
+
+ self hasSpecClassAndSelector ifFalse:[
+ self doSave isNil ifTrue: [^nil].
+ ] ifTrue: [
+ self askForSectionModification.
+ (modified or: [self painter isModified or: [self helpTool modified]])
+ ifTrue:
+ [
+ ((YesNoBox title:'Window Spec was modified!!')
+ noText:'Cancel';
+ yesText:'Save it and start';
+ showAtPointer;
+ accepted) ifFalse: [^nil].
+ self doSave isNil ifTrue: [^nil]
]
].
- infoMessage notNil ifTrue:[
- ^ self information:infoMessage
- ].
-
- self isModified ifTrue:[
- (self confirm:'Accept modifications in section ' , tabSelection printString asBoldText, '?') ifTrue:[
- self accept.
- "/ "XXX must be fixed - canvas changes are not recorded in the history
- "/ so isModified returns false here
- "/
- "/ self painter isModified ifTrue:[
- "/
- (self confirm:'Save the new window spec?' withCRs) ifTrue:[
- self doSave
- ]
- ]
- ].
-
- self painter isModified ifTrue:[
- (self confirm:'The current window spec has not yet been saved!!\\Start anyway (based upon the previous window spec)?' withCRs) ifFalse:[
- ^ self
- ]
- ].
-
- ((app := cls new) respondsTo:#openInterface:) ifFalse:[
+ ((application := (self resolveName:specClass) new) respondsTo:#openInterface:) ifFalse:[
^ self warn:('The application does not respond to the ''openInterface:'' message.\\(maybe its supposed to be used as subApplication/subCanvas)') withCRs.
].
- app openInterface:specSelector
+ application openInterface:specSelector
!
doStepDown
- "move selected component after the next component in the hierarchy of
- its container widget
- "
+ "moves the selected widget one step down in the hierarchy"
+
treeView doStepOver:1
!
doStepIn
- "change the container of the selected widget
- "
+ "moves the selected widget into the next widget as child"
+
treeView doStepIn
!
doStepOut
- "change the container of the selected widget
- "
+ "moves the selected widget out of the parent widget"
+
treeView doStepOut
!
doStepUp
- "move selected component before the previous component in the hierarchy of
- its container widget
- "
+ "moves the selected widget one step up in the hierarchy"
+
treeView doStepOver:-1
!
doWindowSpec
- "create the window specification but do not write to application; instead
- open a view
- "
- |code v|
-
- self treeSelection. "accept modifications"
-
- code := self painter generateWindowSpecMethodSource.
-
- v := CodeView open.
- v contents:code.
- v label:'windowSpec'.
+ "opens a code view with the contents of the window spec"
+
+ self askForSectionModification.
+
+ CodeView
+ openWith: self painter generateWindowSpecMethodSource
+ title: 'Window Spec'
! !
@@ -3629,16 +3194,16 @@
!UIPainter::TreeView methodsFor:'accessing'!
canvas
- "returns the canvas( UIPainter )
- "
- ^ model root contents view
+ "returns the canvas (UIPainterView)"
+
+ ^ model root contents view
!
canvas:aCanvas
- "install canvas( UIPainter )
- "
+ "install canvas (UIPainterView)"
+
|props|
props := UIPainterView::ViewProperty new.
@@ -3650,8 +3215,8 @@
!
canvasSpec
- "returns spec assigned to canvas
- "
+ "returns spec assigned to canvas"
+
|spec|
spec := WindowSpec new.
@@ -3662,12 +3227,11 @@
].
^ spec
- "Modified: / 29.10.1997 / 18:06:44 / cg"
!
canvasSpec:aSpec
- "update canvas from spec
- "
+ "update canvas from spec"
+
|spec|
self setAttributesFromWindowSpec:aSpec.
@@ -3679,22 +3243,22 @@
!
itemOfView:aView
- "returns item assigned to view or nil
- "
+ "returns item assigned to view or nil"
+
aView notNil ifTrue:[
self allItemsDo:[:anItem|
(anItem contents view == aView) ifTrue:[^ anItem]
]
].
- ^ nil
+ ^ nil
!
lastDrawnMaster
- "returns the lastDrawnMaster
- "
- ^ lastDrawnMaster
+ "returns the lastDrawnMaster"
+
+ ^ lastDrawnMaster
! !
@@ -3702,27 +3266,27 @@
!UIPainter::TreeView methodsFor:'accessing property'!
propertiesDo:aOneArgBlock
- "evaluate the argument a block on each property
- "
+ "evaluates the argument a block on each property"
+
self allItemsDo:[:anItem| aOneArgBlock value:(anItem contents)]
!
propertyDetect:aOneArgBlock
- "evaluate the block on each property
- "
+ "evaluates the block on each property"
+
self allItemsDo:[:anItem|
(aOneArgBlock value:(anItem contents)) ifTrue:[^ anItem contents]
].
- ^ nil
+ ^ nil
!
propertySelected
"returns current selected property or nil in case of multi selection
- or empty selection
- "
+ or empty selection "
+
|idx|
selection size == 1 ifTrue:[
@@ -3730,15 +3294,15 @@
^ (listOfNodes at:idx) contents
]
].
- ^ nil
+ ^ nil
! !
!UIPainter::TreeView methodsFor:'adding & removing'!
addProperty:aProperty
- "add a new item
- "
+ "adds a new item"
+
|parent|
parent := self detectItemRespondsToView:(aProperty view superView).
@@ -3750,8 +3314,8 @@
!
removeAll
- "remove all items other than canvas
- "
+ "removes all items other than canvas"
+
lastDrawnMaster := nil.
windowSpec := nil.
@@ -3765,8 +3329,8 @@
!
removeView:aView
- "remove a view
- "
+ "removes a view"
+
|item prnt|
((item := self itemOfView:aView) notNil and:[(prnt := item parent) notNil]) ifTrue:[
@@ -3781,8 +3345,8 @@
!UIPainter::TreeView methodsFor:'building'!
generateFullSpecForComponents:aSpecArray
- "generates a full spec for components
- "
+ "generates a full spec from aSpecArray"
+
|fullSpec winSpec|
fullSpec := FullSpec new.
@@ -3797,16 +3361,14 @@
].
^ fullSpec literalArrayEncoding.
- "Modified: / 29.10.1997 / 18:05:58 / cg"
!
setAttributesFromWindowSpec:aWindowSpec
- "set windowSpec from argument a WindowSpec
- "
+ "sets a window spec from aWindowSpec"
+
windowSpec := WindowSpec new copyValuesFromSpec:aWindowSpec.
self canvasNameChanged:aWindowSpec name.
- "Modified: / 29.10.1997 / 18:06:56 / cg"
! !
!UIPainter::TreeView methodsFor:'canvas selection'!
@@ -3976,22 +3538,22 @@
!UIPainter::TreeView methodsFor:'drag & drop'!
canDrop:anObjectOrCollection
- "can drop ? delegate to canvas
- "
- ^ self canvas canDrop:anObjectOrCollection
+ "can drop ? delegate to canvas"
+
+ ^ self canvas canDrop:anObjectOrCollection
!
drop:anObjectOrCollection at:aPoint
- "drop objects ? delegate to canvas
- "
+ "drop objects ? delegate to canvas"
+
self canvas drop:anObjectOrCollection at:aPoint
! !
!UIPainter::TreeView methodsFor:'enumerating'!
allItemsDo:aOneArgBlock
- "evaluate the argument a block on each item other than the canvas
- "
+ "evaluates the argument a block on each item other than the canvas"
+
model root allChildrenDo:aOneArgBlock
@@ -4000,9 +3562,9 @@
!UIPainter::TreeView methodsFor:'event processing'!
cvsEventsDisabledDo:aBlock
- "evaluate the block without raising selection changed notifications
- to canvas
- "
+ "evaluates the block without raising selection changed notifications
+ to canvas"
+
|restoreCvsEvents|
restoreCvsEvents := cvsEventsDisabled.
@@ -4014,9 +3576,9 @@
!
cvsSetupListDo:aBlock
- "evaluate block without handling notifications from model; after evaluation
- the new list will be recomputed
- "
+ "evaluates block without handling notifications from model; after evaluation
+ the new list will be recomputed"
+
model removeDependent:self.
self cvsEventsDisabledDo:[
@@ -4029,8 +3591,8 @@
!
doubleClicked
- "disable collapse of canvas item
- "
+ "disables collapsing of the root item"
+
self selectedNode == model root ifFalse:[
super doubleClicked
]
@@ -4041,8 +3603,8 @@
!UIPainter::TreeView methodsFor:'initialization'!
initialize
- "initialization; set multiple select and model
- "
+ "initialize the tree view; multiple select and tree item actions"
+
super initialize.
self multipleSelectOk:true.
@@ -4084,6 +3646,8 @@
!UIPainter::TreeView methodsFor:'private'!
nameForSpecInList:aSpec
+ "returns the tree item label for aSpec"
+
^ aSpec name asBoldText, ': [', aSpec viewClass name , ']'
!
@@ -4123,9 +3687,7 @@
canChangeOrderInContainer
"returns true if any selection exists and all widgets in the selection
- can change their layout through to a move or align operation.
- "
- |canvas|
+ can change their layout through to a move or align operation"
((selection size ~~ 1) or: [(selection at: 1) == 1]) ifTrue:[
^ false
@@ -4135,19 +3697,16 @@
canMoveOrAlignSelection
"returns true if any selection exists and all widgets in the selection
- can change their layout through to a move or align operation.
- "
- |canvas|
+ can change their layout through to a move or align operation"
selection size == 0 ifTrue:[
^ false
].
- canvas := self canvas.
selection do:[:i|
i == 1 ifTrue:[^ false].
- (canvas canChangeLayoutOfView:((listOfNodes at:i) contents view)) ifFalse:[
+ (self canvas canChangeLayoutOfView:((listOfNodes at:i) contents view)) ifFalse:[
^ false
]
].
@@ -4155,9 +3714,9 @@
!
canMoveSelectionIntoContainer
- "returns true in case that one component is selected and can change its container
- widget to the next element in the list which will have the same container.
- "
+ "returns true in case that one widget is selected and can change its container
+ widget to the next element in the list which will have the same container"
+
|item prnt|
( (item := self selectedNode) isNil
@@ -4167,13 +3726,13 @@
) ifTrue:[
^ false
].
- ^ true
+ ^ true
!
canMoveSelectionOutOfContainer
- "returns true in case that one component is selected which is contained within
- another component.
- "
+ "returns true in case that one widget is selected which is contained within
+ another widget"
+
|item prnt|
( (item := self selectedNode) isNil
@@ -4182,43 +3741,43 @@
) ifTrue:[
^ false
].
- ^ true
+ ^ true
!
canResizeSelectedWidget
"returns true in case of one widget selected and is contained
- within a widget which allows to resize sub components
- "
- |n|
-
- (n := self selectedNode) notNil ifTrue:[
- (n := n parent) notNil ifTrue:[
- ^ (n parent isNil or:[n contents spec class canResizeSubComponents])
+ within a widget which allows to resize sub components"
+
+ |selectedNode|
+
+ (selectedNode := self selectedNode) notNil ifTrue:[
+ (selectedNode := selectedNode parent) notNil ifTrue:[
+ ^ (selectedNode parent isNil or:[selectedNode contents spec class canResizeSubComponents])
]
].
^ false
!
hasOneSelectionOtherThanCanvas
- "returns true in case that one selection exists other than the canvas
- "
- ^ (selection size == 1 and:[selection first ~~ 1])
+ "returns true in case that one selection exists other than the canvas"
+
+ ^ selection size == 1 and:[selection first ~~ 1]
!
isCanvasSelected
"returns true in case of a single selection and the
- selection is the canvas (index 1)
- "
- ^ (selection size == 1 and:[self isInSelection:1])
+ selection is the canvas (index 1)"
+
+ ^ selection size == 1 and:[self isInSelection:1]
! !
-!UIPainter::TreeView methodsFor:'seraching'!
+!UIPainter::TreeView methodsFor:'searching'!
detectItemRespondsToView:aView
- "detect the item responding to the view. The item of the view or the first
+ "detects the item responding to the view. The item of the view or the first
subview providing the item is returned. If no property is detected nil is
- returned
- "
+ returned"
+
|view item|
(view := aView) notNil ifTrue:[
@@ -4266,8 +3825,8 @@
!
doStepOver:anIndex
- "move child 'anOffset' forward or backward in list of children
- "
+ "moves child 'anOffset' forward or backward in list of children"
+
|item idx size prnt spVw view canvas|
( (item := self selectedNode) isNil