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

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Wed Feb 4 20:56:55 EST 2004


Author: benm
Date: 2004-02-04 20:56:55 -0500 (Wed, 04 Feb 2004)
New Revision: 785

Modified:
   trunk/MonoDevelop/data/resources/glade/EditorBindings.glade
   trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Gui/OptionPanels/GeneralTextEditorPanel.cs
   trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Makefile
   trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Properties/TextEditorProperties.cs
   trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs
Log:
use default OS fonts

Modified: trunk/MonoDevelop/data/resources/glade/EditorBindings.glade
===================================================================
--- trunk/MonoDevelop/data/resources/glade/EditorBindings.glade	2004-02-05 00:08:11 UTC (rev 784)
+++ trunk/MonoDevelop/data/resources/glade/EditorBindings.glade	2004-02-05 01:56:55 UTC (rev 785)
@@ -421,7 +421,7 @@
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
-	  <property name="expand">True</property>
+	  <property name="expand">False</property>
 	  <property name="fill">True</property>
 	</packing>
       </child>
@@ -484,16 +484,18 @@
 		<widget class="GtkVBox" id="vbox44">
 		  <property name="visible">True</property>
 		  <property name="homogeneous">False</property>
-		  <property name="spacing">0</property>
+		  <property name="spacing">6</property>
 
 		  <child>
-		    <widget class="GnomeFontPicker" id="fontNameDisplayTextBox">
+		    <widget class="GtkRadioButton" id="use_monospace">
 		      <property name="visible">True</property>
 		      <property name="can_focus">True</property>
-		      <property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property>
-		      <property name="show_size">True</property>
-		      <property name="use_font_in_label">True</property>
-		      <property name="label_font_size">12</property>
+		      <property name="label" translatable="yes">Use default _monospace font</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>
@@ -501,6 +503,109 @@
 		      <property name="fill">False</property>
 		    </packing>
 		  </child>
+
+		  <child>
+		    <widget class="GtkRadioButton" id="use_sans">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">Use default _sans-serif font</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">use_monospace</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="vbox53">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">4</property>
+
+		      <child>
+			<widget class="GtkRadioButton" id="use_cust">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="label" translatable="yes">_Use cusom font:</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">use_monospace</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="hbox28">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">0</property>
+
+			  <child>
+			    <widget class="GtkLabel" id="label50">
+			      <property name="width_request">30</property>
+			      <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="GnomeFontPicker" id="fontNameDisplayTextBox">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="preview_text" translatable="yes">if (foo) Console.WriteLine (&quot;foo!&quot;);</property>
+			      <property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property>
+			      <property name="show_size">True</property>
+			      <property name="use_font_in_label">True</property>
+			      <property name="label_font_size">12</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>
 		</widget>
 		<packing>
 		  <property name="padding">0</property>
@@ -518,7 +623,7 @@
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
-	  <property name="expand">True</property>
+	  <property name="expand">False</property>
 	  <property name="fill">True</property>
 	</packing>
       </child>
@@ -632,7 +737,7 @@
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
-	  <property name="expand">True</property>
+	  <property name="expand">False</property>
 	  <property name="fill">True</property>
 	</packing>
       </child>

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Gui/OptionPanels/GeneralTextEditorPanel.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Gui/OptionPanels/GeneralTextEditorPanel.cs	2004-02-05 00:08:11 UTC (rev 784)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Gui/OptionPanels/GeneralTextEditorPanel.cs	2004-02-05 01:56:55 UTC (rev 785)
@@ -56,6 +56,7 @@
 // 			[Glade.Widget] OptionMenu textEncodingComboBox;
 			[Glade.Widget] FontPicker fontNameDisplayTextBox;
 			[Glade.Widget] VBox encodingBox;
+			[Glade.Widget] RadioButton use_monospace, use_sans, use_cust;
 			
 			public GeneralTextEditorPanelWidget (IProperties CustomizationObject) :  base ("EditorBindings.glade", "GeneralTextEditorPanel")
 			{
@@ -80,9 +81,29 @@
 					"${res:Dialog.Options.IDEOptions.TextEditor.General.DoubleBufferCheckBox}");
  				enableDoublebufferingCheckBox.Active = ((IProperties) CustomizationObject).GetProperty(
 					"DoubleBuffer", true);
-
-				fontNameDisplayTextBox.FontName = ((IProperties) CustomizationObject).GetProperty("DefaultFont", "Courier 12").ToString();
+					
+				string font_name = ((IProperties) CustomizationObject).GetProperty("DefaultFont", "__default_monospace").ToString ();
 				
