[MonoDevelop] Another option panel

John BouAntoun secretsquirrel@optusnet.com.au
Tue, 13 Jan 2004 12:38:15 +1100


--=-6nO6lo6dN+0VJbVqli5p
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

12 minutes this time.

This one goes in:

src/Main/Base/Gui/Dialogs/OptionPanels/IDEOptions/CodeGenerationPanel.cs

somone please review and commit.

JBA

P.S. Is the check box string rendering fixed in gtk-sharp yet?

JBA

--=-6nO6lo6dN+0VJbVqli5p
Content-Disposition: attachment; filename=CodeGenerationPanel.cs
Content-Type: text/plain; name=CodeGenerationPanel.cs; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

// <file>
//     <copyright see=3D"prj:///doc/copyright.txt"/>
//     <license see=3D"prj:///doc/license.txt"/>
//     <owner name=3D"Mike Kr=C3=BCger" email=3D"mike@icsharpcode.net"/>
//     <version value=3D"$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;=20
		CheckButton blankLinesBetweenMemberCheckBox;
		CheckButton elseOnClosingCheckBox;
		CheckButton startBlockOnTheSameLineCheckBox;=20
	=09
		// Services
		StringParserService StringParserService =3D (StringParserService)ServiceM=
anager.Services.GetService (typeof (StringParserService));
		PropertyService PropertyService =3D (PropertyService)ServiceManager.Servi=
ces.GetService (typeof (PropertyService));
		static readonly string codeGenerationProperty =3D "SharpDevelop.UI.CodeGe=
nerationOptions";
	=09
		public override void LoadPanelContents()
		{
			// set up the form controls instance
			SetupPanelInstance();
		=09
			IProperties p =3D (IProperties)PropertyService.GetProperty(codeGeneratio=
nProperty, new DefaultProperties());
		=09
			generateAdditonalCommentsCheckBox.Active =3D p.GetProperty("GenerateAddi=
tionalComments", true);
			generateDocCommentsCheckBox.Active       =3D p.GetProperty("GenerateDocu=
mentComments", true);
			useFullTypeNamesCheckBox.Active          =3D p.GetProperty("UseFullyQual=
ifiedNames", true);
		=09
			blankLinesBetweenMemberCheckBox.Active   =3D p.GetProperty("BlankLinesBe=
tweenMembers", true);
			elseOnClosingCheckBox.Active             =3D p.GetProperty("ElseOnClosin=
g", true);
			startBlockOnTheSameLineCheckBox.Active   =3D p.GetProperty("StartBlockOn=
SameLine", true);
		}
	=09
		public override bool StorePanelContents()
		{
			IProperties p =3D (IProperties)PropertyService.GetProperty(codeGeneratio=
nProperty, new DefaultProperties());
			p.SetProperty("GenerateAdditionalComments", generateAdditonalCommentsChe=
ckBox.Active);
			p.SetProperty("GenerateDocumentComments",   generateDocCommentsCheckBox.=
Active);
			p.SetProperty("UseFullyQualifiedNames",     useFullTypeNamesCheckBox.Act=
ive);
			p.SetProperty("BlankLinesBetweenMembers",   blankLinesBetweenMemberCheck=
Box.Active);
			p.SetProperty("ElseOnClosing",              elseOnClosingCheckBox.Active=
);
			p.SetProperty("StartBlockOnSameLine",       startBlockOnTheSameLineCheck=
Box.Active);
			PropertyService.SetProperty(codeGenerationProperty, p);
			return true;
		}
	=09
		private void SetupPanelInstance()
		{
			// instantiate all the controls in the first group
			Gtk.Frame frame1 =3D new Gtk.Frame(StringParserService.Parse("${res:Dial=
og.Options.IDEOptions.CodeGenerationOptionsPanel.CodeGenerationOptionsGroup=
Box}"));
			Gtk.VBox vBox1 =3D new Gtk.VBox(false,2);		=09
			useFullTypeNamesCheckBox =3D CheckButton.NewWithLabel(StringParserServic=
e.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.UseFull=
TypeNamesCheckBox}"));=20
			blankLinesBetweenMemberCheckBox =3D CheckButton.NewWithLabel(StringParse=
rService.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.=
BlankLinesBetweenMembersCheckBox}"));
			elseOnClosingCheckBox =3D CheckButton.NewWithLabel(StringParserService.P=
arse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.ElseOnClos=
ingCheckBox}"));
			startBlockOnTheSameLineCheckBox =3D CheckButton.NewWithLabel(StringParse=
rService.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.=
StartBlockOnTheSameLineCheckBox}"));=20
		=09
			// 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);
		=09
			// instantiate all the controls in the second group
			Gtk.Frame frame2 =3D new Gtk.Frame(StringParserService.Parse("${res:Dial=
og.Options.IDEOptions.CodeGenerationOptionsPanel.CommentGenerationOptionsGr=
oupBox}"));
			Gtk.VBox vBox2 =3D new Gtk.VBox(false,2);		=09
			generateAdditonalCommentsCheckBox =3D CheckButton.NewWithLabel(StringPar=
serService.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPane=
l.GenerateAdditionalCommentsCheckBox}"));
			generateDocCommentsCheckBox =3D CheckButton.NewWithLabel(StringParserSer=
vice.Parse("${res:Dialog.Options.IDEOptions.CodeGenerationOptionsPanel.Gene=
rateDocCommentsCheckBox}"));
		=09
			// pack all controls in second group
			vBox2.PackStart(generateDocCommentsCheckBox, false, false, 2);
			vBox2.PackStart(generateAdditonalCommentsCheckBox, false, false, 2);
			frame2.Add(vBox2);
		=09
			// pack all the groups
			Gtk.VBox mainBox =3D new Gtk.VBox(false,2);
			mainBox.PackStart(frame1, false, false, 2);
			mainBox.PackStart(frame2, false, false, 2);
			this.Add(mainBox);
		}

	}
}

--=-6nO6lo6dN+0VJbVqli5p--