*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Mon, 16 Nov 2009 14:20:20 +0100
changeset 2724 4bd4ad9083fb
parent 2723 d03a850ebc29
child 2725 168192759cae
*** empty log message ***
Tools__ProjectBuilderAssistantApplication.st
--- a/Tools__ProjectBuilderAssistantApplication.st	Sun Nov 15 23:19:23 2009 +0100
+++ b/Tools__ProjectBuilderAssistantApplication.st	Mon Nov 16 14:20:20 2009 +0100
@@ -17,7 +17,9 @@
 		selectedApplicationsComment buildDirectoryHolder makeProcess
 		listOfClassesInProject makeOutputWindow projectBuilder
 		newStartupClassName usedCompilerHolder listOfNewProjectsName
-		newProjectsNameListExtendedComboBox'
+		newProjectsNameListExtendedComboBox productNameHolder
+		companyNameHolder compilerWarnMessageHolder
+		compilerWarnMessageVisibleHolder'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'System-Support-Projects'
@@ -155,12 +157,22 @@
         )
 
         (AssistantPageSpec
+            pageTitle: 'Specify Project Attributes'
+            windowSpecSelector: page6a_specifyProjectAttributes
+            infoText: 'Define additional attributes.'
+            enterCallbackSelector: updateProjectAttributes
+            leaveCallbackSelector: #rememberProjectAttributes
+        )
+
+        (AssistantPageSpec
             pageTitle: 'Specify Build Directory'
-            windowSpecSelector: page6_specifyBuildDirectorySpec
+            windowSpecSelector: page6b_specifyBuildDirectorySpec
             infoText: 'Define where the build-process is to be performed.
                        All generated files are created below that directory.
                        After deployment, the build directory is no longer needed
                        (but you can keep it for a faster compile the next time).'
+
+            enterCallbackSelector: #checkCompilerAvailability
         )
 
         (AssistantPageSpec
@@ -868,7 +880,7 @@
       )
 !
 
-page6_specifyBuildDirectorySpec
+page6a_specifyProjectAttributes
     "This resource specification was automatically generated
      by the UIPainter of ST/X."
 
@@ -876,15 +888,15 @@
      the UIPainter may not be able to read the specification."
 
     "
-     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page6_specifyBuildDirectorySpec
-     Tools::ProjectBuilderAssistantApplication new openInterface:#page6_specifyBuildDirectorySpec
+     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page6a_specifyProjectAttributes
+     Tools::ProjectBuilderAssistantApplication new openInterface:#page6a_specifyProjectAttributes
     "
 
     <resource: #canvas>
 
     ^ 
      #(FullSpec
-        name: #'page6_specifyBuildDirectorySpec'
+        name: #'page6a_specifyProjectAttributes'
         window: 
        (WindowSpec
           label: 'Project Selection'
@@ -896,6 +908,82 @@
        (SpecCollection
           collection: (
            (FramedBoxSpec
+              label: 'Product Information'
+              name: 'FramedBox3'
+              layout: (LayoutFrame 0 0.0 5 0 4 1.0 101 0)
+              labelPosition: topLeft
+              translateLabel: true
+              component: 
+             (SpecCollection
+                collection: (
+                 (LabelSpec
+                    label: 'Product Name:'
+                    name: 'Label1'
+                    layout: (LayoutFrame 0 0 10 0 148 0 32 0)
+                    translateLabel: true
+                    adjust: right
+                  )
+                 (InputFieldSpec
+                    name: 'EntryField4'
+                    layout: (LayoutFrame 150 0.0 10 0 0 1.0 32 0)
+                    model: productNameHolder
+                    acceptOnLostFocus: true
+                    acceptOnPointerLeave: true
+                    viewClassName: ''
+                  )
+                 (LabelSpec
+                    label: 'Company Name:'
+                    name: 'Label2'
+                    layout: (LayoutFrame 0 0 39 0 148 0 61 0)
+                    translateLabel: true
+                    adjust: right
+                  )
+                 (InputFieldSpec
+                    name: 'EntryField3'
+                    layout: (LayoutFrame 150 0.0 39 0 0 1.0 61 0)
+                    model: companyNameHolder
+                    acceptOnLostFocus: true
+                    acceptOnPointerLeave: true
+                    viewClassName: ''
+                  )
+                 )
+               
+              )
+            )
+           )
+         
+        )
+      )
+!
+
+page6b_specifyBuildDirectorySpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:Tools::ProjectBuilderAssistantApplication andSelector:#page6b_specifyBuildDirectorySpec
+     Tools::ProjectBuilderAssistantApplication new openInterface:#page6b_specifyBuildDirectorySpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(FullSpec
+        name: #'page6b_specifyBuildDirectorySpec'
+        window: 
+       (WindowSpec
+          label: 'Project Selection'
+          name: 'Project Selection'
+          min: (Point 0 0)
+          bounds: (Rectangle 0 0 521 361)
+        )
+        component: 
+       (SpecCollection
+          collection: (
+           (FramedBoxSpec
               label: 'Build Directory'
               name: 'FramedBox3'
               layout: (LayoutFrame 0 0.0 5 0 4 1.0 79 0)
@@ -935,6 +1023,17 @@
                
               )
             )
+           (LabelSpec
+              label: 'Compiler Warn-Label'
+              name: 'Label1'
+              layout: (LayoutFrame 2 0.0 158 0 -2 1.0 303 0)
+              level: -1
+              visibilityChannel: compilerWarnMessageVisibleHolder
+              backgroundColor: (Color 100.0 49.999237048905 49.999237048905)
+              translateLabel: true
+              labelChannel: compilerWarnMessageHolder
+              adjust: left
+            )
            )
          
         )
