diff -r bb0cc63e2cf1 -r 700f2ee9911e UILayoutTool.st --- a/UILayoutTool.st Thu Jun 26 15:02:21 1997 +0200 +++ b/UILayoutTool.st Fri Jun 27 11:59:12 1997 +0200 @@ -20,14 +20,28 @@ category:'Interface-UIPainter' ! -ApplicationModel subclass:#LayoutOrigin +ApplicationModel subclass:#AlignmentOrigin instanceVariableNames:'' classVariableNames:'' poolDictionaries:'' privateIn:UILayoutTool ! -ApplicationModel subclass:#Rectangle +ApplicationModel subclass:#Extent + instanceVariableNames:'' + classVariableNames:'' + poolDictionaries:'' + privateIn:UILayoutTool +! + +ApplicationModel subclass:#LayoutFrame + instanceVariableNames:'' + classVariableNames:'' + poolDictionaries:'' + privateIn:UILayoutTool +! + +ApplicationModel subclass:#LayoutOrigin instanceVariableNames:'' classVariableNames:'' poolDictionaries:'' @@ -41,21 +55,7 @@ privateIn:UILayoutTool ! -ApplicationModel subclass:#LayoutFrame - instanceVariableNames:'' - classVariableNames:'' - poolDictionaries:'' - privateIn:UILayoutTool -! - -ApplicationModel subclass:#AlignmentOrigin - instanceVariableNames:'' - classVariableNames:'' - poolDictionaries:'' - privateIn:UILayoutTool -! - -ApplicationModel subclass:#Extent +ApplicationModel subclass:#Rectangle instanceVariableNames:'' classVariableNames:'' poolDictionaries:'' @@ -103,8 +103,221 @@ ^ 'Layout' ! ! +!UILayoutTool class methodsFor:'help specs'! + +helpSpec + "return a dictionary filled with helpKey -> helptext associations. + These are used by the activeHelp tool. + " + ^ super helpSpec addPairsFrom:#( + +#layoutTool 'tool to set the layout of the component' + +#originX 'absolute origin x' +#originY 'absolute origin y' +#cornerX 'absolute corner x' +#cornerY 'absolute corner y' + +#leftRelative 'relative origin x' +#topRelative 'relative origin y' + +#leftAbsolute +'inset of the left edge; positive +is to the right, negative to the left' + +#topAbsolute +'inset of the top edge; positive +is to the bottom, negative to the top' + +#makeLeftAbsolute +'compute current left inset and relative +origin x to an absolute origin x' + +#makeLeftRelative +'compute current relative origin x and inset +of the left edge to a relative origin x' + +#makeTopRelative +'compute current relative origin y and inset +of the top edge to a relative origin y' + + +#makeTopAbsolute +'compute current top inset and relative +origin y to an absolute origin y' + +) +! ! + !UILayoutTool class methodsFor:'interface specs'! +layoutOriginSpec + "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:self andSelector:#layoutOriginSpec + self new openInterface:#layoutOriginSpec + " + + + + ^ + + #(#FullSpec + #'window:' + #(#WindowSpec + #'name:' 'uIPainterView' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'unnamed' + #'bounds:' #(#Rectangle 0 0 258 93) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#LabelSpec + #'name:' 'labelRelative' + #'layout:' #(#Point 57 12) + #'label:' 'relative' + ) + #(#LabelSpec + #'name:' 'labelAbsolute' + #'layout:' #(#Point 154 13) + #'label:' 'absolute' + ) + #(#LabelSpec + #'name:' 'labelLeft' + #'layout:' #(#AlignmentOrigin 52 0 44 0 1 0) + #'label:' 'left' + ) + #(#InputFieldSpec + #'name:' 'fieldLeftFraction' + #'layout:' #(#LayoutFrame 57 0 44 0 114 0 62 0) + #'activeHelpKey:' #leftRelative + #'tabable:' true + #'model:' #leftFraction + #'type:' #numberOrNil + ) + #(#ActionButtonSpec + #'name:' 'actionRelativeLeft' + #'layout:' #(#LayoutFrame 119 0 44 0 138 0 62 0) + #'activeHelpKey:' #makeLeftRelative + #'model:' #relativeLeft + ) + #(#InputFieldSpec + #'name:' 'fieldLeftOffset' + #'layout:' #(#LayoutFrame 154 0 44 0 212 0 62 0) + #'activeHelpKey:' #leftAbsolute + #'tabable:' true + #'model:' #leftOffset + #'type:' #numberOrNil + ) + #(#ActionButtonSpec + #'name:' 'actionAbsoluteLeft' + #'layout:' #(#LayoutFrame 216 0 44 0 235 0 62 0) + #'activeHelpKey:' #makeLeftAbsolute + #'model:' #absoluteLeft + ) + #(#LabelSpec + #'name:' 'labelTop' + #'layout:' #(#AlignmentOrigin 52 0 71 0 1 0) + #'label:' 'top' + ) + #(#InputFieldSpec + #'name:' 'fieldTopFraction' + #'layout:' #(#LayoutFrame 57 0 71 0 114 0 89 0) + #'activeHelpKey:' #topRelative + #'tabable:' true + #'model:' #topFraction + #'type:' #numberOrNil + ) + #(#ActionButtonSpec + #'name:' 'actionRelativeTop' + #'layout:' #(#LayoutFrame 119 0 71 0 138 0 89 0) + #'activeHelpKey:' #makeTopRelative + #'model:' #relativeTop + ) + #(#InputFieldSpec + #'name:' 'fieldTopOffset' + #'layout:' #(#LayoutFrame 154 0 71 0 212 0 89 0) + #'activeHelpKey:' #topAbsolute + #'tabable:' true + #'model:' #topOffset + #'type:' #numberOrNil + ) + #(#ActionButtonSpec + #'name:' 'actionAbsoluteTop' + #'layout:' #(#LayoutFrame 216 0 71 0 235 0 89 0) + #'activeHelpKey:' #makeTopAbsolute + #'model:' #absoluteTop + ) + ) + ) + ) + +! + +layoutPointSpec + "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:self andSelector:#layoutPointSpec + self new openInterface:#layoutPointSpec + " + + + ^ + + #(#FullSpec + #'window:' + #(#WindowSpec + #'name:' 'uIPainterView' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'unnamed' + #'bounds:' #(#Rectangle 0 0 194 66) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#LabelSpec + #'name:' 'labelOriginX' + #'layout:' #(#AlignmentOrigin 75 0 19 0 1 0) + #'label:' 'origin x:' + ) + #(#InputFieldSpec + #'name:' 'fieldOriginX' + #'layout:' #(#LayoutFrame 77 0 19 0 170 0 37 0) + #'activeHelpKey:' #originX + #'tabable:' true + #'model:' #leftOffset + #'type:' #numberOrNil + ) + #(#LabelSpec + #'name:' 'labelOriginY' + #'layout:' #(#AlignmentOrigin 75 0 46 0 1 0) + #'label:' 'origin y:' + ) + #(#InputFieldSpec + #'name:' 'fieldOriginY' + #'layout:' #(#LayoutFrame 77 0 46 0 170 0 64 0) + #'activeHelpKey:' #originY + #'tabable:' true + #'model:' #topOffset + #'type:' #numberOrNil + ) + ) + ) + ) + +! + slices ^ #( ( 'Frame' LayoutFrame) @@ -148,9 +361,10 @@ #(#NoteBookViewSpec #'name:' 'NoteBook' #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'activeHelpKey:' #layoutTool + #'enableChannel:' #enableChannel #'tabable:' true #'menu:' #noteBookList - #'enableChannel:' #enableChannel #'style:' #(#FontDescription #helvetica #medium @@ -159,7 +373,6 @@ #'model:' #noteBookModel #'tabWidget:' #Window #'direction:' #bottom -"/ #'useIndex:' true #'canvas:' #noteBookView ) ) @@ -448,465 +661,37 @@ appl := Smalltalk classNamed:(self class name asString, '::', appl). appl := appl new. appl masterApplication:self. + modifiedHolder value:true. ]. - self noteBookView client:appl + self noteBookView client:appl. ]. self update ! ! -!UILayoutTool::LayoutOrigin class methodsFor:'interface specs'! - -windowSpec - "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:UILayoutTool::LayoutOrigin andSelector:#windowSpec - UILayoutTool::LayoutOrigin new openInterface:#windowSpec - " - "UILayoutTool::LayoutOrigin open" - - +!UILayoutTool::AlignmentOrigin class methodsFor:'help specs'! - ^ - - #(#FullSpec - #'window:' - #(#WindowSpec - #'name:' 'uIPainterView' - #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) - #'label:' 'unnamed' - #'bounds:' #(#Rectangle 0 0 258 93) - ) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#LabelSpec - #'name:' 'labelRelative' - #'layout:' #(#Point 57 12) - #'label:' 'relative' - ) - #(#LabelSpec - #'name:' 'labelAbsolute' - #'layout:' #(#Point 154 13) - #'label:' 'absolute' - ) - #(#LabelSpec - #'name:' 'labelLeft' - #'layout:' #(#AlignmentOrigin 52 0 44 0 1 0) - #'label:' 'left' - ) - #(#InputFieldSpec - #'name:' 'fieldLeftFraction' - #'layout:' #(#LayoutFrame 57 0 44 0 114 0 62 0) - #'tabable:' true - #'model:' #leftFraction - #'type:' #numberOrNil - ) - #(#ActionButtonSpec - #'name:' 'actionRelativeLeft' - #'layout:' #(#LayoutFrame 119 0 44 0 138 0 62 0) - #'label:' '' - #'model:' #relativeLeft - ) - #(#InputFieldSpec - #'name:' 'fieldLeftOffset' - #'layout:' #(#LayoutFrame 154 0 44 0 212 0 62 0) - #'tabable:' true - #'model:' #leftOffset - #'type:' #numberOrNil - ) - #(#ActionButtonSpec - #'name:' 'actionAbsoluteLeft' - #'layout:' #(#LayoutFrame 216 0 44 0 235 0 62 0) - #'label:' '' - #'model:' #absoluteLeft - ) - #(#LabelSpec - #'name:' 'labelTop' - #'layout:' #(#AlignmentOrigin 52 0 71 0 1 0) - #'label:' 'top' - ) - #(#InputFieldSpec - #'name:' 'fieldTopFraction' - #'layout:' #(#LayoutFrame 57 0 71 0 114 0 89 0) - #'tabable:' true - #'model:' #topFraction - #'type:' #numberOrNil - ) - #(#ActionButtonSpec - #'name:' 'actionRelativeTop' - #'layout:' #(#LayoutFrame 119 0 71 0 138 0 89 0) - #'label:' '' - #'model:' #relativeTop - ) - #(#InputFieldSpec - #'name:' 'fieldTopOffset' - #'layout:' #(#LayoutFrame 154 0 71 0 212 0 89 0) - #'tabable:' true - #'model:' #topOffset - #'type:' #numberOrNil - ) - #(#ActionButtonSpec - #'name:' 'actionAbsoluteTop' - #'layout:' #(#LayoutFrame 216 0 71 0 235 0 89 0) - #'label:' '' - #'model:' #absoluteTop - ) - ) - ) - ) -! ! - -!UILayoutTool::LayoutOrigin methodsFor:'accessing'! - -fetch:aView - "fetch layoutOrigin +helpSpec + "return a dictionary filled with helpKey -> helptext associations. + These are used by the activeHelp tool. " - |layout| - - layout := UIPainterView asLayoutFrameFromView:aView. - - (self aspectFor:#leftOffset) value:(layout leftOffset). - (self aspectFor:#leftFraction) value:(layout leftFraction). - (self aspectFor:#topOffset) value:(layout topOffset). - (self aspectFor:#topFraction) value:(layout topFraction). - - -! - -layout - "returns current layout as layoutOrigin - " - |layout| - - layout := Smalltalk::LayoutOrigin new. - - layout leftOffset:((self aspectFor:#leftOffset) value) ? 0. - layout topOffset:((self aspectFor:#topOffset) value) ? 0. - layout leftFraction:((self aspectFor:#leftFraction) value) ? 0. - layout topFraction:((self aspectFor:#topFraction) value) ? 0. - - ^ layout - -! ! - -!UILayoutTool::Rectangle class methodsFor:'interface specs'! - -windowSpec - "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:UILayoutTool::Rectangle andSelector:#windowSpec - UILayoutTool::Rectangle new openInterface:#windowSpec - " - "UILayoutTool::Rectangle open" - - + ^ super helpSpec addPairsFrom:#( - ^ - - #(#FullSpec - #'window:' - #(#WindowSpec - #'name:' 'uIPainterView' - #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) - #'label:' 'unnamed' - #'bounds:' #(#Rectangle 0 0 224 146) - ) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#UISubSpecification - #'name:' 'subSpecification' - #'layout:' #(#LayoutOrigin 0 0 0 0) - #'majorKey:' #'UILayoutTool::Point' - #'minorKey:' #windowSpec - ) - #(#LabelSpec - #'name:' 'labelCornerX' - #'layout:' #(#AlignmentOrigin 75 0 74 0 1 0) - #'label:' 'corner x:' - #'adjust:' #left - ) - #(#InputFieldSpec - #'name:' 'fieldCornerX' - #'layout:' #(#LayoutFrame 77 0 74 0 170 0 92 0) - #'tabable:' true - #'model:' #rightOffset - #'type:' #numberOrNil - ) - #(#LabelSpec - #'name:' 'labelCornerY' - #'layout:' #(#AlignmentOrigin 75 0 101 0 1 0) - #'label:' 'corner y:' - #'adjust:' #left - ) - #(#InputFieldSpec - #'name:' 'fieldCornerY' - #'layout:' #(#LayoutFrame 77 0 101 0 170 0 119 0) - #'tabable:' true - #'model:' #bottomOffset - #'type:' #numberOrNil - ) - ) - ) - ) -! ! - -!UILayoutTool::Rectangle methodsFor:'accessing'! - -fetch:aView - "fetch rectangle - " - |origin corner| - - origin := aView computeOrigin. - corner := aView computeCorner. - - (self aspectFor:#leftOffset) value:(origin x). - (self aspectFor:#rightOffset) value:(corner x). - (self aspectFor:#topOffset) value:(origin y). - (self aspectFor:#bottomOffset) value:(corner y). - - -! +#alignVertical 'vertical inset to the location point of the component' +#alignHorizontal 'horizontal inset to the location point of the component' -layout - "returns current layout as rectangle - " - ^ Smalltalk::Rectangle left:(((self aspectFor:#leftOffset) value) ? 0) - top:(((self aspectFor:#topOffset) value) ? 0) - right:(((self aspectFor:#rightOffset) value) ? 0) - bottom:(((self aspectFor:#bottomOffset) value) ? 0) - - -! ! - -!UILayoutTool::Point class methodsFor:'interface specs'! - -windowSpec - "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:UILayoutTool::Point andSelector:#windowSpec - UILayoutTool::Point new openInterface:#windowSpec - " - "UILayoutTool::Point open" - - - - ^ - - #(#FullSpec - #'window:' - #(#WindowSpec - #'name:' 'uIPainterView' - #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) - #'label:' 'unnamed' - #'bounds:' #(#Rectangle 0 0 194 66) - ) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#LabelSpec - #'name:' 'labelOriginX' - #'layout:' #(#AlignmentOrigin 75 0 19 0 1 0) - #'label:' 'origin x:' - ) - #(#InputFieldSpec - #'name:' 'fieldOriginX' - #'layout:' #(#LayoutFrame 77 0 19 0 170 0 37 0) - #'tabable:' true - #'model:' #leftOffset - #'type:' #numberOrNil - ) - #(#LabelSpec - #'name:' 'labelOriginY' - #'layout:' #(#AlignmentOrigin 75 0 46 0 1 0) - #'label:' 'origin y:' - ) - #(#InputFieldSpec - #'name:' 'fieldOriginY' - #'layout:' #(#LayoutFrame 77 0 46 0 170 0 64 0) - #'tabable:' true - #'model:' #topOffset - #'type:' #numberOrNil - ) - ) - ) - ) -! ! - -!UILayoutTool::Point methodsFor:'accessing'! - -fetch:aView - "fetch point - " - |origin| - - origin := aView computeOrigin. - - (self aspectFor:#leftOffset) value:(origin x). - (self aspectFor:#topOffset) value:(origin y). - - -! - -layout - "returns current layout as point - " - ^ Smalltalk::Point x:(((self aspectFor:#leftOffset) value) ? 0) - y:(((self aspectFor:#topOffset) value) ? 0) - -! ! - -!UILayoutTool::LayoutFrame class methodsFor:'interface specs'! - -windowSpec - "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:UILayoutTool::LayoutFrame andSelector:#windowSpec - UILayoutTool::LayoutFrame new openInterface:#windowSpec - " - "UILayoutTool::LayoutFrame open" - - +#alignTopLeft 'align component to origin x and origin y' +#alignLeftCenter 'align component to origin x and (corner y)//2' +#alignBottomLeft 'align component to origin x and corner y' - ^ - - #(#FullSpec - #'window:' - #(#WindowSpec - #'name:' 'uIPainterView' - #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) - #'label:' 'unnamed' - #'bounds:' #(#Rectangle 0 0 250 193) - ) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#UISubSpecification - #'name:' 'subLayoutSpec' - #'layout:' #(#LayoutOrigin 0 0 0 0) - #'majorKey:' #'UILayoutTool::LayoutOrigin' - #'minorKey:' #windowSpec - ) - #(#LabelSpec - #'name:' 'labelRight' - #'layout:' #(#AlignmentOrigin 52 0 98 0 1 0) - #'label:' 'right' - ) - #(#InputFieldSpec - #'name:' 'fieldRightFraction' - #'layout:' #(#LayoutFrame 57 0 98 0 114 0 116 0) - #'model:' #rightFraction - #'type:' #numberOrNil - ) - #(#ActionButtonSpec - #'name:' 'actionRelativeRight' - #'layout:' #(#LayoutFrame 119 0 98 0 138 0 116 0) - #'label:' '' - #'model:' #relativeRight - ) - #(#InputFieldSpec - #'name:' 'fieldRightOffset' - #'layout:' #(#LayoutFrame 154 0 98 0 212 0 116 0) - #'model:' #rightOffset - #'type:' #numberOrNil - ) - #(#ActionButtonSpec - #'name:' 'actionAbsoluteRight' - #'layout:' #(#LayoutFrame 216 0 98 0 235 0 116 0) - #'label:' '' - #'model:' #absoluteRight - ) - #(#LabelSpec - #'name:' 'labelBottom' - #'layout:' #(#AlignmentOrigin 52 0 126 0 1 0) - #'label:' 'bottom' - ) - #(#InputFieldSpec - #'name:' 'fieldBottomFraction' - #'layout:' #(#LayoutFrame 57 0 126 0 114 0 144 0) - #'model:' #bottomFraction - #'type:' #numberOrNil - ) - #(#ActionButtonSpec - #'name:' 'actionRelativeBottom' - #'layout:' #(#LayoutFrame 119 0 126 0 138 0 144 0) - #'label:' '' - #'model:' #relativeBottom - ) - #(#InputFieldSpec - #'name:' 'fieldBottomOffset' - #'layout:' #(#LayoutFrame 154 0 126 0 211 0 144 0) - #'model:' #bottomOffset - #'type:' #numberOrNil - ) - #(#ActionButtonSpec - #'name:' 'actionAbsoluteBottom' - #'layout:' #(#LayoutFrame 216 0 126 0 235 0 144 0) - #'label:' '' - #'model:' #absoluteBottom - ) - ) - ) - ) -! ! +#alignTopRight 'align component to corner x and origin y' +#alignRightCenter 'align component to corner x and (corner y)//2' +#alignBottomRight 'align component to corner x and corner y' -!UILayoutTool::LayoutFrame methodsFor:'accessing'! - -fetch:aView - |layout| - - layout := UIPainterView asLayoutFrameFromView:aView. - - (self aspectFor:#leftOffset) value:(layout leftOffset). - (self aspectFor:#leftFraction) value:(layout leftFraction). - (self aspectFor:#topOffset) value:(layout topOffset). - (self aspectFor:#topFraction) value:(layout topFraction). - (self aspectFor:#rightOffset) value:(layout rightOffset). - (self aspectFor:#bottomOffset) value:(layout bottomOffset). - (self aspectFor:#rightFraction) value:(layout rightFraction). - (self aspectFor:#bottomFraction) value:(layout bottomFraction). - -! +#alignTopCenter 'align component to (corner x)//2 and origin y' +#alignCenter 'align component to (corner x)//2 and (corner y)//2' +#alignBottomCenter 'align component to (corner x)//2 and corner y' -layout - "returns current layout as layoutFrame - " - |layout| - - layout := Smalltalk::LayoutFrame new. - - layout leftOffset:((self aspectFor:#leftOffset) value) ? 0. - layout rightOffset:((self aspectFor:#rightOffset) value) ? 0. - layout topOffset:((self aspectFor:#topOffset) value) ? 0. - layout bottomOffset:((self aspectFor:#bottomOffset) value) ? 0. - layout leftFraction:((self aspectFor:#leftFraction) value) ? 0. - layout rightFraction:((self aspectFor:#rightFraction) value) ? 0. - layout topFraction:((self aspectFor:#topFraction) value) ? 0. - layout bottomFraction:((self aspectFor:#bottomFraction) value) ? 0. - - ^ layout - +) ! ! !UILayoutTool::AlignmentOrigin class methodsFor:'interface specs'! @@ -942,8 +727,8 @@ #(#UISubSpecification #'name:' 'subSpecification' #'layout:' #(#LayoutOrigin 0 0 0 0) - #'majorKey:' #'UILayoutTool::LayoutOrigin' - #'minorKey:' #windowSpec + #'majorKey:' #UILayoutTool + #'minorKey:' #layoutOriginSpec ) #(#LabelSpec #'name:' 'label5' @@ -960,6 +745,7 @@ #(#InputFieldSpec #'name:' 'editField5' #'layout:' #(#LayoutFrame 89 0 106 0 146 0 124 0) + #'activeHelpKey:' #alignHorizontal #'tabable:' true #'model:' #leftAlignmentFraction #'type:' #numberOrNil @@ -967,82 +753,83 @@ #(#InputFieldSpec #'name:' 'editField6' #'layout:' #(#LayoutFrame 89 0 132 0 146 0 150 0) + #'activeHelpKey:' #alignVertical #'tabable:' true #'model:' #topAlignmentFraction #'type:' #numberOrNil ) #(#DividerSpec #'name:' 'separator1' - #'layout:' #(#Rectangle 175 111 224 114) + #'layout:' #(#Rectangle 175 108 224 111) #'orientation:' #horizontal ) #(#DividerSpec #'name:' 'separator2' - #'layout:' #(#Rectangle 175 143 224 146) + #'layout:' #(#Rectangle 175 140 224 143) #'orientation:' #horizontal ) #(#DividerSpec #'name:' 'separator3' - #'layout:' #(#Rectangle 171 118 174 139) + #'layout:' #(#Rectangle 168 118 171 139) #'orientation:' #vertical ) #(#DividerSpec #'name:' 'separator4' - #'layout:' #(#Rectangle 226 118 229 139) + #'layout:' #(#Rectangle 223 118 226 139) #'orientation:' #vertical ) #(#ActionButtonSpec #'name:' 'alignBottomRight' #'layout:' #(#Rectangle 222 138 234 150) - #'label:' '' + #'activeHelpKey:' #alignBottomRight #'model:' #alignBottomRight ) #(#ActionButtonSpec #'name:' 'alignTopLeft' #'layout:' #(#Rectangle 166 107 178 119) - #'label:' '' + #'activeHelpKey:' #alignTopLeft #'model:' #alignTopLeft ) #(#ActionButtonSpec #'name:' 'alignTopRight' #'layout:' #(#Rectangle 222 107 234 119) - #'label:' '' + #'activeHelpKey:' #alignTopRight #'model:' #alignTopRight ) #(#ActionButtonSpec #'name:' 'alignBottomLeft' #'layout:' #(#Rectangle 166 137 178 149) - #'label:' '' + #'activeHelpKey:' #alignBottomLeft #'model:' #alignBottomLeft ) #(#ActionButtonSpec #'name:' 'alignTopCenter' #'layout:' #(#Rectangle 194 107 206 119) - #'label:' '' + #'activeHelpKey:' #alignTopCenter #'model:' #alignTopCenter ) #(#ActionButtonSpec #'name:' 'alignBottomCenter' #'layout:' #(#Rectangle 194 138 206 150) - #'label:' '' + #'activeHelpKey:' #alignBottomCenter #'model:' #alignBottomCenter ) #(#ActionButtonSpec #'name:' 'alignLeftCenter' #'layout:' #(#Rectangle 166 122 178 134) - #'label:' '' + #'activeHelpKey:' #alignLeftCenter #'model:' #alignLeftCenter ) #(#ActionButtonSpec #'name:' 'alignRightCenter' #'layout:' #(#Rectangle 222 122 234 134) - #'label:' '' + #'activeHelpKey:' #alignRightCenter #'model:' #alignRightCenter ) #(#ActionButtonSpec #'name:' 'alignCenter' #'layout:' #(#Rectangle 194 122 206 134) - #'label:' '' + #'activeHelpKey:' #alignCenter #'model:' #alignCenter ) ) @@ -1186,6 +973,20 @@ ! ! +!UILayoutTool::Extent class methodsFor:'help specs'! + +helpSpec + "return a dictionary filled with helpKey -> helptext associations. + These are used by the activeHelp tool. + " + ^ super helpSpec addPairsFrom:#( + +#vrtExtent 'vertical extent of the component' +#hrzExtent 'horizontal extent of the component' + +) +! ! + !UILayoutTool::Extent class methodsFor:'interface specs'! windowSpec @@ -1225,6 +1026,7 @@ #(#InputFieldSpec #'name:' 'fieldLeftOffset' #'layout:' #(#LayoutFrame 78 0 25 0 171 0 43 0) + #'activeHelpKey:' #hrzExtent #'tabable:' true #'model:' #leftOffset #'type:' #numberOrNil @@ -1238,6 +1040,7 @@ #(#InputFieldSpec #'name:' 'fieldRightOffset' #'layout:' #(#LayoutFrame 78 0 52 0 171 0 70 0) + #'activeHelpKey:' #vrtExtent #'tabable:' true #'model:' #rightOffset #'type:' #numberOrNil @@ -1270,6 +1073,497 @@ ! ! +!UILayoutTool::LayoutFrame class methodsFor:'help specs'! + +helpSpec + "return a dictionary filled with helpKey -> helptext associations. + These are used by the activeHelp tool. + " + ^ super helpSpec addPairsFrom:#( + +#makeRightRelative +'compute current relative corner x and inset +of the right edge to a relative corner x' + +#makeBottomRelative +'compute current relative corner y and inset +of the bottom edge to a relative corner y' + +#makeBottomAbsolute +'compute current bottom inset and relative +corner y to an absolute corner y' + +#makeRightAbsolute +'compute current right inset and relative +corner x to an absolute corner x' + +#bottomAbsolute +'inset of the bottom edge; positive +is to the top, negative to the bottom' + +#rightAbsolute +'inset of the right edge; positive +is to the left, negative to the right' + +#rightRelative 'relative corner x' +#bottomRelative 'relative corner y' + +) +! ! + +!UILayoutTool::LayoutFrame class methodsFor:'interface specs'! + +windowSpec + "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:UILayoutTool::LayoutFrame andSelector:#windowSpec + UILayoutTool::LayoutFrame new openInterface:#windowSpec + " + "UILayoutTool::LayoutFrame open" + + + + ^ + + #(#FullSpec + #'window:' + #(#WindowSpec + #'name:' 'uIPainterView' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'unnamed' + #'bounds:' #(#Rectangle 0 0 250 193) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#UISubSpecification + #'name:' 'subLayoutSpec' + #'layout:' #(#LayoutOrigin 0 0 0 0) + #'majorKey:' #UILayoutTool + #'minorKey:' #layoutOriginSpec + ) + #(#LabelSpec + #'name:' 'labelRight' + #'layout:' #(#AlignmentOrigin 52 0 98 0 1 0) + #'label:' 'right' + ) + #(#InputFieldSpec + #'name:' 'fieldRightFraction' + #'layout:' #(#LayoutFrame 57 0 98 0 114 0 116 0) + #'activeHelpKey:' #rightRelative + #'model:' #rightFraction + #'type:' #numberOrNil + ) + #(#ActionButtonSpec + #'name:' 'actionRelativeRight' + #'layout:' #(#LayoutFrame 119 0 98 0 138 0 116 0) + #'activeHelpKey:' #makeRightRelative + #'model:' #relativeRight + ) + #(#InputFieldSpec + #'name:' 'fieldRightOffset' + #'layout:' #(#LayoutFrame 154 0 98 0 212 0 116 0) + #'activeHelpKey:' #rightAbsolute + #'model:' #rightOffset + #'type:' #numberOrNil + ) + #(#ActionButtonSpec + #'name:' 'actionAbsoluteRight' + #'layout:' #(#LayoutFrame 216 0 98 0 235 0 116 0) + #'activeHelpKey:' #makeRightAbsolute + #'model:' #absoluteRight + ) + #(#LabelSpec + #'name:' 'labelBottom' + #'layout:' #(#AlignmentOrigin 52 0 126 0 1 0) + #'label:' 'bottom' + ) + #(#InputFieldSpec + #'name:' 'fieldBottomFraction' + #'layout:' #(#LayoutFrame 57 0 126 0 114 0 144 0) + #'activeHelpKey:' #bottomRelative + #'model:' #bottomFraction + #'type:' #numberOrNil + ) + #(#ActionButtonSpec + #'name:' 'actionRelativeBottom' + #'layout:' #(#LayoutFrame 119 0 126 0 138 0 144 0) + #'activeHelpKey:' #makeBottomRelative + #'model:' #relativeBottom + ) + #(#InputFieldSpec + #'name:' 'fieldBottomOffset' + #'layout:' #(#LayoutFrame 154 0 126 0 211 0 144 0) + #'activeHelpKey:' #bottomAbsolute + #'model:' #bottomOffset + #'type:' #numberOrNil + ) + #(#ActionButtonSpec + #'name:' 'actionAbsoluteBottom' + #'layout:' #(#LayoutFrame 216 0 126 0 235 0 144 0) + #'activeHelpKey:' #makeBottomAbsolute + #'model:' #absoluteBottom + ) + ) + ) + ) +! ! + +!UILayoutTool::LayoutFrame methodsFor:'accessing'! + +fetch:aView + |layout| + + layout := UIPainterView asLayoutFrameFromView:aView. + + (self aspectFor:#leftOffset) value:(layout leftOffset). + (self aspectFor:#leftFraction) value:(layout leftFraction). + (self aspectFor:#topOffset) value:(layout topOffset). + (self aspectFor:#topFraction) value:(layout topFraction). + (self aspectFor:#rightOffset) value:(layout rightOffset). + (self aspectFor:#bottomOffset) value:(layout bottomOffset). + (self aspectFor:#rightFraction) value:(layout rightFraction). + (self aspectFor:#bottomFraction) value:(layout bottomFraction). + +! + +layout + "returns current layout as layoutFrame + " + |layout| + + layout := Smalltalk::LayoutFrame new. + + layout leftOffset:((self aspectFor:#leftOffset) value) ? 0. + layout rightOffset:((self aspectFor:#rightOffset) value) ? 0. + layout topOffset:((self aspectFor:#topOffset) value) ? 0. + layout bottomOffset:((self aspectFor:#bottomOffset) value) ? 0. + layout leftFraction:((self aspectFor:#leftFraction) value) ? 0. + layout rightFraction:((self aspectFor:#rightFraction) value) ? 0. + layout topFraction:((self aspectFor:#topFraction) value) ? 0. + layout bottomFraction:((self aspectFor:#bottomFraction) value) ? 0. + + ^ layout + +! ! + +!UILayoutTool::LayoutFrame methodsFor:'actions'! + +absoluteBottom + "automatically generated by UIPainter ..." + + "action to be added ..." + Transcript showCR:self class name , ': action for absoluteBottom ...'. +! + +absoluteRight + "automatically generated by UIPainter ..." + + "action to be added ..." + Transcript showCR:self class name , ': action for absoluteRight ...'. +! + +relativeBottom + "automatically generated by UIPainter ..." + + "action to be added ..." + Transcript showCR:self class name , ': action for relativeBottom ...'. +! + +relativeRight + "automatically generated by UIPainter ..." + + "action to be added ..." + Transcript showCR:self class name , ': action for relativeRight ...'. +! ! + +!UILayoutTool::LayoutFrame methodsFor:'aspects'! + +bottomFraction + "automatically generated by UIPainter ..." + + |holder| + + (holder := builder bindingAt:#bottomFraction) isNil ifTrue:[ + builder aspectAt:#bottomFraction put:(holder := ValueHolder new). + ]. + ^ holder +! + +bottomOffset + "automatically generated by UIPainter ..." + + |holder| + + (holder := builder bindingAt:#bottomOffset) isNil ifTrue:[ + builder aspectAt:#bottomOffset put:(holder := ValueHolder new). + ]. + ^ holder +! + +rightFraction + "automatically generated by UIPainter ..." + + |holder| + + (holder := builder bindingAt:#rightFraction) isNil ifTrue:[ + builder aspectAt:#rightFraction put:(holder := ValueHolder new). + ]. + ^ holder +! + +rightOffset + "automatically generated by UIPainter ..." + + |holder| + + (holder := builder bindingAt:#rightOffset) isNil ifTrue:[ + builder aspectAt:#rightOffset put:(holder := ValueHolder new). + ]. + ^ holder +! ! + +!UILayoutTool::LayoutOrigin class methodsFor:'interface specs'! + +windowSpec + "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:UILayoutTool::LayoutOrigin andSelector:#windowSpec + UILayoutTool::LayoutOrigin new openInterface:#windowSpec + " + "UILayoutTool::LayoutOrigin open" + + + + ^ + + #(#FullSpec + #'window:' + #(#WindowSpec + #'name:' 'uIPainterView' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'unnamed' + #'bounds:' #(#Rectangle 0 0 258 93) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#UISubSpecification + #'name:' 'subSpecification' + #'layout:' #(#LayoutOrigin 0 0 0 0) + #'majorKey:' #UILayoutTool + #'minorKey:' #layoutOriginSpec + ) + ) + ) + ) +! ! + +!UILayoutTool::LayoutOrigin methodsFor:'accessing'! + +fetch:aView + "fetch layoutOrigin + " + |layout| + + layout := UIPainterView asLayoutFrameFromView:aView. + + (self aspectFor:#leftOffset) value:(layout leftOffset). + (self aspectFor:#leftFraction) value:(layout leftFraction). + (self aspectFor:#topOffset) value:(layout topOffset). + (self aspectFor:#topFraction) value:(layout topFraction). + + +! + +layout + "returns current layout as layoutOrigin + " + |layout| + + layout := Smalltalk::LayoutOrigin new. + + layout leftOffset:((self aspectFor:#leftOffset) value) ? 0. + layout topOffset:((self aspectFor:#topOffset) value) ? 0. + layout leftFraction:((self aspectFor:#leftFraction) value) ? 0. + layout topFraction:((self aspectFor:#topFraction) value) ? 0. + + ^ layout + +! ! + +!UILayoutTool::Point class methodsFor:'interface specs'! + +windowSpec + "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:UILayoutTool::Point andSelector:#windowSpec + UILayoutTool::Point new openInterface:#windowSpec + " + "UILayoutTool::Point open" + + + + ^ + + #(#FullSpec + #'window:' + #(#WindowSpec + #'name:' 'uIPainterView' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'unnamed' + #'bounds:' #(#Rectangle 0 0 194 66) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#UISubSpecification + #'name:' 'subSpecification' + #'layout:' #(#LayoutOrigin 0 0 0 0) + #'majorKey:' #UILayoutTool + #'minorKey:' #layoutPointSpec + ) + ) + ) + ) +! ! + +!UILayoutTool::Point methodsFor:'accessing'! + +fetch:aView + "fetch point + " + |origin| + + origin := aView computeOrigin. + + (self aspectFor:#leftOffset) value:(origin x). + (self aspectFor:#topOffset) value:(origin y). + + +! + +layout + "returns current layout as point + " + ^ Smalltalk::Point x:(((self aspectFor:#leftOffset) value) ? 0) + y:(((self aspectFor:#topOffset) value) ? 0) + +! ! + +!UILayoutTool::Rectangle class methodsFor:'interface specs'! + +windowSpec + "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:UILayoutTool::Rectangle andSelector:#windowSpec + UILayoutTool::Rectangle new openInterface:#windowSpec + " + "UILayoutTool::Rectangle open" + + + + ^ + + #(#FullSpec + #'window:' + #(#WindowSpec + #'name:' 'uIPainterView' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'unnamed' + #'bounds:' #(#Rectangle 0 0 224 146) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#UISubSpecification + #'name:' 'subSpecification' + #'layout:' #(#LayoutOrigin 0 0 0 0) + #'majorKey:' #UILayoutTool + #'minorKey:' #layoutPointSpec + ) + #(#LabelSpec + #'name:' 'labelCornerX' + #'layout:' #(#AlignmentOrigin 75 0 74 0 1 0) + #'label:' 'corner x:' + #'adjust:' #left + ) + #(#InputFieldSpec + #'name:' 'fieldCornerX' + #'layout:' #(#LayoutFrame 77 0 74 0 170 0 92 0) + #'activeHelpKey:' #cornerX + #'tabable:' true + #'model:' #rightOffset + #'type:' #numberOrNil + ) + #(#LabelSpec + #'name:' 'labelCornerY' + #'layout:' #(#AlignmentOrigin 75 0 101 0 1 0) + #'label:' 'corner y:' + #'adjust:' #left + ) + #(#InputFieldSpec + #'name:' 'fieldCornerY' + #'layout:' #(#LayoutFrame 77 0 101 0 170 0 119 0) + #'activeHelpKey:' #cornerY + #'tabable:' true + #'model:' #bottomOffset + #'type:' #numberOrNil + ) + ) + ) + ) +! ! + +!UILayoutTool::Rectangle methodsFor:'accessing'! + +fetch:aView + "fetch rectangle + " + |origin corner| + + origin := aView computeOrigin. + corner := aView computeCorner. + + (self aspectFor:#leftOffset) value:(origin x). + (self aspectFor:#rightOffset) value:(corner x). + (self aspectFor:#topOffset) value:(origin y). + (self aspectFor:#bottomOffset) value:(corner y). + + +! + +layout + "returns current layout as rectangle + " + ^ Smalltalk::Rectangle left:(((self aspectFor:#leftOffset) value) ? 0) + top:(((self aspectFor:#topOffset) value) ? 0) + right:(((self aspectFor:#rightOffset) value) ? 0) + bottom:(((self aspectFor:#bottomOffset) value) ? 0) + + +! ! + !UILayoutTool class methodsFor:'documentation'! version