[Monodevelop-patches-list] r518 - trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/IDEOptions

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sat Jan 17 13:27:49 EST 2004


Author: tberman
Date: 2004-01-17 13:27:49 -0500 (Sat, 17 Jan 2004)
New Revision: 518

Modified:
   trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/IDEOptions/CodeGenerationPanel.cs
Log:
option panel from jba


Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/IDEOptions/CodeGenerationPanel.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/IDEOptions/CodeGenerationPanel.cs	2004-01-17 06:28:20 UTC (rev 517)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/IDEOptions/CodeGenerationPanel.cs	2004-01-17 18:27:49 UTC (rev 518)
@@ -1,56 +1,104 @@
-// <file>
-//     <copyright see="prj:///doc/copyright.txt"/>
-//     <license see="prj:///doc/license.txt"/>
-//     <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-//     <version value="$version"/>
-// </file>
-
-using System;
-using System.IO;
-using System.Drawing;
-using System.Collections;
-using System.Windows.Forms;
-
-using ICSharpCode.SharpDevelop.Internal.ExternalTool;
-using ICSharpCode.Core.AddIns.Codons;
-using ICSharpCode.Core.Properties;
-using ICSharpCode.SharpDevelop.Gui.Components;
-using ICSharpCode.Core.Services;
-using ICSharpCode.Core.AddIns;
-
-namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels
-{/*
-	public class CodeGenerationPanel : AbstractOptionPanel
-	{
-		static readonly string codeGenerationProperty = "SharpDevelop.UI.CodeGenerationOptions";
-		
-		public override void LoadPanelContents()
-		{
-			SetupFromXml(Path.Combine(PropertyService.DataDirectory, 
-			                          @"resources\panels\CodeGenerationOptionsPanel.xfrm"));
-			
-			IProperties p = (IProperties)PropertyService.GetProperty(codeGenerationProperty, new DefaultProperties());
-			
-			((CheckBox)ControlDictionary["generateAdditonalCommentsCheckBox"]).Checked = p.GetProperty("GenerateAdditionalComments", true);
-			((CheckBox)ControlDictionary["generateDocCommentsCheckBox"]).Checked       = p.GetProperty("GenerateDocumentComments", true);
-			((CheckBox)ControlDictionary["useFullTypeNamesCheckBox"]).Checked          = p.GetProperty("UseFullyQualifiedNames", true);
-			
-			((CheckBox)ControlDictionary["blankLinesBetweenMemberCheckBox"]).Checked   = p.GetProperty("BlankLinesBetweenMembers", true);
-			((CheckBox)ControlDictionary["elseOnClosingCheckbox"]).Checked             = p.GetProperty("ElseOnClosing", true);
-			((CheckBox)ControlDictionary["startBlockOnTheSameLineCheckBox"]).Checked   = p.GetProperty("StartBlockOnSameLine", true);
-		}
-		
-		public override bool StorePanelContents()
-		{
-			IProperties p = (IProperties)PropertyService.GetProperty(codeGenerationProperty, new DefaultProperties());
-			p.SetProperty("GenerateAdditionalComments", ((CheckBox)ControlDictionary["generateAdditonalCommentsCheckBox"]).Checked);
-			p.SetProperty("GenerateDocumentComments",   ((CheckBox)ControlDictionary["generateDocCommentsCheckBox"]).Checked);
-			p.SetProperty("UseFullyQualifiedNames",     ((CheckBox)ControlDictionary["useFullTypeNamesCheckBox"]).Checked);
-			p.SetProperty("BlankLinesBetweenMembers",   ((CheckBox)ControlDictionary["blankLinesBetweenMemberCheckBox"]).Checked);
-			p.SetProperty("ElseOnClosing",              ((CheckBox)ControlDictionary["elseOnClosingCheckbox"]).Checked);
-			p.SetProperty("StartBlockOnSameLine",       ((CheckBox)ControlDictionary["startBlockOnTheSameLineCheckBox"]).Checked);
-			PropertyService.SetProperty(codeGenerationProperty, p);
-			return true;
-		}
-	}*/
-}
+// <file>
+//     <copyright see="prj:///doc/copyright.txt"/>
+//     <license see="prj:///doc/license.txt"/>
+//     <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+//     <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+using System.Drawing;
+using System.Collections;
+
+using ICSharpCode.SharpDevelop.Internal.ExternalTool;
+using ICSharpCode.Core.AddIns.Codons;
+using ICSharpCode.Core.Properties;
+using ICSharpCode.SharpDevelop.Gui.Components;
+using ICSharpCode.Core.Services;
+using ICSharpCode.Core.AddIns;
+
+using Gtk;
+
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels
+{
+	public class CodeGenerationPanel : AbstractOptionPanel
+	{
+		// Gtk Controls
+		CheckButton generateAdditonalCommentsCheckBox;
+		CheckButton generateDocCommentsCheckBox;
+		CheckButton useFullTypeNamesCheckBox; 
+		CheckButton blankLinesBetweenMemberCheckBox;
+		CheckButton elseOnClosingCheckBox;
+		CheckButton startBlockOnTheSameLineCheckBox; 
+		
+		// Services
+		StringParserService StringParserService = (StringParserService)ServiceManager.Services.GetService (typeof (StringParserService));
+		PropertyService PropertyService = (PropertyService)ServiceManager.Services.GetService (typeof (PropertyService));
+		static readonly string codeGenerationProperty = "SharpDevelop.UI.CodeGenerationOptions";
+		
+		public override void LoadPanelContents()
+		{
+			// set up the form controls instance
+			SetupPanelInstance();
+			
+			IProperties p = (IProperties)PropertyService.GetProperty(codeGenerationProperty, new DefaultProperties());
+			
+			generateAdditonalCommentsCheckBox.Active = p.GetProperty("GenerateAdditionalComments", true);
+			generateDocCommentsCheckBox.Active       = p.GetProperty("GenerateDocumentComments", true);
+			useFullTypeNamesCheckBox.Active          = p.GetProperty("UseFullyQualifiedNames", true);
+			
+			blankLinesBetweenMemberCheckBox.Active   = p.GetProperty("BlankLinesBetweenMembers", true);
+			elseOnClosingCheckBox.Active             = p.GetProperty("ElseOnClosing", true);
+			startBlockOnTheSameLineCheckBox.Active   = p.GetProperty("StartBlockOnSameLine", true);
+		}
+		
+		public override bool StorePanelContents()
+		{
+			IProperties p = (IProperties)PropertyService.GetProperty(codeGenerationProperty, new DefaultProperties());
+			p.SetProperty("GenerateAdditionalComments", generateAdditonalCommentsCheckBox.Active);
+			p.SetProperty("GenerateDocumentComments",   generateDocCommentsCheckBox.Active);
+			p.SetProperty("UseFullyQualifiedNames",     useFullTypeNamesCheckBox.Active);
+			p.SetProperty("BlankLinesBetweenMembers",   blankLinesBetweenMemberCheckBox.Active);
+			p.SetProperty("ElseOnClosing",              elseOnClosingCheckBox.Active);
+			p.SetProperty("StartBlockOnSameLine",       startBlockOnTheSameLineCheckBox.Active);
+			PropertyService.SetProperty(codeGenerationProperty, p);
+			return true;
+		}
+		
+		private void SetupPanelInstance()
+		{
+			// instantiate all the controls in the first group
+			Gtk.Frame frame1 = new Gtk.Frame(StringParserService.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.CodeGenerationOptionsGroupBox}"));
+			Gtk.VBox vBox1 = new Gtk.VBox(false,2);			
+			useFullTypeNamesCheckBox = CheckButton.NewWithLabel(StringParserService.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.UseFullTypeNamesCheckBox}")); 
+			blankLinesBetweenMemberCheckBox = CheckButton.NewWithLabel(StringParserService.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.BlankLinesBetweenMembersCheckBox}"));
+			elseOnClosingCheckBox = CheckButton.NewWithLabel(StringParserService.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.ElseOnClosingCheckBox}"));
+			startBlockOnTheSameLineCheckBox = CheckButton.NewWithLabel(StringParserService.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.StartBlockOnTheSameLineCheckBox}")); 
+			
+			// pack all controls in first group
+			vBox1.PackStart(startBlockOnTheSameLineCheckBox, false, false, 2);
+			vBox1.PackStart(elseOnClosingCheckBox, false, false, 2);
+			vBox1.PackStart(blankLinesBetweenMemberCheckBox, false, false, 2);
+			vBox1.PackStart(useFullTypeNamesCheckBox, false, false, 2);
+			frame1.Add(vBox1);
+			
+			// instantiate all the controls in the second group
+			Gtk.Frame frame2 = new Gtk.Frame(StringParserService.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.CommentGenerationOptionsGroupBox}"));
+			Gtk.VBox vBox2 = new Gtk.VBox(false,2);			
+			generateAdditonalCommentsCheckBox = CheckButton.NewWithLabel(StringParserService.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.GenerateAdditionalCommentsCheckBox}"));
+			generateDocCommentsCheckBox = CheckButton.NewWithLabel(StringParserService.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.GenerateDocCommentsCheckBox}"));
+			
+			// pack all controls in second group
+			vBox2.PackStart(generateDocCommentsCheckBox, false, false, 2);
+			vBox2.PackStart(generateAdditonalCommentsCheckBox, false, false, 2);
+			frame2.Add(vBox2);
+			
+			// pack all the groups
+			Gtk.VBox mainBox = new Gtk.VBox(false,2);
+			mainBox.PackStart(frame1, false, false, 2);
+			mainBox.PackStart(frame2, false, false, 2);
+			this.Add(mainBox);
+		}
+
+	}
+}




More information about the Monodevelop-patches-list mailing list