Author: mkrueger
Date: 2008-02-08 08:43:54 -0500 (Fri, 08 Feb 2008)
New Revision: 95243
Added:
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Marker.cs
Modified:
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/Rule.cs
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Span.cs
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Style.cs
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Document.cs
trunk/monodevelop/main/src/addins/Mono.Texteditor/OblivionStyle.xml
trunk/monodevelop/main/src/addins/Mono.Texteditor/TangoStyle.xml
trunk/monodevelop/main/src/addins/Mono.Texteditor/XmlSyntaxMode.xml
Log:
* XmlSyntaxMode.xml: Worked on xml syntax highlighting
Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-08
13:43:33 UTC (rev 95242)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-08
13:43:54 UTC (rev 95243)
@@ -1,5 +1,9 @@
2008-02-08 Mike Krüger <[EMAIL PROTECTED]>
+ * XmlSyntaxMode.xml: Worked on xml syntax highlighting
+
+2008-02-08 Mike Krüger <[EMAIL PROTECTED]>
+
* Mono.TextEditor.Highlighting/SyntaxModeService.cs: removed some
redraws.
2008-02-08 Mike Krüger <[EMAIL PROTECTED]>
Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/Makefile.am
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/Makefile.am
2008-02-08 13:43:33 UTC (rev 95242)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/Makefile.am
2008-02-08 13:43:54 UTC (rev 95243)
@@ -14,6 +14,7 @@
Mono.TextEditor.Highlighting/ChunkStyle.cs \
Mono.TextEditor.Highlighting/DefaultStyle.cs \
Mono.TextEditor.Highlighting/Keywords.cs \
+ Mono.TextEditor.Highlighting/Marker.cs \
Mono.TextEditor.Highlighting/Match.cs \
Mono.TextEditor.Highlighting/Rule.cs \
Mono.TextEditor.Highlighting/Span.cs \
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-08 13:43:33 UTC (rev 95242)
+++
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/Document.cs
2008-02-08 13:43:54 UTC (rev 95243)
@@ -53,6 +53,7 @@
set {
splitter.Clear ();
buffer.Text = value;
+
Mono.TextEditor.Highlighting.SyntaxModeService.WaitForUpdate ();
}
}
Added:
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Marker.cs
===================================================================
---
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Marker.cs
2008-02-08 13:43:33 UTC (rev 95242)
+++
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Marker.cs
2008-02-08 13:43:54 UTC (rev 95243)
@@ -0,0 +1,66 @@
+//
+// Marker.cs
+//
+// Author:
+// Mike Krüger <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2008 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.Highlighting
+{
+ public class Marker
+ {
+ string color;
+ string tag;
+
+ public string Color {
+ get {
+ return color;
+ }
+ }
+
+ public string Tag {
+ get {
+ return tag;
+ }
+ }
+
+ public Marker ()
+ {
+
+ }
+
+ public const string PrevMarker = "PrevMarker";
+
+ public static Marker Read (XmlReader reader)
+ {
+ Marker result = new Marker ();
+ result.color = reader.GetAttribute ("color");
+ result.tag = 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-02-08 13:43:33 UTC (rev 95242)
+++
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Rule.cs
2008-02-08 13:43:54 UTC (rev 95243)
@@ -42,6 +42,7 @@
protected List<Keywords> keywords = new List<Keywords> ();
protected List<Span> spans = new List<Span> ();
protected List<Match> matches = new List<Match> ();
+ protected List<Marker> prevMarker = new List<Marker> ();
public string Name {
get {
@@ -78,6 +79,12 @@
return defaultColor;
}
}
+
+ public List<Marker> PrevMarker {
+ get {
+ return prevMarker;
+ }
+ }
public Rule()
{
@@ -104,6 +111,9 @@
case Mono.TextEditor.Highlighting.Keywords.Node:
this.keywords.Add
(Mono.TextEditor.Highlighting.Keywords.Read (reader));
return true;
+ case Marker.PrevMarker:
+ this.prevMarker.Add (Marker.Read (reader));
+ return true;
}
return false;
}
Modified:
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Span.cs
===================================================================
---
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Span.cs
2008-02-08 13:43:33 UTC (rev 95242)
+++
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Span.cs
2008-02-08 13:43:54 UTC (rev 95243)
@@ -39,6 +39,7 @@
string begin;
string end;
string constraint;
+ string nextColor;
char escape;
bool stopAtEol;
@@ -97,6 +98,12 @@
return constraint;
}
}
+
+ public string NextColor {
+ get {
+ return nextColor;
+ }
+ }
public override string ToString ()
{
@@ -111,6 +118,7 @@
result.color = reader.GetAttribute ("color");
result.tagColor = reader.GetAttribute ("tagColor");
result.constraint = reader.GetAttribute ("constraint");
+ result.nextColor = reader.GetAttribute ("nextColor");
string esc = reader.GetAttribute ("escape");
if (!String.IsNullOrEmpty (esc)) {
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-08 13:43:33 UTC (rev 95242)
+++
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/Style.cs
2008-02-08 13:43:54 UTC (rev 95243)
@@ -237,8 +237,9 @@
SetStyle ("preprocessor", new
Mono.TextEditor.ChunkStyle (new Gdk.Color (0, 128 , 0), false, false));
SetStyle ("preprocessorkw", new
Mono.TextEditor.ChunkStyle (new Gdk.Color (0, 128, 0), true, false));
-
- SetStyle ("markup", new Mono.TextEditor.ChunkStyle (new
Gdk.Color (128, 0, 0), false, false));
+
+ SetStyle ("markup", new Mono.TextEditor.ChunkStyle (new
Gdk.Color (0, 0x8A , 0x8C), false, false));
+ SetStyle ("markupTag", new Mono.TextEditor.ChunkStyle
(new Gdk.Color (0x6A, 0x5A, 0xCD), false, false));
}
void SetStyle (string name, ChunkStyle style)
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-02-08 13:43:33 UTC (rev 95242)
+++
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxMode.cs
2008-02-08 13:43:54 UTC (rev 95243)
@@ -85,14 +85,14 @@
this.mode = mode;
this.line = line;
}
-
void AddChunk (ref Chunk curChunk, int length,
ChunkStyle style)
{
if (curChunk.Length > 0) {
result.Add (curChunk);
curChunk = new Chunk
(curChunk.EndOffset, 0, ChunkStyle.Default);
}
- curChunk.Style = style;
+ if (curChunk.Style == ChunkStyle.Default)
+ curChunk.Style = style;
curChunk.Length = length;
result.Add (curChunk);
curChunk = new Chunk (curChunk.EndOffset, 0,
ChunkStyle.Default);
@@ -169,6 +169,7 @@
SetSpan ();
SetTree ();
bool isNoKeyword = false;
+ bool isAfterSpan = false;
for (int i = offset; i < maxEnd; i++) {
char ch = doc.Buffer.GetCharAt (i);
if (curSpan != null &&
!String.IsNullOrEmpty (curSpan.End)) {
@@ -209,6 +210,8 @@
AddChunk (ref curChunk,
span.Begin.Length, !String.IsNullOrEmpty (span.TagColor) ? style.GetChunkStyle
(span.TagColor) : GetSpanStyle (spanStack));
SetSpan ();
SetTree ();
+ if
(!String.IsNullOrEmpty (span.NextColor))
+ curChunk.Style
= style.GetChunkStyle (span.NextColor);
continue;
}
} else {
Modified:
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs
===================================================================
---
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs
2008-02-08 13:43:33 UTC (rev 95242)
+++
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.Highlighting/SyntaxModeService.cs
2008-02-08 13:43:54 UTC (rev 95243)
@@ -200,6 +200,11 @@
}
static Thread updateThread = null;
+ public static void WaitForUpdate ()
+ {
+ if (updateThread != null && updateThread.IsAlive)
+ updateThread.Join ();
+ }
public static void StartUpdate (Document doc, SyntaxMode mode,
int startOffset, int endOffset)
{
if (updateThread != null && updateThread.IsAlive)
Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp
2008-02-08 13:43:33 UTC (rev 95242)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor.mdp
2008-02-08 13:43:54 UTC (rev 95243)
@@ -68,6 +68,7 @@
<File name="gtk-gui/generated.cs" subtype="Code" buildaction="Compile" />
<File name="Mono.TextEditor/TextUtil.cs" subtype="Code"
buildaction="Compile" />
<File name="Mono.TextEditor/FoldingType.cs" subtype="Code"
buildaction="Compile" />
+ <File name="Mono.TextEditor.Highlighting/Marker.cs" subtype="Code"
buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/OblivionStyle.xml
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/OblivionStyle.xml
2008-02-08 13:43:33 UTC (rev 95242)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/OblivionStyle.xml
2008-02-08 13:43:54 UTC (rev 95243)
@@ -112,5 +112,5 @@
<Style name="preprocessor" color="plum1"/>
<Style name="preprocessorkw" color="plum1" weight="bold"/>
- <Style name="markup" color="orange1"/>
+ <Style name="markup" color="skyblue1"/>
</EditorStyle>
Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/TangoStyle.xml
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/TangoStyle.xml
2008-02-08 13:43:33 UTC (rev 95242)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/TangoStyle.xml
2008-02-08 13:43:54 UTC (rev 95243)
@@ -114,5 +114,5 @@
<Style name="preprocessor" color="orange2"/>
<Style name="preprocessorkw" color="orange2" weight="bold"/>
- <Style name="markup" color="orange1"/>
+ <Style name="markup" color="skyblue3"/>
</EditorStyle>
Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/XmlSyntaxMode.xml
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/XmlSyntaxMode.xml
2008-02-08 13:43:33 UTC (rev 95242)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/XmlSyntaxMode.xml
2008-02-08 13:43:54 UTC (rev 95243)
@@ -24,25 +24,37 @@
THE SOFTWARE. -->
<SyntaxMode name = "Xml" mimeTypes="application/xml">
- <Span color = "Comment1">
+ <Span color = "comment">
<Begin><!--</Begin>
<End>--></End>
</Span>
- <Span color = "Markup" rule = "InTag">
+ <Span color = "preprocessor">
+ <Begin>&</Begin>
+ <End>;</End>
+ </Span>
+
+ <Span color = "markup" rule = "InTag" constraint="!!" >
<Begin><</Begin>
<End>></End>
</Span>
- <Rule name = "InTag" color = "PreProcessorDirective1">
- <Span color = "Literal">
+ <Rule name = "InTag">
+ <Span color = "literal" rule="InLiteral">
<Begin>"</Begin>
<End>"</End>
</Span>
- <Span color = "Literal">
+
+ <Span color = "literal" rule="InLiteral">
<Begin>'</Begin>
<End>'</End>
</Span>
</Rule>
+ <Rule name = "InLiteral">
+ <Span color = "preprocessor">
+ <Begin>&</Begin>
+ <End>;</End>
+ </Span>
+ </Rule>
</SyntaxMode>
\ No newline at end of file
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches