Author: mkrueger
Date: 2008-02-11 15:35:32 -0500 (Mon, 11 Feb 2008)
New Revision: 95463

Removed:
   trunk/monodevelop/main/src/addins/Mono.Texteditor/bookmark.png
Modified:
   trunk/monodevelop/main/src/addins/Mono.Texteditor/C64Style.xml
   trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
   trunk/monodevelop/main/src/addins/Mono.Texteditor/Makefile.am
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Style.cs
   trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/BookmarkMargin.cs
   trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Document.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/FoldMarkerMargin.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/GutterMargin.cs
   trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/IMargin.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
   trunk/monodevelop/main/src/addins/Mono.Texteditor/OblivionStyle.xml
   trunk/monodevelop/main/src/addins/Mono.Texteditor/TangoLightStyle.xml
   trunk/monodevelop/main/src/addins/Mono.Texteditor/UbuntuStyle.xml
Log:
* TangoLightStyle.xml, Mono.TextEditor.mdp, bookmark.png,
  OblivionStyle.xml, UbuntuStyle.xml,
  Mono.TextEditor/TextViewMargin.cs, Mono.TextEditor/Document.cs,
  Mono.TextEditor/FoldMarkerMargin.cs, Mono.TextEditor/IMargin.cs,
  Mono.TextEditor/TextEditor.cs, Mono.TextEditor/BookmarkMargin.cs,
  Mono.TextEditor/TextEditorOptions.cs,
  Mono.TextEditor/GutterMargin.cs,
  Mono.TextEditor.Highlighting/Style.cs, Makefile.am, C64Style.xml:
  Worked on text editor - performance & drawing improvements.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/C64Style.xml
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/C64Style.xml      
2008-02-11 20:12:44 UTC (rev 95462)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/C64Style.xml      
2008-02-11 20:35:32 UTC (rev 95463)
@@ -49,6 +49,9 @@
 
        <Style name="bracketHighlightRectangle" color="#97A0EF"/>
        <Style name="bracketHighlightBg" color="#3F3FDF"/>
+       
+       <Style name="bookmarkColor1" color="#3F3FDF"/>
+       <Style name="bookmarkColor2" color="#FFFFFF"/>
 
        <!-- highlighting -->
        <Style name="comment" color="white"/>

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-11 
20:12:44 UTC (rev 95462)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-11 
20:35:32 UTC (rev 95463)
@@ -1,3 +1,14 @@
+2008-02-11  Mike Krüger <[EMAIL PROTECTED]> 
+
+       * TangoLightStyle.xml, Mono.TextEditor.mdp, bookmark.png, 
OblivionStyle.xml,
+         UbuntuStyle.xml, Mono.TextEditor/TextViewMargin.cs,
+         Mono.TextEditor/Document.cs, Mono.TextEditor/FoldMarkerMargin.cs,
+         Mono.TextEditor/IMargin.cs, Mono.TextEditor/TextEditor.cs,
+         Mono.TextEditor/BookmarkMargin.cs, 
Mono.TextEditor/TextEditorOptions.cs,
+         Mono.TextEditor/GutterMargin.cs, 
Mono.TextEditor.Highlighting/Style.cs,
+         Makefile.am, C64Style.xml: Worked on text editor - performance & 
drawing
+         improvements.
+
 2008-02-11 Michael Hutchinson <[EMAIL PROTECTED]> 
 
        * Makefile.am: Fix location of installed assembly.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/Makefile.am
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/Makefile.am       
2008-02-11 20:12:44 UTC (rev 95462)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/Makefile.am       
2008-02-11 20:35:32 UTC (rev 95463)
@@ -3,6 +3,7 @@
 ASSEMBLY = $(top_builddir)/build/bin/Mono.TextEditor.dll
 REFS =  \
        $(GTK_SHARP_LIBS) \
+       -r:Mono.Cairo \
        -r:Mono.Posix \
        -r:System \
        -r:System.Xml
@@ -62,7 +63,6 @@
        
Mono.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/CaretMoveTests.cs
 
 RES =  \
-       bookmark.png \
        C64Style.xml \
        CPPSyntaxMode.xml \
        CSharpSyntaxMode.xml \

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/BookmarkMargin.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/BookmarkMargin.cs
 2008-02-11 20:12:44 UTC (rev 95462)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/BookmarkMargin.cs
 2008-02-11 20:35:32 UTC (rev 95463)
@@ -27,6 +27,7 @@
 
 using System;
 using Gtk;
