UIPainter.st
changeset 2072 0b0a24d7b198
parent 2040 2df23da6484a
child 2077 bf7f7207fa07
equal deleted inserted replaced
2071:54af4d66b0fa 2072:0b0a24d7b198
  2457 
  2457 
  2458         helpTool := UIHelpTool new.
  2458         helpTool := UIHelpTool new.
  2459         applBuilder := helpTool builder.
  2459         applBuilder := helpTool builder.
  2460         applWindow  := ApplicationSubView origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  2460         applWindow  := ApplicationSubView origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  2461         applWindow level:0.
  2461         applWindow level:0.
  2462         helpTool loadFromClass:specClassName.
  2462         helpTool loadFromClass:specClass.
  2463         helpTool masterApplication:self.
  2463         helpTool masterApplication:self.
  2464         applBuilder window:applWindow.
  2464         applBuilder window:applWindow.
  2465         applWindow client:helpTool spec:#innerSpec builder:applBuilder.
  2465         applWindow client:helpTool spec:#innerSpec builder:applBuilder.
  2466         applBuilder window:applWindow.
  2466         applBuilder window:applWindow.
  2467         helpTool modifiedHolder:modifiedChannel.
  2467         helpTool modifiedHolder:modifiedChannel.
  2478         applBuilder window:applWindow.
  2478         applBuilder window:applWindow.
  2479 
  2479 
  2480         specTool modifiedHolder:modifiedChannel.
  2480         specTool modifiedHolder:modifiedChannel.
  2481     ].
  2481     ].
  2482     ^ noteBook
  2482     ^ noteBook
       
  2483 
       
  2484     "Modified: / 31-08-2006 / 10:11:15 / cg"
  2483 !
  2485 !
  2484 
  2486 
  2485 painterShown
  2487 painterShown
  2486     "returns a boolean value holder which is set to true if the painter is shown"
  2488     "returns a boolean value holder which is set to true if the painter is shown"
  2487 
  2489 
  2921 !UIPainter methodsFor:'help'!
  2923 !UIPainter methodsFor:'help'!
  2922 
  2924 
  2923 defaultInfoLabel
  2925 defaultInfoLabel
  2924     "returns the default info label"
  2926     "returns the default info label"
  2925 
  2927 
  2926     specClassName isNil ifTrue: [^'No class and selector defined.'].
  2928     specClassName isNil ifTrue: [^'No class defined.'].
  2927     specSelector isNil ifTrue: [^'No selector defined.'].
  2929     specSelector isNil ifTrue: [^'No selector defined.'].
  2928     ^ specClassName printString, ' >> ', specSelector
  2930     ^ specClassName printString, ' >> ', specSelector
  2929 
  2931 
  2930     "Modified: / 20.6.1998 / 16:49:16 / cg"
  2932     "Modified: / 31-08-2006 / 10:12:03 / cg"
  2931 ! !
  2933 ! !
  2932 
  2934 
  2933 !UIPainter methodsFor:'help spec'!
  2935 !UIPainter methodsFor:'help spec'!
  2934 
  2936 
  2935 flyByHelpSpec
  2937 flyByHelpSpec
  3212     self specClass:clsName.
  3214     self specClass:clsName.
  3213     specSelector := (selector ? '').
  3215     specSelector := (selector ? '').
  3214     specSuperclassName := superClassName.
  3216     specSuperclassName := superClassName.
  3215 
  3217 
  3216     (specClassName notNil and:[ selector notNil ]) ifTrue:[
  3218     (specClassName notNil and:[ selector notNil ]) ifTrue:[
  3217         self addHistoryEntryForClass:specClassName selector:specSelector.
  3219         self addHistoryEntryForClass:specClass selector:specSelector.
  3218         self updateInfoLabel
  3220         self updateInfoLabel
  3219     ].
  3221     ].
  3220 
  3222 
  3221     "Modified: / 5.2.1998 / 09:44:58 / stefan"
  3223     "Modified: / 05-02-1998 / 09:44:58 / stefan"
       
  3224     "Modified: / 31-08-2006 / 10:14:49 / cg"
  3222 !
  3225 !
  3223 
  3226 
  3224 setViewInLayoutTool:aView spec:aSpec
  3227 setViewInLayoutTool:aView spec:aSpec
  3225     "sets view for layout tool"
  3228     "sets view for layout tool"
  3226 
  3229 
  3231     ].
  3234     ].
  3232     self layoutTool layoutView:aView type:type spec:aSpec
  3235     self layoutTool layoutView:aView type:type spec:aSpec
  3233 
  3236 
  3234 !
  3237 !
  3235 
  3238 
       
  3239 specClass
       
  3240     specClass isNil ifTrue:[
       
  3241         specClassName notNil ifTrue:[
       
  3242             specClass := Smalltalk classNamed:specClassName.
       
  3243         ]
       
  3244     ].
       
  3245     ^ specClass
       
  3246 
       
  3247     "Created: / 31-08-2006 / 10:08:43 / cg"
       
  3248     "Modified: / 04-09-2006 / 10:39:21 / cg"
       
  3249 !
       
  3250 
  3236 specClass:aClassOrClassName
  3251 specClass:aClassOrClassName
  3237     "sets the specClass and updates the Help Tool"
  3252     "sets the specClass and updates the Help Tool"
  3238 
  3253 
  3239     aClassOrClassName isBehavior 
  3254     aClassOrClassName isBehavior 
  3240         ifTrue: [ specClassName := aClassOrClassName ]
  3255         ifTrue: [ specClass := aClassOrClassName.
  3241         ifFalse:[ specClassName := Smalltalk classNamed:aClassOrClassName ].
  3256                   specClassName := aClassOrClassName name ]
  3242 
  3257         ifFalse:[ specClass := Smalltalk classNamed:aClassOrClassName.
  3243     self helpTool loadFromClass:specClassName.    
  3258                   specClassName := aClassOrClassName ].
  3244     self clearModifiedFlag. 
  3259 
       
  3260     self helpTool loadFromClass:specClass.    
       
  3261     self clearModifiedFlag.
       
  3262 
       
  3263     "Modified: / 31-08-2006 / 10:10:22 / cg"
  3245 ! !
  3264 ! !
  3246 
  3265 
  3247 !UIPainter methodsFor:'private-tools'!
  3266 !UIPainter methodsFor:'private-tools'!
  3248 
  3267 
  3249 helpTool
  3268 helpTool
  3562     "sets the root of the tree view as first selection;
  3581     "sets the root of the tree view as first selection;
  3563      sets the grid parameters, if defined"
  3582      sets the grid parameters, if defined"
  3564 
  3583 
  3565     |cls sel|
  3584     |cls sel|
  3566 
  3585 
  3567     cls := specClassName.
  3586     cls := self specClass.
  3568     cls isString ifTrue:[
       
  3569         cls := Smalltalk at:(cls string asSymbol)
       
  3570     ].
       
  3571     sel := specSelector.
  3587     sel := specSelector.
  3572     cls notNil ifTrue:[
  3588     cls notNil ifTrue:[
  3573         self setClass:cls selector:sel.
  3589         self setClass:cls selector:sel.
  3574 
  3590 
  3575         (cls respondsTo:sel) ifTrue:[  
  3591         (cls respondsTo:sel) ifTrue:[  
  3588         (builder componentAt:#infoBarSubSpec) beInvisible
  3604         (builder componentAt:#infoBarSubSpec) beInvisible
  3589     ].
  3605     ].
  3590 
  3606 
  3591     self updateInfoLabel.
  3607     self updateInfoLabel.
  3592 
  3608 
  3593     "Modified: / 22.8.1998 / 17:41:34 / cg"
  3609     "Modified: / 31-08-2006 / 10:12:53 / cg"
  3594 !
  3610 !
  3595 
  3611 
  3596 loadFromClass:aClass andSelector:selector
  3612 loadFromClass:aClass andSelector:selector
  3597     "loads a window spec by evaluating aMessageString
  3613     "loads a window spec by evaluating aMessageString
  3598      (which is something like 'fooClass windowSpec')"
  3614      (which is something like 'fooClass windowSpec')"
  3622 openInterface:aSymbol 
  3638 openInterface:aSymbol 
  3623     "in addition to opening my interface, also open up a gallery and a painter"
  3639     "in addition to opening my interface, also open up a gallery and a painter"
  3624     
  3640     
  3625     |cls topView galleryWindow icon name|
  3641     |cls topView galleryWindow icon name|
  3626 
  3642 
  3627     specClassName notNil ifTrue:[
  3643     self specClass notNil ifTrue:[
  3628         specClassName isBehavior ifTrue:[
  3644         specClassName isBehavior ifTrue:[
  3629             name := specClassName nameWithoutPrefix.
  3645             name := specClassName nameWithoutPrefix.
  3630         ] ifFalse:[
  3646         ] ifFalse:[
  3631             name := specClassName printString string
  3647             name := specClassName printString string
  3632         ]
  3648         ]
  3698 
  3714 
  3699     selectionPanel window waitUntilVisible.
  3715     selectionPanel window waitUntilVisible.
  3700     painterView window waitUntilVisible.
  3716     painterView window waitUntilVisible.
  3701     self window waitUntilVisible.
  3717     self window waitUntilVisible.
  3702     [ Delay waitForSeconds:0.5. self window topView raise ] fork.
  3718     [ Delay waitForSeconds:0.5. self window topView raise ] fork.
       
  3719 
       
  3720     "Modified: / 31-08-2006 / 10:13:16 / cg"
  3703 !
  3721 !
  3704 
  3722 
  3705 openOnClass:aClass
  3723 openOnClass:aClass
  3706     "opens the GUI Painter on aClass and #windowSpec"
  3724     "opens the GUI Painter on aClass and #windowSpec"
  3707 
  3725 
  3715         (self confirm:'No class given to the GUI Painter (class was probably renamed?)\\Open anyway (to create a new window spec) ?' withCRs)
  3733         (self confirm:'No class given to the GUI Painter (class was probably renamed?)\\Open anyway (to create a new window spec) ?' withCRs)
  3716         ifFalse:[^ nil].
  3734         ifFalse:[^ nil].
  3717     ].
  3735     ].
  3718 
  3736 
  3719     specSelector := aSelector.
  3737     specSelector := aSelector.
  3720     specClassName := aClass.
  3738     specClass := aClass.
       
  3739     specClassName := aClass name.
  3721 
  3740 
  3722     self openInterface.
  3741     self openInterface.
  3723 
  3742 
  3724 "/    specSelector := aSelector.
  3743 "/    specSelector := aSelector.
  3725 "/    specClass := aClass.
  3744 "/    specClass := aClass.
  3726 
  3745 
  3727     "Modified: / 21.8.1998 / 20:59:15 / cg"
  3746     "Modified: / 31-08-2006 / 10:13:31 / cg"
  3728 !
  3747 !
  3729 
  3748 
  3730 postBuildWith: aBuilder
  3749 postBuildWith: aBuilder
  3731     super postBuildWith:aBuilder.
  3750     super postBuildWith:aBuilder.
  3732 
  3751 
  4219     "opens a ResourceSelectionBrowser for loading a window spec from a class"
  4238     "opens a ResourceSelectionBrowser for loading a window spec from a class"
  4220 
  4239 
  4221     self askForModification ifFalse: [^nil].
  4240     self askForModification ifFalse: [^nil].
  4222 
  4241 
  4223     self loadFromMessage: 
  4242     self loadFromMessage: 
  4224 	(ResourceSelectionBrowser
  4243         (ResourceSelectionBrowser
  4225 	    request: 'Load Window Spec From Class'
  4244             request: 'Load Window Spec From Class'
  4226 	    onSuperclass: nil
  4245             onSuperclass: nil
  4227 	    andClass: specClassName
  4246             andClass: self specClass
  4228 	    andSelector: specSelector ? #windowSpec
  4247             andSelector: specSelector ? #windowSpec
  4229 	    withResourceTypes: #(canvas))
  4248             withResourceTypes: #(canvas))
       
  4249 
       
  4250     "Modified: / 31-08-2006 / 10:14:01 / cg"
  4230 !
  4251 !
  4231 
  4252 
  4232 doLoadSubspec
  4253 doLoadSubspec
  4233     "opens a ResourceSelectionBrowser for loading a sub spec from a class"
  4254     "opens a ResourceSelectionBrowser for loading a sub spec from a class"
  4234 
  4255 
  4237     self askForSectionModification.
  4258     self askForSectionModification.
  4238 
  4259 
  4239     classAndSelector := ResourceSelectionBrowser
  4260     classAndSelector := ResourceSelectionBrowser
  4240             request: 'Load Subspec From Class'
  4261             request: 'Load Subspec From Class'
  4241             onSuperclass: nil
  4262             onSuperclass: nil
  4242             andClass: specClassName
  4263             andClass: self specClass
  4243             andSelector: specSelector
  4264             andSelector: specSelector
  4244             withResourceTypes: #(canvas).
  4265             withResourceTypes: #(canvas).
  4245 
  4266 
  4246     classAndSelector isNil ifTrue:[^ self].
  4267     classAndSelector isNil ifTrue:[^ self].
  4247     class := classAndSelector methodClass.
  4268     class := classAndSelector methodClass.
  4251         ^ self.
  4272         ^ self.
  4252     ].
  4273     ].
  4253     (class respondsTo:selector) ifTrue:[
  4274     (class respondsTo:selector) ifTrue:[
  4254         self addWidgetOfSpec:(Array with: (UISubSpecification new majorKey: class name; minorKey: selector))
  4275         self addWidgetOfSpec:(Array with: (UISubSpecification new majorKey: class name; minorKey: selector))
  4255     ]
  4276     ]
       
  4277 
       
  4278     "Modified: / 31-08-2006 / 10:13:56 / cg"
  4256 !
  4279 !
  4257 
  4280 
  4258 doNew
  4281 doNew
  4259     "removes all widgets, specClass, and specSelector"
  4282     "removes all widgets, specClass, and specSelector"
  4260 
  4283 
  4261     self askForModification ifFalse: [^nil].
  4284     self askForModification ifFalse: [^nil].
  4262     specClassName := specSelector := nil.
  4285     specClass := specClassName := specSelector := nil.
  4263     self painter removeAll.
  4286     self painter removeAll.
  4264     treeView canvas topView name:  UIPainter defaultNameOfCanvas.
  4287     treeView canvas topView name:  UIPainter defaultNameOfCanvas.
  4265     treeView canvas topView label: UIPainter defaultNameOfCanvas.
  4288     treeView canvas topView label: UIPainter defaultNameOfCanvas.
  4266     self helpTool doNew.
  4289     self helpTool doNew.
  4267     self treeSelectionChanged.
  4290     self treeSelectionChanged.
  4268     treeView selectedNode changed.
  4291     treeView selectedNode changed.
  4269     self tabModel value: self tabList value first.
  4292     self tabModel value: self tabList value first.
  4270     self updateInfoLabel.
  4293     self updateInfoLabel.
       
  4294 
       
  4295     "Modified: / 31-08-2006 / 10:14:10 / cg"
  4271 !
  4296 !
  4272 
  4297 
  4273 doOpenWidgetDocumentation
  4298 doOpenWidgetDocumentation
  4274     "opens documentation for the selected widget"
  4299     "opens documentation for the selected widget"
  4275 
  4300