[Monodevelop-patches-list] r2664 - in trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding: . Gui

Lluis Sanchez <lluis@ximian.com> lluis at mono-cvs.ximian.com
Mon Jul 18 09:01:09 EDT 2005


Author: lluis
Date: 2005-07-18 09:01:09 -0400 (Mon, 18 Jul 2005)
New Revision: 2664

Modified:
   trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/CSharp.glade
   trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/ChangeLog
   trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/Gui/CodeGenerationPanel.cs
Log:
2005-07-18  Lluis Sanchez Gual  <lluis at novell.com>

	* CSharp.glade:
	* Gui/CodeGenerationPanel.cs: Use a combo entry for the main class
	field. Disable that entry when building a library.



Modified: trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/CSharp.glade
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/CSharp.glade	2005-07-18 11:50:06 UTC (rev 2663)
+++ trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/CSharp.glade	2005-07-18 13:01:09 UTC (rev 2664)
@@ -184,27 +184,6 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkEntry" id="mainClassEntry">
-		      <property name="visible">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="editable">True</property>
-		      <property name="visibility">True</property>
-		      <property name="max_length">0</property>
-		      <property name="text" translatable="yes"></property>
-		      <property name="has_frame">True</property>
-		      <property name="invisible_char" translatable="yes">*</property>
-		      <property name="activates_default">False</property>
-		    </widget>
-		    <packing>
-		      <property name="left_attach">1</property>
-		      <property name="right_attach">2</property>
-		      <property name="top_attach">2</property>
-		      <property name="bottom_attach">3</property>
-		      <property name="y_options"></property>
-		    </packing>
-		  </child>
-
-		  <child>
 		    <widget class="GtkHBox" id="hbox57">
 		      <property name="visible">True</property>
 		      <property name="homogeneous">False</property>
@@ -230,6 +209,20 @@
 		      <property name="y_options">fill</property>
 		    </packing>
 		  </child>
+
+		  <child>
+		    <widget class="GtkComboBoxEntry" id="mainClassEntry">
+		      <property name="visible">True</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">1</property>
+		      <property name="right_attach">2</property>
+		      <property name="top_attach">2</property>
+		      <property name="bottom_attach">3</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options">fill</property>
+		    </packing>
+		  </child>
 		</widget>
 		<packing>
 		  <property name="padding">0</property>

Modified: trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/ChangeLog	2005-07-18 11:50:06 UTC (rev 2663)
+++ trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/ChangeLog	2005-07-18 13:01:09 UTC (rev 2664)
@@ -1,3 +1,9 @@
+2005-07-18  Lluis Sanchez Gual  <lluis at novell.com>
+
+	* CSharp.glade:
+	* Gui/CodeGenerationPanel.cs: Use a combo entry for the main class
+	field. Disable that entry when building a library.
+
 2005-07-14  Ben Motmans  <ben.motmans at gmail.com>
 
 	* templates/GladeSharp2Project.xpt.xml:

Modified: trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/Gui/CodeGenerationPanel.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/Gui/CodeGenerationPanel.cs	2005-07-18 11:50:06 UTC (rev 2663)
+++ trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/Gui/CodeGenerationPanel.cs	2005-07-18 13:01:09 UTC (rev 2664)
@@ -15,6 +15,7 @@
 using MonoDevelop.Core.Services;
 using MonoDevelop.Core.Properties;
 using MonoDevelop.Core.AddIns.Codons;
+using MonoDevelop.Internal.Parser;
 
 using Gtk;
 using MonoDevelop.Gui.Widgets;
@@ -32,7 +33,7 @@
 			// Gtk Controls	
 			//
  			[Glade.Widget] Entry symbolsEntry;
- 			[Glade.Widget] Entry mainClassEntry;
+ 			[Glade.Widget] ComboBoxEntry mainClassEntry;
 			[Glade.Widget] ComboBox compileTargetCombo;
  			[Glade.Widget] CheckButton generateOverflowChecksCheckButton;
 			[Glade.Widget] CheckButton allowUnsafeCodeCheckButton;
@@ -42,12 +43,16 @@
  			[Glade.Widget] CheckButton generateXmlOutputCheckButton;
  			[Glade.Widget] SpinButton warningLevelSpinButton;
 
+			Project project;
 			DotNetProjectConfiguration configuration;
 			CSharpCompilerParameters compilerParameters = null;
+			ListStore classListStore;
+			bool classListFilled;
 
  			public  CodeGenerationPanelWidget(IProperties CustomizationObject) : base ("CSharp.glade", "CodeGenerationPanel")
  			{	
 				configuration = (DotNetProjectConfiguration)((IProperties)CustomizationObject).GetProperty("Config");
+				project = (Project)((IProperties)CustomizationObject).GetProperty("Project");
 				compilerParameters = (CSharpCompilerParameters) configuration.CompilationParameters;
 				
 				ListStore store = new ListStore (typeof (string));
@@ -58,10 +63,17 @@
 				compileTargetCombo.PackStart (cr, true);
 				compileTargetCombo.AddAttribute (cr, "text", 0);
 				compileTargetCombo.Active = (int) configuration.CompileTarget;
+				compileTargetCombo.Changed += new EventHandler (OnTargetChanged);
 
 				symbolsEntry.Text = compilerParameters.DefineSymbols;
-				mainClassEntry.Text = compilerParameters.MainClass;
+				
+				classListStore = new ListStore (typeof(string));
+				mainClassEntry.Model = classListStore;
+				mainClassEntry.TextColumn = 0;
+				((Entry)mainClassEntry.Child).Text = compilerParameters.MainClass;
 
+				UpdateTarget ();
+				
 				generateDebugInformationCheckButton.Active = configuration.DebugMode;
 				generateXmlOutputCheckButton.Active        = compilerParameters.GenerateXmlDocumentation;
 				enableOptimizationCheckButton.Active       = compilerParameters.Optimize;
@@ -70,6 +82,36 @@
 				warningsAsErrorsCheckButton.Active         = ! configuration.RunWithWarnings;
 				warningLevelSpinButton.Value               = compilerParameters.WarningLevel;				
  			}
+			
+			void FillClasses ()
+			{
+				foreach (IClass c in Runtime.ParserService.GetProjectContents (project)) {
+					if (c.Methods != null) {
+						foreach (IMethod m in c.Methods) {
+							if (m.IsStatic && m.Name == "Main")
+								classListStore.AppendValues (c.FullyQualifiedName);
+						}
+					}
+				}
+			}
+			
+			void UpdateTarget ()
+			{
+				if ((CompileTarget) compileTargetCombo.Active == CompileTarget.Library) {
+					mainClassEntry.Sensitive = false;
+				} else {
+					mainClassEntry.Sensitive = true;
+					if (!classListFilled) {
+						FillClasses ();
+						classListFilled = true;
+					}
+				}
+			}
+			
+			void OnTargetChanged (object s, EventArgs a)
+			{
+				UpdateTarget ();
+			}
 
 			public bool Store ()
 			{	
@@ -78,7 +120,7 @@
 				}
 				configuration.CompileTarget =  (CompileTarget) compileTargetCombo.Active;
 				compilerParameters.DefineSymbols =  symbolsEntry.Text;
-				compilerParameters.MainClass     =  mainClassEntry.Text;
+				compilerParameters.MainClass     =  ((Entry)mainClassEntry.Child).Text;
 
 				configuration.DebugMode                = generateDebugInformationCheckButton.Active;
 				compilerParameters.GenerateXmlDocumentation = generateXmlOutputCheckButton.Active;




More information about the Monodevelop-patches-list mailing list