Not connecting wire on scaled graphics bug and forbidding copy on the fly of groups fixed
authorlbessard
Mon, 30 Jun 2008 14:35:06 +0200
changeset 216 93af9ac5aeaf
parent 215 dd3381f38a9e
child 217 ddb5b2e499e2
Not connecting wire on scaled graphics bug and forbidding copy on the fly of groups fixed
Viewer.py
--- a/Viewer.py	Sat Jun 28 19:00:04 2008 +0200
+++ b/Viewer.py	Mon Jun 30 14:35:06 2008 +0200
@@ -1132,14 +1132,14 @@
                             self.RefreshRect(self.GetScrolledRect(rect), False)
                 elif connector:
                     self.DrawingWire = True
-                    pos = GetScaledEventPosition(event, self.GetLogicalDC(), self.Scaling)
+                    scaled_pos = GetScaledEventPosition(event, self.GetLogicalDC(), self.Scaling)
                     if (connector.GetDirection() == EAST):
-                        wire = Wire(self, [wx.Point(pos.x, pos.y), EAST], [wx.Point(pos.x, pos.y), WEST])
+                        wire = Wire(self, [wx.Point(pos.x, pos.y), EAST], [wx.Point(scaled_pos.x, scaled_pos.y), WEST])
                     else:
-                        wire = Wire(self, [wx.Point(pos.x, pos.y), WEST], [wx.Point(pos.x, pos.y), EAST])
-                    wire.oldPos = pos
+                        wire = Wire(self, [wx.Point(pos.x, pos.y), WEST], [wx.Point(scaled_pos.x, scaled_pos.y), EAST])
+                    wire.oldPos = scaled_pos
                     wire.Handle = (HANDLE_POINT, 0)
-                    wire.ProcessDragging(0, 0, False, self.Scaling)
+                    wire.ProcessDragging(0, 0, False, None)
                     wire.Handle = (HANDLE_POINT, 1)
                     self.AddWire(wire)
                     if self.SelectedElement:
@@ -1393,11 +1393,14 @@
                 self.RefreshScrollBars()
                 self.RefreshRect(self.GetScrolledRect(self.SelectedElement.GetRedrawRect(0, scaling[1])), False)
         elif keycode == wx.WXK_SPACE and self.SelectedElement is not None and self.SelectedElement.Dragging:
-            self.CopyBlock(self.SelectedElement, wx.Point(*self.SelectedElement.GetPosition()))
-            self.RefreshBuffer()
-            self.RefreshScrollBars()
-            self.ParentWindow.RefreshVariablePanel(self.TagName)
-            self.SelectedElement.Refresh()
+            if self.IsBlock(self.SelectedElement) or self.IsComment(self.SelectedElement):
+                self.CopyBlock(self.SelectedElement, wx.Point(*self.SelectedElement.GetPosition()))
+                self.RefreshBuffer()
+                self.RefreshScrollBars()
+                self.ParentWindow.RefreshVariablePanel(self.TagName)
+                self.SelectedElement.Refresh()
+            else:
+                event.Skip()
         else:
             event.Skip()