@@ -1106,7 +1205,7 @@
                        (ActionButtonSpec
                           label: 'Open Console'
                           name: 'Button2'
-                          visibilityChannel: false
+                          visibilityChannel: isUnixOS
                           translateLabel: true
                           resizeForLabel: true
                           model: doOpenConsoleTerminal
@@ -1202,7 +1301,8 @@
                             category:'Applications'.
             CodeGeneratorTool createApplicationCodeFor:newAppClass.
         ].
-        self updateListOfApplicationsInProject
+        self updateListOfApplicationsInProject.
+        self selectedApplicationIndexHolder value:(listOfApplicationsInProject value indexOf:newAppClass).
     ].
 !
 
@@ -1290,7 +1390,8 @@
             self projectTypeIsGuiApplication ifTrue: [startupApplication := selectedApplication].
             CodeGeneratorTool createStartupCodeFor:newStartupClass forStartOf:startupApplication.
         ].
-        self updateListOfStartupClassesInProject
+        self updateListOfStartupClassesInProject.
+        self selectedStartupClassIndexHolder value:(listOfStartupClassesInProject value indexOf:newStartupClass).
     ].
 !
 
@@ -1362,9 +1463,13 @@
 "/    OperatingSystem
 "/        executeCommand:'cmd.exe'        
 "/        inDirectory:(projectBuilder packageBuildDirectory)
-    OperatingSystem
-        executeCommand:'c:\windows\System32\cmd.exe'        
-        inDirectory:(projectBuilder packageBuildDirectory)
+    OperatingSystem isUNIXlike ifTrue:[
+        VT100TerminalView openShellIn:(projectBuilder packageBuildDirectory)
+    ] ifFalse:[
+        OperatingSystem
+            executeCommand:'c:\windows\System32\cmd.exe'        
+            inDirectory:(projectBuilder packageBuildDirectory)
+    ]
 !
 
 doOpenExplorer
@@ -1378,6 +1483,7 @@
     self stopMakeButtonVisible value:true.
     self startMakeButtonEnabled value:false.
 
+    self infoHolder value:'Building (make) - please wait...'.
     makeOutputWindow clear.
 
     makeProcess := 
@@ -1389,6 +1495,7 @@
                     self startMakeButtonEnabled value:true.
                     makeProcess := nil.
                     self updateButtonEnableState.
+                    self infoHolder value:''.
                 ].
             ] newProcess.
 
@@ -1403,6 +1510,7 @@
     self stopMakeButtonVisible value:true.
     self startMakeButtonEnabled value:false.
 
+    self infoHolder value:'Building (make) - please wait...'.
     makeOutputWindow clear.
 
     makeProcess := 
@@ -1414,6 +1522,7 @@
                     self startMakeButtonEnabled value:true.
                     makeProcess := nil.
                     self updateButtonEnableState.
+                    self infoHolder value:''.
                 ].
             ] newProcess.
 
@@ -1562,6 +1671,33 @@
     ^ buildDirectoryHolder.
 !
 
+companyNameHolder
+    <resource: #uiAspect>
+
+    companyNameHolder isNil ifTrue:[
+        companyNameHolder := 'MyCompany' asValue.
+    ].
+    ^ companyNameHolder.
+!
+
+compilerWarnMessageHolder
+    <resource: #uiAspect>
+
+    compilerWarnMessageHolder isNil ifTrue:[
+        compilerWarnMessageHolder := '' asValue.
+    ].
+    ^ compilerWarnMessageHolder.
+!
+
+compilerWarnMessageVisibleHolder
+    <resource: #uiAspect>
+
+    compilerWarnMessageVisibleHolder isNil ifTrue:[
+        compilerWarnMessageVisibleHolder := false asValue.
+    ].
+    ^ compilerWarnMessageVisibleHolder.
+!
+
 hasApplicationSelectedHolder
     <resource: #uiAspect>
 
@@ -1667,7 +1803,7 @@
 
 listOfPossibleCompilers
     OperatingSystem isMSWINDOWSlike ifTrue:[
-        ^ #('bcc' 'vc' 'lcc')
+        ^ #('bcc' 'vc' 'lcc' 'gcc' )
     ].
     ^ #('gcc')
 !
@@ -1748,6 +1884,15 @@
     ^ newStartupClassName.
 !
 
