UIPainterView.st
changeset 1554 d5e4612bf7cf
parent 1543 09c4ed98434d
child 1568 a9d61da29e8b
equal deleted inserted replaced
1553:1d7fd5dde600 1554:d5e4612bf7cf
   586         |selector|
   586         |selector|
   587 
   587 
   588         (selector := aProp model) notNil ifTrue:[
   588         (selector := aProp model) notNil ifTrue:[
   589             selector isArray ifFalse:[
   589             selector isArray ifFalse:[
   590                 selector := selector asSymbol.
   590                 selector := selector asSymbol.
   591                 (cls implements:selector) ifTrue:[
   591                 (cls includesSelector:selector) ifTrue:[
   592                     skip := false.
   592                     skip := false.
   593                     (cls isSubclassOf:SimpleDialog) ifTrue:[
   593                     (cls isSubclassOf:SimpleDialog) ifTrue:[
   594                         skip := SimpleDialog implements:selector asSymbol
   594                         skip := SimpleDialog includesSelector:selector asSymbol
   595                     ].
   595                     ].
   596                     skip ifFalse:[
   596                     skip ifFalse:[
   597                         methods add:(cls compiledMethodAt:selector)
   597                         methods add:(cls compiledMethodAt:selector)
   598                     ].
   598                     ].
   599                 ].
   599                 ].
   601         ].
   601         ].
   602 
   602 
   603         (selector := aProp menu) notNil ifTrue:[
   603         (selector := aProp menu) notNil ifTrue:[
   604             selector isArray ifFalse:[
   604             selector isArray ifFalse:[
   605                 selector := selector asSymbol.
   605                 selector := selector asSymbol.
   606                 (cls implements:selector) ifTrue:[
   606                 (cls includesSelector:selector) ifTrue:[
   607                     methods add:(cls compiledMethodAt:selector)
   607                     methods add:(cls compiledMethodAt:selector)
   608                 ]
   608                 ]
   609             ].
   609             ].
   610         ].
   610         ].
   611 
   611 
   612         (aProp spec aspectSelectors) do:[:aSel |
   612         (aProp spec aspectSelectors) do:[:aSel |
   613             |selector|
   613             |selector|
   614 
   614 
   615             aSel isArray ifFalse:[
   615             aSel isArray ifFalse:[
   616                 selector := aSel asSymbol.
   616                 selector := aSel asSymbol.
   617                 (cls implements:selector) ifTrue:[
   617                 (cls includesSelector:selector) ifTrue:[
   618                     methods add:(cls compiledMethodAt:selector)
   618                     methods add:(cls compiledMethodAt:selector)
   619                 ]
   619                 ]
   620             ].
   620             ].
   621         ].
   621         ].
   622         aProp spec actionSelectors do:[:aSel|
   622         aProp spec actionSelectors do:[:aSel|
   623             |selector|
   623             |selector|
   624 
   624 
   625             aSel isArray ifFalse:[
   625             aSel isArray ifFalse:[
   626                 selector := aSel asSymbol.
   626                 selector := aSel asSymbol.
   627                 (cls implements:selector) ifTrue:[
   627                 (cls includesSelector:selector) ifTrue:[
   628                     methods add:(cls compiledMethodAt:selector)
   628                     methods add:(cls compiledMethodAt:selector)
   629                 ]
   629                 ]
   630             ].
   630             ].
   631         ].
   631         ].
   632         aProp spec valueSelectors do:[:aSel|
   632         aProp spec valueSelectors do:[:aSel|
   633             |selector|
   633             |selector|
   634 
   634 
   635             aSel isArray ifFalse:[
   635             aSel isArray ifFalse:[
   636                 selector := aSel asSymbol.
   636                 selector := aSel asSymbol.
   637                 (cls implements:selector) ifTrue:[
   637                 (cls includesSelector:selector) ifTrue:[
   638                     methods add:(cls compiledMethodAt:selector)
   638                     methods add:(cls compiledMethodAt:selector)
   639                 ]
   639                 ]
   640             ].
   640             ].
   641         ]
   641         ]
   642     ].
   642     ].
   644     protoSpec := treeView canvasSpec.
   644     protoSpec := treeView canvasSpec.
   645 
   645 
   646     (selector := protoSpec menu) notNil ifTrue:[
   646     (selector := protoSpec menu) notNil ifTrue:[
   647         selector isArray ifFalse:[
   647         selector isArray ifFalse:[
   648             selector := selector asSymbol.
   648             selector := selector asSymbol.
   649             (cls implements:selector) ifTrue:[
   649             (cls includesSelector:selector) ifTrue:[
   650                 methods add:(cls compiledMethodAt:selector)
   650                 methods add:(cls compiledMethodAt:selector)
   651             ]
   651             ]
   652         ].
   652         ].
   653     ].
   653     ].
   654 
   654 
   819 
   819 
   820                     sym := aSel asSymbol.
   820                     sym := aSel asSymbol.
   821                     skip := false.
   821                     skip := false.
   822 
   822 
   823                     (cls isSubclassOf:SimpleDialog) ifTrue:[
   823                     (cls isSubclassOf:SimpleDialog) ifTrue:[
   824                         skip := SimpleDialog implements:sym
   824                         skip := SimpleDialog includesSelector:sym
   825                     ].
   825                     ].
   826                     (definedMethodSelectors includes:sym) ifTrue:[
   826                     (definedMethodSelectors includes:sym) ifTrue:[
   827                         skip := true.
   827                         skip := true.
   828                     ].
   828                     ].
   829 
   829 
  1017 
  1017 
  1018 generateCodeFrom:aListOfSelectors in:aClass do:aBlock
  1018 generateCodeFrom:aListOfSelectors in:aClass do:aBlock
  1019 
  1019 
  1020     self class redefineAspectMethods ifTrue:[
  1020     self class redefineAspectMethods ifTrue:[
  1021         aListOfSelectors do:[:aSelector|
  1021         aListOfSelectors do:[:aSelector|
  1022             (aSelector isArray or:[aClass implements:aSelector]) ifFalse:[
  1022             (aSelector isArray or:[aClass includesSelector:aSelector]) ifFalse:[
  1023                 aBlock value:aSelector
  1023                 aBlock value:aSelector
  1024             ] ifTrue:[
  1024             ] ifTrue:[
  1025                 Transcript showCR:'#' , aSelector , ' skipped - already implemented in the class'
  1025                 Transcript showCR:'#' , aSelector , ' skipped - already implemented in the class'
  1026             ]
  1026             ]
  1027         ]
  1027         ]
  1034                     Transcript showCR:'#' , aSelector , ' skipped - already implemented in the class (or superclass)'
  1034                     Transcript showCR:'#' , aSelector , ' skipped - already implemented in the class (or superclass)'
  1035                 ]
  1035                 ]
  1036             ]
  1036             ]
  1037         ]
  1037         ]
  1038     ]
  1038     ]
  1039 
       
  1040 
       
  1041 !
  1039 !
  1042 
  1040 
  1043 generateHookMethodFor:selectorSpec comment:commentWhen note:noteOrNil defaultCode:defaultCode inClass:targetClass
  1041 generateHookMethodFor:selectorSpec comment:commentWhen note:noteOrNil defaultCode:defaultCode inClass:targetClass
  1044     ^ ('!!' , targetClass name , ' methodsFor:''hooks''!!\\' ,
  1042     ^ ('!!' , targetClass name , ' methodsFor:''hooks''!!\\' ,
  1045       selectorSpec , '\' ,
  1043       selectorSpec , '\' ,
  1084 generateHookMethodsInClass:targetClass
  1082 generateHookMethodsInClass:targetClass
  1085     |code|
  1083     |code|
  1086 
  1084 
  1087     code := ''.
  1085     code := ''.
  1088 
  1086 
  1089     (targetClass implements:#postBuildWith:) ifFalse:[
  1087     (targetClass includesSelector:#postBuildWith:) ifFalse:[
  1090         code := code 
  1088         code := code 
  1091                 , (self 
  1089                 , (self 
  1092                     generateHookMethodFor:'postBuildWith:aBuilder'
  1090                     generateHookMethodFor:'postBuildWith:aBuilder'
  1093                     comment:'the widgets have been built, but before the view is opened'
  1091                     comment:'the widgets have been built, but before the view is opened'
  1094                     note:'or after the super send'
  1092                     note:'or after the super send'
  1095                     defaultCode:'    super postBuildWith:aBuilder'
  1093                     defaultCode:'    super postBuildWith:aBuilder'
  1096                     inClass:targetClass)
  1094                     inClass:targetClass)
  1097     ].
  1095     ].
  1098     (targetClass implements:#postOpenWith:) ifFalse:[
  1096     (targetClass includesSelector:#postOpenWith:) ifFalse:[
  1099         code := code 
  1097         code := code 
  1100                 , (self 
  1098                 , (self 
  1101                     generateHookMethodFor:'postOpenWith:aBuilder'
  1099                     generateHookMethodFor:'postOpenWith:aBuilder'
  1102                     comment:'the topView has been opened, but before events are dispatched for it'
  1100                     comment:'the topView has been opened, but before events are dispatched for it'
  1103                     note:'or after the super send'
  1101                     note:'or after the super send'
  1104                     defaultCode:'    super postOpenWith:aBuilder'
  1102                     defaultCode:'    super postOpenWith:aBuilder'
  1105                     inClass:targetClass)
  1103                     inClass:targetClass)
  1106     ].
  1104     ].
  1107     (targetClass implements:#closeRequest) ifFalse:[
  1105     (targetClass includesSelector:#closeRequest) ifFalse:[
  1108         code := code 
  1106         code := code 
  1109                 , (self 
  1107                 , (self 
  1110                     generateHookMethodFor:'closeRequest'
  1108                     generateHookMethodFor:'closeRequest'
  1111                     comment:'the topView has been asked to close'
  1109                     comment:'the topView has been asked to close'
  1112                     note:'return without the ''super closeRequest'' to stay open'
  1110                     note:'return without the ''super closeRequest'' to stay open'