Made wires with logicWidth!=1 thicker
[Mograsim.git] / net.mograsim.logic.model / src / net / mograsim / logic / model / model / wires / GUIWire.java
index 99241a3..c564571 100644 (file)
@@ -18,6 +18,7 @@ import net.mograsim.logic.core.wires.Wire.ReadEnd;
 import net.mograsim.logic.model.model.ViewModelModifiable;
 import net.mograsim.preferences.ColorDefinition;
 import net.mograsim.preferences.ColorManager;
+import net.mograsim.preferences.Preferences;
 
 /**
  * A wire connecting exactly two {@link Pin}s.
@@ -252,18 +253,18 @@ public class GUIWire
 
                recalculateEffectivePath();
 
-               model.wireCreated(this);
+               model.wireCreated(this, this::destroyed);
        }
 
        /**
-        * Destroys this wire. This method implicitly calls {@link ViewModelModifiable#wireDestroyed(GUIWire) wireDestroyed()} for the model
-        * this component is a part of.
+        * Destroys this wire. This method is called from {@link ViewModelModifiable#wireDestroyed(GUIWire) wireDestroyed()} of the model this
+        * wire is a part of.
         * 
         * @author Daniel Kirschten
         */
-       public void destroy()
+       private void destroyed()
        {
-               model.wireDestroyed(this);
+               // nothing to do
        }
 
        // pins
@@ -364,11 +365,15 @@ public class GUIWire
         */
        public void render(GeneralGC gc)
        {
-               // TODO maybe make wires with logicWidth!=1 thicker? Maybe make thickness selectable?
                ColorDefinition wireColor = BitVectorFormatter.formatAsColor(end);
                if (wireColor != null)
                        gc.setForeground(ColorManager.current().toColor(wireColor));
+               if (logicWidth == 1)
+                       gc.setLineWidth(Preferences.current().getDouble("net.mograsim.logic.model.linewidth.wire.singlebit"));
+               else
+                       gc.setLineWidth(Preferences.current().getDouble("net.mograsim.logic.model.linewidth.wire.multibit"));
                gc.drawPolyline(effectivePath);
+               gc.setLineWidth(Preferences.current().getDouble("net.mograsim.logic.model.linewidth.default"));
        }
 
        // operations concerning the path