+using Gdk;
 
 namespace Mono.TextEditor
 {
@@ -34,14 +35,8 @@
        {
                TextEditor editor;
                Gdk.GC backgroundGC, seperatorGC;
+               Cairo.Color color1, color2;
                
-               static Gdk.Pixbuf bookmarkPixbuf;
-               
-               static BookmarkMargin ()
-               {
-                       bookmarkPixbuf = Gdk.Pixbuf.LoadFromResource 
("bookmark.png");
-               }
-               
                public BookmarkMargin (TextEditor editor)
                {
                        this.editor = editor;
@@ -53,6 +48,18 @@
                        }
                }
                
+               public override void Dispose ()
+               {
+                       if (backgroundGC != null) {
+                               backgroundGC.Dispose ();
+                               backgroundGC = null;
+                       }
+                       if (seperatorGC != null) {
+                               seperatorGC.Dispose ();
+                               seperatorGC = null;
+                       }
+               }
+               
                public override void OptionsChanged ()
                {
                        backgroundGC = new Gdk.GC (editor.GdkWindow);
@@ -60,7 +67,30 @@
                        
                        seperatorGC = new Gdk.GC (editor.GdkWindow);
                        seperatorGC.RgbFgColor = 
editor.ColorStyle.IconBarSeperator;
+                       
+                       color1 = Convert (editor.ColorStyle.BookmarkColor1);
+                       color2 = Convert (editor.ColorStyle.BookmarkColor2);
                }
+               
+               static Cairo.Color Convert (Gdk.Color color)
+               {
+                       return new Cairo.Color (color.Red / 
(double)ushort.MaxValue, 
+                                               color.Green / 
(double)ushort.MaxValue, 
+                                               color.Blue / 
(double)ushort.MaxValue);
+               }
+               
+               public static void DrawRoundRectangle (Cairo.Context cr, int x, 
int y, int r, int w, int h)
+               {
+                       cr.MoveTo (x + r, y);
+                       cr.LineTo (x + w - r, y);
+                       cr.CurveTo (x + w, y, x + w, y, x + w, y + r);
+                       cr.LineTo (x + w, y + h - r);
+                       cr.CurveTo (x + w, y + h, x + w, y + h, x + w - r, y + 
h);
+                       cr.LineTo (x + r, y + h);
+                       cr.CurveTo (x, y + h, x, y + h, x, y + h - r);
+                       cr.LineTo (x, y + r);
+                       cr.CurveTo (x, y, x, y, x + r, y);
+               }
 
                public override void MousePressed (int button, int x, int y, 
bool doubleClick)
                {
@@ -83,8 +113,22 @@
                        win.DrawLine (seperatorGC, x + Width - 1, drawArea.Top, 
x + Width - 1, drawArea.Bottom);
                        if (line < editor.Splitter.LineCount) {
                                LineSegment lineSegment = 
editor.Document.GetLine (line);
-                               if (lineSegment.IsBookmarked) 
-                                       win.DrawPixbuf (backgroundGC, 
bookmarkPixbuf, 0, 0, x + 1, y, bookmarkPixbuf.Width, bookmarkPixbuf.Height, 
Gdk.RgbDither.None, 0, 0);
+                               if (lineSegment.IsBookmarked) {
+                                       Cairo.Context cr = 
Gdk.CairoHelper.Create (win);
+                                       DrawRoundRectangle (cr, x + 1, y + 1, 
8, Width - 4, editor.LineHeight - 4);
+                                       Cairo.Gradient pat = new 
Cairo.LinearGradient (x, y + editor.LineHeight, x + Width, y);
+                                       pat.AddColorStop (0, color1);
+                                       pat.AddColorStop (1, color2);
+                                       cr.Pattern = pat;
+                                       cr.FillPreserve ();
+                                       
+                                       pat = new Cairo.LinearGradient (x, y + 
editor.LineHeight, x + Width, y);
+                                       pat.AddColorStop (0, color2);
+                                       pat.AddColorStop (1, color1);
+                                       cr.Pattern = pat;
+                                       cr.Stroke ();
+                                       ((IDisposable)cr).Dispose();
+                               }
                        }
                }
        }

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Document.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Document.cs   
    2008-02-11 20:12:44 UTC (rev 95462)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Document.cs   
    2008-02-11 20:35:32 UTC (rev 95463)
@@ -298,10 +298,14 @@
                        }
                        if (i < foldSegments.Count)
                                newSegments.AddRange (foldSegments.GetRange (i, 
foldSegments.Count - i));
+                       bool needsUpdate = foldSegments.Count != 
newSegments.Count;
                        foldSegments = newSegments;
-                       
-                       RequestUpdate (new UpdateAll ());
-                       CommitDocumentUpdate ();
+                       if (needsUpdate) {
+                               System.Console.WriteLine("UPDATE!!!");
+                               RequestUpdate (new UpdateAll ());
+                               CommitDocumentUpdate ();
+                               
+                       }
                }
                
                public List<FoldSegment> GetFoldingsFromOffset (int offset)

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/FoldMarkerMargin.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/FoldMarkerMargin.cs
       2008-02-11 20:12:44 UTC (rev 95462)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/FoldMarkerMargin.cs
       2008-02-11 20:35:32 UTC (rev 95463)
