# HG changeset patch # User ca # Date 867330053 -7200 # Node ID 5e0f65e92d9502dec5ba0dc12967f75dc50efb52 # Parent e0a85c343cb703a2d74d8e311e58d91f35619337 update diff -r e0a85c343cb7 -r 5e0f65e92d95 UISelectionPanel.st --- a/UISelectionPanel.st Thu Jun 26 14:50:18 1997 +0200 +++ b/UISelectionPanel.st Thu Jun 26 15:00:53 1997 +0200 @@ -1,5 +1,29 @@ " - COPYRIGHT (c) 1997 by eXept Software AG + COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG + All Rights Reserved + + This software is furnished under a license and may be used + only in accordance with the terms of that license and with the + inclusion of the above copyright notice. This software may not + be provided or otherwise made available to, or used by, any + other person. No title to or ownership of the software is + hereby transferred. +" + + + +ApplicationModel subclass:#UISelectionPanel + instanceVariableNames:'userClass userSpecs userLabels majorSelection clipBoardSpec' + classVariableNames:'UserClass UserSpecs UserLabels' + poolDictionaries:'' + category:'Interface-UIPainter' +! + +!UISelectionPanel class methodsFor:'documentation'! + +copyright +" + COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG All Rights Reserved This software is furnished under a license and may be used @@ -11,43 +35,6 @@ " -ApplicationModel subclass:#UISelectionPanel - instanceVariableNames:'selection selectors receiver' - classVariableNames:'' - poolDictionaries:'' - category:'Interface-UIPainter' -! - -View subclass:#Canvas - instanceVariableNames:'inputView selection specification lastClickPoint labelHolder - nameHolder' - classVariableNames:'' - poolDictionaries:'' - privateIn:UISelectionPanel -! - -DropObject subclass:#DropSpecification - instanceVariableNames:'' - classVariableNames:'' - poolDictionaries:'' - privateIn:UISelectionPanel::Canvas -! - -!UISelectionPanel class methodsFor:'documentation'! - -copyright -" - COPYRIGHT (c) 1997 by eXept Software AG - All Rights Reserved - - This software is furnished under a license and may be used - only in accordance with the terms of that license and with the - inclusion of the above copyright notice. This software may not - be provided or otherwise made available to, or used by, any - other person. No title to or ownership of the software is - hereby transferred. -" - ! documentation @@ -55,66 +42,284 @@ implements a selection panel, keeping widgets which could be placed into the UIPainter by drag & drop. + [start with:] + UISelectionPanel open + [author:] + Claus Gittinger Claus Atzkern [see also:] TabView + NoteBookView + UIGalleryView UIPainter - [start with:] - UISelectionPanel open - " ! ! -!UISelectionPanel class methodsFor:'instance creation'! - -newDefault - |appl| - - appl := self new. +!UISelectionPanel class methodsFor:'accessing'! - appl labels:#( 'Button & Toggle' - 'Panel' - 'Text' - 'View' - 'Menu & Combo' - 'Slider' - ) +specifications - selectors:#( #buttonToggleSpec - #panelSpec - #textSpec - #viewsSpec - #menuComboSpec - #sliderSpec - ) - receiver:self. + ^ #( + #( 'Standarts' #( + #('Button & Toggle' standartButtonToggle) + #('Menus' standartMenus) + #('Panel' standartPanels) + #('Text' standartText) + #('Views' standartViews) + #('Canvas' standartCanvas) + #('Sliders' standartSliders) + ) + ) - ^ appl. -! + #( 'Clip Board' #( + #('Copy & Paste Buffer' clipBoardSpec) + ) + ) -open - |appl| - - appl := self newDefault. - appl open. - ^ appl. + #( 'User Defined' #userDefined ) + ) ! ! -!UISelectionPanel class methodsFor:'interface specs'! +!UISelectionPanel class methodsFor:'interface specification'! -buttonToggleSpec +nameAndSelectorSpec "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:UISelectionPanel andSelector:#buttonToggleSpec - UISelectionPanel new openInterface:#buttonToggleSpec + UIPainter new openOnClass:UISelectionPanel andSelector:#nameAndSelectorSpec + UISelectionPanel new openInterface:#nameAndSelectorSpec + " + + + + ^ + + #(#FullSpec + #'window:' + #(#WindowSpec + #'name:' 'uIPainterView' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'Painter' + #'bounds:' #(#Rectangle 0 0 315 216) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#LabelSpec + #'name:' 'title' + #'layout:' #(#Point 5 10) + #'label:' 'class & selectors to access user specs:' + #'adjust:' #left + #'resizeForLabel:' true + ) + #(#LabelSpec + #'name:' 'classLabel' + #'layout:' #(#AlignmentOrigin 68 0.11 51 0 1 0.5) + #'label:' 'Class:' + #'adjust:' #right + #'resizeForLabel:' true + ) + #(#InputFieldSpec + #'name:' 'classField' + #'layout:' #(#LayoutFrame 74 0.11 39 0 -5 1.0 61 0) + #'tabable:' true + #'model:' #className + #'type:' #string + ) + #(#LabelSpec + #'name:' 'labelsLabel' + #'layout:' #(#AlignmentOrigin 68 0.11 74 0 1 0.5) + #'label:' 'Labels:' + #'adjust:' #right + #'resizeForLabel:' true + ) + #(#InputFieldSpec + #'name:' 'labelsField' + #'layout:' #(#LayoutFrame 74 0.11 64 0 -5 1.0 86 0) + #'tabable:' true + #'model:' #labelsKey + #'type:' #symbolOrNil + ) + #(#LabelSpec + #'name:' 'specsLabel' + #'layout:' #(#AlignmentOrigin 68 0.11 99 0 1 0.5) + #'label:' 'Specifications:' + #'adjust:' #right + #'resizeForLabel:' true + ) + #(#InputFieldSpec + #'name:' 'specsField' + #'layout:' #(#LayoutFrame 74 0.11 89 0 -5 1.0 111 0) + #'tabable:' true + #'model:' #specsKey + #'type:' #symbolOrNil + ) + #(#HorizontalPanelViewSpec + #'name:' 'commitPanel' + #'layout:' #(#LayoutFrame 0 0.0 -23 1.0 0 1.0 0 1.0) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#ActionButtonSpec + #'name:' 'cancel' + #'label:' 'cancel' + #'tabable:' true + #'model:' #cancel + #'extent:' #(#Point 153 23) + ) + #(#ActionButtonSpec + #'name:' 'accept' + #'label:' 'ok' + #'tabable:' true + #'isDefault:' true + #'model:' #accept + #'extent:' #(#Point 153 23) + ) + ) + ) + #'horizontalLayout:' #fitSpace + #'verticalLayout:' #fit + #'horizontalSpace:' 3 + #'verticalSpace:' 3 + ) + #(#CheckBoxSpec + #'name:' 'updateDefaultResources' + #'layout:' #(#Point 5 133) + #'model:' #updateDefaultResources + #'label:' 'Update Default Resources' + ) + ) + ) + ) +! + +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:UISelectionPanel andSelector:#windowSpec + UISelectionPanel new openInterface:#windowSpec + " + "UISelectionPanel open" + + + + ^ + + #(#FullSpec + #'window:' + #(#WindowSpec + #'name:' 'uIPainterView' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'Component Gallery' + #'bounds:' #(#Rectangle 0 0 471 223) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#UIGalleryViewSpec + #'name:' 'gallery' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 -40 1.0 0 1.0) + #'tabable:' true + #'menu:' #galleryList + #'style:' + #(#FontDescription + #helvetica #medium + #roman #'10' + ) + #'model:' #galleryModel + #'tabWidget:' #Window + #'minorKeys:' #minorKeys + #'clientSpec:' #clientSpec + #'raiseMenu:' #raiseMenu + #'useIndex:' true + ) + #(#TabViewSpec + #'name:' 'major' + #'layout:' #(#LayoutFrame -40 1.0 30 0.0 0 1.0 0 1.0) + #'menu:' #majorList + #'style:' + #(#FontDescription + #helvetica #medium + #roman #'10' + ) + #'model:' #majorChannel + #'tabWidget:' #Window + #'direction:' #right + #'useIndex:' true + ) + #(#LabelSpec + #'name:' 'clientSpecLabel' + #'layout:' #(#AlignmentOrigin 0 0.0 0 1.0 0 1) + #'label:' '' + #'adjust:' #left + #'resizeForLabel:' true + ) + ) + ) + ) +! ! + +!UISelectionPanel class methodsFor:'menus'! + +menuSelected + ^ #(#Menu #( + #(#MenuItem + #'label:' 'copy' + #'value:' #copy + ) + #(#MenuItem + #'label:' 'cut' + #'value:' #cut + ) + ) + nil + nil + ) + + + +! + +menuUnselected + ^ #(#Menu #( + #(#MenuItem + #'label:' 'paste' + #'value:' #paste + ) + ) + nil + nil + ) + + + +! ! + +!UISelectionPanel class methodsFor:'standart specifications'! + +standartButtonToggle + "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:UISelectionPanel andSelector:#standartButtonToggle + UISelectionPanel new openInterface:#standartButtonToggle " @@ -137,54 +342,46 @@ #'name:' 'ArrowButton up' #'layout:' #(#LayoutFrame 237 0 20 0 259 0 42 0) #'isTriggerOnDown:' true - #'autoRepeat:' false #'direction:' #up ) #(#ActionButtonSpec #'name:' 'Button' #'layout:' #(#LayoutFrame 20 0 20 0 119 0 42 0) #'label:' 'Button' - #'isTriggerOnDown:' false - #'autoRepeat:' false ) #(#RadioButtonSpec #'name:' 'RadioButton' #'layout:' #(#LayoutFrame 127 0.0 20 0 226 0 42 0) #'label:' 'RadioButton' #'isTriggerOnDown:' true - #'autoRepeat:' false #'showLamp:' true #'lampColor:' #(#Color 100.0 100.0 0.0) ) #(#ArrowButtonSpec #'name:' 'ArrowButton down' - #'layout:' #(#LayoutFrame 238 0 51 0 260 0 73 0) + #'layout:' #(#LayoutFrame 237 0 51 0 259 0 73 0) #'hasCharacterOrientedLabel:' false #'isTriggerOnDown:' true - #'autoRepeat:' false #'direction:' #down ) #(#ArrowButtonSpec #'name:' 'ArrowButton left' - #'layout:' #(#LayoutFrame 238 0 82 0 260 0 104 0) + #'layout:' #(#LayoutFrame 237 0 82 0 259 0 104 0) #'hasCharacterOrientedLabel:' false #'isTriggerOnDown:' true - #'autoRepeat:' false #'direction:' #left ) #(#ArrowButtonSpec #'name:' 'ArrowButton right' - #'layout:' #(#LayoutFrame 238 0 113 0 260 0 135 0) + #'layout:' #(#LayoutFrame 237 0 113 0 259 0 135 0) #'hasCharacterOrientedLabel:' false #'isTriggerOnDown:' true - #'autoRepeat:' false #'direction:' #right ) #(#CheckToggleSpec #'name:' 'CheckToggle' #'layout:' #(#LayoutFrame 297 0 82 0 317 0 102 0) #'isTriggerOnDown:' true - #'autoRepeat:' false #'showLamp:' false #'lampColor:' #(#Color 100.0 100.0 0.0) ) @@ -193,13 +390,12 @@ #'layout:' #(#LayoutFrame 297 0 20 0 396 0 42 0) #'label:' 'Toggle' #'isTriggerOnDown:' true - #'autoRepeat:' false #'showLamp:' true #'lampColor:' #(#Color 100.0 100.0 0.0) ) #(#CheckBoxSpec #'name:' 'CheckBox' - #'layout:' #(#LayoutFrame 297 0 51 0 398 0 73 0) + #'layout:' #(#LayoutFrame 297 0 51 0 396 0 73 0) #'label:' 'CheckBox' ) #(#ActionButtonSpec @@ -207,39 +403,33 @@ #'layout:' #(#LayoutFrame 20 0 51 0 119 0 73 0) #'label:' 'ok' #'model:' #accept - #'isTriggerOnDown:' false - #'autoRepeat:' false ) #(#ActionButtonSpec #'name:' 'cancel' #'layout:' #(#LayoutFrame 20 0 82 0 119 0 104 0) #'label:' 'cancel' #'model:' #cancel - #'isTriggerOnDown:' false - #'autoRepeat:' false ) #(#ActionButtonSpec #'name:' 'help' #'layout:' #(#LayoutFrame 20 0 113 0 119 0 135 0) #'label:' 'help' #'model:' #help - #'isTriggerOnDown:' false - #'autoRepeat:' false ) ) ) ) ! -menuComboSpec +standartCanvas "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:UISelectionPanel andSelector:#menuComboSpec - UISelectionPanel new openInterface:#menuComboSpec + UIPainter new openOnClass:UISelectionPanel andSelector:#standartCanvas + UISelectionPanel new openInterface:#standartCanvas " @@ -252,6 +442,91 @@ #'name:' 'uIPainterView' #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) #'label:' 'unnamed' + #'bounds:' #(#Rectangle 0 0 370 203) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#UIGalleryViewSpec + #'name:' 'Gallery' + #'layout:' #(#LayoutFrame 16 0 19 0 168 0 92 0) + #'tabWidget:' #Window + ) + #(#LabelSpec + #'name:' 'GalleryLabel' + #'layout:' #(#AlignmentOrigin 20 0 88 0 0 1) + #'label:' 'Gallery' + #'style:' + #(#FontDescription + #helvetica #medium + #roman #'10' + ) + #'adjust:' #left + #'resizeForLabel:' true + #'canUIDrag:' false + ) + #(#UISubSpecification + #'name:' 'SubSpecification' + #'layout:' #(#LayoutFrame 182 0 19 0 334 0 92 0) + ) + #(#LabelSpec + #'name:' 'SubSpecificationLabel' + #'layout:' #(#AlignmentOrigin 186 0 88 0 0 1) + #'label:' 'SubSpecification' + #'style:' + #(#FontDescription + #helvetica #medium + #roman #'10' + ) + #'resizeForLabel:' true + #'canUIDrag:' false + ) + #(#SubCanvasSpec + #'name:' 'SubCanvas' + #'layout:' #(#LayoutFrame 182 0 104 0 334 0 177 0) + #'hasHorizontalScrollBar:' true + #'hasVerticalScrollBar:' true + ) + #(#LabelSpec + #'name:' 'subCanvasLabel' + #'layout:' #(#AlignmentOrigin 255 0 158 0 0 0) + #'label:' 'SubCanvas' + #'style:' + #(#FontDescription + #helvetica #medium + #roman #'10' + ) + #'adjust:' #left + #'resizeForLabel:' true + #'canUIDrag:' false + ) + ) + ) + ) +! + +standartMenus + "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:#standartMenus + self new openInterface:#standartMenus + " + + + + ^ + + #(#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 464 253) ) #'component:' @@ -283,7 +558,7 @@ #'tabWidget:' #Window ) #(#NoteBookViewSpec - #'name:' 'noteBookView' + #'name:' 'NoteBookView' #'layout:' #(#LayoutFrame 269 0 71 0 409 0 159 0) #'tabWidget:' #Window ) @@ -302,30 +577,32 @@ ) ) ) + + ! -panelSpec +standartPanels "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:UISelectionPanel andSelector:#panelSpec - UISelectionPanel new openInterface:#panelSpec + UIPainter new openOnClass:UISelectionPanel andSelector:#standartPanels + UISelectionPanel new openInterface:#standartPanels " ^ - + #(#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 475 136) + #'bounds:' #(#Rectangle 0 0 411 131) ) #'component:' #(#SpecCollection @@ -368,7 +645,7 @@ ) #(#VariableHorizontalPanelSpec #'name:' 'VariableHorizontalPanel' - #'layout:' #(#LayoutFrame 249 0 20 0 337 0 105 0) + #'layout:' #(#LayoutFrame 249 0 20 0 323 0 105 0) #'component:' #(#SpecCollection #'collection:' @@ -425,7 +702,7 @@ ) #(#VariableVerticalPanelSpec #'name:' 'VariableVerticalPanel' - #'layout:' #(#LayoutFrame 342 0 20 0 426 0 105 0) + #'layout:' #(#LayoutFrame 328 0 20 0 402 0 105 0) #'component:' #(#SpecCollection #'collection:' @@ -497,24 +774,23 @@ ) ) ) - ! -sliderSpec +standartSliders "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:UISelectionPanel andSelector:#sliderSpec - UISelectionPanel new openInterface:#sliderSpec + UIPainter new openOnClass:self andSelector:#standartSliders + self new openInterface:#standartSliders " ^ - + #(#FullSpec #'window:' #(#WindowSpec @@ -561,17 +837,18 @@ ) ) ) + ! -textSpec +standartText "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:UISelectionPanel andSelector:#textSpec - UISelectionPanel new openInterface:#textSpec + UIPainter new openOnClass:UISelectionPanel andSelector:#standartText + UISelectionPanel new openInterface:#standartText " @@ -592,34 +869,34 @@ #( #(#InputFieldSpec #'name:' 'EditField' - #'layout:' #(#LayoutFrame 222 0 109 0 401 0 131 0) + #'layout:' #(#LayoutFrame 20 0 100 0 199 0 122 0) ) #(#LabelSpec #'name:' 'Text Label' - #'layout:' #(#LayoutFrame 222 0 138 0 401 0 160 0) + #'layout:' #(#LayoutFrame 20 0 128 0 199 0 150 0) #'label:' '' ) #(#TextEditorSpec #'name:' 'EditTextView' - #'layout:' #(#LayoutFrame 20 0 13 0 199 0 101 0) + #'layout:' #(#LayoutFrame 20 0 13 0 199 0 94 0) #'hasHorizontalScrollBar:' true #'hasVerticalScrollBar:' true ) #(#SequenceViewSpec #'name:' 'SelectionInListView' - #'layout:' #(#LayoutFrame 222 0 13 0 401 0 101 0) + #'layout:' #(#LayoutFrame 222 0 13 0 401 0 94 0) #'hasHorizontalScrollBar:' true #'hasVerticalScrollBar:' true ) #(#HTMLViewSpec #'name:' 'HTMLView' - #'layout:' #(#LayoutFrame 20 0 109 0 199 0 197 0) + #'layout:' #(#LayoutFrame 222 0 100 0 401 0 181 0) #'hasHorizontalScrollBar:' true #'hasVerticalScrollBar:' true ) #(#LabelSpec #'name:' 'HTMLViewLabel' - #'layout:' #(#LayoutFrame 93 0 179 0 183 0 193 0) + #'layout:' #(#AlignmentOrigin 295 0 178 0 0 1) #'label:' 'HTMLView' #'style:' #(#FontDescription @@ -627,11 +904,12 @@ #roman #'10' ) #'adjust:' #left + #'resizeForLabel:' true #'canUIDrag:' false ) #(#LabelSpec #'name:' 'label1' - #'layout:' #(#LayoutFrame 93 0 83 0 183 0 97 0) + #'layout:' #(#AlignmentOrigin 93 0 91 0 0 1) #'label:' 'EditText' #'style:' #(#FontDescription @@ -639,11 +917,12 @@ #roman #'10' ) #'adjust:' #left + #'resizeForLabel:' true #'canUIDrag:' false ) #(#LabelSpec #'name:' 'label2' - #'layout:' #(#LayoutFrame 295 0 83 0 387 0 97 0) + #'layout:' #(#AlignmentOrigin 295 0 91 0 0 1) #'label:' 'SelectionInList' #'style:' #(#FontDescription @@ -651,11 +930,12 @@ #roman #'10' ) #'adjust:' #left + #'resizeForLabel:' true #'canUIDrag:' false ) #(#LabelSpec #'name:' 'labelInLabel' - #'layout:' #(#LayoutFrame 226 0 142 0 275 0 156 0) + #'layout:' #(#AlignmentOrigin 24 0 139 0 0 0.5) #'label:' 'Label' #'style:' #(#FontDescription @@ -663,6 +943,7 @@ #roman #'10' ) #'adjust:' #left + #'resizeForLabel:' true #'canUIDrag:' false ) ) @@ -670,15 +951,54 @@ ) ! -viewsSpec +standartUserPanel "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:UISelectionPanel andSelector:#viewsSpec - UISelectionPanel new openInterface:#viewsSpec + UIPainter new openOnClass:UISelectionPanel andSelector:#standartUserPanel + UISelectionPanel new openInterface:#standartUserPanel + " + + + + ^ + + #(#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 445 162) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#LabelSpec + #'name:' 'helpText' + #'layout:' #(#Point 10 0) + #'labelChannel:' #userDefinedHelpText + #'resizeForLabel:' true + #'canUIDrag:' false + ) + ) + ) + ) +! + +standartViews + "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:UISelectionPanel andSelector:#standartViews + UISelectionPanel new openInterface:#standartViews " @@ -691,7 +1011,7 @@ #'name:' 'uIPainterView' #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) #'label:' 'unnamed' - #'bounds:' #(#Rectangle 0 0 485 245) + #'bounds:' #(#Rectangle 0 0 431 200) ) #'component:' #(#SpecCollection @@ -699,45 +1019,27 @@ #( #(#FramedBoxSpec #'name:' 'FramedBox' - #'layout:' #(#LayoutFrame 16 0 14 0 177 0 104 0) + #'layout:' #(#LayoutFrame 16 0 14 0 136 0 94 0) #'label:' 'FramedBox' #'labelPosition:' #topCenter ) #(#ViewSpec #'name:' 'View' - #'layout:' #(#LayoutFrame 14 0 116 0 175 0 188 0) - ) - #(#SubCanvasSpec - #'name:' 'SubCanvas' - #'layout:' #(#LayoutFrame 199 0 14 0 360 0 104 0) - #'hasHorizontalScrollBar:' true - #'hasVerticalScrollBar:' true - ) - #(#LabelSpec - #'name:' 'subCanvasLabel' - #'layout:' #(#LayoutFrame 272 0 86 0 343 0 100 0) - #'label:' 'SubCanvas' - #'style:' - #(#FontDescription - #helvetica #medium - #roman #'10' - ) - #'adjust:' #left - #'canUIDrag:' false + #'layout:' #(#LayoutFrame 152 0 14 0 266 0 94 0) ) #(#DividerSpec #'name:' 'Horizontal Seperator' - #'layout:' #(#LayoutFrame 199 0 116 0 360 0 120 0) + #'layout:' #(#LayoutFrame 16 0 107 0 137 0 111 0) #'orientation:' #horizontal ) #(#DividerSpec #'name:' 'Vertical Seperator' - #'layout:' #(#LayoutFrame 356 0 116 0 360 0 188 0) + #'layout:' #(#LayoutFrame 16 0 107 0 20 0 159 0) #'orientation:' #vertical ) #(#LabelSpec #'name:' 'viewLabel' - #'layout:' #(#LayoutFrame 19 0 118 0 70 0 135 0) + #'layout:' #(#AlignmentOrigin 158 0 20 0 0 0) #'label:' 'View' #'style:' #(#FontDescription @@ -745,11 +1047,12 @@ #roman #'10' ) #'adjust:' #left + #'resizeForLabel:' true #'canUIDrag:' false ) #(#LabelSpec #'name:' 'Seperators' - #'layout:' #(#LayoutFrame 199 0 125 0 270 0 143 0) + #'layout:' #(#AlignmentOrigin 136 0 117 0 1 0) #'label:' 'Seperators' #'style:' #(#FontDescription @@ -757,524 +1060,410 @@ #roman #'10' ) #'adjust:' #left + #'resizeForLabel:' true #'canUIDrag:' false ) #(#RegionSpec #'name:' 'Region' - #'layout:' #(#LayoutFrame 373 0 14 0 473 0 104 0) + #'layout:' #(#LayoutFrame 278 0 14 0 358 0 94 0) #'lineWidth:' 2 #'regionType:' #ellipse ) #(#LabelSpec #'name:' 'RegionLabel' - #'layout:' #(#LayoutFrame 388 0 50 0 459 0 68 0) + #'layout:' #(#AlignmentOrigin 319 0 54 0 0.5 0.5) #'label:' 'Region' #'style:' #(#FontDescription #helvetica #medium #roman #'10' ) - #'canUIDrag:' false - ) - #(#UISubSpecification - #'name:' 'UISubSpecification' - #'layout:' #(#LayoutFrame 373 0 116 0 473 0 188 0) - ) - #(#LabelSpec - #'name:' 'SubSpec label 1' - #'layout:' #(#LayoutFrame 403 0 132 0 442 0 150 0) - #'label:' 'UISub-' - #'style:' - #(#FontDescription - #helvetica #medium - #roman #'10' - ) - #'canUIDrag:' false - ) - #(#LabelSpec - #'name:' 'SubSpec label 2' - #'layout:' #(#LayoutFrame 383 0 146 0 455 0 164 0) - #'label:' 'Specification' - #'style:' - #(#FontDescription - #helvetica #medium - #roman #'10' - ) + #'resizeForLabel:' true #'canUIDrag:' false ) ) ) ) -! - -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:UISelectionPanel andSelector:#windowSpec - UISelectionPanel new openInterface:#windowSpec - " - "UISelectionPanel open" - - - - ^ - - #(#FullSpec - #'window:' - #(#WindowSpec - #'name:' 'uIPainterView' - #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) - #'label:' 'Component Gallery' - #'bounds:' #(#Rectangle 0 0 480 260) - ) - #'component:' - #(#SpecCollection - #'collection:' - #( - #(#LabelSpec - #'name:' 'label1' - #'layout:' #(#LayoutFrame 0 0.0 -20 1.0 0 1.0 0 1.0) - #'label:' 'selection' - #'labelChannel:' #nameOfObject - #'level:' 2 - #'hasCharacterOrientedLabel:' false - ) - #(#NoteBookViewSpec - #'name:' 'noteBookView1' - #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -21 1.0) - #'menu:' #tabList - #'model:' #tabModel - #'tabWidget:' #Window - #'useIndex:' true - #'level:' 2 - #'canvas:' #canvas - ) - ) - ) - ) ! ! -!UISelectionPanel methodsFor:'accessing'! +!UISelectionPanel methodsFor:'actions'! + +defineClassAndSelector + |bd cls sel lbl| + + bd := IdentityDictionary new. + bd at:#className put:( userClass asValue). + bd at:#specsKey put:( (userSpecs ? '') asValue). + bd at:#labelsKey put:( (userLabels ? '') asValue). + bd at:#updateDefaultResources put:(false asValue). + + (self openDialogInterface:#nameAndSelectorSpec withBindings:bd) ifTrue:[ + ( (cls := (bd at:#className) value) notNil + and:[(sel := (bd at:#specsKey) value) notNil + and:[(lbl := (bd at:#labelsKey) value) notNil]] + ) ifTrue:[ + userClass := cls. + userSpecs := sel. + userLabels := lbl. + + (bd at:#updateDefaultResources) value ifTrue:[ + UserClass := userClass. + UserSpecs := userSpecs. + UserLabels := userLabels. + ] + ] + ]. +! + +paste:something + "paste something at a point + " + |coll specs point device gallery ext spec| + + clipBoardSpec isNil ifTrue:[ + clipBoardSpec := SpecCollection new. + clipBoardSpec collection:(OrderedCollection new). + ]. + coll := clipBoardSpec collection. + gallery := self builder componentAt:#gallery. + device := gallery device. + + point := device translatePoint:(device pointerPosition) + from:(device rootView id) + to:(gallery canvas id). + + point y < 1 ifTrue:[point y:1]. + ext := gallery extent - (10@10). -labels:loLabels selectors:loSelectors receiver:aReceiver - selectors := loSelectors. - receiver := aReceiver. - (self tabList) value:loLabels. + (specs := something) isCollection ifFalse:[ + specs := Array with:something + ]. + + specs do:[:aSpec| + point x > ext x ifTrue:[point x:1]. + point y > ext y ifTrue:[point y:1]. + + spec := aSpec copy. + spec layout:(LayoutOrigin fromPoint:point). + coll add:spec. + point := point + (20@20). + ]. + gallery update. +! + +raiseMenu + "can open menu + " + |spec menu value collection paste| + + spec := self clientSpec value. + spec notNil ifTrue:[ + menu := self class menuSelected decodeAsLiteralArray. + self isClipBoard ifFalse:[ + (menu someMenuItemWithValue:#cut) disable. + ]. + + (value := menu startUp) == #cut ifTrue:[ + clipBoardSpec collection remove:spec ifAbsent:nil. + (self builder componentAt:#gallery) update. + ] ifFalse:[ + value == #copy ifTrue:[ + self window setSelection:spec + ] + ]. + ^ self + ]. + + self isUserBoard ifTrue:[ + ^ self defineClassAndSelector + ]. + + paste := self window getSelection. + + (self canPaste:paste) ifTrue:[ + menu := self class menuUnselected decodeAsLiteralArray. + + (menu startUp) == #paste ifTrue:[ + self paste:paste + ] + ]. ! ! !UISelectionPanel methodsFor:'aspects'! -canvas +clientSpec + "automatically generated by UIPainter ..." + |holder| - (holder := builder bindingAt:#canvas) isNil ifTrue:[ - builder aspectAt:#canvas put:(holder := Canvas new) - ]. - ^ holder -! - -nameOfObject - |holder canvas| - - (holder := builder bindingAt:#nameOfObject) isNil ifTrue:[ - builder aspectAt:#nameOfObject put:(holder := ValueHolder new). - canvas := self canvas. - canvas nameHolder:holder. - ]. - ^ holder -! - -tabList - "returns list of tab-labels - " - |holder| - - (holder := builder bindingAt:#tabList) isNil ifTrue:[ - builder aspectAt:#tabList put:(holder := ValueHolder new). + (holder := builder bindingAt:#clientSpec) isNil ifTrue:[ + builder aspectAt:#clientSpec put:(holder := ValueHolder new). + holder addDependent:self. ]. ^ holder ! -tabModel - "returns my model; catching select notifications - " +clipBoardSpec + ^ clipBoardSpec +! + +galleryList + "automatically generated by UIPainter ..." + |holder| - (holder := builder bindingAt:#tabModel) isNil ifTrue:[ - holder := AspectAdaptor new subject:self; forAspect:#selection. - builder aspectAt:#tabModel put:holder. + (holder := builder bindingAt:#galleryList) isNil ifTrue:[ + builder aspectAt:#galleryList put:(holder := ValueHolder new). ]. ^ holder +! -! ! +galleryModel + "automatically generated by UIPainter ..." -!UISelectionPanel methodsFor:'selection'! + |holder| -selection - ^ selection + (holder := builder bindingAt:#galleryModel) isNil ifTrue:[ + builder aspectAt:#galleryModel put:(holder := ValueHolder new). + ]. + ^ holder ! -selection:aValue - |spec canvas| +majorChannel + "automatically generated by UIPainter ..." - (aValue isNil or:[aValue == 0]) ifTrue:[ - ^ self + |holder| + + (holder := builder bindingAt:#majorChannel) isNil ifTrue:[ + holder := AspectAdaptor new subject:self; forAspect:#majorSelection. + builder aspectAt:#majorChannel put:holder. ]. - selection ~~ aValue ifTrue:[ - (selection := aValue) notNil ifTrue:[ - selectors size >= aValue ifTrue:[ - spec := receiver perform:(selectors at:selection) - ] - ]. - canvas := builder aspectAt:#canvas. - canvas specification:spec. + ^ holder +! + +majorList + "automatically generated by UIPainter ... + " + ^ self class specifications collect:[:el| el first] +! + +minorKeys + "automatically generated by UIPainter ..." + + |holder| + + (holder := builder bindingAt:#minorKeys) isNil ifTrue:[ + builder aspectAt:#minorKeys put:(holder := ValueHolder new). ]. + ^ holder ! ! -!UISelectionPanel::Canvas methodsFor:'accessing'! +!UISelectionPanel methodsFor:'change & update'! -nameHolder:aValueHolder - "set value holder which keeps the name of the object - under the cursor or selected +update:something with:aParameter from:changedObject + "one of my models changed its value " - nameHolder := aValueHolder -! + |channel label| -specification:aSpecOrSpecArray - "load a new specification - " - |builder| + (channel := self clientSpec) == changedObject ifTrue:[ + label := self builder componentAt:#clientSpecLabel. - self selection:nil. - - self subViews copy do:[:aSubView| - aSubView ~~ inputView ifTrue:[ - aSubView destroy + channel value notNil ifTrue:[ + label label:(' ', channel value name, ' '). + label level:1. + ] ifFalse:[ + label label:nil. + label level:0. ] ]. - aSpecOrSpecArray notNil ifTrue:[ - specification := UISpecification from:aSpecOrSpecArray. - builder := UIBuilder new. - specification buildViewFor:builder in:self. - - subViews do:[:v| - (v ~~ inputView and:[(self findSpecFor:v) notNil]) ifTrue:[ - v borderWidth:1. - ] - ]. - - self realizeAllSubViews. - inputView raise. - ] ifFalse:[ - specification := nil - ] - -! ! - -!UISelectionPanel::Canvas methodsFor:'drag & drop'! - -buildSpecFrom:aSpec - "build spec out of spec - " - |spec comp coll| - - (aSpec notNil and:[aSpec canUIDrag]) ifFalse:[ - ^ nil - ]. - - spec := aSpec copy. - - (aSpec class supportsSubComponents and:[aSpec component notNil]) ifFalse:[ - ^ spec - ]. - comp := aSpec component. - spec component:nil. - - comp canUIDrag ifFalse:[ - ^ spec - ]. - coll := OrderedCollection new. - - comp do:[:anEntry||spc| - (spc := self buildSpecFrom:anEntry) notNil ifTrue:[ - coll add:spc - ] - ]. - coll isEmpty ifTrue:[ - ^ spec - ]. - comp := comp copy. - comp collection:coll. - spec component:comp. - ^ spec - - -! - -startDrag - "start drag of selection - " - |dragObj spec name| - - spec := self findSpecFor:selection. - - spec notNil ifTrue:[ - spec := self buildSpecFrom:spec. - name := spec className asString. - name := name copyFrom:1 to:(name size - ('Spec' size) + 1). - name at:1 put:(name at:1) asLowercase. - name at:(name size) put:$1. - spec name:name. - - self showUnselected. - dragObj := DropSpecification for:selection specification:spec. - self showSelected. - DragAndDropManager startDrag:dragObj from:inputView. - ] + super update:something with:aParameter from:changedObject. ! ! -!UISelectionPanel::Canvas methodsFor:'event handling'! - -buttonMotion:state x:x y:y - "start a drag on selection - " - |obj sensor| +!UISelectionPanel methodsFor:'drag & drop'! - (state ~~ 0 and:[selection notNil]) ifTrue:[ - sensor := self sensor. - sensor anyButtonPressed ifTrue:[ - (lastClickPoint dist:(x@y)) > 10.0 ifTrue:[ - self startDrag - ] - ] - ] ifFalse:[ - (nameHolder notNil and:[(obj := self findObjectAtX:x y:y) notNil]) ifTrue:[ - nameHolder value:(obj name) - ] - ] - +canDrop:something in:aComponent + ^ self canPaste:(something collect:[:el| el theObject ]). ! -buttonPress:button x:x y:y - "change selection +drop:something in:aComponent at:aPoint + + |spc top| + + top := DragAndDropManager dragOriginatorQuerySignal raise topView. + + top == aComponent topView ifTrue:[ + spc := self clientSpec value. + spc isNil ifTrue:[^ self]. + + (clipBoardSpec collection remove:spc ifAbsent:nil) isNil ifTrue:[ + ^ self + ]. + ] ifFalse:[ + spc := something collect:[:el| el theObject]. + ]. + self paste:spc. +! ! + +!UISelectionPanel methodsFor:'queries'! + +canPaste:something + "returns true if something could be paste " - lastClickPoint := Point x:x y:y. - self selection:(self findObjectAtX:x y:y). - + (self isClipBoard and:[something notNil]) ifTrue:[ + something isCollection ifTrue:[ + something notEmpty ifTrue:[ + ^ (something at:1) isKindOf:UISpecification + ] + ] ifFalse:[ + ^ something isKindOf:UISpecification + ] + ]. + ^ false ! -exposeX:x y:y width:w height:h - "handle an expose event from device; redraw selection +isClipBoard + "returns true if current view is clip board + " + majorSelection notNil ifTrue:[ + ^ (self majorList at:majorSelection) startsWith:'Clip' + ]. + ^ false +! + +isUserBoard + "returns true if current view is clip board " - super exposeX:x y:y width:w height:h. + majorSelection notNil ifTrue:[ + ^ (self majorList at:majorSelection) startsWith:'User' + ]. + ^ false +! ! + +!UISelectionPanel methodsFor:'selection'! + +majorSelection + ^ majorSelection +! + +majorSelection:aSelection + |spec channel| - (selection notNil and:[self sensor hasExposeEventFor:selection]) ifFalse:[ - self showSelected. + (majorSelection == aSelection or:[aSelection isNil]) ifTrue:[ + ^ self ]. + (self builder componentAt:#gallery) builder:nil. + majorSelection := aSelection. + spec := ((self class specifications) at:aSelection) last. + + spec isSymbol ifFalse:[ + self galleryList value:(spec collect:[:a| a first]). + self minorKeys value:(spec collect:[:a| a last]). + ] ifTrue:[ + self perform:spec + ]. + channel := self galleryModel. + + channel value notNil ifTrue:[ + channel setValue:nil + ]. + channel value:1. ! ! -!UISelectionPanel::Canvas methodsFor:'initialization'! +!UISelectionPanel methodsFor:'startup / release'! -initialize - super initialize. +allButOpenInterface:aSpec + "setup default values + " + super allButOpenInterface:aSpec. + userClass := UserClass. + userSpecs := UserSpecs. + userLabels := UserLabels. +! + +closeRequest + |sav| - inputView := InputView origin:0.0@0.0 extent:1.0@1.0 in:self. + (sav := masterApplication) notNil ifTrue:[ + masterApplication := nil. + masterApplication closeRequestFor:(self window). + masterApplication := sav. + ] ifFalse:[ + super closeRequest. + ] +! - inputView eventReceiver:self. - inputView enableButtonEvents. - inputView enableButtonMotionEvents. - inputView enableMotionEvents. - +openWindow + "setup default values + " + super openWindow. + "/ self window waitForExpose. + Delay waitForSeconds:1. + self majorChannel value:1. ! ! -!UISelectionPanel::Canvas methodsFor:'searching'! +!UISelectionPanel methodsFor:'user defined'! + +userDefined + |cls lbl sel builder| -findObjectAtX:x y:y - "find the origin/corner of the currentWidget - " - |point id p e| + (cls := userClass) notNil ifTrue:[ + cls isBehavior ifFalse:[ + cls := Smalltalk at:cls asSymbol + ]. + (cls notNil and:[(cls respondsTo:userLabels)]) ifTrue:[ + lbl := cls perform:userLabels. + sel := Array new:(lbl size) withAll:#userDefinedSpec. + self galleryList value:lbl. + self minorKeys value:sel. + ] + ]. + builder := UIBuilder new. + builder application:self. + (self builder componentAt:#gallery) builder:builder. + self galleryList value:#( '???' ). + self minorKeys value:#( standartUserPanel ). +! - point := Point x:x y:y. - id := inputView id. +userDefinedHelpText + +^ ' +no user defined specifications are configured yet. To assign +user defined specifications to the gallery press the middle +button of your mouse to open a dialog. +' +! + +userDefinedSpec + |cls spc idx| - subViews do:[:v| - v ~~ inputView ifTrue:[ - p := device translatePoint:point from:id to:(v id). - ( p x >= 0 and:[p x <= v width - and:[p y >= 0 and:[p y <= v height - and:[(self findSpecFor:v) notNil]]]] - ) ifTrue:[ - ^ v + (cls := userClass) notNil ifTrue:[ + cls isBehavior ifFalse:[ + cls := Smalltalk at:cls asSymbol + ]. + (cls notNil and:[(cls respondsTo:userSpecs)]) ifTrue:[ + spc := cls perform:userSpecs. + idx := self galleryModel value. + + idx <= spc size ifTrue:[ + spc := spc at:idx. + (cls respondsTo:spc) ifTrue:[ + ^ cls perform:spc + ] ] ] ]. ^ nil - - - - - -! - -findSpecFor:anObject - "returns subspec assigned to instance or nil - " - |name components spec| - - anObject notNil ifTrue:[ - name := anObject name. - - specification do:[:aSpec| - aSpec name = name ifTrue:[ - aSpec canUIDrag ifTrue:[^ aSpec] - ifFalse:[^ nil] - ] - ] - ]. - ^ nil - -! ! - -!UISelectionPanel::Canvas methodsFor:'selection'! - -handlesOf:aComponent do:aOneArgBlock - "evaluate the block on each handle; the argument to the block - is a rectangle - " - aComponent notNil ifTrue:[ - aOneArgBlock value:(aComponent origin - (2@2) extent:6@6). - aOneArgBlock value:(aComponent corner - (1@1) extent:6@6). - aOneArgBlock value:(aComponent topRight - (1@2) extent:6@6). - aOneArgBlock value:(aComponent bottomLeft - (2@1) extent:6@6). - aOneArgBlock value:(aComponent leftCenter - (2@0) extent:6@6). - aOneArgBlock value:(aComponent rightCenter - (1@0) extent:6@6). - aOneArgBlock value:(aComponent topCenter - (0@2) extent:6@6). - aOneArgBlock value:(aComponent bottomCenter - (0@1) extent:6@6). - ] - -! - -selection:anObject - "selection changed - " - |name| - - selection ~~ anObject ifTrue:[ - self showUnselected. - (self findSpecFor:anObject) notNil ifTrue:[ - selection := anObject. - name := anObject name. - self showSelected - ] ifFalse:[ - selection := nil - ]. - nameHolder notNil ifTrue:[nameHolder value:name] - ] - -! - -showSelected - "show selected - " - selection notNil ifTrue:[ - self clippedByChildren:false. - - self handlesOf:selection do:[:aRectangle| - self fillRectangle:aRectangle - ]. - self clippedByChildren:true. - ]. - - -! - -showUnselected - "show unselected - " - |r currSel| - - (currSel := selection) isNil ifTrue:[ - ^ self - ]. - selection := nil. - self clippedByChildren:false. - - self handlesOf:currSel do:[:aRectangle| - self clearRectangle:aRectangle - ]. - self clippedByChildren:true. - r := currSel bounds. - - subViews do:[:sv| - |absOrg absFrame| - - sv ~~ inputView ifTrue:[ - (sv bounds intersects:r) ifTrue:[ - sv borderColor:(Color gray:5). - sv borderColor:(Color black). - - sv withAllSubViewsDo:[:v| - v fill:v viewBackground. - v exposeX:0 y:0 width:9999 height:9999. - ] - ] - ] - ]. - selection := currSel. - -! ! - -!UISelectionPanel::Canvas::DropSpecification class methodsFor:'instance creation'! - -for:aView specification:aSpec - "create drop object for a view derived from a specification - " - |point extent root device| - - device := aView device. - root := device rootView. - extent := aView extent. - point := device translatePoint:0@0 from:(aView id) to:(root id). - - DisplayObject := nil. - - (point x > 0 and:[point y > 0]) ifTrue:[ - point := point + extent. - (point x < root width and:[point y < root height]) ifTrue:[ - aView topView raise. - device sync. - aView invalidate. - aView windowGroup processExposeEvents. - DisplayObject := Image fromView:aView grab:false. - ] - ]. - DisplayObject isNil ifTrue:[ - DisplayObject := Form extent:extent depth:1. - DisplayObject colorMap:(Array with:Color white with:Color black). - DisplayObject fill:(Color colorId:0). - DisplayObject paint:(Color colorId:1). - DisplayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y. - ]. - aSpec class == UISubSpecification ifTrue:[ - aSpec layout:(LayoutOrigin fromPoint:0@0) - ]. - ^ self new theObject:aSpec - - ! ! !UISelectionPanel class methodsFor:'documentation'! version ^ '$Header$' + ! !