--- a/graphics/GraphicCommons.py Mon Sep 10 16:12:29 2007 +0200
+++ b/graphics/GraphicCommons.py Mon Sep 10 18:16:07 2007 +0200
@@ -229,8 +229,9 @@
self.Redraw()
# Method that erase the last box and draw the new box
- def Redraw(self):
- dc = self.drawingSurface.GetLogicalDC()
+ def Redraw(self, dc = None):
+ if not dc:
+ dc = self.drawingSurface.GetLogicalDC()
dc.SetPen(wx.Pen(wx.WHITE, 1, wx.DOT))
dc.SetBrush(wx.TRANSPARENT_BRUSH)
dc.SetLogicalFunction(wx.XOR)
@@ -242,20 +243,22 @@
# Draw current box
dc.DrawRectangle(self.currentBox.x, self.currentBox.y, self.currentBox.width,
self.currentBox.height)
-
+
# Erase last box
- def Erase(self):
- dc = self.drawingSurface.GetLogicalDC()
+ def Erase(self, dc = None):
+ if not dc:
+ dc = self.drawingSurface.GetLogicalDC()
dc.SetPen(wx.Pen(wx.WHITE, 1, wx.DOT))
dc.SetBrush(wx.TRANSPARENT_BRUSH)
dc.SetLogicalFunction(wx.XOR)
if self.lastBox:
dc.DrawRectangle(self.lastBox.x, self.lastBox.y, self.lastBox.width,
self.lastBox.height)
-
+
# Draw current box
- def Draw(self):
- dc = self.drawingSurface.GetLogicalDC()
+ def Draw(self, dc = None):
+ if not dc:
+ dc = self.drawingSurface.GetLogicalDC()
dc.SetPen(wx.Pen(wx.WHITE, 1, wx.DOT))
dc.SetBrush(wx.TRANSPARENT_BRUSH)
dc.SetLogicalFunction(wx.XOR)
@@ -264,7 +267,6 @@
dc.DrawRectangle(self.currentBox.x, self.currentBox.y, self.currentBox.width,
self.currentBox.height)
-
#-------------------------------------------------------------------------------
# Graphic element base class
#-------------------------------------------------------------------------------
@@ -451,6 +453,7 @@
if self.Dragging:
self.oldPos = pos
self.ProcessDragging(movex, movey)
+ return True
# If cursor just pass over the element, changes the cursor if it is on a handle
else:
pos = event.GetLogicalPosition(dc)
@@ -461,6 +464,7 @@
if cursor != self.CurrentCursor:
self.Parent.SetCursor(CURSORS[cursor])
self.CurrentCursor = cursor
+ return False
# Moves the element
def Move(self, dx, dy, exclude = []):
@@ -1578,6 +1582,7 @@
if self.CurrentCursor != 5:
self.CurrentCursor = 5
wx.CallAfter(self.Parent.SetCursor, CURSORS[5])
+ return False
else:
# Test if a point has been handled
#result = self.TestPoint(pos)
@@ -1590,10 +1595,10 @@
# self.OverStart = False
# self.OverEnd = False
# Execute the default method for a graphic element
- Graphic_Element.OnMotion(self, event, dc, scaling)
+ return Graphic_Element.OnMotion(self, event, dc, scaling)
else:
# Execute the default method for a graphic element
- Graphic_Element.OnMotion(self, event, dc, scaling)
+ return Graphic_Element.OnMotion(self, event, dc, scaling)
# Refreshes the wire state according to move defined and handle selected
def ProcessDragging(self, movex, movey):