Merge branch 'development' of
[Mograsim.git] / LogicUI / src / era / mi / gui / components / GUIManualSwitch.java
index 9af3940..7bec909 100644 (file)
@@ -1,90 +1,6 @@
 package era.mi.gui.components;\r
 \r
-import java.util.ArrayList;\r
-import java.util.Collections;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import era.mi.logic.Bit;\r
-import era.mi.logic.components.ManualSwitch;\r
-import era.mi.logic.wires.WireArray;\r
-import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
-import net.haspamelodica.swt.helper.swtobjectwrappers.Font;\r
-import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
-import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;\r
-\r
-public class GUIManualSwitch extends ManualSwitch implements BasicGUIComponent\r
+public class GUIManualSwitch\r
 {\r
-       private static final Map<Bit, String> bitNames;\r
-       static\r
-       {\r
-               Map<Bit, String> bitNamesModifiable = new HashMap<>();\r
-               bitNamesModifiable.put(Bit.ONE, "1");\r
-               bitNamesModifiable.put(Bit.ZERO, "0");\r
-               bitNamesModifiable.put(Bit.Z, "Z");\r
-               bitNamesModifiable.put(Bit.U, "U");\r
-               bitNamesModifiable.put(Bit.X, "X");\r
-               bitNames = Collections.unmodifiableMap(bitNamesModifiable);\r
-       }\r
-\r
-       private final WireArray                 wa;\r
-       private final List<WireArray>   connectedWireArrays;\r
-       private final List<Point>               wireArrayConnectionPoints;\r
-\r
-       public GUIManualSwitch(WireArray output)\r
-       {\r
-               super(output);\r
-\r
-               this.wa = output;\r
-\r
-               List<WireArray> connectedWireArraysModifiable = new ArrayList<>();\r
-               List<Point> wireArrayConnectionPointsModifiable = new ArrayList<>();\r
-\r
-               connectedWireArraysModifiable.add(output);\r
-               wireArrayConnectionPointsModifiable.add(new Point(20, 7.5));\r
-\r
-               this.connectedWireArrays = Collections.unmodifiableList(connectedWireArraysModifiable);\r
-               this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);\r
-       }\r
-\r
-       @Override\r
-       public Rectangle getBounds()\r
-       {\r
-               return new Rectangle(0, 0, 20, 15);\r
-       }\r
-       @Override\r
-       public void render(GeneralGC gc)\r
-       {\r
-               gc.drawRectangle(0, 0, 20, 15);\r
-               String label = bitNames.get(wa.getValue());\r
-               Font oldFont = gc.getFont();\r
-               Font labelFont = new Font(oldFont.getName(), 6, oldFont.getStyle());\r
-               gc.setFont(labelFont);\r
-               Point textExtent = gc.textExtent(label);\r
-               gc.drawText(label, 10 - textExtent.x / 2, 7.5 - textExtent.y / 2, true);\r
-               gc.setFont(oldFont);\r
-       }\r
-       @Override\r
-       public boolean clicked(double x, double y)\r
-       {\r
-               toggle();\r
-               return true;\r
-       }\r
 \r
-       @Override\r
-       public int getConnectedWireArraysCount()\r
-       {\r
-               return connectedWireArrays.size();\r
-       }\r
-       @Override\r
-       public WireArray getConnectedWireArray(int connectionIndex)\r
-       {\r
-               return connectedWireArrays.get(connectionIndex);\r
-       }\r
-       @Override\r
-       public Point getWireArrayConnectionPoint(int connectionI)\r
-       {\r
-               return wireArrayConnectionPoints.get(connectionI);\r
-       }\r
-}
\ No newline at end of file
+}\r