--- a/graphics/SFC_Objects.py Wed Jan 30 09:52:57 2008 +0100
+++ b/graphics/SFC_Objects.py Wed Jan 30 18:48:05 2008 +0100
@@ -150,7 +150,6 @@
# Refresh the step bounding box
def RefreshBoundingBox(self):
- dc = wx.ClientDC(self.Parent)
# Calculate the bounding box size
if self.Action:
bbx_width = self.Size[0] + CONNECTOR_SIZE
@@ -290,8 +289,7 @@
# Returns the step minimum size
def GetMinSize(self):
- dc = wx.ClientDC(self.Parent)
- text_width, text_height = dc.GetTextExtent(self.Name)
+ text_width, text_height = self.Parent.GetTextExtent(self.Name)
if self.Initial:
return text_width + 14, text_height + 14
else:
@@ -393,7 +391,7 @@
self.Parent.PopupDefaultMenu()
# Refreshes the step state according to move defined and handle selected
- def ProcessDragging(self, movex, movey, scaling):
+ def ProcessDragging(self, movex, movey, centered, scaling):
handle_type, handle = self.Handle
if handle_type == HANDLE_MOVE:
movex = max(-self.BoundingBox.x, movex)
@@ -418,7 +416,7 @@
self.RefreshOutputPosition()
return movex, 0
else:
- return Graphic_Element.ProcessDragging(self, movex, movey, scaling)
+ return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling)
# Refresh input element model
def RefreshInputModel(self):
@@ -543,17 +541,15 @@
# Refresh the size of text for name
def RefreshConditionSize(self):
if self.Type != "connection":
- dc = wx.ClientDC(self.Parent)
if self.Condition != "":
- self.ConditionSize = dc.GetTextExtent(self.Condition)
+ self.ConditionSize = self.Parent.GetTextExtent(self.Condition)
else:
- self.ConditionSize = dc.GetTextExtent("Transition")
+ self.ConditionSize = self.Parent.GetTextExtent("Transition")
# Refresh the size of text for name
def RefreshPrioritySize(self):
if self.Priority != "":
- dc = wx.ClientDC(self.Parent)
- self.PrioritySize = dc.GetTextExtent(str(self.Priority))
+ self.PrioritySize = self.Parent.GetTextExtent(str(self.Priority))
else:
self.PrioritySize = None
@@ -570,7 +566,6 @@
# Refresh the transition bounding box
def RefreshBoundingBox(self):
- dc = wx.ClientDC(self.Parent)
bbx_x, bbx_y, bbx_width, bbx_height = self.Pos.x, self.Pos.y, self.Size[0], self.Size[1]
if self.Priority != 0:
bbx_y = self.Pos.y - self.PrioritySize[1] - 2
@@ -769,7 +764,7 @@
self.Parent.PopupDefaultMenu()
# Refreshes the transition state according to move defined and handle selected
- def ProcessDragging(self, movex, movey, scaling):
+ def ProcessDragging(self, movex, movey, centered, scaling):
if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
movex = max(-self.BoundingBox.x, movex)
if scaling is not None:
@@ -779,7 +774,7 @@
self.RefreshOutputPosition()
return movex, 0
else:
- return Graphic_Element.ProcessDragging(self, movex, movey, scaling)
+ return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling)
# Refresh input element model
def RefreshInputModel(self):
@@ -1196,7 +1191,7 @@
self.Parent.PopupDivergenceMenu(False)
# Refreshes the divergence state according to move defined and handle selected
- def ProcessDragging(self, movex, movey, scaling):
+ def ProcessDragging(self, movex, movey, centered, scaling):
handle_type, handle = self.Handle
# A connector has been handled
if handle_type == HANDLE_CONNECTOR:
@@ -1208,7 +1203,7 @@
self.RefreshConnectedPosition(handle)
return movex, 0
elif self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
- return Graphic_Element.ProcessDragging(self, movex, movey, scaling)
+ return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling)
return 0, 0
# Refresh output element model
@@ -1329,8 +1324,7 @@
# Refresh the jump bounding box
def RefreshBoundingBox(self):
- dc = wx.ClientDC(self.Parent)
- text_width, text_height = dc.GetTextExtent(self.Target)
+ text_width, text_height = self.Parent.GetTextExtent(self.Target)
# Calculate the bounding box size
bbx_width = self.Size[0] + 2 + text_width
self.BoundingBox = wx.Rect(self.Pos.x, self.Pos.y - CONNECTOR_SIZE,
@@ -1413,7 +1407,7 @@
self.Parent.PopupDefaultMenu()
# Refreshes the jump state according to move defined and handle selected
- def ProcessDragging(self, movex, movey, scaling):
+ def ProcessDragging(self, movex, movey, centered, scaling):
if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
movex = max(-self.BoundingBox.x, movex)
if scaling is not None:
@@ -1422,7 +1416,7 @@
self.RefreshInputPosition()
return movex, 0
else:
- return Graphic_Element.ProcessDragging(self, movex, movey, scaling)
+ return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling)
# Refresh input element model
def RefreshInputModel(self):
@@ -1575,23 +1569,22 @@
# Changes the action block actions
def SetActions(self, actions):
- dc = wx.ClientDC(self.Parent)
self.Actions = actions
self.ColSize = [0, 0, 0]
min_height = 0
for action in self.Actions:
- width, height = dc.GetTextExtent(action["qualifier"])
+ width, height = self.Parent.GetTextExtent(action["qualifier"])
self.ColSize[0] = max(self.ColSize[0], width + 10)
row_height = height
if "duration" in action:
- width, height = dc.GetTextExtent(action["duration"])
+ width, height = self.Parent.GetTextExtent(action["duration"])
row_height = max(row_height, height)
self.ColSize[0] = max(self.ColSize[0], width + 10)
- width, height = dc.GetTextExtent(action["value"])
+ width, height = self.Parent.GetTextExtent(action["value"])
row_height = max(row_height, height)
self.ColSize[1] = max(self.ColSize[1], width + 10)
if "indicator" in action and action["indicator"] != "":
- width, height = dc.GetTextExtent(action["indicator"])
+ width, height = self.Parent.GetTextExtent(action["indicator"])
row_height = max(row_height, height)
self.ColSize[2] = max(self.ColSize[2], width + 10)
min_height += row_height + 5
@@ -1632,7 +1625,7 @@
self.Parent.PopupDefaultMenu()
# Refreshes the action block state according to move defined and handle selected
- def ProcessDragging(self, movex, movey, scaling):
+ def ProcessDragging(self, movex, movey, centered, scaling):
if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
handle_type, handle = self.Handle
if handle_type == HANDLE_MOVE:
@@ -1647,9 +1640,9 @@
return movex, 0
return 0, 0
else:
- return Graphic_Element.ProcessDragging(self, movex, movey, scaling)
- else:
- return Graphic_Element.ProcessDragging(self, movex, movey, scaling)
+ return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling)
+ else:
+ return Graphic_Element.ProcessDragging(self, movex, movey, centered, scaling)
# Refreshes the action block model