Diff of /cmajor++/CmDevEnv/DevEnv/MainForm.cs [r367] .. [r368]  Maximize  Restore

  Switch to side-by-side view

--- a/cmajor++/CmDevEnv/DevEnv/MainForm.cs
+++ b/cmajor++/CmDevEnv/DevEnv/MainForm.cs
@@ -40,6 +40,8 @@
             solutionExplorerTreeView.Sorted = true;
             compiler = new Compiler();
             compiler.CmcPath = Configuration.Instance.CmcPath;
+            compiler.CmcaPath = Configuration.Instance.CmcaPath;
+            compilerToUse = UseCompiler.cmc;
             compiler.SetWriteMethod(this, WriteOutputLine);
             compiler.SetHandleCompileResultMethod(this, HandleCompileResult);
             if (args.Length > 1)
@@ -162,6 +164,10 @@
             buildActiveProjectToolStripMenuItem.Enabled = activeProjectSet;
             rebuildActiveProjectToolStripMenuItem.Enabled = activeProjectSet;
             buildSolutionToolStripMenuItem.Enabled = solutionHasProjects;
+            cleanSolutionToolStripMenuItem.Enabled = solutionHasProjects;
+            cleanSolutionToolStripMenuItem2.Enabled = solutionHasProjects;
+            cleanActiveProjectToolStripMenuItem.Enabled = activeProjectSet;
+            cleanProjectToolStripMenuItem.Enabled = solutionHasProjects;
             setAsActiveProjectToolStripMenuItem.Enabled = solutionHasProjects;
             projectDependenciesToolStripMenuItem.Enabled = solutionHasProjects;
             projectBuildOrderToolStripMenuItem.Enabled = solutionHasProjects;
@@ -170,6 +176,19 @@
             gotoLineToolStripMenuItem.Enabled = editorOpen;
             formatContentToolStripMenuItem.Enabled = editorOpen;
             findToolStripMenuItem.Enabled = activeProjectSet && solution.ActiveProject.SourceFiles.Count > 0;
+            compileCurrentFileToolStripMenuItem.Enabled = false;
+            if (editorOpen)
+            {
+                TabPage selectedTab = editorTabControl.SelectedTab;
+                if (selectedTab != null)
+                {
+                    Editor editor = (Editor)selectedTab.Tag;
+                    if (editor.SourceFile.GetKind() == SourceFile.Kind.cm)
+                    {
+                        compileCurrentFileToolStripMenuItem.Enabled = true;
+                    }
+                }
+            }
         }
         private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
         {
@@ -538,7 +557,7 @@
                     string config = configComboBox.Text;
                     compileStartTime = DateTime.Now;
                     compileTimer.Start();
-                    compiler.DoCompile(solution.FilePath, !checkUpToDate, config, null, verbose, nocttc, debugCompilingClasses, debugCompilingFunctions, debugTi, debugArch, debugNothrow);
+                    compiler.DoCompile(compilerToUse, solution.FilePath, !checkUpToDate, config, null, quiet, verbose, stats, nocttc, debugCompilingClasses, debugCompilingFunctions, debugTi, debugArch);
                     infoLabel.Text = "Building";
                 }
             }
@@ -575,7 +594,7 @@
                 string config = configComboBox.Text;
                 compileStartTime = DateTime.Now;
                 compileTimer.Start();
-                compiler.DoCompile(project.FilePath, !checkUpToDate, config, null, verbose, nocttc, debugCompilingClasses, debugCompilingFunctions, debugTi, debugArch, debugNothrow);
+                compiler.DoCompile(compilerToUse, project.FilePath, !checkUpToDate, config, null, quiet, verbose, stats, nocttc, debugCompilingClasses, debugCompilingFunctions, debugTi, debugArch);
                 infoLabel.Text = "Building";
             }
             catch (Exception ex)
@@ -583,11 +602,58 @@
                 MessageBox.Show(ex.Message);
             }
         }