@@ -99,6 +99,26 @@
                
                Gdk.GC foldBgGC, foldLineGC, foldLineHighlightedGC, 
foldToggleMarkerGC;
                
+               public override void Dispose ()
+               {
+                       if (foldBgGC != null) {
+                               foldBgGC.Dispose ();
+                               foldBgGC = null;
+                       }
+                       if (foldLineGC != null) {
+                               foldLineGC.Dispose ();
+                               foldLineGC = null;
+                       }
+                       if (foldLineHighlightedGC != null) {
+                               foldLineHighlightedGC.Dispose ();
+                               foldLineHighlightedGC = null;
+                       }
+                       if (foldToggleMarkerGC != null) {
+                               foldToggleMarkerGC.Dispose ();
+                               foldToggleMarkerGC = null;
+                       }
+               }
+               
                void DrawFoldSegment (Gdk.Window win, int x, int y, bool 
isOpen, bool isSelected)
                {
                        Gdk.Rectangle drawArea = new Gdk.Rectangle (x + 3, y + 
3, foldSegmentSize, foldSegmentSize);

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/GutterMargin.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/GutterMargin.cs
   2008-02-11 20:12:44 UTC (rev 95462)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/GutterMargin.cs
   2008-02-11 20:35:32 UTC (rev 95463)
@@ -31,7 +31,7 @@
 
 namespace Mono.TextEditor
 {
-       public class GutterMargin : AbstractMargin, System.IDisposable
+       public class GutterMargin : AbstractMargin
        {
                TextEditor editor;
                Pango.Layout layout;
@@ -84,6 +84,25 @@
                                }
                        }
                }
+               public override void Dispose ()
+               {
+                       if (layout != null) {
+                               layout.Dispose ();
+                               layout = null;
+                       }
+                       if (lineNumberBgGC != null) {
+                               lineNumberBgGC.Dispose ();
+                               lineNumberBgGC = null;
+                       }
+                       if (lineNumberGC != null) {
+                               lineNumberGC.Dispose ();
+                               lineNumberGC = null;
+                       }
+                       if (lineNumberHighlightGC != null) {
+                               lineNumberHighlightGC.Dispose ();
+                               lineNumberHighlightGC = null;
+                       }
+               }
                
                Gdk.GC lineNumberBgGC, lineNumberGC, lineNumberHighlightGC;
                public override void OptionsChanged ()
@@ -109,13 +128,5 @@
                        }
                }
                
-               void IDisposable.Dispose ()
-               {
-                       System.Console.WriteLine("Gutter dispose");
-                       if (layout != null) {
-                               layout.Dispose ();
-                               layout = null;
-                       }
-               }
        }
 }
\ No newline at end of file

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/IMargin.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/IMargin.cs    
    2008-02-11 20:12:44 UTC (rev 95462)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/IMargin.cs    
    2008-02-11 20:35:32 UTC (rev 95463)
@@ -53,7 +53,7 @@
                void MouseLeft ();
        }
        
-       public abstract class AbstractMargin : IMargin
+       public abstract class AbstractMargin : IMargin, IDisposable
        {
                public abstract int Width {
                        get;
@@ -94,5 +94,9 @@
                public virtual void MouseLeft ()
                {
                }
+               public virtual void Dispose ()
+               {
+               }
+               
        }
 }

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-02-11 20:12:44 UTC (rev 95462)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-02-11 20:35:32 UTC (rev 95463)
@@ -52,6 +52,8 @@
                List<IMargin> margins = new List<IMargin> ();
                int oldRequest = -1;
                
