diff -r 5af567f52811 -r 668eb9eae2ac UIPainter.st --- a/UIPainter.st Fri Feb 21 20:33:18 1997 +0100 +++ b/UIPainter.st Fri Feb 21 20:33:57 1997 +0100 @@ -13,19 +13,21 @@ ApplicationModel subclass:#UIPainter instanceVariableNames:'menu nameField elementMenu workView treeView outletView stringBox actionBox listBox fileBox currentFileName topView propertyFrame - whichProperty changeSelectorHolder changeChannel - aspectSelectorHolder aspectChannel nameChannel applyAction - leftFractionHolder leftOffsetHolder rightFractionHolder - rightOffsetHolder topFractionHolder topOffsetHolder - bottomFractionHolder bottomOffsetHolder specClass specSelector - specSuperclass leftAlignmentFractionHolder - topAlignmentFractionHolder classNameHolder methodNameHolder - aspectHolders propertyShown specShown' + whichProperty nameChannel applyAction specClass specSelector + specSuperclass aspectHolders specShown specSpecificAspectHolders + claus' classVariableNames:'' poolDictionaries:'' category:'Interface-UIPainter' ! +HorizontalPanelView subclass:#ButtonPanel + instanceVariableNames:'receiver argumentToSelector' + classVariableNames:'' + poolDictionaries:'' + privateIn:UIPainter +! + !UIPainter class methodsFor:'documentation'! copyright @@ -138,12 +140,54 @@ ) ! +cancelAndApplySpec + "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:#cancelAndApplySpec + UIPainter new openInterface:#cancelAndApplySpec + " + + + + ^ + + #(#FullSpec + #'window:' + #(#WindowSpec + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'unnamed' + #'bounds:' #(#Rectangle 0 0 225 45) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#ActionButtonSpec + #'name:' 'cancel' + #'layout:' #(#LayoutFrame 26 0 13 0 77 0 35 0) + #'label:' 'cancel' + #'model:' #cancel + ) + #(#ActionButtonSpec + #'name:' 'apply' + #'layout:' #(#LayoutFrame 139 0 13 0 190 0 35 0) + #'label:' 'apply' + #'model:' #apply + ) + ) + ) + ) +! + colorSpec "UIBuilder new openOnClass:self andSelector:#colorSpec" "Builder new openInterface:#colorSpec" - ^ #(#FullSpec @@ -186,14 +230,14 @@ #( #(#InputFieldSpec #'layout:' #(#LayoutFrame 0 0 49 0 163 0 69 0) - #model: #foregroundChannel + #model: #foregroundColor #acceptOnLostFocus: true #tabable: true ) #(#InputFieldSpec #'layout:' #(#LayoutFrame 0 0 119 0 163 0 142 0) - #model: #backgroundChannel + #model: #backgroundColor #acceptOnLostFocus: true #tabable: true @@ -227,491 +271,527 @@ ! geometrySpecForAlignmentOrigin - "UIBuilder new openOnClass:self andSelector:#geometrySpecForAlignmentOrigin" - "Builder new openInterface:#geometrySpecForAlignmentOrigin" - + " + UIPainter new openOnClass:self andSelector:#geometrySpecForAlignmentOrigin + " ^ - + #(#FullSpec + #'window:' + #(#WindowSpec + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'unnamed' + #'bounds:' #(#Rectangle 0 0 248 304) + ) #'component:' #(#SpecCollection #'collection:' #( - #(#FramedBoxSpec - #'layout:' #(#LayoutFrame 0 0 -1 0 253 0 291 0) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#VerticalPanelViewSpec - #'layout:' #(#LayoutFrame 6 0 26 0 85 0 219 0) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#LabelSpec - #'layout:' #(#LayoutFrame 0 0 19 0 30 0 43 0) - #'label:' 'left' - #'adjust:' #left - ) - #(#LabelSpec - #'layout:' #(#LayoutFrame 0 0 63 0 31 0 87 0) - #'label:' 'top' - #'adjust:' #left - ) - #(#LabelSpec - #'layout:' #(#LayoutFrame 0 0 107 0 41 0 131 0) - #'label:' 'align H' - #'adjust:' #left - ) - #(#LabelSpec - #'layout:' #(#LayoutFrame 0 0 151 0 61 0 175 0) - #'label:' 'align V' - #'adjust:' #left - ) - ) - ) - #'horizontalLayout:' #left - #'verticalLayout:' #spreadSpace - ) - #(#VerticalPanelViewSpec - #'layout:' #(#LayoutFrame 80 0 24 0 124 0 217 0) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 21 0 71 0 42 0) - #'type:' #numberOrNil - #model: #leftFractionChannel - #acceptOnLostFocus: true - #tabable: true - ) - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 64 0 71 0 85 0) - #'type:' #numberOrNil - #'model:' #'topFractionChannel' - #acceptOnLostFocus: true - #tabable: true - ) - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 107 0 71 0 128 0) - #'type:' #numberOrNil - #model: #'leftAlignmentFractionChannel' - #acceptOnLostFocus: true - #tabable: true - ) - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 150 0 71 0 171 0) - #'type:' #numberOrNil - #'model:' #'topAlignmentFractionChannel' - #acceptOnLostFocus: true - #tabable: true - ) - ) - ) - #'horizontalLayout:' #fit - #'verticalLayout:' #spreadSpace - ) - #(#VerticalPanelViewSpec - #'layout:' #(#LayoutFrame 150 0 24 0 220 0 216 0) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 21 0 114 0 42 0) - #'type:' #numberOrNil - #model: #leftOffsetChannel - #acceptOnLostFocus: true - #tabable: true - ) - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 64 0 114 0 85 0) - #'type:' #numberOrNil - #model: #topOffsetChannel - #acceptOnLostFocus: true - #tabable: true - ) - ) - ) - #'horizontalLayout:' #fit - #'verticalLayout:' #spreadSpace - ) - #(#ActionButtonSpec - #'name:' 'button' - #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0) - #'label:' 'frame' - #'model:' #setLayoutFrame - ) - #(#ActionButtonSpec - #'name:' 'button' - #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0) - #'label:' 'origin' - #'model:' #setLayoutOrigin - ) - #(#ActionButtonSpec - #'name:' 'button' - #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0) - #'label:' 'align' - #'model:' #setAlignmentOrigin - #'initiallyDisabled:' true - ) - - #(#ActionButtonSpec - #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0) - #'label:' 'apply' - #'model:' #setDimensionForAlignmentOrigin - #tabable: true - ) - #(#LabelSpec - #'layout:' #(#LayoutFrame 77 0 9 0 137 0 31 0) - #'label:' 'relative' - ) - #(#LabelSpec - #'layout:' #(#LayoutFrame 167 0 9 0 213 0 30 0) - #'label:' 'offset' - ) - ) - ) - #'labelPosition:' #topLeft - #'showFrame:' false + #(#LabelSpec + #'name:' 'label1' + #'layout:' #(#LayoutFrame 5 0 42 0 48 0 60 0) + #'label:' 'left' + ) + #(#LabelSpec + #'name:' 'label2' + #'layout:' #(#LayoutFrame 5 0 69 0 48 0 87 0) + #'label:' 'top' + ) + #(#LabelSpec + #'name:' 'label3' + #'layout:' #(#LayoutFrame 57 0 10 0 103 0 27 0) + #'label:' 'relative' + ) + #(#LabelSpec + #'name:' 'label4' + #'layout:' #(#LayoutFrame 154 0 11 0 190 0 28 0) + #'label:' 'offset' + ) + #(#LabelSpec + #'name:' 'label5' + #'layout:' #(#LayoutFrame 5 0 96 0 48 0 114 0) + #'label:' 'align H' + ) + #(#LabelSpec + #'name:' 'label6' + #'layout:' #(#LayoutFrame 5 0 122 0 48 0 140 0) + #'label:' 'align V' + ) + #(#InputFieldSpec + #'name:' 'editField1' + #'type:' #numberOrNil + #'layout:' #(#LayoutFrame 57 0 42 0 114 0 60 0) + #'model:' #leftFraction + #acceptOnLostFocus: true + #tabable: true + ) + #(#InputFieldSpec + #'name:' 'editField2' + #'type:' #numberOrNil + #'layout:' #(#LayoutFrame 57 0 69 0 114 0 87 0) + #'model:' #topFraction + #acceptOnLostFocus: true + #tabable: true + ) + #(#InputFieldSpec + #'name:' 'editField5' + #'type:' #numberOrNil + #'layout:' #(#LayoutFrame 57 0 96 0 114 0 114 0) + #'model:' #leftAlignmentFraction + #acceptOnLostFocus: true + #tabable: true + ) + #(#InputFieldSpec + #'name:' 'editField6' + #'type:' #numberOrNil + #'layout:' #(#LayoutFrame 56 0 122 0 113 0 140 0) + #'model:' #topAlignmentFraction + #acceptOnLostFocus: true + #tabable: true ) + #(#InputFieldSpec + #'name:' 'editField3' + #'type:' #numberOrNil + #'layout:' #(#LayoutFrame 154 0 42 0 212 0 60 0) + #'model:' #leftOffset + #acceptOnLostFocus: true + #tabable: true + ) + #(#InputFieldSpec + #'name:' 'editField4' + #'type:' #numberOrNil + #'layout:' #(#LayoutFrame 154 0 69 0 212 0 87 0) + #'model:' #topOffset + #acceptOnLostFocus: true + #tabable: true + ) + #(#ActionButtonSpec + #'name:' 'button1' + #'layout:' #(#LayoutFrame 119 0 42 0 138 0 60 0) + #'label:' '' + #'model:' #makeRelativeLeft + ) + #(#ActionButtonSpec + #'name:' 'button2' + #'layout:' #(#LayoutFrame 119 0 69 0 138 0 87 0) + #'label:' '' + #'model:' #makeRelativeTop + ) + #(#ActionButtonSpec + #'name:' 'button3' + #'layout:' #(#LayoutFrame 216 0 42 0 235 0 60 0) + #'label:' '' + #'model:' #makeOffsetLeft + ) + #(#ActionButtonSpec + #'name:' 'button4' + #'layout:' #(#LayoutFrame 216 0 69 0 235 0 87 0) + #'label:' '' + #'model:' #makeOffsetTop + ) + + + #(#ActionButtonSpec + #'name:' 'button' + #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0) + #'label:' 'frame' + #'model:' #setLayoutFrame + ) + #(#ActionButtonSpec + #'name:' 'button' + #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0) + #'label:' 'origin' + #'model:' #setLayoutOrigin + ) + #(#ActionButtonSpec + #'name:' 'button' + #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0) + #'label:' 'align' + #'model:' #setAlignmentOrigin + #'initiallyDisabled:' true + ) + #(#ActionButtonSpec + #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0) + #'label:' 'apply' + #'model:' #setDimensionForLayoutFrame + #tabable: true + ) + ) ) - #'window:' - #(#WindowSpec - #'label:' 'indy: unnamed' - #'bounds:' #(#Rectangle 0 0 255 292) - ) ) + + ! geometrySpecForLayoutFrame - "UIBuilder new openOnClass:self andSelector:#geometrySpecForLayoutFrame" - "Builder new openInterface:#geometrySpecForLayoutFrame" - - - - ^ - - #(#FullSpec - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#FramedBoxSpec - #'layout:' #(#LayoutFrame 0 0 -1 0 253 0 291 0) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#VerticalPanelViewSpec - #'layout:' #(#LayoutFrame 6 0 26 0 85 0 219 0) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#LabelSpec - #'layout:' #(#LayoutFrame 0 0 19 0 30 0 43 0) - #'label:' 'left' - #'adjust:' #left - ) - #(#LabelSpec - #'layout:' #(#LayoutFrame 0 0 63 0 30 0 87 0) - #'label:' 'top' - #'adjust:' #left - ) - #(#LabelSpec - #'layout:' #(#LayoutFrame 0 0 107 0 40 0 131 0) - #'label:' 'right' - #'adjust:' #left - ) - #(#LabelSpec - #'layout:' #(#LayoutFrame 0 0 151 0 40 0 175 0) - #'label:' 'bottom' - #'adjust:' #left - ) - ) - ) - #'horizontalLayout:' #left - #'verticalLayout:' #spreadSpace - ) - #(#VerticalPanelViewSpec - #'layout:' #(#LayoutFrame 80 0 24 0 124 0 217 0) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 21 0 71 0 42 0) - #'type:' #numberOrNil - #model: #leftFractionChannel - #acceptOnLostFocus: true - #tabable: true - ) - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 64 0 71 0 85 0) - #'type:' #numberOrNil - #'model:' #'topFractionChannel' - #acceptOnLostFocus: true - #tabable: true - ) - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 107 0 71 0 128 0) - #'type:' #numberOrNil - #model: #'rightFractionChannel' - #acceptOnLostFocus: true - #tabable: true - ) - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 150 0 71 0 171 0) - #'type:' #numberOrNil - #'model:' #'bottomFractionChannel' - #acceptOnLostFocus: true - #tabable: true - ) - ) - ) - #'horizontalLayout:' #fit - #'verticalLayout:' #spreadSpace - ) - #(#VerticalPanelViewSpec - #'layout:' #(#LayoutFrame 150 0 24 0 220 0 216 0) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 21 0 114 0 42 0) - #'type:' #numberOrNil - #model: #leftOffsetChannel - #acceptOnLostFocus: true - #tabable: true - ) - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 64 0 114 0 85 0) - #'type:' #numberOrNil - #model: #topOffsetChannel - #acceptOnLostFocus: true - #tabable: true - ) - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 107 0 114 0 128 0) - #'type:' #numberOrNil - #'model:' #rightOffsetChannel - #acceptOnLostFocus: true - #tabable: true - ) - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 150 0 114 0 171 0) - #'type:' #numberOrNil - #'model:' #bottomOffsetChannel - #acceptOnLostFocus: true - #tabable: true - ) - ) - ) - #'horizontalLayout:' #fit - #'verticalLayout:' #spreadSpace - ) - - #(#ActionButtonSpec - #'name:' 'button' - #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0) - #'label:' 'frame' - #'model:' #setLayoutFrame - #'initiallyDisabled:' true - ) - #(#ActionButtonSpec - #'name:' 'button' - #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0) - #'label:' 'origin' - #'model:' #setLayoutOrigin - ) - #(#ActionButtonSpec - #'name:' 'button' - #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0) - #'label:' 'align' - #'model:' #setAlignmentOrigin - ) - - #(#ActionButtonSpec - #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0) - #'label:' 'apply' - #'model:' #setDimensionForLayoutFrame - #tabable: true - ) - #(#LabelSpec - #'layout:' #(#LayoutFrame 77 0 9 0 137 0 31 0) - #'label:' 'relative' - ) - #(#LabelSpec - #'layout:' #(#LayoutFrame 167 0 9 0 213 0 30 0) - #'label:' 'offset' - ) - ) - ) - #'labelPosition:' #topLeft - #'showFrame:' false - ) - ) - ) - #'window:' - #(#WindowSpec - #'label:' 'indy: unnamed' - #'bounds:' #(#Rectangle 0 0 255 292) - ) - ) -! - -geometrySpecForLayoutOrigin - "UIPainter new openOnClass:self andSelector:#geometrySpecForLayoutOrigin" - "Builder new openInterface:#geometrySpecForLayoutOrigin" - + " + UIPainter new openOnClass:self andSelector:#geometrySpecForLayoutFrame + " ^ #(#FullSpec + #'window:' + #(#WindowSpec + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'unnamed' + #'bounds:' #(#Rectangle 0 0 300 300) + ) #'component:' #(#SpecCollection #'collection:' #( - #(#FramedBoxSpec - #'name:' 'framedBox' - #'layout:' #(#LayoutFrame 0 0 -1 0 253 0 291 0) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#VerticalPanelViewSpec - #'name:' 'verticalPanelView' - #'layout:' #(#LayoutFrame 6 0 26 0 85 0 219 0) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#LabelSpec - #'name:' 'label' - #'layout:' #(#LayoutFrame 0 0 19 0 30 0 43 0) - #'label:' 'left' - #'adjust:' #left - ) - #(#LabelSpec - #'name:' 'label' - #'layout:' #(#LayoutFrame 0 0 63 0 31 0 87 0) - #'label:' 'top' - #'adjust:' #left - ) - ) - ) - #'horizontalLayout:' #left - #'verticalLayout:' #spreadSpace - ) - #(#VerticalPanelViewSpec - #'name:' 'verticalPanelView' - #'layout:' #(#LayoutFrame 80 0 24 0 124 0 217 0) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 21 0 71 0 42 0) - #'type:' #numberOrNil - #model: #leftFractionChannel - #'acceptOnLostFocus:' true - #tabable: true - ) - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 64 0 71 0 85 0) - #'type:' #numberOrNil - #'model:' #'topFractionChannel' - #acceptOnLostFocus: true - #tabable: true - ) - ) - ) - #'horizontalLayout:' #fit - #'verticalLayout:' #spreadSpace - ) - #(#VerticalPanelViewSpec - #'name:' 'verticalPanelView' - #'layout:' #(#LayoutFrame 150 0 24 0 220 0 216 0) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 21 0 114 0 42 0) - #'type:' #numberOrNil - #model: #leftOffsetChannel - #acceptOnLostFocus: true - #tabable: true - ) - #(#InputFieldSpec - #'layout:' #(#LayoutFrame 0 0 64 0 114 0 85 0) - #'type:' #numberOrNil - #model: #topOffsetChannel - #acceptOnLostFocus: true - #tabable: true - ) - ) - ) - #'horizontalLayout:' #fit - #'verticalLayout:' #spreadSpace - ) - #(#ActionButtonSpec - #'name:' 'button' - #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0) - #'label:' 'frame' - #'model:' #setLayoutFrame - ) - #(#ActionButtonSpec - #'name:' 'button' - #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0) - #'label:' 'origin' - #'model:' #setLayoutOrigin - #'initiallyDisabled:' true - ) - #(#ActionButtonSpec - #'name:' 'button' - #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0) - #'label:' 'align' - #'model:' #setAlignmentOrigin - ) - #(#ActionButtonSpec - #'name:' 'button' - #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0) - #'label:' 'apply' - #'model:' #setDimensionForLayoutOrigin - ) - #(#LabelSpec - #'name:' 'label' - #'layout:' #(#LayoutFrame 77 0 9 0 137 0 31 0) - #'label:' 'relative' - ) - #(#LabelSpec - #'name:' 'label' - #'layout:' #(#LayoutFrame 159 0 9 0 205 0 30 0) - #'label:' 'offset' - ) - ) - ) - #'labelPosition:' #topLeft - #'showFrame:' false + #(#LabelSpec + #'name:' 'label left' + #'layout:' #(#LayoutFrame 12 0 39 0 53 0 57 0) + #'label:' 'left' + ) + #(#LabelSpec + #'name:' 'label top' + #'layout:' #(#LayoutFrame 12 0 67 0 53 0 85 0) + #'label:' 'top' + ) + #(#LabelSpec + #'name:' 'label right' + #'layout:' #(#LayoutFrame 12 0 95 0 53 0 113 0) + #'label:' 'right' + ) + #(#LabelSpec + #'name:' 'label bottom' + #'layout:' #(#LayoutFrame 12 0 123 0 53 0 141 0) + #'label:' 'bottom' + ) + #(#LabelSpec + #'name:' 'label relative' + #'layout:' #(#LayoutFrame 65 0 6 0 110 0 24 0) + #'label:' 'relative' + ) + #(#LabelSpec + #'name:' 'label offset' + #'layout:' #(#LayoutFrame 159 0 6 0 190 0 24 0) + #'label:' 'offset' + ) + #(#LabelSpec + #'name:' 'label all relative' + #'layout:' #(#LayoutFrame 12 0 157 0 53 0 175 0) + #'label:' 'all' + ) + #(#LabelSpec + #'name:' 'label all absolute' + #'layout:' #(#LayoutFrame 159 0 157 0 210 0 175 0) + #'label:' 'all' + ) + #(#InputFieldSpec + #'name:' 'relative E1' + #'layout:' #(#LayoutFrame 65 0 39 0 113 0 57 0) + #'model:' #leftFraction + #'type:' #numberOrNil + #'immediateAccept:' false + #'acceptOnLeave:' true + #'acceptOnReturn:' true + #'acceptOnTab:' true + #'acceptOnLostFocus:' true + ) + #(#InputFieldSpec + #'name:' 'relative E2' + #'layout:' #(#LayoutFrame 65 0 67 0 113 0 85 0) + #'model:' #topFraction + #'type:' #numberOrNil + #'immediateAccept:' false + #'acceptOnLeave:' true + #'acceptOnReturn:' true + #'acceptOnTab:' true + #'acceptOnLostFocus:' true + ) + #(#InputFieldSpec + #'name:' 'relative E3' + #'layout:' #(#LayoutFrame 65 0 95 0 113 0 113 0) + #'model:' #rightFraction + #'type:' #numberOrNil + #'immediateAccept:' false + #'acceptOnLeave:' true + #'acceptOnReturn:' true + #'acceptOnTab:' true + #'acceptOnLostFocus:' true + ) + #(#InputFieldSpec + #'name:' 'relative E4' + #'layout:' #(#LayoutFrame 65 0 123 0 113 0 141 0) + #'model:' #bottomFraction + #'type:' #numberOrNil + #'immediateAccept:' false + #'acceptOnLeave:' true + #'acceptOnReturn:' true + #'acceptOnTab:' true + #'acceptOnLostFocus:' true + ) + #(#InputFieldSpec + #'name:' 'offset E1' + #'layout:' #(#LayoutFrame 159 0 39 0 210 0 57 0) + #'model:' #leftOffset + #'type:' #numberOrNil + #'immediateAccept:' false + #'acceptOnLeave:' true + #'acceptOnReturn:' true + #'acceptOnTab:' true + #'acceptOnLostFocus:' true + ) + #(#InputFieldSpec + #'name:' 'offset E2' + #'layout:' #(#LayoutFrame 159 0 67 0 210 0 85 0) + #'model:' #topOffset + #'type:' #numberOrNil + #'immediateAccept:' false + #'acceptOnLeave:' true + #'acceptOnReturn:' true + #'acceptOnTab:' true + #'acceptOnLostFocus:' true + ) + #(#InputFieldSpec + #'name:' 'offset E3' + #'layout:' #(#LayoutFrame 159 0 95 0 210 0 113 0) + #'model:' #rightOffset + #'type:' #numberOrNil + #'immediateAccept:' false + #'acceptOnLeave:' true + #'acceptOnReturn:' true + #'acceptOnTab:' true + #'acceptOnLostFocus:' true + ) + #(#InputFieldSpec + #'name:' 'offset E4' + #'layout:' #(#LayoutFrame 159 0 123 0 210 0 141 0) + #'model:' #bottomOffset + #'type:' #numberOrNil + #'immediateAccept:' false + #'acceptOnLeave:' true + #'acceptOnReturn:' true + #'acceptOnTab:' true + #'acceptOnLostFocus:' true + ) + #(#ActionButtonSpec + #'name:' 'relative B1' + #'layout:' #(#LayoutFrame 117 0 39 0 136 0 57 0) + #'label:' '' + #'model:' #makeRelativeLeft + ) + #(#ActionButtonSpec + #'name:' 'relative B2' + #'layout:' #(#LayoutFrame 117 0 67 0 136 0 85 0) + #'label:' '' + #'model:' #makeRelativeTop + ) + #(#ActionButtonSpec + #'name:' 'relative B3' + #'layout:' #(#LayoutFrame 117 0 95 0 136 0 113 0) + #'label:' '' + #'model:' #makeRelativeRight + ) + #(#ActionButtonSpec + #'name:' 'relative B4' + #'layout:' #(#LayoutFrame 117 0 123 0 136 0 141 0) + #'label:' '' + #'model:' #makeRelativeBottom + ) + #(#ActionButtonSpec + #'name:' 'relative BAll' + #'layout:' #(#LayoutFrame 117 0 157 0 136 0 175 0) + #'label:' '' + #'model:' #makeRelativeAll + ) + #(#ActionButtonSpec + #'name:' 'offset B1' + #'layout:' #(#LayoutFrame 214 0 39 0 233 0 57 0) + #'label:' '' + #'model:' #makeOffsetLeft + ) + #(#ActionButtonSpec + #'name:' 'offset B2' + #'layout:' #(#LayoutFrame 214 0 67 0 233 0 85 0) + #'label:' '' + #'model:' #makeOffsetTop + ) + #(#ActionButtonSpec + #'name:' 'offset B3' + #'layout:' #(#LayoutFrame 214 0 95 0 233 0 113 0) + #'label:' '' + #'model:' #makeOffsetRight + ) + #(#ActionButtonSpec + #'name:' 'offset B4' + #'layout:' #(#LayoutFrame 214 0 123 0 233 0 141 0) + #'label:' '' + #'model:' #makeOffsetBottom + ) + #(#ActionButtonSpec + #'name:' 'offset BAll' + #'layout:' #(#LayoutFrame 214 0 157 0 233 0 175 0) + #'label:' '' + #'model:' #makeOffsetAll + ) + #(#ActionButtonSpec + #'name:' 'button' + #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0) + #'label:' 'frame' + #'model:' #setLayoutFrame + ) + #(#ActionButtonSpec + #'name:' 'button10' + #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0) + #'label:' 'origin' + #'model:' #setLayoutOrigin + ) + #(#ActionButtonSpec + #'name:' 'button11' + #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0) + #'label:' 'align' + #'model:' #setAlignmentOrigin + ) + #(#ActionButtonSpec + #'name:' 'button12' + #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0) + #'label:' 'apply' + #'model:' #setDimensionForLayoutFrame ) ) ) + ) + + +! + +geometrySpecForLayoutOrigin + " + UIPainter new openOnClass:self andSelector:#geometrySpecForLayoutOrigin + " + + + ^ + + #(#FullSpec #'window:' #(#WindowSpec - #'label:' 'indy: unnamed' - #'bounds:' #(#Rectangle 0 0 255 292) + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'unnamed' + #'bounds:' #(#Rectangle 0 0 248 304) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#LabelSpec + #'name:' 'label1' + #'layout:' #(#LayoutFrame 16 0 42 0 44 0 60 0) + #'label:' 'left' + ) + #(#LabelSpec + #'name:' 'label2' + #'layout:' #(#LayoutFrame 16 0 69 0 44 0 87 0) + #'label:' 'top' + ) + #(#LabelSpec + #'name:' 'label3' + #'layout:' #(#LayoutFrame 57 0 10 0 103 0 27 0) + #'label:' 'relative' + ) + #(#LabelSpec + #'name:' 'label4' + #'layout:' #(#LayoutFrame 154 0 11 0 190 0 28 0) + #'label:' 'offset' + ) + #(#InputFieldSpec + #'name:' 'editField1' + #'type:' #numberOrNil + #'layout:' #(#LayoutFrame 57 0 42 0 114 0 60 0) + #'model:' #leftFraction + #acceptOnLostFocus: true + #tabable: true + ) + #(#InputFieldSpec + #'name:' 'editField2' + #'type:' #numberOrNil + #'layout:' #(#LayoutFrame 57 0 69 0 114 0 87 0) + #'model:' #topFraction + #acceptOnLostFocus: true + #tabable: true + ) + #(#InputFieldSpec + #'name:' 'editField3' + #'type:' #numberOrNil + #'layout:' #(#LayoutFrame 154 0 42 0 212 0 60 0) + #'model:' #leftOffset + #acceptOnLostFocus: true + #tabable: true + ) + #(#InputFieldSpec + #'name:' 'editField4' + #'type:' #numberOrNil + #'layout:' #(#LayoutFrame 154 0 69 0 212 0 87 0) + #'model:' #topOffset + #acceptOnLostFocus: true + #tabable: true + ) + #(#ActionButtonSpec + #'name:' 'button1' + #'layout:' #(#LayoutFrame 119 0 42 0 138 0 60 0) + #'label:' '' + #'model:' #makeRelativeLeft + ) + #(#ActionButtonSpec + #'name:' 'button2' + #'layout:' #(#LayoutFrame 119 0 69 0 138 0 87 0) + #'label:' '' + #'model:' #makeRelativeTop + ) + #(#ActionButtonSpec + #'name:' 'button3' + #'layout:' #(#LayoutFrame 216 0 42 0 235 0 60 0) + #'label:' '' + #'model:' #makeOffsetLeft + ) + #(#ActionButtonSpec + #'name:' 'button4' + #'layout:' #(#LayoutFrame 216 0 69 0 235 0 87 0) + #'label:' '' + #'model:' #makeOffsetTop + ) + + + #(#ActionButtonSpec + #'name:' 'button' + #'layout:' #(#LayoutFrame 16 0 210 0 76 0 240 0) + #'label:' 'frame' + #'model:' #setLayoutFrame + ) + #(#ActionButtonSpec + #'name:' 'button' + #'layout:' #(#LayoutFrame 96 0 210 0 156 0 240 0) + #'label:' 'origin' + #'model:' #setLayoutOrigin + #'initiallyDisabled:' true + ) + #(#ActionButtonSpec + #'name:' 'button' + #'layout:' #(#LayoutFrame 176 0 210 0 236 0 240 0) + #'label:' 'align' + #'model:' #setAlignmentOrigin + ) + #(#ActionButtonSpec + #'layout:' #(#LayoutFrame 96 0 260 0 156 0 290 0) + #'label:' 'apply' + #'model:' #setDimensionForLayoutFrame + #tabable: true + ) + + ) ) ) + ! miscSpec @@ -878,9 +958,7 @@ "do not manually edit this - the painter/builder may not be able to handle the specification if its corrupted." - "UIPainter new openOnClass:NewApplication andSelector:#windowSpec" - "NewApplication new openInterface:#windowSpec" - "NewApplication open" + "UIPainter new openOnClass:self andSelector:#nameAndSelectorSpec" @@ -1009,6 +1087,10 @@ singleSelection := workView singleSelection. + something == #selection ifTrue:[ + claus setupView:singleSelection. + ]. + (something == #layout or:[something == #any]) ifTrue:[ singleSelection notNil ifTrue:[ self fetchLayoutFrom:singleSelection @@ -1042,39 +1124,11 @@ !UIPainter methodsFor:'aspects'! aspectFor:aKey - ^ aspectHolders at:aKey ifAbsent:[super aspectFor:aKey] -! - -backgroundChannel - ^ self aspectFor:#backgroundChannel -! - -bottomFractionChannel - ^ bottomFractionHolder -! - -bottomOffsetChannel - ^ bottomOffsetHolder - -! - -foregroundChannel - ^ self aspectFor:#foregroundChannel - -! - -leftAlignmentFractionChannel - ^ leftAlignmentFractionHolder - -! - -leftFractionChannel - ^ leftFractionHolder - -! - -leftOffsetChannel - ^ leftOffsetHolder + ^ specSpecificAspectHolders at:aKey ifAbsent:[ + aspectHolders at:aKey ifAbsent:[ + super aspectFor:aKey + ] + ] ! @@ -1085,31 +1139,6 @@ ^ nameChannel "Modified: 6.9.1995 / 00:38:00 / claus" -! - -rightFractionChannel - ^ rightFractionHolder - -! - -rightOffsetChannel - ^ rightOffsetHolder - -! - -topAlignmentFractionChannel - ^ topAlignmentFractionHolder - -! - -topFractionChannel - ^ topFractionHolder - -! - -topOffsetChannel - ^ topOffsetHolder - ! ! !UIPainter methodsFor:'filein & fileout'! @@ -1156,30 +1185,6 @@ !UIPainter methodsFor:'initialization'! -buttonPanelSpec - "return a spec for the buttons in the panel; - entries consists of selector and bitmap-filename. - nil selectors are taken as separators (see setupButtonPanel)" - - ^ #( - #( alignSelectionLeft 'b_alignL.xbm' ) - #( alignSelectionRight 'b_alignR.xbm' ) - #( alignSelectionLeftAndRight 'b_alignLR.xbm' ) - #( nil ) - #( alignSelectionTop 'b_alignT.xbm' ) - #( alignSelectionBottom 'b_alignB.xbm' ) - #( alignSelectionTopAndBottom 'b_alignTB.xbm' ) - #( nil ) - #( alignSelectionCenterHor 'b_alignCH.xbm' ) - #( alignSelectionCenterVer 'b_alignCV.xbm' ) - #( nil ) - #( moveSelectionLeft: 'b_moveLeft.xbm' ) - #( moveSelectionRight: 'b_moveRight.xbm' ) - #( moveSelectionUp: 'b_moveUp.xbm' ) - #( moveSelectionDown: 'b_moveDown.xbm' ) - ) -! - createCanvas |topView| @@ -1220,30 +1225,41 @@ ! initChannels + |cls| + + specSpecificAspectHolders := IdentityDictionary new. aspectHolders := IdentityDictionary new. - aspectHolders at:#classNameChannel put:((specClass notNil ifTrue:[specClass name] ifFalse:['NewApplication']) asValue). - aspectHolders at:#superclassNameChannel put:((specClass notNil ifTrue:[specClass superclass] ifFalse:[ApplicationModel]) name asValue). - aspectHolders at:#methodNameChannel put:((specSelector notNil ifTrue:[specSelector] ifFalse:[#windowSpec]) asValue). + aspectHolders at:#classNameChannel put:( + (specClass notNil ifTrue:[specClass] + ifFalse:['NewApplication']) asValue + ). + specSuperclass isNil ifTrue:[ + specClass notNil ifTrue:[ + (cls := Smalltalk at:specClass asSymbol) notNil ifTrue:[ + specSuperclass := cls superclass name. + ] + ] + ]. + aspectHolders at:#superclassNameChannel put:( + (specSuperclass notNil ifTrue:[specSuperclass] + ifFalse:['ApplicationModel']) asValue + ). + aspectHolders at:#methodNameChannel put:( + (specSelector notNil ifTrue:[specSelector] + ifFalse:[#windowSpec]) asValue + ). aspectHolders at:#aspectChannel put:(ValueHolder new). aspectHolders at:#changeChannel put:(ValueHolder new). - aspectHolders at:#foregroundChannel put:(ValueHolder new). - aspectHolders at:#backgroundChannel put:(ValueHolder new). - - - bottomFractionHolder := nil asValue. - bottomOffsetHolder := nil asValue. - leftFractionHolder := nil asValue. - leftOffsetHolder := nil asValue. - rightFractionHolder := nil asValue. - rightOffsetHolder := nil asValue. - topFractionHolder := nil asValue. - topOffsetHolder := nil asValue. - leftAlignmentFractionHolder := nil asValue. - topAlignmentFractionHolder := nil asValue. - + aspectHolders at:#foregroundColor put:(ValueHolder new). + aspectHolders at:#backgroundColor put:(ValueHolder new). + + #( bottomFraction leftFraction topFraction rightFraction leftAlignmentFraction + bottomOffset leftOffset topOffset rightOffset topAlignmentFraction + ) + do:[:aChannel| aspectHolders at:aChannel put:(ValueHolder new) ]. ! initPullDownMenu @@ -1306,29 +1322,7 @@ ) receiver:self. - menu at:#font - putLabels:(resources array:#( - 'larger' - 'smaller' - '-' - 'normal' - 'bold' - 'italic' - 'bold italic' - '-' - 'font panel' - ) ) - selectors:#(largerFont - smallerFont - nil - normalFont - boldFont - italicFont - boldItalicFont - nil - showFontPanel - ) - receiver:workView. + menu at:#font putMenu:(workView subMenuFont menuView). menu at:#type putLabels:(resources array:#( @@ -1358,11 +1352,15 @@ menu at:#special putLabels:(resources array:#( 'group radioButtons' - 'group enterFields' + 'group enterFields' + '-' + 'delete undo history' ) ) selectors:#( groupRadioButtons groupEnterFields + nil + undoDeleteAll ) receiver:workView. @@ -1385,16 +1383,16 @@ ! openInterface - |list panel topPane botPanel v - leftPanel middlePanel rightPanel buttonPanel propSelector| + |list v topInset menuInset leftPanel middlePanel rightPanel buttonPanel propSelector| super initialize. self initChannels. whichProperty := SelectionInList new. - whichProperty list:#('dimension' 'colors' 'model' 'misc' 'attribute list'). - whichProperty onChangeSend:#propertySelectionChanged to:self. +"/ whichProperty list:#('dimension' 'colors' 'model' 'misc' 'attribute list'). + whichProperty list:(UISpecification slices collect:[:slice | slice first asString]). + whichProperty onChangeSend:#showPropertyView to:self. workView :=self createCanvas. @@ -1403,21 +1401,20 @@ topView icon:(Image fromFile:'bitmaps/Builder.xbm' resolution:100). topView extent:(600 @ 400). - menu := PullDownMenu in:topView. - - buttonPanel := self setupButtonPanelIn:topView below:menu. - - leftPanel := View in:topView. - leftPanel origin:(0.0 @ 0.0) corner:0.3@1.0. - leftPanel topInset:menu height + buttonPanel height + View viewSpacing. - - middlePanel := View in:topView. - middlePanel origin:(0.3 @ 0.0) corner:0.6@1.0. - middlePanel topInset:menu height + buttonPanel height + View viewSpacing. - - rightPanel := View in:topView. - rightPanel origin:(0.6 @ 0.0) corner:1.0@1.0. - rightPanel topInset:menu height + buttonPanel height + View viewSpacing. + menu := PullDownMenu in:topView. + buttonPanel := ButtonPanel in:topView. + + menuInset := menu preferredExtent y. + topInset := menuInset + buttonPanel preferredExtent y. + + buttonPanel origin:0.0@menuInset corner:1.0@topInset. + buttonPanel receiver:workView. + leftPanel := View origin:(0.0 @ 0.0) corner:0.3@1.0 in:topView. + leftPanel topInset:topInset. + middlePanel := View origin:(0.3 @ 0.0) corner:0.6@1.0 in:topView. + middlePanel topInset:topInset. + rightPanel := View origin:(0.6 @ 0.0) corner:1.0@1.0 in:topView. + rightPanel topInset:topInset. v := HVScrollableView for:UIPainterTreeView miniScrollerH:true in:middlePanel. v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). @@ -1432,33 +1429,11 @@ propertyFrame origin:(0.0 @ 0.0) corner:1.0@1.0. propertyFrame topInset:propSelector height + View viewSpacing. -"/ panel := VariableVerticalPanel in:topView. -"/ panel origin:(0.0 @ 0.0) corner:0.5@1.0. -"/ panel topInset:menu height + buttonPanel height + View viewSpacing. - -"/ topPane := View in:panel. -"/ topPane origin:(0.0 @ 0.0) corner:(1.0 @ 0.5). -"/ topPane borderWidth:0. - -"/ botPanel := VariableHorizontalPanel in:panel. -"/ botPanel origin:(0.0 @ 0.5) corner:(1.0 @ 1.0). -"/ botPanel borderWidth:0. + claus := View origin:(0.0 @ 0.0) corner:1.0@1.0 in:rightPanel. + claus := UIPropertyView in:claus receiver:workView. elementMenu := self createPaletteIn:leftPanel. -"/ v := ScrollableView for:UIPainterTreeView in:botPanel. -"/ v origin:(0.0 @ 0.0) corner:(0.5 @ 1.0). -"/ treeView := v scrolledView. - -"/ v := ScrollableView for:SelectionInListView in:botPanel. -"/ v origin:(0.5 @ 0.0) corner:(1.0 @ 1.0). -"/ outletView := v scrolledView. -"/ outletView action:[:lineNr | self selectOutlet:lineNr]. - -"/ v := ScrollableView for:TextCollector in:topPane. -"/ v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). -"/ infoView := v scrolledView. - treeView builderView:workView. "link workview with treeview" workView addDependent:treeView. @@ -1512,8 +1487,8 @@ |specArray| - specClass := aClass. - specSuperclass := aClass superclass. + specClass := aClass name. + specSuperclass := aClass superclass name. specSelector := aSelector. self openInterface. @@ -1528,68 +1503,105 @@ |newBuilder| newBuilder := self new. +! ! + +!UIPainter methodsFor:'make layout'! + +makeLayout:what xOrY:xOrY offset:aBool + |view layout extent fraction offset fractSymb offsetSymb| + + view := workView singleSelection. + + view isNil ifTrue:[ + ^ self + ]. + layout := view geometryLayout. + + layout isLayout ifFalse:[ + ^ self + ]. + fractSymb := (what, 'Fraction') asSymbol. + offsetSymb := (what, 'Offset') asSymbol. + + ( (layout respondsTo:fractSymb) + and:[layout respondsTo:offsetSymb] + ) ifTrue:[ + + fraction := layout perform:fractSymb. + offset := layout perform:offsetSymb. + extent := (view superView computeExtent) perform:xOrY. + + aBool ifTrue:[ + offset := offset + ((fraction * extent) asInteger). + (aspectHolders at:offsetSymb) value:offset. + (aspectHolders at:fractSymb) value:0. + ] ifFalse:[ + fraction := (fraction + (offset / extent)) asFloat. + + (fraction > 1.0) ifTrue:[ fraction := 1.0 ]. + (fraction < 0.0) ifTrue:[ fraction := 0.0 ]. + + (aspectHolders at:offsetSymb) value:0. + (aspectHolders at:fractSymb) value:fraction. + ] + ] ! -setupButtonPanelIn:aTopView below:aMenu - "create the buttonPanel - " - |spc mh buttonPanel pressAction| - - spc := View viewSpacing // 2. - buttonPanel := HorizontalPanelView in:aTopView. - buttonPanel level:-1; borderWidth:0. - buttonPanel horizontalLayout:#leftSpace. - - pressAction := [:aButton :aSelector| - |menu org top| - - workView selection notNil ifTrue:[ - top := aButton topView. - - org := top origin + (aButton originRelativeTo:top) - + (0@((spc + aButton extent y))). - - menu := PopUpMenu labels:#( '1' '2' '4' '10' '..' ) - args:#( 1 2 4 10 nil ). - - menu action:[:anArg||no| - (no := anArg) isNil ifTrue:[ - no := EnterBox request:'number'. - no := SmallInteger readFrom:no onError:0. - ]. - no ~~ 0 ifTrue:[ - workView perform:aSelector with:no - ] - ]. - menu showAt:org. - ]. - aButton turnOff - ]. - - self buttonPanelSpec do:[:anArray| |selector image button| - selector := anArray at:1. - - selector notNil ifTrue:[ - image := Image fromFile:( anArray at:2 ). - button := Button label:image in:buttonPanel. - - selector last == $: ifFalse:[ - button action:[ workView perform:selector ] - ] ifTrue:[ - button pressAction:[ pressAction value:button value:selector ] - ] - ] ifFalse:[|sep| - sep := View in:buttonPanel. - sep extent:20@1; borderWidth:0. - ] - ]. - - mh := aMenu height. - buttonPanel origin:0.0 @ (mh + spc) - corner:(1.0 @ (mh + spc + buttonPanel preferredExtent y)). - - buttonPanel leftInset:spc; rightInset:spc. - ^ buttonPanel +makeOffsetAll + self makeOffsetLeft. + self makeOffsetTop. + self makeOffsetRight. + self makeOffsetBottom. + +! + +makeOffsetBottom + self makeLayout:'bottom' xOrY:#y offset:true. + +! + +makeOffsetLeft + self makeLayout:'left' xOrY:#x offset:true. + +! + +makeOffsetRight + self makeLayout:'right' xOrY:#x offset:true. + +! + +makeOffsetTop + self makeLayout:'top' xOrY:#y offset:true. + + +! + +makeRelativeAll + self makeRelativeLeft. + self makeRelativeTop. + self makeRelativeRight. + self makeRelativeBottom. + +! + +makeRelativeBottom + self makeLayout:'bottom' xOrY:#y offset:false. + +! + +makeRelativeLeft + self makeLayout:'left' xOrY:#x offset:false. + +! + +makeRelativeRight + self makeLayout:'right' xOrY:#x offset:false. + +! + +makeRelativeTop + self makeLayout:'top' xOrY:#y offset:false. + ! ! !UIPainter methodsFor:'misc'! @@ -1769,12 +1781,33 @@ ! setupPropertyFromSpec:aSpec + "apply is pressed in the geometry-sub view, with a alignmentOrigin selected + " + |aViewsSpec| + + workView singleSelectionDo:[:selectedView | + aViewsSpec := workView generateSpecFor:selectedView. + aViewsSpec := aViewsSpec first. + ]. + + self setupPropertyFromSpec:aSpec for:aViewsSpec + +! + +setupPropertyFromSpec:aSpec for:aViewsSpec "setup menu from spec " + |specBindings| + outletView := nil. specShown ~= aSpec ifTrue:[ propertyFrame destroySubViews. + + "/ get aspects from specClass + specSpecificAspectHolders := IdentityDictionary new. + aViewsSpec class addBindingsTo:specSpecificAspectHolders for:aViewsSpec channel:nil. + builder buildFromSpec:aSpec in:propertyFrame. propertyFrame realizeAllSubViews. ]. @@ -1803,13 +1836,13 @@ fetchColorsFrom:aView |holder| - holder := self aspectFor:#foregroundChannel. + holder := self aspectFor:#foregroundColor. (aView respondsTo:#foregroundColor) ifTrue:[ holder value:(aView foregroundColor storeString). ] ifFalse:[ holder value:nil ]. - holder := self aspectFor:#backgroundChannel. + holder := self aspectFor:#backgroundColor. (aView respondsTo:#backgroundColor) ifTrue:[ holder value:(aView backgroundColor storeString). ] ifFalse:[ @@ -1826,48 +1859,48 @@ layout isLayout ifFalse:[ layout isRectangle ifTrue:[ - leftOffsetHolder value:(layout left). - rightOffsetHolder value:(layout right). - topOffsetHolder value:(layout top). - bottomOffsetHolder value:(layout bottom). - ^ self + (aspectHolders at:#leftOffset) value:(layout left). + (aspectHolders at:#rightOffset) value:(layout right). + (aspectHolders at:#topOffset) value:(layout top). + (aspectHolders at:#bottomOffset) value:(layout bottom). + ^ self ]. layout isPoint ifTrue:[ - leftOffsetHolder value:(layout left). - rightOffsetHolder value:(layout right). - ^ self + (aspectHolders at:#leftOffset) value:(layout left). + (aspectHolders at:#rightOffset) value:(layout right). + ^ self ]. ]. - leftOffsetHolder value:(layout leftOffset). - leftFractionHolder value:(layout leftFraction). - topFractionHolder value:(layout topFraction). - topOffsetHolder value:(layout topOffset). + (aspectHolders at:#leftOffset) value:(layout leftOffset). + (aspectHolders at:#leftFraction) value:(layout leftFraction). + (aspectHolders at:#topOffset) value:(layout topOffset). + (aspectHolders at:#topFraction) value:(layout topFraction). layout isLayoutFrame ifTrue:[ - rightOffsetHolder value:(layout rightOffset). - bottomOffsetHolder value:(layout bottomOffset). - rightFractionHolder value:(layout rightFraction). - bottomFractionHolder value:(layout bottomFraction). - - leftAlignmentFractionHolder value:0. - topAlignmentFractionHolder value:0. - + (aspectHolders at:#rightOffset) value:(layout rightOffset). + (aspectHolders at:#bottomOffset) value:(layout bottomOffset). + + (aspectHolders at:#rightFraction) value:(layout rightFraction). + (aspectHolders at:#bottomFraction) value:(layout bottomFraction). + + (aspectHolders at:#leftAlignmentFraction) value:0. + (aspectHolders at:#topAlignmentFraction) value:0. ] ifFalse:[ extent := aView extent. - rightOffsetHolder value:(layout leftOffset + extent x). - bottomOffsetHolder value:(layout topOffset + extent y). - - rightFractionHolder value:0. - bottomFractionHolder value:0. + (aspectHolders at:#rightOffset) value:(layout leftOffset + extent x). + (aspectHolders at:#bottomOffset) value:(layout topOffset + extent y). + + (aspectHolders at:#rightFraction) value:0. + (aspectHolders at:#bottomFraction) value:0. layout isAlignmentOrigin ifTrue:[ - leftAlignmentFractionHolder value:(layout leftAlignmentFraction). - topAlignmentFractionHolder value:(layout topAlignmentFraction) + (aspectHolders at:#leftAlignmentFraction) value:(layout leftAlignmentFraction). + (aspectHolders at:#topAlignmentFraction) value:(layout topAlignmentFraction). ] ifFalse:[ - leftAlignmentFractionHolder value:0. - topAlignmentFractionHolder value:0 + (aspectHolders at:#leftAlignmentFraction) value:0. + (aspectHolders at:#topAlignmentFraction) value:0. ] ]. @@ -1996,13 +2029,13 @@ view notNil ifTrue:[ layout := AlignmentOrigin new. - layout leftOffset:(leftOffsetHolder value) ? 0. - layout topOffset:(topOffsetHolder value) ? 0. - layout leftFraction:(leftFractionHolder value) ? 0. - layout topFraction:(topFractionHolder value) ? 0. - - layout leftAlignmentFraction:(leftAlignmentFractionHolder value) ? 0. - layout topAlignmentFraction:(topAlignmentFractionHolder value) ? 0. + layout leftOffset:((aspectHolders at:#leftOffset) value) ? 0. + layout topOffset:((aspectHolders at:#topOffset) value) ? 0. + layout leftFraction:((aspectHolders at:#leftFraction) value) ? 0. + layout topFraction:((aspectHolders at:#topFraction) value) ? 0. + + layout leftAlignmentFraction:((aspectHolders at:#leftAlignmentFraction) value) ? 0. + layout topAlignmentFraction:((aspectHolders at:#topAlignmentFraction) value) ? 0. workView setDimension:layout. ] @@ -2016,14 +2049,14 @@ view notNil ifTrue:[ layout := LayoutFrame new. - layout leftOffset:(leftOffsetHolder value) ? 0. - layout rightOffset:(rightOffsetHolder value) ? 0. - layout topOffset:(topOffsetHolder value) ? 0. - layout bottomOffset:(bottomOffsetHolder value) ? 0. - layout leftFraction:(leftFractionHolder value) ? 0. - layout rightFraction:(rightFractionHolder value) ? 0. - layout topFraction:(topFractionHolder value) ? 0. - layout bottomFraction:(bottomFractionHolder value) ? 0. + layout leftOffset:((aspectHolders at:#leftOffset) value) ? 0. + layout rightOffset:((aspectHolders at:#rightOffset) value) ? 0. + layout topOffset:((aspectHolders at:#topOffset) value) ? 0. + layout bottomOffset:((aspectHolders at:#bottomOffset) value) ? 0. + layout leftFraction:((aspectHolders at:#leftFraction) value) ? 0. + layout rightFraction:((aspectHolders at:#rightFraction) value) ? 0. + layout topFraction:((aspectHolders at:#topFraction) value) ? 0. + layout bottomFraction:((aspectHolders at:#bottomFraction) value) ? 0. workView setDimension:layout. ] @@ -2037,11 +2070,11 @@ view notNil ifTrue:[ layout := LayoutOrigin new. - layout leftOffset:(leftOffsetHolder value) ? 0. - layout topOffset:(topOffsetHolder value) ? 0. - - layout leftFraction:(leftFractionHolder value) ? 0. - layout topFraction:(topFractionHolder value) ? 0. + layout leftOffset:((aspectHolders at:#leftOffset) value) ? 0. + layout topOffset:((aspectHolders at:#topOffset) value) ? 0. + + layout leftFraction:((aspectHolders at:#leftFraction) value) ? 0. + layout topFraction:((aspectHolders at:#topFraction) value) ? 0. workView setDimension:layout. ] @@ -2074,13 +2107,6 @@ super closeRequestFor:aTopView ! -propertySelectionChanged - workView singleSelectionDo:[:selectedView | - propertyShown := whichProperty selection. - self showPropertyView - ] -! - selectOutlet:nr |outlet type sel text box action initialText initialList view prop t val| @@ -2388,14 +2414,16 @@ setColors |fg bg| - fg := self foregroundChannel value. + fg := (self aspectFor:#foregroundColor) value. + (fg notNil and:[fg notEmpty]) ifTrue:[ fg := Color readFrom:fg. workView singleSelectionDo:[:selectedView | selectedView foregroundColor:fg ]. ]. - bg := self backgroundChannel value. + bg := (self aspectFor:#backgroundColor) value. + (bg notNil and:[bg notEmpty]) ifTrue:[ bg := Color readFrom:bg. workView singleSelectionDo:[:selectedView | @@ -2496,10 +2524,38 @@ ! showPropertyView - |v l spec| + |v l spec shown possibleProperties slices specIndex slice specSymbol| + + shown := whichProperty selection. workView singleSelectionDo:[:selectedView | - propertyShown = 'dimension' ifTrue:[ + |aViewsSpec| + + aViewsSpec := workView generateSpecFor:selectedView. + aViewsSpec := aViewsSpec first. + + slices := selectedView specClass slices. + possibleProperties := slices collect:[:slice | slice first asString]. + possibleProperties := possibleProperties, #('dimension' 'colors' 'model' 'misc' 'attribute list'). + possibleProperties ~= whichProperty list ifTrue:[ + whichProperty list:possibleProperties. + + (possibleProperties includes:shown) ifFalse:[ + shown := nil. + ]. + ]. + + specIndex := slices findFirst:[:slice | slice first = shown]. + specIndex ~~ 0 ifTrue:[ + slice := slices at:specIndex. + specSymbol := slice at:2. + (selectedView specClass respondsTo:specSymbol) ifTrue:[ + spec := selectedView specClass perform:specSymbol. + ^ self setupPropertyFromSpec:spec for:aViewsSpec + ] + ]. + + (shown = 'dimension' or:[shown = 'Position']) ifTrue:[ (l := selectedView geometryLayout) notNil ifTrue:[ l isLayout ifTrue:[ l isAlignmentOrigin ifTrue:[ @@ -2514,24 +2570,26 @@ spec isNil ifTrue:[ spec := self class geometrySpecForLayoutFrame ]. - ^ self setupPropertyFromSpec:spec + ^ self setupPropertyFromSpec:spec for:aViewsSpec ]. - propertyShown = 'colors' ifTrue:[ - ^ self setupPropertyFromSpec:(self class colorSpec) + shown = 'colors' ifTrue:[ + ^ self setupPropertyFromSpec:(self class colorSpec) for:aViewsSpec ]. - propertyShown = 'model' ifTrue:[ - ^ self setupPropertyFromSpec:(self class modelSpec) + shown = 'model' ifTrue:[ + ^ self setupPropertyFromSpec:(self class modelSpec) for:aViewsSpec ]. - propertyShown = 'misc' ifTrue:[ - ^ self setupPropertyFromSpec:(self class miscSpec) + shown = 'misc' ifTrue:[ + ^ self setupPropertyFromSpec:(self class miscSpec) for:aViewsSpec ]. - propertyShown = 'attribute list' ifTrue:[ + shown = 'attribute list' ifTrue:[ specShown ~~ #attributeList ifTrue:[ propertyFrame destroySubViews. + specSpecificAspectHolders := IdentityDictionary new. + v := ScrollableView for:SelectionInListView in:propertyFrame. v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). outletView := v scrolledView. @@ -2547,6 +2605,7 @@ propertyFrame destroySubViews. outletView := nil. specShown := nil. + specSpecificAspectHolders := IdentityDictionary new. ! ! @@ -2557,7 +2616,14 @@ |superclass cls| - (cls := Smalltalk at:specClass asSymbol) isNil ifTrue:[ + specClass isNil ifTrue:[^ false]. + + specClass isBehavior ifFalse:[ + cls := Smalltalk at:specClass asSymbol + ] ifTrue:[ + cls := specClass + ]. + cls isNil ifTrue:[ (superclass := Smalltalk at:specSuperclass asSymbol) isNil ifTrue:[ self warn:'no class named ' , specSuperclass , ' exists.'. ^ false. @@ -2577,8 +2643,13 @@ ^ false. ]. + specSuperclass isBehavior ifFalse:[ + superclass := Smalltalk at:specSuperclass asSymbol + ] ifTrue:[ + superclass := specSuperclass + ]. specSuperclass notNil ifTrue:[ - (superclass := Smalltalk at:specSuperclass asSymbol) isNil ifTrue:[ + superclass isNil ifTrue:[ self warn:'no class named ' , specSuperclass , ' exists.'. ^ false. ]. @@ -2723,6 +2794,7 @@ view isNil ifTrue:[^ self]. spec := UISpecification fromView:view topView. + self halt. "/ ok, got it workView setupFromSpec:spec. @@ -2803,6 +2875,115 @@ workView testMode:t ! ! +!UIPainter::ButtonPanel methodsFor:'accessing'! + +receiver + ^ receiver +! + +receiver:aReceiver + receiver := aReceiver +! ! + +!UIPainter::ButtonPanel methodsFor:'initialization'! + +initialize + "initialize and setup buttons + " + super initialize. + + self level:-1. + self borderWidth:0. + self horizontalLayout:#leftSpace. + argumentToSelector := 1. + + self specification do:[:anArray| + |selector image button seperator| + + selector := anArray at:1. + + selector notNil ifTrue:[ + image := Image fromFile:( anArray at:2 ). + button := Button label:image in:self. + + selector last == $: ifFalse:[ + button action:[ + receiver notNil ifTrue:[ + receiver perform:selector + ] + ] + ] ifTrue:[ + button pressAction:[ + receiver notNil ifTrue:[ + receiver perform:selector with:argumentToSelector + ] + ]. + button autoRepeat:true. + button menuHolder:self; menuMessage:#editMenu; menuPerformer:self. + ] + ] ifFalse:[ + seperator := View in:self. + seperator extent:20@1. + seperator borderWidth:0. + ] + ]. + +! + +specification + "return a spec for the buttons in the panel; + entries consists of selector and bitmap-filename. + nil selectors are taken as separators (see setupButtonPanel)" + + ^ #( + #( alignSelectionLeft 'b_alignL.xbm' ) + #( alignSelectionRight 'b_alignR.xbm' ) + #( alignSelectionLeftAndRight 'b_alignLR.xbm' ) + #( nil ) + #( alignSelectionTop 'b_alignT.xbm' ) + #( alignSelectionBottom 'b_alignB.xbm' ) + #( alignSelectionTopAndBottom 'b_alignTB.xbm' ) + #( nil ) + #( alignSelectionCenterHor 'b_alignCH.xbm' ) + #( alignSelectionCenterVer 'b_alignCV.xbm' ) + #( nil ) + #( moveSelectionLeft: 'b_moveLeft.xbm' ) + #( moveSelectionRight: 'b_moveRight.xbm' ) + #( moveSelectionUp: 'b_moveUp.xbm' ) + #( moveSelectionDown: 'b_moveDown.xbm' ) + ) + + +! ! + +!UIPainter::ButtonPanel methodsFor:'menu'! + +editMenu + "edit menu used by buttons using an argument for the receiver; the argumentToSelector + " + |menu| + + menu := PopUpMenu labels:#( '1' '2' '4' '10' '20' '..' ) + args:#( 1 2 4 10 20 nil ). + + menu action:[:anArg||no| + (no := anArg) isNil ifTrue:[ + no := EnterBox request:'number'. + no := SmallInteger readFrom:no onError:0. + ]. + no ~~ 0 ifTrue:[ + |index view| + + view := (WindowGroup lastEventQuerySignal raise) view. + view := view menuPerformer. + argumentToSelector := no. + view pressAction value. + argumentToSelector := 1. + ] + ]. + ^ menu +! ! + !UIPainter class methodsFor:'documentation'! version