UIPainterView.st
changeset 858 6b2e9e31cf06
parent 796 05b2883a23b0
child 886 3c67610b9631
equal deleted inserted replaced
857:eabfba82d601 858:6b2e9e31cf06
   642       '    ].\' ,
   642       '    ].\' ,
   643       '    ^ holder\' ,
   643       '    ^ holder\' ,
   644       '!! !!\\') withCRs.
   644       '!! !!\\') withCRs.
   645     ^ code
   645     ^ code
   646 
   646 
   647     "Modified: / 26.10.1997 / 19:01:15 / cg"
   647     "Modified: / 5.6.1998 / 01:17:41 / cg"
   648 !
   648 !
   649 
   649 
   650 generateAspectMethods
   650 generateAspectMethods
   651     "generate aspect, action & menu methods
   651     "generate aspect, action & menu methods
   652      - but do not overwrite existing ones.
   652      - but do not overwrite existing ones.
   653      Return a string ready to compile into the application class."
   653      Return a string ready to compile into the application class."
   654 
   654 
   655     |cls code skip menuSelector protoSpec thisCode|
   655     |cls code skip menuSelector protoSpec thisCode
       
   656      definedMethodSelectors|
       
   657 
       
   658     definedMethodSelectors := IdentitySet new.
   656 
   659 
   657     code := ''.
   660     code := ''.
   658 
   661 
   659     className isNil ifTrue:[
   662     className isNil ifTrue:[
   660         self warn:'Set first the class!!'.
   663         self warn:'Set first the class!!'.
   672         protoSpec := aProp spec.
   675         protoSpec := aProp spec.
   673 
   676 
   674         (modelSelector := aProp model) notNil ifTrue:[
   677         (modelSelector := aProp model) notNil ifTrue:[
   675             self generateCodeFrom:(Array with:modelSelector) in:cls
   678             self generateCodeFrom:(Array with:modelSelector) in:cls
   676                 do:[:aSel|
   679                 do:[:aSel|
       
   680                     |sym|
       
   681 
       
   682                     sym := aSel asSymbol.
   677                     skip := false.
   683                     skip := false.
   678 
   684 
   679                     (cls isSubclassOf:SimpleDialog) ifTrue:[
   685                     (cls isSubclassOf:SimpleDialog) ifTrue:[
   680                         skip := SimpleDialog implements:aSel asSymbol
   686                         skip := SimpleDialog implements:sym
       
   687                     ].
       
   688                     (definedMethodSelectors includes:sym) ifTrue:[
       
   689                         skip := true.
   681                     ].
   690                     ].
   682 
   691 
   683                     skip ifFalse:[
   692                     skip ifFalse:[
   684                         "/ kludge ..
   693                         "/ kludge ..
   685                         "/ (protoSpec isKindOf:ActionButtonSpec) 
   694                         "/ (protoSpec isKindOf:ActionButtonSpec) 
   687                         ifTrue:[
   696                         ifTrue:[
   688                             thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
   697                             thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
   689                         ] ifFalse:[
   698                         ] ifFalse:[
   690                             thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
   699                             thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
   691                         ].
   700                         ].
   692                         code := code, thisCode
   701                         code := code, thisCode.
       
   702                         definedMethodSelectors add:sym.
   693                     ]
   703                     ]
   694                 ]
   704                 ]
   695         ].
   705         ].
   696 
   706 
   697         self generateCodeFrom:(aProp spec aspectSelectors) in:cls
   707         self generateCodeFrom:(aProp spec aspectSelectors) in:cls
   698                 do:[:aSel|
   708                 do:[:aSel|
   699                     thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
   709                     |sym|
   700                     code := code , thisCode
   710 
       
   711                     sym := aSel asSymbol.
       
   712                     (definedMethodSelectors includes:sym) ifFalse:[
       
   713                         thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
       
   714                         code := code , thisCode.
       
   715                         definedMethodSelectors add:sym.
       
   716                     ]
   701                 ].
   717                 ].
   702 
   718 
   703         self generateCodeFrom:(aProp spec actionSelectors) in:cls
   719         self generateCodeFrom:(aProp spec actionSelectors) in:cls
   704                 do:[:aSel|
   720                 do:[:aSel|
   705                     thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
   721                     |sym|
   706                     code := code , thisCode
   722 
       
   723                     sym := aSel asSymbol.
       
   724                     (definedMethodSelectors includes:sym) ifFalse:[
       
   725                         thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
       
   726                         code := code , thisCode.
       
   727                         definedMethodSelectors add:sym.
       
   728                     ]
   707                 ].
   729                 ].
   708 
   730 
   709         self generateCodeFrom:(aProp spec valueSelectors) in:cls
   731         self generateCodeFrom:(aProp spec valueSelectors) in:cls
   710                 do:[:aSel|
   732                 do:[:aSel|
   711                  "/ uppercase: - assume its a globals name.
   733                     |sym|
   712                     aSel first isUppercase ifFalse:[
   734 
   713                         thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
   735                     sym := aSel asSymbol.
   714                         code := code , thisCode
   736                     (definedMethodSelectors includes:sym) ifFalse:[
       
   737                         "/ uppercase: - assume its a globals name.
       
   738                         aSel first isUppercase ifFalse:[
       
   739                             thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
       
   740                             code := code , thisCode.
       
   741                             definedMethodSelectors add:sym.
       
   742                         ]
   715                     ]
   743                     ]
   716                 ].
   744                 ].
   717     ].
   745     ].
   718 
   746 
   719     ^ code
   747     ^ code
   720 
   748 
   721     "Modified: / 21.4.1998 / 20:23:48 / cg"
   749     "Modified: / 5.6.1998 / 01:21:35 / cg"
   722 !
   750 !
   723 
   751 
   724 generateCodeFrom:aListOfSelectors in:aClass do:aBlock
   752 generateCodeFrom:aListOfSelectors in:aClass do:aBlock
   725 
   753 
   726     self class redefineAspectMethods ifTrue:[
   754     self class redefineAspectMethods ifTrue:[