+               bool isDisposed = false;
+               
                public Document Document {
                        get {
                                return textEditorData.Document;
@@ -259,6 +261,9 @@
                        Gtk.TargetList list = new Gtk.TargetList ();
                        list.AddTextTargets (CopyAction.TextType);
                        Gtk.Drag.DestSet (this, DestDefaults.All, 
(TargetEntry[])list, DragAction.Move | DragAction.Copy);
+                       this.Destroyed += delegate {
+                               Dispose ();
+                       };
                }
                
                protected virtual void OptionsChanged (object sender, EventArgs 
args)
@@ -287,6 +292,9 @@
                
                public override void Dispose ()
                {
+                       if (isDisposed)
+                               return;
+                       this.isDisposed = true;
                        TextEditorOptions.Changed -= OptionsChanged;
                        
                        foreach (IMargin margin in this.margins) {
@@ -299,17 +307,23 @@
                
                internal void RedrawLine (int logicalLine)
                {
+                       if (isDisposed)
+                               return;
                        this.QueueDrawArea (0, 
(int)-this.textEditorData.VAdjustment.Value + Document.LogicalToVisualLine 
(logicalLine) * LineHeight, this.Allocation.Width, LineHeight);
                }
                
                internal void RedrawPosition (int logicalLine, int 
logicalColumn)
                {
+                       if (isDisposed)
+                               return;
                        RedrawLine (logicalLine);
 //                     this.QueueDrawArea (0, 
(int)-this.textEditorData.VAdjustment.Value + Document.LogicalToVisualLine 
(logicalLine) * LineHeight, this.Allocation.Width, LineHeight);
                }
                
                internal void RedrawLines (int start, int end)
                {
+                       if (isDisposed)
+                               return;
                        int visualStart = 
(int)-this.textEditorData.VAdjustment.Value + Document.LogicalToVisualLine 
(start) * LineHeight;
                        int visualEnd   = 
(int)-this.textEditorData.VAdjustment.Value + Document.LogicalToVisualLine 
(end) * LineHeight + LineHeight;
                        this.QueueDrawArea (0, visualStart, 
this.Allocation.Width, visualEnd - visualStart );
@@ -317,11 +331,15 @@
                
                internal void RedrawFromLine (int logicalLine)
                {
+                       if (isDisposed)
+                               return;
                        this.QueueDrawArea (0, 
(int)-this.textEditorData.VAdjustment.Value + Document.LogicalToVisualLine 
(logicalLine) * LineHeight, this.Allocation.Width, this.Allocation.Height);
                }
        
                public void SimulateKeyPress (Gdk.Key key, Gdk.ModifierType 
modifier)
                {
+                       if (isDisposed)
+                               return;
                        int keyCode = GetKeyCode (key, modifier);
                        if (keyBindings.ContainsKey (keyCode)) {
                                try {
@@ -364,7 +382,7 @@
                {
                        base.IsFocus = true;
                        if (lastTime != e.Time) {// filter double clicks
-                               if (e.Type == EventType.TwoButtonPress) {       
                        
+                               if (e.Type == EventType.TwoButtonPress) {
                                    lastTime = e.Time;
                                        mousePressed = false;
                                } else {

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs
      2008-02-11 20:12:44 UTC (rev 95462)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditorOptions.cs
      2008-02-11 20:35:32 UTC (rev 95463)
@@ -64,6 +64,7 @@
                bool highlightMatchingBracket = true;
                bool highlightCaretLine = false;
                string fontName = DEFAULT_FONT;
+               string colorStyle = "Default";
                
                public string IndentationString {
                        get {
@@ -252,10 +253,18 @@
                        }
                }
                
-               
+               public virtual string ColorSheme {
+                       get {
+                               return colorStyle;
+                       }
+                       set {
+                               colorStyle = value;
+                               OnChanged (EventArgs.Empty);
+                       }
+               }
                public virtual Style GetColorStyle (Gtk.Widget widget)
                {
-                       return new DefaultStyle (widget);
+                       return SyntaxModeService.GetColorStyle (widget, 
ColorSheme);
                }
                
                protected static void OnChanged (EventArgs args)

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
 2008-02-11 20:12:44 UTC (rev 95462)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
 2008-02-11 20:35:32 UTC (rev 95463)
@@ -36,7 +36,7 @@
 
 namespace Mono.TextEditor
 {
-       public class TextViewMargin : AbstractMargin, System.IDisposable
+       public class TextViewMargin : AbstractMargin
        {
                TextEditor textEditor;
                Pango.Layout tabMarker, spaceMarker, eolMarker, 
invalidLineMarker;
@@ -51,7 +51,6 @@
                Gdk.Cursor defaultCursor;
                Gdk.Cursor textCursor;
                
-               
                int lineHeight = 16;
                public int LineHeight {
                        get {
@@ -166,10 +165,34 @@
                        layout.GetPixelSize (out this.charWidth, out 
this.lineHeight);
                }
                
-               public void Dispose ()
+               public override void Dispose ()
                {
                        if (caretBlinkTimeoutId != 0)
                                GLib.Source.Remove (caretBlinkTimeoutId);
+                       if (layout != null) {
+                               layout.Dispose ();
+                               layout = null;
+                       }
+                       if (gc != null) {
+                               gc.Dispose ();
+                               gc = null;
+                       }
+                       if (tabMarker != null) {
+                               tabMarker.Dispose ();
+                               tabMarker = null;
+                       }
+                       if (spaceMarker != null) {
+                               spaceMarker.Dispose ();
+                               spaceMarker = null;
+                       }
+                       if (eolMarker != null) {
+                               eolMarker.Dispose ();
+                               eolMarker = null;
+                       }
+                       if (invalidLineMarker != null) {
+                               invalidLineMarker.Dispose ();
+                               invalidLineMarker = null;
+                       }
                }
                
                public void ResetCaretBlink ()
@@ -212,7 +235,6 @@
 //                     int start  = offset;
                        int xStart = xPos;
                        int index = line.Offset + line.EditableLength - offset;
-                       Gdk.Color selectedTextColor = ColorStyle.SelectedFg;
                        int selectionStart = TextEditorData.SelectionStart != 
null ? TextEditorData.SelectionStart.Segment.Offset + 
TextEditorData.SelectionStart.Column : -1;
                        int selectionEnd = TextEditorData.SelectionEnd != null 
? TextEditorData.SelectionEnd.Segment.Offset + 
TextEditorData.SelectionEnd.Column : -1;
                        if (selectionStart > selectionEnd) {
@@ -238,19 +260,19 @@
 //                             Console.WriteLine ("#" + chunks.Length);
                        foreach (Chunk chunk in chunks) {
                                if (chunk.Offset >= selectionStart && 
chunk.EndOffset <= selectionEnd) {
-                                       DrawTextWithHighlightedWs (win, 
selectedTextColor, chunk.Style.Bold, chunk.Style.Italic, ref xPos, y, 
Document.Buffer.GetTextAt (chunk));
+                                       DrawTextWithHighlightedWs (win, true, 
chunk.Style, ref xPos, y, Document.Buffer.GetTextAt (chunk));
                                } else if (chunk.Offset >= selectionStart && 
chunk.Offset < selectionEnd && chunk.EndOffset > selectionEnd) {
-                                       DrawTextWithHighlightedWs (win, 
selectedTextColor, chunk.Style.Bold, chunk.Style.Italic, ref xPos, y, 
Document.Buffer.GetTextAt (chunk.Offset, selectionEnd - chunk.Offset));
-                                       DrawTextWithHighlightedWs (win, 
chunk.Style.Color, chunk.Style.Bold, chunk.Style.Italic, ref xPos, y, 
Document.Buffer.GetTextAt (selectionEnd, chunk.EndOffset - selectionEnd));
+                                       DrawTextWithHighlightedWs (win, true, 
chunk.Style, ref xPos, y, Document.Buffer.GetTextAt (chunk.Offset, selectionEnd 
- chunk.Offset));
+                                       DrawTextWithHighlightedWs (win, false, 
chunk.Style, ref xPos, y, Document.Buffer.GetTextAt (selectionEnd, 
chunk.EndOffset - selectionEnd));
                                } else if (chunk.Offset < selectionStart && 
chunk.EndOffset > selectionStart && chunk.EndOffset <= selectionEnd) {
-                                       DrawTextWithHighlightedWs (win, 
chunk.Style.Color, chunk.Style.Bold, chunk.Style.Italic, ref xPos, y, 
Document.Buffer.GetTextAt (chunk.Offset, selectionStart - chunk.Offset));
-                                       DrawTextWithHighlightedWs (win, 
selectedTextColor, chunk.Style.Bold, chunk.Style.Italic, ref xPos, y, 
Document.Buffer.GetTextAt (selectionStart, chunk.EndOffset - selectionStart));
+                                       DrawTextWithHighlightedWs (win, false, 
chunk.Style, ref xPos, y, Document.Buffer.GetTextAt (chunk.Offset, 
selectionStart - chunk.Offset));
+                                       DrawTextWithHighlightedWs (win, true, 
chunk.Style, ref xPos, y, Document.Buffer.GetTextAt (selectionStart, 
chunk.EndOffset - selectionStart));
                                } else if (chunk.Offset < selectionStart && 
chunk.EndOffset > selectionEnd) {
-                                       DrawTextWithHighlightedWs (win, 
chunk.Style.Color, chunk.Style.Bold, chunk.Style.Italic, ref xPos, y, 
Document.Buffer.GetTextAt (chunk.Offset, selectionStart - chunk.Offset));
-                                       DrawTextWithHighlightedWs (win, 
selectedTextColor, chunk.Style.Bold, chunk.Style.Italic, ref xPos, y, 
Document.Buffer.GetTextAt (selectionStart, selectionEnd - selectionStart));
-                                       DrawTextWithHighlightedWs (win, 
chunk.Style.Color, chunk.Style.Bold, chunk.Style.Italic, ref xPos, y, 
Document.Buffer.GetTextAt (selectionEnd, chunk.EndOffset - selectionEnd));
+                                       DrawTextWithHighlightedWs (win, false, 
chunk.Style, ref xPos, y, Document.Buffer.GetTextAt (chunk.Offset, 
selectionStart - chunk.Offset));
+                                       DrawTextWithHighlightedWs (win, true, 
chunk.Style, ref xPos, y, Document.Buffer.GetTextAt (selectionStart, 
selectionEnd - selectionStart));
+                                       DrawTextWithHighlightedWs (win, false, 
chunk.Style, ref xPos, y, Document.Buffer.GetTextAt (selectionEnd, 
chunk.EndOffset - selectionEnd));
                                } else 
-                                       DrawTextWithHighlightedWs (win, 
chunk.Style.Color, chunk.Style.Bold, chunk.Style.Italic, ref xPos, y, 
Document.Buffer.GetTextAt (chunk));
+                                       DrawTextWithHighlightedWs (win, false, 
chunk.Style, ref xPos, y, Document.Buffer.GetTextAt (chunk));
                        }
                        if (line.Markers != null) {
                                foreach (TextMarker marker in line.Markers) {
@@ -265,26 +287,26 @@
                        }
                }
                
-               void DrawTextWithHighlightedWs (Gdk.Window win, Gdk.Color 
defaultColor, bool bold, bool italic, ref int xPos, int y, string text)
+               void DrawTextWithHighlightedWs (Gdk.Window win, bool selected, 
ChunkStyle style, ref int xPos, int y, string text)
                {
                        string[] spaces = text.Split (' ');
                        for (int i = 0; i < spaces.Length; i++) {
                                string[] tabs = spaces[i].Split ('\t');
                                
                                for (int j = 0; j < tabs.Length; j++) {
-                                       gc.RgbFgColor = defaultColor;
-                                       if (bold)
+                                       gc.RgbFgColor = selected ? 
ColorStyle.SelectedFg : style.Color;
+                                       if (style.Bold)
                                                layout.FontDescription.Weight = 
Pango.Weight.Bold; 
-                                       if (italic)
+                                       if (style.Italic)
                                                layout.FontDescription.Style  = 
Pango.Style.Italic; 
                                        DrawText (win, ref xPos, y, tabs[j]);
-                                       if (bold)
+                                       if (style.Bold)
                                                layout.FontDescription.Weight = 
Pango.Weight.Normal; 
-                                       if (italic)
+                                       if (style.Italic)
                                                layout.FontDescription.Style  = 
Pango.Style.Normal; 
                                        if (j + 1 < tabs.Length) {
                                                if 
(TextEditorOptions.Options.ShowTabs) { 
-                                                       DrawTabMarker (win, ref 
xPos, y);
+                                                       DrawTabMarker (win, 
selected, ref xPos, y);
                                                } else {
                                                        DrawText (win, ref 
xPos, y, new string (' ', TextEditorOptions.Options.TabSize));
                                                }
@@ -293,7 +315,7 @@
                                
                                if (i + 1 < spaces.Length) {
                                        if 
(TextEditorOptions.Options.ShowSpaces) { 
-                                               DrawSpaceMarker (win, ref xPos, 
y);
+                                               DrawSpaceMarker (win, selected, 
ref xPos, y);
                                        } else {
                                                DrawText (win, ref xPos, y, " 
");
                                        }
@@ -310,22 +332,22 @@
                        xPos += width;
                }
                
-               void DrawEolMarker (Gdk.Window win, ref int xPos, int y)
+               void DrawEolMarker (Gdk.Window win, bool selected, ref int 
xPos, int y)
                {
-                       gc.RgbFgColor = ColorStyle.WhitespaceMarker;
+                       gc.RgbFgColor = selected ? ColorStyle.SelectedFg : 
ColorStyle.WhitespaceMarker;
                        win.DrawLayout (gc, xPos, y, eolMarker);
                }
                
-               void DrawSpaceMarker (Gdk.Window win, ref int xPos, int y)
+               void DrawSpaceMarker (Gdk.Window win, bool selected, ref int 
xPos, int y)
                {
-                       gc.RgbFgColor = ColorStyle.WhitespaceMarker;
+                       gc.RgbFgColor = selected ? ColorStyle.SelectedFg : 
ColorStyle.WhitespaceMarker;
                        win.DrawLayout (gc, xPos, y, spaceMarker);
                        xPos += charWidth;
                }
                
-               void DrawTabMarker (Gdk.Window win, ref int xPos, int y)
+               void DrawTabMarker (Gdk.Window win, bool selected, ref int 
xPos, int y)
                {
-                       gc.RgbFgColor = ColorStyle.WhitespaceMarker;
+                       gc.RgbFgColor = selected ? ColorStyle.SelectedFg : 
ColorStyle.WhitespaceMarker;
                        win.DrawLayout (gc, xPos, y, tabMarker);
                        xPos += charWidth * TextEditorOptions.Options.TabSize;
                }
@@ -351,7 +373,7 @@
                                        new CaretMoveToDocumentEnd ().Run 
(TextEditorData);
                                        return;
                                }
-                               if  (doubleClick) {
+                               if (doubleClick) {
                                        int start = ScanWord (offset, false);
                                        int end   = ScanWord (offset, true);
                                        if (TextEditorData.IsSomethingSelected) 
{
@@ -457,6 +479,7 @@
                        Gdk.Rectangle lineArea = new Gdk.Rectangle (x, y, 
area.Width - x, LineHeight);
                        bool isSelected = false;
                        bool drawDefaultBg = true;
+                       bool eolSelected = false;
                        Gdk.Color defaultStateType = lineNr == Caret.Line && 
TextEditorOptions.Options.HighlightCaretLine ? this.ColorStyle.LineMarker : 
this.ColorStyle.Background;
                        
                        if (line != null && TextEditorData.SelectionStart != 
null && TextEditorData.SelectionEnd != null) {
@@ -505,16 +528,17 @@
                                        // draw remaining line (unselected, if 
in middle, otherwise rest of line is selected)
                                        lineArea = new Gdk.Rectangle 
(System.Math.Max (x, lineArea.Right), y, area.Width - System.Math.Max (x, 
lineArea.Right), LineHeight);
                                        DrawRectangleWithRuler (win, x, 
lineArea, selectionColumnEnd >= 0 ? defaultStateType : 
this.ColorStyle.SelectedBg);
+                                       eolSelected = true;
                                        drawDefaultBg = false;
                                }
                        }
                        int width, height;
                        
                        if (drawDefaultBg) {
+                               eolSelected = isSelected;
                                DrawRectangleWithRuler (win, x, lineArea, 
isSelected ? this.ColorStyle.SelectedBg : defaultStateType);
                        }
                        
-                       
                        if (TextEditorOptions.Options.ShowRuler) {
                                gc.RgbFgColor = ColorStyle.Ruler;
                                win.DrawLine (gc, x + rulerX, y, x + rulerX, y 
+ LineHeight); 
@@ -577,7 +601,7 @@
                        if (line.EndOffset - offset > 0)
                                DrawLineText (win, line, offset, line.Offset + 
line.EditableLength - offset, ref xPos, y);
                        if (TextEditorOptions.Options.ShowEolMarkers) 
-                               DrawEolMarker (win, ref xPos, y);
+                               DrawEolMarker (win, eolSelected, ref xPos, y);
                        if (caretOffset == line.Offset + line.EditableLength)
                                DrawCaret (win, xPos, y);
                }

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Style.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Style.cs
     2008-02-11 20:12:44 UTC (rev 95462)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Style.cs
     2008-02-11 20:35:32 UTC (rev 95463)
@@ -41,7 +41,10 @@
                Color caret;
                Color lineMarker, ruler, whitespaceMarker, invalidLineMarker;
                
+               Color bookmarkColor1, bookmarkColor2;
+               
                Color lineNumberFg, lineNumberBg, lineNumberFgHighlighted;
+               
                Color iconBarBg, iconBarSeperator;
                Color bracketHighlightBg, bracketHighlightRectangle;
                Color foldLine, foldLineHighlighted, foldBg, foldToggleMarker;
@@ -161,13 +164,25 @@
                                return bracketHighlightBg;
                        }
                }
-
+               
                public virtual Color BracketHighlightRectangle {
                        get {
                                return bracketHighlightRectangle;
                        }
                }
-
+               
+               public virtual Color BookmarkColor2 {
+                       get {
+                               return bookmarkColor2;
+                       }
+               }
+               
+               public virtual Color BookmarkColor1 {
+                       get {
+                               return bookmarkColor1;
+                       }
+               }
+               
                public string Name {
                        get {
                                return name;
@@ -179,7 +194,7 @@
                                return description;
                        }
                }
-
+               
                public Style ()
                {
                        
@@ -207,6 +222,10 @@
                        bracketHighlightBg        = new Gdk.Color (196, 196, 
196);
                        bracketHighlightRectangle = new Gdk.Color (128, 128, 
128);
                        
+                       bookmarkColor1 = new Gdk.Color (105, 156, 235);
+                       bookmarkColor2 = new Gdk.Color (255, 255, 255);
+                       
+                       
                        SetStyle ("comment", new Mono.TextEditor.ChunkStyle 
(new Gdk.Color (0, 0, 255), false, false));
                        SetStyle ("altcomment", new Mono.TextEditor.ChunkStyle 
(new Gdk.Color (128, 128, 128), true, false));
                        SetStyle ("todocomment", new Mono.TextEditor.ChunkStyle 
(new Gdk.Color (0, 0, 255), true, false));
@@ -290,11 +309,13 @@
                        case "foldToggleMarker":
                        case "bracketHighlightRectangle":
                        case "bracketHighlightBg":
+                       case "bookmarkColor1":
+                       case "bookmarkColor2":
                                return false;
                        }
                        return true;
                }
-                                       
+               
                Gdk.Color GetColor (string colorString)
                {
                        if (customPalette.ContainsKey (colorString))
@@ -371,6 +392,12 @@
                        case "bracketHighlightBg":
                                this.bracketHighlightBg = color;
                                break;
+                       case "bookmarkColor1":
+                               this.bookmarkColor1 = color;
+                               break;
+                       case "bookmarkColor2":
+                               this.bookmarkColor2 = color;
+                               break;
                        default:
                                throw new Exception ("color  " + name + " 
invalid.");
                        }

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp       
2008-02-11 20:12:44 UTC (rev 95462)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp       
2008-02-11 20:35:32 UTC (rev 95463)
@@ -55,7 +55,6 @@
     <File name="JavaSyntaxMode.xml" subtype="Code" 
buildaction="EmbedAsResource" />
     <File name="CSyntaxMode.xml" subtype="Code" buildaction="EmbedAsResource" 
/>
     <File name="CPPSyntaxMode.xml" subtype="Code" 
buildaction="EmbedAsResource" />
-    <File name="bookmark.png" subtype="Code" buildaction="EmbedAsResource" />
     <File name="Mono.TextEditor.Highlighting/ChunkStyle.cs" subtype="Code" 
buildaction="Compile" />
     <File name="Mono.TextEditor.Highlighting/Match.cs" subtype="Code" 
buildaction="Compile" />
     <File name="Mono.TextEditor.Highlighting/Span.cs" subtype="Code" 
buildaction="Compile" />
@@ -80,6 +79,7 @@
     <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, 
Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
     <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, 
Version=2.10.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <ProjectReference type="Gac" localcopy="True" refto="Mono.Cairo, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
   </References>
   <GtkDesignInfo isWidgetLibrary="True" gtkVersion="2.10.2">
     <ExportedWidgets>

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/OblivionStyle.xml
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/OblivionStyle.xml 
2008-02-11 20:12:44 UTC (rev 95462)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/OblivionStyle.xml 
2008-02-11 20:35:32 UTC (rev 95463)
@@ -80,6 +80,9 @@
        <Style name="bracketHighlightRectangle" color="aluminium4"/>
        <Style name="bracketHighlightBg" color="aluminium6"/>
 
+       <Style name="bookmarkColor1" color="aluminium1"/>
+       <Style name="bookmarkColor2" color="aluminium4"/>
+
        <!-- highlighting -->
        <Style name="comment" color="aluminium4"/>
        <Style name="altcomment" color="aluminium4"/>

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/TangoLightStyle.xml
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/TangoLightStyle.xml       
2008-02-11 20:12:44 UTC (rev 95462)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/TangoLightStyle.xml       
2008-02-11 20:35:32 UTC (rev 95463)
@@ -69,7 +69,7 @@
        <Style name="lineNumberHighlighted" color="aluminium5"/>
        <Style name="lineNumberBg" color="white"/>
        
-       <Style name="iconBar" color="white"/>
+       <Style name="iconBar" color="aluminium1"/>
        <Style name="iconBarSeperator" color="aluminium3"/>
 
        <Style name="foldLine" color="aluminium3"/>
@@ -79,6 +79,9 @@
        
        <Style name="bracketHighlightRectangle" color="aluminium4"/>
        <Style name="bracketHighlightBg" color="aluminium1"/>
+       
+       <Style name="bookmarkColor1" color="skyblue2"/>
+       <Style name="bookmarkColor2" color="white"/>
 
        <!-- highlighting -->
        <Style name="comment" color="chameleon3"/>

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/UbuntuStyle.xml
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/UbuntuStyle.xml   
2008-02-11 20:12:44 UTC (rev 95462)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/UbuntuStyle.xml   
2008-02-11 20:35:32 UTC (rev 95463)
@@ -74,7 +74,7 @@
        
        <Style name="lineMarker" color="accent_yellow_highlight"/>
        <Style name="ruler" color="accent_blue_highlight"/>
-       <Style name="whitespaces" color="accent_blue_highlight"/>
+       <Style name="whitespaces" color="human"/>
        <Style name="invalidLines" color="accent_red_base"/>
 
        <Style name="lineNumber" color="human"/>
@@ -92,6 +92,9 @@
        <Style name="bracketHighlightRectangle" 
color="environmental_blue_medium"/>
        <Style name="bracketHighlightBg" color="environmental_blue_highlight"/>
 
+       <Style name="bookmarkColor1" color="human_highlight"/>
+       <Style name="bookmarkColor2" color="human_base"/>
+
        <!-- highlighting -->
        <Style name="comment" color="accent_green_base"/>
        <Style name="altcomment" color="accent_green_base"/>

Deleted: trunk/monodevelop/main/src/addins/Mono.Texteditor/bookmark.png
===================================================================
(Binary files differ)

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

Reply via email to