UIPainter.st
changeset 798 c1116ba57e66
parent 794 212bc7e46765
child 805 99e70b6c02e5
equal deleted inserted replaced
797:6494228f845a 798:c1116ba57e66
  2621 
  2621 
  2622     self openOnClass:aClass andSelector:#windowSpec
  2622     self openOnClass:aClass andSelector:#windowSpec
  2623 !
  2623 !
  2624 
  2624 
  2625 openOnClass:aClass andSelector:aSelector
  2625 openOnClass:aClass andSelector:aSelector
  2626     "opens the GUI Painter on aClass and aSelector"
  2626     "opens the GUI Painter on aClass and aSelector
  2627 
  2627     "
  2628     |painter window|
       
  2629 
       
  2630     aClass isNil ifTrue:[
  2628     aClass isNil ifTrue:[
  2631         (self confirm:'No class given to the GUI Painter (class was probably renamed?)\\Open anyway (to create a new window spec) ?' withCRs)
  2629         (self confirm:'No class given to the GUI Painter (class was probably renamed?)\\Open anyway (to create a new window spec) ?' withCRs)
  2632         ifFalse:[^ nil].
  2630         ifFalse:[^ nil].
  2633     ].
  2631     ].
  2634 
       
  2635     self openInterface.
  2632     self openInterface.
  2636 
  2633 
  2637     window := self window.
  2634     specSelector := aSelector.
  2638     [window realized] whileFalse:[Delay waitForSeconds:0.01].
  2635     specClass := aClass.
  2639 
  2636 
  2640     aClass notNil ifTrue:[
  2637 
  2641         painter := self painter.
       
  2642         self setClass:aClass selector:aSelector.
       
  2643 
       
  2644         (aClass respondsTo:aSelector) ifTrue:[  
       
  2645             painter setupFromSpec:(aClass perform:aSelector).
       
  2646         ]
       
  2647     ].
       
  2648 !
  2638 !
  2649 
  2639 
  2650 postOpenWith: aBuilder
  2640 postOpenWith: aBuilder
  2651     "sets the root of the tree view as first selection;
  2641     "sets the root of the tree view as first selection;
  2652      sets the grid parameters, if defined"
  2642      sets the grid parameters, if defined"
  2653 
  2643 
  2654     |painter settings gridPara hspace vspace|
  2644     |painter settings gridPara hspace vspace cls sel|
  2655 
  2645 
  2656     super postOpenWith: aBuilder.
  2646     super postOpenWith:aBuilder.
  2657 
  2647 
  2658     treeView selection: #(1).
  2648     cls := specClass.
       
  2649     sel := specSelector.
       
  2650     specSelector := nil.
       
  2651     specClass    := nil.
  2659 
  2652 
  2660     painter  := self painter.
  2653     painter  := self painter.
  2661     settings := self class settings.
  2654     settings := self class settings.
  2662     gridPara := painter gridParameters copy.
  2655     gridPara := painter gridParameters copy.
  2663     hspace   := settings at: #HGridSpace ifAbsent: [10].
  2656     hspace   := settings at: #HGridSpace ifAbsent: [10].
  2665     gridPara at:1 put:hspace; at:2 put:vspace; at:5 put:hspace; at:6 put:vspace.
  2658     gridPara at:1 put:hspace; at:2 put:vspace; at:5 put:hspace; at:6 put:vspace.
  2666     painter gridParameters:gridPara.
  2659     painter gridParameters:gridPara.
  2667     painter gridShown: (settings at: #GridShown ifAbsent: [false]).
  2660     painter gridShown: (settings at: #GridShown ifAbsent: [false]).
  2668     painter gridAlign: (settings at: #GridAlign ifAbsent: [false]).
  2661     painter gridAlign: (settings at: #GridAlign ifAbsent: [false]).
  2669     painter clear.
  2662     painter clear.
       
  2663 
       
  2664     cls notNil ifTrue:[
       
  2665         self setClass:cls selector:sel.
       
  2666 
       
  2667         (cls respondsTo:sel) ifTrue:[  
       
  2668             painter setupFromSpec:(cls perform:sel).
       
  2669         ]
       
  2670     ].
       
  2671     treeView selection: #(1).
  2670 
  2672 
  2671 ! !
  2673 ! !
  2672 
  2674 
  2673 !UIPainter methodsFor:'user actions'!
  2675 !UIPainter methodsFor:'user actions'!
  2674 
  2676