--- a/graphics/SFC_Objects.py Tue Feb 21 23:56:13 2012 +0100
+++ b/graphics/SFC_Objects.py Wed Mar 07 10:06:01 2012 +0100
@@ -1179,11 +1179,7 @@
# Returns if the point given is in the bounding box
def HitTest(self, pt, connectors=True):
- if connectors:
- rect = self.BoundingBox
- else:
- rect = wx.Rect(self.Pos.x, self.Pos.y, self.Size[0], self.Size[1])
- return rect.InsideXY(pt.x, pt.y) or self.TestConnector(pt, exclude=False) != None
+ return self.BoundingBox.InsideXY(pt.x, pt.y) or self.TestConnector(pt, exclude=False) != None
# Refresh the divergence bounding box
def RefreshBoundingBox(self):
@@ -1349,25 +1345,11 @@
# Method called when a LeftDown event have been generated
def OnLeftDown(self, event, dc, scaling):
- self.RealConnectors = {"Inputs":[],"Outputs":[]}
- for input in self.Inputs:
- position = input.GetRelPosition()
- self.RealConnectors["Inputs"].append(float(position.x)/float(self.Size[0]))
- for output in self.Outputs:
- position = output.GetRelPosition()
- self.RealConnectors["Outputs"].append(float(position.x)/float(self.Size[0]))
- Graphic_Element.OnLeftDown(self, event, dc, scaling)
-
- # Method called when a LeftUp event have been generated
- def OnLeftUp(self, event, dc, scaling):
- Graphic_Element.OnLeftUp(self, event, dc, scaling)
- self.RealConnectors = None
-
- # Method called when a RightDown event have been generated
- def OnRightDown(self, event, dc, scaling):
- pos = GetScaledEventPosition(event, dc, scaling)
- # Test if a connector have been handled
- connector = self.TestConnector(pos, exclude=False)
+ connector = None
+ if event.ControlDown():
+ pos = GetScaledEventPosition(event, dc, scaling)
+ # Test if a connector have been handled
+ connector = self.TestConnector(pos, exclude=False)
if connector:
self.Handle = (HANDLE_CONNECTOR, connector)
wx.CallAfter(self.Parent.SetCurrentCursor, 1)
@@ -1375,10 +1357,17 @@
# Initializes the last position
self.oldPos = GetScaledEventPosition(event, dc, scaling)
else:
- Graphic_Element.OnRightDown(self, event, dc, scaling)
-
- # Method called when a RightUp event have been generated
- def OnRightUp(self, event, dc, scaling):
+ self.RealConnectors = {"Inputs":[],"Outputs":[]}
+ for input in self.Inputs:
+ position = input.GetRelPosition()
+ self.RealConnectors["Inputs"].append(float(position.x)/float(self.Size[0]))
+ for output in self.Outputs:
+ position = output.GetRelPosition()
+ self.RealConnectors["Outputs"].append(float(position.x)/float(self.Size[0]))
+ Graphic_Element.OnLeftDown(self, event, dc, scaling)
+
+ # Method called when a LeftUp event have been generated
+ def OnLeftUp(self, event, dc, scaling):
handle_type, handle = self.Handle
if handle_type == HANDLE_CONNECTOR and self.Dragging and self.oldPos:
wires = handle.GetWires()
@@ -1390,17 +1379,20 @@
block.RefreshInputModel()
else:
block.RefreshOutputModel()
- Graphic_Element.OnRightUp(self, event, dc, scaling)
- else:
- pos = GetScaledEventPosition(event, dc, scaling)
- # Popup the menu with special items for a block and a connector if one is handled
- connector = self.TestConnector(pos, exclude=False)
- if connector:
- self.Handle = (HANDLE_CONNECTOR, connector)
- self.Parent.PopupDivergenceMenu(True)
- else:
- # Popup the divergence menu without delete branch
- self.Parent.PopupDivergenceMenu(False)
+ Graphic_Element.OnLeftUp(self, event, dc, scaling)
+ self.RealConnectors = None
+
+ # Method called when a RightUp event have been generated
+ def OnRightUp(self, event, dc, scaling):
+ pos = GetScaledEventPosition(event, dc, scaling)
+ # Popup the menu with special items for a block and a connector if one is handled
+ connector = self.TestConnector(pos, exclude=False)
+ if connector:
+ self.Handle = (HANDLE_CONNECTOR, connector)
+ self.Parent.PopupDivergenceMenu(True)
+ else:
+ # Popup the divergence menu without delete branch
+ self.Parent.PopupDivergenceMenu(False)
# Refreshes the divergence state according to move defined and handle selected
def ProcessDragging(self, movex, movey, event, scaling):