From 3a8edacf5d19b95fb9ac45e96944b957c2e16a87 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Thu, 04 Jun 2009 08:10:16 +0000 Subject: Select tool: add fixed ratio support press ctrl down when selecting will do a selection with a fixed ratio --- (limited to 'Area.py') diff --git a/Area.py b/Area.py index 3f91943..28d6354 100644 --- a/Area.py +++ b/Area.py @@ -380,6 +380,16 @@ class Area(gtk.DrawingArea): self.d.square(widget,event,coords,True,self.tool['fill']) elif self.tool['name'] == 'marquee-rectangular' and not self.selmove: + if state & gtk.gdk.CONTROL_MASK: + xdiff = abs(coords[0] - self.oldx) + ydiff = abs(coords[1] - self.oldy) + if xdiff >= ydiff: + y = self.oldy + xdiff + x = coords[0] + else: + x = self.oldx + ydiff + y = coords[1] + coords = (x, y) self.d.selection(widget,coords) # selected elif self.tool['name'] == 'marquee-rectangular' and self.selmove: @@ -462,6 +472,16 @@ class Area(gtk.DrawingArea): elif self.tool['name'] == 'marquee-rectangular': if self.selmove == False: + if event.state & gtk.gdk.CONTROL_MASK: + xdiff = abs(coords[0] - self.oldx) + ydiff = abs(coords[1] - self.oldy) + if xdiff >= ydiff: + y = self.oldy + xdiff + x = coords[0] + else: + x = self.oldx + ydiff + y = coords[1] + coords = (x, y) self.d.selection(widget,coords,False) self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.FLEUR)) self.selmove = True -- cgit v0.9.1