Author: lluis
Date: 2008-01-09 07:29:08 -0500 (Wed, 09 Jan 2008)
New Revision: 92496
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor/ChangeLog
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs
Log:
* MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs:
Don't store changes until OK is clicked. Fixes bug #344269.
Modified: trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor/ChangeLog
2008-01-09 11:44:43 UTC (rev 92495)
+++ trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor/ChangeLog
2008-01-09 12:29:08 UTC (rev 92496)
@@ -1,3 +1,8 @@
+2008-01-09 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs:
+ Don't store changes until OK is clicked. Fixes bug #344269.
+
2008-01-08 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* EditorBindings.glade,
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs
2008-01-09 11:44:43 UTC (rev 92495)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor/MonoDevelop.SourceEditor.Gui.OptionPanels/SyntaxHighlightingPanel.cs
2008-01-09 12:29:08 UTC (rev 92496)
@@ -2,6 +2,7 @@
using System.IO;
using System.Text;
using System.Collections;
+using System.Collections.Generic;
using Gtk;
using Pango;
@@ -52,6 +53,8 @@
SourceTagStyle currentStyle;
string styleid;
+
Dictionary<SourceLanguage,Dictionary<string,SourceTagStyle>> changes = new
Dictionary<SourceLanguage,Dictionary<string,SourceTagStyle>> ();
+
public SyntaxHighlightingPanelWidget () : base
("EditorBindings.glade", "SyntaxHighlightingPanel")
{
enableSyntaxHighlighting.Active =
TextEditorProperties.SyntaxHighlight;
@@ -75,6 +78,11 @@
public void Store ()
{
TextEditorProperties.SyntaxHighlight =
enableSyntaxHighlighting.Active;
+ foreach
(KeyValuePair<SourceLanguage,Dictionary<string,SourceTagStyle>> lang in
changes) {
+ foreach
(KeyValuePair<string,SourceTagStyle> style in lang.Value) {
+ lang.Key.SetTagStyle
(style.Key, style.Value);
+ }
+ }
}
void SetCurrentLanguage (string name)
@@ -120,7 +128,7 @@
sts.Underline = underlineToggle.Active;
sts.Strikethrough = strikeToggle.Active;
sts.IsDefault = false;
- currentLanguage.SetTagStyle (styleid, sts);
+ SetTagStyle (currentLanguage, styleid, sts);
restoreDefaultButton.Sensitive = true;
}
@@ -134,7 +142,7 @@
fgColorButton.Sensitive = checkColor.Active;
bgColorButton.Sensitive =
checkBackground.Active;
sts.IsDefault = false;
- currentLanguage.SetTagStyle (styleid, sts);
+ SetTagStyle (currentLanguage, styleid, sts);
restoreDefaultButton.Sensitive = true;
}
@@ -166,10 +174,31 @@
if (selection.GetSelected (out model, out
iter)) {
styleid = (string) model.GetValue
(iter, 1);
- currentStyle =
currentLanguage.GetTagStyle (styleid);
+ currentStyle = GetTagStyle
(currentLanguage, styleid);
SetSourceTagStyle ();
}
}
+
+ SourceTagStyle GetTagStyle (SourceLanguage lang, string
id)
+ {
+ Dictionary<string,SourceTagStyle> styles;
+ if (changes.TryGetValue (lang, out styles)) {
+ SourceTagStyle style;
+ if (styles.TryGetValue (id, out style))
+ return style;
+ }
+ return currentLanguage.GetTagStyle (styleid);
+ }
+
+ void SetTagStyle (SourceLanguage lang, string id,
SourceTagStyle style)
+ {
+ Dictionary<string,SourceTagStyle> styles;
+ if (!changes.TryGetValue (lang, out styles)) {
+ styles = new
Dictionary<string,SourceTagStyle> ();
+ changes [lang] = styles;
+ }
+ styles [id] = style;
+ }
}
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches