tz@739: " tz@739: COPYRIGHT (c) 1997 by eXept Software AG tz@739: All Rights Reserved tz@739: tz@739: This software is furnished under a license and may be used tz@739: only in accordance with the terms of that license and with the tz@739: inclusion of the above copyright notice. This software may not tz@739: be provided or otherwise made available to, or used by, any tz@739: other person. No title to or ownership of the software is tz@739: hereby transferred. tz@739: " ca@1431: "{ Package: 'stx:libtool2' }" ca@1373: tz@739: ResourceSpecEditor subclass:#TabListEditor ca@1373: instanceVariableNames:'listOfTabs' tz@739: classVariableNames:'' tz@739: poolDictionaries:'' tz@739: category:'Interface-UIPainter' tz@739: ! tz@739: tz@739: !TabListEditor class methodsFor:'documentation'! tz@739: tz@739: copyright tz@739: " tz@739: COPYRIGHT (c) 1997 by eXept Software AG tz@739: All Rights Reserved tz@739: tz@739: This software is furnished under a license and may be used tz@739: only in accordance with the terms of that license and with the tz@739: inclusion of the above copyright notice. This software may not tz@739: be provided or otherwise made available to, or used by, any tz@739: other person. No title to or ownership of the software is tz@739: hereby transferred. tz@739: " tz@739: tz@739: tz@739: ! tz@739: tz@739: documentation tz@739: " tz@739: The TabListEditor allows you to create, modify or just inspect tz@739: tab lists for tab headers or note books. tz@739: tz@739: [start with:] tz@739: TabItemEditor open tz@739: tz@739: [see also:] tz@739: TabItem tz@739: TabView tz@739: NoteBookView tz@739: UIPainter tz@739: tz@739: [author:] tz@739: Claus Atzkern, eXept Software AG tz@749: Thomas Zwick, eXept Software AG tz@739: " tz@739: tz@739: tz@739: ! ! tz@739: tz@739: !TabListEditor class methodsFor:'instance creation'! tz@739: tz@739: openModalOnTabList: aTabList tz@739: "Open a TabListEditor modal on aTabList" tz@739: "self openModalOnTabList: (Array with: (TabItem label: 'Tab Item 1'))" tz@739: tz@739: ^self new openModalOnTabList: aTabList tz@739: tz@739: ! ! tz@739: tz@739: !TabListEditor class methodsFor:'accessing'! tz@739: tz@739: resourceType tz@739: "get the type of resource of the method generated by the TabListEditor" tz@739: tz@739: ^#tabList tz@739: tz@739: tz@739: tz@739: tz@739: tz@739: tz@739: ! ! tz@739: tz@739: !TabListEditor class methodsFor:'aspects'! tz@739: tz@739: aspects tz@739: "get the aspects for the attributes of the tab list components" tz@739: tz@739: ^#( tz@739: label tz@739: translateLabel tz@739: labelForegroundColor tz@739: enabled tz@739: editAgument ca@1325: accessCharacterPosition ca@1325: shortcutKey ca@1373: activeHelpKey ca@1373: ca@1373: majorKey ca@1373: minorKey ca@1373: createNewBuilder ca@1373: ca@1373: hasHorizontalScrollBar ca@1373: hasVerticalScrollBar ca@1373: miniScrollerHorizontal ca@1373: miniScrollerVertical tz@739: ) tz@739: tz@739: ! ! tz@739: tz@739: !TabListEditor class methodsFor:'help specs'! tz@739: tz@739: helpSpec tz@739: "This resource specification was automatically generated tz@739: by the UIHelpTool of ST/X." tz@739: tz@739: "Do not manually edit this!! If it is corrupted, tz@739: the UIHelpTool may not be able to read the specification." tz@739: tz@739: " tz@739: UIHelpTool openOnClass:TabListEditor tz@739: " tz@739: tz@739: tz@739: ca@1845: ^ super helpSpec addPairsFrom:#( tz@739: tz@739: #addTabItem tz@739: 'Adds a new tab item.' tz@739: cg@2346: #applicationProvidesLabel cg@2346: 'If on, the label''s string is a selector returning a string or bitmap image, which is used as logo in the tab item.' cg@2346: ca@1373: #autoHideScrollBars ca@1373: 'ScrollBars should be made invisible dynamically, if there is nothing to scroll.' tz@739: ca@1845: #basicTab ca@1845: 'Define the basic attributes.' ca@1845: tz@739: #canSelect tz@739: 'Turns on/off whether the tab item is selectable.' tz@739: ca@1845: #canvasTab ca@1845: 'Define an application, which is started if the tab is pressed the first time.' ca@1845: ca@1845: #color ca@1845: 'Defines the foreground color of the label. The default color derives from the style sheet.' ca@1845: ca@1373: #createNewBuilder ca@1373: 'Create a new builder for the application; the application use its own aspects.' ca@1373: ca@1845: #detailTab ca@1845: 'Define the optional/specific attributes.' ca@1845: ca@1845: #detailsAccelerator ca@1845: 'Key to be pressed to select the tab item from the keyboard (accelerator key).' ca@1845: ca@1845: #detailsAccessCharaterPosition ca@1845: 'Index of the access character position of the textual label (optional).' ca@1845: ca@1845: #detailsArgument ca@1845: 'An optional argument stored with the tab item.' tz@739: tz@739: #fileCreateAspectMethod tz@739: 'Creates the aspect method for the tab list.' tz@739: tz@739: #fileLoad tz@739: 'Opens a dialog for selecting and loading a tab list spec from a class.' tz@739: tz@739: #fileNew tz@739: 'Creates a new tab list.' tz@739: tz@739: #fileSave tz@739: 'Saves current tab list.' tz@739: ca@1373: #horizontalMiniScroller ca@1373: 'Use a mini-scroller as horizontal scrollbar.' ca@1373: ca@1845: #horizontalScroller ca@1845: 'Enable horizontal scrollability.' ca@1373: tz@739: #label tz@739: 'Label of the tab item.' tz@739: ca@1845: #majorKey ca@1845: 'Name of the class to be started (application if empty); or app-selector returning application instance.' ca@1373: ca@1845: #minorKey ca@1845: 'Message sent to the class which returns the window specification (default: #windowSpec).' ca@1373: tz@739: #testPreview tz@739: 'Turns on/off preview of the tab list.' tz@739: cg@2346: #translateLabel cg@2346: 'If on, the label is translated using the applications language resources.' cg@2346: ca@1845: #verticalMiniScroller ca@1845: 'Use a mini-scroller as vertical scrollbar.' ca@1845: ca@1845: #verticalScroller ca@1845: 'Enable vertical scrollability.' ca@1845: tz@739: ) tz@739: ! ! tz@739: tz@739: !TabListEditor class methodsFor:'image specs'! tz@739: tz@739: newTabItemIcon tz@739: "This resource specification was automatically generated tz@739: by the ImageEditor of ST/X." tz@739: tz@739: "Do not manually edit this!!!! If it is corrupted, tz@739: the ImageEditor may not be able to read the specification." tz@739: tz@739: " tz@739: ImageEditor openOnClass:self andSelector:#newTabItemIcon tz@739: " tz@739: tz@739: tz@739: tz@739: ^Icon tz@739: constantNamed:#'TabListEditor newTabItemIcon' ca@1431: ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'U@@@@EUPUEUUVEUPUF**+EUPUF**+EUPUF**+EUP@F**+@@@EV***UV@F*****+@F KNC*+NF(("H*+@F((BC +EF(("H*+@F(("C*+MF*****+@F"@ H*K@F"""(LK@F"" ("K@F"""(*K@F"" H*K@F*****+HK??????@@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 127 127 127]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'G?<@G?<@G?<@G?<@G?<@??? tz@739: cg@1183: ^ cg@1876: #(FullSpec cg@1876: name: basicSpec cg@1876: window: cg@1876: (WindowSpec cg@1876: label: 'Basic' cg@1876: name: 'Basic' cg@1876: min: (Point 10 10) cg@1876: max: (Point 1280 1024) cg@2346: bounds: (Rectangle 0 0 429 240) cg@1183: ) cg@1876: component: cg@1876: (SpecCollection cg@1876: collection: ( cg@1876: (LabelSpec cg@1876: label: 'Label:' cg@1876: name: 'labelLabel' cg@1876: layout: (AlignmentOrigin 98 0 26 0 1 0.5) cg@1876: translateLabel: true cg@1876: resizeForLabel: true cg@1183: ) cg@1876: (InputFieldSpec cg@1876: name: 'label' cg@1876: layout: (LayoutFrame 100 0 15 0 -5 1.0 37 0) cg@1876: activeHelpKey: label cg@1876: tabable: true cg@1876: model: label cg@1876: group: inputGroup cg@1876: immediateAccept: true cg@1876: acceptOnReturn: false cg@1876: acceptOnTab: false cg@1876: acceptOnLostFocus: false cg@1876: acceptChannel: acceptChannel cg@1876: modifiedChannel: modifiedChannel cg@1876: acceptOnPointerLeave: false ca@1325: ) cg@1876: (LabelSpec cg@1876: label: 'Accelerator:' cg@1876: name: 'shortcutKeyLabel' cg@1876: layout: (AlignmentOrigin 98 0 55 0 1 0.5) cg@1876: translateLabel: true cg@1876: resizeForLabel: true ca@1325: ) cg@1876: (InputFieldSpec cg@1876: name: 'shortcutKey' cg@1876: layout: (LayoutFrame 100 0 44 0 -5 1.0 66 0) cg@1876: activeHelpKey: detailsAccelerator cg@1876: tabable: true cg@1876: model: shortcutKey cg@1876: group: inputGroup cg@1876: type: symbolOrNil cg@1876: immediateAccept: true cg@1876: acceptOnReturn: false cg@1876: acceptOnTab: false cg@1876: acceptOnLostFocus: false cg@1876: acceptChannel: acceptChannel cg@1876: modifiedChannel: modifiedChannel cg@1876: acceptOnPointerLeave: false ca@1325: ) cg@1876: (LabelSpec cg@1876: label: 'Argument:' cg@1876: name: 'editAgumentLabel' cg@1876: layout: (AlignmentOrigin 98 0 84 0 1 0.5) cg@1876: translateLabel: true cg@1876: resizeForLabel: true ca@1325: ) cg@1876: (InputFieldSpec cg@1876: name: 'editAgument' cg@1876: layout: (LayoutFrame 100 0 73 0 -5 1.0 95 0) cg@1876: activeHelpKey: detailsArgument cg@1876: tabable: true cg@1876: model: editAgument cg@1876: group: inputGroup cg@1876: immediateAccept: true cg@1876: acceptOnReturn: false cg@1876: acceptOnTab: false cg@1876: acceptOnLostFocus: false cg@1876: acceptChannel: acceptChannel cg@1876: modifiedChannel: modifiedChannel cg@1876: acceptOnPointerLeave: false ca@1325: ) cg@1876: (LabelSpec cg@1876: label: 'Access Character Position:' cg@1876: name: 'accessCharacterPositionLabel' cg@1876: layout: (AlignmentOrigin 275 0 113 0 1 0.5) cg@1876: translateLabel: true cg@1876: resizeForLabel: true ca@1325: ) cg@1876: (InputFieldSpec cg@1876: name: 'accessCharacterPosition' cg@1876: layout: (LayoutFrame 278 0 103 0 -5 1.0 125 0) cg@1876: activeHelpKey: detailsAccessCharaterPosition cg@1876: tabable: true cg@1876: model: accessCharacterPosition cg@1876: group: inputGroup cg@1876: type: number cg@1876: immediateAccept: true cg@1876: acceptOnReturn: false cg@1876: acceptOnTab: false cg@1876: acceptOnLostFocus: false cg@1876: acceptChannel: acceptChannel cg@1876: modifiedChannel: modifiedChannel cg@1876: acceptOnPointerLeave: false cg@1183: ) cg@1876: (CheckBoxSpec cg@2346: label: 'Translate Label ' cg@1876: name: 'translateLabel' cg@2346: layout: (LayoutFrame 96 0 135 0 308 0 161 0) cg@2346: activeHelpKey: translateLabel cg@1876: tabable: true cg@1876: model: translateLabel cg@1876: translateLabel: true cg@1183: ) cg@2346: (CheckBoxSpec cg@2346: label: 'Application Provides Label ' cg@2346: name: 'CheckBox1' cg@2346: layout: (LayoutFrame 96 0 161 0 308 0 187 0) cg@2346: activeHelpKey: applicationProvidesLabel cg@2346: tabable: true cg@2346: model: applicationProvidesLabel cg@2346: translateLabel: true cg@2346: ) cg@1876: (LabelSpec cg@1876: label: 'Help Key:' cg@1876: name: 'activeHelp' cg@2346: layout: (AlignmentOrigin 98 0 203 0 1 0.5) cg@1876: translateLabel: true cg@1876: resizeForLabel: true ca@1373: ) cg@1876: (InputFieldSpec cg@1876: name: 'activeHelpKey' cg@2346: layout: (LayoutFrame 100 0 192 0 -5 1.0 214 0) cg@1876: activeHelpKey: label cg@1876: tabable: true cg@1876: model: activeHelpKey cg@1876: group: inputGroup cg@1876: type: symbolOrNil cg@1876: immediateAccept: true cg@1876: acceptOnReturn: false cg@1876: acceptOnTab: false cg@1876: acceptOnLostFocus: false cg@1876: acceptChannel: acceptChannel cg@1876: modifiedChannel: modifiedChannel cg@1876: acceptOnPointerLeave: false ca@1373: ) ca@1373: ) ca@1373: ca@1373: ) ca@1373: ) ca@1373: ! ca@1373: ca@1373: canvasSpec ca@1373: "This resource specification was automatically generated ca@1373: by the UIPainter of ST/X." ca@1373: ca@1373: "Do not manually edit this!! If it is corrupted, ca@1373: the UIPainter may not be able to read the specification." ca@1373: ca@1373: " ca@1373: UIPainter new openOnClass:TabListEditor andSelector:#canvasSpec ca@1373: TabListEditor new openInterface:#canvasSpec ca@1373: " ca@1373: ca@1373: ca@1373: ca@1373: ^ ca@1845: #(FullSpec ca@1845: name: canvasSpec ca@1845: window: ca@1845: (WindowSpec ca@1845: label: 'Canvas' ca@1845: name: 'Canvas' ca@1845: min: (Point 10 10) ca@1845: max: (Point 1280 1024) ca@1845: bounds: (Rectangle 0 0 383 220) ca@1373: ) ca@1845: component: ca@1845: (SpecCollection ca@1845: collection: ( ca@1845: (LabelSpec ca@1845: label: 'Class Name / Major Key:' ca@1845: name: 'majorKeyLabel' ca@1845: layout: (AlignmentOrigin 160 0 26 0 1 0.5) ca@1845: activeHelpKey: majorKey ca@1845: translateLabel: true ca@1845: resizeForLabel: true ca@1373: ) ca@1845: (InputFieldSpec ca@1845: name: 'majorKeyField' ca@1845: layout: (LayoutFrame 161 0 15 0 -5 1.0 37 0) ca@1845: activeHelpKey: majorKey ca@1845: tabable: true ca@1845: model: majorKey ca@1845: group: inputGroup ca@1845: type: symbolOrNil ca@1845: immediateAccept: true ca@1845: acceptOnReturn: false ca@1845: acceptOnTab: false ca@1845: acceptOnLostFocus: false ca@1845: modifiedChannel: modifiedChannel ca@1845: acceptOnPointerLeave: false ca@1373: ) ca@1845: (LabelSpec ca@1845: label: 'Selector / Minor Key:' ca@1845: name: 'minorKeyLabel' ca@1845: layout: (AlignmentOrigin 160 0 55 0 1 0.5) ca@1845: translateLabel: true ca@1845: resizeForLabel: true ca@1373: ) ca@1845: (InputFieldSpec ca@1845: name: 'minorKeyField' ca@1845: layout: (LayoutFrame 161 0 44 0 -5 1.0 66 0) ca@1845: activeHelpKey: majorKey ca@1845: tabable: true ca@1845: model: minorKey ca@1845: group: inputGroup ca@1845: type: symbolOrNil ca@1845: immediateAccept: true ca@1845: acceptOnReturn: false ca@1845: acceptOnTab: false ca@1845: acceptOnLostFocus: false ca@1845: modifiedChannel: modifiedChannel ca@1845: acceptOnPointerLeave: false ca@1373: ) ca@1845: (FramedBoxSpec ca@1845: label: 'Scroll Bars' ca@1845: name: 'FramedBox' ca@1860: layout: (LayoutFrame 0 0.0 119 0.0 0 1.0 218 0) ca@1845: labelPosition: topLeft cg@1876: translateLabel: true ca@1845: component: ca@1845: (SpecCollection ca@1845: collection: ( ca@1845: (HorizontalPanelViewSpec ca@1845: name: 'HorizontalPanel1' ca@1845: layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) ca@1845: horizontalLayout: fitSpace ca@1845: verticalLayout: fitSpace ca@1845: horizontalSpace: 3 ca@1845: verticalSpace: 3 ca@1845: component: ca@1845: (SpecCollection ca@1845: collection: ( ca@1845: (ViewSpec ca@1845: name: 'Box1' ca@1845: component: ca@1845: (SpecCollection ca@1845: collection: ( ca@1845: (CheckBoxSpec ca@1845: label: 'Vertical' ca@1845: name: 'verticalScrollBarCheckBox' ca@1845: layout: (LayoutFrame 0 0.0 3 0 0 1.0 27 0) ca@1845: activeHelpKey: verticalScroller ca@1845: tabable: true ca@1845: model: hasVerticalScrollBar ca@1845: translateLabel: true ca@1373: ) ca@1845: (CheckBoxSpec ca@1845: label: 'Mini' ca@1845: name: 'miniScrollerVerticalCheckBox' ca@1845: layout: (LayoutFrame 0 0.0 32 0 0 1.0 56 0) ca@1845: activeHelpKey: verticalMiniScroller ca@1845: tabable: true ca@1845: model: miniScrollerVertical ca@1845: translateLabel: true ca@1373: ) ca@1373: ) ca@1373: ca@1373: ) ca@1845: useDefaultExtent: true ca@1373: ) ca@1845: (ViewSpec ca@1845: name: 'Box2' ca@1845: component: ca@1845: (SpecCollection ca@1845: collection: ( ca@1845: (CheckBoxSpec ca@1845: label: 'Horizontal' ca@1845: name: 'horizontalScrollBarCheckBox' ca@1845: layout: (LayoutFrame 0 0.0 3 0 0 1.0 27 0) ca@1845: activeHelpKey: horizontalScroller ca@1845: tabable: true ca@1845: model: hasHorizontalScrollBar ca@1845: translateLabel: true ca@1373: ) ca@1845: (CheckBoxSpec ca@1845: label: 'Mini' ca@1845: name: 'miniScrollerHorizontalCheckBox' ca@1845: layout: (LayoutFrame 0 0.0 32 0 0 1.0 56 0) ca@1845: activeHelpKey: horizontalMiniScroller ca@1845: tabable: true ca@1845: model: miniScrollerHorizontal ca@1845: translateLabel: true ca@1373: ) ca@1373: ) ca@1373: ca@1373: ) cg@1876: extent: (Point 113 61) ca@1373: ) ca@1845: (ViewSpec ca@1845: name: 'Box3' ca@1845: component: ca@1845: (SpecCollection ca@1845: collection: ( ca@1845: (LabelSpec ca@1845: label: 'Auto Hide:' ca@1845: name: 'Label1' ca@1845: layout: (LayoutFrame 0 0.0 6 0 0 1.0 23 0) ca@1845: translateLabel: true ca@1845: resizeForLabel: true ca@1845: adjust: left ca@1373: ) ca@1845: (PopUpListSpec ca@1845: label: 'Default' ca@1845: name: 'PopUpList1' ca@1845: layout: (LayoutFrame 0 0.0 32 0 0 1.0 54 0) ca@1845: activeHelpKey: autoHideScrollBars ca@1845: tabable: true ca@1845: model: autoHideScrollBars ca@1845: menu: ca@1845: (Default ca@1845: On Off ca@1373: ) ca@1845: useIndex: true ca@1373: ) ca@1373: ) ca@1373: ca@1373: ) cg@1876: extent: (Point 113 61) ca@1373: ) ca@1373: ) ca@1373: ca@1373: ) ca@1373: ) ca@1373: ) ca@1373: ca@1373: ) ca@1373: ) ca@1845: (CheckBoxSpec ca@1845: label: 'Create New Builder' ca@1845: name: 'createNewBuilder' ca@1845: layout: (Point 161 75) ca@1845: activeHelpKey: createNewBuilder ca@1845: model: createNewBuilder ca@1845: translateLabel: true ca@1373: ) ca@1373: ) ca@1373: ca@1373: ) ca@1373: ) ca@1373: ! ca@1373: ca@1373: detailSpec ca@1373: "This resource specification was automatically generated ca@1373: by the UIPainter of ST/X." ca@1373: ca@1373: "Do not manually edit this!! If it is corrupted, ca@1373: the UIPainter may not be able to read the specification." ca@1373: ca@1373: " ca@1373: UIPainter new openOnClass:TabListEditor andSelector:#detailSpec ca@1373: TabListEditor new openInterface:#detailSpec ca@1373: " ca@1373: ca@1373: ca@1373: ca@1373: ^ cg@1876: #(FullSpec cg@1876: name: detailSpec cg@1876: window: cg@1876: (WindowSpec cg@1876: label: 'Details' cg@1876: name: 'Details' cg@1876: min: (Point 10 10) cg@1876: max: (Point 1280 1024) cg@1876: bounds: (Rectangle 0 0 358 107) ca@1373: ) cg@1876: component: cg@1876: (SpecCollection cg@1876: collection: ( cg@1876: (CheckBoxSpec cg@1876: label: 'Can Select' cg@1876: name: 'enabled' cg@1876: layout: (Point 46 14) cg@1876: activeHelpKey: canSelect cg@1876: tabable: true cg@1876: model: enabled cg@1876: translateLabel: true cg@1183: ) cg@1876: (LabelSpec cg@1876: label: 'Color:' cg@1876: name: 'ForegroundLabel' cg@1876: layout: (AlignmentOrigin 46 0 62 0 1 0.5) cg@1876: translateLabel: true cg@1876: resizeForLabel: true cg@1876: adjust: right cg@1183: ) cg@1876: (ColorMenuSpec cg@1876: name: 'ForegroundColorMenu' cg@1876: layout: (LayoutFrame 48 0 50 0 -10 1.0 72 0) cg@1876: activeHelpKey: color cg@1876: model: labelForegroundColor cg@1876: labelsAreColored: false cg@1183: ) cg@1183: ) cg@1183: cg@1183: ) tz@739: ) tz@739: ! tz@739: tz@739: windowSpec tz@739: "This resource specification was automatically generated tz@739: by the UIPainter of ST/X." tz@739: tz@739: "Do not manually edit this!! If it is corrupted, tz@739: the UIPainter may not be able to read the specification." tz@739: tz@739: " tz@739: UIPainter new openOnClass:TabListEditor andSelector:#windowSpec tz@739: TabListEditor new openInterface:#windowSpec tz@739: TabListEditor open tz@739: " tz@739: tz@739: tz@739: cg@1183: ^ cg@1183: #(#FullSpec cg@1183: #name: #windowSpec cg@1183: #window: cg@1183: #(#WindowSpec cg@1183: #label: 'Tab List Editor' cg@1183: #name: 'Tab List Editor' cg@1183: #min: #(#Point 440 280) ca@1375: #bounds: #(#Rectangle 596 292 1132 661) cg@1183: #menu: #menu cg@1183: ) cg@1183: #component: cg@1183: #(#SpecCollection cg@1183: #collection: #( cg@1183: #(#MenuPanelSpec cg@1183: #name: 'menuToolbarView' cg@1183: #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 34 0) cg@1183: #menu: #menuToolbar cg@1183: #showSeparatingLines: true cg@1183: ) cg@1183: #(#VariableHorizontalPanelSpec cg@1183: #name: 'VariablePanel' cg@1183: #layout: #(#LayoutFrame 0 0.0 36 0.0 0 1.0 -26 1.0) cg@1183: #component: cg@1183: #(#SpecCollection cg@1183: #collection: #( ca@1373: #(#SelectionInListModelViewSpec ca@1373: #attributes: ca@1373: #(#vpext ca@1373: ca@1373: #(#Array ca@1374: #Array #Array ca@1374: #Array #Array ca@1375: #Array #Point ca@1375: 0.264414 1.0 ca@1373: ) ca@1373: ) ca@1373: #name: 'ListOfLabels' ca@1373: #tabable: true cg@1183: #model: #selectionHolder cg@1183: #menu: #menuEdit cg@1183: #hasHorizontalScrollBar: true cg@1183: #hasVerticalScrollBar: true cg@1183: #miniScrollerHorizontal: true ca@1373: #listModel: #listOfTabs ca@1373: #highlightMode: #line ca@1373: #selectConditionSelector: #askForItemModification cg@1183: ) cg@1183: #(#ViewSpec cg@1183: #name: 'SpecView' cg@1183: #level: -1 tz@739: #component: cg@1183: #(#SpecCollection cg@1183: #collection: #( ca@1373: #(#NoteBookViewSpec ca@1373: #name: 'NoteBook' cg@1183: #layout: #(#LayoutFrame 1 0.0 0 0.0 0 1.0 -30 1.0) ca@1375: #enableChannel: #hasSelectionHolder ca@1374: #tabable: true ca@1373: #model: #noteBookModel ca@1373: #menu: #noteBookTabList ca@1373: #useIndex: true ca@1373: #keepCanvasAlive: true cg@1183: ) cg@1183: #(#UISubSpecification cg@1183: #name: 'subSpec' cg@1183: #layout: #(#LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1) cg@1183: #majorKey: #ToolApplicationModel cg@1183: #minorKey: #windowSpecForCommit cg@1183: ) ca@1373: #(#NoteBookViewSpec ca@1373: #name: 'TestNoteBook' ca@1373: #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) ca@1373: #visibilityChannel: #testMode ca@1374: #tabable: true ca@1373: #menu: #testItemList ca@1373: #useIndex: true ca@1373: ) cg@1183: ) cg@1183: tz@739: ) cg@1183: ) cg@1183: ) cg@1183: tz@739: ) ca@1373: #handles: #(#Any 0.24053 1.0) cg@1183: ) cg@1183: #(#UISubSpecification cg@1183: #name: 'infoBarSubSpec' cg@1183: #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) cg@1183: #majorKey: #ToolApplicationModel cg@1183: #minorKey: #windowSpecForInfoBar cg@1183: ) cg@1183: ) cg@1183: cg@1183: ) tz@739: ) tz@739: ! ! tz@739: ca@1373: !TabListEditor class methodsFor:'list specs'! ca@1373: ca@1373: noteBookTabList ca@1373: "This resource specification was automatically generated ca@1373: by the TabListEditor of ST/X." ca@1373: ca@1373: "Do not manually edit this!! If it is corrupted, ca@1373: the TabListEditor may not be able to read the specification." ca@1373: ca@1373: " ca@1373: TabListEditor new openOnClass:TabListEditor andSelector:#noteBookTabList ca@1373: " ca@1373: ca@1373: ca@1373: ca@1373: ^ #( ca@1373: #(#TabItem ca@1373: #label: 'Basic' ca@1373: #activeHelpKey: #basicTab ca@1373: #minorKey: #basicSpec ca@1373: ) ca@1373: #(#TabItem ca@1373: #label: 'Details' ca@1373: #activeHelpKey: #detailTab ca@1373: #minorKey: #detailSpec ca@1373: ) ca@1373: #(#TabItem ca@1373: #label: 'Canvas' ca@1373: #activeHelpKey: #canvasTab ca@1373: #minorKey: #canvasSpec ca@1373: ) ca@1373: ) ca@1373: ca@1373: collect:[:aTab| TabItem new fromLiteralArrayEncoding:aTab ] ca@1373: ! ! ca@1373: tz@739: !TabListEditor class methodsFor:'menu specs'! tz@739: tz@739: menu tz@739: "This resource specification was automatically generated tz@739: by the MenuEditor of ST/X." tz@739: tz@739: "Do not manually edit this!! If it is corrupted, tz@739: the MenuEditor may not be able to read the specification." tz@739: tz@739: " tz@739: MenuEditor new openOnClass:TabListEditor andSelector:#menu tz@739: (Menu new fromLiteralArrayEncoding:(TabListEditor menu)) startUp tz@739: " tz@739: tz@739: tz@739: tz@739: ^ tz@739: tz@739: #(#Menu tz@739: tz@739: #( tz@739: #(#MenuItem tz@739: #label: 'About' tz@739: #activeHelpKey: #about tz@739: #labelImage: #(#ResourceRetriever nil #menuIcon) tz@739: #submenuChannel: #menuAbout tz@739: ) tz@739: #(#MenuItem tz@739: #label: 'File' tz@739: #activeHelpKey: #file tz@739: #submenu: tz@739: #(#Menu tz@739: tz@739: #( tz@739: #(#MenuItem tz@739: #label: 'New' tz@739: #value: #doNew tz@739: #activeHelpKey: #fileNew tz@739: ) tz@739: #(#MenuItem tz@739: #label: '-' tz@739: ) tz@739: #(#MenuItem tz@739: #label: 'Load...' tz@739: #translateLabel: true tz@739: #value: #doLoad tz@739: #activeHelpKey: #fileLoad tz@739: ) tz@739: #(#MenuItem tz@739: #label: '-' tz@739: ) tz@739: #(#MenuItem tz@739: #label: 'Save' tz@739: #value: #doSave tz@739: #activeHelpKey: #fileSave tz@739: ) tz@739: #(#MenuItem tz@739: #label: 'Save As...' tz@739: #value: #doSaveAs tz@739: #activeHelpKey: #fileSave tz@739: ) tz@739: #(#MenuItem tz@739: #label: '-' tz@739: ) tz@739: #(#MenuItem tz@739: #label: 'Browse Class' tz@739: #value: #doBrowseClass tz@739: #activeHelpKey: #fileBrowseClass tz@739: ) tz@739: #(#MenuItem tz@739: #label: '-' tz@739: ) tz@739: #(#MenuItem tz@739: #label: 'Exit' tz@739: #value: #closeRequest tz@739: #activeHelpKey: #fileExit tz@739: ) tz@739: ) nil tz@739: nil tz@739: ) tz@739: ) tz@739: #(#MenuItem tz@739: #label: 'Edit' tz@739: #activeHelpKey: #edit tz@739: #submenuChannel: #menuEdit tz@739: ) tz@739: #(#MenuItem tz@739: #label: 'Add' tz@739: #activeHelpKey: #add tz@739: #submenu: tz@739: #(#Menu tz@739: tz@739: #( tz@739: #(#MenuItem tz@739: #label: 'Tab Item' ca@1373: #value: #doCreate tz@739: #activeHelpKey: #addTabItem tz@739: #labelImage: #(#ResourceRetriever nil #newTabItemIcon 'Tab Item') tz@739: ) tz@739: ) nil tz@739: nil tz@739: ) tz@739: ) tz@739: #(#MenuItem tz@739: #label: 'Generate' tz@739: #activeHelpKey: #add tz@739: #submenu: tz@739: #(#Menu tz@739: tz@739: #( tz@739: #(#MenuItem tz@739: #label: 'Aspect Method' tz@739: #value: #doGenerateAspectMethod tz@739: #activeHelpKey: #fileCreateAspectMethod tz@739: #enabled: #hasClassAndSelector tz@739: ) tz@739: ) nil tz@739: nil tz@739: ) tz@739: ) tz@739: #(#MenuItem tz@739: #label: 'Test' tz@739: #activeHelpKey: #test tz@739: #submenu: tz@739: #(#Menu tz@739: tz@739: #( tz@739: #(#MenuItem tz@739: #label: 'Preview' tz@739: #activeHelpKey: #testPreview ca@1373: #enabled: #canToggleTestMode tz@739: #indication: #testMode tz@739: ) tz@739: ) nil tz@739: nil tz@739: ) tz@739: ) tz@739: #(#MenuItem tz@749: #label: 'History' tz@749: #activeHelpKey: #history tz@749: #submenuChannel: #menuHistory tz@749: ) tz@749: #(#MenuItem cg@2667: label: 'MENU_Help' tz@739: #startGroup: #right tz@739: #activeHelpKey: #help tz@739: #submenuChannel: #menuHelp cg@2667: startGroup: conditionalRight tz@739: ) tz@739: ) nil tz@739: nil tz@739: ) tz@739: ! tz@739: tz@739: menuEdit tz@739: "This resource specification was automatically generated tz@739: by the MenuEditor of ST/X." tz@739: tz@739: "Do not manually edit this!! If it is corrupted, tz@739: the MenuEditor may not be able to read the specification." tz@739: tz@739: " tz@739: MenuEditor new openOnClass:TabListEditor andSelector:#menuEdit tz@739: (Menu new fromLiteralArrayEncoding:(TabListEditor menuEdit)) startUp tz@739: " tz@739: tz@739: tz@739: ca@1374: ^ ca@1374: #(#Menu ca@1374: #( ca@1374: #(#MenuItem ca@1374: #label: 'Cut' ca@1374: #value: #doCut ca@1374: #activeHelpKey: #editCut ca@1374: #enabled: #hasSelectionHolder ca@1374: ) ca@1374: #(#MenuItem ca@1374: #label: 'Copy' ca@1374: #value: #doCopy ca@1374: #activeHelpKey: #editCopy ca@1374: #enabled: #hasSelectionHolder ca@1374: ) ca@1374: #(#MenuItem ca@1374: #label: 'Paste' ca@1374: #value: #doPaste ca@1374: #activeHelpKey: #editPaste sv@2383: #enabled: #canPasteHolder ca@1374: ) ca@1374: #(#MenuItem ca@1374: #label: 'Delete' ca@1374: #value: #doDelete ca@1374: #activeHelpKey: #editPaste ca@1374: #enabled: #hasSelectionHolder ca@1374: ) ca@1374: #(#MenuItem ca@1374: #label: '-' ca@1374: ) ca@1374: #(#MenuItem ca@1374: #label: 'Move Up' ca@1374: #value: #doMoveTabUpOrDown: ca@1374: #activeHelpKey: #editMoveUp ca@1374: #enabled: #canMoveTabItemUpOrDown ca@1374: #argument: #up ca@1374: #labelImage: #(#ResourceRetriever #Icon #upIcon 'Move Up') ca@1374: ) ca@1374: #(#MenuItem ca@1374: #label: 'Move Down' ca@1374: #value: #doMoveTabUpOrDown: ca@1374: #activeHelpKey: #editMoveDown ca@1374: #enabled: #canMoveTabItemUpOrDown ca@1374: #argument: #down ca@1374: #labelImage: #(#ResourceRetriever #Icon #downIcon 'Move Down') ca@1374: ) ca@1374: #(#MenuItem ca@1374: #label: '-' ca@1374: #isVisible: #hiddenAccelerator ca@1374: ) ca@1374: #(#MenuItem ca@1374: #label: 'Accept' ca@1374: #translateLabel: true ca@1374: #isVisible: #hiddenAccelerator ca@1374: #value: #accept sv@2432: #enabled: #enablingCommitButtonsHolder ca@1374: ) ca@1374: ) ca@1374: nil ca@1374: nil tz@739: ) tz@739: ! tz@739: tz@739: menuToolbar tz@739: "This resource specification was automatically generated tz@739: by the MenuEditor of ST/X." tz@739: tz@739: "Do not manually edit this!! If it is corrupted, tz@739: the MenuEditor may not be able to read the specification." tz@739: tz@739: " tz@739: MenuEditor new openOnClass:TabListEditor andSelector:#menuToolbar tz@739: (Menu new fromLiteralArrayEncoding:(TabListEditor menuToolbar)) startUp tz@739: " tz@739: tz@739: tz@739: ca@1373: ^ cg@1909: #(Menu cg@1909: ( cg@1909: (MenuItem cg@1909: activeHelpKey: fileNew cg@1909: label: 'New' cg@1909: itemValue: doNew cg@1909: translateLabel: true cg@1909: isButton: true cg@1909: labelImage: (ResourceRetriever ToolbarIconLibrary new22x22Icon) ca@1373: ) cg@1909: (MenuItem cg@1909: activeHelpKey: fileLoad cg@1909: label: 'Load' cg@1909: itemValue: doLoad cg@1909: translateLabel: true cg@1909: isButton: true cg@1909: labelImage: (ResourceRetriever ToolbarIconLibrary loadFromMethodIcon) ca@1373: ) cg@1909: (MenuItem cg@1909: activeHelpKey: fileSave cg@1909: label: 'Save' cg@1909: itemValue: doSave cg@1909: translateLabel: true cg@1909: isButton: true cg@1909: labelImage: (ResourceRetriever ToolbarIconLibrary saveAsMethodIcon) ca@1373: ) cg@1909: (MenuItem cg@1909: label: '-' ca@1373: ) cg@1909: (MenuItem cg@1909: activeHelpKey: editCut cg@1909: enabled: hasSelectionHolder cg@1909: label: 'Cut' cg@1909: itemValue: doCut cg@1909: translateLabel: true cg@1909: isButton: true cg@1909: labelImage: (ResourceRetriever ToolbarIconLibrary cutWidgetIcon) ca@1373: ) cg@1909: (MenuItem cg@1909: activeHelpKey: editCopy cg@1909: enabled: hasSelectionHolder cg@1909: label: 'Copy' cg@1909: itemValue: doCopy cg@1909: translateLabel: true cg@1909: isButton: true cg@1909: labelImage: (ResourceRetriever ToolbarIconLibrary copyWidgetIcon) ca@1373: ) cg@1909: (MenuItem cg@1909: activeHelpKey: editPaste sv@2383: enabled: canPasteHolder cg@1909: label: 'Paste' cg@1909: itemValue: doPaste cg@1909: translateLabel: true cg@1909: isButton: true cg@1909: labelImage: (ResourceRetriever ToolbarIconLibrary pasteWidgetIcon) ca@1373: ) cg@1909: (MenuItem cg@1909: activeHelpKey: editDelete cg@1909: enabled: hasSelectionHolder cg@1909: label: 'Delete' cg@1909: itemValue: doDelete cg@1909: translateLabel: true cg@1909: isButton: true cg@1909: isVisible: false cg@1909: labelImage: (ResourceRetriever ToolbarIconLibrary delete22x22Icon) ca@1373: ) cg@1909: (MenuItem cg@1909: label: '-' ca@1373: ) cg@1909: (MenuItem cg@1909: activeHelpKey: addTabItem cg@1909: label: 'Add Tab Item' cg@1909: itemValue: doCreate cg@1909: translateLabel: true cg@1909: isButton: true cg@1909: labelImage: (ResourceRetriever nil newTabItemIcon) ca@1373: ) cg@1909: (MenuItem cg@1909: label: '' ca@1373: ) cg@1909: (MenuItem cg@1909: activeHelpKey: editMoveUp cg@1909: enabled: canMoveTabItemUpOrDown cg@1909: label: 'Move Tab Up' cg@1909: itemValue: doMoveTabUpOrDown: cg@1909: translateLabel: true cg@1909: isButton: true cg@1909: startGroup: right cg@1909: labelImage: (ResourceRetriever XPToolbarIconLibrary up22x22Icon) cg@1909: argument: up ca@1373: ) cg@1909: (MenuItem cg@1909: activeHelpKey: editMoveDown cg@1909: enabled: canMoveTabItemUpOrDown cg@1909: label: 'Move Tab Down' cg@1909: itemValue: doMoveTabUpOrDown: cg@1909: translateLabel: true cg@1909: isButton: true cg@1909: startGroup: right cg@1909: labelImage: (ResourceRetriever XPToolbarIconLibrary down22x22Icon) cg@1909: argument: down ca@1373: ) ca@1373: ) ca@1373: nil ca@1373: nil tz@739: ) tz@739: ! ! tz@739: tz@739: !TabListEditor methodsFor:'aspects'! tz@739: ca@1373: autoHideScrollBars ca@1373: |holder| ca@1373: ca@1373: (holder := builder bindingAt:#autoHideScrollBars) isNil ifTrue:[ ca@1373: builder aspectAt:#autoHideScrollBars put:(holder := 1 asValue). ca@1373: holder addDependent: self ca@1373: ]. ca@1373: ^ holder. ca@1373: ! ca@1373: tz@739: canMoveTabItemUpOrDown ca@1373: ^ builder booleanValueAspectFor:#canMoveTabItemUpOrDown ca@1373: ! ca@1373: ca@1374: hasSelectionHolder ca@1374: ^ builder booleanValueAspectFor:#hasSelectionHolder ca@1374: ! ca@1374: ca@1374: hiddenAccelerator ca@1374: "used to set menu entries with an accelerator not visible to the operator ca@1374: " ca@1374: ^ false ca@1374: ! ca@1374: ca@1326: inputGroup ca@1326: ca@1326: |holder| ca@1326: ca@1326: (holder := builder bindingAt:#inputGroup) isNil ifTrue:[ ca@1326: builder aspectAt:#inputGroup put:(holder := EnterFieldGroup new) ca@1326: ]. ca@1326: ^ holder. ca@1326: ca@1326: ca@1326: ! ca@1326: ca@1373: listOfTabs ca@1373: ^ listOfTabs ca@1373: ! ca@1373: ca@1373: noteBookModel ca@1373: |holder| ca@1373: ca@1373: (holder := builder bindingAt:#noteBookModel) isNil ifTrue:[ ca@1373: holder := 0 asValue. ca@1373: builder aspectAt:#noteBookModel put:holder. ca@1373: ]. ca@1373: ^ holder. ca@1373: ! ca@1373: ca@1373: noteBookTabList ca@1373: "Generated by the TabListEditor" ca@1373: ca@1373: |list| ca@1373: ca@1373: (list := builder bindingAt:#noteBookTabList) isNil ifTrue:[ ca@1373: builder aspectAt:#noteBookTabList put:(list := self class noteBookTabList). ca@1373: ]. ca@1373: ^ list tz@739: ! tz@739: tz@739: selectionHolder tz@739: "holder which keeps the current selection tz@739: " tz@739: |holder| tz@739: tz@739: (holder := builder bindingAt:#selectionHolder) isNil ifTrue:[ ca@1373: holder := 0 asValue. tz@739: builder aspectAt:#selectionHolder put:holder. ca@1373: holder addDependent:self. tz@739: ]. tz@739: ^ holder tz@739: ! tz@739: ca@1373: testItemList tz@739: |holder| tz@739: ca@1373: (holder := builder bindingAt:#testItemList) isNil ifTrue:[ ca@1373: holder := ValueHolder new. ca@1373: builder aspectAt:#testItemList put:holder. tz@739: ]. ca@1373: ^ holder. tz@739: ! tz@739: tz@739: testMode tz@739: tz@739: |holder| tz@739: tz@739: (holder := builder bindingAt:#testMode) isNil ifTrue:[ tz@739: builder aspectAt:#testMode put:(holder := false asValue). tz@739: holder addDependent: self tz@739: ]. tz@739: ^ holder tz@739: tz@739: ! ! tz@739: tz@739: !TabListEditor methodsFor:'building'! tz@739: ca@1373: buildFromResourceSpec:aListSpec ca@1373: self buildFromTabList:aListSpec tz@739: ! tz@739: tz@739: buildFromTabList: aTabList tz@739: "build from a aTabList" tz@739: ca@1373: self selection:0. tz@739: listOfTabs removeAll. tz@739: cg@2819: aTabList do:[:aTabItem| cg@2819: self assert:(aTabItem isKindOf:TabItem). cg@2819: listOfTabs add: aTabItem cg@2819: ]. cg@1972: self clearModified. ca@1374: listOfTabs notEmpty ifTrue:[ self selection:1 ]. cg@2819: cg@2819: "Modified: / 08-11-2010 / 13:57:27 / cg" cg@1972: ! tz@739: cg@1972: loadFromClass:aClass andSelector:aSelector cg@1972: "build from class and selector" cg@1972: cg@1972: |cls spec| cg@1972: cg@1972: self assert:(aClass isNil or:[aClass isClass]). cg@1972: cg@1972: self testMode value: false. cg@1972: self selection:0. cg@1972: cg@1972: "if opened on a tab list" cg@1972: (aClass isNil and: [aSelector isNil and: [listOfTabs size > 0]]) ifFalse:[ cg@1972: listOfTabs removeAll. cg@1972: cg@1972: cls := aClass isBehavior ifTrue:[ aClass ] ifFalse:[ self resolveName:aClass]. cg@1972: specSelector := aSelector. cg@1972: cg@1972: cls notNil ifTrue:[ cg@1972: specSelector notNil ifTrue:[ cg@1972: cg@1972: (cls respondsTo: aSelector) ifTrue:[ cg@1972: spec := cls perform: aSelector. cg@1972: ]. cg@1972: spec size ~~ 0 ifTrue:[ cg@2819: spec do:[:aTabOrArray| cg@2819: |tab| cg@2819: cg@2819: aTabOrArray isArray ifTrue:[ cg@2819: tab := aTabOrArray decodeAsLiteralArray cg@2819: ] ifFalse:[ cg@2819: tab := aTabOrArray. cg@2819: ]. cg@2819: self assert:(tab isKindOf:TabItem). cg@2819: listOfTabs add:tab. cg@1972: ]. cg@1972: self addHistoryEntryForClass:cls selector:specSelector. cg@1972: ] cg@1972: ] cg@1972: ]. cg@1972: cg@1972: self clearModified. cg@1972: ]. cg@1972: listOfTabs notEmpty ifTrue:[ self selection:1 ]. cg@2819: cg@2819: "Modified: / 08-11-2010 / 13:59:09 / cg" tz@739: ! ! tz@739: tz@739: !TabListEditor methodsFor:'change & update'! tz@739: tz@739: update:something with:aParameter from:someObject tz@739: "one of my aspects has changed; update modified channel tz@739: " ca@1374: |list| ca@1373: ca@1373: someObject = self selectionHolder ifTrue:[ ca@1373: ^ self selectionChanged ca@1373: ]. ca@1373: ca@1373: someObject = self testMode ifFalse:[ ca@1373: ^ super update:something with:aParameter from:someObject. ca@1373: ]. ca@1373: ca@1373: someObject value ifTrue:[ ca@1375: self noteBookModel value:0. ca@1375: ca@1374: listOfTabs notEmpty ifTrue:[ ca@1373: list := listOfTabs collect:[:aTab| |tab| ca@1373: tab := aTab copy. ca@1373: tab setAttributesFromClass:specClass. ca@1373: tab ca@1374: ] ca@1374: ]. ca@1374: self selection:0. ca@1373: ]. ca@1373: self testItemList value:list. ca@1373: self updateInfoLabel. tz@739: tz@739: ! ! tz@739: ca@1373: !TabListEditor methodsFor:'queries'! tz@739: ca@1373: canToggleTestMode sv@2281: "checks whether testMode button is enabled" sv@2281: ca@1373: self testMode value ifTrue:[ ca@1373: ^ true ca@1373: ]. ca@1373: sv@2281: self enablingCommitButtonsHolder value ifFalse:[ ca@1373: ^ listOfTabs notEmpty ca@1373: ]. ca@1373: ^ false tz@739: ! ! tz@739: tz@739: !TabListEditor methodsFor:'selection'! tz@739: ca@1373: selectedElement ca@1373: |idx tab| ca@1373: ca@1373: idx := self selection. ca@1373: ca@1373: idx ~~ 0 ifTrue:[ ca@1373: (tab := listOfTabs at:idx ifAbsent:nil) notNil ifTrue:[ ca@1373: ^ tab ca@1373: ]. ca@1373: self selection:0 ca@1373: ]. ca@1373: ^ nil ca@1373: ! ca@1373: ca@1373: selection ca@1373: ^ self selectionHolder value ? 0 tz@739: ! tz@739: ca@1373: selection:anIndex ca@1373: self selectionHolder value:(anIndex ? 0). ca@1373: ! tz@739: ca@1373: selectionChanged ca@1373: |noteBookModel hasSelection| tz@739: ca@1373: hasSelection := self selection ~~ 0. ca@1373: noteBookModel := self noteBookModel. cg@1145: ca@1373: hasSelection ifTrue:[ ca@1373: self testMode value:false. ca@1373: noteBookModel value == 0 ifTrue:[noteBookModel value:1] tz@739: ] ifFalse:[ ca@1373: noteBookModel value:0 tz@739: ]. tz@739: self cancel. ca@1374: self hasSelectionHolder value:hasSelection. sv@2281: self canPasteHolder. ca@1373: ! tz@739: ca@1373: setSelection:anIndex ca@1374: |index| ca@1374: ca@1374: index := anIndex ? 0. ca@1374: self selectionHolder value:index withoutNotifying:self tz@739: ! ! tz@739: tz@739: !TabListEditor methodsFor:'startup / release'! tz@739: tz@739: initialize tz@739: "setup aspects used by column description specifications tz@739: " tz@739: super initialize. ca@1373: listOfTabs := List new. tz@739: ! tz@739: tz@739: openModalOnTabList: aTabList tz@739: "build a tab list from aTabList and open it modal" tz@739: tz@739: super openModalOnResourceSpec: aTabList tz@739: tz@739: ! ! tz@739: tz@739: !TabListEditor methodsFor:'user actions'! tz@739: tz@739: accept tz@739: "accept changes tz@739: " ca@1373: |tab idx asb| cg@1066: ca@1373: (tab := self selectedElement) notNil ifTrue:[ ca@1373: super accept. ca@1373: aspects keysAndValuesDo:[:k :m| tab perform:(k , ':') asSymbol with:(m value) ]. tz@739: ca@1373: asb := self autoHideScrollBars value. ca@1373: asb := asb ~~ 1 ifTrue:[asb == 2] ifFalse:[nil]. ca@1373: tab autoHideScrollBars:asb. tz@739: ]. tz@739: self cancel. ca@1373: ! ca@1373: ca@1373: addTab:aTab ca@1373: |idx| ca@1373: ca@1373: aTab notNil ifTrue:[ cg@2819: self assert:(aTab isKindOf:TabItem). ca@1373: self testMode value: false. ca@1373: ca@1373: (idx := self selection) == 0 ifTrue:[ ca@1373: listOfTabs add:aTab. ca@1373: self selection:(listOfTabs size). ca@1373: ] ifFalse:[ ca@1373: listOfTabs add:aTab afterIndex:idx ca@1373: ]. cg@1972: self setModified. ca@1373: ]. cg@2819: cg@2819: "Modified: / 08-11-2010 / 13:55:27 / cg" tz@739: ! tz@739: tz@739: cancel sv@2281: "cancel all changes" sv@2281: ca@1373: |tab idx asb| tz@739: ca@1373: ( (idx := self selection) ~~ 0 ca@1373: and:[(tab := self selectedElement) notNil] ca@1373: ) ifTrue:[ ca@1373: aspects keysAndValuesDo:[:k :m| m value:(tab perform:k) ]. ca@1373: listOfTabs at:idx put:tab. tz@739: ca@1373: asb := tab autoHideScrollBars. ca@1373: asb notNil ifTrue:[asb := asb == true ifTrue:[2] ifFalse:[3]] ca@1373: ifFalse:[asb := 1]. tz@739: ca@1373: self autoHideScrollBars value:asb. tz@739: ]. ca@1373: self canMoveTabItemUpOrDown value:(listOfTabs size > 1 and:[idx ~~ 0]). sv@2281: self enablingCommitButtonsHolder value: false tz@739: ! tz@739: tz@739: doCopy tz@739: "copy selected tab tz@739: " ca@1373: |tab| ca@1373: ca@1373: (tab := self selectedElement) notNil ifTrue:[ ca@1373: self clipboard:tab. tz@749: self updateAllToolInstances. tz@739: ] tz@739: ! tz@739: ca@1373: doCreate ca@1373: self addTab:(TabItem label:'TAB'). tz@739: ! tz@739: tz@739: doCut ca@1373: "cut the selected tab; put to pasteBuffer tz@739: " ca@1373: |tab| tz@739: ca@1373: (tab := self selectedElement) notNil ifTrue:[ ca@1373: self clipboard:tab. ca@1373: self doDelete. tz@739: ]. tz@739: tz@739: ! tz@739: tz@739: doDelete tz@739: "delete selected tab tz@739: " ca@1374: |index size| tz@739: ca@1373: (index := self selection) ~~ 0 ifTrue:[ tz@739: self testMode value: false. ca@1374: ca@1374: (size := listOfTabs size) == 1 ifTrue:[ ca@1374: self selection:0 ca@1374: ] ifFalse:[ ca@1374: self setSelection:0 ca@1374: ]. tz@739: listOfTabs removeIndex:index. ca@1374: index < size ifFalse:[ ca@1374: index := index - 1 ca@1374: ]. ca@1373: self selection:index. ca@1373: self updateAllToolInstances. cg@1972: self setModified. tz@739: ]. tz@739: ! tz@739: tz@739: doGenerateAspectMethod tz@739: "generate aspect method tz@739: " tz@739: |cls code| tz@739: tz@739: (specClass notNil and:[specSelector notNil]) tz@739: ifFalse: tz@739: [ tz@739: ^self information:'No class and selector defined!!' tz@739: ]. tz@739: tz@739: cls := self resolveName: specClass. tz@739: tz@739: (cls canUnderstand:specSelector) ifTrue:[ tz@739: "/ method already exists, do not overwrite the method automaticaly tz@739: tz@739: ( YesNoBox title:'method ' tz@739: , (Text string:('#', specSelector) emphasis:#bold) tz@739: , ' already exists!!' tz@739: yesText:'overwrite' tz@739: noText:'cancel' tz@739: ) confirm ifFalse:[ tz@739: ^ self tz@739: ] tz@739: ]. tz@739: tz@739: code := '!!' , cls name , ' methodsFor:''aspects''!!\\' , tz@739: specSelector , '\' , tz@739: ' "Generated by the TabListEditor"\' , tz@739: '\' , tz@739: ' |list|\' , tz@739: '\' , tz@739: ' (list := builder bindingAt:#' , specSelector , ') isNil ifTrue:[\' , tz@739: ' builder aspectAt:#' , specSelector, ' put:(list := self class ', specSelector, ').\' , tz@739: ' ].\' , tz@739: ' ^ list\' , tz@739: '!! !!\\'. tz@739: tz@739: (ReadStream on:(code withCRs)) fileIn tz@739: tz@739: tz@739: ! tz@739: tz@739: doMoveTabUpOrDown:what tz@739: "step up or down tz@739: " ca@1373: |tab idx sz| tz@739: ca@1373: (listOfTabs size > 1 and:[(idx := self selection) ~~ 0]) ifFalse:[ tz@739: ^ self tz@739: ]. tz@739: ca@1373: (tab := listOfTabs at:idx ifAbsent:nil) isNil ifTrue:[ ca@1373: ^ self selection:0 ca@1373: ]. tz@739: ca@1373: self setSelection:0. ca@1373: listOfTabs removeIndex:idx. tz@739: ca@1373: sz := listOfTabs size. cg@1145: tz@739: what == #down ifTrue:[ ca@1373: idx := idx > sz ifTrue:[1] ifFalse:[idx + 1] tz@739: ] ifFalse:[ ca@1373: idx := idx == 1 ifTrue:[sz + 1] ifFalse:[idx - 1] tz@739: ]. tz@739: ca@1373: listOfTabs add:tab beforeIndex:idx. ca@1373: self setSelection:idx. cg@1972: self setModified. tz@739: ! tz@739: tz@739: doPaste tz@739: "paste a tab tz@739: " ca@1373: |tab| cg@1145: ca@1373: ((tab := self class clipboard) notNil and:[tab isKindOf:TabItem]) ifTrue:[ ca@1373: self addTab:(tab deepCopy). ca@1373: ] tz@739: ! tz@739: tz@739: doSave cg@1972: "generate code for class and instance" cg@1972: ca@1245: |cls code spec category mthd list| tz@739: tz@739: (specClass notNil and:[specSelector notNil]) tz@739: ifFalse: tz@739: [ tz@739: ^self doSaveAs tz@739: ]. tz@739: tz@739: cls := self resolveName: specClass. tz@739: tz@739: listOfTabs isEmpty ifTrue:[^self information:'No tab list defined!!']. tz@739: tz@739: spec := WriteStream on:String new. ca@1245: list := Array new:(listOfTabs size). ca@1245: listOfTabs keysAndValuesDo:[:i :el|list at:i put:(el literalArrayEncoding)]. ca@1245: ca@1245: UISpecification prettyPrintSpecArray:list on:spec indent:5. tz@739: spec := spec contents. tz@739: tz@739: "/ if that method already exists, do not overwrite the category tz@739: tz@739: category := 'list specs'. tz@739: tz@739: (mthd := cls class compiledMethodAt:specSelector) notNil ifTrue:[ tz@739: category := mthd category. tz@739: ]. tz@739: tz@739: code := Character excla asString tz@739: , cls name , ' class methodsFor:' , category storeString tz@739: , Character excla asString , '\\' tz@739: tz@739: , specSelector , '\' tz@739: , (self class codeGenerationComment replChar:$!! withString:'!!!!') tz@739: , '\\ "\' cg@1855: , ' TabListEditor new openOnClass: self andSelector:#' , specSelector , '\' tz@739: , ' "\'. tz@739: tz@739: code := code tz@739: , '\' tz@739: , ' \\' tz@739: , ' ^' tz@739: , ' ', spec, '\' tz@739: , ' collect:[:aTab| TabItem new fromLiteralArrayEncoding:aTab ]' tz@739: , '\' tz@739: , Character excla asString tz@739: , ' ' tz@739: , Character excla asString tz@739: , '\'. tz@739: tz@739: code := code withCRs. tz@739: (ReadStream on:code) fileIn. tz@739: tz@739: (cls canUnderstand:specSelector) ifFalse:[ cg@2828: (YesNoBox confirm:(resources string:'Generate aspect method for tabList (#%1)?' with:specSelector)) ifTrue:[ tz@739: self doGenerateAspectMethod tz@739: ] tz@739: ]. tz@739: cg@1972: self addHistoryEntryForClass:cls selector:specSelector. cg@1972: self clearModified. tz@739: hasSaved := true. cg@1856: ! cg@1856: cg@1856: openDocumentation cg@1856: self openHTMLDocument:'tools/uipainter/TabListEditor.html'. tz@739: ! ! tz@739: tz@739: !TabListEditor class methodsFor:'documentation'! tz@739: tz@739: version cg@1066: ^ '$Header$' cg@2667: ! cg@2667: cg@2667: version_CVS cg@2667: ^ '$Header$' tz@739: ! !