Author: mkrueger
Date: 2008-01-30 10:48:29 -0500 (Wed, 30 Jan 2008)
New Revision: 94389

Added:
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Match.cs
   trunk/monodevelop/main/src/addins/Mono.Texteditor/TangoStyle.xml
Modified:
   trunk/monodevelop/main/src/addins/Mono.Texteditor/CSharpSyntaxMode.xml
   trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Keywords.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Rule.cs
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs
   trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp
   
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
   trunk/monodevelop/main/src/addins/Mono.Texteditor/OblivionStyle.xml
Log:
* Mono.TextEditor.mdp, OblivionStyle.xml,
  Mono.TextEditor/TextEditor.cs,
  Mono.TextEditor.Highlighting/SyntaxMode.cs,
  Mono.TextEditor.Highlighting/Match.cs,
  Mono.TextEditor.Highlighting/Rule.cs,
  Mono.TextEditor.Highlighting/Keywords.cs, TangoStyle.xml,
  CSharpSyntaxMode.xml: Worked on styling.

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/CSharpSyntaxMode.xml
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/CSharpSyntaxMode.xml      
2008-01-30 15:30:27 UTC (rev 94388)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/CSharpSyntaxMode.xml      
2008-01-30 15:48:29 UTC (rev 94389)
@@ -24,7 +24,6 @@
  THE SOFTWARE. -->
  
 <SyntaxMode name = "C#" mimeType="text/x-csharp">
-       <Delimiters>&amp;&lt;&gt;~!%^*()-+=|\#/{}[]:;"' ,       .?</Delimiters>
 
        <EolSpan color = "preprocessor" rule="PreProcessor">#</EolSpan>
        <EolSpan color = "comment" rule="XmlDocumentation" 
tagColor="commenttag">///</EolSpan>
@@ -49,7 +48,11 @@
                <Begin>&apos;</Begin>
                <End>&apos;</End>
        </Span>