+				switch (font_name) {
+				case "__default_monospace":
+					use_monospace.Active = true;
+					fontNameDisplayTextBox.Sensitive = false;
+					break;
+				case "__default_sans":
+					use_sans.Active = true;
+					fontNameDisplayTextBox.Sensitive = false;
+					break;
+				default:
+					use_cust.Active = true;
+					fontNameDisplayTextBox.Sensitive = true;
+					fontNameDisplayTextBox.FontName = font_name;
+					break;
+				}
+				
+				use_monospace.Toggled += new EventHandler (ItemToggled);
+				use_sans.Toggled += new EventHandler (ItemToggled);
+				use_cust.Toggled += new EventHandler (ItemToggled);
+				
 // 				encVBox.TextWithMnemonic = StringParserService.Parse(
 // 					"${res:Dialog.Options.IDEOptions.TextEditor.General.FontGroupBox.FileEncodingLabel}");
 
@@ -116,18 +137,26 @@
 					"EnableCodeCompletion", enableCodeCompletionCheckBox.Active);
 				((IProperties) CustomizationObject).SetProperty (
 					"EnableFolding", enableFoldingCheckBox.Active);
+				
+				string font_name;
+				if (use_monospace.Active)
+					font_name = "__default_monospace";
+				else if (use_sans.Active)
+					font_name = "__default_sans";
+				else
+					font_name = fontNameDisplayTextBox.FontName;
+				
 				((IProperties) CustomizationObject).SetProperty (
-					"DefaultFont", fontNameDisplayTextBox.FontName);
+					"DefaultFont", font_name);
 // 				Console.WriteLine (CharacterEncodings.GetEncodingByIndex (selectedIndex).CodePage);
 // 				((IProperties) CustomizationObject).SetProperty (
 // 					"Encoding",CharacterEncodings.GetEncodingByIndex (selectedIndex).CodePage);
 			}
 			
-// 			private void OnOptionChanged (object o, EventArgs args)
-// 			{
-// 				Console.WriteLine (selectedIndex);
-// 				selectedIndex = ((OptionMenu) o).History;
-// 			}
+ 			void ItemToggled (object o, EventArgs args)
+			{
+				fontNameDisplayTextBox.Sensitive = use_cust.Active;
+			}
 
 		}
 	}

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Makefile
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Makefile	2004-02-05 00:08:11 UTC (rev 784)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Makefile	2004-02-05 01:56:55 UTC (rev 785)
@@ -4,6 +4,7 @@
 
 $(DLL) : $(shell find . -name \*.cs)
 	mcs $(shell find . -name \*.cs) /out:$@ /t:library /r:gtk-sharp /r:gdk-sharp /r:glib-sharp.dll \
+		/r:gconf-sharp \
 		/r:../../../../build/bin/MonoDevelop.Core.dll \
 		/r:../../../../build/bin/MonoDevelop.Base.dll \
 		/r:../../../../build/bin/MonoDevelop.Gui.Utils.dll \

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Properties/TextEditorProperties.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Properties/TextEditorProperties.cs	2004-02-05 00:08:11 UTC (rev 784)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/EditorBindings/Properties/TextEditorProperties.cs	2004-02-05 01:56:55 UTC (rev 785)
@@ -266,11 +266,16 @@
 		
 		public static FontDescription Font {
 			get {
-				string s = properties.GetProperty ("DefaultFont", "ack");
-				if (s == "ack")
+				string s = properties.GetProperty ("DefaultFont", "__default_monospace");
+				
+				switch (s) {
+				case "__default_monospace":
+					return FontDescription.FromString ((string) new GConf.Client ().Get ("/desktop/gnome/interface/monospace_font_name"));
+				case "__default_sans":
 					return new Gtk.Label ("").Style.FontDescription;
-				
-				return FontDescription.FromString (s);
+				default:
+					return FontDescription.FromString (s);
+				}
 			}
 			set {
 				properties.SetProperty ("DefaultFont", value.ToString ());

Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs	2004-02-05 00:08:11 UTC (rev 784)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/TextEditor/Gui/Editor/SharpDevelopTextEditorProperties.cs	2004-02-05 01:56:55 UTC (rev 785)
@@ -22,8 +22,9 @@
 		{
 			PropertyService propertyService = (PropertyService) ServiceManager.Services.GetService (typeof(PropertyService));
 			IProperties properties2 = ((IProperties) propertyService.GetProperty("ICSharpCode.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new DefaultProperties()));
-			FontContainer.DefaultFont = FontContainer.ParseFont (properties2.GetProperty ("DefaultFont", FontDescription.FromString ("Courier Pitch 10").ToString ()));
 			properties2.PropertyChanged += new PropertyEventHandler (CheckFontChange);
+			
+			FontContainer.DefaultFont = TextEditorProperties.Font;
 		}
 		
 		static void CheckFontChange(object sender, PropertyEventArgs e)




More information about the Monodevelop-patches-list mailing list