UIPainter.st
changeset 1983 5528c812da8f
parent 1976 969584dd8beb
child 1991 feaad07cb3cf
equal deleted inserted replaced
1982:a60283327f16 1983:5528c812da8f
    12 
    12 
    13 
    13 
    14 "{ Package: 'stx:libtool2' }"
    14 "{ Package: 'stx:libtool2' }"
    15 
    15 
    16 ToolApplicationModel subclass:#UIPainter
    16 ToolApplicationModel subclass:#UIPainter
    17 	instanceVariableNames:'specClass specSelector specSuperclassName aspects treeView
    17 	instanceVariableNames:'specClassName specSelector specSuperclassName aspects treeView
    18 		selectionPanel tabSelection modified specTool layoutTool helpTool'
    18 		selectionPanel tabSelection modified specTool layoutTool helpTool'
    19 	classVariableNames:''
    19 	classVariableNames:''
    20 	poolDictionaries:''
    20 	poolDictionaries:''
    21 	category:'Interface-UIPainter'
    21 	category:'Interface-UIPainter'
    22 !
    22 !
  2428 
  2428 
  2429         helpTool := UIHelpTool new.
  2429         helpTool := UIHelpTool new.
  2430         applBuilder := helpTool builder.
  2430         applBuilder := helpTool builder.
  2431         applWindow  := ApplicationSubView origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  2431         applWindow  := ApplicationSubView origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
  2432         applWindow level:0.
  2432         applWindow level:0.
  2433         helpTool loadFromClass:specClass.
  2433         helpTool loadFromClass:specClassName.
  2434         helpTool masterApplication:self.
  2434         helpTool masterApplication:self.
  2435         applBuilder window:applWindow.
  2435         applBuilder window:applWindow.
  2436         applWindow client:helpTool spec:#windowSpec builder:applBuilder.
  2436         applWindow client:helpTool spec:#innerSpec builder:applBuilder.
  2437         applBuilder window:applWindow.
  2437         applBuilder window:applWindow.
  2438         helpTool modifiedHolder:modifiedChannel.
  2438         helpTool modifiedHolder:modifiedChannel.
  2439 
  2439 
  2440         specTool := UISpecificationTool new.
  2440         specTool := UISpecificationTool new.
  2441         specTool createBuilder.
  2441         specTool createBuilder.
  2513 openDataSetColumnEditor
  2513 openDataSetColumnEditor
  2514     "opens a Table Column Editor on current widget"
  2514     "opens a Table Column Editor on current widget"
  2515 
  2515 
  2516     |cls editor specTool columnHolder tableSelector columns|
  2516     |cls editor specTool columnHolder tableSelector columns|
  2517 
  2517 
  2518     (cls := self resolveName:specClass) isNil ifTrue:[
  2518     (cls := self resolveName:specClassName) isNil ifTrue:[
  2519         self askForSaving ifTrue:[cls := self resolveName:specClass].
  2519         self askForSaving ifTrue:[cls := self resolveName:specClassName].
  2520     ].
  2520     ].
  2521     cls isNil ifTrue:[^ self].
  2521     cls isNil ifTrue:[^ self].
  2522 
  2522 
  2523     self modifiedChannel value ifTrue:[
  2523     self modifiedChannel value ifTrue:[
  2524         (self confirm:'Accept changes made to spec ?') ifTrue:[
  2524         (self confirm:'Accept changes made to spec ?') ifTrue:[
  2572 openEditMenu
  2572 openEditMenu
  2573     "opens a Menu Editor on current widget"
  2573     "opens a Menu Editor on current widget"
  2574 
  2574 
  2575     |cls selectorOrMenu editor selectedSpec spec holder|
  2575     |cls selectorOrMenu editor selectedSpec spec holder|
  2576 
  2576 
  2577     (cls := self resolveName:specClass) isNil ifTrue:[
  2577     (cls := self resolveName:specClassName) isNil ifTrue:[
  2578         self askForSaving ifTrue:[cls := self resolveName:specClass].
  2578         self askForSaving ifTrue:[cls := self resolveName:specClassName].
  2579     ].
  2579     ].
  2580     cls isNil ifTrue:[^ self].
  2580     cls isNil ifTrue:[^ self].
  2581 
  2581 
  2582     self modifiedChannel value ifTrue:[
  2582     self modifiedChannel value ifTrue:[
  2583         (self confirm:'Accept changes made to spec ?') ifTrue:[
  2583         (self confirm:'Accept changes made to spec ?') ifTrue:[
  2621 openHierarchicalListEditor
  2621 openHierarchicalListEditor
  2622     "opens a Hierarchical List Editor on current widget"
  2622     "opens a Hierarchical List Editor on current widget"
  2623 
  2623 
  2624     |selector editor spec|
  2624     |selector editor spec|
  2625 
  2625 
  2626     (self resolveName:specClass) isNil ifTrue:[
  2626     (self resolveName:specClassName) isNil ifTrue:[
  2627 	self askForSaving ifFalse: [^self]
  2627 	self askForSaving ifFalse: [^self]
  2628     ].
  2628     ].
  2629 
  2629 
  2630     spec := self specTool specification.
  2630     spec := self specTool specification.
  2631     (selector := spec hierarchicalList) notNil ifTrue:[
  2631     (selector := spec hierarchicalList) notNil ifTrue:[
  2632 	selector := selector asSymbol
  2632 	selector := selector asSymbol
  2633     ].
  2633     ].
  2634 
  2634 
  2635     editor := HierarchicalListEditor new.
  2635     editor := HierarchicalListEditor new.
  2636     editor masterApplication:self.
  2636     editor masterApplication:self.
  2637     editor openModalOnClass:specClass andSelector:selector.
  2637     editor openModalOnClass:specClassName andSelector:selector.
  2638 
  2638 
  2639     editor specSelector ~= selector ifTrue:[
  2639     editor specSelector ~= selector ifTrue:[
  2640 	editor hasSaved ifTrue:[
  2640 	editor hasSaved ifTrue:[
  2641 	    spec hierarchicalList:editor specSelector.
  2641 	    spec hierarchicalList:editor specSelector.
  2642 	    self modifiedChannel value:true.
  2642 	    self modifiedChannel value:true.
  2650 openSubSpecGUIPainter
  2650 openSubSpecGUIPainter
  2651     "opens a GUI Painter on the current subspecification"
  2651     "opens a GUI Painter on the current subspecification"
  2652 
  2652 
  2653     |spec cls meta sel|
  2653     |spec cls meta sel|
  2654 
  2654 
  2655     (self resolveName:specClass) isNil ifTrue:[
  2655     (self resolveName:specClassName) isNil ifTrue:[
  2656         self askForSaving ifFalse: [^self]
  2656         self askForSaving ifFalse: [^self]
  2657     ]. 
  2657     ]. 
  2658 
  2658 
  2659     spec := self specTool specification.
  2659     spec := self specTool specification.
  2660     cls := spec majorKey.
  2660     cls := spec majorKey.
  2661     cls isNil ifTrue:[
  2661     cls isNil ifTrue:[
  2662         cls := specClass.
  2662         cls := specClassName.
  2663     ].
  2663     ].
  2664     (cls := self resolveName:cls inClass:(Smalltalk at: specClass asSymbol)) isNil ifTrue:[
  2664     (cls := self resolveName:cls inClass:(Smalltalk at: specClassName asSymbol)) isNil ifTrue:[
  2665         spec majorKey isNil ifTrue:[
  2665         spec majorKey isNil ifTrue:[
  2666             ^ self warn:'Cannot find class (no majorKey specified).'.
  2666             ^ self warn:'Cannot find class (no majorKey specified).'.
  2667         ].
  2667         ].
  2668         ^ self warn:('Cannot find class ', spec majorKey asBoldText, '.').
  2668         ^ self warn:('Cannot find class ', spec majorKey asBoldText, '.').
  2669     ].
  2669     ].
  2683 openTabListEditor
  2683 openTabListEditor
  2684     "opens a Tab List Editor on current widget"
  2684     "opens a Tab List Editor on current widget"
  2685 
  2685 
  2686     |selector editor spec cls holder|
  2686     |selector editor spec cls holder|
  2687 
  2687 
  2688     (cls := self resolveName:specClass) isNil ifTrue:[
  2688     (cls := self resolveName:specClassName) isNil ifTrue:[
  2689         self askForSaving ifTrue:[cls := self resolveName:specClass].
  2689         self askForSaving ifTrue:[cls := self resolveName:specClassName].
  2690     ].
  2690     ].
  2691     cls isNil ifTrue:[^ self].
  2691     cls isNil ifTrue:[^ self].
  2692 
  2692 
  2693     self modifiedChannel value ifTrue:[
  2693     self modifiedChannel value ifTrue:[
  2694         (self confirm:'Accept changes made to spec ?') ifTrue:[
  2694         (self confirm:'Accept changes made to spec ?') ifTrue:[
  2899 !UIPainter methodsFor:'help'!
  2899 !UIPainter methodsFor:'help'!
  2900 
  2900 
  2901 defaultInfoLabel
  2901 defaultInfoLabel
  2902     "returns the default info label"
  2902     "returns the default info label"
  2903 
  2903 
  2904     specClass isNil ifTrue: [^'No class and selector defined.'].
  2904     specClassName isNil ifTrue: [^'No class and selector defined.'].
  2905     specSelector isNil ifTrue: [^'No selector defined.'].
  2905     specSelector isNil ifTrue: [^'No selector defined.'].
  2906     ^specClass printString, ' >> ', specSelector
  2906     ^specClassName printString, ' >> ', specSelector
  2907 
  2907 
  2908     "Modified: / 20.6.1998 / 16:49:16 / cg"
  2908     "Modified: / 20.6.1998 / 16:49:16 / cg"
  2909 ! !
  2909 ! !
  2910 
  2910 
  2911 !UIPainter methodsFor:'help spec'!
  2911 !UIPainter methodsFor:'help spec'!
  3033 checkClassAndSelector
  3033 checkClassAndSelector
  3034     "checks for class & superclass"
  3034     "checks for class & superclass"
  3035 
  3035 
  3036     |superclass cls|
  3036     |superclass cls|
  3037 
  3037 
  3038     specClass isNil ifTrue:[^ false].
  3038     specClassName isNil ifTrue:[^ false].
  3039 
  3039 
  3040     cls := self resolveName:specClass.
  3040     cls := self resolveName:specClassName.
  3041 
  3041 
  3042     cls isNil ifTrue:[
  3042     cls isNil ifTrue:[
  3043         superclass := self resolveName:specSuperclassName.
  3043         superclass := self resolveName:specSuperclassName.
  3044 
  3044 
  3045         superclass isNil ifTrue:[
  3045         superclass isNil ifTrue:[
  3046             self warn:'No class named ' , specSuperclassName , ' exists!!'.
  3046             self warn:'No class named ' , specSuperclassName , ' exists!!'.
  3047             ^ false.
  3047             ^ false.
  3048         ].
  3048         ].
  3049 
  3049 
  3050         (self confirm:'Create class ' , specClass asBoldText, '?') ifTrue:[
  3050         (self confirm:'Create class ' , specClassName asBoldText, '?') ifTrue:[
  3051             cls := superclass 
  3051             cls := superclass 
  3052                         subclass:(specClass asSymbol)
  3052                         subclass:(specClassName asSymbol)
  3053                         instanceVariableNames:''
  3053                         instanceVariableNames:''
  3054                         classVariableNames:''
  3054                         classVariableNames:''
  3055                         poolDictionaries:''
  3055                         poolDictionaries:''
  3056                         category:'Applications'.
  3056                         category:'Applications'.
  3057 
  3057 
  3058             cls name ~= specClass ifTrue:[
  3058             cls name ~= specClassName ifTrue:[
  3059                 self information:'Created new class is ' , cls name.
  3059                 self information:'Created new class is ' , cls name.
  3060                 specClass := cls name
  3060                 specClassName := cls name
  3061             ].
  3061             ].
  3062             ^ true.
  3062             ^ true.
  3063         ].
  3063         ].
  3064         ^ false.
  3064         ^ false.
  3065     ].
  3065     ].
  3066     cls isBehavior ifFalse:[
  3066     cls isBehavior ifFalse:[
  3067         self warn:'A global named ' , specClass , ' exists, but it is no class.'.
  3067         self warn:'A global named ' , specClassName , ' exists, but it is no class.'.
  3068         ^ false.
  3068         ^ false.
  3069     ].
  3069     ].
  3070 
  3070 
  3071     specSuperclassName isBehavior ifFalse:[
  3071     specSuperclassName isBehavior ifFalse:[
  3072         specSuperclassName isEmpty ifFalse:[
  3072         specSuperclassName isEmpty ifFalse:[
  3083             self warn:'No class named ' , specSuperclassName , ' exists!!'.
  3083             self warn:'No class named ' , specSuperclassName , ' exists!!'.
  3084             ^ false.
  3084             ^ false.
  3085         ].
  3085         ].
  3086 
  3086 
  3087         (cls isSubclassOf:superclass) ifFalse:[
  3087         (cls isSubclassOf:superclass) ifFalse:[
  3088             self information:('A global named ' , specClass , ' exists,\' ,
  3088             self information:('A global named ' , specClassName , ' exists,\' ,
  3089                               'but is not a subclass of ' , superclass name , '.\\' ,
  3089                               'but is not a subclass of ' , superclass name , '.\\' ,
  3090                               'Check and try again if that is not what you want.') withCRs.
  3090                               'Check and try again if that is not what you want.') withCRs.
  3091         ]
  3091         ]
  3092     ].
  3092     ].
  3093 
  3093 
  3157 
  3157 
  3158     self specClass:clsName.
  3158     self specClass:clsName.
  3159     specSelector := (selector ? '').
  3159     specSelector := (selector ? '').
  3160     specSuperclassName := superClassName.
  3160     specSuperclassName := superClassName.
  3161 
  3161 
  3162     (specClass notNil and:[ selector notNil ]) ifTrue:[
  3162     (specClassName notNil and:[ selector notNil ]) ifTrue:[
  3163         self addHistoryEntryForClass:specClass selector:specSelector.
  3163         self addHistoryEntryForClass:specClassName selector:specSelector.
  3164         self updateInfoLabel
  3164         self updateInfoLabel
  3165     ].
  3165     ].
  3166 
  3166 
  3167     "Modified: / 5.2.1998 / 09:44:58 / stefan"
  3167     "Modified: / 5.2.1998 / 09:44:58 / stefan"
  3168 !
  3168 !
  3181 
  3181 
  3182 specClass:aClassOrClassName
  3182 specClass:aClassOrClassName
  3183     "sets the specClass and updates the Help Tool"
  3183     "sets the specClass and updates the Help Tool"
  3184 
  3184 
  3185     aClassOrClassName isBehavior 
  3185     aClassOrClassName isBehavior 
  3186         ifTrue: [ specClass := aClassOrClassName ]
  3186         ifTrue: [ specClassName := aClassOrClassName ]
  3187         ifFalse:[ specClass := Smalltalk classNamed:aClassOrClassName ].
  3187         ifFalse:[ specClassName := Smalltalk classNamed:aClassOrClassName ].
  3188 
  3188 
  3189     self helpTool loadFromClass:specClass.    
  3189     self helpTool loadFromClass:specClassName.    
  3190     self clearModifiedFlag. 
  3190     self clearModifiedFlag. 
  3191 ! !
  3191 ! !
  3192 
  3192 
  3193 !UIPainter methodsFor:'private-tools'!
  3193 !UIPainter methodsFor:'private-tools'!
  3194 
  3194 
  3222 !UIPainter methodsFor:'queries'!
  3222 !UIPainter methodsFor:'queries'!
  3223 
  3223 
  3224 hasSpecClass
  3224 hasSpecClass
  3225     "answers whether an application class is defined"
  3225     "answers whether an application class is defined"
  3226 
  3226 
  3227     ^ (self resolveName:specClass) notNil
  3227     ^ (self resolveName:specClassName) notNil
  3228 !
  3228 !
  3229 
  3229 
  3230 hasSpecClassAndSelector
  3230 hasSpecClassAndSelector
  3231     "answers whether an application class and a selector under which
  3231     "answers whether an application class and a selector under which
  3232      the window spec is stored is defined"
  3232      the window spec is stored is defined"
  3496 	].
  3496 	].
  3497 	topView raise.
  3497 	topView raise.
  3498     ].
  3498     ].
  3499 !
  3499 !
  3500 
  3500 
       
  3501 initialize
       
  3502     super initialize.
       
  3503 
       
  3504     modified := false.
       
  3505     aspects := IdentityDictionary new.
       
  3506     aspects at:#classNameChannel put:'NewApplication' asValue.
       
  3507 !
       
  3508 
  3501 loadFromClass:aClass andSelector:selector
  3509 loadFromClass:aClass andSelector:selector
  3502     "loads a window spec by evaluating aMessageString
  3510     "loads a window spec by evaluating aMessageString
  3503      (which is something like 'fooClass windowSpec')"
  3511      (which is something like 'fooClass windowSpec')"
  3504 
  3512 
  3505     self assert:(aClass isNil or:[aClass isClass]).
  3513     self assert:(aClass isNil or:[aClass isClass]).
  3527 openInterface:aSymbol 
  3535 openInterface:aSymbol 
  3528     "opens the interface on the selector aSymbol"
  3536     "opens the interface on the selector aSymbol"
  3529     
  3537     
  3530     |cls painterView painter topView galleryWindow icon name|
  3538     |cls painterView painter topView galleryWindow icon name|
  3531 
  3539 
  3532     modified := false.
  3540     specClassName notNil ifTrue:[
  3533     aspects := IdentityDictionary new.
  3541         specClassName isBehavior ifTrue:[
  3534     specClass notNil ifTrue:[
  3542             name := specClassName nameWithoutPrefix.
  3535         specClass isBehavior ifTrue:[
       
  3536             name := specClass nameWithoutPrefix.
       
  3537         ] ifFalse:[
  3543         ] ifFalse:[
  3538             name := specClass printString string
  3544             name := specClassName printString string
  3539         ]
  3545         ]
  3540     ].
  3546     ].
  3541     aspects at:#classNameChannel
  3547     (aspects at:#classNameChannel) value:(specClassName ? 'NewApplication').
  3542         put:((specClass notNil ifTrue:[ specClass ] ifFalse:[ 'NewApplication' ]) 
       
  3543                 asValue).
       
  3544 
  3548 
  3545     specSuperclassName isNil ifTrue:[
  3549     specSuperclassName isNil ifTrue:[
  3546         specClass notNil ifTrue:[
  3550         specClassName notNil ifTrue:[
  3547             (cls := self resolveName:specClass) notNil ifTrue:[
  3551             (cls := self resolveName:specClassName) notNil ifTrue:[
  3548                 specSuperclassName := cls superclass name.
  3552                 specSuperclassName := cls superclass name.
  3549             ]
  3553             ]
  3550         ]
  3554         ]
  3551     ].
  3555     ].
  3552     aspects at:#superclassNameChannel
  3556     aspects at:#superclassNameChannel
  3618         (self confirm:'No class given to the GUI Painter (class was probably renamed?)\\Open anyway (to create a new window spec) ?' withCRs)
  3622         (self confirm:'No class given to the GUI Painter (class was probably renamed?)\\Open anyway (to create a new window spec) ?' withCRs)
  3619         ifFalse:[^ nil].
  3623         ifFalse:[^ nil].
  3620     ].
  3624     ].
  3621 
  3625 
  3622     specSelector := aSelector.
  3626     specSelector := aSelector.
  3623     specClass := aClass.
  3627     specClassName := aClass.
  3624 
  3628 
  3625     self openInterface.
  3629     self openInterface.
  3626 
  3630 
  3627 "/    specSelector := aSelector.
  3631 "/    specSelector := aSelector.
  3628 "/    specClass := aClass.
  3632 "/    specClass := aClass.
  3636 
  3640 
  3637     |painter settings gridPara hspace vspace cls sel|
  3641     |painter settings gridPara hspace vspace cls sel|
  3638 
  3642 
  3639     super postBuildWith:aBuilder.
  3643     super postBuildWith:aBuilder.
  3640 
  3644 
  3641     cls := specClass.
  3645     cls := specClassName.
  3642     cls isString ifTrue:[
  3646     cls isString ifTrue:[
  3643         cls := Smalltalk at:(cls string asSymbol)
  3647         cls := Smalltalk at:(cls string asSymbol)
  3644     ].
  3648     ].
  3645     sel := specSelector.
  3649     sel := specSelector.
  3646     specSelector := nil.
  3650     specSelector := nil.
  3647     specClass    := nil.
  3651     specClassName    := nil.
  3648 
  3652 
  3649     painter  := self painter.
  3653     painter  := self painter.
  3650     settings := self class settings.
  3654     settings := self class settings.
  3651     gridPara := painter gridParameters copy.
  3655     gridPara := painter gridParameters copy.
  3652     hspace   := settings at: #HGridSpace ifAbsent:10.
  3656     hspace   := settings at: #HGridSpace ifAbsent:10.
  3872 
  3876 
  3873     self painter isModified ifTrue:[
  3877     self painter isModified ifTrue:[
  3874         self warn:'The current window spec has not yet been saved!!\\The System Browser will show the code of the old window spec.' withCRs.
  3878         self warn:'The current window spec has not yet been saved!!\\The System Browser will show the code of the old window spec.' withCRs.
  3875     ].
  3879     ].
  3876 
  3880 
  3877     UserPreferences systemBrowserClass openInClass:(self resolveName:specClass)
  3881     UserPreferences systemBrowserClass openInClass:(self resolveName:specClassName)
  3878 !
  3882 !
  3879 
  3883 
  3880 doBrowseViewClass
  3884 doBrowseViewClass
  3881     "opens a browser on the selected widgets class"
  3885     "opens a browser on the selected widgets class"
  3882 
  3886 
  3908     ].
  3912     ].
  3909 
  3913 
  3910     [
  3914     [
  3911         again := false.
  3915         again := false.
  3912 
  3916 
  3913         aspects at:#classNameChannel      put:(specClass      ? 'NewApplication')   asValue.
  3917         aspects at:#classNameChannel      put:(specClassName      ? 'NewApplication')   asValue.
  3914         aspects at:#methodNameChannel     put:(specSelector   ? 'windowSpec')       asValue.
  3918         aspects at:#methodNameChannel     put:(specSelector   ? 'windowSpec')       asValue.
  3915         aspects at:#superclassNameChannel put:(specSuperclassName ? 'ApplicationModel') asValue.
  3919         aspects at:#superclassNameChannel put:(specSuperclassName ? 'ApplicationModel') asValue.
  3916 
  3920 
  3917         (self openDialogInterface:#dialogSpecForDefiningClassAndSelector) ifTrue:[
  3921         (self openDialogInterface:#dialogSpecForDefiningClassAndSelector) ifTrue:[
  3918             specClass      := readFromModelKeyed value:#classNameChannel.
  3922             specClassName      := readFromModelKeyed value:#classNameChannel.
  3919             specSelector   := readFromModelKeyed value:#methodNameChannel.
  3923             specSelector   := readFromModelKeyed value:#methodNameChannel.
  3920             specSuperclassName := readFromModelKeyed value:#superclassNameChannel.
  3924             specSuperclassName := readFromModelKeyed value:#superclassNameChannel.
  3921 
  3925 
  3922             (again := self checkClassAndSelector not) ifFalse:[
  3926             (again := self checkClassAndSelector not) ifFalse:[
  3923                 self painter className:specClass
  3927                 self painter className:specClassName
  3924                         superclassName:specSuperclassName
  3928                         superclassName:specSuperclassName
  3925                               selector:specSelector.
  3929                               selector:specSelector.
  3926             ].
  3930             ].
  3927 
  3931 
  3928             again ifFalse:[
  3932             again ifFalse:[
  3929                 ((Smalltalk at:specClass asSymbol) notNil
  3933                 ((Smalltalk at:specClassName asSymbol) notNil
  3930                 and:[ (Smalltalk at:specClass asSymbol) class includesSelector:specSelector ])
  3934                 and:[ (Smalltalk at:specClassName asSymbol) class includesSelector:specSelector ])
  3931                 ifTrue:[
  3935                 ifTrue:[
  3932                     (self confirm:('%1 already implements %2. Overwrite ?' bindWith:specClass with:specSelector))
  3936                     (self confirm:('%1 already implements %2. Overwrite ?' bindWith:specClassName with:specSelector))
  3933                     ifFalse:[
  3937                     ifFalse:[
  3934                         again := true.
  3938                         again := true.
  3935                     ].
  3939                     ].
  3936                 ].
  3940                 ].
  3937             ].
  3941             ].
  3939             ^nil
  3943             ^nil
  3940         ]
  3944         ]
  3941 
  3945 
  3942     ] doWhile:[again].
  3946     ] doWhile:[again].
  3943 
  3947 
  3944     specClass := specClass isBehavior ifTrue:[specClass name]
  3948     specClassName := specClassName isBehavior ifTrue:[specClassName name]
  3945                                       ifFalse:[specClass].
  3949                                       ifFalse:[specClassName].
  3946 
  3950 
  3947     self clearModifiedFlag.
  3951     self clearModifiedFlag.
  3948     self helpTool buildAndMergeFromClass:specClass.
  3952     self helpTool buildAndMergeFromClass:specClassName.
  3949     self updateInfoLabel
  3953     self updateInfoLabel
  3950 
  3954 
  3951     "Modified: / 16.7.1998 / 18:26:33 / cg"
  3955     "Modified: / 16.7.1998 / 18:26:33 / cg"
  3952 !
  3956 !
  3953 
  3957 
  4136 
  4140 
  4137     self loadFromMessage: 
  4141     self loadFromMessage: 
  4138 	(ResourceSelectionBrowser
  4142 	(ResourceSelectionBrowser
  4139 	    request: 'Load Window Spec From Class'
  4143 	    request: 'Load Window Spec From Class'
  4140 	    onSuperclass: nil
  4144 	    onSuperclass: nil
  4141 	    andClass: specClass
  4145 	    andClass: specClassName
  4142 	    andSelector: specSelector ? #windowSpec
  4146 	    andSelector: specSelector ? #windowSpec
  4143 	    withResourceTypes: #(canvas))
  4147 	    withResourceTypes: #(canvas))
  4144 !
  4148 !
  4145 
  4149 
  4146 doLoadSubspec
  4150 doLoadSubspec
  4151     self askForSectionModification.
  4155     self askForSectionModification.
  4152 
  4156 
  4153     classAndSelector := ResourceSelectionBrowser
  4157     classAndSelector := ResourceSelectionBrowser
  4154             request: 'Load Subspec From Class'
  4158             request: 'Load Subspec From Class'
  4155             onSuperclass: nil
  4159             onSuperclass: nil
  4156             andClass: specClass
  4160             andClass: specClassName
  4157             andSelector: specSelector
  4161             andSelector: specSelector
  4158             withResourceTypes: #(canvas).
  4162             withResourceTypes: #(canvas).
  4159 
  4163 
  4160     classAndSelector isNil ifTrue:[^ self].
  4164     classAndSelector isNil ifTrue:[^ self].
  4161     class := classAndSelector methodClass.
  4165     class := classAndSelector methodClass.
  4162     selector := classAndSelector methodSelector.
  4166     selector := classAndSelector methodSelector.
  4163     (class == specClass and: [selector == specSelector]) ifTrue: [
  4167     (class == specClassName and: [selector == specSelector]) ifTrue: [
  4164         self warn: 'Current interface as subspec not allowed!!'.
  4168         self warn: 'Current interface as subspec not allowed!!'.
  4165         ^ self.
  4169         ^ self.
  4166     ].
  4170     ].
  4167     (class respondsTo:selector) ifTrue:[
  4171     (class respondsTo:selector) ifTrue:[
  4168         self addWidgetOfSpec:(Array with: (UISubSpecification new majorKey: class name; minorKey: selector))
  4172         self addWidgetOfSpec:(Array with: (UISubSpecification new majorKey: class name; minorKey: selector))
  4171 
  4175 
  4172 doNew
  4176 doNew
  4173     "removes all widgets, specClass, and specSelector"
  4177     "removes all widgets, specClass, and specSelector"
  4174 
  4178 
  4175     self askForModification ifFalse: [^nil].
  4179     self askForModification ifFalse: [^nil].
  4176     specClass := specSelector := nil.
  4180     specClassName := specSelector := nil.
  4177     self painter removeAll.
  4181     self painter removeAll.
  4178     treeView canvas topView name:  UIPainter defaultNameOfCanvas.
  4182     treeView canvas topView name:  UIPainter defaultNameOfCanvas.
  4179     treeView canvas topView label: UIPainter defaultNameOfCanvas.
  4183     treeView canvas topView label: UIPainter defaultNameOfCanvas.
  4180     self helpTool doNew.
  4184     self helpTool doNew.
  4181     self treeSelectionChanged.
  4185     self treeSelectionChanged.
  4229         self doDefineClassAndSelector isNil ifTrue:[
  4233         self doDefineClassAndSelector isNil ifTrue:[
  4230             ^ nil
  4234             ^ nil
  4231         ]
  4235         ]
  4232     ].
  4236     ].
  4233     
  4237     
  4234     (specClass notNil and:[ specClass isClass ]) ifFalse:[
  4238     (specClassName notNil and:[ specClassName isClass ]) ifFalse:[
  4235         self warn:('Oops - cannot save - class not found: ' , specClass).
  4239         self warn:('Oops - cannot save - class not found: ' , specClassName).
  4236         ^ nil
  4240         ^ nil
  4237     ].
  4241     ].
  4238     painter := self painter.
  4242     painter := self painter.
  4239     painter 
  4243     painter 
  4240         class:specClass
  4244         class:specClassName
  4241         superclassName:specSuperclassName
  4245         superclassName:specSuperclassName
  4242         selector:specSelector.
  4246         selector:specSelector.
  4243 
  4247 
  4244 "/    Transcript showCR:'generating windowSpec code...'.
  4248 "/    Transcript showCR:'generating windowSpec code...'.
  4245 
  4249 
  4255     self doGenerateAspectSelectorsMethod.
  4259     self doGenerateAspectSelectorsMethod.
  4256     self helpTool doSave.
  4260     self helpTool doSave.
  4257     self updateInfoLabel.
  4261     self updateInfoLabel.
  4258     modified := false.
  4262     modified := false.
  4259     painter resetModification.
  4263     painter resetModification.
  4260     (specClass respondsTo:specSelector) ifTrue:[
  4264     (specClassName respondsTo:specSelector) ifTrue:[
  4261         self addHistoryEntryForClass:specClass selector:specSelector.
  4265         self addHistoryEntryForClass:specClassName selector:specSelector.
  4262     ].
  4266     ].
  4263 !
  4267 !
  4264 
  4268 
  4265 doSaveAs
  4269 doSaveAs
  4266     "opens a ResourceSelectionBrowser for saving the window spec on a class"
  4270     "opens a ResourceSelectionBrowser for saving the window spec on a class"
  4271     self askForModification ifFalse:[^ false].
  4275     self askForModification ifFalse:[^ false].
  4272 
  4276 
  4273     classAndSelector := ResourceSelectionBrowser
  4277     classAndSelector := ResourceSelectionBrowser
  4274             request: 'Save Window Spec In Class'
  4278             request: 'Save Window Spec In Class'
  4275             onSuperclass: #Object
  4279             onSuperclass: #Object
  4276             andClass: (specClass ? #ApplicationModel) asSymbol
  4280             andClass: (specClassName ? #ApplicationModel) asSymbol
  4277             andSelector: specSelector ? #windowSpec
  4281             andSelector: specSelector ? #windowSpec
  4278             withResourceTypes: #(canvas).
  4282             withResourceTypes: #(canvas).
  4279 
  4283 
  4280     classAndSelector isNil ifTrue:[^ false].
  4284     classAndSelector isNil ifTrue:[^ false].
  4281 
  4285 
  4282     modified := false.
  4286     modified := false.
  4283     self painter resetModification.
  4287     self painter resetModification.
  4284 
  4288 
  4285     specClass := classAndSelector methodClass.
  4289     specClassName := classAndSelector methodClass.
  4286     specSelector := classAndSelector methodSelector.
  4290     specSelector := classAndSelector methodSelector.
  4287     specSuperclassName := specClass superclass name.
  4291     specSuperclassName := specClassName superclass name.
  4288     self doSave.
  4292     self doSave.
  4289     ^ true
  4293     ^ true
  4290 !
  4294 !
  4291 
  4295 
  4292 doStartApplication
  4296 doStartApplication
  4308                 accepted) ifFalse: [^nil].
  4312                 accepted) ifFalse: [^nil].
  4309             self doSave isNil ifTrue: [^nil]
  4313             self doSave isNil ifTrue: [^nil]
  4310         ]
  4314         ]
  4311     ].
  4315     ].
  4312 
  4316 
  4313     cls := self resolveName:specClass.
  4317     cls := self resolveName:specClassName.
  4314     cls isNil ifTrue:[
  4318     cls isNil ifTrue:[
  4315         self warn:'Oops cannot start application - no class:' , specClass.
  4319         self warn:'Oops cannot start application - no class:' , specClassName.
  4316         ^ nil
  4320         ^ nil
  4317     ].
  4321     ].
  4318     ((application := cls new) respondsTo:#openInterface:) ifFalse:[
  4322     ((application := cls new) respondsTo:#openInterface:) ifFalse:[
  4319         (self confirm:('The application does not respond to the ''openInterface:'' message.\(maybe the spec is supposed to be used as subApplication/subCanvas)\\Shall I try to open this as a standAlone dialog ?') withCRs)
  4323         (self confirm:('The application does not respond to the ''openInterface:'' message.\(maybe the spec is supposed to be used as subApplication/subCanvas)\\Shall I try to open this as a standAlone dialog ?') withCRs)
  4320         ifTrue:[
  4324         ifTrue:[