-        private void compileToolStripMenuItem_Click(object sender, EventArgs e)
+        private void cleanSolutionToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            CleanProjectOrSolution(solution.FilePath);
+        }
+        private void cleanSolutionToolStripMenuItem2_Click(object sender, EventArgs e)
+        {
+            CleanProjectOrSolution(solution.FilePath);
+        }
+        private void cleanActiveProjectToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            CleanProjectOrSolution(solution.ActiveProject.FilePath);
+        }
+        private void cleanProjectToolStripMenuItem_Click(object sender, EventArgs e)
         {
             TreeNode selectedNode = solutionExplorerTreeView.SelectedNode;
             if (selectedNode != null)
             {
+                Project selectedProject = selectedNode.Tag as Project;
+                if (selectedProject != null)
+                {
+                    CleanProjectOrSolution(selectedProject.FilePath);
+                }
+            }
+        }
+        private bool cleaning = false;
+        private void CleanProjectOrSolution(string solutionOrProjectFilePath)
+        {
+            try
+            {
+                string config = configComboBox.Text;
+                SaveAll();
+                progressTimer.Start();
+                outputRichTextBox.Clear();
+                errorListView.Items.Clear();
+                buildSolutionToolStripMenuItem.Enabled = false;
+                buildToolStripMenuItem1.Enabled = false;
+                buildActiveProjectToolStripMenuItem.Enabled = false;
+                outputTabControl.SelectedTab = outputTabPage;
+                cleaning = true;
+                compiler.DoClean(compilerToUse, solutionOrProjectFilePath, config);
+                infoLabel.Text = "Cleaning";
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.Message);
+            }
+        }
+        private void compileToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            TreeNode selectedNode = solutionExplorerTreeView.SelectedNode;
+            if (selectedNode != null)
+            {
                 SourceFile sourceFile = selectedNode.Tag as SourceFile;
                 if (sourceFile != null)
                 {
@@ -599,6 +665,22 @@
                         {
                             CompileSourceFile(project, sourceFile);
                         }
+                    }
+                }
+            }
+        }
+        private void compileCurrentFileToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            TabPage selectedTab = editorTabControl.SelectedTab;
+            if (selectedTab != null)
+            {
+                Editor editor = (Editor)selectedTab.Tag;
+                if (editor != null)
+                {
+                    SourceFile sourceFile = editor.SourceFile;
+                    if (sourceFile.GetKind() == SourceFile.Kind.cm)
+                    {
+                        CompileSourceFile(sourceFile.Project, sourceFile);
                     }
                 }
             }
@@ -620,7 +702,7 @@
                 compiling = true;
                 compileStartTime = DateTime.Now;
                 compileTimer.Start();
-                compiler.DoCompile(project.FilePath, false, config, sourceFile.FilePath, verbose, nocttc, debugCompilingClasses, debugCompilingFunctions, debugTi, debugArch, debugNothrow);
+                compiler.DoCompile(compilerToUse, project.FilePath, false, config, sourceFile.FilePath, quiet, verbose, stats, nocttc, debugCompilingClasses, debugCompilingFunctions, debugTi, debugArch);
                 infoLabel.Text = "Compiling";
             }
             catch (Exception ex)
@@ -641,6 +723,11 @@
                     compiling = false;
                     infoLabel.Text = "Compile failed";
                 }
+                else if (cleaning)
+                {
+                    cleaning = false;
+                    infoLabel.Text = "Clean failed";
+                }
                 else
                 {
                     infoLabel.Text = "Build failed";
@@ -663,6 +750,11 @@
                 {
                     compiling = false;
                     infoLabel.Text = "Compile succeeded";
+                }
+                else if (cleaning)
+                {
+                    cleaning = false;
+                    infoLabel.Text = "Clean succeeded";
                 }
                 else
                 {
@@ -1498,22 +1590,26 @@
             try
             {
                 BuildOptionsDialog dialog = new BuildOptionsDialog();
+                dialog.Compiler = compilerToUse;
+                dialog.Quiet = quiet;
                 dialog.Verbose = verbose;
+                dialog.Stats = stats;
                 dialog.Nocttc = nocttc;
                 dialog.DebugCompilingClasses = debugCompilingClasses;
                 dialog.DebugCompilingFunctions = debugCompilingFunctions;
                 dialog.DebugTi = debugTi;
                 dialog.DebugArch = debugArch;
-                dialog.DebugNothrow = debugNothrow;
                 if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
+                    compilerToUse = dialog.Compiler;
+                    quiet = dialog.Quiet;
                     verbose = dialog.Verbose;
+                    stats = dialog.Stats;
                     nocttc = dialog.Nocttc;
                     debugCompilingClasses = dialog.DebugCompilingClasses;
                     debugCompilingFunctions = dialog.DebugCompilingFunctions;
                     debugTi = dialog.DebugTi;
                     debugArch = dialog.DebugArch;
-                    debugNothrow = dialog.DebugNothrow;
                 }
             }
             catch (Exception ex)
@@ -1531,13 +1627,15 @@
         private bool matchCase;
         private bool matchWholeWord;
         private bool useRegularExpression;
+        private UseCompiler compilerToUse;
+        private bool quiet;
         private bool verbose;
+        private bool stats;
         private bool nocttc;
         private bool debugCompilingClasses;
         private bool debugCompilingFunctions;
         private bool debugTi;
         private bool debugArch;
-        private bool debugNothrow;
     }
 
     public static class KeyboardUtil

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks