diff -r 1d5adf147721 -r 89719cf96c63 DataSetBuilder.st --- a/DataSetBuilder.st Wed May 13 22:14:42 1998 +0200 +++ b/DataSetBuilder.st Wed May 13 22:24:26 1998 +0200 @@ -1,5 +1,5 @@ " - COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger + COPYRIGHT (c) 1997 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used @@ -15,8 +15,8 @@ ResourceSpecEditor subclass:#DataSetBuilder - instanceVariableNames:'rowClass rowSuperClass hasChanged columnView columns - selectedColumnIndex tabSelectionIndex' + instanceVariableNames:'rowClass rowSuperClass columnView columns selectedColumnIndex + modalOpened' classVariableNames:'' poolDictionaries:'' category:'Interface-UIPainter' @@ -26,7 +26,7 @@ copyright " - COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger + COPYRIGHT (c) 1997 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used @@ -58,19 +58,55 @@ ! ! -!DataSetBuilder class methodsFor:'instance creation'! - -openOnClass:aClass andSelector:aSelector - - ^ self new openOnClass:aClass andSelector:aSelector -! ! - -!DataSetBuilder class methodsFor:'constants'! +!DataSetBuilder class methodsFor:'accessing'! resourceType "get the type of resource of the method generated by the MenuEditor" - ^#dataset + ^#tableColumns + + +! ! + +!DataSetBuilder class methodsFor:'aspects'! + +aspects + "get the aspects for the attributes of the table columns" + + ^#( + label + canSelect + choices + editorType + formatString + labelIsImage + size + type + width + minWidth + height + menu + foregroundSelector + backgroundSelector + doubleClickedSelector + selectSelector + printSelector + readSelector + writeSelector + rendererType + showColSeparator + showRowSeparator + backgroundColor + foregroundColor + labelForegroundColor + labelBackgroundColor + labelFont + labelActionSelector + labelActionArgument + labelAlignment + columnAlignment + ) + ! ! @@ -357,10 +393,11 @@ ! colorsEditSpec - "this window spec was automatically generated by the ST/X UIPainter" + "This resource specification was automatically generated + by the UIPainter of ST/X." - "do not manually edit this - the painter/builder may not be able to - handle the specification if its corrupted." + "Do not manually edit this!! If it is corrupted, + the UIPainter may not be able to read the specification." " UIPainter new openOnClass:DataSetBuilder andSelector:#colorsEditSpec @@ -375,11 +412,11 @@ #window: #(#WindowSpec #name: 'DataSet Misc' - #layout: #(#LayoutFrame 383 0 282 0 751 0 581 0) + #layout: #(#LayoutFrame 518 0 351 0 886 0 650 0) #label: 'DataSet Misc' #min: #(#Point 10 10) #max: #(#Point 1280 1024) - #bounds: #(#Rectangle 383 282 752 582) + #bounds: #(#Rectangle 518 351 887 651) #usePreferredExtent: false ) #component: @@ -502,10 +539,11 @@ ! defineClassNameSpec - "this window spec was automatically generated by the ST/X UIPainter" + "This resource specification was automatically generated + by the UIPainter of ST/X." - "do not manually edit this - the painter/builder may not be able to - handle the specification if its corrupted." + "Do not manually edit this!! If it is corrupted, + the UIPainter may not be able to read the specification." " UIPainter new openOnClass:DataSetBuilder andSelector:#defineClassNameSpec @@ -520,11 +558,11 @@ #window: #(#WindowSpec #name: 'Data Set Builder' - #layout: #(#LayoutFrame 425 0 253 0 751 0 388 0) + #layout: #(#LayoutFrame 414 0 336 0 740 0 471 0) #label: 'Data Set Builder' #min: #(#Point 10 10) #max: #(#Point 1152 900) - #bounds: #(#Rectangle 425 253 752 389) + #bounds: #(#Rectangle 414 336 741 472) #usePreferredExtent: false ) #component: @@ -575,10 +613,11 @@ ! formatEditSpec - "this window spec was automatically generated by the ST/X UIPainter" + "This resource specification was automatically generated + by the UIPainter of ST/X." - "do not manually edit this - the painter/builder may not be able to - handle the specification if its corrupted." + "Do not manually edit this!! If it is corrupted, + the UIPainter may not be able to read the specification." " UIPainter new openOnClass:DataSetBuilder andSelector:#formatEditSpec @@ -593,11 +632,11 @@ #window: #(#WindowSpec #name: 'DataSet Details' - #layout: #(#LayoutFrame 415 0 266 0 802 0 557 0) + #layout: #(#LayoutFrame 329 0 353 0 716 0 644 0) #label: 'DataSet Details' #min: #(#Point 10 10) #max: #(#Point 1280 1024) - #bounds: #(#Rectangle 415 266 803 558) + #bounds: #(#Rectangle 329 353 717 645) #usePreferredExtent: false ) #component: @@ -668,10 +707,11 @@ ! frameEditSpec - "this window spec was automatically generated by the ST/X UIPainter" + "This resource specification was automatically generated + by the UIPainter of ST/X." - "do not manually edit this - the painter/builder may not be able to - handle the specification if its corrupted." + "Do not manually edit this!! If it is corrupted, + the UIPainter may not be able to read the specification." " UIPainter new openOnClass:DataSetBuilder andSelector:#frameEditSpec @@ -686,11 +726,11 @@ #window: #(#WindowSpec #name: 'DataSet Dimension' - #layout: #(#LayoutFrame 354 0 262 0 644 0 475 0) + #layout: #(#LayoutFrame 512 0 370 0 802 0 583 0) #label: 'DataSet Dimension' #min: #(#Point 10 10) #max: #(#Point 1280 1024) - #bounds: #(#Rectangle 354 262 645 476) + #bounds: #(#Rectangle 512 370 803 584) #usePreferredExtent: false ) #component: @@ -788,10 +828,11 @@ ! selectionEditSpec - "this window spec was automatically generated by the ST/X UIPainter" + "This resource specification was automatically generated + by the UIPainter of ST/X." - "do not manually edit this - the painter/builder may not be able to - handle the specification if its corrupted." + "Do not manually edit this!! If it is corrupted, + the UIPainter may not be able to read the specification." " UIPainter new openOnClass:DataSetBuilder andSelector:#selectionEditSpec @@ -806,11 +847,11 @@ #window: #(#WindowSpec #name: 'DataSet Basic' - #layout: #(#LayoutFrame 411 0 287 0 699 0 542 0) + #layout: #(#LayoutFrame 533 0 372 0 821 0 627 0) #label: 'DataSet Basic' #min: #(#Point 10 10) #max: #(#Point 1280 1024) - #bounds: #(#Rectangle 411 287 700 543) + #bounds: #(#Rectangle 533 372 822 628) #usePreferredExtent: false ) #component: @@ -938,10 +979,11 @@ ! valuesEditSpec - "this window spec was automatically generated by the ST/X UIPainter" + "This resource specification was automatically generated + by the UIPainter of ST/X." - "do not manually edit this - the painter/builder may not be able to - handle the specification if its corrupted." + "Do not manually edit this!! If it is corrupted, + the UIPainter may not be able to read the specification." " UIPainter new openOnClass:DataSetBuilder andSelector:#valuesEditSpec @@ -956,11 +998,11 @@ #window: #(#WindowSpec #name: 'DataSet Basic' - #layout: #(#LayoutFrame 385 0 286 0 680 0 591 0) + #layout: #(#LayoutFrame 501 0 386 0 796 0 691 0) #label: 'DataSet Basic' #min: #(#Point 10 10) #max: #(#Point 1280 1024) - #bounds: #(#Rectangle 385 286 681 592) + #bounds: #(#Rectangle 501 386 797 692) #usePreferredExtent: false ) #component: @@ -1105,11 +1147,11 @@ #window: #(#WindowSpec #name: 'Data Set Builder' - #layout: #(#LayoutFrame 487 0 189 0 1031 0 690 0) + #layout: #(#LayoutFrame 314 0 309 0 853 0 808 0) #label: 'Data Set Builder' #min: #(#Point 10 10) #max: #(#Point 1152 900) - #bounds: #(#Rectangle 487 189 1032 691) + #bounds: #(#Rectangle 314 309 854 809) #menu: #menu #usePreferredExtent: false ) @@ -1117,21 +1159,41 @@ #(#SpecCollection #collection: #( - #(#ViewSpec - #name: 'Box1' - #layout: #(#LayoutFrame 0 0.0 100 0.0 0 1.0 0 1.0) + #(#MenuPanelSpec + #name: 'menuToolbarView' + #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 32 0) + #menu: #menuToolbar + ) + #(#VariableVerticalPanelSpec + #name: 'VariableVerticalPanel1' + #layout: #(#LayoutFrame 0 0.0 38 0.0 0 1.0 -26 1.0) #component: #(#SpecCollection #collection: #( - #(#MenuPanelSpec - #name: 'menuToolbarView' - #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 32 0) - #menu: #menuToolbar + #(#FramedBoxSpec + #name: 'FramedBox' + #component: + #(#SpecCollection + #collection: + #( + #(#DataSetSpec + #name: 'columnView' + #layout: #(#LayoutFrame 15 0.0 16 0.0 15 1.0 16 1.0) + #hasHorizontalScrollBar: true + #hasVerticalScrollBar: false + #miniScrollerHorizontal: true + #rowClassName: 'CodingExamples_GUI::GUIDemoDataSetView::Row' + #useIndex: false + #has3Dsepartors: true + ) + ) + ) + #label: 'Table Columns' + #labelPosition: #topLeft ) #(#VariableHorizontalPanelSpec #name: 'VariablePanel' - #layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0) #component: #(#SpecCollection #collection: @@ -1186,38 +1248,18 @@ ) ) ) - #handles: #(#Any 0.346072 1.0) - ) - #(#UISubSpecification - #name: 'infoBarSubSpec' - #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) - #majorKey: #ToolApplicationModel - #minorKey: #windowSpecForInfoBar + #level: -1 + #handles: #(#Any 0.311111 1.0) ) ) ) + #handles: #(#Any 0.25 1.0) ) - #(#FramedBoxSpec - #name: 'ColumnFrame' - #layout: #(#LayoutFrame 0 0.0 5 0.0 0 1.0 100 0) - #component: - #(#SpecCollection - #collection: - #( - #(#DataSetSpec - #name: 'columnView' - #layout: #(#LayoutFrame 14 0.0 18 0.0 14 1.0 14 1.0) - #hasHorizontalScrollBar: true - #hasVerticalScrollBar: false - #miniScrollerHorizontal: true - #rowClassName: 'CodingExamples_GUI::GUIDemoDataSetView::Row' - #useIndex: false - #has3Dsepartors: true - ) - ) - ) - #label: 'Table Columns' - #labelPosition: #topLeft + #(#UISubSpecification + #name: 'infoBarSubSpec' + #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) + #majorKey: #ToolApplicationModel + #minorKey: #windowSpecForInfoBar ) ) ) @@ -1363,6 +1405,20 @@ ) ) #(#MenuItem + #label: 'Settings' + #submenu: + #(#Menu + + #( + #(#MenuItem + #label: 'Fonts' + #submenuChannel: #menuFont + ) + ) nil + nil + ) + ) + #(#MenuItem #label: 'History' #activeHelpKey: #history #submenuChannel: #menuHistory @@ -1370,36 +1426,7 @@ #(#MenuItem #label: 'Help' #startGroup: #right - #submenu: - #(#Menu - - #( - #(#MenuItem - #label: 'Documentation' - #value: #openHTMLDocument: - #activeHelpKey: #helpTutorial - #argument: 'tools/uipainter/DataSetBuilder.html' - ) - #(#MenuItem - #label: '-' - ) - #(#MenuItem - #label: 'Help Tool' - #value: #openHTMLDocument: - #activeHelpKey: #helpHelpTool - #argument: 'tools/uipainter/HelpTool.html' - ) - #(#MenuItem - #label: '-' - ) - #(#MenuItem - #label: 'Show Help Texts' - #activeHelpKey: #helpShowHelp - #indication: #showHelp: - ) - ) nil - nil - ) + #submenuChannel: #menuHelp ) ) nil nil @@ -1407,10 +1434,11 @@ ! menuEdit - "this window spec was automatically generated by the ST/X MenuEditor" + "This resource specification was automatically generated + by the MenuEditor of ST/X." - "do not manually edit this - the builder may not be able to - handle the specification if its corrupted." + "Do not manually edit this!! If it is corrupted, + the MenuEditor may not be able to read the specification." " MenuEditor new openOnClass:DataSetBuilder andSelector:#menuEdit @@ -1425,41 +1453,47 @@ #( #(#MenuItem - #'label:' 'Cut' - #'value:' #doCutColumn - #'activeHelpKey:' #editCut - #'enabled:' #isColumnSelected + #label: 'Cut' + #value: #doCut + #activeHelpKey: #editCut + #enabled: #isColumnSelected ) #(#MenuItem - #'label:' 'Copy' - #'value:' #doCopyColumn - #'activeHelpKey:' #editCopy - #'enabled:' #isColumnSelected + #label: 'Copy' + #value: #doCopy + #activeHelpKey: #editCopy + #enabled: #isColumnSelected ) #(#MenuItem - #'label:' 'Paste' - #'value:' #doPasteColumn - #'activeHelpKey:' #editPaste - #'enabled:' #valueOfHavingClipboard + #label: 'Paste' + #value: #doPaste + #activeHelpKey: #editPaste + #enabled: #valueOfHavingClipboard ) #(#MenuItem - #'label:' '-' + #label: 'Delete' + #value: #doDelete + #activeHelpKey: #editPaste + #enabled: #valueOfHavingClipboard + ) + #(#MenuItem + #label: '-' ) #(#MenuItem - #'label:' 'Move Up' - #'value:' #'doMoveColumn:' - #'activeHelpKey:' #editMoveUp - #'enabled:' #isColumnSelected - #'argument:' #up - #'labelImage:' #(#ResourceRetriever #DataSetBuilder #upIcon 'Move Up') + #label: 'Move Up' + #value: #doMoveColumn: + #activeHelpKey: #editMoveUp + #enabled: #isColumnSelected + #argument: #up + #labelImage: #(#ResourceRetriever #DataSetBuilder #upIcon 'Move Up') ) #(#MenuItem - #'label:' 'Move Down' - #'value:' #'doMoveColumn:' - #'activeHelpKey:' #editMoveDown - #'enabled:' #isColumnSelected - #'argument:' #down - #'labelImage:' #(#ResourceRetriever #DataSetBuilder #downIcon 'Move Down') + #label: 'Move Down' + #value: #doMoveColumn: + #activeHelpKey: #editMoveDown + #enabled: #isColumnSelected + #argument: #down + #labelImage: #(#ResourceRetriever #DataSetBuilder #downIcon 'Move Down') ) ) nil nil @@ -1467,10 +1501,11 @@ ! menuToolbar - "this window spec was automatically generated by the ST/X MenuEditor" + "This resource specification was automatically generated + by the MenuEditor of ST/X." - "do not manually edit this - the builder may not be able to - handle the specification if its corrupted." + "Do not manually edit this!! If it is corrupted, + the MenuEditor may not be able to read the specification." " MenuEditor new openOnClass:DataSetBuilder andSelector:#menuToolbar @@ -1485,33 +1520,92 @@ #( #(#MenuItem - #'label:' 'Add Column' - #'isButton:' true - #'value:' #doCreateColumn - #'activeHelpKey:' #addColumn - #'enabled:' #columnIsNotEditing - #'labelImage:' #(#ResourceRetriever nil #newColumnIcon) + #label: 'New' + #isButton: true + #value: #doNew + #activeHelpKey: #fileNew + #labelImage: #(#ResourceRetriever nil #newIcon) + ) + #(#MenuItem + #label: 'Load' + #isButton: true + #value: #doLoad + #activeHelpKey: #fileLoad + #labelImage: #(#ResourceRetriever nil #loadIcon) ) #(#MenuItem - #'label:' '' + #label: 'Save' + #isButton: true + #value: #doSave + #activeHelpKey: #fileSave + #labelImage: #(#ResourceRetriever nil #saveIcon) + ) + #(#MenuItem + #label: '' + ) + #(#MenuItem + #label: 'Cut' + #isButton: true + #value: #doCut + #activeHelpKey: #editCut + #enabled: #isColumnSelected + #labelImage: #(#ResourceRetriever nil #cutIcon) + ) + #(#MenuItem + #label: 'Copy' + #isButton: true + #value: #doCopy + #activeHelpKey: #editCopy + #enabled: #isColumnSelected + #labelImage: #(#ResourceRetriever nil #copyIcon) ) #(#MenuItem - #'label:' 'Move Up' - #'isButton:' true - #'value:' #'doMoveColumn:' - #'activeHelpKey:' #editMoveUp - #'enabled:' #isColumnSelected - #'argument:' #up - #'labelImage:' #(#ResourceRetriever nil #upIcon) + #label: 'Paste' + #isButton: true + #value: #doPaste + #activeHelpKey: #editPaste + #enabled: #valueOfCanPaste + #labelImage: #(#ResourceRetriever nil #pasteIcon) + ) + #(#MenuItem + #label: 'Delete' + #isButton: true + #value: #doDelete + #activeHelpKey: #editDelete + #enabled: #isColumnSelected + #labelImage: #(#ResourceRetriever nil #deleteIcon) + ) + #(#MenuItem + #label: '' ) #(#MenuItem - #'label:' 'Move Down' - #'isButton:' true - #'value:' #'doMoveColumn:' - #'activeHelpKey:' #editMoveDown - #'enabled:' #isColumnSelected - #'argument:' #down - #'labelImage:' #(#ResourceRetriever nil #downIcon) + #label: 'Add Column' + #isButton: true + #value: #doCreateColumn + #activeHelpKey: #addColumn + #enabled: #columnIsNotEditing + #labelImage: #(#ResourceRetriever nil #newColumnIcon) + ) + #(#MenuItem + #label: '' + ) + #(#MenuItem + #label: 'Move Up' + #isButton: true + #value: #doMoveColumn: + #activeHelpKey: #editMoveUp + #enabled: #isColumnSelected + #argument: #up + #labelImage: #(#ResourceRetriever nil #upIcon) + ) + #(#MenuItem + #label: 'Move Down' + #isButton: true + #value: #doMoveColumn: + #activeHelpKey: #editMoveDown + #enabled: #isColumnSelected + #argument: #down + #labelImage: #(#ResourceRetriever nil #downIcon) ) ) nil nil @@ -1521,16 +1615,22 @@ !DataSetBuilder class methodsFor:'resources'! newColumnIcon - "Generated by the Image Editor" + "This resource specification was automatically generated + by the ImageEditor of ST/X." + + "Do not manually edit this!! If it is corrupted, + the ImageEditor may not be able to read the specification." + " - ImageEditor openOnClass:self andSelector:#newColumnIcon + self newColumnIcon inspect + ImageEditor openOnClass:self andSelector:#newColumnIcon " ^Icon constantNamed:#'DataSetBuilder newColumnIcon' - ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UT@@@@UPUTUUUXUPUTZ**,UPUTZB",UPUTX*H,UYUTX*H,UPUTZB",UPQTZ**,UPUTX*H,UPUTX*H,UPUTX*H,UPUTXB@,UPUTZ**,UPUTZ**,UPUTX"H,UYUTXB@,UPUTX"@,UPUTX"H,UPUTZ**,UPUTZ**,UPUT/?? 0 ifTrue: [self selectedColumnModel value: ((idx - 1) max: 1)]. + self updateColumnView. + self updateInputFields. + columns isEmpty ifTrue: [self isColumnSelected value: false]. + self cancel. + modified := true. + ] +! + doGenerateCode "generate code for column values" |cls superclass| rowClass isNil ifTrue:[^self information:'No class defined!!']. - cls := self resolveRowClassNamed. + cls := self resolveClassNamed. cls isNil ifTrue: @@ -2429,7 +2535,6 @@ size := list size. size == 1 ifTrue:[^self]. - hasChanged := true. selectedColumnIndex := 0. label := list at:idx. col := columns at:idx. @@ -2453,24 +2558,25 @@ self updateColumnView. ! -doPasteColumn +doPaste "paste clipboard copy column after selected column or at left (nothing selected)" |col lbl| - self checkMenuItemModified ifFalse: [^nil]. + self askForItemModification ifFalse: [^nil]. col := self class clipboard deepCopy. lbl := self labelFromColumn:col. columns add:col afterIndex:selectedColumnIndex. self seqList add:lbl afterIndex:selectedColumnIndex. - hasChanged := true. self valueOfEnablingCommitButtons value ifFalse:[ self selectedColumnModel value:selectedColumnIndex + 1 ]. self updateColumnView. self updateInputFields. + modified := true. + ! doPickColumns