Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Area.py19
-rw-r--r--Desenho.py29
-rw-r--r--NEWS4
3 files changed, 32 insertions, 20 deletions
diff --git a/Area.py b/Area.py
index 0451c32..8d62654 100644
--- a/Area.py
+++ b/Area.py
@@ -135,6 +135,7 @@ class Area(gtk.DrawingArea):
self.rainbow_counter = 0
self.font = pango.FontDescription('Sans 9')
+ self._set_selection_bounds(0,0,0,0)
#start of UNDO and REDO
self.first_undo = True
@@ -269,9 +270,13 @@ class Area(gtk.DrawingArea):
self.last = -1, -1
self.d.rainbow(widget, coords, self.last, self.rainbow_counter,self.line_size, self.brush_shape)
self.last = coords
+
x , y, state = event.window.get_pointer()
- if state & gtk.gdk.BUTTON3_MASK:
+ x0, y0, x1, y1 = self.get_selection_bounds()
+
+ if (state & gtk.gdk.BUTTON3_MASK) or not (x0<x<x1 and y0<y<y1):
self.sel_get_out = True
+ self.pixmap.draw_drawable(self.gc, self.pixmap_temp, 0,0,0,0, width, height)
self.pixmap_sel.draw_drawable(self.gc, self.pixmap_temp, 0,0,0,0, width, height)
if state & gtk.gdk.BUTTON1_MASK:
self.pixmap_temp.draw_drawable(self.gc, self.pixmap, 0,0,0,0, width, height)
@@ -394,14 +399,14 @@ class Area(gtk.DrawingArea):
elif self.tool == 'marquee-rectangular':
# FIXME: Adicionar cursor formato selecao
if self.selmove == False:
- self.pixmap_temp.draw_drawable(self.gc,self.pixmap, 0 , 0 ,0,0, width, height)
- self.pixmap_sel.draw_drawable(self.gc,self.pixmap, 0 , 0 ,0,0, width, height)#avoid blink
+ self.pixmap_temp.draw_drawable(self.gc,self.pixmap, 0,0,0,0, width, height)
+ self.pixmap_sel.draw_drawable(self.gc,self.pixmap, 0,0,0,0, width, height)#avoid blink
self.sx = int (event.x)
self.sy = int(event.y)
self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.FLEUR))
self.selmove = True
self.sel_get_out = False
- elif self.selmove and self.sel_get_out: #get out of the func selection
+ elif self.sel_get_out: #get out of the func selection
self.pixmap.draw_drawable(self.gc, self.pixmap_temp, 0,0,0,0, width, height)
self.selmove = False
self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.TCROSS))
@@ -797,14 +802,14 @@ class Area(gtk.DrawingArea):
if not load_selected :
self.enableUndo(widget)
else :
+ self.selmove = True
+ self.desenha = True
self.oldx, self.oldy = 0,0
self.d.selection(self, size, True, False)
- #self.pixmap_temp.draw_rectangle(self.gc_selection, True ,0,0,size[0],size[1])
+ self.pixmap_sel.draw_rectangle(self.gc_selection, True ,0,0,size[0],size[1])
self.sx, self.sy = size
self.tool = 'marquee-rectangular'
self.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.FLEUR))
- self.selmove = True
- self.desenha = True
self.queue_draw()
diff --git a/Desenho.py b/Desenho.py
index 413b016..cdc43c9 100644
--- a/Desenho.py
+++ b/Desenho.py
@@ -85,7 +85,7 @@ class Desenho:
coords -- Two value tuple
"""
- width, height = self.window.get_size()
+ width, height = self.d.window.get_size()
self.d.pixmap_temp.draw_drawable(self.d.gc,self.d.pixmap, 0 , 0 ,0,0, width, height)
self.d.pixmap_temp.draw_line(self.d.gc_line,self.d.oldx,self.d.oldy,coords[0],coords[1])
#self.d.newx = coords[0]
@@ -569,10 +569,12 @@ class Desenho:
pixmap.draw_drawable(self.d.gc,self.d.pixmap,0,0,0,0,width,height)
if fill == True:
- pixmap.draw_rectangle(self.d.gc,True,x,y,dx,dy)
- pixmap.draw_rectangle(self.d.gc_selection,False,x,y,dx,dy)
+ pixmap.draw_rectangle(self.d.gc,True,int(x),int(y),int(dx),int(dy))
+
+ pixmap.draw_rectangle(self.d.gc_selection,False,int(x),int(y),int(dx),int(dy))
widget.queue_draw()
- return self.d.oldx, self.d.oldy, coords[0], coords[1]
+ #return self.d.oldx, self.d.oldy, coords[0], coords[1]
+ return x,y,x+dx,y+dy
def moveSelection(self, widget, coords):
"""Move the selection.
@@ -584,9 +586,8 @@ class Desenho:
"""
width, height = self.d.window.get_size()
- self.d.pixmap_temp.draw_drawable(self.d.gc,self.d.pixmap, 0 , 0 ,0,0, width, height)
- self.d.pixmap_sel.draw_drawable(self.d.gc,self.d.pixmap, 0 , 0 ,0,0, width, height)
+ self.d.pixmap_sel.draw_drawable(self.d.gc,self.d.pixmap,0,0,0,0, width, height)
if self.d.sx > self.d.oldx:
x0 = self.d.oldx
@@ -594,9 +595,9 @@ class Desenho:
x0 = self.d.sx
if self.d.sy > self.d.oldy:
- x1 = self.d.oldy
+ y0 = self.d.oldy
else:
- x1 = self.d.sy
+ y0 = self.d.sy
w = self.d.sx - self.d.oldx
if w < 0:
@@ -605,16 +606,18 @@ class Desenho:
h = self.d.sy - self.d.oldy
if h < 0:
h = - h
+
+ self.d._set_selection_bounds(coords[0]-w/2, coords[1]-h/2, coords[0]+w/2, coords[1]+h/2)
+
- self.d.pixmap_temp.draw_rectangle(self.d.get_style().white_gc, True, x0, x1, w, h)
- self.d.pixmap_temp.draw_drawable(self.d.gc, self.d.pixmap, x0, x1, coords[0] - w/2, coords[1]- h/2, w, h)
+ self.d.pixmap_sel.draw_rectangle(self.d.get_style().white_gc, True, x0, y0, w, h)
+ self.d.pixmap_sel.draw_drawable(self.d.gc, self.d.pixmap, x0, y0, coords[0] - w/2, coords[1]- h/2, w, h)
+ self.d.pixmap_temp.draw_drawable(self.d.gc, self.d.pixmap_sel,0,0,0,0, width, height)
- self.d.pixmap_sel.draw_rectangle(self.d.get_style().white_gc, True, x0, x1, w, h)
- self.d.pixmap_sel.draw_drawable(self.d.gc, self.d.pixmap, x0, x1, coords[0] - w/2, coords[1]- h/2, w, h)
#to draw the selection black and white line rectangle
self.d.pixmap_sel.draw_rectangle(self.d.gc_selection, False ,coords[0] - w/2, coords[1]- h/2, w, h)
self.d.pixmap_sel.draw_rectangle(self.d.gc_selection1, False ,coords[0] - w/2-1, coords[1]- h/2-1, w+2, h+2)
-
+
widget.queue_draw()
diff --git a/NEWS b/NEWS
index a919bcc..3b76917 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,10 @@
5
===
+<<<<<<< .mine
Added 'Clear' button (alexandre)
+=======
+Modifications on selection and gelection bounds (pekayatt)
+>>>>>>> .r96
Added rainbow effect (andremossinato)
Side number for regular polygon can be choosen (alexandre)
New shape available: Heart (andremossinato)