X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fcomponents%2FGUIManualSwitch.java;h=8b9bcd90e59f08c39f2a185da9c88d9e41492a4e;hb=4dca33ac72b3f476ab069d6627f5e824c4a55a5b;hp=265efa3ca7e33dd2bb5bd19afd8a97085fe6e74e;hpb=7123af7d72607a7325f71e6db799837c8fac4d10;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIManualSwitch.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIManualSwitch.java index 265efa3c..8b9bcd90 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIManualSwitch.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIManualSwitch.java @@ -1,7 +1,5 @@ package net.mograsim.logic.ui.model.components; -import net.mograsim.logic.ui.model.ViewModel; -import net.mograsim.logic.ui.model.wires.Pin; import net.haspamelodica.swt.helper.gcs.GeneralGC; import net.haspamelodica.swt.helper.swtobjectwrappers.Font; import net.haspamelodica.swt.helper.swtobjectwrappers.Point; @@ -11,6 +9,8 @@ import net.mograsim.logic.core.LogicObserver; import net.mograsim.logic.core.components.ManualSwitch; import net.mograsim.logic.core.types.BitVectorFormatter; import net.mograsim.logic.core.wires.Wire.ReadEnd; +import net.mograsim.logic.ui.model.ViewModelModifiable; +import net.mograsim.logic.ui.model.wires.Pin; public class GUIManualSwitch extends GUIComponent { @@ -24,10 +24,10 @@ public class GUIManualSwitch extends GUIComponent private ManualSwitch logicSwitch; private ReadEnd end; - public GUIManualSwitch(ViewModel model) + public GUIManualSwitch(ViewModelModifiable model) { super(model); - logicObs = (i) -> callComponentLookChangedListeners(); + logicObs = (i) -> requestRedraw(); setSize(width, height); addPin(this.outputPin = new Pin(this, 1, width, height / 2)); @@ -40,7 +40,7 @@ public class GUIManualSwitch extends GUIComponent double posY = getBounds().y; // TODO maybe draw switch state too? - gc.drawRectangle(posX, posY, width, height); + gc.drawRectangle(getBounds()); String label = BitVectorFormatter.formatValueAsString(end); Font oldFont = gc.getFont(); Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle());