[meld] Fix linkmap painting when offset from its TextViews
- From: Kai Willadsen <kaiw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [meld] Fix linkmap painting when offset from its TextViews
- Date: Sat, 10 Oct 2009 02:37:23 +0000 (UTC)
commit 0e036d6163d0fe36b541a84a936d7a2abdc05d6e
Author: Kai Willadsen <kai willadsen gmail com>
Date: Tue Jul 14 17:55:02 2009 +1000
Fix linkmap painting when offset from its TextViews
The linkmap drawing code assumes that the linkmap has the same y-coords
as both of its TextViews. While this is currently true, it doesn't hold
when per-pane MsgAreas are used. This commit adds an offset correction
so that linkmaps starting below their textviews will do the right thing.
meld/filediff.py | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index f33545a..de3fd10 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1155,6 +1155,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
#
def on_linkmap_expose_event(self, widget, event):
wtotal, htotal = widget.allocation.width, widget.allocation.height
+ yoffset = widget.allocation.y
context = widget.window.cairo_create()
context.rectangle(event.area.x, event.area.y, event.area.width, event.area.height)
context.clip()
@@ -1175,6 +1176,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
pix_start[which ] = self.textview[which ].get_visible_rect().y
pix_start[which+1] = self.textview[which+1].get_visible_rect().y
+ rel_offset = [None] * self.num_panes
+ rel_offset[which] = self.textview[which].allocation.y - yoffset
+ rel_offset[which + 1] = self.textview[which + 1].allocation.y - yoffset
+
def bounds(idx):
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)
@@ -1196,8 +1201,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
break
# f and t are short for "from" and "to"
- 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] ]
+ f0, f1 = [self._line_to_pixel(which, l) - pix_start[which] + rel_offset[which] for l in c[1:3]]
+ t0, t1 = [self._line_to_pixel(which + 1, l) - pix_start[which + 1] + rel_offset[which + 1] for l in c[3:5]]
context.move_to(x_steps[0], f0 - 0.5)
context.curve_to(x_steps[1], f0 - 0.5,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]