# HG changeset patch # User ca # Date 866453806 -7200 # Node ID e652608690b16e65511968e5ba8de6c954922c79 # Parent 785417b6955d60dd03c082de668aa688c97ce9ad help ... diff -r 785417b6955d -r e652608690b1 UIObjectView.st --- a/UIObjectView.st Mon Jun 16 11:34:16 1997 +0200 +++ b/UIObjectView.st Mon Jun 16 11:36:46 1997 +0200 @@ -451,7 +451,6 @@ setOfViews notNil ifTrue:[^ Array with:setOfViews] ifFalse:[^ nil] ]. - ^ setOfViews select:[:aView| (setOfViews detect:[:v|aView isComponentOf:v] ifNone:nil) isNil ] @@ -1269,6 +1268,12 @@ ! +selection:something + "change selection to something + " + self select:something +! + selectionChanged "called whenever the selection changed " @@ -1659,15 +1664,6 @@ ! -setDimension:aLayout - "change layout for all selected objects - " - self transaction:#layout dimensionDo:[:v| - v geometryLayout:(aLayout copy) - ]. - -! - setExtent:anExtent "change extent for all selected objects " @@ -1679,11 +1675,21 @@ "Modified: 28.2.1997 / 12:49:00 / cg" ! +setLayout:aLayout + "change layout for all selected objects + " + self transaction:#layout dimensionDo:[:v| + v geometryLayout:(aLayout copy) + ]. + +! + setToDefaultExtent "change extent of all selected views to their default extent " self transaction:#defaultExtent dimensionDo:[:v| - self resize:v corner:(v computeOrigin + (v preferredExtent)) + self resize:v corner:(v computeOrigin + (v preferredExtent)). + self halt. ] ! @@ -2289,7 +2295,7 @@ openUndoMenu "open undo menu " - self selection:nil. + self select:nil. undoHistory openUndoMenu ! diff -r 785417b6955d -r e652608690b1 UIPainter.st --- a/UIPainter.st Mon Jun 16 11:34:16 1997 +0200 +++ b/UIPainter.st Mon Jun 16 11:36:46 1997 +0200 @@ -1,6 +1,7 @@ ApplicationModel subclass:#UIPainter - instanceVariableNames:'objectList selectionPanel tabSelection lastSlice specView - layoutTool fileName specClass specSelector specSuperclass aspects' + instanceVariableNames:'activeHelpTool layoutTool objectList selectionPanel tabSelection + lastSlice specView fileName specClass specSelector specSuperclass + aspects' classVariableNames:'' poolDictionaries:'' category:'Interface-UIPainter' @@ -55,12 +56,6 @@ ! ! -!UIPainter class methodsFor:'constants'! - -titleOfLayoutMenu - ^ 'Dimension' -! ! - !UIPainter class methodsFor:'icons'! iconAlignB @@ -104,6 +99,183 @@ !UIPainter class methodsFor:'interface specs'! +XXwindowSpec + "this window spec was automatically generated by the ST/X UIPainter" + + "do not manually edit this - the painter/builder may not be able to + handle the specification if its corrupted." + + " + UIPainter new openOnClass:UIPainter andSelector:#windowSpec + UIPainter new openInterface:#windowSpec + " + "UIPainter open" + + + + ^ + + #(#FullSpec + #'window:' + #(#WindowSpec + #'name:' 'uIPainterView' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'Tree-View' + #'bounds:' #(#Rectangle 0 0 478 429) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#MenuPanelSpec + #'name:' 'menuPullDown' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 24 0) + #'tabable:' true + #'menu:' #menuPullDown + ) + #(#MenuPanelSpec + #'name:' 'menuAlignment' + #'layout:' #(#LayoutFrame 0 0.0 29 0 233 0 54 0) + #'tabable:' true + #'menu:' #menuAlignment + #'showSeparatingLines:' true + ) + #(#PanelViewSpec + #'name:' 'panelViewButtons' + #'layout:' #(#LayoutFrame -125 1.0 25 0.0 0 1.0 57 0.0) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#ActionButtonSpec + #'name:' 'moveLeft' + #'label:' '' + #'translateLabel:' true + #'labelChannel:' #'LABELb_moveLeft.xbm' + #'tabable:' true + #'defaultable:' true + #'model:' #moveSelectionLeft + #'isTriggerOnDown:' true + #'enableChannel:' #enableChannel + #'autoRepeat:' false + #'extent:' #(#Point 26 24) + ) + #(#ActionButtonSpec + #'name:' 'moveRight' + #'label:' '' + #'translateLabel:' true + #'labelChannel:' #'LABELb_moveRight.xbm' + #'tabable:' true + #'defaultable:' true + #'model:' #moveSelectionRight + #'isTriggerOnDown:' true + #'enableChannel:' #enableChannel + #'autoRepeat:' false + #'extent:' #(#Point 26 24) + ) + #(#ActionButtonSpec + #'name:' 'moveUp' + #'label:' '' + #'translateLabel:' true + #'labelChannel:' #'LABELb_moveUp.xbm' + #'tabable:' true + #'defaultable:' true + #'model:' #moveSelectionUp + #'isTriggerOnDown:' true + #'enableChannel:' #enableChannel + #'autoRepeat:' false + #'extent:' #(#Point 26 24) + ) + #(#ActionButtonSpec + #'name:' 'moveDown' + #'label:' '' + #'translateLabel:' true + #'labelChannel:' #'LABELb_moveDown.xbm' + #'tabable:' true + #'defaultable:' true + #'model:' #moveSelectionDown + #'isTriggerOnDown:' true + #'enableChannel:' #enableChannel + #'autoRepeat:' false + #'extent:' #(#Point 26 24) + ) + ) + ) + #'level:' 1 + #'horizontalLayout:' #fitSpace + #'verticalLayout:' #fitSpace + #'horizontalSpace:' 4 + #'verticalSpace:' 4 + ) + #(#SequenceViewSpec + #'name:' 'objectTree' + #'layout:' #(#LayoutFrame 0 0.0 59 0.0 0 0.35 0 1.0) + #'enableChannel:' #enableChannel + #'tabable:' true + #'menu:' #objectListMenu + #'model:' #objectList + #'hasHorizontalScrollBar:' true + #'hasVerticalScrollBar:' true + #'miniScrollerHorizontal:' true + #'isMultiSelect:' true + #'doubleClickSelector:' #doubleClick + #'useIndex:' true + ) + #(#NoteBookViewSpec + #'name:' 'noteBook' + #'layout:' #(#LayoutFrame 0 0.35 59 0.0 0 1.0 -30 1.0) + #'enableChannel:' #enableChannel + #'tabable:' true + #'menu:' #tabList + #'style:' + #(#FontDescription + #helvetica #medium + #roman #'10' + ) + #'model:' #tabModel + #'tabWidget:' #Window + #'canvas:' #noteBookView + ) + #(#HorizontalPanelViewSpec + #'name:' 'modifyPanel' + #'layout:' #(#LayoutFrame 0 0.35 -30 1.0 0 1.0 0 1.0) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#ActionButtonSpec + #'name:' 'cancelButton' + #'label:' 'cancel' + #'tabable:' true + #'model:' #cancel + #'isTriggerOnDown:' false + #'enableChannel:' #modifiedChannel + #'autoRepeat:' false + #'extent:' #(#Point 151 24) + ) + #(#ActionButtonSpec + #'name:' 'acceptButton' + #'label:' 'ok' + #'tabable:' true + #'model:' #accept + #'isTriggerOnDown:' false + #'enableChannel:' #modifiedChannel + #'autoRepeat:' false + #'extent:' #(#Point 151 24) + ) + ) + ) + #'level:' 0 + #'horizontalLayout:' #fitSpace + #'verticalLayout:' #fitSpace + #'horizontalSpace:' 3 + #'verticalSpace:' 3 + ) + ) + ) + ) +! + menuAlignment ^ #(#Menu #( #(#MenuItem @@ -186,24 +358,6 @@ ) ) #(#MenuItem - #'label:' 'special' - #'value:' #special - #'submenu:' - #(#Menu #( - #(#MenuItem - #'label:' 'group radioButtons' - #'value:' #groupRadioButtons - ) - #(#MenuItem - #'label:' 'group enterFields' - #'value:' #groupEnterFields - ) - ) - nil - nil - ) - ) - #(#MenuItem #'label:' 'misc' #'value:' #misc #'submenu:' @@ -275,8 +429,12 @@ #'value:' #doWindowSpec ) #(#MenuItem - #'label:' 'browse' - #'value:' #browseAppClass + #'label:' 'browse application' + #'value:' #doBrowseAppClass + ) + #(#MenuItem + #'label:' 'start application' + #'value:' #doStartApplication ) ) #( 1 2 1) @@ -441,7 +599,7 @@ ) #(#PanelViewSpec #'name:' 'panelViewButtons' - #'layout:' #(#LayoutFrame -125 1.0 25 0.0 0 1.0 -372 1.0) + #'layout:' #(#LayoutFrame -125 1.0 25 0.0 0 1.0 57 0.0) #'component:' #(#SpecCollection #'collection:' @@ -456,7 +614,6 @@ #'model:' #moveSelectionLeft #'isTriggerOnDown:' true #'enableChannel:' #enableChannel - #'autoRepeat:' false #'extent:' #(#Point 26 24) ) #(#ActionButtonSpec @@ -469,7 +626,6 @@ #'model:' #moveSelectionRight #'isTriggerOnDown:' true #'enableChannel:' #enableChannel - #'autoRepeat:' false #'extent:' #(#Point 26 24) ) #(#ActionButtonSpec @@ -482,7 +638,6 @@ #'model:' #moveSelectionUp #'isTriggerOnDown:' true #'enableChannel:' #enableChannel - #'autoRepeat:' false #'extent:' #(#Point 26 24) ) #(#ActionButtonSpec @@ -495,7 +650,6 @@ #'model:' #moveSelectionDown #'isTriggerOnDown:' true #'enableChannel:' #enableChannel - #'autoRepeat:' false #'extent:' #(#Point 26 24) ) ) @@ -508,7 +662,7 @@ ) #(#SequenceViewSpec #'name:' 'objectTree' - #'layout:' #(#LayoutFrame 0 0.0 59 0.0 0 0.35 0 1.0) + #'layout:' #(#LayoutFrame 0 0.0 59 0.0 0 0.35 -25 1.0) #'enableChannel:' #enableChannel #'tabable:' true #'menu:' #objectListMenu @@ -522,7 +676,7 @@ ) #(#NoteBookViewSpec #'name:' 'noteBook' - #'layout:' #(#LayoutFrame 0 0.35 59 0.0 0 1.0 -30 1.0) + #'layout:' #(#LayoutFrame 0 0.35 59 0.0 0 1.0 -55 1.0) #'enableChannel:' #enableChannel #'tabable:' true #'menu:' #tabList @@ -537,7 +691,7 @@ ) #(#HorizontalPanelViewSpec #'name:' 'modifyPanel' - #'layout:' #(#LayoutFrame 0 0.35 -30 1.0 0 1.0 0 1.0) + #'layout:' #(#LayoutFrame 0 0.35 -55 1.0 0 1.0 -25 1.0) #'component:' #(#SpecCollection #'collection:' @@ -547,9 +701,7 @@ #'label:' 'cancel' #'tabable:' true #'model:' #cancel - #'isTriggerOnDown:' false #'enableChannel:' #modifiedChannel - #'autoRepeat:' false #'extent:' #(#Point 151 24) ) #(#ActionButtonSpec @@ -557,9 +709,7 @@ #'label:' 'ok' #'tabable:' true #'model:' #accept - #'isTriggerOnDown:' false #'enableChannel:' #modifiedChannel - #'autoRepeat:' false #'extent:' #(#Point 151 24) ) ) @@ -570,6 +720,13 @@ #'horizontalSpace:' 3 #'verticalSpace:' 3 ) + #(#LabelSpec + #'name:' 'helpInfo' + #'layout:' #(#LayoutFrame 2 0.0 -25 1.0 -2 1.0 -2 1.0) + #'label:' '' + #'level:' -1 + #'adjust:' #left + ) ) ) ) @@ -581,16 +738,19 @@ "automatically generated by UIPainter ..." |layout| - tabSelection = 'Dimension' ifTrue:[ + tabSelection = layoutTool label ifTrue:[ (layout := layoutTool layout) notNil ifTrue:[ layoutTool layoutType == #Extent ifTrue:[ self painter setExtent:layout ] ifFalse:[ - self painter setDimension:layout + self painter setLayout:layout ] ] ] ifFalse:[ - self painter updateFromSpec:(specView specEdited). + tabSelection = 'Help' ifTrue:[ + activeHelpTool accept + ]. + self painter updateFromSpec:(specView specEdited) ]. self cancel @@ -608,6 +768,35 @@ objectList selectGroup ! ! +!UIPainter methodsFor:'active help'! + +activeHelpTool + "automatically generated by UIPainter ..." + + activeHelpTool isNil ifTrue:[ + activeHelpTool := UIHelpTool new + ]. + ^ activeHelpTool +! + +showHelp:aHelpText for:view + "hook to allow an application to display active help + texts in its own info area. + This method may be redefined in a concrete application. + If it returns false, the ActiveHelp manager will popup a + bubble with the help text." + + |l| + + (l := self builder componentAt:#helpInfo) notNil ifTrue:[ + l label:aHelpText. + ^ true. + ]. + ^ false + + +! ! + !UIPainter methodsFor:'aspects'! enableChannel @@ -746,7 +935,7 @@ (painter respondsTo:(aMessage selector)) ifTrue:[ ^ aMessage sendTo:painter ]. - self error + super doesNotUnderstand:aMessage ! @@ -767,7 +956,7 @@ size := slices size + 1. list := Array new:size. slices keysAndValuesDo:[:i :s|list at:i put:(s first asString)]. - list at:size put:'Dimension'. + list at:size put:(layoutTool label). (self tabList) value:list. ] ifTrue:[ list := self tabList value @@ -864,11 +1053,15 @@ objectList removeDependent:self. objectList painter release. - objectList := nil. selectionPanel notNil ifTrue:[ selectionPanel closeRequest ]. + selectionPanel := nil. + layoutTool := nil. + objectList := nil. + activeHelpTool := nil. + super closeRequest. ! @@ -982,32 +1175,6 @@ !UIPainter methodsFor:'user interaction - dialog'! -browseAppClass - "open a browser on the class" - - |cls| - - specClass isNil ifTrue:[ - self information:'no class yet'. - ^ self - ]. - - specClass isBehavior ifFalse:[ - cls := Smalltalk at:specClass asSymbol - ] ifTrue:[ - cls := specClass - ]. - - cls isNil ifTrue:[ - self information:'no class yet'. - ^ self - ]. - - SystemBrowser openInClass:cls - - -! - checkClassAndSelector "check for class & superclass" @@ -1089,6 +1256,30 @@ !UIPainter methodsFor:'user interaction - pullDown'! +doBrowseAppClass + "open a browser on the class" + + |cls| + + specClass isNil ifTrue:[ + ^ self information:'no class yet'. + ]. + + specClass isBehavior ifFalse:[ + cls := Smalltalk at:specClass asSymbol + ] ifTrue:[ + cls := specClass + ]. + + cls isNil ifTrue:[ + ^ self information:'no class yet'. + ]. + + SystemBrowser openInClass:cls + + +! + doFromClass |className methodName cls sel accepted failed spec s painter| @@ -1242,6 +1433,29 @@ ! +doStartApplication + |cls| + + (specClass isNil or:[specSelector isNil]) ifTrue:[ + ^ self information:'no class or selector defined'. + ]. + + specClass isBehavior ifFalse:[ + cls := Smalltalk at:specClass asSymbol + ] ifTrue:[ + cls := specClass + ]. + + cls isNil ifTrue:[ + ^ self information:'class not existant'. + ]. + + (cls respondsTo:specSelector) ifFalse:[ + ^ self information:'selector not defined'. + ]. + cls new openInterface:specSelector +! + doWindowSpec |code code2 v| diff -r 785417b6955d -r e652608690b1 UIPainterView.st --- a/UIPainterView.st Mon Jun 16 11:34:16 1997 +0200 +++ b/UIPainterView.st Mon Jun 16 11:36:46 1997 +0200 @@ -24,13 +24,6 @@ privateIn:UIPainterView ! -UIPainterView::ViewProperty subclass:#GroupProperties - instanceVariableNames:'controlledObjects group name' - classVariableNames:'' - poolDictionaries:'' - privateIn:UIPainterView -! - MultiSelectionInList subclass:#ListHolder instanceVariableNames:'painter propertyList masterElement disabledChanged' classVariableNames:'' @@ -528,25 +521,29 @@ !UIPainterView methodsFor:'generating output'! generateActionMethodFor:aspect spec:protoSpec inClass:targetClass - |args| - + |args showIt| - (aspect last) == $: ifFalse:[args := '\'] - ifTrue:[args := 'anArgument\']. + (aspect asSymbol numArgs) == 1 ifFalse:[ + args := '\'. + showIt := ' ...''.\'. + ] ifTrue:[ + args := 'anArgument\'. + showIt := ''' , anArgument printString , '' ...''.\'. + ]. ^ ('!!' , targetClass name , ' methodsFor:''actions''!!\\' , aspect , args , ' "automatically generated by UIPainter ..."\' , '\' , ' "action to be added ..."\' , - ' Transcript showCR:''action for ' , aspect , ' ...''.\' , + ' Transcript showCR:self class name , '': action for ' , aspect , showIt , '!! !!\\') withCRs ! generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass |modelClass| - modelClass := protoSpec defaultModelClass. + modelClass := protoSpec defaultModelClassFor:aspect. ^ ('!!' , targetClass name , ' methodsFor:''aspects''!!\\' , aspect , '\' , @@ -660,54 +657,6 @@ "Modified: 5.9.1995 / 20:57:53 / claus" ! -generateInitCodeForGroup:aGroup - |code c name p objects outlets moreCode sym typ val| - - " := in:" - - code := ''. - - p := self propertyOfGroup:aGroup. - name := p at:#variableName. - c := ' ' , name , ' := ' , (aGroup class name) , ' new.\'. - - code := code , c withCRs. - - " :" - - objects := p at:#controlledObjects ifAbsent:[nil]. - objects notNil ifTrue:[ - objects do:[:controlledObject | - c := c , name , ' add:' , (self uniqueNameOf:controlledObject) , '.\' - ] - ]. - - code := code , c withCRs - - - - - -! - -generateInitCodeForOtherStuff - |code g c name p outlets moreCode sym typ val| - - code := ''. - - "generate code for groups" - - listHolder propertiesDo:[:props| - g := props at:#group ifAbsent:[nil]. - g notNil ifTrue:[ - code := code , (self generateInitCodeForGroup:g) - ] - ]. - ^ code - - -! - generateInitCodeForView:aView |code c name p outlets moreCode sym typ val| @@ -795,9 +744,6 @@ self subviewsOf:self do:[:v | code := code , (self generateInitCodeForView:v) ]. - - code := code , (self generateInitCodeForOtherStuff). - code := code , ' ^ self\' withCRs. defCode := Character excla asString , '\\'. @@ -814,10 +760,6 @@ ! -generateOutlets - ^ self -! - generateWindowSpecMethodSource |t s spec specArray str code| @@ -867,32 +809,6 @@ "Modified: 5.9.1995 / 21:01:35 / claus" ! -nameOfClass - ^ 'NewView' -! - -outletValueOf:aSymbol for:aView -"/ |c name p outlets moreCode sym typ val| -"/ -"/ p := self propertyOfView:aView. -"/ outlets := p at:#outlets ifAbsent:[^ nil]. -"/ outlets notNil ifTrue:[ -"/ outlets do:[:selectorOutlet | -"/ sym := selectorOutlet at:#selector. -"/ (sym == aSymbol) ifTrue:[ -"/ typ := selectorOutlet at:#type. -"/ val := selectorOutlet at:#value. -"/ ^ val -"/ ] -"/ ] -"/ ]. - ^ nil - - - - -! - storeContentsOn:aStream listHolder propertiesDo:[:p| p storeOn:aStream] ! @@ -914,73 +830,6 @@ ! ! -!UIPainterView methodsFor:'group manipulations'! - -groupEnterFields - |props group objects| - - self hasSelection ifFalse:[ - ^ self - ]. - self selectionDo:[:aView | - (aView isKindOf:EditField) ifFalse:[ - self warn:'select EditFields only !!'. - ^ self - ] - ]. - self withSelectionHiddenDo:[ - group := EnterFieldGroup new. - props := GroupProperties new. - name := self uniqueNameFor:(EnterFieldGroup className). - props group:group. - props name:name. - group groupID:name asSymbol. - objects := OrderedCollection new. - props controlledObjects:objects. - listHolder add:props. - - self selectionDo:[:aView | - objects add:aView. - group add:aView - ]. - ] - - -! - -groupRadioButtons - |props name group objects| - - self hasSelection ifFalse:[ - ^ self - ]. - self selectionDo:[:aView | - (aView isKindOf:RadioButton) ifFalse:[ - self warn:'select RadioButtons only !!'. - ^ self - ] - ]. - self withSelectionHiddenDo:[ - group := RadioButtonGroup new. - props := GroupProperties new. - name := self uniqueNameFor:(RadioButtonGroup className). - props group:group. - props name:name. - group groupID:name asSymbol. - objects := OrderedCollection new. - props controlledObjects:objects. - listHolder add:props. - - self selectionDo:[:aView | - aView turnOff. - objects add:aView. - group add:aView - ]. - ] - - "Modified: 5.9.1995 / 16:06:15 / claus" -! ! - !UIPainterView methodsFor:'initialization'! destroy @@ -1071,50 +920,6 @@ ! ! -!UIPainterView methodsFor:'misc'! - -changeFont:aFontDescription - |f| - - f := aFontDescription onDevice:device. -"/ f := Font family:family -"/ face:face -"/ style:style -"/ size:size. - - f notNil ifTrue:[ - self withSelectionHiddenDo:[ - self selectionDo:[:aView | - aView font:f. - self elementChangedSize:aView. - ] - ]. - ] - - "Modified: 5.9.1995 / 12:13:27 / claus" - "Created: 10.4.1997 / 09:56:16 / cg" -! - -changeFontFamily:family face:face style:style size:size - |f| - - f := Font family:family - face:face - style:style - size:size. - - f notNil ifTrue:[ - self withSelectionHiddenDo:[ - self selectionDo:[:aView | - aView font:f. - self elementChangedSize:aView. - ] - ] - ] - - "Modified: 5.9.1995 / 12:13:27 / claus" -! ! - !UIPainterView methodsFor:'removing components'! remove:anObject @@ -1183,12 +988,6 @@ ifFalse:[^ nil] ! -propertyOfGroup:aGroup - "returns property assigned to group - " - ^ listHolder detectProperty:[:p| p group == aGroup ] -! - propertyOfIdentifier:anId "returns property assigned to unique identifier " @@ -1665,10 +1464,6 @@ !UIPainterView::ViewProperty methodsFor:'accessing'! -group - ^ nil -! - identifier "return the unique identifier assigned to property " @@ -1751,42 +1546,6 @@ spec name:aName ! ! -!UIPainterView::GroupProperties methodsFor:'accessing'! - -controlledObjects - "return the value of the instance variable 'controlledObjects' (automatically generated)" - - ^ controlledObjects! - -controlledObjects:something - "set the value of the instance variable 'controlledObjects' (automatically generated)" - - controlledObjects := something.! - -group - "return the value of the instance variable 'group' - " - ^ group -! - -group:something - "set the value of the instance variable 'group' - " - group := something. -! - -name - "return the value of the group name - " - ^ name -! - -name:aName - "set the value of the group name - " - name := aName -! ! - !UIPainterView::ListHolder class methodsFor:'instance creation'! for:aPainter diff -r 785417b6955d -r e652608690b1 UIPropertyView.st --- a/UIPropertyView.st Mon Jun 16 11:34:16 1997 +0200 +++ b/UIPropertyView.st Mon Jun 16 11:36:46 1997 +0200 @@ -177,6 +177,7 @@ !UIPropertyView methodsFor:'initialization'! closeRequest + modifiedHolder notNil ifTrue:[ modifiedHolder removeDependent:self. modifiedHolder := nil. @@ -999,6 +1000,10 @@ self update. ! +label + ^ 'Layout' +! + layout "returns current layout "