[meld] linkmap: Clip drawing to textview extents and add bottom border



commit 7bff5ff2f238ef5b77cddf9b1c58feee62a87930
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Jan 26 08:44:16 2014 +1000

    linkmap: Clip drawing to textview extents and add bottom border

 data/meld.css   |    6 ++++++
 meld/linkmap.py |    7 ++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/data/meld.css b/data/meld.css
index 871b1e3..aeb64fe 100644
--- a/data/meld.css
+++ b/data/meld.css
@@ -31,3 +31,9 @@
     box-shadow: inset 0 3px alpha(black, 0.02), inset 0 2px alpha(black, 0.02), inset 0 1px alpha(black, 
0.02);
     padding: 2px;
 }
+
+LinkMap {
+    border-width: 0 0 1px 0;
+    border-style: solid;
+    border-color: @borders;
+}
diff --git a/meld/linkmap.py b/meld/linkmap.py
index 5fb1f8d..8cb7f7a 100644
--- a/meld/linkmap.py
+++ b/meld/linkmap.py
@@ -50,10 +50,16 @@ class LinkMap(Gtk.DrawingArea):
 
         context.set_line_width(1.0)
         allocation = self.get_allocation()
+        style = self.get_style_context()
 
         pix_start = [t.get_visible_rect().y for t in self.views]
         y_offset = [t.translate_coordinates(self, 0, 0)[1] for t in self.views]
 
+        clip_height = max(t.get_visible_rect().height for t in self.views) + 2
+        Gtk.render_frame(style, context, 0, 0, allocation.width, clip_height)
+        context.rectangle(0, -1, allocation.width, clip_height)
+        context.clip()
+
         height = allocation.height
         visible = [self.views[0].get_line_num_for_y(pix_start[0]),
                    self.views[0].get_line_num_for_y(pix_start[0] + height),
@@ -118,6 +124,5 @@ class LinkMap(Gtk.DrawingArea):
             context.set_source_rgba(*self.line_colors[c[0]])
             context.stroke()
 
-
     def do_scroll_event(self, event):
         self.filediff.next_diff(event.direction)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]