Author: mkrueger
Date: 2008-01-25 05:28:29 -0500 (Fri, 25 Jan 2008)
New Revision: 93876

Modified:
   trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs
Log:
* Mono.TextEditor/TextEditor.cs, Mono.TextEditor/TextEditorOptions.cs:
  Added property change event.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-01-25 
10:00:05 UTC (rev 93875)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-01-25 
10:28:29 UTC (rev 93876)
@@ -1,5 +1,15 @@
 2008-01-25  Mike Krüger <[EMAIL PROTECTED]> 
 
+       * Mono.TextEditor/TextEditor.cs, Mono.TextEditor/TextEditorOptions.cs: 
Added
+         property change event.
+
+2008-01-25  Mike Krüger <[EMAIL PROTECTED]> 
+
+       * Mono.TextEditor/TextEditor.cs, Mono.TextEditor/TextEditorOptions.cs: 
Added
+         property change event.
+
+2008-01-25  Mike Krüger <[EMAIL PROTECTED]> 
+
        * Mono.TextEditor/DefaultEditActions.cs, 
Mono.TextEditor/TextEditorData.cs,
          Mono.TextEditor/TextEditor.cs, Mono.TextEditor.Highlighting/Style.cs:
          Editor is now capable of outputting rtf to clipboard.

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-01-25 10:00:05 UTC (rev 93875)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-01-25 10:28:29 UTC (rev 93876)
@@ -42,7 +42,6 @@
        public class TextEditor : Gtk.DrawingArea, IMargin
        {
                TextEditorData textEditorData = new TextEditorData ();
-               Mono.TextEditor.Highlighting.Style style = new 
Mono.TextEditor.Highlighting.Style ();
                protected Dictionary <int, EditAction> keyBindings = new 
Dictionary<int,EditAction> ();
                BookmarkMargin bookmarkMargin;
                GutterMargin   gutterMargin;
@@ -151,7 +150,6 @@
                        
                        layout = new Pango.Layout (this.PangoContext);
                        layout.Alignment = Pango.Alignment.Left;
-                       layout.FontDescription = TextEditorOptions.Options.Font;
                        
                        keyBindings.Add (GetKeyCode (Gdk.Key.Left), new 
CaretMoveLeft ());
                        keyBindings.Add (GetKeyCode (Gdk.Key.Left, 
Gdk.ModifierType.ShiftMask), new SelectionMoveLeft ());
@@ -264,13 +262,23 @@
                        };
                        this.ColorStyle = new DefaultStyle (this);
                        
-                       bookmarkMargin.IsVisible = 
TextEditorOptions.Options.ShowIconMargin;
-                       gutterMargin.IsVisible = 
TextEditorOptions.Options.ShowLineNumberMargin;
-                       foldMarkerMargin.IsVisible = 
TextEditorOptions.Options.ShowFoldMargin;
-                       
                        textCursor = new Gdk.Cursor (Gdk.CursorType.Xterm);
+                       OptionsChanged (this, EventArgs.Empty);
+                       TextEditorOptions.Changed += OptionsChanged;
                }
                
+               protected virtual void OptionsChanged (object sender, EventArgs 
args)
+               {
+                       layout.FontDescription = TextEditorOptions.Options.Font;
+                       layout.SetText ("H");
+                       layout.GetPixelSize (out this.charWidth, out 
this.lineHeight);
+                       
+                       bookmarkMargin.IsVisible   = 
TextEditorOptions.Options.ShowIconMargin;
+                       gutterMargin.IsVisible     = 
TextEditorOptions.Options.ShowLineNumberMargin;
+                       foldMarkerMargin.IsVisible = 
TextEditorOptions.Options.ShowFoldMargin;
+                       this.QueueDraw ();
+               }
+               
                protected override void OnRealized ()
                {
                        base.OnRealized ();
@@ -291,6 +299,7 @@
                
                public override void Destroy ()
                {
+                       TextEditorOptions.Changed -= OptionsChanged;
                        if (caretBlinkTimeoutId != 0)
                                GLib.Source.Remove (caretBlinkTimeoutId);
                        base.Destroy ();
@@ -626,7 +635,7 @@
                        }
                        if (line.EndOffset - offset > 0) {
                                if (Document.SyntaxMode != null) {
-                                       Chunk[] chunks = 
Document.SyntaxMode.GetChunks (Document, style, line, offset, line.Offset + 
line.EditableLength - offset);
+                                       Chunk[] chunks = 
Document.SyntaxMode.GetChunks (Document, TextEditorData.ColorStyle, line, 
offset, line.Offset + line.EditableLength - offset);
                                        int start  = offset;
                                        int xStart = xPos;
                                        offset = line.Offset + 
line.EditableLength - offset;
@@ -849,8 +858,6 @@
                {
                        Gdk.Window    win = e.Window;
                        Gdk.Rectangle area = e.Area;
-                       layout.SetText ("H");
-                       layout.GetPixelSize (out this.charWidth, out 
this.lineHeight);
                        
                        int width;
                        if (TextEditorOptions.Options.ShowRuler) {

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs
      2008-01-25 10:00:05 UTC (rev 93875)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs
      2008-01-25 10:28:29 UTC (rev 93876)
@@ -69,6 +69,7 @@
                        }
                        set {
                                tabsToSpaces = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -78,6 +79,7 @@
                        }
                        set {
                                indentationSize = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -87,6 +89,7 @@
                        }
                        set {
                                tabSize = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -96,6 +99,7 @@
                        }
                        set {
                                showIconMargin = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -105,6 +109,7 @@
                        }
                        set {
                                showLineNumberMargin = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -114,6 +119,7 @@
                        }
                        set {
                                showFoldMargin = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -123,6 +129,7 @@
                        }
                        set {
                                showInvalidLines = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -132,6 +139,7 @@
                        }
                        set {
                                showTabs = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -141,6 +149,7 @@
                        }
                        set {
                                showEolMarkers = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -150,6 +159,7 @@
                        }
                        set {
                                highlightCaretLine = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -159,6 +169,7 @@
                        }
                        set {
                                showSpaces = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -168,6 +179,7 @@
                        }
                        set {
                                rulerColumn = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -177,6 +189,7 @@
                        }
                        set {
                                showRuler = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
 
@@ -186,6 +199,7 @@
                        }
                        set {
                                autoIndent = value;
+                               OnChanged (EventArgs.Empty);
                        }
                }
                
@@ -194,7 +208,10 @@
                                return fontName;
                        }
                        set {
-                               fontName = !String.IsNullOrEmpty (value) ? 
value : DEFAULT_FONT;
+                               if (fontName != value) {
+                                       fontName = !String.IsNullOrEmpty 
(value) ? value : DEFAULT_FONT;
+                                       OnChanged (EventArgs.Empty);
+                               }
                        }
                }
                
@@ -202,6 +219,13 @@
                        get {
                                return Pango.FontDescription.FromString 
(FontName);
                        }
-               }               
+               }
+               
+               protected static void OnChanged (EventArgs args)
+               {
+                       if (Changed != null)
+                               Changed (null, args);
+               }
+               public static event EventHandler Changed;
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to