diff -r 270de066caa1 -r ef8750cd1bab Tools__ProjectDefinitionEditor.st --- a/Tools__ProjectDefinitionEditor.st Fri Oct 13 18:25:59 2006 +0200 +++ b/Tools__ProjectDefinitionEditor.st Mon Oct 16 11:11:32 2006 +0200 @@ -10,9 +10,11 @@ fileRevisionNrHolder fileDescriptionHolder releaseNrHolder fileMinorVersionNrHolder descriptionHolder legalCopyrightHolder isApplicationDefinitionHolder isNonGUIApplicationHolder - startSinglethreadedHolder hasConsoleHolder startupClassNameHolder - startupSelectorHolder prerequisitesList classListHolder - extensionsListHolder prerequisitesListHolder' + startSinglethreadedHolder hasConsoleHolder shownHasConsoleHolder + startupClassNameHolder startupSelectorHolder prerequisitesList + classListHolder extensionsListHolder prerequisitesListHolder + documentExtensionsListStringHolder stcOptimizationFlagsHolder + ccOptimizationFlagsHolder' classVariableNames:'' poolDictionaries:'' category:'Interface-Tools' @@ -72,6 +74,52 @@ " ! ! +!ProjectDefinitionEditor class methodsFor:'help specs'! + +flyByHelpSpec + "This resource specification was automatically generated + by the UIHelpTool of ST/X." + + "Do not manually edit this!! If it is corrupted, + the UIHelpTool may not be able to read the specification." + + " + UIHelpTool openOnClass:Tools::ProjectDefinitionEditor + " + + + + ^ super flyByHelpSpec addPairsFrom:#( + +#documentExtensions +'";"-separated list of file extensions' + +) + + "Created: / 15-10-2006 / 14:34:57 / cg" +! + +helpSpec + "This resource specification was automatically generated + by the UIHelpTool of ST/X." + + "Do not manually edit this!! If it is corrupted, + the UIHelpTool may not be able to read the specification." + + " + UIHelpTool openOnClass:Tools::ProjectDefinitionEditor + " + + + + ^ super helpSpec addPairsFrom:#( + +#documentExtensions +'";"-separated list of file extensions' + +) +! ! + !ProjectDefinitionEditor class methodsFor:'interface specs'! classesSpec @@ -133,96 +181,94 @@ - ^ + ^ #(FullSpec - name: compilationSpec - window: + name: compilationSpec + window: (WindowSpec - label: 'NewApplication' - name: 'NewApplication' - min: (Point 0 0) - bounds: (Rectangle 0 0 433 300) - ) - component: + label: 'NewApplication' + name: 'NewApplication' + min: (Point 0 0) + bounds: (Rectangle 0 0 433 300) + ) + component: (SpecCollection - collection: ( - (FramedBoxSpec - label: 'Optimization' - name: 'FramedBox1' - layout: (LayoutFrame 0 0 0 0 0 1 93 0) - labelPosition: topLeft - translateLabel: true - component: - (SpecCollection - collection: ( - (LabelSpec - label: 'STC Optimization Flags:' - name: 'Label1' - layout: (LayoutFrame 0 0.0 7 0 160 0 29 0) - translateLabel: true - adjust: right - ) - (InputFieldSpec - name: 'STCOptimizationFlagsEntryField' - layout: (LayoutFrame 162 0.0 5 0 0 1.0 27 0) - model: stcOptimizationFlagsHolder - acceptOnReturn: true - acceptOnTab: true - acceptOnLostFocus: true - acceptOnPointerLeave: false - ) - (LabelSpec - label: 'CC Optimization Flags:' - name: 'Label2' - layout: (LayoutFrame 0 0.0 35 0 160 0 57 0) - translateLabel: true - adjust: right - ) - (InputFieldSpec - name: 'CCOptimizationFlagsEntryField' - layout: (LayoutFrame 162 0.0 33 0 0 1.0 55 0) - model: ccOptimizationFlagsHolder - acceptOnReturn: true - acceptOnTab: true - acceptOnLostFocus: true - acceptOnPointerLeave: false - ) - ) - - ) - ) - (FramedBoxSpec - label: 'Includes' - name: 'FramedBox2' - layout: (LayoutFrame 0 0 98 0 0 1 160 0) - labelPosition: topLeft - translateLabel: true - component: - (SpecCollection - collection: ( - (LabelSpec - label: 'Additional Includes:' - name: 'Label3' - layout: (LayoutFrame 0 0.0 7 0 160 0 29 0) - translateLabel: true - adjust: right - ) - (InputFieldSpec - name: 'IncludeFlagsEntryField' - layout: (LayoutFrame 162 0.0 5 0 0 1.0 27 0) - model: includeFlagsHolder - acceptOnReturn: true - acceptOnTab: true - acceptOnLostFocus: true - acceptOnPointerLeave: false - ) - ) - - ) - ) - ) - - ) + collection: ( + (FramedBoxSpec + label: 'Optimization' + name: 'FramedBox1' + layout: (LayoutFrame 0 0 0 0 0 1 93 0) + labelPosition: topLeft + translateLabel: true + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'STC Optimization Flags:' + name: 'Label1' + layout: (LayoutFrame 0 0.0 7 0 160 0 29 0) + translateLabel: true + adjust: right + ) + (ComboBoxSpec + name: 'STCOptimizationFlagsComboBox' + layout: (LayoutFrame 162 0.0 5 0 0 1.0 27 0) + model: stcOptimizationFlagsHolder + acceptOnPointerLeave: false + comboList: stcOptimizationFlagList + postBuildCallback: flagHolderBuilt: + ) + (LabelSpec + label: 'CC Optimization Flags:' + name: 'Label2' + layout: (LayoutFrame 0 0.0 35 0 160 0 57 0) + translateLabel: true + adjust: right + ) + (ComboBoxSpec + name: 'CCOptimizationFlagsComboBox' + layout: (LayoutFrame 162 0.0 33 0 0 1.0 55 0) + model: ccOptimizationFlagsHolder + acceptOnPointerLeave: false + comboList: ccOptimizationFlagList + postBuildCallback: flagHolderBuilt: + ) + ) + + ) + ) + (FramedBoxSpec + label: 'Includes' + name: 'FramedBox2' + layout: (LayoutFrame 0 0 98 0 0 1 160 0) + labelPosition: topLeft + translateLabel: true + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Additional Includes:' + name: 'Label3' + layout: (LayoutFrame 0 0.0 7 0 160 0 29 0) + translateLabel: true + adjust: right + ) + (InputFieldSpec + name: 'IncludeFlagsEntryField' + layout: (LayoutFrame 162 0.0 5 0 0 1.0 27 0) + model: includeFlagsHolder + acceptOnReturn: true + acceptOnTab: true + acceptOnLostFocus: true + acceptOnPointerLeave: false + ) + ) + + ) + ) + ) + + ) ) ! @@ -569,7 +615,7 @@ collection: ( (FramedBoxSpec label: 'Startup' - name: 'FramedBox1' + name: 'StartupFrame' layout: (LayoutFrame 0 0 0 0 0 1 93 0) labelPosition: topLeft translateLabel: true @@ -614,8 +660,8 @@ ) (FramedBoxSpec label: 'Execution' - name: 'FramedBox2' - layout: (LayoutFrame 0 0 97 0 0 1 186 0) + name: 'ExecutionFrame' + layout: (LayoutFrame 0 0 94 0 0 1 176 0) labelPosition: topLeft translateLabel: true component: @@ -641,17 +687,51 @@ name: 'HasConsoleCheckBox1' layout: (LayoutFrame 0 0.5 34 0 0 1 56 0) enableChannel: isGUIApplicationHolder - model: hasConsoleHolder + model: shownHasConsoleHolder translateLabel: true ) ) ) ) + (FramedBoxSpec + label: 'File Extensions' + name: 'FileExtensionsFrame' + layout: (LayoutFrame 0 0 177 0 0 1 237 0) + labelPosition: topLeft + translateLabel: true + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Document Extensions:' + name: 'Label3' + layout: (LayoutFrame 0 0.0 7 0 160 0 29 0) + activeHelpKey: documentExtensions + translateLabel: true + adjust: right + ) + (InputFieldSpec + activeHelpKey: documentExtensions + name: 'EntryField1' + layout: (LayoutFrame 162 0.0 5 0 0 1.0 27 0) + model: documentExtensionsListStringHolder + type: string + acceptOnReturn: true + acceptOnTab: true + acceptOnLostFocus: true + acceptOnPointerLeave: false + ) + ) + + ) + ) ) ) ) + + "Modified: / 15-10-2006 / 14:35:12 / cg" ! windowSpec @@ -905,121 +985,128 @@ ^ #(Menu - ( - (MenuItem - label: 'File' - translateLabel: true - submenu: - (Menu - ( - (MenuItem - label: 'New' - itemValue: menuNew - translateLabel: true - ) - (MenuItem - label: '-' - ) - (MenuItem - label: 'Open...' - itemValue: menuOpen - translateLabel: true - ) - (MenuItem - label: '-' - ) - (MenuItem - enabled: hasDefinitionClassHolder - label: 'Save' - itemValue: menuSave - translateLabel: true - ) - (MenuItem - enabled: hasDefinitionClassHolder - label: 'Save As...' - itemValue: menuSaveAs - translateLabel: true - ) - (MenuItem - label: '-' - ) - (MenuItem - label: 'Exit' - itemValue: closeRequest - translateLabel: true - ) - ) - nil - nil - ) - ) - (MenuItem - label: 'Definition' - translateLabel: true - submenu: - (Menu - ( - (MenuItem - enabled: hasDefinitionClassHolder - label: 'Generate Definitions' - itemValue: menuGenerateProjectDefinitions - translateLabel: true - ) - ) - nil - nil - ) - ) - (MenuItem - label: 'Classes' - translateLabel: true - isVisible: classesMenuVisibleHolder - submenuChannel: classListMenu - keepLinkedMenu: true - ) - (MenuItem - label: 'Extensions' - translateLabel: true - isVisible: extensionsMenuVisibleHolder - submenuChannel: extensionsListMenu - keepLinkedMenu: true - ) - (MenuItem - label: 'Prerequisites' - translateLabel: true - isVisible: prerequisitesMenuVisibleHolder - submenuChannel: prerequisitesListMenu - keepLinkedMenu: true - ) - (MenuItem - label: 'Help' - translateLabel: true - startGroup: right - submenu: - (Menu - ( - (MenuItem - label: 'Documentation' - itemValue: openDocumentation - translateLabel: true - ) - (MenuItem - label: '-' - ) - (MenuItem - label: 'About this Application...' - itemValue: openAboutThisApplication - translateLabel: true - ) - ) - nil - nil - ) - ) - ) - nil - nil + ( + (MenuItem + label: 'File' + translateLabel: true + submenu: + (Menu + ( + (MenuItem + label: 'New Library' + itemValue: menuNewLibraryDefinition + translateLabel: true + ) + (MenuItem + label: 'New Application' + itemValue: menuNewApplicationDefinition + translateLabel: true + ) + (MenuItem + label: '-' + ) + (MenuItem + label: 'Open...' + itemValue: menuOpen + translateLabel: true + ) + (MenuItem + label: '-' + ) + (MenuItem + enabled: hasDefinitionClassHolder + label: 'Save' + itemValue: menuSave + translateLabel: true + ) + (MenuItem + enabled: hasDefinitionClassHolder + label: 'Save As...' + itemValue: menuSaveAs + translateLabel: true + ) + (MenuItem + label: '-' + ) + (MenuItem + label: 'Exit' + itemValue: closeRequest + translateLabel: true + ) + ) + nil + nil + ) + ) + (MenuItem + label: 'Definition' + translateLabel: true + submenu: + (Menu + ( + (MenuItem + enabled: hasDefinitionClassHolder + label: 'Generate Definitions' + itemValue: menuGenerateProjectDefinitions + translateLabel: true + ) + ) + nil + nil + ) + ) + (MenuItem + label: 'Classes' + translateLabel: true + isVisible: classesMenuVisibleHolder + submenuChannel: classListMenu + keepLinkedMenu: true + ) + (MenuItem + label: 'Extensions' + translateLabel: true + isVisible: extensionsMenuVisibleHolder + submenuChannel: extensionsListMenu + keepLinkedMenu: true + ) + (MenuItem + label: 'Prerequisites' + translateLabel: true + isVisible: prerequisitesMenuVisibleHolder + submenuChannel: prerequisitesListMenu + keepLinkedMenu: true + ) + (MenuItem + label: 'Help' + translateLabel: true + startGroup: right + submenu: + (Menu + ( + (MenuItem + label: 'Documentation' + itemValue: openDocumentation + translateLabel: true + ) + (MenuItem + label: '-' + ) + (MenuItem + label: 'About this Application...' + itemValue: openAboutThisApplication + translateLabel: true + ) + ) + nil + nil + ) + ) + ) + nil + nil ) + + "Modified: / 15-10-2006 / 14:52:43 / cg" ! prerequisitesListMenu @@ -1195,6 +1282,24 @@ !ProjectDefinitionEditor methodsFor:'aspects'! +ccOptimizationFlagList + ^ #( + '-O' + '-g' + ) + + "Created: / 15-10-2006 / 15:14:39 / cg" +! + +ccOptimizationFlagsHolder + ccOptimizationFlagsHolder isNil ifTrue:[ + ccOptimizationFlagsHolder := ValueHolder new. + ]. + ^ ccOptimizationFlagsHolder + + "Created: / 15-10-2006 / 15:13:14 / cg" +! + classListHolder classListHolder isNil ifTrue:[ classListHolder := #() asValue. @@ -1231,6 +1336,15 @@ "Modified: / 04-09-2006 / 17:58:15 / cg" ! +documentExtensionsListStringHolder + documentExtensionsListStringHolder isNil ifTrue:[ + documentExtensionsListStringHolder := '' asValue. + ]. + ^ documentExtensionsListStringHolder. + + "Created: / 15-10-2006 / 14:32:29 / cg" +! + extensionsListHolder extensionsListHolder isNil ifTrue:[ extensionsListHolder := #() asValue. @@ -1369,11 +1483,13 @@ isNonGUIApplicationHolder isNonGUIApplicationHolder isNil ifTrue:[ - isNonGUIApplicationHolder := false asValue. + isNonGUIApplicationHolder := false asValue. + isNonGUIApplicationHolder addDependent:self. ]. ^ isNonGUIApplicationHolder. "Created: / 05-09-2006 / 13:34:31 / cg" + "Modified: / 15-10-2006 / 14:00:03 / cg" ! legalCopyrightHolder @@ -1504,6 +1620,25 @@ ^ selectedClassIndexHolder. ! +shownHasConsoleHolder + shownHasConsoleHolder isNil ifTrue:[ + shownHasConsoleHolder := IndirectValue for:self hasConsoleHolder. + ]. + ^ shownHasConsoleHolder + + "Created: / 15-10-2006 / 13:59:01 / cg" +! + +shownHasConsoleValue + ^ BlockValue + with:[:m1 :m2 | self isGUIApplicationHolder value not + or:[ self hasConsoleHolder value] ] + argument:(self hasConsoleHolder) + argument:(self isGUIApplicationHolder). + + "Created: / 15-10-2006 / 13:54:16 / cg" +! + startSinglethreadedHolder startSinglethreadedHolder isNil ifTrue:[ startSinglethreadedHolder := false asValue. @@ -1531,6 +1666,29 @@ "Created: / 05-09-2006 / 13:34:20 / cg" ! +stcOptimizationFlagList + ^ #( + '+optSpace' + '+optSpace2' + '+optSpace3' + '+optInline' + '-optInline' + '-inlineNew' + '-inlineNot' + ) + + "Created: / 15-10-2006 / 15:14:29 / cg" +! + +stcOptimizationFlagsHolder + stcOptimizationFlagsHolder isNil ifTrue:[ + stcOptimizationFlagsHolder := ValueHolder new. + ]. + ^ stcOptimizationFlagsHolder + + "Modified: / 15-10-2006 / 15:13:10 / cg" +! + tabList "Generated by the TabListEditor" @@ -1671,6 +1829,7 @@ self iconFileNameHolder value:(definitionClass iconFileName). self tabList value:(self class tabListForApplication). + self documentExtensionsListStringHolder value:(definitionClass documentExtensions asStringWith:';'). ] ifFalse:[ self tabList value:(self class tabListForLibrary). ]. @@ -1703,7 +1862,7 @@ ]. "Created: / 04-09-2006 / 16:34:39 / cg" - "Modified: / 04-10-2006 / 21:19:19 / cg" + "Modified: / 15-10-2006 / 14:32:45 / cg" ! refetchDefinitionValues @@ -1715,12 +1874,23 @@ update:something with:parameter from:changedObject changedObject == self selectedTabIndexHolder ifTrue:[ - self updateMenuVisibility. - ^ self. + self updateMenuVisibility. + ^ self. + ]. + changedObject == self isNonGUIApplicationHolder ifTrue:[ + changedObject value ifTrue:[ + "/ a NON-GUI application - always has a console + self shownHasConsoleHolder valueHolder:true + ] ifFalse:[ + "/ a GUI application - sometimes has a console + self shownHasConsoleHolder valueHolder:(self hasConsoleHolder) + ]. + ^ self. ]. ^ super update:something with:parameter from:changedObject "Created: / 03-09-2006 / 10:59:42 / cg" + "Modified: / 15-10-2006 / 14:08:23 / cg" ! updateMenuVisibility @@ -1746,6 +1916,14 @@ "Modified: / 03-09-2006 / 10:53:14 / cg" ! +flagHolderBuilt:aComboBox + aComboBox menuSelectAction:[:txt | + self updateFlagsIn:aComboBox from:txt + ]. + + "Created: / 15-10-2006 / 15:11:50 / cg" +! + postBuildWith:aBuilder super postBuildWith:aBuilder. self selectedTabIndexHolder value:1. @@ -1768,6 +1946,42 @@ !ProjectDefinitionEditor methodsFor:'menu actions'! +editNew:definitionClass + |className class newPackage| + + self hasUnsavedChanges ifTrue:[ + self halt. + ]. + className := Dialog + requestClassName:'Name of new Definition class' + okLabel:'Create' + initialAnswer:'private_myProject'. + className isEmptyOrNil ifTrue:[^ self]. + + class := Smalltalk classNamed:className. + class notNil ifTrue:[ + (class isLibraryDefinition == (definitionClass == LibraryDefinition)) ifFalse:[ + Dialog warn:(resources + string:'A class named "%1" already exists as %2.' + with:className allBold + with:(class isLibraryDefinition + ifTrue:'Library' + ifFalse:'Application')). + ^ self + ]. + Dialog warn:(resources + string:'A class named "%1" already exists. Editing the existing definition.' + with:className allBold). + ] ifFalse:[ + newPackage := className copy replaceAll:$_ with:$/. + newPackage replaceAll:$/ with:$:. + class := definitionClass newNamed:className package:newPackage. + ]. + self definitionClass:class. + + "Created: / 15-10-2006 / 14:50:15 / cg" +! + menuGenerateProjectDefinitions |action| @@ -1805,6 +2019,18 @@ self warn:'no action for ''new'' available.'. ! +menuNewApplicationDefinition + self editNew:ApplicationDefinition + + "Created: / 15-10-2006 / 14:49:53 / cg" +! + +menuNewLibraryDefinition + self editNew:LibraryDefinition + + "Created: / 15-10-2006 / 14:49:46 / cg" +! + menuOpen |projectID class answer| @@ -1850,23 +2076,23 @@ |className class newPackage| className := Dialog - requestClassName:'Name of new Definition class' - okLabel:'Create' - initialAnswer:'privete_myProject'. + requestClassName:'Name of new Definition class' + okLabel:'Create' + initialAnswer:'private_myProject'. className isEmptyOrNil ifTrue:[^ self]. class := Smalltalk classNamed:className. class notNil ifTrue:[ - Dialog warn:(resources - string:'A class named %1 already exists' - with:className). - ^ self. + Dialog warn:(resources + string:'A class named %1 already exists' + with:className). + ^ self. ]. newPackage := className copy replaceAll:$_ with:$/. - newPackage replace:$/ with:$:. + newPackage replaceAll:$/ with:$:. class := ApplicationDefinition newNamed:className package:newPackage. self menuSaveAs:class. - "Modified: / 05-09-2006 / 16:20:16 / cg" + "Modified: / 15-10-2006 / 14:47:53 / cg" ! menuSaveAs:aClassName @@ -1895,6 +2121,24 @@ "/ add application-specific help files under the 'doc/online//help/appName' "/ directory, and open a viewer with: "/ HTMLDocumentView openFullOnDocumentationFile:'help//TOP.html'. +! + +updateFlagsIn:aComboBox from:flag + |s flags base negation| + + s := aComboBox editor contents. + flags := s asCollectionOfWords. + (flags includes:flag) ifFalse:[ + base := (flag copyFrom:2). + negation := (flag startsWith:'+') + ifTrue:[ ('-',base) ] + ifFalse:[ ('+',base) ]. + flags remove:negation ifAbsent:[]. + flags add:flag. + aComboBox editor contents:(flags asStringWith:' '). + ]. + + "Created: / 15-10-2006 / 15:35:53 / cg" ! ! !ProjectDefinitionEditor methodsFor:'queries'!