Author: fejj
Date: 2007-02-23 12:02:33 -0500 (Fri, 23 Feb 2007)
New Revision: 73374
Modified:
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/ChangeLog
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs
Log:
2007-02-22 Jeffrey Stedfast <[EMAIL PROTECTED]>
* MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs:
Added some new font properties that GeneralTextEditorPanel.cs
needed in order to drop the need for the CustomizationObject.
Also changed the default IndentStyle to Smart.
* MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs:
Same as below.
* MonoDevelop.SourceEditor.Gui.OptionPanels.MarkersTextEditorPanel.cs:
Same as below.
* MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs:
Same as below.
* MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs:
Don't use the CustomizationObject, wherever that comes
from(?). Instead, directly use TextEditorProperties so that
changing the defaults in TextEditorProperties changes it in the
Preferences dialog as well.
Modified: trunk/monodevelop/Extras/MonoDevelop.SourceEditor/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/MonoDevelop.SourceEditor/ChangeLog 2007-02-23
16:41:06 UTC (rev 73373)
+++ trunk/monodevelop/Extras/MonoDevelop.SourceEditor/ChangeLog 2007-02-23
17:02:33 UTC (rev 73374)
@@ -1,3 +1,25 @@
+2007-02-22 Jeffrey Stedfast <[EMAIL PROTECTED]>
+
+ * MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs:
+ Added some new font properties that GeneralTextEditorPanel.cs
+ needed in order to drop the need for the CustomizationObject.
+ Also changed the default IndentStyle to Smart.
+
+ * MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs:
+ Same as below.
+
+ * MonoDevelop.SourceEditor.Gui.OptionPanels.MarkersTextEditorPanel.cs:
+ Same as below.
+
+ * MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs:
+ Same as below.
+
+ * MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs:
+ Don't use the CustomizationObject, wherever that comes
+ from(?). Instead, directly use TextEditorProperties so that
+ changing the defaults in TextEditorProperties changes it in the
+ Preferences dialog as well.
+
2007-02-21 Jeffrey Stedfast <[EMAIL PROTECTED]>
* EditorBindings.glade: Fixed the UseUnderline attribute for the
Modified:
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs
2007-02-23 16:41:06 UTC (rev 73373)
+++
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/BehaviorTextEditorPanel.cs
2007-02-23 17:02:33 UTC (rev 73374)
@@ -14,6 +14,7 @@
using MonoDevelop.Core;
using MonoDevelop.SourceEditor;
using MonoDevelop.SourceEditor.Document;
+using MonoDevelop.SourceEditor.Properties;
using MonoDevelop.Core.Gui.Dialogs;
using MonoDevelop.Components;
using MonoDevelop.SourceEditor.FormattingStrategy;
@@ -31,12 +32,12 @@
public override void LoadPanelContents ()
{
- Add (widget = new BehaviorTextEditorPanelWidget
((IProperties) CustomizationObject));
+ Add (widget = new BehaviorTextEditorPanelWidget ());
}
public override bool StorePanelContents ()
{
- widget.Store ((IProperties) CustomizationObject);
+ widget.Store ();
return true;
}
@@ -51,25 +52,23 @@
[Glade.Widget] RadioButton smartIndentStyle;
[Glade.Widget] SpinButton indentAndTabSizeSpinButton;
- public BehaviorTextEditorPanelWidget (IProperties
CustomizationObject) :
+ public BehaviorTextEditorPanelWidget () :
base ("EditorBindings.glade",
"BehaviorTextEditorPanel")
{
// FIXME: enable when it is implemented
autoinsertCurlyBraceCheckBox.Sensitive = false;
-
- // Set up Value
- autoinsertCurlyBraceCheckBox.Active =
((IProperties)CustomizationObject).GetProperty(
- "AutoInsertCurlyBracket", true);
- autoInsertTemplatesCheckBox.Active =
((IProperties)CustomizationObject).GetProperty(
- "AutoInsertTemplates", true);
- convertTabsToSpacesCheckBox.Active =
((IProperties)CustomizationObject).GetProperty(
- "TabsToSpaces", false);
-
+
+ // Set up Values
+ autoinsertCurlyBraceCheckBox.Active =
TextEditorProperties.AutoInsertCurlyBracket;
+
+ autoInsertTemplatesCheckBox.Active =
TextEditorProperties.AutoInsertTemplates;
+
+ convertTabsToSpacesCheckBox.Active =
TextEditorProperties.ConvertTabsToSpaces;
+
//FIXME: Only one of these should be selected
to hold the value
- indentAndTabSizeSpinButton.Value =
((IProperties)CustomizationObject).GetProperty(
- "TabIndent", 4);
-
- IndentStyle currentIndent =
(IndentStyle)((IProperties) CustomizationObject).GetProperty ("IndentStyle",
IndentStyle.Smart);
+ indentAndTabSizeSpinButton.Value =
TextEditorProperties.TabIndent;
+
+ IndentStyle currentIndent =
TextEditorProperties.IndentStyle;
if (currentIndent == IndentStyle.None)
noneIndentStyle.Active = true;
else if (currentIndent == IndentStyle.Auto)
@@ -78,24 +77,22 @@
smartIndentStyle.Active = true;
}
- public void Store (IProperties CustomizationObject)
+ public void Store ()
{
- ((IProperties)CustomizationObject).SetProperty(
- "TabsToSpaces",
convertTabsToSpacesCheckBox.Active);
- ((IProperties)CustomizationObject).SetProperty(
- "AutoInsertCurlyBracket",
autoinsertCurlyBraceCheckBox.Active);
- ((IProperties)CustomizationObject).SetProperty(
- "AutoInsertTemplates",
autoInsertTemplatesCheckBox.Active);
-
+ TextEditorProperties.ConvertTabsToSpaces =
convertTabsToSpacesCheckBox.Active;
+ TextEditorProperties.AutoInsertCurlyBracket =
autoinsertCurlyBraceCheckBox.Active;
+ TextEditorProperties.AutoInsertTemplates =
autoInsertTemplatesCheckBox.Active;
+
+
if (noneIndentStyle.Active)
-
((IProperties)CustomizationObject).SetProperty("IndentStyle", IndentStyle.None);
+ TextEditorProperties.IndentStyle =
IndentStyle.None;
else if (automaticIndentStyle.Active)
-
((IProperties)CustomizationObject).SetProperty("IndentStyle", IndentStyle.Auto);
+ TextEditorProperties.IndentStyle =
IndentStyle.Auto;
else if (smartIndentStyle.Active)
-
((IProperties)CustomizationObject).SetProperty("IndentStyle",
IndentStyle.Smart);
+ TextEditorProperties.IndentStyle =
IndentStyle.Smart;
//FIXME: Only one of these should be selected
to save the value
-
((IProperties)CustomizationObject).SetProperty("TabIndent",
indentAndTabSizeSpinButton.Value);
+ TextEditorProperties.TabIndent = (int)
indentAndTabSizeSpinButton.Value;
}
}
}
Modified:
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs
2007-02-23 16:41:06 UTC (rev 73373)
+++
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/GeneralTextEditorPanel.cs
2007-02-23 17:02:33 UTC (rev 73374)
@@ -13,6 +13,7 @@
using Pango;
using MonoDevelop.Core.Properties;
+using MonoDevelop.SourceEditor.Properties;
using MonoDevelop.Core;
using MonoDevelop.Core.Gui.Dialogs;
using MonoDevelop.Components;
@@ -28,12 +29,12 @@
public override void LoadPanelContents()
{
- Add (widget = new GeneralTextEditorPanelWidget
((IProperties) CustomizationObject));
+ Add (widget = new GeneralTextEditorPanelWidget ());
}
public override bool StorePanelContents()
{
- widget.Store ((IProperties) CustomizationObject);
+ widget.Store ();
return true;
}
@@ -47,29 +48,26 @@
[Glade.Widget] RadioButton use_sans;
[Glade.Widget] RadioButton use_cust;
- public GeneralTextEditorPanelWidget (IProperties
CustomizationObject) : base ("EditorBindings.glade", "GeneralTextEditorPanel")
+ public GeneralTextEditorPanelWidget () : base
("EditorBindings.glade", "GeneralTextEditorPanel")
{
encodingBox.Destroy(); // this is a really
dirty way of hiding encodingBox, but Hide() doesn't work
- enableCodeCompletionCheckBox.Active =
((IProperties) CustomizationObject).GetProperty(
- "EnableCodeCompletion", true);
+ enableCodeCompletionCheckBox.Active =
TextEditorProperties.EnableCodeCompletion;
- enableFoldingCheckBox.Active = ((IProperties)
CustomizationObject).GetProperty("EnableFolding", true);
-
- string font_name = ((IProperties)
CustomizationObject).GetProperty("DefaultFont", "__default_monospace").ToString
();
+ enableFoldingCheckBox.Active =
TextEditorProperties.EnableFolding;
- switch (font_name) {
- case "__default_monospace":
+ switch (TextEditorProperties.FontType) {
+ case EditorFontType.DefaultMonospace:
use_monospace.Active = true;
fontNameDisplayTextBox.Sensitive =
false;
break;
- case "__default_sans":
+ case EditorFontType.DefaultSans:
use_sans.Active = true;
fontNameDisplayTextBox.Sensitive =
false;
break;
default:
use_cust.Active = true;
+ fontNameDisplayTextBox.FontName =
TextEditorProperties.FontName;
fontNameDisplayTextBox.Sensitive = true;
- fontNameDisplayTextBox.FontName =
font_name;
break;
}
@@ -102,23 +100,19 @@
// textEncodingComboBox.Changed += new
EventHandler (OnOptionChanged);
}
- public void Store (IProperties CustomizationObject)
+ public void Store ()
{
- ((IProperties) CustomizationObject).SetProperty
(
- "EnableCodeCompletion",
enableCodeCompletionCheckBox.Active);
- ((IProperties) CustomizationObject).SetProperty
(
- "EnableFolding",
enableFoldingCheckBox.Active);
+ TextEditorProperties.EnableCodeCompletion =
enableCodeCompletionCheckBox.Active;
+ TextEditorProperties.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;
+ if (use_monospace.Active) {
+ TextEditorProperties.FontType =
EditorFontType.DefaultMonospace;
+ } else if (use_sans.Active) {
+ TextEditorProperties.FontType =
EditorFontType.DefaultSans;
+ } else {
+ TextEditorProperties.FontName =
fontNameDisplayTextBox.FontName;
+ }
- ((IProperties) CustomizationObject).SetProperty
(
- "DefaultFont", font_name);
// Console.WriteLine
(CharacterEncodings.GetEncodingByIndex (selectedIndex).CodePage);
// ((IProperties) CustomizationObject).SetProperty
(
//
"Encoding",CharacterEncodings.GetEncodingByIndex (selectedIndex).CodePage);
Modified:
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs
2007-02-23 16:41:06 UTC (rev 73373)
+++
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/MarkersTextEditorPanel.cs
2007-02-23 17:02:33 UTC (rev 73374)
@@ -9,6 +9,7 @@
using System.IO;
using MonoDevelop.SourceEditor.Document;
+using MonoDevelop.SourceEditor.Properties;
using MonoDevelop.Core.Properties;
using MonoDevelop.Core;
@@ -30,12 +31,12 @@
public override void LoadPanelContents()
{
// set up the form controls instance
- Add (widget = new MarkersTextEditorPanelWidget
((IProperties) CustomizationObject));
+ Add (widget = new MarkersTextEditorPanelWidget ());
}
public override bool StorePanelContents()
{
- widget.Store ((IProperties) CustomizationObject);
+ widget.Store ();
return true;
}
@@ -48,40 +49,35 @@
[Glade.Widget] CheckButton showVRulerCheckBox;
[Glade.Widget] SpinButton vRulerRowTextBox;
[Glade.Widget] ComboBox wrapModeComboBox;
-
- public MarkersTextEditorPanelWidget (IProperties
CustomizationObject) :
+
+ public MarkersTextEditorPanelWidget () :
base ("EditorBindings.glade",
"MarkersTextEditorPanel")
{
- showLineNumberCheckBox.Active =
((IProperties)CustomizationObject).GetProperty(
- "ShowLineNumbers", true);
- showBracketHighlighterCheckBox.Active =
((IProperties)CustomizationObject).GetProperty(
- "ShowBracketHighlight", true);
- showErrorsCheckBox.Active =
((IProperties)CustomizationObject).GetProperty(
- "ShowErrors", true);
- showVRulerCheckBox.Active =
((IProperties)CustomizationObject).GetProperty(
- "ShowVRuler", false);
-
- vRulerRowTextBox.Value =
((IProperties)CustomizationObject).GetProperty("VRulerRow", 80);
-
- wrapModeComboBox.Active = (int)
((IProperties)CustomizationObject).GetProperty(
- "WrapMode", WrapMode.None);
-
- // disabled
+ showLineNumberCheckBox.Active =
TextEditorProperties.ShowLineNumbers;
+ showBracketHighlighterCheckBox.Active =
TextEditorProperties.ShowMatchingBracket;
+ showErrorsCheckBox.Active =
TextEditorProperties.UnderlineErrors;
+
+ showVRulerCheckBox.Active =
TextEditorProperties.ShowVerticalRuler;
+ vRulerRowTextBox.Value =
TextEditorProperties.VerticalRulerRow;
+
+ wrapModeComboBox.Active = (int)
TextEditorProperties.WrapMode;
+
+ // FIXME: re-enable when implemented
showErrorsCheckBox.Sensitive = false;
}
- public void Store (IProperties CustomizationObject)
+ public void Store ()
{
-
((IProperties)CustomizationObject).SetProperty("ShowLineNumbers",
showLineNumberCheckBox.Active);
-
((IProperties)CustomizationObject).SetProperty("ShowBracketHighlight",
showBracketHighlighterCheckBox.Active);
-
((IProperties)CustomizationObject).SetProperty("ShowErrors",
showErrorsCheckBox.Active);
-
((IProperties)CustomizationObject).SetProperty("ShowVRuler",
showVRulerCheckBox.Active);
+ TextEditorProperties.ShowLineNumbers =
showLineNumberCheckBox.Active;
+ TextEditorProperties.ShowMatchingBracket =
showBracketHighlighterCheckBox.Active;
+ TextEditorProperties.UnderlineErrors =
showErrorsCheckBox.Active;
+ TextEditorProperties.ShowVerticalRuler =
showVRulerCheckBox.Active;
try {
-
((IProperties)CustomizationObject).SetProperty("VRulerRow",
vRulerRowTextBox.Value);
+ TextEditorProperties.VerticalRulerRow =
(int) vRulerRowTextBox.Value;
}
catch { }
try {
-
((IProperties)CustomizationObject).SetProperty("WrapMode", (WrapMode)
wrapModeComboBox.Active);
+ TextEditorProperties.WrapMode =
(WrapMode) wrapModeComboBox.Active;
}
catch { }
}
Modified:
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs
2007-02-23 16:41:06 UTC (rev 73373)
+++
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs
2007-02-23 17:02:33 UTC (rev 73374)
@@ -7,6 +7,7 @@
using GtkSourceView;
using MonoDevelop.Core.Properties;
+using MonoDevelop.SourceEditor.Properties;
using MonoDevelop.Core;
using MonoDevelop.Core.Gui.Dialogs;
using MonoDevelop.Components;
@@ -19,12 +20,12 @@
public override void LoadPanelContents()
{
- Add (widget = new SyntaxHighlightingPanelWidget
((IProperties) CustomizationObject));
+ Add (widget = new SyntaxHighlightingPanelWidget ());
}
public override bool StorePanelContents()
{
- widget.Store ((IProperties) CustomizationObject);
+ widget.Store ();
return true;
}
@@ -49,10 +50,10 @@
SourceTagStyle currentStyle;
string styleid;
- public SyntaxHighlightingPanelWidget (IProperties
CustomizationObject) : base ("EditorBindings.glade", "SyntaxHighlightingPanel")
+ public SyntaxHighlightingPanelWidget () : base
("EditorBindings.glade", "SyntaxHighlightingPanel")
{
- enableSyntaxHighlighting.Active =
((IProperties) CustomizationObject).GetProperty ("SyntaxHighlight", true);
-
+ enableSyntaxHighlighting.Active =
TextEditorProperties.SyntaxHighlight;
+
// add available sourceLanguages
ListStore store = new ListStore (typeof
(string));
foreach (SourceLanguage sl in
svs.AvailableLanguages)
@@ -69,9 +70,9 @@
stylesTreeView.Selection.Changed += new
EventHandler (OnStyleChanged);
}
- public void Store (IProperties CustomizationObject)
+ public void Store ()
{
- ((IProperties) CustomizationObject).SetProperty
("SyntaxHighlight", enableSyntaxHighlighting.Active);
+ TextEditorProperties.SyntaxHighlight =
enableSyntaxHighlighting.Active;
}
void SetCurrentLanguage (string name)
Modified:
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs
===================================================================
---
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs
2007-02-23 16:41:06 UTC (rev 73373)
+++
trunk/monodevelop/Extras/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Properties/TextEditorProperties.cs
2007-02-23 17:02:33 UTC (rev 73374)
@@ -38,6 +38,17 @@
Additive
}
+ public enum EditorFontType {
+ // Default Monospace font as set in the user's GNOME font
properties
+ DefaultMonospace,
+
+ // Default Sans font as set in the user's GNOME font properties
+ DefaultSans,
+
+ // Custom font, will need to get the FontName property for more
specifics
+ UserSpecified
+ }
+
public class TextEditorProperties {
static PropertyService propertyService =
(PropertyService)ServiceManager.GetService(typeof(PropertyService));
static IProperties properties = ((IProperties)
propertyService.GetProperty (
@@ -74,8 +85,7 @@
public static IndentStyle IndentStyle {
get {
- // FIXME: remember to change default to
IndentStyle.Smart
- return (IndentStyle)properties.GetProperty
("IndentStyle", IndentStyle.Auto);
+ return (IndentStyle)properties.GetProperty
("IndentStyle", IndentStyle.Smart);
}
set {
properties.SetProperty ("IndentStyle", value);
@@ -307,9 +317,46 @@
}
}
+ public static EditorFontType FontType {
+ get {
+ string name = FontName;
+
+ switch (name) {
+ case "__default_monospace":
+ return EditorFontType.DefaultMonospace;
+ case "__default_sans":
+ return EditorFontType.DefaultSans;
+ default:
+ return EditorFontType.UserSpecified;
+ }
+ }
+ set {
+ switch (value) {
+ case EditorFontType.DefaultMonospace:
+ FontName = "__default_monospace";
+ break;
+ case EditorFontType.DefaultSans:
+ FontName = "__default_sans";
+ break;
+ default:
+ // no-op - caller must set FontName
himself
+ break;
+ }
+ }
+ }
+
+ public static string FontName {
+ get {
+ return properties.GetProperty ("DefaultFont",
"__default_monospace");
+ }
+ set {
+ properties.SetProperty ("DefaultFont", value !=
null ? value : "__default_monospace");
+ }
+ }
+
public static FontDescription Font {
get {
- string s = properties.GetProperty
("DefaultFont", "__default_monospace");
+ string s = FontName;
switch (s) {
case "__default_monospace":
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches