--- a/graphics/GraphicCommons.py Tue Feb 26 15:41:18 2008 +0100
+++ b/graphics/GraphicCommons.py Wed Feb 27 11:12:28 2008 +0100
@@ -518,10 +518,12 @@
self.SetSize(width, height)
# Refreshes the element state according to move defined and handle selected
- def ProcessDragging(self, movex, movey, centered, scaling):
+ def ProcessDragging(self, movex, movey, centered, scaling, width_fac = 1, height_fac = 1):
handle_type, handle = self.Handle
# If it is a resize handle, calculate the values from resizing
if handle_type == HANDLE_RESIZE:
+ if scaling is not None:
+ scaling = (scaling[0] * width_fac, scaling[1] * height_fac)
x = y = start_x = start_y = 0
width, height = start_width, start_height = self.GetSize()
if handle[0] == 1:
--- a/graphics/LD_Objects.py Tue Feb 26 15:41:18 2008 +0100
+++ b/graphics/LD_Objects.py Wed Feb 27 11:12:28 2008 +0100
@@ -311,6 +311,10 @@
else:
self.Parent.PopupDefaultMenu()
+ def Resize(self, x, y, width, height):
+ self.Move(x, y)
+ self.SetSize(LD_POWERRAIL_WIDTH, height)
+
# Refreshes the powerrail state according to move defined and handle selected
def ProcessDragging(self, movex, movey, centered, scaling):
handle_type, handle = self.Handle
@@ -341,7 +345,10 @@
dc.SetPen(wx.BLACK_PEN)
dc.SetBrush(wx.BLACK_BRUSH)
# Draw a rectangle with the power rail size
- dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
+ if self.Type == LEFTRAIL:
+ dc.DrawRectangle(self.Pos.x + self.Size[0] - LD_POWERRAIL_WIDTH, self.Pos.y, LD_POWERRAIL_WIDTH + 1, self.Size[1] + 1)
+ else:
+ dc.DrawRectangle(self.Pos.x, self.Pos.y, LD_POWERRAIL_WIDTH + 1, self.Size[1] + 1)
# Draw connectors
for connector in self.Connectors:
if connector:
--- a/graphics/SFC_Objects.py Tue Feb 26 15:41:18 2008 +0100
+++ b/graphics/SFC_Objects.py Wed Feb 27 11:12:28 2008 +0100
@@ -528,7 +528,7 @@
rect = rect.Union(self.Input.GetConnectedRedrawRect(movex, movey))
if self.Output.IsConnected():
rect = rect.Union(self.Output.GetConnectedRedrawRect(movex, movey))
- if self.Type == "connection" and self.Connection.IsConnected():
+ if self.Type == "connection" and self.Condition.IsConnected():
rect = rect.Union(self.Condition.GetConnectedRedrawRect(movex, movey))
return rect
@@ -778,7 +778,7 @@
self.RefreshOutputPosition()
return movex, 0
else:
- return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling)
+ return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling, width_fac = 2, height_fac = 2)
# Refresh input element model
def RefreshInputModel(self):
@@ -816,7 +816,12 @@
dc.SetPen(wx.BLACK_PEN)
dc.SetBrush(wx.BLACK_BRUSH)
# Draw plain rectangle for representing the transition
- dc.DrawRectangle(self.Pos.x, self.Pos.y, self.Size[0] + 1, self.Size[1] + 1)
+ dc.DrawRectangle(self.Pos.x,
+ self.Pos.y + (self.Size[1] - SFC_TRANSITION_SIZE[1])/2,
+ self.Size[0] + 1,
+ SFC_TRANSITION_SIZE[1] + 1)
+ vertical_line_x = self.Input.GetPosition()[0]
+ dc.DrawLine(vertical_line_x, self.Pos.y, vertical_line_x, self.Pos.y + self.Size[1])
# Draw transition condition
if self.Type != "connection":
text_width, text_height = self.ConditionSize
@@ -855,10 +860,7 @@
self.Id = id
self.RealConnectors = None
number = max(2, number)
- if self.Type in [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE]:
- self.Size = wx.Size((number - 1) * SFC_DEFAULT_SEQUENCE_INTERVAL, 1)
- elif self.Type in [SIMULTANEOUS_DIVERGENCE, SIMULTANEOUS_CONVERGENCE]:
- self.Size = wx.Size((number - 1) * SFC_DEFAULT_SEQUENCE_INTERVAL, 3)
+ self.Size = wx.Size((number - 1) * SFC_DEFAULT_SEQUENCE_INTERVAL, self.GetMinSize()[1])
# Create an input and output connector
if self.Type in [SELECTION_DIVERGENCE, SIMULTANEOUS_DIVERGENCE]:
self.Inputs = [Connector(self, "", None, wx.Point(self.Size[0] / 2, 0), NORTH, onlyone = True)]
@@ -901,7 +903,7 @@
# Forbids to resize the divergence
def Resize(self, x, y, width, height):
if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
- Graphic_Element.Resize(self, x, y, width, height)
+ Graphic_Element.Resize(self, x, 0, width, self.GetMinSize()[1])
# Delete this divergence by calling the appropriate method
def Delete(self):
@@ -1420,7 +1422,7 @@
self.RefreshInputPosition()
return movex, 0
else:
- return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling)
+ return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling, width_fac = 2)
# Refresh input element model
def RefreshInputModel(self):