Author: lluis
Date: 2008-01-16 12:59:14 -0500 (Wed, 16 Jan 2008)
New Revision: 93070
Modified:
branches/monodevelop/main/1.0/src/addins/VersionControl/ChangeLog
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/LibSvnClient.cs
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl/ChangeLog
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/Statuses.cs
Log:
2008-01-16 Lluis Sanchez Gual <[EMAIL PROTECTED]>
*
MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/LibSvnClient.cs:
More marshalling fixes.
2008-01-15 Lluis Sanchez Gual <[EMAIL PROTECTED]>
*
MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/LibSvnClient.cs:
Fix marshalling issues.
2008-01-16 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* MonoDevelop.VersionControl.Views/Statuses.cs: Removed colorize
method. Not
needed anymore.
* MonoDevelop.VersionControl.Views/CellRendererDiff.cs: Changed the way
diffs are rendered. Instead of having a big pango layout with all
text,
now we render text line by line, skipping lines which are not visible.
Coloring is done changing the GC, instead of using markup. Fixes bug
#353705 and improves performance.
Modified: branches/monodevelop/main/1.0/src/addins/VersionControl/ChangeLog
===================================================================
--- branches/monodevelop/main/1.0/src/addins/VersionControl/ChangeLog
2008-01-16 17:57:35 UTC (rev 93069)
+++ branches/monodevelop/main/1.0/src/addins/VersionControl/ChangeLog
2008-01-16 17:59:14 UTC (rev 93070)
@@ -1,3 +1,13 @@
+2008-01-16 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ *
MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/LibSvnClient.cs:
+ More marshalling fixes.
+
+2008-01-15 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ *
MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/LibSvnClient.cs:
+ Fix marshalling issues.
+
2008-01-09 Lluis Sanchez Gual <[EMAIL PROTECTED]>
*
MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/SubversionVersionControl.cs:
Modified:
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl/ChangeLog
===================================================================
---
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl/ChangeLog
2008-01-16 17:57:35 UTC (rev 93069)
+++
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl/ChangeLog
2008-01-16 17:59:14 UTC (rev 93070)
@@ -1,3 +1,13 @@
+2008-01-16 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * MonoDevelop.VersionControl.Views/Statuses.cs: Removed colorize
method. Not
+ needed anymore.
+ * MonoDevelop.VersionControl.Views/CellRendererDiff.cs: Changed the way
+ diffs are rendered. Instead of having a big pango layout with all
text,
+ now we render text line by line, skipping lines which are not visible.
+ Coloring is done changing the GC, instead of using markup. Fixes bug
+ #353705 and improves performance.
+
2008-01-09 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* MonoDevelop.VersionControl/Checkout.cs,
Modified:
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs
===================================================================
---
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs
2008-01-16 17:57:35 UTC (rev 93069)
+++
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs
2008-01-16 17:59:14 UTC (rev 93070)
@@ -13,7 +13,8 @@
Pango.Layout layout;
Pango.FontDescription font;
bool diffMode;
- Hashtable layoutCache = new Hashtable ();
+ int width, height, lineHeight;
+ string[] lines;
public CellRendererDiff()
{
@@ -22,56 +23,116 @@
public void Reset ()
{
- layoutCache.Clear ();
}
public void InitCell (Widget container, bool diffMode, string
text, string path)
{
- this.diffMode = diffMode;
-
+ this.diffMode = diffMode;
+
if (diffMode) {
- layout = (Pango.Layout) layoutCache [path];
- if (layout == null) {
- layout = CreateLayout (container, text);
- layoutCache [path] = layout;
+ if (text.Length > 0) {
+ lines = text.Split ('\n');
+ int maxlen = -1;
+ int maxlin = -1;
+ for (int n=0; n<lines.Length; n++) {
+ if (lines [n].Length > maxlen) {
+ maxlen = lines
[n].Length;
+ maxlin = n;
+ }
+ }
+ layout = CreateLayout (container, lines
[maxlin]);
+ layout.GetPixelSize (out width, out
lineHeight);
+ height = lineHeight * lines.Length;
}
+ else
+ width = height = 0;
}
- else
+ else {
layout = CreateLayout (container, text);
+ layout.GetPixelSize (out width, out height);
+ }
}
Pango.Layout CreateLayout (Widget container, string text)
{
Pango.Layout layout = new Pango.Layout
(container.PangoContext);
layout.SingleParagraphMode = false;
- if (diffMode)
+ if (diffMode) {
layout.FontDescription = font;
- layout.SetMarkup (text);
+ layout.SetText (text);
+ }
+ else
+ layout.SetMarkup (text);
return layout;
}
protected override void Render (Drawable window, Widget widget,
Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle
expose_area, CellRendererState flags)
{
- int width, height;
- layout.GetPixelSize (out width, out height);
if (diffMode) {
- window.DrawRectangle (widget.Style.BaseGC
(Gtk.StateType.Normal), true, cell_area.X, cell_area.Y, cell_area.Width - 1,
cell_area.Height - 1);
- window.DrawLayout (widget.Style.TextGC
(StateType.Normal), cell_area.X + 2, cell_area.Y + 2, layout);
- window.DrawRectangle (widget.Style.DarkGC
(Gtk.StateType.Prelight), false, cell_area.X, cell_area.Y, cell_area.Width - 1,
cell_area.Height - 1);
+ int w, maxy;
+ window.GetSize (out w, out maxy);
+
+ int recty = cell_area.Y;
+ int recth = cell_area.Height - 1;
+ if (recty < 0) {
+ recth += recty + 1;
+ recty = -1;
+ }
+ if (recth > maxy + 2)
+ recth = maxy + 2;
+
+ window.DrawRectangle (widget.Style.BaseGC
(Gtk.StateType.Normal), true, cell_area.X, recty, cell_area.Width - 1, recth);
+
+ Gdk.GC normalGC = widget.Style.TextGC
(StateType.Normal);
+ Gdk.GC removedGC = new Gdk.GC (window);
+ removedGC.Copy (normalGC);
+ removedGC.RgbFgColor = new Color (255, 0, 0);
+ Gdk.GC addedGC = new Gdk.GC (window);
+ addedGC.Copy (normalGC);
+ addedGC.RgbFgColor = new Color (0, 0, 255);
+ Gdk.GC infoGC = new Gdk.GC (window);
+ infoGC.Copy (normalGC);
+ infoGC.RgbFgColor = new Color (0xa5, 0x2a,
0x2a);
+
+ int y = cell_area.Y + 2;
+
+ for (int n=0; n<lines.Length; n++, y +=
lineHeight) {
+ if (y + lineHeight < 0)
+ continue;
+ if (y > maxy)
+ break;
+ string line = lines [n];
+ if (line.Length == 0)
+ continue;
+
+ Gdk.GC gc;
+ switch (line[0]) {
+ case '-': gc = removedGC; break;
+ case '+': gc = addedGC; break;
+ case '@': gc = infoGC; break;
+ default: gc = normalGC; break;
+ }
+
+ layout.SetText (line);
+ window.DrawLayout (gc, cell_area.X + 2,
y, layout);
+ }
+ window.DrawRectangle (widget.Style.DarkGC
(Gtk.StateType.Prelight), false, cell_area.X, recty, cell_area.Width - 1,
recth);
} else {
int y = cell_area.Y + (cell_area.Height -
height)/2;
window.DrawLayout (widget.Style.TextGC
(GetState(flags)), cell_area.X, y, layout);
}
}
- public override void GetSize (Widget widget, ref Rectangle
cell_area, out int x_offset, out int y_offset, out int width, out int height)
+ public override void GetSize (Widget widget, ref Rectangle
cell_area, out int x_offset, out int y_offset, out int c_width, out int
c_height)
{
- layout.GetPixelSize (out width, out height);
x_offset = y_offset = 0;
+ c_width = width;
+ c_height = height;
+
if (diffMode) {
// Add some spacing for the margin
- width += 4;
- height += 4;
+ c_width += 4;
+ c_height += 4;
}
}
Modified:
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/Statuses.cs
===================================================================
---
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/Statuses.cs
2008-01-16 17:57:35 UTC (rev 93069)
+++
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/Statuses.cs
2008-01-16 17:59:14 UTC (rev 93070)
@@ -720,7 +720,7 @@
if (difs != null) {
foreach (DiffInfo di in difs) {
if (di.FileName == file) {
- filestore.SetValue (iter,
ColPath, Colorize (di.Content));
+ filestore.SetValue (iter,
ColPath, di.Content);
return;
}
}
@@ -728,25 +728,6 @@
filestore.SetValue (iter, ColPath,
GLib.Markup.EscapeText (GettextCatalog.GetString ("No differences found")));
}
- string Colorize (string txt)
- {
- txt = GLib.Markup.EscapeText (txt);
- StringReader sr = new StringReader (txt);
- StringBuilder sb = new StringBuilder ();
- string line;
- while ((line = sr.ReadLine ()) != null) {
- if (line.Length > 0) {
- char c = line [0];
- if (c == '-') {
- line = "<span
foreground='red'>" + line + "</span>";
- } else if (c == '+')
- line = "<span
foreground='blue'>" + line + "</span>";
- }
- sb.Append (line).Append ('\n');
- }
- return sb.ToString ();
- }
-
void OnFillDifs (object s, EventArgs a)
{
diffRenderer.Reset ();
Modified:
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/LibSvnClient.cs
===================================================================
---
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/LibSvnClient.cs
2008-01-16 17:57:35 UTC (rev 93069)
+++
branches/monodevelop/main/1.0/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion/LibSvnClient.cs
2008-01-16 17:59:14 UTC (rev 93070)
@@ -128,7 +128,7 @@
internal DirEnt (string name, svn_dirent_t ent)
{
Name = name;
- IsDirectory = (ent.kind == (int) NodeKind.Dir);
+ IsDirectory = (ent.kind.ToInt32 () == (int)
NodeKind.Dir);
Size = ent.size;
HasProps = ent.has_props != 0;
CreatedRevision = ent.created_rev;
@@ -291,12 +291,12 @@
}
internal struct svn_dirent_t {
- public int kind;
+ public IntPtr kind;
public long size;
- public int has_props;
+ [MarshalAs (UnmanagedType.SysInt)] public int has_props;
public int created_rev;
public long time; // created
- public string last_author;
+ [MarshalAs (UnmanagedType.LPStr)] public string
last_author;
}
public enum NodeSchedule {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches