[Monodevelop-patches-list] r802 - in trunk/MonoDevelop: data/resources/glade src/AddIns/DisplayBindings/EditorBindings/Gui/OptionPanels

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Fri Feb 6 02:09:43 EST 2004


Author: dkor
Date: 2004-02-06 02:09:42 -0500 (Fri, 06 Feb 2004)
New Revision: 802

Modified:
   trunk/MonoDevelop/data/resources/glade/EditorBindings.glade
   trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Gui/OptionPanels/BehaviorTextEditorPanel.cs
Log:
Glading of the BehaviorTextEditorPanel

Modified: trunk/MonoDevelop/data/resources/glade/EditorBindings.glade
===================================================================
--- trunk/MonoDevelop/data/resources/glade/EditorBindings.glade	2004-02-06 06:58:34 UTC (rev 801)
+++ trunk/MonoDevelop/data/resources/glade/EditorBindings.glade	2004-02-06 07:09:42 UTC (rev 802)
@@ -1163,6 +1163,7 @@
 			  <property name="yalign">0.49</property>
 			  <property name="xpad">1</property>
 			  <property name="ypad">0</property>
+			  <property name="mnemonic_widget">showVRulerCheckBox</property>
 			</widget>
 			<packing>
 			  <property name="padding">0</property>
@@ -1221,4 +1222,497 @@
   </child>
 </widget>
 
+<widget class="GtkWindow" id="BehaviorTextEditorPanel">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">BehaviorTextEditorPanel</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+
+  <child>
+    <widget class="GtkVBox" id="vbox54">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">12</property>
+
+      <child>
+	<widget class="GtkVBox" id="vbox55">
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">6</property>
+
+	  <child>
+	    <widget class="GtkLabel" id="tabsGroupBoxLabel">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">&lt;b&gt;Tabs&lt;/b&gt;</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">True</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkHBox" id="hbox29">
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">0</property>
+
+	      <child>
+		<widget class="GtkLabel" id="label51">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">    </property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkVBox" id="vbox57">
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">6</property>
+
+		  <child>
+		    <widget class="GtkLabel" id="indentLabel">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">I_ndentations-</property>
+		      <property name="use_underline">True</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="mnemonic_widget">noneIndentStyle</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox31">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">6</property>
+
+		      <child>
+			<widget class="GtkLabel" id="label54">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">    </property>
+			  <property name="use_underline">False</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkVBox" id="vbox59">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">6</property>
+
+			  <child>
+			    <widget class="GtkRadioButton" id="noneIndentStyle">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">None-</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkRadioButton" id="automaticIndentStyle">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Automatic-</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			      <property name="group">noneIndentStyle</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkRadioButton" id="smartIndentStyle">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Smart-</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			      <property name="group">noneIndentStyle</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkHBox" id="indentAndTabSizeBox">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">6</property>
+
+		      <child>
+			<widget class="GtkLabel" id="tabSizeLabel">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Tab size-</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			  <property name="mnemonic_widget">indentAndTabSizeSpinButton</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="label57">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">&amp;</property>
+			  <property name="use_underline">False</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="indentSizeLabel">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">_Indentation size-</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			  <property name="mnemonic_widget">indentAndTabSizeSpinButton</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkSpinButton" id="indentAndTabSizeSpinButton">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="climb_rate">1</property>
+			  <property name="digits">0</property>
+			  <property name="numeric">True</property>
+			  <property name="update_policy">GTK_UPDATE_IF_VALID</property>
+			  <property name="snap_to_ticks">False</property>
+			  <property name="wrap">False</property>
+			  <property name="adjustment">4 1 40 1 4 10</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkCheckButton" id="convertTabsToSpacesCheckBox">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">C_onvert Tabs to Spaces-</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		  <property name="pack_type">GTK_PACK_END</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkVBox" id="vbox56">
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">6</property>
+
+	  <child>
+	    <widget class="GtkLabel" id="behaviourGroupBoxLabel">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">&lt;b&gt;Behavior-&lt;/b&gt;</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">True</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkHBox" id="hbox30">
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">6</property>
+
+	      <child>
+		<widget class="GtkLabel" id="label52">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">    </property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkVBox" id="vbox60">
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">6</property>
+
+		  <child>
+		    <widget class="GtkCheckButton" id="caretBehindEOLCheckBox">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">_Can mouve caret behidn EOL-</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkCheckButton" id="autoInsertTemplatesCheckBox">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">_Automatic template insertion-</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkCheckButton" id="autoinsertCurlyBraceCheckBox">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">A_uto insert curly braces-</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkCheckButton" id="hideMouseCursorCheckBox">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">_Hide mouse cursor shile typing-</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
 </glade-interface>

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Gui/OptionPanels/BehaviorTextEditorPanel.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Gui/OptionPanels/BehaviorTextEditorPanel.cs	2004-02-06 06:58:34 UTC (rev 801)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Gui/OptionPanels/BehaviorTextEditorPanel.cs	2004-02-06 07:09:42 UTC (rev 802)
@@ -21,6 +21,7 @@
 using ICSharpCode.SharpDevelop.Gui.Dialogs;
 
 using Gtk;
