diff -r 056c9fe74cc6 -r 053e2d3089b7 UIPainterView.st --- a/UIPainterView.st Sun Sep 07 08:12:32 1997 +0200 +++ b/UIPainterView.st Wed Sep 10 10:33:05 1997 +0200 @@ -454,7 +454,7 @@ ! generateAspectMethods - |cls code skip| + |cls code skip modelSelector menuSelector menuPerformer protoSpec thisCode| code := ''. @@ -464,9 +464,7 @@ ]. cls := Smalltalk classNamed:className. - treeView propertiesDo:[:aProp | - |modelSelector menuSelector protoSpec thisCode| - + treeView propertiesDo:[:aProp| protoSpec := aProp spec. (modelSelector := aProp model) notNil ifTrue:[ @@ -488,8 +486,8 @@ ]. (menuSelector := aProp menu) notNil ifTrue:[ - (cls implements:menuSelector asSymbol) ifFalse:[ - thisCode := (self generateAspectMethodFor:menuSelector spec:protoSpec inClass:cls). + thisCode := self generateMenuMethodFor:menuSelector spec:protoSpec inClass:cls. + thisCode size ~~ 0 ifTrue:[ code := code , thisCode ] ]. @@ -511,10 +509,60 @@ thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls). code := code , thisCode ] - ]. + ] + ]. + + protoSpec := treeView canvasSpec. + + (menuSelector := protoSpec menu) notNil ifTrue:[ + thisCode := self generateMenuMethodFor:menuSelector spec:protoSpec inClass:cls. + thisCode size ~~ 0 ifTrue:[ + code := code , thisCode + ] + ]. + + + ^ code +! + +generateMenuMethodFor:aspect spec:protoSpec inClass:aClass + |code cperf performer category| + + (aClass implements:aspect asSymbol) ifFalse:[ + code := MenuEditor generateCodeFor:aClass menuSelector:(aspect asSymbol). + ] ifTrue:[ + code := '' + ]. + (protoSpec respondsTo:#menuPerformer) ifTrue:[ + performer := protoSpec menuPerformer. ]. - ^ code + performer notNil ifTrue:[ + performer := performer asSymbol. + + (aClass implements:performer) ifFalse:[ + category := MenuEditor sourceCategory. + + cperf := Character excla asString + , aClass name , ' methodsFor:' , category storeString + , Character excla asString , '\\' + , performer , '\' + , ' "this window spec was automatically generated by the UI Builder"\\' + , ' ^ self\\' + , '\' + , Character excla asString + , ' ' + , Character excla asString + , '\\'. + + code := code, cperf. + ] + ]. + + code size == 0 ifTrue:[ + ^ nil + ]. + ^ code withCRs ! generateValueMethodFor:aspect spec:protoSpec inClass:targetClass