Made wires with logicWidth!=1 thicker
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 2 Sep 2019 20:46:19 +0000 (22:46 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 2 Sep 2019 20:46:19 +0000 (22:46 +0200)
net.mograsim.logic.model/src/net/mograsim/logic/model/LogicUIRenderer.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/submodels/SubmodelComponent.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/wires/GUIWire.java
net.mograsim.preferences/src/net/mograsim/preferences/DefaultPreferences.java

index 8a2ef4e..36b165a 100644 (file)
@@ -25,7 +25,7 @@ public class LogicUIRenderer
        {
                gc.setAntialias(SWT.ON);
                gc.setClipping(visibleRegion);
-               gc.setLineWidth(Preferences.current().getDouble("net.mograsim.logic.model.linewidth"));
+               gc.setLineWidth(Preferences.current().getDouble("net.mograsim.logic.model.linewidth.default"));
                model.getWiresByName().values().forEach(w ->
                {
                        Rectangle bounds = w.getBounds();
index 5119568..46d5945 100644 (file)
@@ -387,7 +387,7 @@ public abstract class SubmodelComponent extends GUIComponent
                }
                conf.reset(gc);
                // reset line width explicitly to avoid rounding errors causing weird glitches
-               gc.setLineWidth(Preferences.current().getDouble("net.mograsim.logic.model.linewidth"));
+               gc.setLineWidth(Preferences.current().getDouble("net.mograsim.logic.model.linewidth.default"));
                // draw the outline after all other operations to make interface pins look better
                renderOutline(gc, visibleRegion);
        }
index 8b91fc4..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.
@@ -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
index d2c2342..2f5c7c2 100644 (file)
@@ -31,8 +31,12 @@ public class DefaultPreferences extends Preferences
        {
                switch (name)
                {
-               case "net.mograsim.logic.model.linewidth":
+               case "net.mograsim.logic.model.linewidth.default":
                        return 0.5;
+               case "net.mograsim.logic.model.linewidth.wire.singlebit":
+                       return 0.5;
+               case "net.mograsim.logic.model.linewidth.wire.multibit":
+                       return 0.85;
                default:
                        throw new IllegalArgumentException("Unknown double preference name: " + name);
                }