Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Area.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2010-05-31 03:56:59 (GMT)
committer Gonzalo Odiard <gonzalo@nautilus.localdomain>2010-06-09 16:24:10 (GMT)
commit8b26812890406a8f0101a4d62386999150342554 (patch)
treeab8db29b65a3c00b35406a66d3854cd2fe60a8a7 /Area.py
parent2b4898cf64e28c84991aab2197b755cd5505329d (diff)
fix #296 - Active point of Paint pointers should be at tip of penscil, brush, drip on fill bucket, etc
Diffstat (limited to 'Area.py')
-rw-r--r--Area.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/Area.py b/Area.py
index 8af2b9b..7b8c8b4 100644
--- a/Area.py
+++ b/Area.py
@@ -176,6 +176,11 @@ class Area(gtk.DrawingArea):
##Shapes will be filled or not?
self.fill = True
+ # variables to show the tool shape
+ self.drawing = False
+ self.x_cursor = 0
+ self.y_cursor = 0
+
def setup(self, width, height):
"""Configure the Area object."""
@@ -256,8 +261,22 @@ class Area(gtk.DrawingArea):
widget.window.draw_drawable(self.gc,self.pixmap_temp,area[0],area[1],area[0],area[1],area[2],area[3])
else:
widget.window.draw_drawable(self.gc,self.pixmap,area[0],area[1],area[0],area[1],area[2],area[3])
+ self.show_tool_shape(widget)
return False
+ def show_tool_shape(self,widget):
+ """
+ Show the shape of the tool selected for pencil, brush, rainbow and eraser
+ """
+ if self.tool['name'] in ['pencil','eraser','brush','rainbow']:
+ if not self.drawing:
+ size = self.tool['line size']
+ if self.tool['line shape'] == 'circle':
+ widget.window.draw_arc(self.gc_brush, False, self.x_cursor - size/2, self.y_cursor - size/2, size, size, 0, 360*64)
+ else:
+ widget.window.draw_rectangle(self.gc_brush, False, self.x_cursor - size/2, self.y_cursor - size/2, size, size)
+
+
def mousedown(self,widget,event):
"""Make the Area object (GtkDrawingArea) recognize that the mouse button has been pressed.
@@ -304,14 +323,17 @@ class Area(gtk.DrawingArea):
self.last = []
self.d.eraser(widget, coords, self.last, self.line_size, self.tool['line shape'])
self.last = coords
+ self.drawing = True
elif self.tool['name'] == 'brush':
self.last = []
self.d.brush(widget, coords, self.last, self.line_size, self.tool['line shape'])
self.last = coords
+ self.drawing = True
elif self.tool['name'] == 'rainbow':
self.last = []
self.d.rainbow(widget, coords, self.last, self.rainbow_counter,self.line_size, self.tool['line shape'])
self.last = coords
+ self.drawing = True
elif self.tool['name'] == 'polygon':
self.configure_line(self.line_size)
if self.polygon_start == False:
@@ -347,6 +369,8 @@ class Area(gtk.DrawingArea):
y = event.y
state = event.state
+ self.x_cursor,self.y_cursor = int(x), int(y)
+
coords = int(x), int(y)
if state & gtk.gdk.BUTTON1_MASK and self.pixmap != None:
@@ -419,6 +443,8 @@ class Area(gtk.DrawingArea):
self.configure_line(self.line_size)
self.d.heart(widget,coords,True,self.tool['fill'])
else:
+ if self.tool['name'] in ['brush','eraser','rainbow','pencil'] :
+ widget.queue_draw()
if self.tool['name'] == 'marquee-rectangular' and self.selmove:
size = self.pixmap_sel.get_size()
xi = self.orig_x
@@ -520,10 +546,11 @@ class Area(gtk.DrawingArea):
self.d.heart(widget,coords,False,self.tool['fill'])
self.enableUndo(widget)
- if self.tool['name'] == 'brush' or self.tool['name'] == 'eraser' or self.tool['name'] == 'rainbow' or self.tool['name'] == 'pencil' :
+ if self.tool['name'] in ['brush','eraser','rainbow','pencil'] :
self.last = []
widget.queue_draw()
self.enableUndo(widget)
+ self.drawing = False
self.desenha = False
def undo(self):