graphics/LD_Objects.py
changeset 478 dc403c47af54
parent 383 25ffba02b6a8
child 495 d1c9517c0fe0
--- a/graphics/LD_Objects.py	Tue Dec 08 16:29:16 2009 +0100
+++ b/graphics/LD_Objects.py	Tue Dec 08 17:10:30 2009 +0100
@@ -410,6 +410,12 @@
             self.Output.Flush()
             self.Output = None
     
+    def SetForced(self, forced):
+        if self.Forced != forced:
+            self.Forced = forced
+            if self.Visible:
+                self.Parent.UpdateRefreshRect(self.GetRedrawRect())
+    
     def SetValue(self, value):
         self.PreviousValue = self.Value
         self.Value = value
@@ -626,14 +632,16 @@
     def Draw(self, dc):
         Graphic_Element.Draw(self, dc)
         if self.Value is not None:            
-            if self.Type == CONTACT_NORMAL and self.Value:
-                dc.SetPen(wx.GREEN_PEN)
-            elif self.Type == CONTACT_REVERSE and not self.Value:
-                dc.SetPen(wx.GREEN_PEN)
-            elif self.Type == CONTACT_RISING and self.Value and not self.PreviousValue:
-                dc.SetPen(wx.GREEN_PEN)
-            elif self.Type == CONTACT_FALLING and self.Value and not self.PreviousValue:
-                dc.SetPen(wx.GREEN_PEN)
+            if self.Type == CONTACT_NORMAL and self.Value or \
+               self.Type == CONTACT_REVERSE and not self.Value or \
+               self.Type == CONTACT_RISING and self.Value and not self.PreviousValue or \
+               self.Type == CONTACT_RISING and self.Value and not self.PreviousValue:
+                if self.Forced:
+                    dc.SetPen(wx.CYAN_PEN)
+                else:
+                    dc.SetPen(wx.GREEN_PEN)
+            elif self.Forced:
+                dc.SetPen(wx.Pen(wx.BLUE))
             else:
                 dc.SetPen(wx.BLACK_PEN)
         else:
@@ -915,7 +923,12 @@
     def Draw(self, dc):
         Graphic_Element.Draw(self, dc)
         if self.Value is not None and self.Value:
-            dc.SetPen(wx.Pen(wx.GREEN, 2, wx.SOLID))
+            if self.Forced:
+                dc.SetPen(wx.Pen(wx.CYAN, 2, wx.SOLID))
+            else:
+                dc.SetPen(wx.Pen(wx.GREEN, 2, wx.SOLID))
+        elif self.Forced:
+            dc.SetPen(wx.Pen(wx.BLUE, 2, wx.SOLID))
         else:
             dc.SetPen(wx.Pen(wx.BLACK, 2, wx.SOLID))
         dc.SetBrush(wx.TRANSPARENT_BRUSH)