graphics/SFC_Objects.py
changeset 140 06d28f03f6f4
parent 138 9c74d00ce93e
child 144 b67a5de5a24a
--- a/graphics/SFC_Objects.py	Mon Dec 31 13:36:11 2007 +0100
+++ b/graphics/SFC_Objects.py	Wed Jan 02 18:15:31 2008 +0100
@@ -446,6 +446,7 @@
         if self.Action:
             self.Action.Draw(dc)
         Graphic_Element.Draw(self, dc)
+        
 
 #-------------------------------------------------------------------------------
 #                       Sequencial Function Chart Transition
@@ -785,6 +786,7 @@
         if self.Type == "connection":
             self.Condition.Draw(dc)
         Graphic_Element.Draw(self, dc)
+        
 
 #-------------------------------------------------------------------------------
 #                Sequencial Function Chart Divergence and Convergence
@@ -1168,6 +1170,19 @@
                 for output in self.Outputs:
                     output.RefreshWires()
     
+    # Draws the highlightment of this element if it is highlighted
+    def DrawHighlightment(self, dc):
+        if self.Highlighted:
+            dc.SetPen(wx.Pen(HIGHLIGHTCOLOR))
+            dc.SetBrush(wx.Brush(HIGHLIGHTCOLOR))
+            # Draw two rectangles for representing the contact
+            posx = self.Pos.x - 2
+            width = self.Size[0] + 5
+            if self.Type in [SIMULTANEOUS_DIVERGENCE, SIMULTANEOUS_CONVERGENCE]:
+                posx -= SFC_SIMULTANEOUS_SEQUENCE_EXTRA
+                width += SFC_SIMULTANEOUS_SEQUENCE_EXTRA * 2
+            dc.DrawRectangle(posx, self.Pos.y - 2, width, self.Size[1] + 5)
+        
     # Draws divergence
     def Draw(self, dc):
         dc.SetPen(wx.BLACK_PEN)
@@ -1186,6 +1201,7 @@
         for output in self.Outputs:
             output.Draw(dc)
         Graphic_Element.Draw(self, dc)
+        
 
 #-------------------------------------------------------------------------------
 #                   Sequencial Function Chart Jump to Step
@@ -1349,6 +1365,16 @@
             if self.Parent.GetDrawingMode() != FREEDRAWING_MODE:
                 self.RefreshInputModel()
     
+    # Draws the highlightment of this element if it is highlighted
+    def DrawHighlightment(self, dc):
+        if self.Highlighted:
+            dc.SetPen(wx.Pen(HIGHLIGHTCOLOR))
+            dc.SetBrush(wx.Brush(HIGHLIGHTCOLOR))
+            points = [wx.Point(self.Pos.x - 3, self.Pos.y - 2),
+                      wx.Point(self.Pos.x + self.Size[0] + 4, self.Pos.y - 2),
+                      wx.Point(self.Pos.x + self.Size[0] / 2, self.Pos.y + self.Size[1] + 4)]
+            dc.DrawPolygon(points)
+    
     # Draws divergence
     def Draw(self, dc):
         dc.SetPen(wx.BLACK_PEN)
@@ -1367,7 +1393,7 @@
         if self.Input:
             self.Input.Draw(dc)
         Graphic_Element.Draw(self, dc)
-
+        
 
 #-------------------------------------------------------------------------------
 #                   Sequencial Function Chart Action Block
@@ -1565,4 +1591,4 @@
         # Draw input connector
         self.Input.Draw(dc)
         Graphic_Element.Draw(self, dc)
-
+