-       
+       
+       <Match color = "literal">\d+(U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?</Match>
+       <Match color = 
"literal">0[xX][a-fA-F\d]+(U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?</Match>
+       <Match color = "literal">\d+(\.\d+)?([eE][+-]\d+)?[FfDdMm]?</Match>
+       
        <Keywords color = "kw:access">
                <Word>this</Word>
                <Word>base</Word>

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-01-30 
15:30:27 UTC (rev 94388)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-01-30 
15:48:29 UTC (rev 94389)
@@ -1,3 +1,12 @@
+2008-01-30  Mike Krüger <[EMAIL PROTECTED]> 
+
+       * Mono.TextEditor.mdp, OblivionStyle.xml, Mono.TextEditor/TextEditor.cs,
+         Mono.TextEditor.Highlighting/SyntaxMode.cs,
+         Mono.TextEditor.Highlighting/Match.cs,
+         Mono.TextEditor.Highlighting/Rule.cs,
+         Mono.TextEditor.Highlighting/Keywords.cs, TangoStyle.xml,
+         CSharpSyntaxMode.xml: Worked on styling.
+
 2008-01-29  Mike Krüger <[EMAIL PROTECTED]> 
 
        * OblivionStyle.xml, Mono.TextEditor/DefaultEditActions.cs,

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-30 15:30:27 UTC (rev 94388)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextEditor.cs 
    2008-01-30 15:48:29 UTC (rev 94389)
@@ -760,9 +760,9 @@
                                        selectionEnd = selectionStart;
                                        selectionStart = tmp;
                                }
-//                                     Console.WriteLine ("#" + chunks.Length);
+//                             Console.WriteLine ("#" + chunks.Length);
                                foreach (Chunk chunk in chunks) {
-//                                             Console.WriteLine (chunk + " 
style:" + chunk.Style);
+//                                     Console.WriteLine (chunk + " style:" + 
chunk.Style);
                                        layout.FontDescription.Weight = 
chunk.Style.Bold ? Pango.Weight.Bold : Pango.Weight.Normal;
                                        layout.FontDescription.Style = 
chunk.Style.Italic ? Pango.Style.Italic : Pango.Style.Normal;
                                        if (chunk.Offset >= selectionStart && 
chunk.EndOffset <= selectionEnd) {
@@ -1034,6 +1034,8 @@
                        if (area.Height % this.LineHeight == 0) {
                                startLine = (area.Top + reminder) / 
this.LineHeight;
                                endLine   = startLine + (area.Height / 
this.LineHeight) - 1;
+                       } else {
+                               endLine++;
                        }
 //                     System.Console.WriteLine("draw" + startLine + " -- to: 
" + endLine);
                        for (int visualLineNumber = startLine; visualLineNumber 
<= endLine; visualLineNumber++) {

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Keywords.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Keywords.cs
  2008-01-30 15:30:27 UTC (rev 94388)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Keywords.cs
  2008-01-30 15:48:29 UTC (rev 94389)
@@ -32,18 +32,9 @@
 
 namespace Mono.TextEditor.Highlighting
 {
-       [Flags]
-       public enum KeywordWeight {
-               Normal,
-               Italic,
-               Bold,
-               Underlined
-       };
-       
        public class Keywords
        {
                string        color;
-               KeywordWeight weight = KeywordWeight.Normal;
                List<string>  words = new List<string> ();
                bool          ignorecase = false;
                
@@ -53,12 +44,6 @@
                        }
                }
 
-               public KeywordWeight Weight {
-                       get {
-                               return weight;
-                       }
-               }
-
                public ReadOnlyCollection<string> Words {
                        get {
                                return words.AsReadOnly ();
@@ -87,9 +72,6 @@
                        result.color      = reader.GetAttribute ("color");
                        if (!String.IsNullOrEmpty (reader.GetAttribute 
("ignorecase")))
                                result.ignorecase = Boolean.Parse 
(reader.GetAttribute ("ignorecase"));
-                       string weight = reader.GetAttribute ("weight");
-                       if (!String.IsNullOrEmpty (weight))
-                               result.weight = (KeywordWeight)Enum.Parse 
(typeof(KeywordWeight), weight);
                        
                        XmlReadHelper.ReadList (reader, Node, delegate () {
                                switch (reader.LocalName) {

Added: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Match.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Match.cs
     2008-01-30 15:30:27 UTC (rev 94388)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Match.cs
     2008-01-30 15:48:29 UTC (rev 94389)
@@ -0,0 +1,71 @@
+// Match.cs
+//
+// Author:
+//   Mike Krüger <[EMAIL PROTECTED]>
+//
+// Copyright (c) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to 
deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+using System.Xml;
+
+namespace Mono.TextEditor
+{
+       public class Match
+       {
+               string color;
+               string pattern;
+               
+               public string Color {
+                       get {
+                               return color;
+                       }
+               }
+
+               public string Pattern {
+                       get {
+                               return pattern;
+                       }
+               }
+               
+               public System.Text.RegularExpressions.Regex Regex {
+                       get {
+                               return new System.Text.RegularExpressions.Regex 
(pattern, System.Text.RegularExpressions.RegexOptions.Compiled);
+                       }
+               }
+               
+               public override string ToString ()
+               {
+                       return String.Format ("[Match: Color={0}, 
Pattern={1}]", color, pattern);
+               }
+
+               
+               public const string Node = "Match";
+               public static Match Read (XmlReader reader)
+               {
+                       Match result = new Match ();
+                       result.color = reader.GetAttribute ("color");
+                       result.pattern = reader.ReadElementString ();
+                       return result;
+               }
+       }
+}

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Rule.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Rule.cs
      2008-01-30 15:30:27 UTC (rev 94388)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Rule.cs
      2008-01-30 15:48:29 UTC (rev 94389)
@@ -41,6 +41,7 @@
                
                protected List<Keywords> keywords = new List<Keywords> ();
                protected List<Span> spans = new List<Span> ();
+               protected List<Match> matches = new List<Match> ();
                
                public string Name {
                        get {
@@ -65,6 +66,12 @@
                                return spans.AsReadOnly ();
                        }
                }
+               
+               public ReadOnlyCollection<Match> Matches {
+                       get {
+                               return this.matches.AsReadOnly ();
+                       }
+               }
 
                public string DefaultColor {
                        get {
@@ -87,6 +94,9 @@
                        case "Delimiters":
                                this.delimiters = reader.ReadElementString ();
                                return true;
+                       case Match.Node:
+                               this.matches.Add (Match.Read (reader));
+                               return true;
                        case Span.Node:
                        case Span.AltNode:
                                this.spans.Add (Span.Read (reader));

Modified: 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs
        2008-01-30 15:30:27 UTC (rev 94388)
+++ 
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs
        2008-01-30 15:48:29 UTC (rev 94389)
@@ -28,8 +28,10 @@
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
+using System.Text.RegularExpressions;
 using System.Xml;
 
+
 namespace Mono.TextEditor.Highlighting
 {
        public class SyntaxMode : Rule
@@ -153,6 +155,7 @@
                        
                        Chunk curChunk;
                        int maxEnd;
+                       
                        public Chunk[] GetChunks (int offset, int length)
                        {
                                curRule = mode;
@@ -166,14 +169,15 @@
                                SetSpan ();
                                SetTree ();
                                bool isNoKeyword = false;
+                               string text = offset >= maxEnd ? 
doc.Buffer.GetTextAt (offset, maxEnd - offset) : "";
                                for (int i = offset; i < maxEnd; i++) {
                                        char ch = doc.Buffer.GetCharAt (i);
                                        if (curSpan != null) {
                                                if (!String.IsNullOrEmpty 
(curSpan.End) && curSpan.End[endOffset] == ch) {
                                                        endOffset++;
                                                        if (endOffset >= 
curSpan.End.Length) {
-                                                               int 
chunkEndOffset = i - curChunk.EndOffset + 1;
-                                                               AddChunk (ref 
curChunk, chunkEndOffset, !String.IsNullOrEmpty (curSpan.TagColor) ? 
style.GetChunkStyle (curSpan.TagColor) : GetSpanStyle (spanStack));
+                                                               curChunk.Length 
-= curSpan.End.Length - 1;
+                                                               AddChunk (ref 
curChunk, curSpan.End.Length, !String.IsNullOrEmpty (curSpan.TagColor) ? 
style.GetChunkStyle (curSpan.TagColor) : GetSpanStyle (spanStack));
                                                                spanStack.Pop 
();
                                                                SetSpan ();
                                                                SetTree ();
@@ -214,6 +218,7 @@
                                                AddChunk (ref curChunk, 
wordOffset, GetChunkStyleColor (spanStack, pair.o1));
                                                isNoKeyword = false;
                                        }
+                                       
                                        if (tree != null) {
                                                if (!isNoKeyword && 
tree.ContainsKey (ch)) {
                                                        wordOffset++;

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp       
2008-01-30 15:30:27 UTC (rev 94388)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp       
2008-01-30 15:48:29 UTC (rev 94389)
@@ -62,6 +62,8 @@
     <File name="ChangeLog" subtype="Code" buildaction="Nothing" />
     <File name="Mono.TextEditor/TextEditor.cs" subtype="Code" 
buildaction="Compile" />
     <File name="XmlSyntaxMode.xml" subtype="Code" 
buildaction="EmbedAsResource" />
+    <File name="TangoStyle.xml" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Mono.TextEditor.Highlighting/Match.cs" subtype="Code" 
buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, 
Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />

Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/OblivionStyle.xml
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/OblivionStyle.xml 
2008-01-30 15:30:27 UTC (rev 94388)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/OblivionStyle.xml 
2008-01-30 15:48:29 UTC (rev 94389)
@@ -1,4 +1,4 @@
-<!-- C64Style.xml
+<!-- OblivionStyle.xml
 
  Author:
    Mike Krüger <[EMAIL PROTECTED]>
@@ -95,9 +95,9 @@
        <Style name="kw:jump" color="white" weight="bold"/>
        <Style name="kw:context" color="white" weight="bold"/>
        <Style name="kw:exceptions" color="white" weight="bold"/>
-       <Style name="kw:literals" color="white" weight="bold"/>
+       <Style name="kw:literals" color="orange3"/>
        <Style name="kw:modifiers" color="white" weight="bold"/>
-       <Style name="kw:types" color="white" weight="bold"/>
+       <Style name="kw:types" color="chameleon1" weight="bold"/>
        <Style name="kw:namespaces" color="white" weight="bold"/>
        <Style name="kw:properties" color="white" weight="bold"/>
        <Style name="kw:declarations" color="white" weight="bold"/>

Added: trunk/monodevelop/main/src/addins/Mono.Texteditor/TangoStyle.xml
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/TangoStyle.xml    
2008-01-30 15:30:27 UTC (rev 94388)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/TangoStyle.xml    
2008-01-30 15:48:29 UTC (rev 94389)
@@ -0,0 +1,115 @@
+<!-- OblivionStyle.xml
+
+ Author:
+   Mike Krüger <[EMAIL PROTECTED]>
+
+ Copyright (c) 2007 Novell, Inc (http://www.novell.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE. -->
+ <EditorStyle _name="TangoStyle" _description="Light color sheme using tango 
colors.">
+ 
+       <!-- tango palette -->
+       <Color name="butter1" value="#fce94f"/>
+       <Color name="butter2" value="#edd400"/>
+       <Color name="butter3" value="#c4a000"/>
+       <Color name="orange1" value="#fcaf3e"/>
+       <Color name="orange2" value="#f57900"/>
+       <Color name="orange3" value="#ce5c00"/>
+       <Color name="chocolate1" value="#e9b96e"/>
+       <Color name="chocolate2" value="#c17d11"/>
+       <Color name="chocolate3" value="#8f5902"/>
+       <Color name="chameleon1" value="#8ae234"/>
+       <Color name="chameleon2" value="#73d216"/>
+       <Color name="chameleon3" value="#4e9a06"/>
+       <Color name="skyblue1" value="#729fcf"/>
+       <Color name="skyblue2" value="#3465a4"/>
+       <Color name="skyblue3" value="#204a87"/>
+       <Color name="plum1" value="#ad7fa8"/>
+       <Color name="plum2" value="#75507b"/>
+       <Color name="plum3" value="#5c3566"/>
+       <Color name="scarletred1" value="#ef2929"/>
+       <Color name="scarletred2" value="#cc0000"/>
+       <Color name="scarletred3" value="#a40000"/>
+       <Color name="aluminium1" value="#eeeeec"/>
+       <Color name="aluminium2" value="#d3d7cf"/>
+       <Color name="aluminium3" value="#babdb6"/>
+       <Color name="aluminium4" value="#888a85"/>
+       <Color name="aluminium5" value="#555753"/>
+       <Color name="aluminium6" value="#2e3436"/>
+       
+       <!-- environment -->
+       <Style name="default" color="black"/>
+       <Style name="caret" color="black"/>
+       <Style name="background" color="white"/>
+       <Style name="selectedBackground" color="skyblue1"/>
+       <Style name="selectedForeground" color="aluminium1"/>
+       
+       <Style name="lineMarker" color="aluminium1"/>
+       <Style name="ruler" color="aluminium3"/>
+       <Style name="whitespaces" color="aluminium3"/>
+       <Style name="invalidLines" color="scarletred2"/>
+
+       <Style name="lineNumber" color="aluminium5"/>
+       <Style name="lineNumberHighlighted" color="aluminium3"/>
+       <Style name="lineNumberBg" color="white"/>
+       
+       <Style name="iconBar" color="white"/>
+       <Style name="iconBarSeperator" color="aluminium3"/>
+
+       <Style name="foldLine" color="aluminium3"/>
+       <Style name="foldBg" color="white"/>
+       <Style name="foldLineHighlighted" color="aluminium2"/>
+       <Style name="foldToggleMarker" color="aluminium1"/>
+       
+       <!-- highlighting -->
+       <Style name="comment" color="chameleon3"/>
+       <Style name="altcomment" color="chameleon3"/>
+       <Style name="todocomment" color="chameleon3" weight="italic" />
+       <Style name="commentkw" color="chameleon3" weight="bold" />
+       <Style name="commenttag" color="aluminium4"/>
+       
+       <Style name="digit" color="orange3"/>
+       <Style name="literal" color="orange3"/>
+       <Style name="punctuation" color="aluminium6"/>
+       
+       <Style name="kw:namespaces" color="plum3" weight="bold"/>
+       <Style name="kw:properties" color="skyblue3" weight="bold"/>
+       <Style name="kw:modifiers" color="plum3" weight="bold"/>
+       <Style name="kw:types" color="chameleon3" weight="bold"/>
+       <Style name="kw:void" color="chameleon3" weight="bold"/>
+       <Style name="kw:declarations" color="plum3" weight="bold"/>
+               
+       <Style name="kw:access" color="black" weight="bold" />
+       
+       <Style name="kw:operator" color="skyblue3"/>
+       <Style name="kw:selection" color="skyblue3" weight="bold"/>
+       <Style name="kw:iteration" color="skyblue3" weight="bold"/>
+       <Style name="kw:jump" color="skyblue3" weight="bold"/>
+       <Style name="kw:context" color="skyblue3" />
+       <Style name="kw:exceptions" color="scarletred3" weight="bold"/>
+       <Style name="kw:literals" color="orange3"/>
+       <Style name="kw:parameter" color="skyblue3" weight="bold"/>
+       <Style name="kw:operatordecl" color="skyblue3" weight="bold"/>
+       <Style name="kw:misc" color="skyblue3"/>
+       
+       <Style name="preprocessor" color="orange2"/>
+       <Style name="preprocessorkw" color="orange2" weight="bold"/>
+       
+       <Style name="markup" color="orange1"/>
+</EditorStyle>

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

Reply via email to