graphics/SFC_Objects.py
changeset 2 93bc4c2cf376
parent 1 e9d01d824086
child 5 f8652b073e84
--- a/graphics/SFC_Objects.py	Thu Feb 01 18:09:34 2007 +0100
+++ b/graphics/SFC_Objects.py	Wed Feb 07 18:43:32 2007 +0100
@@ -446,10 +446,10 @@
         else:
             text_width, text_height = dc.GetTextExtent("Transition")
         # Calculate the bounding box size
-        bbx_width = self.Size[0] + CONNECTOR_SIZE + 2 + text_width
-        bbx_y = self.Pos.y - max(0, (text_height - self.Size[1]) / 2)
+        bbx_width = self.Size[0] + 5 + text_width
+        bbx_y = self.Pos.y - max(0, (text_height - 5 - self.Size[1]) / 2)
         bbx_height = max(self.Size[1], text_height)
-        self.BoundingBox = wxRect(self.Pos.x, bbx_y, bbx_width + 1, bbx_height + 1)
+        self.BoundingBox = wxRect(self.Pos.x, bbx_y, bbx_width + 1, bbx_height - 4)
         
     # Returns the connector connected to input
     def GetPreviousConnector(self):
@@ -624,7 +624,7 @@
         else:
             text_width, text_height = dc.GetTextExtent("Transition")
             condition = "Transition"
-        dc.DrawText(condition, self.Pos.x + self.Size[0] + CONNECTOR_SIZE + 2,
+        dc.DrawText(condition, self.Pos.x + self.Size[0] + 5,
                     self.Pos.y + (self.Size[1] - text_height) / 2)
         # Draw input and output connectors
         self.Input.Draw(dc)
@@ -734,11 +734,11 @@
     # Refresh the divergence bounding box
     def RefreshBoundingBox(self):
         if self.Type in [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE]:
-            self.BoundingBox = wxRect(self.Pos.x, self.Pos.y - CONNECTOR_SIZE, 
-                self.Size[0] + 1, self.Size[1] + CONNECTOR_SIZE * 2 + 1)
+            self.BoundingBox = wxRect(self.Pos.x, self.Pos.y - 2, 
+                self.Size[0] + 1, self.Size[1] + 5)
         elif self.Type in [SIMULTANEOUS_DIVERGENCE, SIMULTANEOUS_CONVERGENCE]:
-            self.BoundingBox = wxRect(self.Pos.x - SFC_SIMULTANEOUS_SEQUENCE_EXTRA, self.Pos.y - CONNECTOR_SIZE, 
-                self.Size[0] + 2 * SFC_SIMULTANEOUS_SEQUENCE_EXTRA + 1, self.Size[1] + CONNECTOR_SIZE * 2 + 1)
+            self.BoundingBox = wxRect(self.Pos.x - SFC_SIMULTANEOUS_SEQUENCE_EXTRA, self.Pos.y - 2, 
+                self.Size[0] + 2 * SFC_SIMULTANEOUS_SEQUENCE_EXTRA + 1, self.Size[1] + 5)
     
     # Refresh the position of wires connected to divergence
     def RefreshConnected(self, exclude = []):
@@ -1212,7 +1212,7 @@
             width, height = dc.GetTextExtent(action["qualifier"])
             self.ColSize[0] = max(self.ColSize[0], width + 10)
             if "duration" in action:
-                width, height = dc.GetTextExtent("T#%s"%action["duration"])
+                width, height = dc.GetTextExtent(action["duration"])
                 self.ColSize[0] = max(self.ColSize[0], width + 10)
             width, height = dc.GetTextExtent(action["value"])
             self.ColSize[1] = max(self.ColSize[1], width + 10)
@@ -1220,7 +1220,7 @@
                 width, height = dc.GetTextExtent(action["indicator"])
                 self.ColSize[2] = max(self.ColSize[2], width + 10)
         self.Size = wxSize(max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2],
-            self.Size[0]), len(self.Actions) * SFC_ACTION_MIN_SIZE[1])
+            SFC_ACTION_MIN_SIZE[0]), len(self.Actions) * SFC_ACTION_MIN_SIZE[1])
         self.RefreshBoundingBox()
         if self.Input:
             wires = self.Input.GetWires()
@@ -1235,7 +1235,8 @@
     
     # Returns the action block minimum size
     def GetMinSize(self):
-        return SFC_ACTION_MIN_SIZE[0], len(self.Actions) * SFC_ACTION_MIN_SIZE[1]
+        return max(self.ColSize[0] + self.ColSize[1] + self.ColSize[2],
+            SFC_ACTION_MIN_SIZE[0]), len(self.Actions) * SFC_ACTION_MIN_SIZE[1]
     
     # Method called when a LeftDClick event have been generated
     def OnLeftDClick(self, event, scaling):