+using MonoDevelop.Gui.Widgets;
 using MonoDevelop.EditorBindings.FormattingStrategy;
 
 namespace MonoDevelop.EditorBindings.Gui.OptionPanels
@@ -30,146 +31,126 @@
 	/// </summary>
 	public class BehaviorTextEditorPanel : AbstractOptionPanel
 	{
-		// GTK controls
-		CheckButton		autoinsertCurlyBraceCheckBox;
-		CheckButton		hideMouseCursorCheckBox;
-		CheckButton		caretBehindEOLCheckBox;
-		CheckButton		auotInsertTemplatesCheckBox;
-		CheckButton		convertTabsToSpacesCheckBox;
-		Entry			tabSizeTextBox;
-		Entry			indentSizeTextBox;
-		Gtk.Menu		indentStyleComboBoxMenu;
-		Gtk.OptionMenu	indentStyleComboBox;
-		Gtk.Menu		mouseWhellDirectionComboBoxMenu;
-		Gtk.OptionMenu	mouseWhellDirectionComboBox;
+		BehaviorTextEditorPanelWidget widget;
 		
-		// Services
-		StringParserService StringParserService = (StringParserService)ServiceManager.Services.GetService (typeof (StringParserService));
-		
 		public override void LoadPanelContents()
 		{
-			// set up the form controls instance
-			SetupPanelInstance();			
-			
-			autoinsertCurlyBraceCheckBox.Active = ((IProperties)CustomizationObject).GetProperty("AutoInsertCurlyBracket", true);
-			hideMouseCursorCheckBox.Active      = ((IProperties)CustomizationObject).GetProperty("HideMouseCursor", true);
-			caretBehindEOLCheckBox.Active       = ((IProperties)CustomizationObject).GetProperty("CursorBehindEOL", false);
-			auotInsertTemplatesCheckBox.Active  = ((IProperties)CustomizationObject).GetProperty("AutoInsertTemplates", true);
-			
-			convertTabsToSpacesCheckBox.Active  = ((IProperties)CustomizationObject).GetProperty("TabsToSpaces", false);
-			
-			tabSizeTextBox.Text    = ((IProperties)CustomizationObject).GetProperty("TabIndent", 4).ToString();
-			indentSizeTextBox.Text = ((IProperties)CustomizationObject).GetProperty("IndentationSize", 4).ToString();
-			
-			indentStyleComboBoxMenu.Append(MenuItem.NewWithLabel(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.IndentStyle.None}")));
-			indentStyleComboBoxMenu.Append(MenuItem.NewWithLabel(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.IndentStyle.Automatic}")));
-			indentStyleComboBoxMenu.Append(MenuItem.NewWithLabel(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.IndentStyle.Smart}")));
-			
-			indentStyleComboBox.SetHistory((uint)(IndentStyle)((IProperties)CustomizationObject).GetProperty("IndentStyle", IndentStyle.Smart));
-		
-			mouseWhellDirectionComboBoxMenu.Append(MenuItem.NewWithLabel(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.NormalMouseDirectionRadioButton}")));
-			mouseWhellDirectionComboBoxMenu.Append(MenuItem.NewWithLabel(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.ReverseMouseDirectionRadioButton}")));
-			int selectedIndex = ((IProperties)CustomizationObject).GetProperty("MouseWheelScrollDown", true) ? 0 : 1;
-			mouseWhellDirectionComboBox.SetHistory((uint)selectedIndex);
+			Add (widget = new BehaviorTextEditorPanelWidget ((IProperties) CustomizationObject));
 		}
 		
 		public override bool StorePanelContents()
 		{
-			((IProperties)CustomizationObject).SetProperty("TabsToSpaces",         convertTabsToSpacesCheckBox.Active);
-			((IProperties)CustomizationObject).SetProperty("MouseWheelScrollDown", mouseWhellDirectionComboBox.History == 0);
+			widget.Store ((IProperties) CustomizationObject);
+			return true;
+		}
+		
+		class BehaviorTextEditorPanelWidget : GladeWidgetExtract 
+		{
+			// Services
+			StringParserService StringParserService = (
+				StringParserService)ServiceManager.Services.GetService (typeof (StringParserService));
 			
-			((IProperties)CustomizationObject).SetProperty("AutoInsertCurlyBracket", autoinsertCurlyBraceCheckBox.Active);
-			((IProperties)CustomizationObject).SetProperty("HideMouseCursor",        hideMouseCursorCheckBox.Active);
-			((IProperties)CustomizationObject).SetProperty("CursorBehindEOL",        caretBehindEOLCheckBox.Active);
-			((IProperties)CustomizationObject).SetProperty("AutoInsertTemplates",    auotInsertTemplatesCheckBox.Active);
+			// GTK controls
+			[Glade.Widget] Label			tabsGroupBoxLabel;
+			[Glade.Widget] Label			behaviourGroupBoxLabel;
+			[Glade.Widget] Label			tabSizeLabel;
+			[Glade.Widget] Label			indentSizeLabel;
+			[Glade.Widget] Label			indentLabel;
+			[Glade.Widget] CheckButton		autoinsertCurlyBraceCheckBox;
+			[Glade.Widget] CheckButton		hideMouseCursorCheckBox;
+			[Glade.Widget] CheckButton		caretBehindEOLCheckBox;
+			[Glade.Widget] CheckButton		autoInsertTemplatesCheckBox;
+			[Glade.Widget] CheckButton		convertTabsToSpacesCheckBox;
+			[Glade.Widget] RadioButton              noneIndentStyle;
+			[Glade.Widget] RadioButton              automaticIndentStyle;
+			[Glade.Widget] RadioButton              smartIndentStyle;
+			[Glade.Widget] SpinButton               indentAndTabSizeSpinButton;
 			
-			((IProperties)CustomizationObject).SetProperty("IndentStyle", indentStyleComboBox.History);
-			
-			try {
-				int tabSize = Int32.Parse(tabSizeTextBox.Text);
+			public BehaviorTextEditorPanelWidget (IProperties CustomizationObject) :  
+				base ("EditorBindings.glade", "BehaviorTextEditorPanel")
+			{
+				// Set up Text
+				tabsGroupBoxLabel.Markup = "<b>" + StringParserService.Parse(
+					"${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.TabsGroupBox}")  + "</b>";
+				tabSizeLabel.TextWithMnemonic = StringParserService.Parse(
+					"${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.TabSizeLabel}");
+				indentSizeLabel.TextWithMnemonic = StringParserService.Parse(
+					"${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.IndentSizeLabel}");
+				indentLabel.TextWithMnemonic = StringParserService.Parse(
+					"${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.IndentLabel}");
 				
-				// FIX: don't allow to set tab size to zero as this will cause divide by zero exceptions in the text control.
-				// Zero isn't a setting that makes sense, anyway.
-				if (tabSize > 0) {
-					((IProperties)CustomizationObject).SetProperty("TabIndent", tabSize);
+				behaviourGroupBoxLabel.Markup = "<b>" +  StringParserService.Parse(
+					"${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.BehaviourGroupBox}") + "</b>";
+				autoinsertCurlyBraceCheckBox.Label = StringParserService.Parse(
+					"${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.CurlyBracketCheckBox}");
+				hideMouseCursorCheckBox.Label = StringParserService.Parse(
+					"${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.HideMouseCheckBox}");
+				caretBehindEOLCheckBox.Label = StringParserService.Parse(
+					"${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.BehindEOLCheckBox}");
+				autoInsertTemplatesCheckBox.Label = StringParserService.Parse(
+					"${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.TemplateInsertCheckBox}");
+				convertTabsToSpacesCheckBox.Label = StringParserService.Parse(
+					"${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.ConvertTabsToSpacesCheckBox}");			
+				
+				// Set up Value
+				autoinsertCurlyBraceCheckBox.Active = ((IProperties)CustomizationObject).GetProperty(
+					"AutoInsertCurlyBracket", true);
+				hideMouseCursorCheckBox.Active      = ((IProperties)CustomizationObject).GetProperty(
+					"HideMouseCursor", true);
+				caretBehindEOLCheckBox.Active       = ((IProperties)CustomizationObject).GetProperty(
+					"CursorBehindEOL", false);
+				autoInsertTemplatesCheckBox.Active  = ((IProperties)CustomizationObject).GetProperty(
+					"AutoInsertTemplates", true);
+				convertTabsToSpacesCheckBox.Active  = ((IProperties)CustomizationObject).GetProperty(
+					"TabsToSpaces", false);
+				
+				//FIXME: Only one of these should be selected to hold the value
+				indentAndTabSizeSpinButton.Value  = ((IProperties)CustomizationObject).GetProperty(
+					"TabIndent", 4);
+				indentAndTabSizeSpinButton.Value = ((IProperties)CustomizationObject).GetProperty(
+					"IndentationSize", 4);
+
+				if (IndentStyle.None.Equals(
+					    (IndentStyle) ((IProperties)CustomizationObject).GetProperty(
+						    "IndentStyle", IndentStyle.Smart))){
+					noneIndentStyle.Active = true;
 				}
-			} catch (Exception) {
+				else if (IndentStyle.Auto.Equals(
+						 (IndentStyle) ((IProperties)CustomizationObject).GetProperty(
+							 "IndentStyle", IndentStyle.Smart))){
+					automaticIndentStyle.Active = true;
+				}
+				else if (IndentStyle.Smart.Equals(
+						 (IndentStyle) ((IProperties)CustomizationObject).GetProperty(
+							 "IndentStyle", IndentStyle.Smart))){
+					smartIndentStyle.Active = true;
+				}
 			}
-			
-			try {
-				((IProperties)CustomizationObject).SetProperty("IndentationSize", Int32.Parse(indentSizeTextBox.Text));
-			} catch (Exception) {
+
+			public void Store (IProperties CustomizationObject)
+			{
+				((IProperties)CustomizationObject).SetProperty(
+					"TabsToSpaces",           convertTabsToSpacesCheckBox.Active);
+				((IProperties)CustomizationObject).SetProperty(
+					"AutoInsertCurlyBracket", autoinsertCurlyBraceCheckBox.Active);
+				((IProperties)CustomizationObject).SetProperty(
+					"HideMouseCursor",        hideMouseCursorCheckBox.Active);
+				((IProperties)CustomizationObject).SetProperty(
+					"CursorBehindEOL",        caretBehindEOLCheckBox.Active);
+				((IProperties)CustomizationObject).SetProperty(
+					"AutoInsertTemplates",    autoInsertTemplatesCheckBox.Active);
+
+				if (noneIndentStyle.Active)
+					((IProperties)CustomizationObject).SetProperty("IndentStyle", IndentStyle.None);
+				else if (automaticIndentStyle.Active)
+					((IProperties)CustomizationObject).SetProperty("IndentStyle", IndentStyle.Auto);
+				else if (smartIndentStyle.Active)
+					((IProperties)CustomizationObject).SetProperty("IndentStyle", IndentStyle.Smart);
+				
+				//FIXME: Only one of these should be selected to save the value
+				((IProperties)CustomizationObject).SetProperty("TabIndent", indentAndTabSizeSpinButton.Value);
+				((IProperties)CustomizationObject).SetProperty("IndentationSize", indentAndTabSizeSpinButton.Value);
 			}
-			return true;
 		}
-		
-		#region jba added methods
-		
-		private void SetupPanelInstance()
-		{
-			Gtk.Frame frame1 = new Gtk.Frame(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.TabsGroupBox}"));
-			//
-			// set up the Tab
-			//
-			// instantiate all the controls
-			Gtk.VBox vBox1 = new Gtk.VBox(false,2);
-			Gtk.Label label1 = new Gtk.Label(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.TabSizeLabel}"));
-			Gtk.Label label2 = new Gtk.Label(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.IndentSizeLabel}"));
-			Gtk.Label label3 = new Gtk.Label(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.IndentLabel}"));
-			tabSizeTextBox = new Entry();
-			indentSizeTextBox = new Entry();
-			indentStyleComboBoxMenu = new Menu();
-			indentStyleComboBox = new OptionMenu();
-			indentStyleComboBox.Menu = indentStyleComboBoxMenu;
-			convertTabsToSpacesCheckBox = new CheckButton(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.ConvertTabsToSpacesCheckBox}"));
-				// table to pack the tab settings options 
-				Table table1 = new Table(4, 2, false);
-				//pack the table
-				table1.Attach(label1, 0, 1, 0, 1);
-				table1.Attach(tabSizeTextBox, 1, 2, 0, 1);
-				table1.Attach(label2, 0, 1, 1, 2);
-				table1.Attach(indentSizeTextBox, 1, 2, 1, 2);
-				table1.Attach(label3, 2, 4, 0, 1);
-				table1.Attach(indentStyleComboBox, 2, 4, 1, 2);
-				
-			// pack them all
-			vBox1.PackStart(table1, false, false, 2);
-			vBox1.PackStart(convertTabsToSpacesCheckBox, false, false, 2);
-			frame1.Add(vBox1);
-			
-			//
-			// setup the behaviour options
-			//
-			//instantiate all the controls			
-			Gtk.Frame frame2 = new Gtk.Frame(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.BehaviourGroupBox}"));
-			Gtk.VBox vBox2 = new Gtk.VBox(false, 2);
-			
-			
-			autoinsertCurlyBraceCheckBox = new CheckButton(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.CurlyBracketCheckBox}"));
-			hideMouseCursorCheckBox  = new CheckButton(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.HideMouseCheckBox}"));
-			caretBehindEOLCheckBox  = new CheckButton(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.BehindEOLCheckBox}"));
-			auotInsertTemplatesCheckBox  = new CheckButton(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.TemplateInsertCheckBox}"));			
-			Label label4 = new Gtk.Label(StringParserService.Parse("${res:Dialog.Options.IDEOptions.TextEditor.Behaviour.MouseWhellGroupBox}"));
-			mouseWhellDirectionComboBoxMenu = new Menu();
-			mouseWhellDirectionComboBox = new OptionMenu();
-			mouseWhellDirectionComboBox.Menu = mouseWhellDirectionComboBoxMenu;
-			// pack them all
-			vBox2.PackStart(caretBehindEOLCheckBox, false, false, 2);
-			vBox2.PackStart(auotInsertTemplatesCheckBox, false, false, 2);
-			vBox2.PackStart(autoinsertCurlyBraceCheckBox, false, false, 2);
-			vBox2.PackStart(hideMouseCursorCheckBox, false, false, 2);
-			vBox2.PackStart(label4, false, false, 2);
-			vBox2.PackStart(mouseWhellDirectionComboBox, false, false, 2);
-			frame2.Add(vBox2);
-			
-			// create the main box
-			Gtk.VBox mainBox = new Gtk.VBox(false, 2);
-			mainBox.PackStart(frame1, false, false, 2);
-			mainBox.PackStart(frame2, false, false, 2);
-			
-			this.Add(mainBox);
-		}
-		
-		#endregion
 	}
 }




More information about the Monodevelop-patches-list mailing list