UIPainter.st
changeset 2001 b12d9b4dd6f2
parent 1994 afcf20d971e0
child 2007 77cf7ecc9ecf
equal deleted inserted replaced
2000:345bb527e187 2001:b12d9b4dd6f2
  1096               level: 1
  1096               level: 1
  1097               tabable: true
  1097               tabable: true
  1098               menu: menuToolbar
  1098               menu: menuToolbar
  1099             )
  1099             )
  1100            (VariableHorizontalPanelSpec
  1100            (VariableHorizontalPanelSpec
  1101               name: 'hpanel'
  1101               name: 'mainPanel'
  1102               layout: (LayoutFrame 0 0.0 32 0.0 0 1.0 -24 1.0)
  1102               layout: (LayoutFrame 0 0.0 32 0.0 0 1.0 -24 1.0)
  1103               level: 1
  1103               level: 1
  1104               component: 
  1104               component: 
  1105              (SpecCollection
  1105              (SpecCollection
  1106                 collection: (
  1106                 collection: (
  2903 defaultInfoLabel
  2903 defaultInfoLabel
  2904     "returns the default info label"
  2904     "returns the default info label"
  2905 
  2905 
  2906     specClassName isNil ifTrue: [^'No class and selector defined.'].
  2906     specClassName isNil ifTrue: [^'No class and selector defined.'].
  2907     specSelector isNil ifTrue: [^'No selector defined.'].
  2907     specSelector isNil ifTrue: [^'No selector defined.'].
  2908     ^specClassName printString, ' >> ', specSelector
  2908     ^ specClassName printString, ' >> ', specSelector
  2909 
  2909 
  2910     "Modified: / 20.6.1998 / 16:49:16 / cg"
  2910     "Modified: / 20.6.1998 / 16:49:16 / cg"
  2911 ! !
  2911 ! !
  2912 
  2912 
  2913 !UIPainter methodsFor:'help spec'!
  2913 !UIPainter methodsFor:'help spec'!
  3069         self warn:'A global named ' , specClassName , ' exists, but it is no class.'.
  3069         self warn:'A global named ' , specClassName , ' exists, but it is no class.'.
  3070         ^ false.
  3070         ^ false.
  3071     ].
  3071     ].
  3072 
  3072 
  3073     specSuperclassName isBehavior ifFalse:[
  3073     specSuperclassName isBehavior ifFalse:[
  3074         specSuperclassName isEmpty ifFalse:[
  3074         specSuperclassName notEmptyOrNil ifTrue:[
  3075             superclass := self resolveName:specSuperclassName
  3075             superclass := self resolveName:specSuperclassName
  3076         ] ifTrue:[
  3076         ] ifFalse:[
  3077             specSuperclassName := nil.
  3077             specSuperclassName := nil.
  3078         ]
  3078         ]
  3079     ] ifTrue:[
  3079     ] ifTrue:[
  3080         superclass := specSuperclassName
  3080         superclass := specSuperclassName
  3081     ].
  3081     ].
  3522     self autoAcceptOnSelectionChange addDependent:self.
  3522     self autoAcceptOnSelectionChange addDependent:self.
  3523     self autoAcceptOnSelectionChange value ifTrue:[
  3523     self autoAcceptOnSelectionChange value ifTrue:[
  3524         (builder componentAt:'acceptButton') label:(resources string:'Apply')
  3524         (builder componentAt:'acceptButton') label:(resources string:'Apply')
  3525     ].
  3525     ].
  3526 
  3526 
       
  3527     self updateInfoLabel.
  3527     "Modified: / 22.8.1998 / 17:41:34 / cg"
  3528     "Modified: / 22.8.1998 / 17:41:34 / cg"
  3528 !
  3529 !
  3529 
  3530 
  3530 initialize
  3531 initialize
  3531     super initialize.
  3532     super initialize.
  3668     "Modified: / 21.8.1998 / 20:59:15 / cg"
  3669     "Modified: / 21.8.1998 / 20:59:15 / cg"
  3669 !
  3670 !
  3670 
  3671 
  3671 postBuildWith: aBuilder
  3672 postBuildWith: aBuilder
  3672     super postBuildWith:aBuilder.
  3673     super postBuildWith:aBuilder.
  3673 
       
  3674     specSelector := nil.
       
  3675     specClassName    := nil.
       
  3676 
  3674 
  3677     self setupPainter.
  3675     self setupPainter.
  3678 
  3676 
  3679     "Modified: / 22.8.1998 / 17:41:34 / cg"
  3677     "Modified: / 22.8.1998 / 17:41:34 / cg"
  3680 !
  3678 !
  4245 !
  4243 !
  4246 
  4244 
  4247 doSave
  4245 doSave
  4248     "saves the window spec"
  4246     "saves the window spec"
  4249     
  4247     
  4250     |code painter|
  4248     |code painter specClass|
  4251 
  4249 
  4252     self askForSectionModification.
  4250     self askForSectionModification.
  4253     self hasSpecClassAndSelector ifFalse:[
  4251     self hasSpecClassAndSelector ifFalse:[
  4254         self doDefineClassAndSelector isNil ifTrue:[
  4252         self doDefineClassAndSelector isNil ifTrue:[
  4255             ^ nil
  4253             ^ nil
  4256         ]
  4254         ]
  4257     ].
  4255     ].
  4258     
  4256 
  4259     (specClassName notNil and:[ specClassName isClass ]) ifFalse:[
  4257     specClass := self resolveName:specClassName.
       
  4258     (specClass notNil and:[ specClass isClass ]) ifFalse:[
  4260         self warn:('Oops - cannot save - class not found: ' , specClassName).
  4259         self warn:('Oops - cannot save - class not found: ' , specClassName).
  4261         ^ nil
  4260         ^ nil
  4262     ].
  4261     ].
       
  4262 
  4263     painter := self painter.
  4263     painter := self painter.
  4264     painter 
  4264     painter 
  4265         class:specClassName
  4265         class:specClass
  4266         superclassName:specSuperclassName
  4266         superclassName:specSuperclassName
  4267         selector:specSelector.
  4267         selector:specSelector.
  4268 
  4268 
  4269 "/    Transcript showCR:'generating windowSpec code...'.
  4269 "/    Transcript showCR:'generating windowSpec code...'.
  4270 
  4270 
  4280     self doGenerateAspectSelectorsMethod.
  4280     self doGenerateAspectSelectorsMethod.
  4281     self helpTool doSave.
  4281     self helpTool doSave.
  4282     self updateInfoLabel.
  4282     self updateInfoLabel.
  4283     modified := false.
  4283     modified := false.
  4284     painter resetModification.
  4284     painter resetModification.
  4285     (specClassName respondsTo:specSelector) ifTrue:[
  4285     (specClass respondsTo:specSelector) ifTrue:[
  4286         self addHistoryEntryForClass:specClassName selector:specSelector.
  4286         self addHistoryEntryForClass:specClass selector:specSelector.
  4287     ].
  4287     ].
  4288 !
  4288 !
  4289 
  4289 
  4290 doSaveAs
  4290 doSaveAs
  4291     "opens a ResourceSelectionBrowser for saving the window spec on a class"
  4291     "opens a ResourceSelectionBrowser for saving the window spec on a class"