--- a/UIPainterView.st Wed Apr 07 17:56:31 2004 +0200
+++ b/UIPainterView.st Wed Apr 07 21:41:52 2004 +0200
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1995 by Claus Gittinger / eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -32,7 +32,7 @@
copyright
"
COPYRIGHT (c) 1995 by Claus Gittinger / eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -49,12 +49,12 @@
new application derives from.
[see also:]
- UIBuilder
- UIObjectView
+ UIBuilder
+ UIObjectView
[author:]
- Claus Gittinger
- Claus Atzkern
+ Claus Gittinger
+ Claus Atzkern
"
! !
@@ -110,7 +110,7 @@
!UIPainterView class methodsFor:'defaults'!
-defaultMenuMessage
+defaultMenuMessage
"This message is the default yo be sent to the menuHolder to get a menu
"
^ #showMiddleButtonMenu
@@ -161,38 +161,38 @@
|prop coll s n newSel|
(aStringOrCollection size == 0) ifTrue:[
- newSel := nil.
+ newSel := nil.
] ifFalse:[
- (s := aStringOrCollection) isString ifFalse:[
- s size == 1 ifTrue:[
- s := s first
- ] ifFalse:[
- coll := OrderedCollection new.
-
- s do:[:aName|
- (prop := self propertyOfName:aName) notNil ifTrue:[
- coll add:(prop view)
- ]
- ].
- (n := coll size) == 1 ifTrue:[
- newSel := coll at:1
- ] ifFalse:[
- n == 0 ifTrue:[
- newSel := nil
- ] ifFalse:[
- newSel := coll
- ]
- ].
- ^ self select:newSel.
- ]
- ].
-
- prop := self propertyOfName:s.
- prop isNil ifTrue:[
- newSel := nil
- ] ifFalse:[
- newSel := prop view
- ].
+ (s := aStringOrCollection) isString ifFalse:[
+ s size == 1 ifTrue:[
+ s := s first
+ ] ifFalse:[
+ coll := OrderedCollection new.
+
+ s do:[:aName|
+ (prop := self propertyOfName:aName) notNil ifTrue:[
+ coll add:(prop view)
+ ]
+ ].
+ (n := coll size) == 1 ifTrue:[
+ newSel := coll at:1
+ ] ifFalse:[
+ n == 0 ifTrue:[
+ newSel := nil
+ ] ifFalse:[
+ newSel := coll
+ ]
+ ].
+ ^ self select:newSel.
+ ]
+ ].
+
+ prop := self propertyOfName:s.
+ prop isNil ifTrue:[
+ newSel := nil
+ ] ifFalse:[
+ newSel := prop view
+ ].
].
^ self select:newSel
@@ -202,7 +202,7 @@
layoutChanged
treeView notNil ifTrue:[
- treeView layoutChanged
+ treeView layoutChanged
]
! !
@@ -214,8 +214,8 @@
container := someComponents first container.
[container notNil
and:[ (someComponents conform:[:eachComponent | eachComponent isComponentOf:container]) not]]
- whileTrue:[
- container := container container.
+ whileTrue:[
+ container := container container.
].
^ container
!
@@ -231,8 +231,8 @@
coll notNil ifTrue:[
"/ self select:nil.
- specs := coll collect:[:aView| self fullSpecFor:aView ].
- self setSelection:specs.
+ specs := coll collect:[:aView| self fullSpecFor:aView ].
+ self setSelection:specs.
"/ treeView selection: sel
].
@@ -256,49 +256,49 @@
coll := self minSetOfSuperViews:(self selection).
coll notNil ifTrue:[
- treeView cvsEventsDisabledDo:[
- treeModel := treeView model.
- oldSelection := treeModel selectedNodes at:1 ifAbsent: nil.
-
- oldSelection notNil ifTrue:[
- children := oldSelection parent children.
- (size := children size) > 1 ifTrue:[
- index := children identityIndexOf:oldSelection.
- size == index ifTrue:[
- index := index - 1
- ].
- newSelection := children at:index ifAbsent:1.
- ] ifFalse:[
- newSelection := oldSelection parent
- ].
- newSelection := treeModel indexOf:newSelection.
- ] ifFalse:[
- newSelection := 1
- ].
-
- self hideSelection.
- selection := nil.
- specs := coll collect:[:aView| self fullSpecFor:aView ].
-
- self withinTransaction:#cut objects:coll do:[
- coll reverseDo:[:aView|
- self createUndoRemove:aView.
- self remove:aView.
- ]
- ].
- buffered ifTrue: [self setSelection:specs].
- treeView selection:nil.
- treeView selection:(Array with: newSelection).
- (nd := treeView selectedNode) notNil ifTrue:[
- self setSelection:nd contents view withRedraw:true.
- ]
- ]
+ treeView cvsEventsDisabledDo:[
+ treeModel := treeView model.
+ oldSelection := treeModel selectedNodes at:1 ifAbsent: nil.
+
+ oldSelection notNil ifTrue:[
+ children := oldSelection parent children.
+ (size := children size) > 1 ifTrue:[
+ index := children identityIndexOf:oldSelection.
+ size == index ifTrue:[
+ index := index - 1
+ ].
+ newSelection := children at:index ifAbsent:1.
+ ] ifFalse:[
+ newSelection := oldSelection parent
+ ].
+ newSelection := treeModel indexOf:newSelection.
+ ] ifFalse:[
+ newSelection := 1
+ ].
+
+ self hideSelection.
+ selection := nil.
+ specs := coll collect:[:aView| self fullSpecFor:aView ].
+
+ self withinTransaction:#cut objects:coll do:[
+ coll reverseDo:[:aView|
+ self createUndoRemove:aView.
+ self remove:aView.
+ ]
+ ].
+ buffered ifTrue: [self setSelection:specs].
+ treeView selection:nil.
+ treeView selection:(Array with: newSelection).
+ (nd := treeView selectedNode) notNil ifTrue:[
+ self setSelection:nd contents view withRedraw:true.
+ ]
+ ]
]
!
deleteTotalSelection
"delete the selection
- "
+ "
self deleteSelectionBuffered: false
!
@@ -326,7 +326,7 @@
sel := self pasteSpecifications:(self getSelection) keepLayout:false.
sel notNil ifTrue:[
- self select:sel.
+ self select:sel.
].
!
@@ -338,20 +338,20 @@
!
pasteKeepingPosition
- "add the objects in the paste-buffer to the object view;
+ "add the objects in the paste-buffer to the object view;
translate the layout as appropriate, to position the component
at the same absolute position (relative to topView) as before
"
|sel|
sel := self
- pasteSpecifications:(self getSelection)
- keepLayout:true
- keepPosition:true
- at:nil.
+ pasteSpecifications:(self getSelection)
+ keepLayout:true
+ keepPosition:true
+ at:nil.
sel notNil ifTrue:[
- self select:sel.
+ self select:sel.
].
!
@@ -360,9 +360,9 @@
"
^ self
- pasteSpecifications:aSpecificationOrList
- keepLayout:keepLayout
- at:nil
+ pasteSpecifications:aSpecificationOrList
+ keepLayout:keepLayout
+ at:nil
"Modified: 11.8.1997 / 01:00:35 / cg"
!
@@ -370,11 +370,11 @@
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil
"add the specs to the object view; returns list of pasted components
"
- ^ self
- pasteSpecifications:aSpecificationOrList
- keepLayout:keepLayout
- keepPosition:false
- at:aPointOrNil
+ ^ self
+ pasteSpecifications:aSpecificationOrList
+ keepLayout:keepLayout
+ keepPosition:false
+ at:aPointOrNil
!
@@ -387,36 +387,36 @@
containerToPasteInto := self singleSelection.
containerToPasteInto isNil ifTrue:[
- self selection size > 0 ifTrue:[
- containerToPasteInto := self commonContainerOf:self selection
- ] ifFalse:[
- containerToPasteInto := self
- ].
- self selection:containerToPasteInto.
+ self selection size > 0 ifTrue:[
+ containerToPasteInto := self commonContainerOf:self selection
+ ] ifFalse:[
+ containerToPasteInto := self
+ ].
+ self selection:containerToPasteInto.
].
(self canPasteInto:containerToPasteInto) ifFalse:[
- containerToPasteInto notNil ifTrue:[
- "/ search up parent list for something we can paste into
- [containerToPasteInto notNil and:[(self canPasteInto:containerToPasteInto) not]] whileTrue:[
- containerToPasteInto := containerToPasteInto container.
- ].
- self selection:containerToPasteInto.
- ].
+ containerToPasteInto notNil ifTrue:[
+ "/ search up parent list for something we can paste into
+ [containerToPasteInto notNil and:[(self canPasteInto:containerToPasteInto) not]] whileTrue:[
+ containerToPasteInto := containerToPasteInto container.
+ ].
+ self selection:containerToPasteInto.
+ ].
].
containerToPasteInto isNil ifTrue:[
- containerToPasteInto := self
+ containerToPasteInto := self
].
(self canPaste:aSpecificationOrList) ifFalse:[
- Dialog warn:'Cannot paste into selected component (not a container ?)'.
- ^ nil
+ Dialog warn:'Cannot paste into selected component (not a container ?)'.
+ ^ nil
].
aSpecificationOrList isCollection ifTrue:[
- paste := aSpecificationOrList
+ paste := aSpecificationOrList
] ifFalse:[
- paste := Array with:aSpecificationOrList
+ paste := Array with:aSpecificationOrList
].
self setSelection:nil.
@@ -424,57 +424,57 @@
builder := UIBuilder new isEditing:true.
className notNil ifTrue:[
- builder applicationClass:(self resolveName:className)
+ builder applicationClass:(self resolveName:className)
].
(keepLayout not or:[keepPosition]) ifTrue:[
- pasteOffset := 0@0.
-
- keepPosition ifTrue:[
- pasteOrigin := device translatePoint:0@0
- fromView:self
- toView:containerToPasteInto.
- ] ifFalse:[
- aPointOrNil isNil ifTrue:[
- pasteOrigin := self sensor mousePoint.
- pasteOrigin := device translatePoint:pasteOrigin
- fromView:nil
- toView:containerToPasteInto.
- ] ifFalse:[
- pasteOrigin := device translatePoint:aPointOrNil
- fromView:self
- toView:containerToPasteInto.
- ]
- ].
-
- bounds := Rectangle origin:0@0 extent:(containerToPasteInto bounds extent)
+ pasteOffset := 0@0.
+
+ keepPosition ifTrue:[
+ pasteOrigin := device translatePoint:0@0
+ fromView:self
+ toView:containerToPasteInto.
+ ] ifFalse:[
+ aPointOrNil isNil ifTrue:[
+ pasteOrigin := self sensor mousePoint.
+ pasteOrigin := device translatePoint:pasteOrigin
+ fromView:nil
+ toView:containerToPasteInto.
+ ] ifFalse:[
+ pasteOrigin := device translatePoint:aPointOrNil
+ fromView:self
+ toView:containerToPasteInto.
+ ]
+ ].
+
+ bounds := Rectangle origin:0@0 extent:(containerToPasteInto bounds extent)
].
paste do:[:aSpec|
- |view newOrigin|
-
- view := self addSpec:aSpec builder:builder in:containerToPasteInto.
-
- keepPosition ifTrue:[
- self moveObject:view to:(view origin + pasteOrigin).
- ] ifFalse:[
- keepLayout ifFalse:[
- (bounds containsPoint:pasteOrigin) ifFalse:[
- newOrigin := pasteOffset.
- ] ifTrue:[
- newOrigin := pasteOrigin + pasteOffset.
- ].
- self moveObject:view to:newOrigin.
- pasteOffset := pasteOffset + 4
- ].
- ].
- view realize.
- newSel add:view.
+ |view newOrigin|
+
+ view := self addSpec:aSpec builder:builder in:containerToPasteInto.
+
+ keepPosition ifTrue:[
+ self moveObject:view to:(view origin + pasteOrigin).
+ ] ifFalse:[
+ keepLayout ifFalse:[
+ (bounds containsPoint:pasteOrigin) ifFalse:[
+ newOrigin := pasteOffset.
+ ] ifTrue:[
+ newOrigin := pasteOrigin + pasteOffset.
+ ].
+ self moveObject:view to:newOrigin.
+ pasteOffset := pasteOffset + 4
+ ].
+ ].
+ view realize.
+ newSel add:view.
].
self withinTransaction:#paste objects:newSel do:[
- undoHistory addUndoSelector:#undoCreate:
- withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier])
+ undoHistory addUndoSelector:#undoCreate:
+ withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier])
].
self realizeAllSubViews.
@@ -496,7 +496,7 @@
sel := self pasteSpecifications:(self getSelection) keepLayout:true.
sel notNil ifTrue:[
- self select:sel.
+ self select:sel.
].
! !
@@ -504,7 +504,7 @@
canDrop:something
"returns true if something can be droped
- "
+ "
(something size == 1 and:[self enabled and:[self numberOfSelections <= 1]]) ifTrue:[
^ something first theObject isKindOf:UISpecification
].
@@ -524,17 +524,17 @@
|el size|
((size := self numberOfSelections) <= 1 and:[self enabled]) ifFalse:[
- ^ false
+ ^ false
].
something isCollection ifTrue:[something notEmpty ifTrue:[el := something first]]
- ifFalse:[el := something].
+ ifFalse:[el := something].
(el isKindOf:UISpecification) ifFalse:[
- ^ false
+ ^ false
].
size == 1 ifTrue:[
- ^ self canPasteInto:(self singleSelection)
+ ^ self canPasteInto:(self singleSelection)
].
^ true
!
@@ -545,9 +545,9 @@
|prop|
aView notNil ifTrue:[
- (prop := self propertyRespondsToView:aView) notNil ifTrue:[
- ^ prop spec class supportsSubComponents
- ].
+ (prop := self propertyRespondsToView:aView) notNil ifTrue:[
+ ^ prop spec class supportsSubComponents
+ ].
^ aView specClass supportsSubComponents.
].
^ false
@@ -559,25 +559,25 @@
doit := true.
self selection notNil ifTrue:[
- oldSel := self singleSelection.
-
- "/ search selections hierarchy for a widget into which we can paste
- widg := oldSel.
- [widg isNil or:[self canPasteInto:widg]] whileFalse:[
- widg notNil ifTrue:[
- widg := widg container
- ].
- ].
-
- oldSel := nil.
- self setSelection:widg withRedraw:true.
+ oldSel := self singleSelection.
+
+ "/ search selections hierarchy for a widget into which we can paste
+ widg := oldSel.
+ [widg isNil or:[self canPasteInto:widg]] whileFalse:[
+ widg notNil ifTrue:[
+ widg := widg container
+ ].
+ ].
+
+ oldSel := nil.
+ self setSelection:widg withRedraw:true.
].
spec := (anObjectOrCollection at:1) theObject.
doit ifTrue:[
- dragOffset := DragAndDropManager dragOffsetQuerySignal query.
- newSel := self pasteSpecifications:spec keepLayout:false at:aPoint - dragOffset.
-
- self select:(oldSel ? newSel)
+ dragOffset := DragAndDropManager dragOffsetQuerySignal query.
+ newSel := self pasteSpecifications:spec keepLayout:false at:aPoint - dragOffset.
+
+ self select:(oldSel ? newSel)
].
"Modified: / 18.3.1999 / 18:29:43 / stefan"
@@ -604,7 +604,7 @@
sizeChanged:how
- super sizeChanged:how.
+ super sizeChanged:how.
self layoutChanged
! !
@@ -617,30 +617,30 @@
|cls methods|
className isNil ifTrue:[
- self warn:'No class defined !!'.
- ^ #()
+ self warn:'No class defined !!'.
+ ^ #()
].
cls := self resolveName:className.
methods := IdentitySet new.
self aspectSelectorsAndTypesDo:
- [:selector :typeSymbol |
- |skip|
-
- (cls includesSelector:selector) ifTrue:[
-
- skip := false.
- (typeSymbol == #modelAspect) ifTrue:[
- (cls isSubclassOf:SimpleDialog) ifTrue:[
- skip := SimpleDialog includesSelector:(selector asSymbol)
- ].
- ].
- skip ifFalse:[
- methods add:(cls compiledMethodAt:selector)
- ].
- ]
- ].
+ [:selector :typeSymbol |
+ |skip|
+
+ (cls includesSelector:selector) ifTrue:[
+
+ skip := false.
+ (typeSymbol == #modelAspect) ifTrue:[
+ (cls isSubclassOf:SimpleDialog) ifTrue:[
+ skip := SimpleDialog includesSelector:(selector asSymbol)
+ ].
+ ].
+ skip ifFalse:[
+ methods add:(cls compiledMethodAt:selector)
+ ].
+ ]
+ ].
^ methods
@@ -654,50 +654,50 @@
|cls selector protoSpec|
className isNil ifTrue:[
- self warn:'No class defined !!'.
- ^ self
+ self warn:'No class defined !!'.
+ ^ self
].
cls := self resolveName:className.
treeView propertiesDo:[:aProp|
- |selector|
-
- (selector := aProp model) notNil ifTrue:[
- selector isArray ifFalse:[
- aTwoArgBlock value:(selector asSymbol) value:#modelAspect
- ].
- ].
-
- (selector := aProp menu) notNil ifTrue:[
- selector isArray ifFalse:[
- aTwoArgBlock value:(selector asSymbol) value:#menu
- ].
- ].
-
- (aProp spec aspectSelectors) do:[:aSel |
- aSel isArray ifFalse:[
- aTwoArgBlock value:(aSel asSymbol) value:#channelAspect
- ].
- ].
- aProp spec actionSelectors do:[:aSel|
- aSel isArray ifFalse:[
- aTwoArgBlock value:(aSel asSymbol) value:#actionSelector
- ].
- ].
- aProp spec valueSelectors do:[:aSel|
- aSel isArray ifFalse:[
- aTwoArgBlock value:(aSel asSymbol) value:#valueSelector
- ].
- ]
+ |selector|
+
+ (selector := aProp model) notNil ifTrue:[
+ selector isArray ifFalse:[
+ aTwoArgBlock value:(selector asSymbol) value:#modelAspect
+ ].
+ ].
+
+ (selector := aProp menu) notNil ifTrue:[
+ selector isArray ifFalse:[
+ aTwoArgBlock value:(selector asSymbol) value:#menu
+ ].
+ ].
+
+ (aProp spec aspectSelectors) do:[:aSel |
+ aSel isArray ifFalse:[
+ aTwoArgBlock value:(aSel asSymbol) value:#channelAspect
+ ].
+ ].
+ aProp spec actionSelectors do:[:aSel|
+ aSel isArray ifFalse:[
+ aTwoArgBlock value:(aSel asSymbol) value:#actionSelector
+ ].
+ ].
+ aProp spec valueSelectors do:[:aSel|
+ aSel isArray ifFalse:[
+ aTwoArgBlock value:(aSel asSymbol) value:#valueSelector
+ ].
+ ]
].
protoSpec := treeView canvasSpec.
(selector := protoSpec menu) notNil ifTrue:[
- selector isArray ifFalse:[
- aTwoArgBlock value:(selector asSymbol) value:#menu
- ].
+ selector isArray ifFalse:[
+ aTwoArgBlock value:(selector asSymbol) value:#menu
+ ].
].
!
@@ -712,52 +712,52 @@
method := aspect.
numArgs == 1 ifTrue:[
- args := 'anArgument'.
- showIt := ''' , anArgument printString , '' ...''.\'.
- ] ifFalse:[
- args := ''.
- showIt := ' ...''.\'.
-
- numArgs ~~ 0 ifTrue:[
- method := ''.
-
- selector keywords keysAndValuesDo:[:i :key|
- method := method, key, 'arg', i printString, ' '
- ]
- ]
+ args := 'anArgument'.
+ showIt := ''' , anArgument printString , '' ...''.\'.
+ ] ifFalse:[
+ args := ''.
+ showIt := ' ...''.\'.
+
+ numArgs ~~ 0 ifTrue:[
+ method := ''.
+
+ selector keywords keysAndValuesDo:[:i :key|
+ method := method, key, 'arg', i printString, ' '
+ ]
+ ]
].
code := '!!' , targetClass name , ' methodsFor:''actions''!!\\' ,
- method , args , '\' ,
- ' "automatically generated by UIPainter ..."\\' ,
- ' "*** the code below performs no action"\' ,
- ' "*** (except for some feedback on the Transcript)"\' ,
- ' "*** Please change as required and accept in the browser."\' ,
- '\' .
+ method , args , '\' ,
+ ' "automatically generated by UIPainter ..."\\' ,
+ ' "*** the code below performs no action"\' ,
+ ' "*** (except for some feedback on the Transcript)"\' ,
+ ' "*** Please change as required and accept in the browser."\' ,
+ '\' .
alreadyInSuperclass ifTrue:[
- code := code ,
- ' "action for ' , aspect , ' is already provided in a superclass."\' ,
- ' "It may be redefined here ..."\\'.
+ code := code ,
+ ' "action for ' , aspect , ' is already provided in a superclass."\' ,
+ ' "It may be redefined here ..."\\'.
] ifFalse:[
- code := code ,
- ' "action to be added ..."\\'.
+ code := code ,
+ ' "action to be added ..."\\'.
].
code := code ,
- ' Transcript showCR:self class name, '': '.
+ ' Transcript showCR:self class name, '': '.
alreadyInSuperclass ifTrue:[
- code := code , 'inherited '.
+ code := code , 'inherited '.
].
code := code , 'action for ' , aspect , showIt.
alreadyInSuperclass ifTrue:[
- code := code ,
- ' super ' , aspect , args , '.\'.
+ code := code ,
+ ' super ' , aspect , args , '.\'.
].
code := code ,
- '!! !!\\'.
+ '!! !!\\'.
^ code withCRs
"Modified: / 25.10.1997 / 19:18:50 / cg"
@@ -781,125 +781,125 @@
cls := self targetClass.
cls isNil ifTrue:[
- ^ nil
+ ^ nil
].
codePieces := OrderedCollection new.
definedMethodSelectors := IdentitySet new.
treeView propertiesDo:[:aProp|
- |modelSelector|
-
- protoSpec := aProp spec.
-
- (modelSelector := aProp model) notNil ifTrue:[
- self generateCodeFrom:(Array with:modelSelector) in:cls
- do:[:aSel|
- (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
- skip := false.
-
- (cls isSubclassOf:SimpleDialog) ifTrue:[
- skip := SimpleDialog includesSelector:aSel
- ].
- (definedMethodSelectors includes:aSel) ifTrue:[
- skip := true.
- ].
-
- skip ifFalse:[
- "/ kludge ..
- "/ (protoSpec isKindOf:ActionButtonSpec)
- (protoSpec defaultModelIsCallBackMethodSelector:aSel)
- ifTrue:[
- thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
- ] ifFalse:[
- thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
- ].
- codePieces add:thisCode.
- definedMethodSelectors add:aSel.
- Transcript showCR:'code generated for aspect: ' , aSel
- ] ifTrue:[
- Transcript showCR:'*** no code generated for aspect: ' , aSel , ' (method already exists)'
- ].
- ].
- ].
- ].
-
- "/ for each aspect, generate getter (if not yet implemented)
- self generateCodeFrom:(aProp spec aspectSelectors) in:cls
- do:[:aSel|
- (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
- (definedMethodSelectors includes:aSel) ifFalse:[
- thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
- codePieces add:thisCode.
- definedMethodSelectors add:aSel.
- Transcript showCR:'code generated for aspect: ' , aSel
- ]
- ]
- ].
-
- "/ exported aspects - need setter methods
- exportSels := (treeView exportedAspects ? #()) collect:[:entry | (entry subAspect , ':') asSymbol].
- self generateCodeFrom:exportSels in:cls
- do:[:aSel|
- |aspect|
-
- (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
- (definedMethodSelectors includes:aSel) ifFalse:[
- aspect := (aSel copyWithoutLast:1) asSymbol.
- thisCode := (self generateAspectSetMethodFor:aspect spec:protoSpec inClass:cls).
- codePieces add:thisCode.
- definedMethodSelectors add:aSel.
- Transcript showCR:'export code generated for aspect: ' , aSel
- ]
- ]
- ].
-
- self generateCodeFrom:(aProp spec actionSelectors) in:cls
- do:[:aSel|
- (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
- (definedMethodSelectors includes:aSel) ifFalse:[
- thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
- codePieces add:thisCode.
- definedMethodSelectors add:aSel.
- Transcript showCR:'action generated for aspect: ' , aSel
- ]
- ]
- ].
-
- self generateCodeFrom:(aProp spec valueSelectors) in:cls
- do:[:aSel|
- (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
- (definedMethodSelectors includes:aSel) ifFalse:[
- "/ uppercase: - assume its a globals name.
- aSel first isUppercase ifFalse:[
- thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
- codePieces add:thisCode.
- definedMethodSelectors add:aSel.
- Transcript showCR:'code generated for aspect: ' , aSel
- ]
- ]
- ]
- ].
+ |modelSelector|
+
+ protoSpec := aProp spec.
+
+ (modelSelector := aProp model) notNil ifTrue:[
+ self generateCodeFrom:(Array with:modelSelector) in:cls
+ do:[:aSel|
+ (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
+ skip := false.
+
+ (cls isSubclassOf:SimpleDialog) ifTrue:[
+ skip := SimpleDialog includesSelector:aSel
+ ].
+ (definedMethodSelectors includes:aSel) ifTrue:[
+ skip := true.
+ ].
+
+ skip ifFalse:[
+ "/ kludge ..
+ "/ (protoSpec isKindOf:ActionButtonSpec)
+ (protoSpec defaultModelIsCallBackMethodSelector:aSel)
+ ifTrue:[
+ thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
+ ] ifFalse:[
+ thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
+ ].
+ codePieces add:thisCode.
+ definedMethodSelectors add:aSel.
+ Transcript showCR:'code generated for aspect: ' , aSel
+ ] ifTrue:[
+ Transcript showCR:'*** no code generated for aspect: ' , aSel , ' (method already exists)'
+ ].
+ ].
+ ].
+ ].
+
+ "/ for each aspect, generate getter (if not yet implemented)
+ self generateCodeFrom:(aProp spec aspectSelectors) in:cls
+ do:[:aSel|
+ (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
+ (definedMethodSelectors includes:aSel) ifFalse:[
+ thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
+ codePieces add:thisCode.
+ definedMethodSelectors add:aSel.
+ Transcript showCR:'code generated for aspect: ' , aSel
+ ]
+ ]
+ ].
+
+ "/ exported aspects - need setter methods
+ exportSels := (treeView exportedAspects ? #()) collect:[:entry | (entry subAspect , ':') asSymbol].
+ self generateCodeFrom:exportSels in:cls
+ do:[:aSel|
+ |aspect|
+
+ (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
+ (definedMethodSelectors includes:aSel) ifFalse:[
+ aspect := (aSel copyWithoutLast:1) asSymbol.
+ thisCode := (self generateAspectSetMethodFor:aspect spec:protoSpec inClass:cls).
+ codePieces add:thisCode.
+ definedMethodSelectors add:aSel.
+ Transcript showCR:'export code generated for aspect: ' , aSel
+ ]
+ ]
+ ].
+
+ self generateCodeFrom:(aProp spec actionSelectors) in:cls
+ do:[:aSel|
+ (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
+ (definedMethodSelectors includes:aSel) ifFalse:[
+ thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
+ codePieces add:thisCode.
+ definedMethodSelectors add:aSel.
+ Transcript showCR:'action generated for aspect: ' , aSel
+ ]
+ ]
+ ].
+
+ self generateCodeFrom:(aProp spec valueSelectors) in:cls
+ do:[:aSel|
+ (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
+ (definedMethodSelectors includes:aSel) ifFalse:[
+ "/ uppercase: - assume its a globals name.
+ aSel first isUppercase ifFalse:[
+ thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
+ codePieces add:thisCode.
+ definedMethodSelectors add:aSel.
+ Transcript showCR:'code generated for aspect: ' , aSel
+ ]
+ ]
+ ]
+ ].
].
AspectsAsInstances ifTrue:[
- iVars := cls instVarNames asOrderedCollection.
- definedMethodSelectors do:[:ivar |
- (iVars includes:ivar) ifFalse:[
- iVars add:ivar
- ]
- ].
- iVars := iVars asArray.
- t := cls shallowCopy.
- t setInstanceVariableString:iVars asStringCollection asString.
- codePieces addFirst:(t definition , '!!\' withCRs).
+ iVars := cls instVarNames asOrderedCollection.
+ definedMethodSelectors do:[:ivar |
+ (iVars includes:ivar) ifFalse:[
+ iVars add:ivar
+ ]
+ ].
+ iVars := iVars asArray.
+ t := cls shallowCopy.
+ t setInstanceVariableString:iVars asStringCollection asString.
+ codePieces addFirst:(t definition , '!!\' withCRs).
].
- ^ String
- streamContents:
- [:codeStream |
- codePieces do:[:eachPiece | codeStream nextPutAll:eachPiece].
- ].
+ ^ String
+ streamContents:
+ [:codeStream |
+ codePieces do:[:eachPiece | codeStream nextPutAll:eachPiece].
+ ].
"Modified: / 29.7.1998 / 12:21:19 / cg"
!
@@ -910,14 +910,14 @@
modelClass := protoSpec defaultModelClassFor:aspect.
modelValueString := protoSpec defaultModelValueStringFor:aspect.
modelValueString notNil ifTrue:[
- modelGen := modelValueString
+ modelGen := modelValueString
] ifFalse:[
- modelValue := protoSpec defaultModelValueFor:aspect.
- modelValue isNil ifTrue:[
- modelGen := modelClass name , ' new'
- ] ifFalse:[
- modelGen := modelValue storeString , ' asValue'
- ].
+ modelValue := protoSpec defaultModelValueFor:aspect.
+ modelValue isNil ifTrue:[
+ modelGen := modelClass name , ' new'
+ ] ifFalse:[
+ modelGen := modelValue storeString , ' asValue'
+ ].
].
@@ -931,36 +931,36 @@
AspectsAsInstances ifTrue:[
- code := code , '\' ,
- ' ' , aspect , ' isNil ifTrue:[\' ,
- ' ' , aspect , ' := ' , modelGen , '.\'.
- modelClass ~~ TriggerValue ifTrue:[
- code := code ,
- '"/ if your app needs to be notified of changes, uncomment one of the lines below:\' ,
- '"/ ' , aspect , ' addDependent:self.\' ,
- '"/ ' , aspect , ' onChangeSend:#', aspect ,'Changed to:self.\'.
- ].
- code := code ,
- ' ].\' ,
- ' ^ ' , aspect ,'.\' ,
- '!! !!\\'
+ code := code , '\' ,
+ ' ' , aspect , ' isNil ifTrue:[\' ,
+ ' ' , aspect , ' := ' , modelGen , '.\'.
+ modelClass ~~ TriggerValue ifTrue:[
+ code := code ,
+ '"/ if your app needs to be notified of changes, uncomment one of the lines below:\' ,
+ '"/ ' , aspect , ' addDependent:self.\' ,
+ '"/ ' , aspect , ' onChangeSend:#', aspect ,'Changed to:self.\'.
+ ].
+ code := code ,
+ ' ].\' ,
+ ' ^ ' , aspect ,'.\' ,
+ '!! !!\\'
] ifFalse:[
- code := code , '\' ,
- ' |holder|\' ,
- '\' ,
- ' (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' ,
- ' holder := ', modelGen, '.\',
- ' builder aspectAt:#' , aspect , ' put:holder.\'.
- modelClass ~~ TriggerValue ifTrue:[
- code := code ,
- '"/ if your app needs to be notified of changes, uncomment one of the lines below:\' ,
- '"/ holder addDependent:self.\' ,
- '"/ holder onChangeSend:#', aspect ,'Changed to:self.\'.
- ].
- code := code ,
- ' ].\' ,
- ' ^ holder.\' ,
- '!! !!\\'
+ code := code , '\' ,
+ ' |holder|\' ,
+ '\' ,
+ ' (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' ,
+ ' holder := ', modelGen, '.\',
+ ' builder aspectAt:#' , aspect , ' put:holder.\'.
+ modelClass ~~ TriggerValue ifTrue:[
+ code := code ,
+ '"/ if your app needs to be notified of changes, uncomment one of the lines below:\' ,
+ '"/ holder addDependent:self.\' ,
+ '"/ holder onChangeSend:#', aspect ,'Changed to:self.\'.
+ ].
+ code := code ,
+ ' ].\' ,
+ ' ^ holder.\' ,
+ '!! !!\\'
].
^ code withCRs
@@ -977,7 +977,7 @@
cls := self targetClass.
cls isNil ifTrue:[
- ^ nil
+ ^ nil
].
spec := treeView exportedAspects.
@@ -985,13 +985,13 @@
"/ make it an array ...
spec := spec collect:[:entry | |subAspect type|
- subAspect := entry subAspect asSymbol.
- (type := entry type) isNil ifTrue:[
- subAspect
- ] ifFalse:[
- Array with:subAspect with:type asSymbol
- ].
- ].
+ subAspect := entry subAspect asSymbol.
+ (type := entry type) isNil ifTrue:[
+ subAspect
+ ] ifFalse:[
+ Array with:subAspect with:type asSymbol
+ ].
+ ].
spec := spec asArray.
code := '!!' , cls name , ' class methodsFor:''plugIn spec''!!\\' .
@@ -1027,29 +1027,29 @@
' "and the mainApp wants to connect its aspects to mine."\'.
AspectsAsInstances ifTrue:[
- code := (code , '\' ,
- '"/ ' , aspect , ' notNil ifTrue:[\' ,
- '"/ ' , aspect , ' removeDependent:self.\' ,
- '"/ ].\' ,
- ' ' , aspect ,' := something.\' ,
- '"/ ' , aspect ,' notNil ifTrue:[\' ,
- '"/ ' , aspect , ' addDependent:self.\' ,
- '"/ ].\' ,
- ' ^ self.\' ,
- '!! !!\\')
+ code := (code , '\' ,
+ '"/ ' , aspect , ' notNil ifTrue:[\' ,
+ '"/ ' , aspect , ' removeDependent:self.\' ,
+ '"/ ].\' ,
+ ' ' , aspect ,' := something.\' ,
+ '"/ ' , aspect ,' notNil ifTrue:[\' ,
+ '"/ ' , aspect , ' addDependent:self.\' ,
+ '"/ ].\' ,
+ ' ^ self.\' ,
+ '!! !!\\')
] ifFalse:[
- code := (code , '\' ,
- '"/ |holder|\' ,
- '\' ,
- '"/ (holder := builder bindingAt:#' , aspect , ') notNil ifTrue:[\' ,
- '"/ holder removeDependent:self.\' ,
- '"/ ].\' ,
- ' builder aspectAt:#' , aspect , ' put:something.\',
- '"/ something notNil ifTrue:[\' ,
- '"/ something addDependent:self.\' ,
- '"/ ].\' ,
- ' ^ self.\' ,
- '!! !!\\')
+ code := (code , '\' ,
+ '"/ |holder|\' ,
+ '\' ,
+ '"/ (holder := builder bindingAt:#' , aspect , ') notNil ifTrue:[\' ,
+ '"/ holder removeDependent:self.\' ,
+ '"/ ].\' ,
+ ' builder aspectAt:#' , aspect , ' put:something.\',
+ '"/ something notNil ifTrue:[\' ,
+ '"/ something addDependent:self.\' ,
+ '"/ ].\' ,
+ ' ^ self.\' ,
+ '!! !!\\')
].
^ code withCRs
@@ -1064,19 +1064,19 @@
realSelectors := aListOfSelectors select:[:sel | sel isArray not].
self class redefineAspectMethods ifTrue:[
- redefCondition := [:cls :sel | (cls includesSelector:sel) not].
- redefMessage := ' skipped - already implemented in the class'.
+ redefCondition := [:cls :sel | (cls includesSelector:sel) not].
+ redefMessage := ' skipped - already implemented in the class'.
] ifFalse:[
- redefCondition := [:cls :sel | (cls canUnderstand:sel) not].
- redefMessage := ' skipped - already implemented in the class (or superclass)'.
+ redefCondition := [:cls :sel | (cls canUnderstand:sel) not].
+ redefMessage := ' skipped - already implemented in the class (or superclass)'.
].
realSelectors do:[:aSelector|
- (redefCondition value:aClass value:aSelector) ifTrue:[
- aBlock value:aSelector asSymbol
- ] ifFalse:[
- Transcript showCR:('#' , aSelector , redefMessage)
- ]
+ (redefCondition value:aClass value:aSelector) ifTrue:[
+ aBlock value:aSelector asSymbol
+ ] ifFalse:[
+ Transcript showCR:('#' , aSelector , redefMessage)
+ ]
]
!
@@ -1107,7 +1107,7 @@
cls := self targetClass.
cls isNil ifTrue:[
- ^ nil
+ ^ nil
].
^ self generateHookMethodsInClass:cls.
@@ -1119,31 +1119,31 @@
code := ''.
(targetClass includesSelector:#postBuildWith:) ifFalse:[
- code := code
- , (self
- generateHookMethodFor:'postBuildWith:aBuilder'
- comment:'the widgets have been built, but before the view is opened'
- note:'or after the super send'
- defaultCode:' super postBuildWith:aBuilder'
- inClass:targetClass)
+ code := code
+ , (self
+ generateHookMethodFor:'postBuildWith:aBuilder'
+ comment:'the widgets have been built, but before the view is opened'
+ note:'or after the super send'
+ defaultCode:' super postBuildWith:aBuilder'
+ inClass:targetClass)
].
(targetClass includesSelector:#postOpenWith:) ifFalse:[
- code := code
- , (self
- generateHookMethodFor:'postOpenWith:aBuilder'
- comment:'the topView has been opened, but before events are dispatched for it'
- note:'or after the super send'
- defaultCode:' super postOpenWith:aBuilder'
- inClass:targetClass)
+ code := code
+ , (self
+ generateHookMethodFor:'postOpenWith:aBuilder'
+ comment:'the topView has been opened, but before events are dispatched for it'
+ note:'or after the super send'
+ defaultCode:' super postOpenWith:aBuilder'
+ inClass:targetClass)
].
(targetClass includesSelector:#closeRequest) ifFalse:[
- code := code
- , (self
- generateHookMethodFor:'closeRequest'
- comment:'the topView has been asked to close'
- note:'return without the ''super closeRequest'' to stay open'
- defaultCode:' ^super closeRequest'
- inClass:targetClass)
+ code := code
+ , (self
+ generateHookMethodFor:'closeRequest'
+ comment:'the topView has been asked to close'
+ note:'return without the ''super closeRequest'' to stay open'
+ defaultCode:' ^super closeRequest'
+ inClass:targetClass)
].
^ code
@@ -1162,108 +1162,108 @@
code := '!!' , targetClass name , ' methodsFor:''' , category , '''!!\\'.
selector = 'openAboutThisApplication' ifTrue:[
- code := code ,
- 'openAboutThisApplication\' ,
- ' "opens an about box for this application."\\' ,
- ' "automatically generated by UIPainter ..."\\' ,
-
- ' |rev box myClass clsRev image msg|\\' ,
-
- ' rev := ''''.\' ,
- ' myClass := self class.\' ,
-
- ' (clsRev := myClass revision) notNil ifTrue:[\' ,
- ' rev := '' (rev: '', clsRev printString, '')''].\\' ,
-
- ' msg := Character cr asString , myClass name asBoldText, rev.\' ,
- ' msg := (msg , ''\\*** add more info here ***\\'') withCRs.\\' ,
- ' box := AboutBox title:msg.\' ,
-
- ' "/ *** add a #defaultIcon method in the class\' ,
- ' "/ *** and uncomment the following line:\' ,
- ' "/ image := self class defaultIcon.\\' ,
- ' image notNil ifTrue:[\' ,
- ' box image:image\' ,
- ' ].\' ,
- ' box label:(resources string:''About %1'' with:myClass name).\' ,
- ' box autoHideAfter:10 with:[].\' ,
- ' box showAtPointer.\' ,
- '!! !!\\'.
- ^ code withCRs
+ code := code ,
+ 'openAboutThisApplication\' ,
+ ' "opens an about box for this application."\\' ,
+ ' "automatically generated by UIPainter ..."\\' ,
+
+ ' |rev box myClass clsRev image msg|\\' ,
+
+ ' rev := ''''.\' ,
+ ' myClass := self class.\' ,
+
+ ' (clsRev := myClass revision) notNil ifTrue:[\' ,
+ ' rev := '' (rev: '', clsRev printString, '')''].\\' ,
+
+ ' msg := Character cr asString , myClass name asBoldText, rev.\' ,
+ ' msg := (msg , ''\\*** add more info here ***\\'') withCRs.\\' ,
+ ' box := AboutBox title:msg.\' ,
+
+ ' "/ *** add a #defaultIcon method in the class\' ,
+ ' "/ *** and uncomment the following line:\' ,
+ ' "/ image := self class defaultIcon.\\' ,
+ ' image notNil ifTrue:[\' ,
+ ' box image:image\' ,
+ ' ].\' ,
+ ' box label:(resources string:''About %1'' with:myClass name).\' ,
+ ' box autoHideAfter:10 with:[].\' ,
+ ' box showAtPointer.\' ,
+ '!! !!\\'.
+ ^ code withCRs
].
selector = 'menuOpen' ifTrue:[
- code := code ,
- 'menuOpen\' ,
- ' "automatically generated by UIPainter ..."\\' ,
- ' "*** the code below opens a dialog for file selection"\' ,
- ' "*** and invokes the #doOpen: method with the selected file."\' ,
- ' "*** Please change as required and accept in the browser."\\' ,
- ' |file|\\' ,
- ' file :=\' ,
- ' (FileSelectionBrowser\' ,
- ' request: ''Open''\' ,
- ' fileName: ''''\' ,
- ' "/ inDirectory: lastOpenDirectory\' ,
- ' withFileFilters: #(''*'')).\\' ,
- ' file notNil ifTrue:[\' ,
- ' "/ lastOpenDirectory := file asFilename directory.\' ,
- ' self doOpen:file\' ,
- ' ]\' ,
- '!! !!\'.
- ^ code withCRs
+ code := code ,
+ 'menuOpen\' ,
+ ' "automatically generated by UIPainter ..."\\' ,
+ ' "*** the code below opens a dialog for file selection"\' ,
+ ' "*** and invokes the #doOpen: method with the selected file."\' ,
+ ' "*** Please change as required and accept in the browser."\\' ,
+ ' |file|\\' ,
+ ' file :=\' ,
+ ' (FileSelectionBrowser\' ,
+ ' request: ''Open''\' ,
+ ' fileName: ''''\' ,
+ ' "/ inDirectory: lastOpenDirectory\' ,
+ ' withFileFilters: #(''*'')).\\' ,
+ ' file notNil ifTrue:[\' ,
+ ' "/ lastOpenDirectory := file asFilename directory.\' ,
+ ' self doOpen:file\' ,
+ ' ]\' ,
+ '!! !!\'.
+ ^ code withCRs
].
numArgs := selector numArgs.
method := selector.
numArgs == 1 ifTrue:[
- args := 'anArgument'.
- showIt := ''' , anArgument printString , '' ...''.\'.
- ] ifFalse:[
- args := ''.
- showIt := ' ...''.\'.
-
- numArgs ~~ 0 ifTrue:[
- method := ''.
-
- selector keywords keysAndValuesDo:[:i :key|
- method := method, key, 'arg', i printString, ' '
- ]
- ]
+ args := 'anArgument'.
+ showIt := ''' , anArgument printString , '' ...''.\'.
+ ] ifFalse:[
+ args := ''.
+ showIt := ' ...''.\'.
+
+ numArgs ~~ 0 ifTrue:[
+ method := ''.
+
+ selector keywords keysAndValuesDo:[:i :key|
+ method := method, key, 'arg', i printString, ' '
+ ]
+ ]
].
code := code ,
- method , args , '\' ,
- ' "automatically generated by UIPainter ..."\\' ,
- ' "*** the code below performs no action"\' ,
- ' "*** (except for some feedback on the Transcript)"\' ,
- ' "*** Please change as required and accept in the browser."\' ,
- '\' .
+ method , args , '\' ,
+ ' "automatically generated by UIPainter ..."\\' ,
+ ' "*** the code below performs no action"\' ,
+ ' "*** (except for some feedback on the Transcript)"\' ,
+ ' "*** Please change as required and accept in the browser."\' ,
+ '\' .
alreadyInSuperclass ifTrue:[
- code := code ,
- ' "action for ' , selector , ' is already provided in a superclass."\' ,
- ' "It may be redefined here ..."\\'.
+ code := code ,
+ ' "action for ' , selector , ' is already provided in a superclass."\' ,
+ ' "It may be redefined here ..."\\'.
] ifFalse:[
- code := code ,
- ' "action to be added ..."\\'.
+ code := code ,
+ ' "action to be added ..."\\'.
].
code := code ,
- ' Transcript showCR:self class name, '': '.
+ ' Transcript showCR:self class name, '': '.
alreadyInSuperclass ifTrue:[
- code := code , 'inherited '.
+ code := code , 'inherited '.
].
code := code , 'menu action for ' , selector , showIt.
alreadyInSuperclass ifTrue:[
- code := code ,
- ' super ' , selector , args , '.\'.
+ code := code ,
+ ' super ' , selector , args , '.\'.
].
code := code ,
- '!! !!\\'.
+ '!! !!\\'.
^ code withCRs
"Created: / 23.8.1998 / 16:46:51 / cg"
@@ -1282,7 +1282,7 @@
cls := self targetClass.
cls isNil ifTrue:[
- ^ nil
+ ^ nil
].
specArray := treeView generateFullSpecForComponents:#() named:nil.
@@ -1290,10 +1290,10 @@
winSpec := fullSpec window.
menuSelector := winSpec menu.
- (menuSelector notNil
+ (menuSelector notNil
and:[ (cls respondsTo:menuSelector) ]) ifFalse:[
- self warn:'No menu defined (yet)'.
- ^ nil.
+ self warn:'No menu defined (yet)'.
+ ^ nil.
].
menuSpec := cls perform:menuSelector.
menuSpec := menuSpec decodeAsLiteralArray.
@@ -1302,24 +1302,24 @@
code := ''.
menuSpec allItemsDo:[:item |
- |sel|
-
- (sel := item value) notNil ifTrue:[
- (definedMethodSelectors includes:sel) ifFalse:[
- self generateCodeFrom:(Array with:sel) in:cls do:[:aSel|
- thisCode := (self generateMenuMethodFor:aSel inClass:cls).
- code := code, thisCode.
- ].
- definedMethodSelectors add:sel.
- ].
- ]
+ |sel|
+
+ (sel := item value) notNil ifTrue:[
+ (definedMethodSelectors includes:sel) ifFalse:[
+ self generateCodeFrom:(Array with:sel) in:cls do:[:aSel|
+ thisCode := (self generateMenuMethodFor:aSel inClass:cls).
+ code := code, thisCode.
+ ].
+ definedMethodSelectors add:sel.
+ ].
+ ]
].
(definedMethodSelectors includes:#menuOpen) ifTrue:[
- self generateCodeFrom:(Array with:#doOpen:) in:cls do:[:aSel|
- thisCode := (self generateMenuMethodFor:aSel inClass:cls).
- code := code, thisCode.
- ].
+ self generateCodeFrom:(Array with:#doOpen:) in:cls do:[:aSel|
+ thisCode := (self generateMenuMethodFor:aSel inClass:cls).
+ code := code, thisCode.
+ ].
].
^ code
@@ -1351,19 +1351,19 @@
spec := OrderedCollection new.
self subViews do:[:aView|
- |vSpec|
-
- "/ care for wrapped views ...
- vSpec := self fullSpecFor:aView.
- vSpec isNil ifTrue:[
- aView subViews size == 1 ifTrue:[
- vSpec := self fullSpecFor:(aView subViews first).
- ]
- ].
- vSpec isNil ifTrue:[
- self warn:'Oops - could not create spec for some view'
- ].
- spec add:vSpec
+ |vSpec|
+
+ "/ care for wrapped views ...
+ vSpec := self fullSpecFor:aView.
+ vSpec isNil ifTrue:[
+ aView subViews size == 1 ifTrue:[
+ vSpec := self fullSpecFor:(aView subViews first).
+ ]
+ ].
+ vSpec isNil ifTrue:[
+ self warn:'Oops - could not create spec for some view'
+ ].
+ spec add:vSpec
].
spec := treeView generateFullSpecForComponents:spec named:methodName.
@@ -1372,10 +1372,10 @@
specCode := str contents.
(specCode includes:$!!) ifTrue:[
- "/ oops - must be chunk format ...
- str := WriteStream on:String new.
- str nextPutAllAsChunk:specCode.
- specCode := str contents.
+ "/ oops - must be chunk format ...
+ str := WriteStream on:String new.
+ str nextPutAllAsChunk:specCode.
+ specCode := str contents.
].
"/ if that method already exists, do not overwrite the category
@@ -1384,37 +1384,37 @@
cls := self resolveName:className.
cls notNil ifTrue:[
- (mthd := cls class compiledMethodAt:methodName asSymbol) notNil ifTrue:[
- category := mthd category.
- ]
+ (mthd := cls class compiledMethodAt:methodName asSymbol) notNil ifTrue:[
+ category := mthd category.
+ ]
].
code := '!!'
- , className , ' class methodsFor:' , category storeString
- , '!!' , '\\'
-
- , methodName , '\'
- , ((ResourceSpecEditor codeGenerationCommentForClass: UIPainter) replChar:$!! withString:'!!!!')
- , '\\ "\'
- , (' UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\').
+ , className , ' class methodsFor:' , category storeString
+ , '!!' , '\\'
+
+ , methodName , '\'
+ , ((ResourceSpecEditor codeGenerationCommentForClass: UIPainter) replChar:$!! withString:'!!!!')
+ , '\\ "\'
+ , (' UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\').
(cls notNil and:[cls isSubclassOf:ApplicationModel]) ifTrue:[
- code := code
- , (' ' , className , ' new openInterface:#' , methodName , '\').
+ code := code
+ , (' ' , className , ' new openInterface:#' , methodName , '\').
].
code := code
- ,(methodName = 'windowSpec'
- ifTrue:[' ' , className , ' open\'] ifFalse: [''])
- , ' "\'.
-
- code := code
- , '\'
- , ' <resource: #canvas>\\'
- , ' ^ ' , specCode
- , '\'
- , '!! !!'
- , '\\'.
+ ,(methodName = 'windowSpec'
+ ifTrue:[' ' , className , ' open\'] ifFalse: [''])
+ , ' "\'.
+
+ code := code
+ , '\'
+ , ' <resource: #canvas>\\'
+ , ' ^ ' , specCode
+ , '\'
+ , '!! !!'
+ , '\\'.
^ code withCRs
@@ -1426,12 +1426,12 @@
|cls|
className isNil ifTrue:[
- self warn:'No TargetClass defined !!'.
- ^ nil
+ self warn:'No TargetClass defined !!'.
+ ^ nil
].
(cls := self resolveName:className) isNil ifTrue:[
- self warn:('Class ', className asString, ' does not exist !!').
- ^ nil
+ self warn:('Class ', className asString, ' does not exist !!').
+ ^ nil
].
^ cls.
! !
@@ -1449,18 +1449,18 @@
defaultViewBackground := self class defaultViewBackgroundColor.
shown ifTrue:[
- self viewBackground: (defaultViewBackground isColor
- ifTrue: [defaultViewBackground]
- ifFalse:[Black]).
- self clear.
+ self viewBackground: (defaultViewBackground isColor
+ ifTrue: [defaultViewBackground]
+ ifFalse:[Black]).
+ self clear.
].
gridShown ifTrue:[
- self defineGrid.
- gridPixmap colorMap: (defaultViewBackground isColor
- ifTrue: [Array with:defaultViewBackground with:Color darkGray]
- ifFalse:[Array with:White with:Black]).
- self viewBackground:gridPixmap.
+ self defineGrid.
+ gridPixmap colorMap: (defaultViewBackground isColor
+ ifTrue: [Array with:defaultViewBackground with:Color darkGray]
+ ifFalse:[Array with:White with:Black]).
+ self viewBackground:gridPixmap.
].
self invalidate
@@ -1494,23 +1494,23 @@
cS := canvas getSelectedViewsAndSpecs.
cS isNil ifTrue:[^self].
views := cS first.
- specs := cS last.
+ specs := cS last.
rect := views first frame.
2 to: views size do:[:i| rect := rect merge: (views at: i) frame].
- layout := LayoutFrame leftFraction:0.0 offset: rect origin x
- rightFraction:0.0 offset: rect corner x + 1
- topFraction:0.0 offset: rect origin y
- bottomFraction:0.0 offset:rect corner y + 1.
+ layout := LayoutFrame leftFraction:0.0 offset: rect origin x
+ rightFraction:0.0 offset: rect corner x + 1
+ topFraction:0.0 offset: rect origin y
+ bottomFraction:0.0 offset:rect corner y + 1.
oldSelection := canvas selection.
canvas select: views first superView.
spec layout: layout.
spec class == VerticalPanelViewSpec ifTrue:[
- spec verticalLayout: #topSpace.
- spec horizontalLayout: #fit.
+ spec verticalLayout: #topSpace.
+ spec horizontalLayout: #fit.
].
spec class == HorizontalPanelViewSpec ifTrue:[
- spec verticalLayout: #fit.
- spec horizontalLayout: #leftSpace.
+ spec verticalLayout: #fit.
+ spec horizontalLayout: #leftSpace.
].
box := self pasteSpecifications:spec keepLayout:true at:nil.
@@ -1518,15 +1518,15 @@
xOffset := box origin x.
yOffset := box origin y.
withLayout ifFalse:[
- 1 to: specs size do:[:i|
- view := views at: i.
- layout := LayoutFrame leftFraction:0.0 offset: (view origin x - xOffset)
- rightFraction:0.0 offset: (view corner x - xOffset + 1)
- topFraction:0.0 offset: (view origin y - yOffset )
- bottomFraction:0.0 offset: (view corner y - yOffset + 1).
- (specs at: i) layout: layout.
- ].
- ].
+ 1 to: specs size do:[:i|
+ view := views at: i.
+ layout := LayoutFrame leftFraction:0.0 offset: (view origin x - xOffset)
+ rightFraction:0.0 offset: (view corner x - xOffset + 1)
+ topFraction:0.0 offset: (view origin y - yOffset )
+ bottomFraction:0.0 offset: (view corner y - yOffset + 1).
+ (specs at: i) layout: layout.
+ ].
+ ].
canvas selection: oldSelection.
canvas deleteSelection.
canvas selection:box.
@@ -1555,19 +1555,19 @@
superView := cS first first superView.
cS last first component isNil ifTrue:[^self].
cS last first component collection isEmpty ifTrue:[^self].
- specs := cS last first component collection copy.
+ specs := cS last first component collection copy.
frame := cS first first frame.
canvas deleteSelection.
withLayout ifFalse:[
- 1 to: specs size do:[:i|
- view := views at: i.
- layout := LayoutFrame leftFraction:0.0 offset: (view origin x + frame origin x)
- rightFraction:0.0 offset: (view corner x + frame origin x + 1)
- topFraction:0.0 offset: (view origin y + frame origin y )
- bottomFraction:0.0 offset: (view corner y + frame origin y + 1).
- (specs at: i) layout: layout.
- ].
- ].
+ 1 to: specs size do:[:i|
+ view := views at: i.
+ layout := LayoutFrame leftFraction:0.0 offset: (view origin x + frame origin x)
+ rightFraction:0.0 offset: (view corner x + frame origin x + 1)
+ topFraction:0.0 offset: (view origin y + frame origin y )
+ bottomFraction:0.0 offset: (view corner y + frame origin y + 1).
+ (specs at: i) layout: layout.
+ ].
+ ].
canvas selection: superView.
canvas pasteSpecifications:specs keepLayout:true.
canvas selection: superView.
@@ -1611,23 +1611,23 @@
|spec builder|
Cursor wait showWhile: [
- self removeAll.
- specOrSpecArray notNil ifTrue:[
- spec := UISpecification from:specOrSpecArray.
- ].
- builder := UIBuilder new isEditing:true.
- "set applicationClass, in order that subspecifications may be resolved"
- className notNil ifTrue:[
- builder applicationClass:(self resolveName:className).
- ].
- spec notNil ifTrue:[
- spec window setupView:self topView for:builder.
- self addSpec:(spec component) builder:builder in:self.
- ].
- self realizeAllSubViews.
- spec notNil ifTrue:[
- treeView setAttributesFromWindowSpec:(spec window)
- ].
+ self removeAll.
+ specOrSpecArray notNil ifTrue:[
+ spec := UISpecification from:specOrSpecArray.
+ ].
+ builder := UIBuilder new isEditing:true.
+ "set applicationClass, in order that subspecifications may be resolved"
+ className notNil ifTrue:[
+ builder applicationClass:(self resolveName:className).
+ ].
+ spec notNil ifTrue:[
+ spec window setupView:self topView for:builder.
+ self addSpec:(spec component) builder:builder in:self.
+ ].
+ self realizeAllSubViews.
+ spec notNil ifTrue:[
+ treeView setAttributesFromWindowSpec:(spec window)
+ ].
].
!
@@ -1635,18 +1635,18 @@
treeView := aTreeView.
treeView delegate:(
- "/
- "/ I want to handle everything typed
- "/ in the treeView, except for Return and Cursor-keys
- "/
- KeyboardForwarder
- toView:self
- condition:nil
- filter:[:k | (k isSymbol
- and:[k ~~ #Return
- and:[k ~~ #Tab
- and:[(k startsWith:#Cursor) not]]])
- ]
+ "/
+ "/ I want to handle everything typed
+ "/ in the treeView, except for Return and Cursor-keys
+ "/
+ KeyboardForwarder
+ toView:self
+ condition:nil
+ filter:[:k | (k isSymbol
+ and:[k ~~ #Return
+ and:[k ~~ #Tab
+ and:[(k startsWith:#Cursor) not]]])
+ ]
)
"Modified: / 31.10.1997 / 20:22:09 / cg"
@@ -1661,8 +1661,8 @@
|m|
self enabled ifTrue:[
- m := MenuPanel fromSpec:(UIPainter menuEdit) receiver:self superView application.
- self startUpMenu:m
+ m := MenuPanel fromSpec:(UIPainter menuEdit) receiver:self superView application.
+ self startUpMenu:m
].
^ nil
! !
@@ -1679,43 +1679,43 @@
|wasClipped sel hColor bg|
selectionHiddenLevel == 0 ifTrue:[
- sel := treeView selection.
- (sel size > 1 and:
- [(treeView model list at: sel first) contents view == aComponent])
- ifTrue: [
- hColor := handleMasterColor
- ] ifFalse:[
- bg := aComponent viewBackground.
- bg isColor ifTrue:[
- bg brightness < 0.5 ifTrue:[
- hColor := handleColorWhite
- ] ifFalse:[
- hColor := handleColorBlack
- ]
- ] ifFalse:[
- hColor := handleColorBlack
- ]
- ].
-
- self paint:hColor.
-
- (wasClipped := clipChildren) ifTrue:[
- self clippedByChildren:(clipChildren := false).
- ].
-
- self handlesOf:aComponent do:[:aRectangle :what| |l t w h|
- l := aRectangle left + 1.
- t := aRectangle top + 1.
- w := aRectangle width - 2.
- h := aRectangle height - 2.
-
- what == #view ifTrue:[self displayRectangleX:l y:t width:w height:h]
- ifFalse:[self fillRectangleX:l y:t width:w height:h]
- ].
-
- wasClipped ifTrue:[
- self clippedByChildren:(clipChildren := true).
- ]
+ sel := treeView selection.
+ (sel size > 1 and:
+ [(treeView model list at: sel first) contents view == aComponent])
+ ifTrue: [
+ hColor := handleMasterColor
+ ] ifFalse:[
+ bg := aComponent viewBackground.
+ bg isColor ifTrue:[
+ bg brightness < 0.5 ifTrue:[
+ hColor := handleColorWhite
+ ] ifFalse:[
+ hColor := handleColorBlack
+ ]
+ ] ifFalse:[
+ hColor := handleColorBlack
+ ]
+ ].
+
+ self paint:hColor.
+
+ (wasClipped := clipChildren) ifTrue:[
+ self clippedByChildren:(clipChildren := false).
+ ].
+
+ self handlesOf:aComponent do:[:aRectangle :what| |l t w h|
+ l := aRectangle left + 1.
+ t := aRectangle top + 1.
+ w := aRectangle width - 2.
+ h := aRectangle height - 2.
+
+ what == #view ifTrue:[self displayRectangleX:l y:t width:w height:h]
+ ifFalse:[self fillRectangleX:l y:t width:w height:h]
+ ].
+
+ wasClipped ifTrue:[
+ self clippedByChildren:(clipChildren := true).
+ ]
]
"Modified: / 6.12.2001 / 00:00:16 / cg"
@@ -1729,7 +1729,7 @@
appl := self application.
appl notNil ifTrue:[
- ^ appl resolveName:aName
+ ^ appl resolveName:aName
].
^ Smalltalk resolveName:aName inClass:self class
! !
@@ -1740,7 +1740,7 @@
"remove anObject from the contents do redraw
"
anObject notNil ifTrue:[
- treeView removeView:anObject.
+ treeView removeView:anObject.
]
!
@@ -1760,7 +1760,7 @@
|p|
(p := self propertyOfParentForView:aView) isNil ifTrue:[
- ^ self
+ ^ self
].
^ p view
!
@@ -1785,14 +1785,14 @@
prop := self propertyOfIdentifier:aViewId.
prop notNil ifTrue:[^ prop view]
- ifFalse:[^ nil]
+ ifFalse:[^ nil]
!
propertyOfIdentifier:anId
"returns property assigned to unique identifier
"
anId notNil ifTrue:[
- ^ treeView propertyDetect:[:p| p identifier == anId ]
+ ^ treeView propertyDetect:[:p| p identifier == anId ]
].
^ nil
!
@@ -1803,7 +1803,7 @@
|name|
aString isNil ifFalse:[
- name := aString string withoutSeparators.
+ name := aString string withoutSeparators.
^ treeView propertyDetect:[:p| p name = name ].
].
^ nil
@@ -1815,7 +1815,7 @@
|item|
(item := treeView detectItemRespondsToView:aSubView) notNil ifTrue:[
- (item := item parent) notNil ifTrue:[^ item contents]
+ (item := item parent) notNil ifTrue:[^ item contents]
].
^ nil
!
@@ -1824,7 +1824,7 @@
"returns property assigned to view
"
(aView isNil or:[aView == self]) ifFalse:[
- ^ treeView propertyDetect:[:p| p view == aView ]
+ ^ treeView propertyDetect:[:p| p view == aView ]
].
^ nil
!
@@ -1839,7 +1839,7 @@
item := treeView detectItemRespondsToView:aView.
(item notNil and:[item parent notNil]) ifTrue:[
- ^ item contents
+ ^ item contents
].
^ nil
!
@@ -1850,18 +1850,18 @@
|next name size|
aSpecOrString isString ifFalse:[name := aSpecOrString userFriendlyName]
- ifTrue:[name := aSpecOrString].
+ ifTrue:[name := aSpecOrString].
size := name size + 1.
next := 0.
treeView propertiesDo:[:p|
- |n|
- n := p name.
-
- (n size >= size and:[n startsWith:name]) ifTrue:[
- next := next max:(p extractNumberStartingAt:size)
- ]
+ |n|
+ n := p name.
+
+ (n size >= size and:[n startsWith:name]) ifTrue:[
+ next := next max:(p extractNumberStartingAt:size)
+ ]
].
next := next + 1.
name := name, next printString.
@@ -1876,10 +1876,10 @@
|prop|
(prop := self propertyOfView:aView) notNil ifTrue:[
- prop name isNil ifTrue:[
- prop name:(self uniqueNameFor:(prop spec)).
- ].
- ^ prop name
+ prop name isNil ifTrue:[
+ prop name:(self uniqueNameFor:(prop spec)).
+ ].
+ ^ prop name
].
^ 'self'
@@ -1891,23 +1891,23 @@
"add an object to the selection
"
(self enabled and:[(self isSelected:anObject) not]) ifTrue:[
- selection isCollection ifFalse:[
- selection isNil ifTrue:[
- selection := anObject
- ] ifFalse:[
- selection := OrderedCollection with:selection with:anObject
- ]
- ] ifTrue:[
- "/ to enforce the change-message (value is identical to oldValue)
- selection isList ifTrue:[
- selection add:anObject
- ] ifFalse:[
- selection := selection asOrderedCollection.
- selection := selection copyWith:anObject
- ]
- ].
- self showSelected:anObject.
- treeView cvsSelectionAdd:anObject.
+ selection isCollection ifFalse:[
+ selection isNil ifTrue:[
+ selection := anObject
+ ] ifFalse:[
+ selection := OrderedCollection with:selection with:anObject
+ ]
+ ] ifTrue:[
+ "/ to enforce the change-message (value is identical to oldValue)
+ selection isList ifTrue:[
+ selection add:anObject
+ ] ifFalse:[
+ selection := selection asOrderedCollection.
+ selection := selection copyWith:anObject
+ ]
+ ].
+ self showSelected:anObject.
+ treeView cvsSelectionAdd:anObject.
]
"Modified: / 11.2.2000 / 01:39:05 / cg"
@@ -1917,21 +1917,21 @@
"remove an object from the selection
"
(self isSelected:anObject) ifTrue:[
- self showUnselected:anObject.
-
- selection size > 1 ifTrue:[
- selection isList ifTrue:[
- selection remove:anObject ifAbsent:nil
- ] ifFalse:[
- "/ to enforce the change-message (value is identical to oldValue)
- selection := selection asOrderedCollection.
- selection := selection copyWithout:anObject
- ].
- self showSelection.
- ] ifFalse:[
- selection := nil
- ].
- treeView cvsSelectionRemove:anObject.
+ self showUnselected:anObject.
+
+ selection size > 1 ifTrue:[
+ selection isList ifTrue:[
+ selection remove:anObject ifAbsent:nil
+ ] ifFalse:[
+ "/ to enforce the change-message (value is identical to oldValue)
+ selection := selection asOrderedCollection.
+ selection := selection copyWithout:anObject
+ ].
+ self showSelection.
+ ] ifFalse:[
+ selection := nil
+ ].
+ treeView cvsSelectionRemove:anObject.
]
"Modified: / 11.2.2000 / 01:41:11 / cg"
@@ -1939,12 +1939,12 @@
select:something
"change selection to something
- "
- (self enabled and:[something ~= self selection]) ifTrue:[
- something isNil
- ifTrue: [treeView selection: (Array with: 1)]
- ifFalse:[treeView cvsSelection:something].
- self setSelection:something withRedraw:true
+ "
+ (self enabled and:[something ~= self selection]) ifTrue:[
+ something isNil
+ ifTrue: [treeView selection: (Array with: 1)]
+ ifFalse:[treeView cvsSelection:something].
+ self setSelection:something withRedraw:true
]
!
@@ -1954,7 +1954,7 @@
(sel := self selection) isNil ifTrue:[^self].
sel isCollection ifTrue:[
- sel := self selection first.
+ sel := self selection first.
].
sel := sel superView.
sel isNil ifTrue:[^self].
@@ -1968,16 +1968,16 @@
|list|
selectionHiddenLevel == 0 ifTrue:[
- aSelOrNil size ~~ 0 ifTrue:[
- list := OrderedCollection new.
-
- self selectionDo:[:el|
- (aSelOrNil includes:el) ifFalse:[list add:el]
- ].
- self showUnselected:list.
- ] ifFalse:[
- self hideSelection.
- ]
+ aSelOrNil size ~~ 0 ifTrue:[
+ list := OrderedCollection new.
+
+ self selectionDo:[:el|
+ (aSelOrNil includes:el) ifFalse:[list add:el]
+ ].
+ self showUnselected:list.
+ ] ifFalse:[
+ self hideSelection.
+ ]
].
self setSelection:aSelOrNil withRedraw:false.
self showSelection
@@ -1994,25 +1994,25 @@
cls := self resolveName:className.
cls notNil ifTrue:[
- aBuilder applicationClass:cls.
+ aBuilder applicationClass:cls.
].
aBuilder componentCreationHook:[:aView :aSpec :aBdr||sv p s n|
- p := ViewProperty new.
- s := aSpec copy.
- p spec:s.
- p view:aView.
-
- s class supportsSubComponents ifTrue:[
- s component:nil
- ].
-
- n := s name.
-
- (n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[
- s name:(self uniqueNameFor:s)
- ].
- treeView addProperty:p.
+ p := ViewProperty new.
+ s := aSpec copy.
+ p spec:s.
+ p view:aView.
+
+ s class supportsSubComponents ifTrue:[
+ s component:nil
+ ].
+
+ n := s name.
+
+ (n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[
+ s name:(self uniqueNameFor:s)
+ ].
+ treeView addProperty:p.
].
^ aSpecification buildViewWithLayoutFor:aBuilder in:aFrame.
@@ -2027,20 +2027,20 @@
mySpec := self specFor:anObject.
(mySpec notNil and:[mySpec class supportsSubComponents]) ifTrue:[
- (anObject subViews notNil) ifTrue:[
- anObject subViews do:[:aSubView||spec|
- spec := self fullSpecFor:aSubView.
- spec notNil ifTrue:[
- subSpecs isNil ifTrue:[
- subSpecs := OrderedCollection new
- ].
- subSpecs add:spec.
- ].
- ].
- subSpecs notNil ifTrue:[
- mySpec component:(SpecCollection new collection:subSpecs)
- ]
- ]
+ (anObject subViews notNil) ifTrue:[
+ anObject subViews do:[:aSubView||spec|
+ spec := self fullSpecFor:aSubView.
+ spec notNil ifTrue:[
+ subSpecs isNil ifTrue:[
+ subSpecs := OrderedCollection new
+ ].
+ subSpecs add:spec.
+ ].
+ ].
+ subSpecs notNil ifTrue:[
+ mySpec component:(SpecCollection new collection:subSpecs)
+ ]
+ ]
].
^ mySpec
@@ -2055,45 +2055,45 @@
|v builder|
(builder := aBuilderOrNil) isNil ifTrue:[
- "/ create a dummy builder
- builder := UIBuilder new isEditing:true.
- className notNil ifTrue:[
- builder applicationClass:(self resolveName:className).
- ].
+ "/ create a dummy builder
+ builder := UIBuilder new isEditing:true.
+ className notNil ifTrue:[
+ builder applicationClass:(self resolveName:className).
+ ].
].
aSpec class isLayoutContainer ifTrue:[
- "/ TODO:
- "/ go through subviews and let them resize to their default/preferred
- "/ needed if we change a containers layout from fit to non-fit.
-
- (aView subViews ? #()) do:[:aSubView |
- |fix spec prop|
-
- (prop := self propertyOfView:aSubView) notNil ifTrue:[
- spec := prop spec.
-
- spec useDefaultExtent ifTrue:[
- fix := aSubView sizeFixed:false.
- aSubView extent:aSubView preferredExtent.
- aSubView sizeFixed:fix
- ]
- ]
- ].
+ "/ TODO:
+ "/ go through subviews and let them resize to their default/preferred
+ "/ needed if we change a containers layout from fit to non-fit.
+
+ (aView subViews ? #()) do:[:aSubView |
+ |fix spec prop|
+
+ (prop := self propertyOfView:aSubView) notNil ifTrue:[
+ spec := prop spec.
+
+ spec useDefaultExtent ifTrue:[
+ fix := aSubView sizeFixed:false.
+ aSubView extent:aSubView preferredExtent.
+ aSubView sizeFixed:fix
+ ]
+ ]
+ ].
].
aSpec needsRebuildForAttributes ifTrue:[
- "/ needs a full rebuild (in case view class depends upon spec-attribute)
- v := aSpec buildViewWithLayoutFor:builder in:(self findContainerOfView:aView).
- v realize.
- aView destroy.
- device sync.
- device flush.
- aView becomeSameAs:v.
- inputView raise.
+ "/ needs a full rebuild (in case view class depends upon spec-attribute)
+ v := aSpec buildViewWithLayoutFor:builder in:(self findContainerOfView:aView).
+ v realize.
+ aView destroy.
+ device sync.
+ device flush.
+ aView becomeSameAs:v.
+ "/ inputView raise.
] ifFalse:[
- aSpec setAttributesIn:aView with:builder.
- self elementChangedSize:aView.
+ aSpec setAttributesIn:aView with:builder.
+ self elementChangedSize:aView.
].
!
@@ -2123,28 +2123,28 @@
|props name|
aSpec class == WindowSpec ifTrue:[
- ^ treeView canvasSpec:aSpec
+ ^ treeView canvasSpec:aSpec
].
self singleSelection notNil ifTrue:[
- self withSelectionHiddenDo:[
- self transaction:#specification selectionDo:[:aView|
- props := self propertyOfView:aView.
- name := (aSpec name) withoutSeparators.
-
- name = props name ifFalse:[
- (self propertyOfName:name) notNil ifTrue:[
- name := props name
- ]
- ].
-
- aSpec name:name.
- self createUndoSpecModify:props.
- self rebuildView:aView fromSpec:aSpec withBuilder:nil.
- props spec:(aSpec copy).
- treeView propertyChanged:props.
- ]
- ]
+ self withSelectionHiddenDo:[
+ self transaction:#specification selectionDo:[:aView|
+ props := self propertyOfView:aView.
+ name := (aSpec name) withoutSeparators.
+
+ name = props name ifFalse:[
+ (self propertyOfName:name) notNil ifTrue:[
+ name := props name
+ ]
+ ].
+
+ aSpec name:name.
+ self createUndoSpecModify:props.
+ self rebuildView:aView fromSpec:aSpec withBuilder:nil.
+ props spec:(aSpec copy).
+ treeView propertyChanged:props.
+ ]
+ ]
]
"Modified: / 30.10.2001 / 13:59:45 / cg"
@@ -2161,7 +2161,7 @@
( (item := treeView itemOfView:aView) isNil
or:[(prnt := item parent) isNil]
) ifTrue:[
- ^ false
+ ^ false
].
^ (prnt parent isNil or:[prnt contents spec class isLayoutContainer not])
!
@@ -2171,7 +2171,7 @@
and all elements in the selection can be moved or aligned
"
selection size == 2 ifFalse:[
- ^ false
+ ^ false
].
^ self canMoveOrAlignSelection
@@ -2191,10 +2191,10 @@
something can change their layout ( move, align, ... operation ).
"
something notNil ifTrue:[
- self forEach:something do:[:aView|
- (self canChangeLayoutOfView:aView) ifFalse:[^ false]
- ].
- ^ true
+ self forEach:something do:[:aView|
+ (self canChangeLayoutOfView:aView) ifFalse:[^ false]
+ ].
+ ^ true
].
^ false
!
@@ -2214,7 +2214,7 @@
argument to the block is a view from derived from something
"
self withinTransaction:aType objects:something do:[
- self forEach:something do:aOneArgBlock
+ self forEach:something do:aOneArgBlock
]
!
@@ -2228,20 +2228,20 @@
size := objects size.
objects isCollection ifTrue:[
- size == 0 ifTrue:[ ^ self ].
- size == 1 ifTrue:[ prop := self propertyOfView:(objects first) ]
+ size == 0 ifTrue:[ ^ self ].
+ size == 1 ifTrue:[ prop := self propertyOfView:(objects first) ]
] ifFalse:[
- prop := self propertyOfView:objects
+ prop := self propertyOfView:objects
].
prop notNil ifTrue:[
- text := prop name
+ text := prop name
] ifFalse:[
- text := size printString, ' elements'
+ text := size printString, ' elements'
].
undoHistory withinTransaction:aType text:text do:[
- aNoneArgBlock value
+ aNoneArgBlock value
]
! !
@@ -2253,21 +2253,21 @@
|lyt args prop|
undoHistory isTransactionOpen ifTrue:[
- prop := self propertyOfView:aView.
-
- prop notNil ifTrue:[
- args := Array new:3.
- args at:1 put:(prop identifier).
-
- (lyt := aView geometryLayout) notNil ifTrue:[
- args at:2 put:#geometryLayout:
- ] ifFalse:[
- lyt := aView extent.
- args at:2 put:#extent:
- ].
- args at:3 put:(lyt copy).
- undoHistory addUndoSelector:#undoLayout: withArgs:args.
- ]
+ prop := self propertyOfView:aView.
+
+ prop notNil ifTrue:[
+ args := Array new:3.
+ args at:1 put:(prop identifier).
+
+ (lyt := aView geometryLayout) notNil ifTrue:[
+ args at:2 put:#geometryLayout:
+ ] ifFalse:[
+ lyt := aView extent.
+ args at:2 put:#extent:
+ ].
+ args at:3 put:(lyt copy).
+ undoHistory addUndoSelector:#undoLayout: withArgs:args.
+ ]
]
!
@@ -2277,14 +2277,14 @@
|prop pid|
(prop := self propertyOfView:aView) notNil ifTrue:[
- (pid := self propertyOfParentForView:aView) notNil ifTrue:[
- pid := pid identifier
- ].
-
- undoHistory addUndoSelector:#undoRemove:
- withArgs:(Array with:(self fullSpecFor:aView)
- with:(prop identifier)
- with:pid)
+ (pid := self propertyOfParentForView:aView) notNil ifTrue:[
+ pid := pid identifier
+ ].
+
+ undoHistory addUndoSelector:#undoRemove:
+ withArgs:(Array with:(self fullSpecFor:aView)
+ with:(prop identifier)
+ with:pid)
]
!
@@ -2292,8 +2292,8 @@
"undo method when changing the specification for an object
"
aProp notNil ifTrue:[
- undoHistory addUndoSelector:#undoSpecModify:
- withArgs:(Array with:(aProp spec) with:(aProp identifier))
+ undoHistory addUndoSelector:#undoSpecModify:
+ withArgs:(Array with:(aProp spec) with:(aProp identifier))
]
!
@@ -2315,8 +2315,8 @@
|view|
(view := self findViewWithId:(args at:1)) notNil ifTrue:[
- view perform:(args at:2) with:(args at:3).
- self layoutChanged.
+ view perform:(args at:2) with:(args at:3).
+ self layoutChanged.
]
!
@@ -2326,10 +2326,10 @@
|frame prop view|
(args at:3) notNil ifTrue:[
- frame := self findViewWithId:(args at:3).
+ frame := self findViewWithId:(args at:3).
].
frame isNil ifTrue:[
- frame := self
+ frame := self
].
view := self addSpec:(args at:1) builder:(UIBuilder new isEditing:true) in:frame.
view realize.
@@ -2346,12 +2346,12 @@
props := self propertyOfIdentifier:(args at:2).
props notNil ifTrue:[
- view := props view.
- spec := args at:1.
-
- props spec:spec.
- self rebuildView:view fromSpec:spec withBuilder:nil.
- treeView propertyChanged:props.
+ view := props view.
+ spec := args at:1.
+
+ props spec:spec.
+ self rebuildView:view fromSpec:spec withBuilder:nil.
+ treeView propertyChanged:props.
]
! !
@@ -2359,7 +2359,7 @@
new
Identifier notNil ifTrue:[Identifier := Identifier + 1]
- ifFalse:[Identifier := 1].
+ ifFalse:[Identifier := 1].
^ self basicNew initialize
! !
@@ -2420,18 +2420,18 @@
val := 0.
self name from:anIndex do:[:c|
- c isDigit ifTrue:[val := val * 10 + c digitValue]
- ifFalse:[^ 0]
+ c isDigit ifTrue:[val := val * 10 + c digitValue]
+ ifFalse:[^ 0]
].
^ val
-
+
! !
!UIPainterView::ViewProperty methodsFor:'spec messages'!
doesNotUnderstand:aMessage
spec notNil ifTrue:[
- (spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec]
+ (spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec]
].
^ nil
!