# HG changeset patch # User Claus Gittinger # Date 1086775384 -7200 # Node ID 410f98d259b7606a94fd47b4ce5b0afbdd28f6a4 # Parent 1209223c6d306a156c5531eff85416f66de55681 kludge to raise the ui-painters control window diff -r 1209223c6d30 -r 410f98d259b7 UIPainter.st --- a/UIPainter.st Mon Jun 07 16:44:47 2004 +0200 +++ b/UIPainter.st Wed Jun 09 12:03:04 2004 +0200 @@ -3158,15 +3158,13 @@ ] ! -openInterface:aSymbol +openInterface:aSymbol "opens the interface on the selector aSymbol" - + |cls painterView painter topView galleryWindow icon name| modified := false. - aspects := IdentityDictionary new. - specClass notNil ifTrue:[ specClass isBehavior ifTrue:[ name := specClass nameWithoutPrefix. @@ -3174,12 +3172,9 @@ name := specClass printString string ] ]. - - aspects at:#classNameChannel put:( - (specClass notNil ifTrue:[specClass] - ifFalse:['NewApplication']) asValue - ). - + aspects at:#classNameChannel + put:((specClass notNil ifTrue:[ specClass ] ifFalse:[ 'NewApplication' ]) + asValue). specSuperclass isNil ifTrue:[ specClass notNil ifTrue:[ (cls := self resolveName:specClass) notNil ifTrue:[ @@ -3187,67 +3182,57 @@ ] ] ]. - aspects at:#superclassNameChannel put:( - (specSuperclass notNil ifTrue:[specSuperclass] - ifFalse:['ApplicationModel']) asValue - ). - aspects at:#superclassNameDefaults put:#('ApplicationModel' 'SimpleDialog') asValue. - aspects at:#methodNameChannel put:( - (specSelector notNil ifTrue:[specSelector asValue] - ifFalse:[#windowSpec]) asValue - ). - - "/ the canvas ... - - treeView := TreeView new. + aspects at:#superclassNameChannel + put:((specSuperclass notNil + ifTrue:[ specSuperclass ] + ifFalse:[ 'ApplicationModel' ]) asValue). + aspects at:#superclassNameDefaults + put:#( 'ApplicationModel' 'SimpleDialog' ) asValue. + aspects at:#methodNameChannel + put:((specSelector notNil + ifTrue:[ specSelector asValue ] + ifFalse:[ #windowSpec ]) asValue). + treeView := TreeView new. treeView windowSpecClass:(self defaultWindowSpecClass). - treeView selectConditionBlock:[:newSelection | self selectionChangeAllowed:newSelection]. - + treeView + selectConditionBlock:[:newSelection | self selectionChangeAllowed:newSelection ]. painterView := StandardSystemView new. - name := name ? UIPainter defaultNameOfCanvas. - - painterView name: name. - painterView label: name. - painterView extent:(treeView windowSpecClass defaultExtentInUIPainter). "/ 300@300. - + painterView name:name. + painterView label:name. + painterView extent:(treeView windowSpecClass defaultExtentInUIPainter). painter := UIPainterView in:painterView. painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout. - treeView := treeView canvas:painter specName:name. painter treeView:treeView. treeView model addDependent:self. - super openInterface:aSymbol. - topView := self window. topView label:'GUI Painter'. - painterView openInGroup:(topView windowGroup). painterView application:self. - - "/ the selectionPanel ... - selectionPanel := self selectionPanelClass new. selectionPanel allButOpenInterface:#windowSpec. - (galleryWindow := selectionPanel window) openInGroup:(topView windowGroup). + (galleryWindow := selectionPanel window) + openInGroup:(topView windowGroup). selectionPanel masterApplication:self. - icon := Smalltalk imageFromFileNamed:'UIPainter.xbm' forClass:self class. topView iconLabel:'GUI Painter'. topView icon:icon. - painterView iconLabel:'GUI Canvas'. painterView icon:icon. - + +"/ painterView topView raise. topView bePartner. painterView bePartner. galleryWindow bePartner. - galleryWindow iconLabel:'GUI Gallery'. galleryWindow icon:icon. - painterView topView raise. + selectionPanel window waitUntilVisible. + painterView window waitUntilVisible. + self window waitUntilVisible. + [ Delay waitForSeconds:0.5. self window topView raise ] fork. ! openOnClass:aClass @@ -3859,20 +3844,16 @@ doSave "saves the window spec" - + |code painter cls| self askForSectionModification. - self hasSpecClassAndSelector ifFalse:[ - self doDefineClassAndSelector isNil ifTrue: [^nil] + self doDefineClassAndSelector isNil ifTrue:[ + ^ nil + ] ]. - - (specClass notNil and: [(cls := Smalltalk at: specClass asSymbol) isClass]) ifFalse:[ - self warn:('Oops - cannot save - class not found: ' , specClass). - ^nil - ]. - + "/ specClass notNil ifTrue:[ "/ (specClass includes:$:) ifFalse:[ "/ (ns := Smalltalk defaultNameSpace) notNil ifTrue:[ @@ -3898,26 +3879,28 @@ "/ ] ifFalse:[ "/ specClass := cls name. "/ ]. - + (specClass notNil + and:[ (cls := Smalltalk at:specClass asSymbol) isClass ]) + ifFalse:[ + self warn:('Oops - cannot save - class not found: ' , specClass). + ^ nil + ]. painter := self painter. painter className:specClass superclassName:specSuperclass selector:specSelector. - +self halt. Transcript showCR:'generating windowSpec code...'. - code := painter generateWindowSpecMethodSource withCRs. (ReadStream on:code) fileIn. - self doGenerateAspectSelectorsMethod. self helpTool doSave. self updateInfoLabel. - modified := false. painter resetModification. - (cls class includesSelector: specSelector) ifTrue:[ - self addToHistory: (specClass, ' ', specSelector) -> #loadFromMessage:. + (cls class includesSelector:specSelector) ifTrue:[ + self addToHistory:(specClass , ' ' , specSelector) -> #loadFromMessage:. ]. !