Bug drawing element selection state on printed documents fixed
authorlaurent
Thu, 27 Aug 2009 18:28:16 +0200
changeset 399 3b9e0b092298
parent 398 c215899298c7
child 400 12b55d82d363
Bug drawing element selection state on printed documents fixed
graphics/GraphicCommons.py
--- a/graphics/GraphicCommons.py	Thu Aug 27 16:29:23 2009 +0200
+++ b/graphics/GraphicCommons.py	Thu Aug 27 18:28:16 2009 +0200
@@ -812,24 +812,25 @@
     
     # Draws the handles of this element if it is selected
     def Draw(self, dc):
-        if self.Highlighted:
-            self.DrawHighlightment(dc)
-        if self.Selected:
-            dc.SetPen(wx.BLACK_PEN)
-            dc.SetBrush(wx.BLACK_BRUSH)
-            dc.DrawRectangle(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y - HANDLE_SIZE - 2, HANDLE_SIZE, HANDLE_SIZE)
-            dc.DrawRectangle(self.BoundingBox.x + (self.BoundingBox.width - HANDLE_SIZE) / 2,
-                self.BoundingBox.y - HANDLE_SIZE - 2, HANDLE_SIZE, HANDLE_SIZE)
-            dc.DrawRectangle(self.BoundingBox.x + self.BoundingBox.width + 2, 
-                self.BoundingBox.y - HANDLE_SIZE - 2, HANDLE_SIZE, HANDLE_SIZE)
-            dc.DrawRectangle(self.BoundingBox.x + self.BoundingBox.width + 2, 
-                self.BoundingBox.y + (self.BoundingBox.height - HANDLE_SIZE) / 2, HANDLE_SIZE, HANDLE_SIZE)
-            dc.DrawRectangle(self.BoundingBox.x + self.BoundingBox.width + 2, 
-                self.BoundingBox.y + self.BoundingBox.height + 2, HANDLE_SIZE, HANDLE_SIZE)
-            dc.DrawRectangle(self.BoundingBox.x + (self.BoundingBox.width - HANDLE_SIZE) / 2, 
-                self.BoundingBox.y + self.BoundingBox.height + 2, HANDLE_SIZE, HANDLE_SIZE)
-            dc.DrawRectangle(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y + self.BoundingBox.height + 2, HANDLE_SIZE, HANDLE_SIZE)
-            dc.DrawRectangle(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y + (self.BoundingBox.height - HANDLE_SIZE) / 2, HANDLE_SIZE, HANDLE_SIZE)
+        if not getattr(dc, "printing", False):
+            if self.Highlighted:
+                self.DrawHighlightment(dc)
+            if self.Selected:
+                dc.SetPen(wx.BLACK_PEN)
+                dc.SetBrush(wx.BLACK_BRUSH)
+                dc.DrawRectangle(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y - HANDLE_SIZE - 2, HANDLE_SIZE, HANDLE_SIZE)
+                dc.DrawRectangle(self.BoundingBox.x + (self.BoundingBox.width - HANDLE_SIZE) / 2,
+                    self.BoundingBox.y - HANDLE_SIZE - 2, HANDLE_SIZE, HANDLE_SIZE)
+                dc.DrawRectangle(self.BoundingBox.x + self.BoundingBox.width + 2, 
+                    self.BoundingBox.y - HANDLE_SIZE - 2, HANDLE_SIZE, HANDLE_SIZE)
+                dc.DrawRectangle(self.BoundingBox.x + self.BoundingBox.width + 2, 
+                    self.BoundingBox.y + (self.BoundingBox.height - HANDLE_SIZE) / 2, HANDLE_SIZE, HANDLE_SIZE)
+                dc.DrawRectangle(self.BoundingBox.x + self.BoundingBox.width + 2, 
+                    self.BoundingBox.y + self.BoundingBox.height + 2, HANDLE_SIZE, HANDLE_SIZE)
+                dc.DrawRectangle(self.BoundingBox.x + (self.BoundingBox.width - HANDLE_SIZE) / 2, 
+                    self.BoundingBox.y + self.BoundingBox.height + 2, HANDLE_SIZE, HANDLE_SIZE)
+                dc.DrawRectangle(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y + self.BoundingBox.height + 2, HANDLE_SIZE, HANDLE_SIZE)
+                dc.DrawRectangle(self.BoundingBox.x - HANDLE_SIZE - 2, self.BoundingBox.y + (self.BoundingBox.height - HANDLE_SIZE) / 2, HANDLE_SIZE, HANDLE_SIZE)
 
 
 #-------------------------------------------------------------------------------
@@ -2610,7 +2611,7 @@
         dc.DrawLines(self.Points)
         dc.DrawPoint(self.Points[-1].x, self.Points[-1].y)
         # Draw the segment selected in red
-        if self.SelectedSegment is not None:
+        if not getattr(dc, "printing", False) and self.SelectedSegment is not None:
             dc.SetPen(wx.RED_PEN)
             dc.DrawLine(self.Points[self.SelectedSegment].x, self.Points[self.SelectedSegment].y,
                         self.Points[self.SelectedSegment + 1].x, self.Points[self.SelectedSegment + 1].y)