Suppressed warnings where the thing warned about is intentional
[Mograsim.git] / LogicUI / src / era / mi / gui / model / wires / WireCrossPoint.java
index 7c19c13..04c5f1e 100644 (file)
@@ -10,19 +10,25 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
 
 public class WireCrossPoint extends GUIComponent
 {
+       private final Pin pin;
+
        private ReadEnd end;
+       private final int logicWidth;
 
-       public WireCrossPoint(ViewModel model)
+       public WireCrossPoint(ViewModel model, int logicWidth)
        {
                super(model);
+               this.logicWidth = logicWidth;
                setSize(0, 0);
-               addPin(new Pin(this, 0, 0));
+               addPin(this.pin = new Pin(this, logicWidth, 0, 0));
        }
 
        @Override
        public void render(GeneralGC gc, Rectangle visibleRegion)
        {
-               ColorHelper.executeWithDifferentBackground(gc, BitVectorFormatter.formatAsColor(end), () -> gc.fillOval(-1, -1, 2, 2));
+               Rectangle bounds = getBounds();
+               ColorHelper.executeWithDifferentBackground(gc, BitVectorFormatter.formatAsColor(end),
+                               () -> gc.fillOval(bounds.x - 1, bounds.y - 1, 2, 2));
        }
 
        public void setLogicModelBinding(ReadEnd end)
@@ -30,4 +36,14 @@ public class WireCrossPoint extends GUIComponent
                this.end = end;
                end.addObserver((i, o) -> callComponentLookChangedListeners());
        }
+
+       public int getLogicWidth()
+       {
+               return logicWidth;
+       }
+
+       public Pin getPin()
+       {
+               return pin;
+       }
 }
\ No newline at end of file