# HG changeset patch # User Claus Gittinger # Date 1141634953 -3600 # Node ID 7a37b7c850924b9a20054cda752e524d59e3bce1 # Parent 746cc87a768ede05ea9e9034c9ea04498b832ba5 *** empty log message *** diff -r 746cc87a768e -r 7a37b7c85092 UIPainter.st --- a/UIPainter.st Mon Mar 06 09:49:01 2006 +0100 +++ b/UIPainter.st Mon Mar 06 09:49:13 2006 +0100 @@ -11,7 +11,7 @@ " -"{ Package: '__NoProject__' }" +"{ Package: 'stx:libtool2' }" ResourceSpecEditor subclass:#UIPainter instanceVariableNames:'specSuperclassName treeView selectionPanel specTool layoutTool @@ -1227,24 +1227,29 @@ label: 'New' itemValue: doNew translateLabel: true + isVisible: isStandAlone ) (MenuItem label: '-' + isVisible: isStandAlone ) (MenuItem activeHelpKey: fileLoad label: 'Load...' itemValue: doLoad translateLabel: true + isVisible: isStandAlone ) (MenuItem activeHelpKey: fileLoadSubspec label: 'Load Subspec...' itemValue: doLoadSubspec translateLabel: true + isVisible: isStandAlone ) (MenuItem label: '-' + isVisible: isStandAlone ) (MenuItem activeHelpKey: fileSave @@ -1263,6 +1268,7 @@ label: 'Define Class and Selector...' itemValue: doDefineClassAndSelector translateLabel: true + isVisible: isStandAlone ) (MenuItem label: '-' @@ -1281,6 +1287,7 @@ label: 'Show Window Spec' itemValue: doWindowSpec translateLabel: true + isVisible: isStandAlone ) (MenuItem activeHelpKey: fileBrowseClass @@ -1288,6 +1295,7 @@ label: 'Browse Applications Class' itemValue: doBrowseClass translateLabel: true + isVisible: isStandAlone ) (MenuItem activeHelpKey: fileBrowseAspectMethods @@ -1298,12 +1306,14 @@ ) (MenuItem label: '-' + isVisible: isStandAlone ) (MenuItem activeHelpKey: fileExit label: 'Exit' itemValue: closeRequest translateLabel: true + isVisible: isStandAlone ) ) nil @@ -1451,6 +1461,7 @@ (MenuItem label: 'History' translateLabel: true + isVisible: isStandAlone submenuChannel: menuHistory ) (MenuItem @@ -1735,11 +1746,11 @@ translateLabel: true ) (MenuItem - label: 'Replace' + activeHelpKey: moveWidgetUp + enabled: canReplaceSelection + label: 'Replace...' + itemValue: doAskAndReplaceWidgetBy translateLabel: true - submenuChannel: menuReplaceWidget - keepLinkedMenu: true - enabled: canReplaceSelection ) (MenuItem label: '-' @@ -2045,10 +2056,12 @@ itemValue: doNew translateLabel: true isButton: true - labelImage: (ResourceRetriever ToolbarIconLibrary newWindowSpecIcon) + isVisible: isStandAlone + labelImage: (ResourceRetriever XPToolbarIconLibrary newWindowSpecIcon) ) (MenuItem label: '-' + isVisible: isStandAlone ) (MenuItem activeHelpKey: fileLoad @@ -2056,7 +2069,8 @@ itemValue: doLoad translateLabel: true isButton: true - labelImage: (ResourceRetriever ToolbarIconLibrary loadFromMethodIcon) + isVisible: isStandAlone + labelImage: (ResourceRetriever XPToolbarIconLibrary loadFromMethodIcon) ) (MenuItem activeHelpKey: fileSave @@ -2936,6 +2950,38 @@ ^ spec ! ! +!UIPainter methodsFor:'initialization'! + +initialize + |name| + + super initialize. + + modified := false. + aspects := IdentityDictionary new. + aspects at:#classNameChannel put:'NewApplication' asValue. + aspects at:#superclassNameChannel put:'ApplicationModel' asValue. + aspects at:#methodNameChannel put:'windowSpec' asValue. + + treeView := TreeView new. + treeView windowSpecClass:(self defaultWindowSpecClass). + treeView + selectConditionBlock:[:newSelection | self selectionChangeAllowed:newSelection ]. + + painterView := StandardSystemView new. + name := name ? UIPainter defaultNameOfCanvas. + painterView beToolWindow. + painterView name:name. + painterView label:name. + painterView extent:(treeView windowSpecClass defaultExtentInUIPainter). + painter := UIPainterView in:painterView. + painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout. + treeView := treeView canvas:painter specName:name. + painter treeView:treeView. + treeView model addDependent:self. + painter enableChannel:(self enableChannel). +! ! + !UIPainter methodsFor:'menus-dynamic'! menuEdit @@ -3384,33 +3430,39 @@ ! updateSlicesForSpec:spec andView:view - |slices size list tabComponent| + |slices "size" list tabComponent| tabComponent := self componentAt:#noteBook. spec notNil ifTrue:[ self helpTool helpKey:(spec activeHelpKey). slices := spec class slices. - size := slices size. - + + list := slices collect:[:eachSlice | eachSlice first asString]. + self treeView isCanvasSelected ifFalse:[ + list add:(UIHelpTool label) + ]. view notNil ifTrue:[ - self treeView isCanvasSelected - ifFalse: - [ - list := Array new:(size + 2). - list at:(size + 2) put:(UILayoutTool label). - ] - ifTrue: - [ - list := Array new:(size + 1). - list at:(size + 1) put:(UILayoutTool label). - ]. - ] ifFalse:[ - list := Array new:(size + 1). + list add:UILayoutTool label. ]. - 1 to:size do:[:i| list at:i put:((slices at:i) first asString)]. - self treeView isCanvasSelected ifFalse: [list at:(size + 1) put:(UIHelpTool label)]. +"/ size := slices size. +"/ view notNil ifTrue:[ +"/ self treeView isCanvasSelected ifFalse:[ +"/ list := Array new:(size + 2). +"/ list at:(size + 2) put:(UILayoutTool label). +"/ ] ifTrue:[ +"/ list := Array new:(size + 1). +"/ list at:(size + 1) put:(UILayoutTool label). +"/ ]. +"/ ] ifFalse:[ +"/ list := Array new:(size + 1). +"/ ]. +"/ +"/ 1 to:size do:[:i| list at:i put:((slices at:i) first asString)]. +"/ self treeView isCanvasSelected ifFalse: [ +"/ list at:(size + 1) put:(UIHelpTool label) +"/ ]. self tabList value:list. self showHelp:spec class name for:self. @@ -3468,7 +3520,7 @@ !UIPainter methodsFor:'startup & release'! closeRequest - "close request" + "asks for permission before closing" self askForModification ifFalse:[^self]. @@ -3483,7 +3535,6 @@ ]. selectionPanel := nil. treeView := nil. - ! closeRequestFor:aTopView @@ -3531,38 +3582,17 @@ (builder componentAt:'acceptButton') label:(resources string:'Apply') ]. + "/ using masters infoHolder ? + (builder aspectAt:#useAlienInfoLabelHolder) == true ifTrue:[ + (builder componentAt:#mainPanel) layout bottomOffset:0. + (builder componentAt:#infoBarSubSpec) beInvisible + ]. + self updateInfoLabel. + "Modified: / 22.8.1998 / 17:41:34 / cg" ! -initialize - |name| - - super initialize. - - modified := false. - aspects := IdentityDictionary new. - aspects at:#classNameChannel put:'NewApplication' asValue. - - treeView := TreeView new. - treeView windowSpecClass:(self defaultWindowSpecClass). - treeView - selectConditionBlock:[:newSelection | self selectionChangeAllowed:newSelection ]. - - painterView := StandardSystemView new. - name := name ? UIPainter defaultNameOfCanvas. - painterView beToolWindow. - painterView name:name. - painterView label:name. - painterView extent:(treeView windowSpecClass defaultExtentInUIPainter). - painter := UIPainterView in:painterView. - painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout. - treeView := treeView canvas:painter specName:name. - painter treeView:treeView. - treeView model addDependent:self. - painter enableChannel:(self enableChannel). -! - loadFromClass:aClass andSelector:selector "loads a window spec by evaluating aMessageString (which is something like 'fooClass windowSpec')"