Speedup by changing redraw listener system
[Mograsim.git] / net.mograsim.logic.model / src / net / mograsim / logic / model / model / components / atomic / GUIManualSwitch.java
index b79ec2f..611d341 100644 (file)
@@ -40,7 +40,7 @@ public class GUIManualSwitch extends GUIComponent
        public GUIManualSwitch(ViewModelModifiable model, String name)
        {
                super(model, name);
-               logicObs = (i) -> requestRedraw();
+               logicObs = (i) -> model.requestRedraw();
 
                setSize(width, height);
                addPin(this.outputPin = new Pin(this, "", 1, width, height / 2));
@@ -50,7 +50,7 @@ public class GUIManualSwitch extends GUIComponent
        public void render(GeneralGC gc, Rectangle visibleRegion)
        {
                // TODO maybe draw switch state too?
-               Color foreground = Preferences.current().getColor("net.mograsim.logic.ui.color.foreground");
+               Color foreground = Preferences.current().getColor("net.mograsim.logic.model.color.foreground");
                if (foreground != null)
                        gc.setForeground(foreground);
                gc.drawRectangle(getBounds());
@@ -59,7 +59,7 @@ public class GUIManualSwitch extends GUIComponent
                Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle());
                gc.setFont(labelFont);
                Point textExtent = gc.textExtent(label);
-               Color textColor = Preferences.current().getColor("net.mograsim.logic.ui.color.text");
+               Color textColor = Preferences.current().getColor("net.mograsim.logic.model.color.text");
                if (textColor != null)
                        gc.setForeground(textColor);
                gc.drawText(label, getPosX() + (width - textExtent.x) / 2, getPosY() + (height - textExtent.y) / 2, true);