# HG changeset patch # User Claus Gittinger # Date 966526707 -7200 # Node ID 97a7eeabae40e3d6093dbb030bd5085ce84982b3 # Parent c4a11a7d407fd0e26c3f524267a461aec4d8572c overwriting existing method check (in #defineClass & selector); correctly set initial label & name for new applications diff -r c4a11a7d407f -r 97a7eeabae40 UIPainter.st --- a/UIPainter.st Wed Aug 16 19:25:32 2000 +0200 +++ b/UIPainter.st Thu Aug 17 17:38:27 2000 +0200 @@ -2886,16 +2886,25 @@ openInterface:aSymbol "opens the interface on the selector aSymbol" - |cls painterView painter topView galleryWindow icon| + |cls painterView painter topView galleryWindow icon name| modified := false. aspects := IdentityDictionary new. + specClass notNil ifTrue:[ + specClass isBehavior ifTrue:[ + name := specClass nameWithoutPrefix. + ] ifFalse:[ + name := specClass printString string + ] + ]. + aspects at:#classNameChannel put:( (specClass notNil ifTrue:[specClass] ifFalse:['NewApplication']) asValue ). + specSuperclass isNil ifTrue:[ specClass notNil ifTrue:[ (cls := self resolveName:specClass) notNil ifTrue:[ @@ -2917,14 +2926,15 @@ treeView := TreeView new. painterView := StandardSystemView new. - painterView name: self class defaultNameOfCanvas. - painterView label: self class defaultNameOfCanvas. + + painterView name: name. + painterView label: name. painterView extent:300@300. painter := UIPainterView in:painterView. painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout. - treeView := treeView canvas:painter. + treeView := treeView canvas:painter specName:name. painter treeView:treeView. treeView model addDependent:self. @@ -2959,7 +2969,6 @@ galleryWindow icon:icon. painterView topView raise. - ! openOnClass:aClass @@ -3230,10 +3239,19 @@ self painter className:specClass superclassName:specSuperclass selector:specSelector. - ] - ] - ifFalse: - [ + ]. + + again ifFalse:[ + ((Smalltalk at:specClass asSymbol) notNil + and:[ (Smalltalk at:specClass asSymbol) class implements:specSelector ]) + ifTrue:[ + (self confirm:('%1 already implements %2. Overwrite ?' bindWith:specClass with:specSelector)) + ifFalse:[ + again := true. + ]. + ]. + ]. + ] ifFalse: [ ^nil ] @@ -3666,6 +3684,19 @@ ! +canvas:aCanvas specName:nameOfSpec + "install canvas (UIPainterView)" + + |props| + + props := UIPainterView::ViewProperty new. + props view:aCanvas. + model root:(TreeItem name:nameOfSpec asBoldText contents:props). + model root expand. + self enableChannel:(aCanvas enableChannel). + +! + canvasSpec "returns spec assigned to canvas"