meld r1110 - trunk
- From: kaiw svn gnome org
- To: svn-commits-list gnome org
- Subject: meld r1110 - trunk
- Date: Fri, 2 Jan 2009 17:51:14 +0000 (UTC)
Author: kaiw
Date: Fri Jan 2 17:51:13 2009
New Revision: 1110
URL: http://svn.gnome.org/viewvc/meld?rev=1110&view=rev
Log:
Minor tweaks to linkmap drawing, using more standard idioms and fixing an off-by-one for insert/delete chunks
Modified:
trunk/filediff.py
Modified: trunk/filediff.py
==============================================================================
--- trunk/filediff.py (original)
+++ trunk/filediff.py Fri Jan 2 17:51:13 2009
@@ -1150,8 +1150,6 @@
window = area.window
# not mapped?
if not window: return
- if not hasattr(area, "meldgc"):
- self._setup_gcs(area)
gctext = area.get_style().bg_gc[gtk.STATE_ACTIVE]
alloc = area.get_allocation()
@@ -1162,7 +1160,7 @@
context = window.cairo_create()
context.rectangle(0, 0, wtotal, htotal)
context.clip()
- context.set_line_width(0.5)
+ context.set_line_width(1.0)
if self.keymask & MASK_SHIFT:
pix0 = self.pixbuf_delete
@@ -1174,7 +1172,6 @@
pix0 = self.pixbuf_apply0
pix1 = self.pixbuf_apply1
draw_style = self.prefs.draw_style
- gc = area.meldgc.get_gc
which = self.linkmap.index(area)
pix_start = [None] * self.num_panes
@@ -1185,6 +1182,8 @@
return [self._pixel_to_line(idx, pix_start[idx]), self._pixel_to_line(idx, pix_start[idx]+htotal)]
visible = [None] + bounds(which) + bounds(which+1)
+ # For bezier control points
+ x_steps = [-0.5, (1. / 3) * wtotal, (2. / 3) * wtotal, wtotal + 0.5]
for c in self.linediffer.pair_changes(which, which+1, self._get_texts()):
if self.prefs.ignore_blank_lines:
@@ -1204,25 +1203,21 @@
f0,f1 = [self._line_to_pixel(which, l) - pix_start[which ] for l in c[1:3] ]
t0,t1 = [self._line_to_pixel(which+1, l) - pix_start[which+1] for l in c[3:5] ]
- if f0==f1: f0 -= 1; f1 += 1
- if t0==t1: t0 -= 1; t1 += 1
+ if f0 == f1:
+ f0 -= 1
+ if t0 == t1:
+ t0 -= 1
if draw_style == 2:
- x_step = wtotal / 3.0 # bezier control point distance
-
- # thin antialiased lines in cairo look thicker than they are
- # this is a workaround (works like a charm)
- aa_adjustment = 0.2
-
- context.move_to(0, f0 - aa_adjustment)
- context.curve_to(x_step, f0 - aa_adjustment,
- x_step * 2, t0 - aa_adjustment,
- wtotal + 1, t0 - aa_adjustment)
-
- context.line_to(wtotal + 1, t1 + aa_adjustment)
- context.curve_to(x_step * 2, t1 + aa_adjustment,
- x_step, f1 + aa_adjustment,
- 0, f1 + aa_adjustment)
+ context.move_to(x_steps[0], f0 - 0.5)
+ context.curve_to(x_steps[1], f0 - 0.5,
+ x_steps[2], t0 - 0.5,
+ x_steps[3], t0 - 0.5)
+ context.line_to(x_steps[3], t1 + 0.5)
+ context.curve_to(x_steps[2], t1 + 0.5,
+ x_steps[1], f1 + 0.5,
+ x_steps[0], f1 + 0.5)
+ context.close_path()
if c[0] in ("insert", "delete"):
bg = gdk.color_parse(self.prefs.color_delete_bg)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]