Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Area.py
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2009-06-04 08:10:16 (GMT)
committer Simon Schampijer <simon@schampijer.de>2009-06-04 08:10:16 (GMT)
commit3a8edacf5d19b95fb9ac45e96944b957c2e16a87 (patch)
treecd91b7cfa46f5272580ec27a84ce05ff1d9722cb /Area.py
parent95f28354a436dd87e890df0ff996b1be54f2e2db (diff)
Select tool: add fixed ratio support
press ctrl down when selecting will do a selection with a fixed ratio
Diffstat (limited to 'Area.py')
-rw-r--r--Area.py20
1 files changed, 20 insertions, 0 deletions
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