# HG changeset patch # User Claus Gittinger # Date 1203323873 -3600 # Node ID 485bda17023f064860e8c31fdda75e61ec98ae1c # Parent b0f6890e73cf74ce54164f95894d75350806f260 more changes to allow for non-class/selector (i.e. spec-only) use diff -r b0f6890e73cf -r 485bda17023f UIPainterView.st --- a/UIPainterView.st Mon Feb 11 15:21:58 2008 +0100 +++ b/UIPainterView.st Mon Feb 18 09:37:53 2008 +0100 @@ -14,7 +14,7 @@ UIObjectView subclass:#UIPainterView instanceVariableNames:'treeView listHolder superclassName className methodName categoryName handleColorBlack handleColorWhite handleMasterColor - sketchPainter' + sketchPainter listOfAspectsHolder' classVariableNames:'HandCursor RedefineAspectMethods AspectsAsInstances GenerateCommentedCode' poolDictionaries:'' @@ -170,6 +170,10 @@ methodName := aSelector. ! +listOfAspectsHolder:something + listOfAspectsHolder := something. +! + methodName ^ methodName ! @@ -424,6 +428,8 @@ (self canPaste:aSpecificationOrList into:containerToPasteInto) "(self canPaste:aSpecificationOrList)" ifFalse:[ +self halt. +(self canPaste:aSpecificationOrList into:containerToPasteInto). Dialog warn:'Cannot paste into selected component (not a container ?)'. ^ nil ]. @@ -611,23 +617,19 @@ canPaste:something into:containerToPasteInto "returns true if something could be pasted" - |el size| - - ((size := self numberOfSelections) <= 1 and:[self enabled]) ifFalse:[ + (self enabled) ifFalse:[ ^ false ]. - something isCollection - ifTrue:[something notEmpty ifTrue:[el := something first]] - ifFalse:[el := something]. - - (el isKindOf:UISpecification) ifFalse:[ + something isCollection ifTrue:[ + something isEmpty ifTrue:[ ^ false]. + ^ something conform:[:el | (self canPaste:el into:containerToPasteInto)] + ]. + + (something isKindOf:UISpecification) ifFalse:[ ^ false ]. - size == 1 ifTrue:[ - ^ self canPasteInto:containerToPasteInto - ]. - ^ true + ^ self canPasteInto:containerToPasteInto ! canPasteInto:aView @@ -1454,23 +1456,23 @@ |cls code menuSelector thisCode definedMethodSelectors - specArray fullSpec winSpec menuSpec - | + spec specArray fullSpec winSpec menuSpec| cls := self targetClass. cls isNil ifTrue:[ - ^ nil + ^ nil ]. - specArray := treeView generateFullSpecForComponents:#() named:nil. + spec := treeView generateFullSpecForComponents:#() named:nil. + specArray := spec literalArrayEncoding. fullSpec := specArray decodeAsLiteralArray. winSpec := fullSpec window. menuSelector := winSpec menu. (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. @@ -1479,24 +1481,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 @@ -1548,12 +1550,13 @@ ! generateWindowSpecMethodSource - |spec str code category cls mthd specCode| + |spec specArray str code category cls mthd specCode| spec := self generateWindowSpec. + specArray := spec literalArrayEncoding. str := WriteStream on:String new. - UISpecification prettyPrintSpecArray:spec on:str indent:5. + UISpecification prettyPrintSpecArray:specArray on:str indent:5. specCode := str contents. (specCode includes:$!!) ifTrue:[ @@ -1610,6 +1613,10 @@ listOfAspects |cls aspects| + listOfAspectsHolder notNil ifTrue:[ + ^ listOfAspectsHolder value + ]. + aspects := IdentitySet new. cls := self targetClass. @@ -1971,6 +1978,14 @@ !UIPainterView methodsFor:'queries'! +isEditingSpecOnly + self halt. +! + +isNotEditingSpecOnly + self halt. +! + resolveName:aName |appl|