[Monodevelop-patches-list] r2274 - in trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor: . Gui Gui/OptionPanels Properties
John Luke <jluke@cfl.rr.com>
jluke at mono-cvs.ximian.com
Sat Feb 26 15:45:19 EST 2005
Author: jluke
Date: 2005-02-26 15:45:19 -0500 (Sat, 26 Feb 2005)
New Revision: 2274
Modified:
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/EditorBindings.glade
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels/GeneralTextEditorPanel.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels/MarkersTextEditorPanel.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Properties/TextEditorProperties.cs
Log:
handle property changes individually
allow Syntax highlighting to be turned off
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-02-25 22:17:37 UTC (rev 2273)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-02-26 20:45:19 UTC (rev 2274)
@@ -1,3 +1,13 @@
+2005-02-26 John Luke <john.luke at gmail.com>
+
+ * Gui/SourceEditorWidget.cs: dont always set Highlight=true
+ * Gui/OptionPanels/MarkersTextEditorPanel.cs: un-sensitize ShowErrors
+ * Gui/SourceEditorDisplayBinding.cs: only modify properties
+ that were changed.
+ * Gui/OptionPanels/GeneralTextEditorPanel.cs:
+ * Properties/TextEditorProperties.cs:
+ * EditorBindings.glade: add SyntaxHighlight check button
+
2005-02-23 Christian Hergert <christian.hergert at gmail.com>
* Gui/Dialogs/ReplaceDialog.cs: Check for null to prevent Exception.
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/EditorBindings.glade
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/EditorBindings.glade 2005-02-25 22:17:37 UTC (rev 2273)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/EditorBindings.glade 2005-02-26 20:45:19 UTC (rev 2274)
@@ -403,6 +403,24 @@
<property name="fill">False</property>
</packing>
</child>
+ <child>
+ <widget class="GtkCheckButton" id="enableSyntaxHighlighting">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Enable syntax highlighting</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</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>
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels/GeneralTextEditorPanel.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels/GeneralTextEditorPanel.cs 2005-02-25 22:17:37 UTC (rev 2273)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels/GeneralTextEditorPanel.cs 2005-02-26 20:45:19 UTC (rev 2274)
@@ -50,7 +50,7 @@
[Glade.Widget] Label genOptions, fontOptions;
// encOptions, encVBox; // if you uncoment change to "," above
[Glade.Widget] CheckButton enableCodeCompletionCheckBox,
- enableFoldingCheckBox;
+ enableFoldingCheckBox, enableSyntaxHighlighting;
// [Glade.Widget] ComboBox textEncodingComboBox;
[Glade.Widget] FontButton fontNameDisplayTextBox;
[Glade.Widget] VBox encodingBox;
@@ -63,6 +63,7 @@
"EnableCodeCompletion", true);
enableFoldingCheckBox.Active = ((IProperties) CustomizationObject).GetProperty("EnableFolding", true);
+ enableSyntaxHighlighting.Active = ((IProperties) CustomizationObject).GetProperty("SyntaxHighlight", true);
string font_name = ((IProperties) CustomizationObject).GetProperty("DefaultFont", "__default_monospace").ToString ();
@@ -117,6 +118,8 @@
"EnableCodeCompletion", enableCodeCompletionCheckBox.Active);
((IProperties) CustomizationObject).SetProperty (
"EnableFolding", enableFoldingCheckBox.Active);
+ ((IProperties) CustomizationObject).SetProperty (
+ "SyntaxHighlight", enableSyntaxHighlighting.Active);
string font_name;
if (use_monospace.Active)
@@ -137,7 +140,7 @@
{
fontNameDisplayTextBox.Sensitive = use_cust.Active;
}
-
}
}
}
+
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels/MarkersTextEditorPanel.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels/MarkersTextEditorPanel.cs 2005-02-25 22:17:37 UTC (rev 2273)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/OptionPanels/MarkersTextEditorPanel.cs 2005-02-26 20:45:19 UTC (rev 2274)
@@ -73,6 +73,9 @@
"ShowVRuler", false);
vRulerRowTextBox.Value = ((IProperties)CustomizationObject).GetProperty("VRulerRow", 80);
+
+ // disabled
+ showErrorsCheckBox.Sensitive = false;
}
public void Store (IProperties CustomizationObject)
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-02-25 22:17:37 UTC (rev 2273)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorDisplayBinding.cs 2005-02-26 20:45:19 UTC (rev 2274)
@@ -188,7 +188,7 @@
ContentNameChanged += new EventHandler (UpdateFSW);
CaretModeChanged (null, null);
- PropertiesChanged (null, null);
+ SetInitialValues ();
PropertyService propertyService = (PropertyService) ServiceManager.GetService (typeof (PropertyService));
IProperties properties2 = ((IProperties) propertyService.GetProperty("MonoDevelop.TextEditor.Document.Document.DefaultDocumentAggregatorProperties", new DefaultProperties()));
@@ -494,45 +494,83 @@
se.Buffer.ClearBookmarks ();
}
#endregion
-
- void PropertiesChanged (object sender, PropertyEventArgs e)
- {
- // FIXME: do these seperately
+
+ void SetInitialValues ()
+ {
se.View.ModifyFont (TextEditorProperties.Font);
se.View.ShowLineNumbers = TextEditorProperties.ShowLineNumbers;
se.Buffer.CheckBrackets = TextEditorProperties.ShowMatchingBracket;
se.View.ShowMargin = TextEditorProperties.ShowVerticalRuler;
se.View.EnableCodeCompletion = TextEditorProperties.EnableCodeCompletion;
-
- if (TextEditorProperties.VerticalRulerRow > -1) {
- se.View.Margin = (uint) TextEditorProperties.VerticalRulerRow;
- } else {
- se.View.Margin = (uint) 80; // FIXME: should i be doing this on a bad vruller setting?
- }
-
- if (TextEditorProperties.TabIndent > -1) {
- se.View.TabsWidth = (uint) TextEditorProperties.TabIndent;
- } else {
- se.View.TabsWidth = (uint) 4; // FIXME: should i be doing this on a bad tabindent setting?
- }
-
se.View.InsertSpacesInsteadOfTabs = TextEditorProperties.ConvertTabsToSpaces;
se.View.AutoIndent = (TextEditorProperties.IndentStyle == IndentStyle.Auto);
se.View.AutoInsertTemplates = TextEditorProperties.AutoInsertTemplates;
se.Buffer.UnderlineErrors = TextEditorProperties.UnderlineErrors;
-
- //System.Console.WriteLine(e.Key + " = " + e.NewValue + "(from " + e.OldValue + ")" );
- // The items below can't be done (since there is no support for it in gtksourceview)
- // CANTDO: show spaces Key = "ShowSpaces"
- // CANTDO: show tabs Key = "ShowTabs"
- // CANTDO eol makers Key = "ShowEOLMarkers"
- // CANTDO: show horizontal ruler Key = "ShowHRuler"
- // DONOTDO: auto insert braces Key = "AutoInsertCurlyBracket"
- // TODO: Show Invalid Lines Key = "ShowInvalidLines"
- // TODO: Code Folding Key = "EnableFolding"
- // TODO: Double Buffering Key = "DoubleBuffer"
- // TODO: can move past EOL Key = "CursorBehindEOL"
- // TODO: auto insert template Key = "AutoInsertTemplates"
+ se.Buffer.Highlight = TextEditorProperties.SyntaxHighlight;
+
+ if (TextEditorProperties.VerticalRulerRow > -1)
+ se.View.Margin = (uint) TextEditorProperties.VerticalRulerRow;
+ else
+ se.View.Margin = (uint) 80;
+
+ if (TextEditorProperties.TabIndent > -1)
+ se.View.TabsWidth = (uint) TextEditorProperties.TabIndent;
+ else
+ se.View.TabsWidth = (uint) 4;
+ }
+
+ void PropertiesChanged (object sender, PropertyEventArgs e)
+ {
+ switch (e.Key) {
+ case "DefaultFont":
+ se.View.ModifyFont (TextEditorProperties.Font);
+ break;
+ case "ShowLineNumbers":
+ se.View.ShowLineNumbers = TextEditorProperties.ShowLineNumbers;
+ break;
+ case "ShowBracketHighlight":
+ se.Buffer.CheckBrackets = TextEditorProperties.ShowMatchingBracket;
+ break;
+ case "ShowVRuler":
+ se.View.ShowMargin = TextEditorProperties.ShowVerticalRuler;
+ break;
+ case "EnableCodeCompletion":
+ se.View.EnableCodeCompletion = TextEditorProperties.EnableCodeCompletion;
+ break;
+ case "ConvertTabsToSpaces":
+ se.View.InsertSpacesInsteadOfTabs = TextEditorProperties.ConvertTabsToSpaces;
+ break;
+ case "IndentStyle":
+ se.View.AutoIndent = (TextEditorProperties.IndentStyle == IndentStyle.Auto);
+ break;
+ case "AutoInsertTemplates":
+ se.View.AutoInsertTemplates = TextEditorProperties.AutoInsertTemplates;
+ break;
+ case "ShowErrors":
+ se.Buffer.UnderlineErrors = TextEditorProperties.UnderlineErrors;
+ break;
+ case "SyntaxHighlight":
+ se.Buffer.Highlight = TextEditorProperties.SyntaxHighlight;
+ break;
+ case "VRulerRow":
+ if (TextEditorProperties.VerticalRulerRow > -1)
+ se.View.Margin = (uint) TextEditorProperties.VerticalRulerRow;
+ else
+ se.View.Margin = (uint) 80;
+ break;
+ case "TabIndent":
+ if (TextEditorProperties.TabIndent > -1)
+ se.View.TabsWidth = (uint) TextEditorProperties.TabIndent;
+ else
+ se.View.TabsWidth = (uint) 4;
+ break;
+ case "EnableFolding":
+ // TODO
+ break;
+ default:
+ Console.WriteLine ("unhandled property change: {0}", e.Key);
+ break;
+ }
}
}
}
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs 2005-02-25 22:17:37 UTC (rev 2273)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorWidget.cs 2005-02-26 20:45:19 UTC (rev 2274)
@@ -17,7 +17,6 @@
DisplayBinding = bind;
Buffer = new SourceEditorBuffer ();
View = new SourceEditorView (Buffer, this);
- Buffer.Highlight = true;
Buffer.View = View;
this.VscrollbarPolicy = PolicyType.Automatic;
this.HscrollbarPolicy = PolicyType.Automatic;
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Properties/TextEditorProperties.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Properties/TextEditorProperties.cs 2005-02-25 22:17:37 UTC (rev 2273)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Properties/TextEditorProperties.cs 2005-02-26 20:45:19 UTC (rev 2274)
@@ -1,15 +1,13 @@
using System;
using System.Text;
+using Pango;
+
using MonoDevelop.Core.Properties;
using MonoDevelop.Core.Services;
using MonoDevelop.Gui.Dialogs.OptionPanels;
-
using MonoDevelop.TextEditor;
using MonoDevelop.TextEditor.Document;
-
-using Pango;
-
using MonoDevelop.EditorBindings.FormattingStrategy;
namespace MonoDevelop.EditorBindings.Properties {
@@ -57,6 +55,15 @@
}
}
+ public static bool SyntaxHighlight {
+ get {
+ return properties.GetProperty ("SyntaxHighlight", true);
+ }
+ set {
+ properties.SetProperty ("SyntaxHighlight", value);
+ }
+ }
+
public static bool EnableCodeCompletion {
get {
return properties.GetProperty ("EnableCodeCompletion", true);
More information about the Monodevelop-patches-list
mailing list