[istanbul] Clean up whitespace. Fixes broken area selection when you select from bottom left. Fixes bug #483836



commit a32d8af5a6b0c35ca8f3a9d40fcc3a2ba2a238bc
Author: Zaheer Merali <zaheermerali gmail com>
Date:   Mon Mar 22 10:30:33 2010 +0100

    Clean up whitespace.
    Fixes broken area selection when you select from bottom left.
    Fixes bug #483836.

 istanbul/main/area_select.py |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/istanbul/main/area_select.py b/istanbul/main/area_select.py
index 52fdec2..036b7cc 100644
--- a/istanbul/main/area_select.py
+++ b/istanbul/main/area_select.py
@@ -43,17 +43,17 @@ class GtkAreaSelector(gtk.Window):
 
     def realize_cb(self, widget):
         gdkwindow = self.window
-        gdkwindow.set_events(gdkwindow.get_events() | 
-            gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | 
+        gdkwindow.set_events(gdkwindow.get_events() |
+            gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK |
             gtk.gdk.POINTER_MOTION_MASK);
         cursor = gtk.gdk.Cursor(gtk.gdk.CROSSHAIR)
         gdkwindow.set_cursor(cursor)
         gdkwindow.set_back_pixmap(None, False)
-        
+
     def expose_cb(self, widget, event):
         dashes = [ 1.0, 2.0 ]
         cr = self.window.cairo_create()
-        cr.rectangle(event.area.x, event.area.y, event.area.width, 
+        cr.rectangle(event.area.x, event.area.y, event.area.width,
             event.area.height)
         cr.clip()
         self.window.draw_image(self.style.black_gc, self.root, event.area.x,
@@ -63,7 +63,7 @@ class GtkAreaSelector(gtk.Window):
         cr.set_source_rgba (1.0, 0.0, 0.0, 1.0)
         cr.set_dash (dashes, 0.0)
         cr.move_to (self.x1 - 0.5, 0.0)
-        cr.line_to (self.x1 - 0.5, event.area.y + event.area.height) 
+        cr.line_to (self.x1 - 0.5, event.area.y + event.area.height)
         cr.move_to (0.0, self.y1 - 0.5)
         cr.line_to (event.area.x + event.area.width, self.y1 - 0.5)
         cr.stroke ()
@@ -82,12 +82,11 @@ class GtkAreaSelector(gtk.Window):
                 cr.set_source_rgba (1.0, 0.0, 0.0, 1.0)
             cr.rectangle (x + 0.5, y + 0.5, w - 1, h - 1)
             cr.stroke()
-        
+
         return False
 
     def motion_notify_cb(self, widget, event):
         self.queue_draw()
-        
         if self.x1 >= 0:
             rect = gtk.gdk.Rectangle()
             rect.x = min(self.x1, min(self.x2, event.x + 1))
@@ -114,6 +113,8 @@ class GtkAreaSelector(gtk.Window):
                 if self.x2 < self.x1:
                     self.x1,self.y1,self.x2,self.y2 = \
                         self.x2,self.y2,self.x1,self.y1
+                if self.y2 < self.y1:
+                    self.y1,self.y2 = self.y2,self.y1
                 print "(%d, %d) - (%d, %d)" % (self.x1, self.y1, self.x2, 
                     self.y2)
                 self.destroy()



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