+productNameHolder
+    <resource: #uiAspect>
+
+    productNameHolder isNil ifTrue:[
+        productNameHolder := 'MyProduct' asValue.
+    ].
+    ^ productNameHolder.
+!
+
 projectType
     self projectTypeHolder value == #libraryType ifTrue:[
         ^ ProjectDefinition libraryType
@@ -1878,7 +2023,8 @@
 
     usedCompilerHolder isNil ifTrue:[
         usedCompilerHolder := ValueHolder new.
-        usedCompilerHolder value:(OperatingSystem isMSWINDOWSlike ifTrue:['bcc'] ifFalse:['gcc'])
+        usedCompilerHolder value:(OperatingSystem isMSWINDOWSlike ifTrue:['bcc'] ifFalse:['gcc']).
+        usedCompilerHolder onChangeSend:#checkCompilerAvailability to:self.
     ].
     ^ usedCompilerHolder.
 ! !
@@ -1894,7 +2040,11 @@
 
     browser := FileBrowserV2 new.
     browser onDirectory:targetDirectory.
-    browser filter:'*.exe'.
+    OperatingSystem isMSWINDOWSlike ifTrue:[
+        browser filter:'*.exe;*.com'.
+    ] ifFalse:[
+        browser filter:'*'.
+    ].
     ^ browser.
 !
 
@@ -2026,6 +2176,10 @@
     ^ self hasProjectSelected "and:[ self hasApplicationSelected ]"
 !
 
+isUnixOS
+    ^ OperatingSystem isUNIXlike
+!
+
 isWindowsOS
     ^ OperatingSystem isMSWINDOWSlike
 !
@@ -2050,6 +2204,55 @@
 
 !ProjectBuilderAssistantApplication methodsFor:'update'!
 
+checkCompilerAvailability
+    |cmd suite warnMsg1 warnMsg2 sep|
+
+    cmd := 'cc'.
+    suite := 'C-Compiler'.
+    warnMsg1 := warnMsg2 := ''.
+
+    self usedCompilerHolder value = 'bcc' ifTrue:[
+        cmd := 'bcc32'.
+        suite := 'Borland C-Compiler'.
+    ].
+    self usedCompilerHolder value = 'vc' ifTrue:[
+        cmd := 'cl'.
+        suite := 'Microsoft Visual C C-Compiler'.
+        warnMsg2 := 'Due to bugs in this C-compiler, some classes may not be compilable.'.
+    ].
+    self usedCompilerHolder value = 'lcc' ifTrue:[
+        cmd := 'lcc'.
+        suite := 'LCC C-Compiler'.
+        warnMsg2 := 'The LCC C-compiler suite is not yet supported (linkage).'.
+    ].
+    self usedCompilerHolder value = 'gcc' ifTrue:[
+        cmd := 'gcc'.
+        suite := 'GNU C-Compiler'.
+        OperatingSystem isMSWINDOWSlike ifTrue:[
+            warnMsg2 := 'The GNU C-compiler suite is not yet supported on MSDOS systems.'.
+        ].
+    ].
+
+    (OperatingSystem canExecuteCommand:cmd) ifFalse:[
+        warnMsg1 :=
+'The "%1"-command seems to be not in your path.
+Please ensure that you installed the 
+"%2" compiler suite correctly.' bindWith:cmd with:suite.
+    ].
+
+    (warnMsg1 notEmpty or:[warnMsg2 notEmpty]) ifTrue:[
+        sep := ''.
+        (warnMsg2 notEmpty) ifTrue:[ sep := '\\' withCRs ].
+
+        self compilerWarnMessageHolder value:('Warning:
+
+',warnMsg1,sep,warnMsg2).
+        self compilerWarnMessageVisibleHolder value:true.
+    ] ifFalse:[
+        self compilerWarnMessageVisibleHolder value:false
+    ].
+!
+
 enterContentsSpecification
     |toAdd|
 
@@ -2078,6 +2281,20 @@
     makeOutputHolder value:(makeOutputWindow contents)
 !
 
+rememberProjectAttributes
+    self assert:selectedProjectDefinition notNil.
+    Class withoutUpdatingChangesDo:[
+        self productNameHolder value ~= selectedProjectDefinition productName ifTrue:[
+            selectedProjectDefinition class compile:(selectedProjectDefinition 
+                        productName_codeFor:(self productNameHolder value)).
+        ].
+        self companyNameHolder value ~= selectedProjectDefinition companyName ifTrue:[
+            selectedProjectDefinition class compile:(selectedProjectDefinition 
+                        companyName_codeFor:(self companyNameHolder value)).
+        ]
+    ].
+!
+
 restoreMakeOutputsContents
     makeOutputWindow contents:makeOutputHolder value
 !
@@ -2260,6 +2477,12 @@
 
     self listOfStartupClassesInProject value:startupClasses.
     self selectedStartupClassIndexHolder value:startupClassIndex.
+!
+
+updateProjectAttributes
+    self assert:selectedProjectDefinition notNil.
+    self productNameHolder value:(selectedProjectDefinition productName).
+    self companyNameHolder value:(selectedProjectDefinition companyName).
 ! !
 
 !ProjectBuilderAssistantApplication class methodsFor:'documentation'!