graphics/LD_Objects.py
changeset 140 06d28f03f6f4
parent 138 9c74d00ce93e
child 144 b67a5de5a24a
--- a/graphics/LD_Objects.py	Mon Dec 31 13:36:11 2007 +0100
+++ b/graphics/LD_Objects.py	Wed Jan 02 18:15:31 2008 +0100
@@ -322,7 +322,7 @@
             if connector:
                 connector.Draw(dc)
         Graphic_Element.Draw(self, dc)
-
+        
 
 #-------------------------------------------------------------------------------
 #                         Ladder Diagram Contact
@@ -501,6 +501,15 @@
         if move:
             self.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
+            dc.DrawRectangle(self.Pos.x - 2, self.Pos.y - 2, 6, self.Size[1] + 5)
+            dc.DrawRectangle(self.Pos.x + self.Size[0] - 3, self.Pos.y - 2, 6, self.Size[1] + 5)
+    
     # Draws contact
     def Draw(self, dc):
         dc.SetPen(wx.BLACK_PEN)
@@ -526,7 +535,7 @@
         self.Input.Draw(dc)
         self.Output.Draw(dc)
         Graphic_Element.Draw(self, dc)
-
+        
 
 #-------------------------------------------------------------------------------
 #                         Ladder Diagram Coil
@@ -705,6 +714,15 @@
         if move:
             self.Output.RefreshWires()
     
+    # Draws the highlightment of this element if it is highlighted
+    def DrawHighlightment(self, dc):
+        if self.Highlighted:
+            dc.SetPen(wx.Pen(HIGHLIGHTCOLOR, 6, wx.SOLID))
+            dc.SetBrush(wx.TRANSPARENT_BRUSH)
+            # Draw a two circle arcs for representing the coil
+            dc.DrawEllipticArc(self.Pos.x, self.Pos.y - int(self.Size[1] * (sqrt(2) - 1.) / 2.) + 1, self.Size[0], int(self.Size[1] * sqrt(2)) - 1, 135, 225)
+            dc.DrawEllipticArc(self.Pos.x, self.Pos.y - int(self.Size[1] * (sqrt(2) - 1.) / 2.) + 1, self.Size[0], int(self.Size[1] * sqrt(2)) - 1, -45, 45)
+    
     # Draws coil
     def Draw(self, dc):
         dc.SetPen(wx.Pen(wx.BLACK, 2, wx.SOLID))
@@ -732,3 +750,4 @@
         self.Input.Draw(dc)
         self.Output.Draw(dc)
         Graphic_Element.Draw(self, dc)
+