From 78c6c20a637ade903ee41b9e557bde0c30c08218 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Wed, 3 Jul 2019 23:02:36 +0200 Subject: [PATCH 01/16] Updated version; added string-based methods in JsonHandler --- .../logic/ui/examples/JsonExample.java | 15 +++++++------- .../ui/serializing/CodeSnippetSupplier.java | 2 +- .../standardComponentIDMapping.json | 2 +- .../serializing/standardSnippetIDMapping.json | 3 +++ .../mograsim/logic/ui/util/JsonHandler.java | 20 ++++++++++++++----- .../net/mograsim/logic/ui/util/Version.java | 2 +- 6 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/JsonExample.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/JsonExample.java index 128ec058..c0ebad60 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/JsonExample.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/JsonExample.java @@ -2,8 +2,6 @@ package net.mograsim.logic.ui.examples; import java.io.IOException; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; import com.google.gson.JsonNull; import net.mograsim.logic.ui.SimpleLogicUIStandalone; @@ -19,6 +17,7 @@ import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; import net.mograsim.logic.ui.serializing.SubmodelComponentDeserializer; import net.mograsim.logic.ui.serializing.SubmodelComponentParams; +import net.mograsim.logic.ui.util.JsonHandler; public class JsonExample { @@ -49,11 +48,11 @@ public class JsonExample GUI_rsLatch comp = new GUI_rsLatch(viewModel); comp.moveTo(30, 0); SubmodelComponentParams params = comp.calculateParams(); - String jsonString = new GsonBuilder().setPrettyPrinting().create().toJson(params); + String jsonString = JsonHandler.toJson(params); System.out.println(jsonString); - SubmodelComponent deserialized = SubmodelComponentDeserializer.create(viewModel, - new Gson().fromJson(jsonString, SubmodelComponentParams.class)); - deserialized.moveTo(30, 50); + SubmodelComponentParams paramsD = JsonHandler.fromJson(jsonString, SubmodelComponentParams.class); + SubmodelComponent componentD = SubmodelComponentDeserializer.create(viewModel, paramsD); + componentD.moveTo(30, 50); double h = 0; for (String s : comp.getInputPinNames()) { @@ -62,7 +61,7 @@ public class JsonExample new GUIWire(viewModel, sw.getOutputPin(), comp.getPin(s)); sw = new GUIManualSwitch(viewModel); sw.moveTo(0, h + 50); - new GUIWire(viewModel, sw.getOutputPin(), deserialized.getPin(s)); + new GUIWire(viewModel, sw.getOutputPin(), componentD.getPin(s)); h += 20; } h = 0; @@ -73,7 +72,7 @@ public class JsonExample new GUIWire(viewModel, bd.getInputPin(), comp.getPin(s)); bd = new GUIBitDisplay(viewModel); bd.moveTo(80, h + 50); - new GUIWire(viewModel, bd.getInputPin(), deserialized.getPin(s)); + new GUIWire(viewModel, bd.getInputPin(), componentD.getPin(s)); h += 20; } } diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java index abd0e73c..743d843c 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java @@ -49,7 +49,7 @@ public class CodeSnippetSupplier static { - try (InputStream s = IndirectGUIComponentCreator.class.getResourceAsStream("./mapping.json")) + try (InputStream s = IndirectGUIComponentCreator.class.getResourceAsStream("./standardSnippetIDMapping.json")) { if (s == null) throw new IOException("Resource not found"); diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardComponentIDMapping.json b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardComponentIDMapping.json index 6c7a8350..a594273d 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardComponentIDMapping.json +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardComponentIDMapping.json @@ -1,4 +1,4 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { "GUIAm2901": "file:components/am2901/GUIAm2901.json", "GUIAm2901ALUFuncDecode": "file:components/am2901/GUIAm2901ALUFuncDecode.json", diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json new file mode 100644 index 00000000..82249515 --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json @@ -0,0 +1,3 @@ +mograsim version: 0.1.3 +{ +} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/util/JsonHandler.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/util/JsonHandler.java index 99ff8d1d..df482666 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/util/JsonHandler.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/util/JsonHandler.java @@ -6,6 +6,7 @@ import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.util.stream.Collectors; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -29,18 +30,27 @@ public class JsonHandler { try (InputStreamReader reader = new InputStreamReader(input); BufferedReader bf = new BufferedReader(reader)) { - String json = bf.lines().dropWhile(s -> s.length() == 0 || s.charAt(0) != '{').reduce("", (x, y) -> x.concat(y)); - T params = parser.fromJson(json, type); - return params; + return fromJson(bf.lines().collect(Collectors.joining("\n")), type); } } + public static T fromJson(String src, Class type) + { + // TODO actually parse and compare version + String rawJson = src.lines().dropWhile(s -> s.length() == 0 || s.charAt(0) != '{').collect(Collectors.joining()); + return parser.fromJson(rawJson, type); + } + public static void writeJson(Object o, String path) throws IOException { try (FileWriter writer = new FileWriter(path)) { - writer.write(String.format("mograsim version: %s\n", Version.jsonCompVersion.toString())); - writer.write(parser.toJson(o)); + writer.write(toJson(o)); } } + + public static String toJson(Object o) + { + return String.format("mograsim version: %s\n%s", Version.jsonCompVersion.toString(), parser.toJson(o)); + } } diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/util/Version.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/util/Version.java index 8e80249c..aa845682 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/util/Version.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/util/Version.java @@ -2,7 +2,7 @@ package net.mograsim.logic.ui.util; public final class Version { - public final static Version jsonCompVersion = new Version(0, 1, 2); + public final static Version jsonCompVersion = new Version(0, 1, 3); public final int major, minor, patch; public Version(int major, int minor, int patch) -- 2.17.1 From 0e490475fa05c2f05ec875165fc6e38e543d6d65 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Wed, 3 Jul 2019 23:16:05 +0200 Subject: [PATCH 02/16] Rebuilt component JSON files --- .../components/GUI_rsLatch.json | 42 +-- .../components/GUIand.json | 35 +- .../components/GUIand41.json | 53 +-- .../components/GUIandor414.json | 33 +- .../components/GUIdemux2.json | 92 ++--- .../components/GUIdff.json | 57 +-- .../components/GUIdlatch.json | 45 +-- .../components/GUIdlatch4.json | 53 +-- .../components/GUIfulladder.json | 31 +- .../components/GUIhalfadder.json | 60 +-- .../components/GUImux1.json | 54 +-- .../components/GUImux1_4.json | 57 +-- .../components/GUInand3.json | 42 +-- .../components/GUInot4.json | 70 +--- .../components/GUIor4.json | 109 ++---- .../components/GUIor_4.json | 146 +++----- .../components/GUIram2.json | 268 +++++--------- .../components/GUIram4.json | 248 ++++--------- .../components/GUIsel2_4.json | 136 ++----- .../components/GUIsel3_4.json | 105 ++---- .../components/GUIxor.json | 59 +-- .../components/am2901/GUIAm2901.json | 344 +++++------------- .../am2901/GUIAm2901ALUFuncDecode.json | 125 ++----- .../am2901/GUIAm2901ALUInclDecode.json | 170 +++------ ...ALUInclSourceDecodeInclFunctionDecode.json | 79 +--- .../components/am2901/GUIAm2901ALUOneBit.json | 64 +--- .../am2901/GUIAm2901DestDecode.json | 197 +++------- .../components/am2901/GUIAm2901QReg.json | 57 +-- .../am2901/GUIAm2901SourceDecode.json | 208 ++++------- .../ui/examples/ComponenetSerializer.java | 65 ++++ 30 files changed, 896 insertions(+), 2208 deletions(-) create mode 100644 net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java diff --git a/net.mograsim.logic.ui.am2900/components/GUI_rsLatch.json b/net.mograsim.logic.ui.am2900/components/GUI_rsLatch.json index 186aac31..4431f34a 100644 --- a/net.mograsim.logic.ui.am2900/components/GUI_rsLatch.json +++ b/net.mograsim.logic.ui.am2900/components/GUI_rsLatch.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUI_rsLatch", "width": 35.0, "height": 20.0, "interfacePins": [ @@ -38,7 +36,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -46,40 +44,32 @@ mograsim version: 0.1.2 "x": 10.0, "y": 7.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 40.0, "y": 12.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 34.0, "y": 16.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 64.0, "y": 36.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -216,17 +206,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "_S", - "_R" - ], - "label": "_rsLatch", - "logic_width": 1, - "output_count": [ - "Q", - "_Q" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIand.json b/net.mograsim.logic.ui.am2900/components/GUIand.json index 2ea36835..0687592a 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIand.json +++ b/net.mograsim.logic.ui.am2900/components/GUIand.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIand", "width": 35.0, "height": 20.0, "interfacePins": [ @@ -30,7 +28,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -38,30 +36,24 @@ mograsim version: 0.1.2 "x": 20.0, "y": 15.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 50.0, "y": 15.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 44.0, "y": 24.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -139,16 +131,5 @@ mograsim version: 0.1.2 } } ] - }, - "specialized": { - "input_count": [ - "A", - "B" - ], - "label": "GUIand", - "logic_width": 1, - "output_count": [ - "Y" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIand41.json b/net.mograsim.logic.ui.am2900/components/GUIand41.json index 7b2757c9..cb1608a5 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIand41.json +++ b/net.mograsim.logic.ui.am2900/components/GUIand41.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIand41", "width": 35.0, "height": 50.0, "interfacePins": [ @@ -78,7 +76,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -86,62 +84,52 @@ mograsim version: 0.1.2 "x": 30.0, "y": 7.5 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 30.0, "y": 32.5 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 30.0, "y": 57.5 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 30.0, "y": 82.5 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 24.0, "y": 46.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 24.0, "y": 71.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 24.0, "y": 96.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -321,22 +309,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "A1", - "A2", - "A3", - "A4", - "B" - ], - "label": "GUIand41", - "logic_width": 1, - "output_count": [ - "Y1", - "Y2", - "Y3", - "Y4" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIandor414.json b/net.mograsim.logic.ui.am2900/components/GUIandor414.json index d581e8f7..d585785b 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIandor414.json +++ b/net.mograsim.logic.ui.am2900/components/GUIandor414.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIandor414", "width": 35.0, "height": 90.0, "interfacePins": [ @@ -110,7 +108,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -118,16 +116,14 @@ mograsim version: 0.1.2 "x": 15.0, "y": 137.5 }, - "name": "GUIand41", - "params": {} + "id": "GUIand41" }, { "pos": { "x": 35.0, "y": 37.5 }, - "name": "GUIor_4", - "params": {} + "id": "GUIor_4" } ], "innerWires": [ @@ -477,26 +473,5 @@ mograsim version: 0.1.2 ] } ] - }, - "specialized": { - "input_count": [ - "C1", - "C2", - "C3", - "C4", - "A1", - "A2", - "A3", - "A4", - "B" - ], - "label": "GUIandor414", - "logic_width": 1, - "output_count": [ - "Y1", - "Y2", - "Y3", - "Y4" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIdemux2.json b/net.mograsim.logic.ui.am2900/components/GUIdemux2.json index d6b01c63..04df7d07 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIdemux2.json +++ b/net.mograsim.logic.ui.am2900/components/GUIdemux2.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIdemux2", "width": 35.0, "height": 40.0, "interfacePins": [ @@ -54,7 +52,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -62,132 +60,108 @@ mograsim version: 0.1.2 "x": 10.0, "y": 2.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 10.0, "y": 27.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 40.0, "y": 2.5 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 40.0, "y": 27.5 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 40.0, "y": 52.5 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 40.0, "y": 77.5 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 6.5, "y": 11.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 16.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 36.5, "y": 61.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 36.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 41.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 31.5, "y": 66.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 31.5, "y": 11.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 36.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -511,19 +485,5 @@ mograsim version: 0.1.2 } } ] - }, - "specialized": { - "input_count": [ - "S0", - "S1" - ], - "label": "GUIdemux2", - "logic_width": 1, - "output_count": [ - "Y00", - "Y01", - "Y10", - "Y11" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIdff.json b/net.mograsim.logic.ui.am2900/components/GUIdff.json index 5c0c80ab..df4e0a1e 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIdff.json +++ b/net.mograsim.logic.ui.am2900/components/GUIdff.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIdff", "width": 35.0, "height": 20.0, "interfacePins": [ @@ -38,7 +36,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.2, "subComps": [ { @@ -46,74 +44,61 @@ mograsim version: 0.1.2 "x": 40.0, "y": 10.0 }, - "name": "GUI_rsLatch", - "params": {} + "id": "GUI_rsLatch" }, { "pos": { "x": 40.0, "y": 40.0 }, - "name": "GUInand3", - "params": {} + "id": "GUInand3" }, { "pos": { "x": 120.0, "y": 60.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 120.0, "y": 30.0 }, - "name": "GUI_rsLatch", - "params": {} + "id": "GUI_rsLatch" }, { "pos": { "x": 9.0, "y": 24.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 19.0, "y": 64.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 99.0, "y": 34.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 99.0, "y": 44.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -323,17 +308,5 @@ mograsim version: 0.1.2 } } ] - }, - "specialized": { - "input_count": [ - "C", - "D" - ], - "label": "GUIdff", - "logic_width": 1, - "output_count": [ - "Q", - "_Q" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIdlatch.json b/net.mograsim.logic.ui.am2900/components/GUIdlatch.json index 6811c4d4..84e635f8 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIdlatch.json +++ b/net.mograsim.logic.ui.am2900/components/GUIdlatch.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIdlatch", "width": 35.0, "height": 20.0, "interfacePins": [ @@ -38,7 +36,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -46,48 +44,39 @@ mograsim version: 0.1.2 "x": 10.0, "y": 2.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 15.0, "y": 27.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 45.0, "y": 7.5 }, - "name": "GUI_rsLatch", - "params": {} + "id": "GUI_rsLatch" }, { "pos": { "x": 4.0, "y": 36.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 11.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -232,17 +221,5 @@ mograsim version: 0.1.2 } } ] - }, - "specialized": { - "input_count": [ - "D", - "E" - ], - "label": "GUIdlatch", - "logic_width": 1, - "output_count": [ - "Q", - "_Q" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIdlatch4.json b/net.mograsim.logic.ui.am2900/components/GUIdlatch4.json index e6316c36..2458b250 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIdlatch4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIdlatch4.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIdlatch4", "width": 35.0, "height": 50.0, "interfacePins": [ @@ -78,7 +76,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -86,62 +84,52 @@ mograsim version: 0.1.2 "x": 30.0, "y": 7.5 }, - "name": "GUIdlatch", - "params": {} + "id": "GUIdlatch" }, { "pos": { "x": 30.0, "y": 32.5 }, - "name": "GUIdlatch", - "params": {} + "id": "GUIdlatch" }, { "pos": { "x": 30.0, "y": 57.5 }, - "name": "GUIdlatch", - "params": {} + "id": "GUIdlatch" }, { "pos": { "x": 30.0, "y": 82.5 }, - "name": "GUIdlatch", - "params": {} + "id": "GUIdlatch" }, { "pos": { "x": 14.0, "y": 46.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 14.0, "y": 71.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 14.0, "y": 96.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -321,22 +309,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "D1", - "D2", - "D3", - "D4", - "C" - ], - "label": "GUIdlatch4", - "logic_width": 1, - "output_count": [ - "Q1", - "Q2", - "Q3", - "Q4" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIfulladder.json b/net.mograsim.logic.ui.am2900/components/GUIfulladder.json index 259ba270..d7396280 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIfulladder.json +++ b/net.mograsim.logic.ui.am2900/components/GUIfulladder.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIfulladder", "width": 35.0, "height": 30.0, "interfacePins": [ @@ -46,7 +44,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -54,26 +52,22 @@ mograsim version: 0.1.2 "x": 5.0, "y": 40.0 }, - "name": "GUIhalfadder", - "params": {} + "id": "GUIhalfadder" }, { "pos": { "x": 45.0, "y": 7.5 }, - "name": "GUIhalfadder", - "params": {} + "id": "GUIhalfadder" }, { "pos": { "x": 57.5, "y": 40.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 } ], "innerWires": [ @@ -179,18 +173,5 @@ mograsim version: 0.1.2 } } ] - }, - "specialized": { - "input_count": [ - "A", - "B", - "C" - ], - "label": "GUIfulladder", - "logic_width": 1, - "output_count": [ - "Y", - "Z" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIhalfadder.json b/net.mograsim.logic.ui.am2900/components/GUIhalfadder.json index 5e1371e1..5cffb3db 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIhalfadder.json +++ b/net.mograsim.logic.ui.am2900/components/GUIhalfadder.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIhalfadder", "width": 35.0, "height": 20.0, "interfacePins": [ @@ -38,7 +36,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -46,70 +44,56 @@ mograsim version: 0.1.2 "x": 10.0, "y": 15.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 40.0, "y": 2.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 40.0, "y": 27.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 65.0, "y": 2.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 4.0, "y": 11.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 36.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 24.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -314,17 +298,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "A", - "B" - ], - "label": "GUIhalfadder", - "logic_width": 1, - "output_count": [ - "Y", - "_Z" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUImux1.json b/net.mograsim.logic.ui.am2900/components/GUImux1.json index 9f373e2a..c3412266 100644 --- a/net.mograsim.logic.ui.am2900/components/GUImux1.json +++ b/net.mograsim.logic.ui.am2900/components/GUImux1.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUImux1", "width": 35.0, "height": 30.0, "interfacePins": [ @@ -38,7 +36,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -46,60 +44,48 @@ mograsim version: 0.1.2 "x": 10.0, "y": 7.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 35.0, "y": 22.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 35.0, "y": 47.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 60.0, "y": 30.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 4.0, "y": 11.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 21.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -226,17 +212,5 @@ mograsim version: 0.1.2 } } ] - }, - "specialized": { - "input_count": [ - "S0", - "I0", - "I1" - ], - "label": "GUImux1", - "logic_width": 1, - "output_count": [ - "Y" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUImux1_4.json b/net.mograsim.logic.ui.am2900/components/GUImux1_4.json index 7d326ba7..35f9c2f9 100644 --- a/net.mograsim.logic.ui.am2900/components/GUImux1_4.json +++ b/net.mograsim.logic.ui.am2900/components/GUImux1_4.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUImux1_4", "width": 35.0, "height": 90.0, "interfacePins": [ @@ -110,7 +108,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -118,62 +116,52 @@ mograsim version: 0.1.2 "x": 30.0, "y": 7.5 }, - "name": "GUImux1", - "params": {} + "id": "GUImux1" }, { "pos": { "x": 30.0, "y": 42.5 }, - "name": "GUImux1", - "params": {} + "id": "GUImux1" }, { "pos": { "x": 30.0, "y": 77.5 }, - "name": "GUImux1", - "params": {} + "id": "GUImux1" }, { "pos": { "x": 30.0, "y": 112.5 }, - "name": "GUImux1", - "params": {} + "id": "GUImux1" }, { "pos": { "x": 24.0, "y": 11.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 24.0, "y": 46.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 24.0, "y": 81.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -461,26 +449,5 @@ mograsim version: 0.1.2 } } ] - }, - "specialized": { - "input_count": [ - "S0", - "I0_1", - "I0_2", - "I0_3", - "I0_4", - "I1_1", - "I1_2", - "I1_3", - "I1_4" - ], - "label": "GUImux1_4", - "logic_width": 1, - "output_count": [ - "Y1", - "Y2", - "Y3", - "Y4" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUInand3.json b/net.mograsim.logic.ui.am2900/components/GUInand3.json index fe953c30..7177e919 100644 --- a/net.mograsim.logic.ui.am2900/components/GUInand3.json +++ b/net.mograsim.logic.ui.am2900/components/GUInand3.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUInand3", "width": 35.0, "height": 30.0, "interfacePins": [ @@ -38,7 +36,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -46,40 +44,32 @@ mograsim version: 0.1.2 "x": 10.0, "y": 15.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 35.0, "y": 15.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 62.5, "y": 2.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 31.5, "y": 24.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -198,17 +188,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "A", - "B", - "C" - ], - "label": "GUInand3", - "logic_width": 1, - "output_count": [ - "Y" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUInot4.json b/net.mograsim.logic.ui.am2900/components/GUInot4.json index 71e414e7..5df0c822 100644 --- a/net.mograsim.logic.ui.am2900/components/GUInot4.json +++ b/net.mograsim.logic.ui.am2900/components/GUInot4.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUInot4", "width": 35.0, "height": 40.0, "interfacePins": [ @@ -70,7 +68,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -78,80 +76,64 @@ mograsim version: 0.1.2 "x": 30.0, "y": 2.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 30.0, "y": 27.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 30.0, "y": 52.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 30.0, "y": 77.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 14.0, "y": 11.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 14.0, "y": 36.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 14.0, "y": 61.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 14.0, "y": 86.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -372,21 +354,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "A1", - "A2", - "A3", - "A4" - ], - "label": "GUInot4", - "logic_width": 1, - "output_count": [ - "Y1", - "Y2", - "Y3", - "Y4" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIor4.json b/net.mograsim.logic.ui.am2900/components/GUIor4.json index 53da78d0..9eb72165 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIor4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIor4.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIor4", "width": 35.0, "height": 40.0, "interfacePins": [ @@ -46,7 +44,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.2, "subComps": [ { @@ -54,150 +52,120 @@ mograsim version: 0.1.2 "x": 20.0, "y": 15.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 20.0, "y": 65.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 20.0, "y": 115.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 20.0, "y": 165.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 50.0, "y": 40.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 50.0, "y": 140.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 110.0, "y": 40.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 110.0, "y": 140.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 140.0, "y": 90.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 14.0, "y": 24.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 14.0, "y": 74.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 14.0, "y": 124.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 14.0, "y": 174.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 104.0, "y": 49.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 104.0, "y": 149.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -530,18 +498,5 @@ mograsim version: 0.1.2 } } ] - }, - "specialized": { - "input_count": [ - "A1", - "A2", - "A3", - "A4" - ], - "label": "GUIor4", - "logic_width": 1, - "output_count": [ - "Y" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIor_4.json b/net.mograsim.logic.ui.am2900/components/GUIor_4.json index 729cd821..06aa13f7 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIor_4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIor_4.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIor_4", "width": 35.0, "height": 80.0, "interfacePins": [ @@ -102,7 +100,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -110,200 +108,160 @@ mograsim version: 0.1.2 "x": 15.0, "y": 2.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 15.0, "y": 27.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 15.0, "y": 52.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 15.0, "y": 77.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 15.0, "y": 102.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 15.0, "y": 127.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 15.0, "y": 152.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 15.0, "y": 177.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 65.0, "y": 2.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 65.0, "y": 27.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 65.0, "y": 52.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 65.0, "y": 77.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 6.5, "y": 11.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 36.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 61.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 86.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 111.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 136.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 161.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 186.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -856,25 +814,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "A1", - "A2", - "A3", - "A4", - "B1", - "B2", - "B3", - "B4" - ], - "label": "GUIor_4", - "logic_width": 1, - "output_count": [ - "Y1", - "Y2", - "Y3", - "Y4" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIram2.json b/net.mograsim.logic.ui.am2900/components/GUIram2.json index df20ab50..c1d00ea9 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIram2.json +++ b/net.mograsim.logic.ui.am2900/components/GUIram2.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIram2", "width": 35.0, "height": 90.0, "interfacePins": [ @@ -142,7 +140,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.1, "subComps": [ { @@ -150,440 +148,361 @@ mograsim version: 0.1.2 "x": 55.0, "y": 45.0 }, - "name": "GUIdemux2", - "params": {} + "id": "GUIdemux2" }, { "pos": { "x": 55.0, "y": 150.0 }, - "name": "GUIdemux2", - "params": {} + "id": "GUIdemux2" }, { "pos": { "x": 130.0, "y": 150.0 }, - "name": "GUIand41", - "params": {} + "id": "GUIand41" }, { "pos": { "x": 55.0, "y": 325.0 }, - "name": "GUIdlatch4", - "params": {} + "id": "GUIdlatch4" }, { "pos": { "x": 55.0, "y": 475.0 }, - "name": "GUIdlatch4", - "params": {} + "id": "GUIdlatch4" }, { "pos": { "x": 55.0, "y": 625.0 }, - "name": "GUIdlatch4", - "params": {} + "id": "GUIdlatch4" }, { "pos": { "x": 55.0, "y": 775.0 }, - "name": "GUIdlatch4", - "params": {} + "id": "GUIdlatch4" }, { "pos": { "x": 235.0, "y": 375.0 }, - "name": "GUIand41", - "params": {} + "id": "GUIand41" }, { "pos": { "x": 235.0, "y": 485.0 }, - "name": "GUIandor414", - "params": {} + "id": "GUIandor414" }, { "pos": { "x": 235.0, "y": 635.0 }, - "name": "GUIandor414", - "params": {} + "id": "GUIandor414" }, { "pos": { "x": 235.0, "y": 785.0 }, - "name": "GUIandor414", - "params": {} + "id": "GUIandor414" }, { "pos": { "x": 135.0, "y": 325.0 }, - "name": "GUIand41", - "params": {} + "id": "GUIand41" }, { "pos": { "x": 135.0, "y": 435.0 }, - "name": "GUIandor414", - "params": {} + "id": "GUIandor414" }, { "pos": { "x": 135.0, "y": 585.0 }, - "name": "GUIandor414", - "params": {} + "id": "GUIandor414" }, { "pos": { "x": 135.0, "y": 735.0 }, - "name": "GUIandor414", - "params": {} + "id": "GUIandor414" }, { "pos": { "x": 109.0, "y": 154.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 104.0, "y": 164.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 99.0, "y": 174.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 94.0, "y": 184.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 549.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 39.0, "y": 649.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 44.0, "y": 749.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 49.0, "y": 809.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 479.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 39.0, "y": 489.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 44.0, "y": 499.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 49.0, "y": 509.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 629.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 39.0, "y": 639.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 44.0, "y": 649.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 49.0, "y": 659.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 129.0, "y": 329.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 124.0, "y": 339.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 119.0, "y": 349.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 114.0, "y": 359.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 129.0, "y": 479.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 124.0, "y": 489.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 119.0, "y": 499.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 114.0, "y": 509.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 129.0, "y": 629.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 124.0, "y": 639.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 119.0, "y": 649.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 114.0, "y": 659.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 129.0, "y": 779.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 124.0, "y": 789.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 119.0, "y": 799.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 114.0, "y": 809.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -2851,30 +2770,5 @@ mograsim version: 0.1.2 ] } ] - }, - "specialized": { - "input_count": [ - "A0", - "A1", - "B0", - "B1", - "WE", - "D1", - "D2", - "D3", - "D4" - ], - "label": "GUIram2", - "logic_width": 1, - "output_count": [ - "QA1", - "QA2", - "QA3", - "QA4", - "QB1", - "QB2", - "QB3", - "QB4" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIram4.json b/net.mograsim.logic.ui.am2900/components/GUIram4.json index 605b061e..87c28929 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIram4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIram4.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIram4", "width": 35.0, "height": 130.0, "interfacePins": [ @@ -174,7 +172,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.1, "subComps": [ { @@ -182,400 +180,329 @@ mograsim version: 0.1.2 "x": 55.0, "y": 45.0 }, - "name": "GUIdemux2", - "params": {} + "id": "GUIdemux2" }, { "pos": { "x": 55.0, "y": 150.0 }, - "name": "GUIdemux2", - "params": {} + "id": "GUIdemux2" }, { "pos": { "x": 235.0, "y": 150.0 }, - "name": "GUIand41", - "params": {} + "id": "GUIand41" }, { "pos": { "x": 80.0, "y": 330.0 }, - "name": "GUIram2", - "params": {} + "id": "GUIram2" }, { "pos": { "x": 80.0, "y": 480.0 }, - "name": "GUIram2", - "params": {} + "id": "GUIram2" }, { "pos": { "x": 80.0, "y": 630.0 }, - "name": "GUIram2", - "params": {} + "id": "GUIram2" }, { "pos": { "x": 80.0, "y": 780.0 }, - "name": "GUIram2", - "params": {} + "id": "GUIram2" }, { "pos": { "x": 250.0, "y": 375.0 }, - "name": "GUIand41", - "params": {} + "id": "GUIand41" }, { "pos": { "x": 250.0, "y": 485.0 }, - "name": "GUIandor414", - "params": {} + "id": "GUIandor414" }, { "pos": { "x": 250.0, "y": 635.0 }, - "name": "GUIandor414", - "params": {} + "id": "GUIandor414" }, { "pos": { "x": 250.0, "y": 785.0 }, - "name": "GUIandor414", - "params": {} + "id": "GUIandor414" }, { "pos": { "x": 155.0, "y": 325.0 }, - "name": "GUIand41", - "params": {} + "id": "GUIand41" }, { "pos": { "x": 155.0, "y": 435.0 }, - "name": "GUIandor414", - "params": {} + "id": "GUIandor414" }, { "pos": { "x": 155.0, "y": 585.0 }, - "name": "GUIandor414", - "params": {} + "id": "GUIandor414" }, { "pos": { "x": 155.0, "y": 735.0 }, - "name": "GUIandor414", - "params": {} + "id": "GUIandor414" }, { "pos": { "x": 229.0, "y": 154.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 224.0, "y": 164.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 219.0, "y": 174.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 214.0, "y": 184.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 59.0, "y": 534.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 64.0, "y": 544.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 69.0, "y": 554.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 74.0, "y": 564.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 59.0, "y": 684.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 64.0, "y": 694.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 69.0, "y": 704.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 74.0, "y": 714.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 59.0, "y": 834.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 64.0, "y": 844.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 69.0, "y": 854.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 74.0, "y": 864.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 39.0, "y": 484.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 44.0, "y": 494.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 49.0, "y": 504.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 54.0, "y": 514.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 39.0, "y": 634.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 44.0, "y": 644.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 49.0, "y": 654.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 54.0, "y": 664.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 39.0, "y": 334.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 44.0, "y": 349.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 49.0, "y": 649.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 54.0, "y": 749.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -3215,34 +3142,5 @@ mograsim version: 0.1.2 ] } ] - }, - "specialized": { - "input_count": [ - "A0", - "A1", - "A2", - "A3", - "B0", - "B1", - "B2", - "B3", - "WE", - "D1", - "D2", - "D3", - "D4" - ], - "label": "GUIram4", - "logic_width": 1, - "output_count": [ - "QA1", - "QA2", - "QA3", - "QA4", - "QB1", - "QB2", - "QB3", - "QB4" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIsel2_4.json b/net.mograsim.logic.ui.am2900/components/GUIsel2_4.json index c98c1dc3..b3845c41 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIsel2_4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIsel2_4.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIsel2_4", "width": 35.0, "height": 100.0, "interfacePins": [ @@ -118,7 +116,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -126,180 +124,144 @@ mograsim version: 0.1.2 "x": 20.0, "y": 2.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 20.0, "y": 52.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 20.0, "y": 102.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 20.0, "y": 152.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 20.0, "y": 27.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 20.0, "y": 77.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 20.0, "y": 127.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 20.0, "y": 177.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 65.0, "y": 2.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 65.0, "y": 27.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 65.0, "y": 52.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 65.0, "y": 77.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 6.5, "y": 16.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 66.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 116.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 41.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 91.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 141.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -820,27 +782,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "SA", - "SB", - "A1", - "A2", - "A3", - "A4", - "B1", - "B2", - "B3", - "B4" - ], - "label": "GUIsel2_4", - "logic_width": 1, - "output_count": [ - "Y1", - "Y2", - "Y3", - "Y4" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIsel3_4.json b/net.mograsim.logic.ui.am2900/components/GUIsel3_4.json index b1f46478..fdcbfafa 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIsel3_4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIsel3_4.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIsel3_4", "width": 35.0, "height": 150.0, "interfacePins": [ @@ -158,7 +156,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.2, "subComps": [ { @@ -166,126 +164,102 @@ mograsim version: 0.1.2 "x": 35.0, "y": 250.0 }, - "name": "GUIsel2_4", - "params": {} + "id": "GUIsel2_4" }, { "pos": { "x": 75.0, "y": 250.0 }, - "name": "GUInot4", - "params": {} + "id": "GUInot4" }, { "pos": { "x": 50.0, "y": 570.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 50.0, "y": 620.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 50.0, "y": 670.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 50.0, "y": 720.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 152.5, "y": 15.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 152.5, "y": 65.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 152.5, "y": 115.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 152.5, "y": 165.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 29.0, "y": 584.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 29.0, "y": 634.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 29.0, "y": 684.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -879,32 +853,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "SA", - "SB", - "SC", - "A1", - "A2", - "A3", - "A4", - "B1", - "B2", - "B3", - "B4", - "C1", - "C2", - "C3", - "C4" - ], - "label": "GUIsel3_4", - "logic_width": 1, - "output_count": [ - "Y1", - "Y2", - "Y3", - "Y4" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIxor.json b/net.mograsim.logic.ui.am2900/components/GUIxor.json index f32f1a11..6b74a5c6 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIxor.json +++ b/net.mograsim.logic.ui.am2900/components/GUIxor.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIxor", "width": 35.0, "height": 20.0, "interfacePins": [ @@ -30,7 +28,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -38,70 +36,56 @@ mograsim version: 0.1.2 "x": 7.5, "y": 15.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 35.0, "y": 2.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 35.0, "y": 27.5 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 62.5, "y": 15.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 4.0, "y": 11.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 36.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 29.0, "y": 24.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -264,16 +248,5 @@ mograsim version: 0.1.2 } } ] - }, - "specialized": { - "input_count": [ - "A", - "B" - ], - "label": "GUIxor", - "logic_width": 1, - "output_count": [ - "Y" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901.json index e93eea3a..d773d7bd 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIAm2901", "width": 35.0, "height": 270.0, "interfacePins": [ @@ -318,7 +316,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.1, "subComps": [ { @@ -326,518 +324,421 @@ mograsim version: 0.1.2 "x": 15.0, "y": 45.0 }, - "name": "GUIAm2901DestDecode", - "params": {} + "id": "GUIAm2901DestDecode" }, { "pos": { "x": 275.0, "y": 135.0 }, - "name": "GUImux1_4", - "params": {} + "id": "GUImux1_4" }, { "pos": { "x": 190.0, "y": 65.0 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 160.0, "y": 75.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 240.0, "y": 2110.0 }, - "name": "GUIAm2901ALUInclSourceDecodeInclFunctionDecode", - "params": {} + "id": "GUIAm2901ALUInclSourceDecodeInclFunctionDecode" }, { "pos": { "x": 275.0, "y": 445.0 }, - "name": "GUIor4", - "params": {} + "id": "GUIor4" }, { "pos": { "x": 320.0, "y": 440.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 95.0, "y": 2220.0 }, - "name": "GUIram4", - "params": {} + "id": "GUIram4" }, { "pos": { "x": 160.0, "y": 2220.0 }, - "name": "GUIdlatch4", - "params": {} + "id": "GUIdlatch4" }, { "pos": { "x": 160.0, "y": 2275.0 }, - "name": "GUIdlatch4", - "params": {} + "id": "GUIdlatch4" }, { "pos": { "x": 45.0, "y": 2310.0 }, - "name": "GUIsel3_4", - "params": {} + "id": "GUIsel3_4" }, { "pos": { "x": 45.0, "y": 2510.0 }, - "name": "GUIsel3_4", - "params": {} + "id": "GUIsel3_4" }, { "pos": { "x": 90.0, "y": 2490.0 }, - "name": "GUIAm2901QReg", - "params": {} + "id": "GUIAm2901QReg" }, { "pos": { "x": 154.0, "y": 949.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 154.0, "y": 89.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 154.0, "y": 2264.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 154.0, "y": 2319.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 39.0, "y": 2314.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 2324.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 29.0, "y": 2334.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 219.0, "y": 2224.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 224.0, "y": 2234.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 229.0, "y": 2244.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 234.0, "y": 2254.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 129.0, "y": 2494.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 134.0, "y": 2504.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 139.0, "y": 2514.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 144.0, "y": 2524.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 219.0, "y": 2494.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 234.0, "y": 2524.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 2624.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 39.0, "y": 2634.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 279.0, "y": 2114.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 294.0, "y": 2144.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 329.0, "y": 949.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 254.0, "y": 2089.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 259.0, "y": 2094.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 264.0, "y": 2099.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 269.0, "y": 2104.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 254.0, "y": 449.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 259.0, "y": 459.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 264.0, "y": 469.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 269.0, "y": 479.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 9.0, "y": 2354.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 14.0, "y": 2364.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 19.0, "y": 2374.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 14.0, "y": 2394.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 19.0, "y": 2404.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 24.0, "y": 2414.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 9.0, "y": 2384.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 14.0, "y": 2424.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 19.0, "y": 2434.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 24.0, "y": 2444.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 314.0, "y": 449.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -3278,52 +3179,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "I8", - "I7", - "I6", - "I5", - "I4", - "I3", - "I2", - "I1", - "I0", - "C", - "Cn", - "D1", - "D2", - "D3", - "D4", - "A0", - "A1", - "A2", - "A3", - "B0", - "B1", - "B2", - "B3", - "IRAMn", - "IRAMn+3", - "IQn", - "IQn+3" - ], - "label": "GUIAm2901", - "logic_width": 1, - "output_count": [ - "Y1", - "Y2", - "Y3", - "Y4", - "F\u003d0", - "Cn+4", - "OVR", - "F3", - "ORAMn", - "ORAMn+3", - "OQn", - "OQn+3" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUFuncDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUFuncDecode.json index 1a838efc..cf9f5a6e 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUFuncDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUFuncDecode.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIAm2901ALUFuncDecode", "width": 35.0, "height": 60.0, "interfacePins": [ @@ -78,7 +76,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.25, "subComps": [ { @@ -86,176 +84,142 @@ mograsim version: 0.1.2 "x": 15.0, "y": 10.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 15.0, "y": 50.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 55.0, "y": 10.0 }, - "name": "GUInand3", - "params": {} + "id": "GUInand3" }, { "pos": { "x": 55.0, "y": 45.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 55.0, "y": 70.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 100.0, "y": 50.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 100.0, "y": 135.0 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 4.0, "y": 19.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 24.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 44.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 9.0, "y": 59.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 9.0, "y": 54.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 9.0, "y": 64.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 9.0, "y": 84.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 49.0, "y": 99.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 49.0, "y": 74.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 39.0, "y": 19.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 39.0, "y": 34.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -687,22 +651,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "I5", - "I4", - "I3" - ], - "label": "GUIAm2901ALUFuncDecode", - "logic_width": 1, - "output_count": [ - "CinE", - "L", - "SN", - "SBE", - "FN", - "RN" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclDecode.json index 9c3181cd..1984f630 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclDecode.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIAm2901ALUInclDecode", "width": 35.0, "height": 120.0, "interfacePins": [ @@ -150,7 +148,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.25, "subComps": [ { @@ -158,248 +156,202 @@ mograsim version: 0.1.2 "x": 20.0, "y": 2.5 }, - "name": "GUIAm2901ALUFuncDecode", - "params": {} + "id": "GUIAm2901ALUFuncDecode" }, { "pos": { "x": 45.0, "y": 80.0 }, - "name": "GUIAm2901ALUOneBit", - "params": {} + "id": "GUIAm2901ALUOneBit" }, { "pos": { "x": 45.0, "y": 180.0 }, - "name": "GUIAm2901ALUOneBit", - "params": {} + "id": "GUIAm2901ALUOneBit" }, { "pos": { "x": 45.0, "y": 280.0 }, - "name": "GUIAm2901ALUOneBit", - "params": {} + "id": "GUIAm2901ALUOneBit" }, { "pos": { "x": 45.0, "y": 380.0 }, - "name": "GUIAm2901ALUOneBit", - "params": {} + "id": "GUIAm2901ALUOneBit" }, { "pos": { "x": 95.0, "y": 400.0 }, - "name": "GUIxor", - "params": {} + "id": "GUIxor" }, { "pos": { "x": 24.0, "y": 94.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 24.0, "y": 194.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 24.0, "y": 294.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 26.5, "y": 104.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 26.5, "y": 204.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 26.5, "y": 304.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 29.0, "y": 124.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 29.0, "y": 224.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 29.0, "y": 324.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 31.5, "y": 144.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 31.5, "y": 244.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 31.5, "y": 344.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 154.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 254.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 354.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 36.5, "y": 164.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 36.5, "y": 264.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 36.5, "y": 364.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 84.0, "y": 374.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 84.0, "y": 384.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -1463,31 +1415,5 @@ mograsim version: 0.1.2 } } ] - }, - "specialized": { - "input_count": [ - "I5", - "I4", - "I3", - "Cn", - "R1", - "R2", - "R3", - "R4", - "S1", - "S2", - "S3", - "S4" - ], - "label": "GUIAm2901ALUInclDecode", - "logic_width": 1, - "output_count": [ - "F1", - "F2", - "F3", - "F4", - "Cn+4", - "OVR" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json index 71a63aa7..3481904b 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIAm2901ALUInclSourceDecodeInclFunctionDecode", "width": 35.0, "height": 230.0, "interfacePins": [ @@ -238,7 +236,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.25, "subComps": [ { @@ -246,72 +244,60 @@ mograsim version: 0.1.2 "x": 15.0, "y": 165.0 }, - "name": "GUIAm2901SourceDecode", - "params": {} + "id": "GUIAm2901SourceDecode" }, { "pos": { "x": 45.0, "y": 365.0 }, - "name": "GUIsel2_4", - "params": {} + "id": "GUIsel2_4" }, { "pos": { "x": 45.0, "y": 575.0 }, - "name": "GUIsel3_4", - "params": {} + "id": "GUIsel3_4" }, { "pos": { "x": 60.0, "y": 15.0 }, - "name": "GUIAm2901ALUInclDecode", - "params": {} + "id": "GUIAm2901ALUInclDecode" }, { "pos": { "x": 9.0, "y": 459.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 14.0, "y": 499.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 19.0, "y": 539.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 24.0, "y": 579.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -1307,42 +1293,5 @@ mograsim version: 0.1.2 ] } ] - }, - "specialized": { - "input_count": [ - "I5", - "I4", - "I3", - "I2", - "I1", - "I0", - "Cn", - "D1", - "D2", - "D3", - "D4", - "A1", - "A2", - "A3", - "A4", - "B1", - "B2", - "B3", - "B4", - "Q1", - "Q2", - "Q3", - "Q4" - ], - "label": "GUIAm2901ALUInclSourceDecodeInclFunctionDecode", - "logic_width": 1, - "output_count": [ - "F1", - "F2", - "F3", - "F4", - "Cn+4", - "OVR" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUOneBit.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUOneBit.json index 5466a04e..84f1a124 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUOneBit.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUOneBit.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIAm2901ALUOneBit", "width": 35.0, "height": 90.0, "interfacePins": [ @@ -94,7 +92,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.2, "subComps": [ { @@ -102,86 +100,73 @@ mograsim version: 0.1.2 "x": 10.0, "y": 20.0 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 10.0, "y": 190.0 }, - "name": "GUIxor", - "params": {} + "id": "GUIxor" }, { "pos": { "x": 10.0, "y": 290.0 }, - "name": "GUIxor", - "params": {} + "id": "GUIxor" }, { "pos": { "x": 60.0, "y": 20.0 }, - "name": "GUIfulladder", - "params": {} + "id": "GUIfulladder" }, { "pos": { "x": 60.0, "y": 55.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 135.0, "y": 20.0 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 90.0, "y": 70.0 }, - "name": "GUImux1", - "params": {} + "id": "GUImux1" }, { "pos": { "x": 135.0, "y": 70.0 }, - "name": "GUIxor", - "params": {} + "id": "GUIxor" }, { "pos": { "x": 49.0, "y": 59.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 54.0, "y": 69.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -514,24 +499,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "Cin", - "CoutE", - "CinE", - "R", - "RN", - "S", - "SN", - "FN", - "L" - ], - "label": "GUIAm2901ALUOneBit", - "logic_width": 1, - "output_count": [ - "Cout", - "F" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901DestDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901DestDecode.json index 3faa02d4..20dbfb08 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901DestDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901DestDecode.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIAm2901DestDecode", "width": 35.0, "height": 60.0, "interfacePins": [ @@ -78,7 +76,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.25, "subComps": [ { @@ -86,290 +84,232 @@ mograsim version: 0.1.2 "x": 15.0, "y": 10.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 15.0, "y": 50.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 15.0, "y": 90.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 15.0, "y": 150.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 50.0, "y": 10.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 50.0, "y": 50.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 50.0, "y": 90.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 50.0, "y": 130.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 80.0, "y": 10.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 80.0, "y": 90.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 80.0, "y": 145.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 110.0, "y": 105.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 115.0, "y": 210.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 4.0, "y": 19.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 14.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 24.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 9.0, "y": 59.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 9.0, "y": 64.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 9.0, "y": 104.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 154.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 39.0, "y": 59.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 44.0, "y": 19.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 44.0, "y": 54.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 39.0, "y": 134.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 74.0, "y": 19.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 74.0, "y": 99.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 74.0, "y": 104.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 74.0, "y": 159.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 109.0, "y": 214.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -1054,22 +994,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "I8", - "I7", - "I6" - ], - "label": "GUIAm2901DestDecode", - "logic_width": 1, - "output_count": [ - "NSH", - "RSH", - "RAMWE", - "YF", - "LSH", - "QWE" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901QReg.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901QReg.json index 85f0edf8..b2772259 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901QReg.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901QReg.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIAm2901QReg", "width": 35.0, "height": 60.0, "interfacePins": [ @@ -86,7 +84,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.4, "subComps": [ { @@ -94,70 +92,59 @@ mograsim version: 0.1.2 "x": 5.0, "y": 15.0 }, - "name": "GUIand", - "params": {} + "id": "GUIand" }, { "pos": { "x": 50.0, "y": 7.5 }, - "name": "GUIdff", - "params": {} + "id": "GUIdff" }, { "pos": { "x": 50.0, "y": 32.5 }, - "name": "GUIdff", - "params": {} + "id": "GUIdff" }, { "pos": { "x": 50.0, "y": 57.5 }, - "name": "GUIdff", - "params": {} + "id": "GUIdff" }, { "pos": { "x": 50.0, "y": 82.5 }, - "name": "GUIdff", - "params": {} + "id": "GUIdff" }, { "pos": { "x": 41.5, "y": 19.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 41.5, "y": 36.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 41.5, "y": 61.5 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -401,23 +388,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "C", - "WE", - "D1", - "D2", - "D3", - "D4" - ], - "label": "GUIAm2901QReg", - "logic_width": 1, - "output_count": [ - "Q1", - "Q2", - "Q3", - "Q4" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901SourceDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901SourceDecode.json index c8823710..e72cc9fb 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901SourceDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901SourceDecode.json @@ -1,7 +1,5 @@ -mograsim version: 0.1.2 +mograsim version: 0.1.3 { - "type": "SimpleRectangularSubmodelComponent", - "name": "GUIAm2901SourceDecode", "width": 35.0, "height": 50.0, "interfacePins": [ @@ -70,7 +68,7 @@ mograsim version: 0.1.2 "logicWidth": 1 } ], - "composition": { + "submodel": { "innerScale": 0.25, "subComps": [ { @@ -78,310 +76,248 @@ mograsim version: 0.1.2 "x": 10.0, "y": 10.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 10.0, "y": 50.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 10.0, "y": 90.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 40.0, "y": 10.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 40.0, "y": 50.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 40.0, "y": 90.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 40.0, "y": 130.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 40.0, "y": 170.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 70.0, "y": 10.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 70.0, "y": 50.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 70.0, "y": 90.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 70.0, "y": 130.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 70.0, "y": 170.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 100.0, "y": 10.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 100.0, "y": 170.0 }, - "name": "GUINandGate", - "params": { - "logicWidth": 1 - } + "id": "GUINandGate", + "params": 1 }, { "pos": { "x": 4.0, "y": 19.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 19.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 4.0, "y": 144.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 59.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 99.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 6.5, "y": 104.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 31.5, "y": 54.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 59.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 64.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 34.0, "y": 134.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 36.5, "y": 99.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 64.0, "y": 59.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 64.0, "y": 99.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 64.0, "y": 139.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 94.0, "y": 19.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 }, { "pos": { "x": 94.0, "y": 179.0 }, - "name": "WireCrossPoint", - "params": { - "logicWidth": 1 - } + "id": "WireCrossPoint", + "params": 1 } ], "innerWires": [ @@ -1097,21 +1033,5 @@ mograsim version: 0.1.2 "path": [] } ] - }, - "specialized": { - "input_count": [ - "I2", - "I1", - "I0" - ], - "label": "Am2901SourceDecode", - "logic_width": 1, - "output_count": [ - "SQ", - "RA", - "SB", - "SA", - "RD" - ] } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java new file mode 100644 index 00000000..4c7b5d9f --- /dev/null +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java @@ -0,0 +1,65 @@ +package net.mograsim.logic.ui.examples; + +import java.io.IOException; +import java.util.function.Function; + +import net.mograsim.logic.ui.model.ViewModelModifiable; +import net.mograsim.logic.ui.model.components.GUIComponent; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUI_rsLatch; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIand; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIand41; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIandor414; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIdemux2; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIdff; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIdlatch; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIdlatch4; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIfulladder; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIhalfadder; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUImux1; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUImux1_4; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUInand3; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUInot4; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIor4; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIor_4; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIram2; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIram4; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIsel2_4; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIsel3_4; +import net.mograsim.logic.ui.model.components.mi.nandbased.GUIxor; +import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901; +import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901ALUFuncDecode; +import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901ALUInclDecode; +import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901ALUInclSourceDecodeInclFunctionDecode; +import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901ALUOneBit; +import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901DestDecode; +import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901QReg; +import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901SourceDecode; +import net.mograsim.logic.ui.model.components.submodels.SubmodelComponent; +import net.mograsim.logic.ui.serializing.SubmodelComponentParams; +import net.mograsim.logic.ui.util.JsonHandler; + +public class ComponenetSerializer +{ + public static void main(String[] args) throws IOException + { + // we know we only use components where this works + Function getIdentifier = c -> c.getClass().getSimpleName(); + + ViewModelModifiable model = new ViewModelModifiable(); + SubmodelComponent[] components = { new GUIAm2901(model), new GUIAm2901ALUFuncDecode(model), new GUIAm2901ALUInclDecode(model), + new GUIAm2901ALUInclSourceDecodeInclFunctionDecode(model), new GUIAm2901ALUOneBit(model), new GUIAm2901DestDecode(model), + new GUIAm2901QReg(model), new GUIAm2901SourceDecode(model), new GUI_rsLatch(model), new GUIand(model), new GUIand41(model), + new GUIandor414(model), new GUIdemux2(model), new GUIdff(model), new GUIdlatch(model), new GUIdlatch4(model), + new GUIfulladder(model), new GUIhalfadder(model), new GUImux1(model), new GUImux1_4(model), new GUInand3(model), + new GUInot4(model), new GUIor4(model), new GUIor_4(model), new GUIram2(model), new GUIram4(model), new GUIsel2_4(model), + new GUIsel3_4(model), new GUIxor(model) }; + + for (SubmodelComponent comp : components) + { + SubmodelComponentParams params = comp.calculateParams(getIdentifier); + JsonHandler.writeJson(params, "components/" + + comp.getClass().getName().substring("net.mograsim.logic.ui.model.components.mi.nandbased.".length()).replace('.', '/') + + ".json"); + } + } +} \ No newline at end of file -- 2.17.1 From 150c5385bc4605d568bac31138b23562b8f19fce Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Wed, 3 Jul 2019 23:16:19 +0200 Subject: [PATCH 03/16] Fixed standardComponentIDMapping --- .../logic/ui/serializing/standardComponentIDMapping.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardComponentIDMapping.json b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardComponentIDMapping.json index a594273d..366f9c24 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardComponentIDMapping.json +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardComponentIDMapping.json @@ -8,9 +8,9 @@ mograsim version: 0.1.3 "GUIAm2901DestDecode": "file:components/am2901/GUIAm2901DestDecode.json", "GUIAm2901QReg": "file:components/am2901/GUIAm2901QReg.json", "GUIAm2901SourceDecode": "file:components/am2901/GUIAm2901SourceDecode.json", - "GUIAndGate": "class:net.mograsim.logic.ui.model.components.GUIAndGate", - "GUINandGate": "class:net.mograsim.logic.ui.model.components.GUINandGate", - "GUIOrGate": "class:net.mograsim.logic.ui.model.components.GUIOrGate", + "GUIAndGate": "class:net.mograsim.logic.ui.model.components.atomic.GUIAndGate", + "GUINandGate": "class:net.mograsim.logic.ui.model.components.atomic.GUINandGate", + "GUIOrGate": "class:net.mograsim.logic.ui.model.components.atomic.GUIOrGate", "GUI_rsLatch": "file:components/GUI_rsLatch.json", "GUIand": "file:components/GUIand.json", "GUIand41": "file:components/GUIand41.json", -- 2.17.1 From c17518ca27f37f56b0da13aa144787a39e1f5454 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Wed, 3 Jul 2019 23:17:37 +0200 Subject: [PATCH 04/16] Fixed & renamed CodeSnippetSupplier.tryInvokeStaticInitializer --- .../logic/ui/serializing/CodeSnippetSupplier.java | 10 +++++----- .../ui/serializing/IndirectGUIComponentCreator.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java index 743d843c..62014ca0 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java @@ -110,18 +110,18 @@ public class CodeSnippetSupplier private static void tryLoadSnippetClass(String snippetClassName) { - tryLoadClass(snippetClassName, "Error getting snippet code for component class: %s\n"); + tryInvokeStaticInitializer(snippetClassName, "Error getting snippet code for component class: %s: %s\n"); } - public static void tryLoadClass(String className, String errorMessageFormat) + public static void tryInvokeStaticInitializer(String className, String errorMessageFormat) { try { - CodeSnippetSupplier.class.getClassLoader().loadClass(className); + Class.forName(className, true, CodeSnippetSupplier.class.getClassLoader()); } - catch (@SuppressWarnings("unused") ClassNotFoundException e) + catch (ClassNotFoundException e) { - System.err.printf(errorMessageFormat, className); + System.err.printf(errorMessageFormat, className, "ClassNotFoundException thrown: " + e.getMessage()); } } } \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/IndirectGUIComponentCreator.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/IndirectGUIComponentCreator.java index ba713bd5..c40897a9 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/IndirectGUIComponentCreator.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/IndirectGUIComponentCreator.java @@ -81,7 +81,7 @@ public class IndirectGUIComponentCreator private static void tryLoadComponentClass(String componentClassName) { - CodeSnippetSupplier.tryLoadClass(componentClassName, "Error loading component class %s\n"); + CodeSnippetSupplier.tryInvokeStaticInitializer(componentClassName, "Error loading component class %s: %s\n"); } public static interface ComponentProvider -- 2.17.1 From 560162bd8d9a5f42305cd04cc0489464b1eafcf1 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Wed, 3 Jul 2019 23:25:03 +0200 Subject: [PATCH 05/16] Switched SubmodelComponentTestbench to use JSON-based Am2901 --- .../examples/SubmodelComponentTestbench.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java index a3dda8af..5f10c729 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java @@ -1,12 +1,16 @@ package net.mograsim.logic.ui.examples; +import java.util.ArrayList; +import java.util.List; + import net.mograsim.logic.ui.SimpleLogicUIStandalone; import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.atomic.GUIBitDisplay; import net.mograsim.logic.ui.model.components.atomic.GUIManualSwitch; -import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901; -import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmodelComponent; +import net.mograsim.logic.ui.model.components.submodels.SubmodelComponent; import net.mograsim.logic.ui.model.wires.GUIWire; +import net.mograsim.logic.ui.model.wires.Pin; +import net.mograsim.logic.ui.serializing.SubmodelComponentDeserializer; public class SubmodelComponentTestbench { @@ -18,20 +22,29 @@ public class SubmodelComponentTestbench @SuppressWarnings("unused") // for GUIWires being created public static void createTestbench(ViewModelModifiable model) { - SimpleRectangularSubmodelComponent comp = new GUIAm2901(model); + SubmodelComponent comp = SubmodelComponentDeserializer.create(model, "components/am2901/GUIAm2901.json"); + + // guess which pins are outputs and which are inputs + List inputPinNames = new ArrayList<>(); + List outputPinNames = new ArrayList<>(); + for (Pin p : comp.getPins().values()) + if (p.getRelX() == 0) + inputPinNames.add(p.name); + else + outputPinNames.add(p.name); comp.moveTo(100, 0); - for (int i = 0; i < comp.getInputPinNames().size(); i++) + for (int i = 0; i < inputPinNames.size(); i++) { GUIManualSwitch sw = new GUIManualSwitch(model); sw.moveTo(0, 20 * i); - new GUIWire(model, comp.getPin(comp.getInputPinNames().get(i)), sw.getOutputPin()); + new GUIWire(model, comp.getPin(inputPinNames.get(i)), sw.getOutputPin()); } - for (int i = 0; i < comp.getOutputPinNames().size(); i++) + for (int i = 0; i < outputPinNames.size(); i++) { GUIBitDisplay bd = new GUIBitDisplay(model); bd.moveTo(200, 20 * i); - new GUIWire(model, comp.getPin(comp.getOutputPinNames().get(i)), bd.getInputPin()); + new GUIWire(model, comp.getPin(outputPinNames.get(i)), bd.getInputPin()); } } } \ No newline at end of file -- 2.17.1 From 2fd5bc7536c065766aaa59113697d5c2ea690962 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Wed, 3 Jul 2019 23:25:47 +0200 Subject: [PATCH 06/16] Made classes in package "nandbased" usable for JSON --- .../model/components/mi/nandbased/GUI_rsLatch.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUIand.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUIand41.java | 6 ++++++ .../model/components/mi/nandbased/GUIandor414.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUIdemux2.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUIdff.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUIdlatch.java | 6 ++++++ .../model/components/mi/nandbased/GUIdlatch4.java | 6 ++++++ .../model/components/mi/nandbased/GUIfulladder.java | 6 ++++++ .../model/components/mi/nandbased/GUIhalfadder.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUImux1.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUImux1_4.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUInand3.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUInot4.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUIor4.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUIor_4.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUIram2.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUIram4.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUIsel2_4.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUIsel3_4.java | 6 ++++++ .../ui/model/components/mi/nandbased/GUIxor.java | 6 ++++++ .../components/mi/nandbased/am2901/GUIAm2901.java | 6 ++++++ .../mi/nandbased/am2901/GUIAm2901ALUFuncDecode.java | 7 +++++++ .../mi/nandbased/am2901/GUIAm2901ALUInclDecode.java | 7 +++++++ ...Am2901ALUInclSourceDecodeInclFunctionDecode.java | 7 +++++++ .../mi/nandbased/am2901/GUIAm2901ALUOneBit.java | 6 ++++++ .../mi/nandbased/am2901/GUIAm2901DestDecode.java | 13 +++++++++---- .../mi/nandbased/am2901/GUIAm2901QReg.java | 6 ++++++ .../mi/nandbased/am2901/GUIAm2901SourceDecode.java | 10 ++++++++-- 29 files changed, 182 insertions(+), 6 deletions(-) diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUI_rsLatch.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUI_rsLatch.java index 065544c1..b190ffa8 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUI_rsLatch.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUI_rsLatch.java @@ -9,6 +9,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUI_rsLatch extends SimpleRectangularSubmodelComponent { @@ -95,4 +96,9 @@ public class GUI_rsLatch extends SimpleRectangularSubmodelComponent throw new IllegalStateException("Illegal atomic state ID: " + stateID); } } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUI_rsLatch.class.getCanonicalName(), (m, p) -> new GUI_rsLatch(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand.java index 637750f8..b21474ef 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIand extends SimpleRectangularSubmodelComponent { @@ -42,4 +43,9 @@ public class GUIand extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, cp1, not.getPin("B"), new Point(45, 30)); new GUIWire(submodelModifiable, not.getPin("Y"), Y); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIand.class.getCanonicalName(), (m, p) -> new GUIand(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand41.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand41.java index 3bfb8142..fc1a5bd7 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand41.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIand41.java @@ -6,6 +6,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIand41 extends SimpleRectangularSubmodelComponent { @@ -64,4 +65,9 @@ public class GUIand41 extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, and3.getPin("Y"), Y3, new Point[0]); new GUIWire(submodelModifiable, and4.getPin("Y"), Y4, new Point[0]); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIand41.class.getCanonicalName(), (m, p) -> new GUIand41(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIandor414.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIandor414.java index f48795f2..c514d4ca 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIandor414.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIandor414.java @@ -5,6 +5,7 @@ import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmodelComponent; import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIandor414 extends SimpleRectangularSubmodelComponent { @@ -62,4 +63,9 @@ public class GUIandor414 extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, or.getPin("Y3"), Y3, new Point[0]); new GUIWire(submodelModifiable, or.getPin("Y4"), Y4, new Point(80, 72.5), new Point(80, 87.5)); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIandor414.class.getCanonicalName(), (m, p) -> new GUIandor414(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdemux2.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdemux2.java index 5365e92c..1f1940b1 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdemux2.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdemux2.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIdemux2 extends SimpleRectangularSubmodelComponent { @@ -85,4 +86,9 @@ public class GUIdemux2 extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, andY10.getPin("Y"), Y10); new GUIWire(submodelModifiable, andY11.getPin("Y"), Y11); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIdemux2.class.getCanonicalName(), (m, p) -> new GUIdemux2(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdff.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdff.java index ad8c212b..440f4d1d 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdff.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdff.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIdff extends SimpleRectangularSubmodelComponent { @@ -93,4 +94,9 @@ public class GUIdff extends SimpleRectangularSubmodelComponent throw new IllegalStateException("Illegal atomic state ID: " + stateID); } } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIdff.class.getCanonicalName(), (m, p) -> new GUIdff(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdlatch.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdlatch.java index 39b1f715..ff158923 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdlatch.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdlatch.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIdlatch extends SimpleRectangularSubmodelComponent { @@ -82,4 +83,9 @@ public class GUIdlatch extends SimpleRectangularSubmodelComponent throw new IllegalStateException("Illegal atomic state ID: " + stateID); } } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIdlatch.class.getCanonicalName(), (m, p) -> new GUIdlatch(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdlatch4.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdlatch4.java index 36a05af3..10ee84db 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdlatch4.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIdlatch4.java @@ -8,6 +8,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIdlatch4 extends SimpleRectangularSubmodelComponent { @@ -132,4 +133,9 @@ public class GUIdlatch4 extends SimpleRectangularSubmodelComponent throw new IllegalStateException("Illegal atomic state ID: " + stateID); } } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIdlatch4.class.getCanonicalName(), (m, p) -> new GUIdlatch4(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIfulladder.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIfulladder.java index 23656fa8..7ec77711 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIfulladder.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIfulladder.java @@ -6,6 +6,7 @@ import net.mograsim.logic.ui.model.components.atomic.GUINandGate; import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmodelComponent; import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIfulladder extends SimpleRectangularSubmodelComponent { @@ -45,4 +46,9 @@ public class GUIfulladder extends SimpleRectangularSubmodelComponent new Point(52.5, 35), new Point(52.5, 45)); new GUIWire(submodelModifiable, nandZ.getPin("Y"), Z); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIfulladder.class.getCanonicalName(), (m, p) -> new GUIfulladder(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIhalfadder.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIhalfadder.java index d68c8923..7a80a959 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIhalfadder.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIhalfadder.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIhalfadder extends SimpleRectangularSubmodelComponent { @@ -58,4 +59,9 @@ public class GUIhalfadder extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, nandYB.getPin("Y"), nandY.getPin("B"), new Point(62.5, 37.5), new Point(62.5, 17.5)); new GUIWire(submodelModifiable, nandY.getPin("Y"), Y, new Point[0]); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIhalfadder.class.getCanonicalName(), (m, p) -> new GUIhalfadder(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUImux1.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUImux1.java index dc9ea531..291f628e 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUImux1.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUImux1.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUImux1 extends SimpleRectangularSubmodelComponent { @@ -54,4 +55,9 @@ public class GUImux1 extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, nandI1.getPin("Y"), nandY.getPin("B")); new GUIWire(submodelModifiable, nandY.getPin("Y"), Y); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUImux1.class.getCanonicalName(), (m, p) -> new GUImux1(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUImux1_4.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUImux1_4.java index 3d7336f8..ff0353bb 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUImux1_4.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUImux1_4.java @@ -6,6 +6,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUImux1_4 extends SimpleRectangularSubmodelComponent { @@ -73,4 +74,9 @@ public class GUImux1_4 extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, mux4.getPin("Y"), Y4); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUImux1_4.class.getCanonicalName(), (m, p) -> new GUImux1_4(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUInand3.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUInand3.java index 64fd958d..39d29e26 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUInand3.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUInand3.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUInand3 extends SimpleRectangularSubmodelComponent { @@ -47,4 +48,9 @@ public class GUInand3 extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, C, nandABC.getPin("B"), new Point(60, 62.5), new Point(60, 17.5)); new GUIWire(submodelModifiable, nandABC.getPin("Y"), Y, new Point[0]); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUInand3.class.getCanonicalName(), (m, p) -> new GUInand3(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUInot4.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUInot4.java index 7fb2b5bc..13d2b1f8 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUInot4.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUInot4.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUInot4 extends SimpleRectangularSubmodelComponent { @@ -67,4 +68,9 @@ public class GUInot4 extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, nand3.getPin("Y"), Y3, new Point[0]); new GUIWire(submodelModifiable, nand4.getPin("Y"), Y4, new Point[0]); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUInot4.class.getCanonicalName(), (m, p) -> new GUInot4(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIor4.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIor4.java index 9aadcdfd..9f7dde4f 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIor4.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIor4.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIor4 extends SimpleRectangularSubmodelComponent { @@ -87,4 +88,9 @@ public class GUIor4 extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, nor34.getPin("Y"), or1234.getPin("B")); new GUIWire(submodelModifiable, or1234.getPin("Y"), Y); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIor4.class.getCanonicalName(), (m, p) -> new GUIor4(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIor_4.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIor_4.java index 9d14d1ad..ba10373c 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIor_4.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIor_4.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIor_4 extends SimpleRectangularSubmodelComponent { @@ -115,4 +116,9 @@ public class GUIor_4 extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, nandY3.getPin("Y"), Y3, new Point[0]); new GUIWire(submodelModifiable, nandY4.getPin("Y"), Y4, new Point[0]); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIor_4.class.getCanonicalName(), (m, p) -> new GUIor_4(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIram2.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIram2.java index 4892203e..f0bbf490 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIram2.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIram2.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIram2 extends SimpleRectangularSubmodelComponent { @@ -319,4 +320,9 @@ public class GUIram2 extends SimpleRectangularSubmodelComponent throw new IllegalStateException("Illegal atomic state ID: " + stateID); } } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIram2.class.getCanonicalName(), (m, p) -> new GUIram2(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIram4.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIram4.java index 333dc077..35d3df59 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIram4.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIram4.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIram4 extends SimpleRectangularSubmodelComponent { @@ -357,4 +358,9 @@ public class GUIram4 extends SimpleRectangularSubmodelComponent return (addr3 == '0' || addr3 == '1') || (addr2 == '0' || addr2 == '1') || (addr1 == '0' || addr1 == '1') || (addr0 == '0' || addr0 == '1'); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIram4.class.getCanonicalName(), (m, p) -> new GUIram4(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIsel2_4.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIsel2_4.java index c43413c6..fadfd385 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIsel2_4.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIsel2_4.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIsel2_4 extends SimpleRectangularSubmodelComponent { @@ -111,4 +112,9 @@ public class GUIsel2_4 extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, nandY3.getPin("Y"), Y3, new Point[0]); new GUIWire(submodelModifiable, nandY4.getPin("Y"), Y4, new Point[0]); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIsel2_4.class.getCanonicalName(), (m, p) -> new GUIsel2_4(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIsel3_4.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIsel3_4.java index 20c8fb4a..83440eee 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIsel3_4.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIsel3_4.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIsel3_4 extends SimpleRectangularSubmodelComponent { @@ -109,4 +110,9 @@ public class GUIsel3_4 extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, nandY3.getPin("Y"), Y3, new Point[0]); new GUIWire(submodelModifiable, nandY4.getPin("Y"), Y4, new Point[0]); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIsel3_4.class.getCanonicalName(), (m, p) -> new GUIsel3_4(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIxor.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIxor.java index dcf6c1f1..537ed00e 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIxor.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/GUIxor.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIxor extends SimpleRectangularSubmodelComponent { @@ -56,4 +57,9 @@ public class GUIxor extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, nandYB.getPin("Y"), nandY.getPin("B")); new GUIWire(submodelModifiable, nandY.getPin("Y"), Y); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIxor.class.getCanonicalName(), (m, p) -> new GUIxor(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901.java index 7548ec59..ec3cf86f 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901.java @@ -13,6 +13,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIAm2901 extends SimpleRectangularSubmodelComponent { @@ -344,4 +345,9 @@ public class GUIAm2901 extends SimpleRectangularSubmodelComponent addHighLevelStateSubcomponentID("regs", ram); addHighLevelStateSubcomponentID("qreg", qreg); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIAm2901.class.getCanonicalName(), (m, p) -> new GUIAm2901(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUFuncDecode.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUFuncDecode.java index 339b18a7..f08898ff 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUFuncDecode.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUFuncDecode.java @@ -9,6 +9,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIAm2901ALUFuncDecode extends SimpleRectangularSubmodelComponent { @@ -106,4 +107,10 @@ public class GUIAm2901ALUFuncDecode extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, nandL.getPin("Y"), L, new Point[0]); new GUIWire(submodelModifiable, andSBE.getPin("Y"), SBE, new Point[0]); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIAm2901ALUFuncDecode.class.getCanonicalName(), + (m, p) -> new GUIAm2901ALUFuncDecode(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUInclDecode.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUInclDecode.java index db2292d3..79bbba6e 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUInclDecode.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUInclDecode.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIAm2901ALUInclDecode extends SimpleRectangularSubmodelComponent { @@ -166,4 +167,10 @@ public class GUIAm2901ALUInclDecode extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, cpCnplus4, Cnplus4, new Point(130, 385), new Point(130, 180)); new GUIWire(submodelModifiable, xorOVR.getPin("Y"), OVR); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIAm2901ALUInclDecode.class.getCanonicalName(), + (m, p) -> new GUIAm2901ALUInclDecode(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.java index d8222824..784e200e 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.java @@ -8,6 +8,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIAm2901ALUInclSourceDecodeInclFunctionDecode extends SimpleRectangularSubmodelComponent { @@ -137,4 +138,10 @@ public class GUIAm2901ALUInclSourceDecodeInclFunctionDecode extends SimpleRectan new GUIWire(submodelModifiable, alu.getPin("Cn+4"), Cnplus4, new Point(120, 60), new Point(120, 180)); new GUIWire(submodelModifiable, alu.getPin("OVR"), OVR, new Point(115, 70), new Point(115, 220)); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIAm2901ALUInclSourceDecodeInclFunctionDecode.class.getCanonicalName(), + (m, p) -> new GUIAm2901ALUInclSourceDecodeInclFunctionDecode(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUOneBit.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUOneBit.java index 4db026f8..c35f7cf2 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUOneBit.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901ALUOneBit.java @@ -11,6 +11,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIAm2901ALUOneBit extends SimpleRectangularSubmodelComponent { @@ -86,4 +87,9 @@ public class GUIAm2901ALUOneBit extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, Coutand.getPin("Y"), Cout, new Point[0]); new GUIWire(submodelModifiable, Fxor.getPin("Y"), F, new Point[0]); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIAm2901ALUOneBit.class.getCanonicalName(), (m, p) -> new GUIAm2901ALUOneBit(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901DestDecode.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901DestDecode.java index 070618c5..defe85b2 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901DestDecode.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901DestDecode.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIAm2901DestDecode extends SimpleRectangularSubmodelComponent { @@ -117,8 +118,7 @@ public class GUIAm2901DestDecode extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, cpNotI81, cpNotI82, new Point[0]); new GUIWire(submodelModifiable, cpNotI82, nandRAMWE.getPin("A"), new Point[0]); new GUIWire(submodelModifiable, cpNotI82, nandI7NotI8.getPin("A"), new Point(45, 95)); - new GUIWire(submodelModifiable, cpI73, nandI7NotI8.getPin("B"), new Point(10, 115), new Point(45, 115), - new Point(45, 105)); + new GUIWire(submodelModifiable, cpI73, nandI7NotI8.getPin("B"), new Point(10, 115), new Point(45, 115), new Point(45, 105)); new GUIWire(submodelModifiable, nandI8I7.getPin("Y"), cpNandI8I7, new Point(40, 100)); new GUIWire(submodelModifiable, cpNandI8I7, nandLSH.getPin("A"), new Point[0]); new GUIWire(submodelModifiable, cpNandI8I7, nandLSH.getPin("B"), new Point(40, 145)); @@ -136,12 +136,17 @@ public class GUIAm2901DestDecode extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, cpNotI6, nandQWE.getPin("B"), new Point[0]); new GUIWire(submodelModifiable, notRSH.getPin("Y"), RSH, new Point(130, 20), new Point(130, 60)); new GUIWire(submodelModifiable, andI7NotI8.getPin("Y"), nandYF.getPin("A")); - new GUIWire(submodelModifiable, cpNotI6, nandYF.getPin("B"), new Point(75, 170), new Point(105, 170), - new Point(105, 120)); + new GUIWire(submodelModifiable, cpNotI6, nandYF.getPin("B"), new Point(75, 170), new Point(105, 170), new Point(105, 120)); new GUIWire(submodelModifiable, nandQWE.getPin("Y"), cpNandQWE, new Point(110, 155)); new GUIWire(submodelModifiable, cpNandQWE, notQWE.getPin("A"), new Point[0]); new GUIWire(submodelModifiable, cpNandQWE, notQWE.getPin("B"), new Point(110, 225)); new GUIWire(submodelModifiable, nandYF.getPin("Y"), YF); new GUIWire(submodelModifiable, notQWE.getPin("Y"), QWE, new Point[0]); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIAm2901DestDecode.class.getCanonicalName(), + (m, p) -> new GUIAm2901DestDecode(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901QReg.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901QReg.java index 11a72416..804e85d2 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901QReg.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901QReg.java @@ -10,6 +10,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIAm2901QReg extends SimpleRectangularSubmodelComponent { @@ -140,4 +141,9 @@ public class GUIAm2901QReg extends SimpleRectangularSubmodelComponent throw new IllegalStateException("Illegal atomic state ID: " + stateID); } } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIAm2901QReg.class.getCanonicalName(), (m, p) -> new GUIAm2901QReg(m)); + } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901SourceDecode.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901SourceDecode.java index 832d9951..d0ef4d5e 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901SourceDecode.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/model/components/mi/nandbased/am2901/GUIAm2901SourceDecode.java @@ -7,6 +7,7 @@ import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmode import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; public class GUIAm2901SourceDecode extends SimpleRectangularSubmodelComponent { @@ -111,8 +112,7 @@ public class GUIAm2901SourceDecode extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, cpI01, notI0.getPin("A"), new Point(7.5, 95)); new GUIWire(submodelModifiable, cpI01, cpI02, new Point[0]); new GUIWire(submodelModifiable, cpI02, notI0.getPin("B"), new Point[0]); - new GUIWire(submodelModifiable, cpI02, nand23.getPin("B"), new Point(7.5, 112.5), new Point(32.5, 112.5), - new Point(32.5, 105)); + new GUIWire(submodelModifiable, cpI02, nand23.getPin("B"), new Point(7.5, 112.5), new Point(32.5, 112.5), new Point(32.5, 105)); new GUIWire(submodelModifiable, notI2.getPin("Y"), cpNotI2, new Point(32.5, 20)); new GUIWire(submodelModifiable, cpNotI2, nand22.getPin("A"), new Point[0]); new GUIWire(submodelModifiable, cpNotI2, nand23.getPin("A"), new Point(32.5, 95)); @@ -149,4 +149,10 @@ public class GUIAm2901SourceDecode extends SimpleRectangularSubmodelComponent new GUIWire(submodelModifiable, nand41.getPin("Y"), SQ, new Point[0]); new GUIWire(submodelModifiable, nand42.getPin("Y"), RD, new Point[0]); } + + static + { + IndirectGUIComponentCreator.setComponentProvider(GUIAm2901SourceDecode.class.getCanonicalName(), + (m, p) -> new GUIAm2901SourceDecode(m)); + } } \ No newline at end of file -- 2.17.1 From e90379ee1c801a735536c06002aed0d6b9afb191 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Wed, 3 Jul 2019 23:29:19 +0200 Subject: [PATCH 07/16] Fixed net.mograsim.plugin.core --- .../src/net/mograsim/plugin/SimulationPreview.java | 6 +++--- .../src/net/mograsim/plugin/views/LogicUIPart.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java b/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java index b8488d50..d76cd59f 100644 --- a/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java +++ b/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java @@ -10,9 +10,9 @@ import net.mograsim.logic.core.timeline.Timeline; import net.mograsim.logic.ui.LogicExecuter; import net.mograsim.logic.ui.LogicUICanvas; import net.mograsim.logic.ui.model.ViewModelModifiable; -import net.mograsim.logic.ui.model.components.GUIManualSwitch; -import net.mograsim.logic.ui.model.components.GUINotGate; -import net.mograsim.logic.ui.model.components.GUIOrGate; +import net.mograsim.logic.ui.model.components.atomic.GUIManualSwitch; +import net.mograsim.logic.ui.model.components.atomic.GUINotGate; +import net.mograsim.logic.ui.model.components.atomic.GUIOrGate; import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.model.wires.WireCrossPoint; import net.mograsim.logic.ui.modeladapter.LogicModelParameters; diff --git a/net.mograsim.plugin.core/src/net/mograsim/plugin/views/LogicUIPart.java b/net.mograsim.plugin.core/src/net/mograsim/plugin/views/LogicUIPart.java index 1ae8066e..0892f248 100644 --- a/net.mograsim.plugin.core/src/net/mograsim/plugin/views/LogicUIPart.java +++ b/net.mograsim.plugin.core/src/net/mograsim/plugin/views/LogicUIPart.java @@ -13,10 +13,10 @@ import net.mograsim.logic.core.timeline.Timeline; import net.mograsim.logic.ui.LogicExecuter; import net.mograsim.logic.ui.LogicUICanvas; import net.mograsim.logic.ui.model.ViewModelModifiable; -import net.mograsim.logic.ui.model.components.GUIBitDisplay; -import net.mograsim.logic.ui.model.components.GUIManualSwitch; -import net.mograsim.logic.ui.model.components.SimpleRectangularSubmodelComponent; +import net.mograsim.logic.ui.model.components.atomic.GUIBitDisplay; +import net.mograsim.logic.ui.model.components.atomic.GUIManualSwitch; import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901; +import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmodelComponent; import net.mograsim.logic.ui.model.wires.GUIWire; import net.mograsim.logic.ui.modeladapter.LogicModelParameters; import net.mograsim.logic.ui.modeladapter.ViewLogicModelAdapter; -- 2.17.1 From 5e2130295467f83016dd715c038b1f2145d567f1 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Wed, 3 Jul 2019 23:30:04 +0200 Subject: [PATCH 08/16] Organized imports + cleaned MANIFEST.MF --- .../src/net/mograsim/logic/core/types/BitVectorFormatter.java | 2 +- net.mograsim.plugin.core/META-INF/MANIFEST.MF | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVectorFormatter.java b/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVectorFormatter.java index 3cb35b3d..5fd1e2c2 100644 --- a/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVectorFormatter.java +++ b/net.mograsim.logic.core/src/net/mograsim/logic/core/types/BitVectorFormatter.java @@ -2,8 +2,8 @@ package net.mograsim.logic.core.types; import net.mograsim.logic.core.wires.Wire.ReadEnd; import net.mograsim.preferences.ColorDefinition; -import net.mograsim.preferences.Preferences; import net.mograsim.preferences.ColorDefinition.BuiltInColor; +import net.mograsim.preferences.Preferences; public class BitVectorFormatter { diff --git a/net.mograsim.plugin.core/META-INF/MANIFEST.MF b/net.mograsim.plugin.core/META-INF/MANIFEST.MF index 4c7bfaee..b125d7eb 100644 --- a/net.mograsim.plugin.core/META-INF/MANIFEST.MF +++ b/net.mograsim.plugin.core/META-INF/MANIFEST.MF @@ -6,6 +6,7 @@ Bundle-Version: 0.1.0.qualifier Export-Package: net.mograsim.plugin;uses:="org.eclipse.ui.themes,org.eclipse.swt.widgets", net.mograsim.plugin.asm, net.mograsim.plugin.asm.editor, + net.mograsim.plugin.asm.editor.rules, net.mograsim.plugin.asm.model, net.mograsim.plugin.nature, net.mograsim.plugin.views -- 2.17.1 From 9ca90120a47e07c9182162351dc47aa89ae703be Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Thu, 4 Jul 2019 10:24:44 +0200 Subject: [PATCH 09/16] Added two SymbolRendererProviders --- .../components/GUI_rsLatch.json | 8 ++ .../components/GUIand.json | 8 ++ .../components/GUIand41.json | 8 ++ .../components/GUIandor414.json | 8 ++ .../components/GUIdemux2.json | 8 ++ .../components/GUIdff.json | 8 ++ .../components/GUIdlatch.json | 8 ++ .../components/GUIdlatch4.json | 8 ++ .../components/GUIfulladder.json | 8 ++ .../components/GUIhalfadder.json | 8 ++ .../components/GUImux1.json | 8 ++ .../components/GUImux1_4.json | 8 ++ .../components/GUInand3.json | 8 ++ .../components/GUInot4.json | 8 ++ .../components/GUIor4.json | 8 ++ .../components/GUIor_4.json | 8 ++ .../components/GUIram2.json | 8 ++ .../components/GUIram4.json | 8 ++ .../components/GUIsel2_4.json | 8 ++ .../components/GUIsel3_4.json | 8 ++ .../components/GUIxor.json | 8 ++ .../components/am2901/GUIAm2901.json | 8 ++ .../am2901/GUIAm2901ALUFuncDecode.json | 8 ++ .../am2901/GUIAm2901ALUInclDecode.json | 8 ++ ...ALUInclSourceDecodeInclFunctionDecode.json | 8 ++ .../components/am2901/GUIAm2901ALUOneBit.json | 8 ++ .../am2901/GUIAm2901DestDecode.json | 8 ++ .../components/am2901/GUIAm2901QReg.json | 8 ++ .../am2901/GUIAm2901SourceDecode.json | 8 ++ .../ui/examples/ComponenetSerializer.java | 11 +++ .../SimpleRectangularSubmodelComponent.java | 1 + .../ui/serializing/CodeSnippetSupplier.java | 30 ++----- .../SubmodelComponentDeserializer.java | 5 +- .../serializing/SubmodelComponentParams.java | 4 +- .../DefaultOutlineRendererProvider.java | 26 ++++++ .../CenteredTextSymbolRendererProvider.java | 57 +++++++++++++ .../DefaultSymbolRendererProvider.java | 31 +++++++ ...RectangularLikeSymbolRendererProvider.java | 83 +++++++++++++++++++ .../serializing/standardSnippetIDMapping.json | 2 + 39 files changed, 453 insertions(+), 29 deletions(-) create mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/outlinerenderers/DefaultOutlineRendererProvider.java create mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRendererProvider.java create mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/DefaultSymbolRendererProvider.java create mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRendererProvider.java diff --git a/net.mograsim.logic.ui.am2900/components/GUI_rsLatch.json b/net.mograsim.logic.ui.am2900/components/GUI_rsLatch.json index 4431f34a..35ebc03d 100644 --- a/net.mograsim.logic.ui.am2900/components/GUI_rsLatch.json +++ b/net.mograsim.logic.ui.am2900/components/GUI_rsLatch.json @@ -206,5 +206,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "_rsLatch", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIand.json b/net.mograsim.logic.ui.am2900/components/GUIand.json index 0687592a..d717447e 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIand.json +++ b/net.mograsim.logic.ui.am2900/components/GUIand.json @@ -131,5 +131,13 @@ mograsim version: 0.1.3 } } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "and", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIand41.json b/net.mograsim.logic.ui.am2900/components/GUIand41.json index cb1608a5..2e9d9531 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIand41.json +++ b/net.mograsim.logic.ui.am2900/components/GUIand41.json @@ -309,5 +309,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "and41", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIandor414.json b/net.mograsim.logic.ui.am2900/components/GUIandor414.json index d585785b..0a9f2645 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIandor414.json +++ b/net.mograsim.logic.ui.am2900/components/GUIandor414.json @@ -473,5 +473,13 @@ mograsim version: 0.1.3 ] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "andor414", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIdemux2.json b/net.mograsim.logic.ui.am2900/components/GUIdemux2.json index 04df7d07..07bf5ada 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIdemux2.json +++ b/net.mograsim.logic.ui.am2900/components/GUIdemux2.json @@ -485,5 +485,13 @@ mograsim version: 0.1.3 } } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "demux2", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIdff.json b/net.mograsim.logic.ui.am2900/components/GUIdff.json index df4e0a1e..4902e6c8 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIdff.json +++ b/net.mograsim.logic.ui.am2900/components/GUIdff.json @@ -308,5 +308,13 @@ mograsim version: 0.1.3 } } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "dff", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIdlatch.json b/net.mograsim.logic.ui.am2900/components/GUIdlatch.json index 84e635f8..a5c6b432 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIdlatch.json +++ b/net.mograsim.logic.ui.am2900/components/GUIdlatch.json @@ -221,5 +221,13 @@ mograsim version: 0.1.3 } } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "dlatch", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIdlatch4.json b/net.mograsim.logic.ui.am2900/components/GUIdlatch4.json index 2458b250..8dddd05f 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIdlatch4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIdlatch4.json @@ -309,5 +309,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "dlatch4", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIfulladder.json b/net.mograsim.logic.ui.am2900/components/GUIfulladder.json index d7396280..34cc7ea4 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIfulladder.json +++ b/net.mograsim.logic.ui.am2900/components/GUIfulladder.json @@ -173,5 +173,13 @@ mograsim version: 0.1.3 } } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "fulladder", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIhalfadder.json b/net.mograsim.logic.ui.am2900/components/GUIhalfadder.json index 5cffb3db..36885ac5 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIhalfadder.json +++ b/net.mograsim.logic.ui.am2900/components/GUIhalfadder.json @@ -298,5 +298,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "halfadder", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUImux1.json b/net.mograsim.logic.ui.am2900/components/GUImux1.json index c3412266..90e90132 100644 --- a/net.mograsim.logic.ui.am2900/components/GUImux1.json +++ b/net.mograsim.logic.ui.am2900/components/GUImux1.json @@ -212,5 +212,13 @@ mograsim version: 0.1.3 } } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "mux1", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUImux1_4.json b/net.mograsim.logic.ui.am2900/components/GUImux1_4.json index 35f9c2f9..d4f23ba1 100644 --- a/net.mograsim.logic.ui.am2900/components/GUImux1_4.json +++ b/net.mograsim.logic.ui.am2900/components/GUImux1_4.json @@ -449,5 +449,13 @@ mograsim version: 0.1.3 } } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "mux1_4", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUInand3.json b/net.mograsim.logic.ui.am2900/components/GUInand3.json index 7177e919..be950652 100644 --- a/net.mograsim.logic.ui.am2900/components/GUInand3.json +++ b/net.mograsim.logic.ui.am2900/components/GUInand3.json @@ -188,5 +188,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "nand3", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUInot4.json b/net.mograsim.logic.ui.am2900/components/GUInot4.json index 5df0c822..ff9a8da3 100644 --- a/net.mograsim.logic.ui.am2900/components/GUInot4.json +++ b/net.mograsim.logic.ui.am2900/components/GUInot4.json @@ -354,5 +354,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "not4", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIor4.json b/net.mograsim.logic.ui.am2900/components/GUIor4.json index 9eb72165..92e54aa4 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIor4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIor4.json @@ -498,5 +498,13 @@ mograsim version: 0.1.3 } } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "or4", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIor_4.json b/net.mograsim.logic.ui.am2900/components/GUIor_4.json index 06aa13f7..53ad0d69 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIor_4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIor_4.json @@ -814,5 +814,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "or_4", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIram2.json b/net.mograsim.logic.ui.am2900/components/GUIram2.json index c1d00ea9..dd051675 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIram2.json +++ b/net.mograsim.logic.ui.am2900/components/GUIram2.json @@ -2770,5 +2770,13 @@ mograsim version: 0.1.3 ] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "ram2", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIram4.json b/net.mograsim.logic.ui.am2900/components/GUIram4.json index 87c28929..16f912e2 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIram4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIram4.json @@ -3142,5 +3142,13 @@ mograsim version: 0.1.3 ] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "ram4", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIsel2_4.json b/net.mograsim.logic.ui.am2900/components/GUIsel2_4.json index b3845c41..6fa6d3af 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIsel2_4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIsel2_4.json @@ -782,5 +782,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "sel2_4", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIsel3_4.json b/net.mograsim.logic.ui.am2900/components/GUIsel3_4.json index fdcbfafa..e5b5d461 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIsel3_4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIsel3_4.json @@ -853,5 +853,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "sel3_4", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/GUIxor.json b/net.mograsim.logic.ui.am2900/components/GUIxor.json index 6b74a5c6..001f5542 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIxor.json +++ b/net.mograsim.logic.ui.am2900/components/GUIxor.json @@ -248,5 +248,13 @@ mograsim version: 0.1.3 } } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "xor", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901.json index d773d7bd..9fc9e8d4 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901.json @@ -3179,5 +3179,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "Am2901", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUFuncDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUFuncDecode.json index cf9f5a6e..b30dcdd2 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUFuncDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUFuncDecode.json @@ -651,5 +651,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "Am2901ALUFuncDecode", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclDecode.json index 1984f630..39aac796 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclDecode.json @@ -1415,5 +1415,13 @@ mograsim version: 0.1.3 } } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "Am2901ALUInclDecode", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json index 3481904b..6c9e6d35 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json @@ -1293,5 +1293,13 @@ mograsim version: 0.1.3 ] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "Am2901ALUInclSourceDecodeInclFunctionDecode", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUOneBit.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUOneBit.json index 84f1a124..5c6215db 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUOneBit.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUOneBit.json @@ -499,5 +499,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "Am2901ALUOneBit", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901DestDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901DestDecode.json index 20dbfb08..621fccd3 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901DestDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901DestDecode.json @@ -994,5 +994,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "Am2901DestDecode", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901QReg.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901QReg.json index b2772259..6bc113d5 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901QReg.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901QReg.json @@ -388,5 +388,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "Am2901QReg", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901SourceDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901SourceDecode.json index e72cc9fb..33b3ff10 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901SourceDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901SourceDecode.json @@ -1033,5 +1033,13 @@ mograsim version: 0.1.3 "path": [] } ] + }, + "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", + "symbolRendererParams": { + "centerText": "Am2901SourceDecode", + "horizontalComponentCenter": 17.5, + "centerTextHeight": 5, + "pinLabelHeight": 3.5, + "pinLabelMargin": 0.5 } } \ No newline at end of file diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java index 4c7b5d9f..397592e1 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java @@ -3,6 +3,8 @@ package net.mograsim.logic.ui.examples; import java.io.IOException; import java.util.function.Function; +import com.google.gson.JsonObject; + import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUIComponent; import net.mograsim.logic.ui.model.components.mi.nandbased.GUI_rsLatch; @@ -57,6 +59,15 @@ public class ComponenetSerializer for (SubmodelComponent comp : components) { SubmodelComponentParams params = comp.calculateParams(getIdentifier); + JsonObject symbolRendererParams = new JsonObject(); + symbolRendererParams.addProperty("centerText", comp.getClass().getSimpleName().substring(3)); // cut away the "GUI" part + symbolRendererParams.addProperty("horizontalComponentCenter", comp.getWidth() / 2); + // use the defaults from SimpleRectangularSubmodelComponent + symbolRendererParams.addProperty("centerTextHeight", 5); + symbolRendererParams.addProperty("pinLabelHeight", 3.5); + symbolRendererParams.addProperty("pinLabelMargin", .5); + params.symbolRendererSnippetID = "SimpleRectangularLikeSymbolRenderer"; + params.symbolRendererParams = symbolRendererParams; JsonHandler.writeJson(params, "components/" + comp.getClass().getName().substring("net.mograsim.logic.ui.model.components.mi.nandbased.".length()).replace('.', '/') + ".json"); diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/submodels/SimpleRectangularSubmodelComponent.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/submodels/SimpleRectangularSubmodelComponent.java index 65114b6b..2bc062e9 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/submodels/SimpleRectangularSubmodelComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/submodels/SimpleRectangularSubmodelComponent.java @@ -93,6 +93,7 @@ public class SimpleRectangularSubmodelComponent extends SubmodelComponent @Override protected void renderSymbol(GeneralGC gc, Rectangle visibleRegion) { + // TODO code duplication: see SimpleRectagularLikeSymbolRendererProvider Font oldFont = gc.getFont(); gc.setFont(new Font(oldFont.getName(), labelFontHeight, oldFont.getStyle())); Point textExtent = gc.textExtent(label); diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java index 62014ca0..8c13e96a 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java @@ -7,14 +7,11 @@ import java.util.Map; import com.google.gson.JsonElement; -import net.haspamelodica.swt.helper.swtobjectwrappers.Point; -import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; import net.mograsim.logic.ui.serializing.snippets.Renderer; import net.mograsim.logic.ui.serializing.snippets.RendererProvider; +import net.mograsim.logic.ui.serializing.snippets.outlinerenderers.DefaultOutlineRendererProvider; +import net.mograsim.logic.ui.serializing.snippets.symbolrenderers.DefaultSymbolRendererProvider; import net.mograsim.logic.ui.util.JsonHandler; -import net.mograsim.preferences.ColorDefinition; -import net.mograsim.preferences.ColorManager; -import net.mograsim.preferences.Preferences; public class CodeSnippetSupplier { @@ -27,24 +24,8 @@ public class CodeSnippetSupplier private static final RendererProvider defaultSymbolRendererProvider; static { - // TODO this code does not belong here - defaultOutlineRendererProvider = (comp, params) -> (gc, visReg) -> - { - ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.ui.color.foreground"); - if (fg != null) - gc.setForeground(ColorManager.current().toColor(fg)); - gc.drawRectangle(comp.getBounds()); - }; - defaultSymbolRendererProvider = (comp, params) -> (gc, visReg) -> - { - ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.ui.color.text"); - if (fg != null) - gc.setForeground(ColorManager.current().toColor(fg)); - String id = "TODO";// TODO add an ID of sorts to DeserializedSubmodelComponent - Point idSize = gc.textExtent(id); - Rectangle bounds = comp.getBounds(); - gc.drawText(id, bounds.x + (bounds.width - idSize.x) / 2, bounds.y + (bounds.height - idSize.y) / 2, true); - }; + defaultOutlineRendererProvider = new DefaultOutlineRendererProvider(); + defaultSymbolRendererProvider = new DefaultSymbolRendererProvider(); } static @@ -105,12 +86,13 @@ public class CodeSnippetSupplier return specializedCode; } } + System.err.println("Couldn't load snippet " + id + "; using default"); return defaultSnippet; } private static void tryLoadSnippetClass(String snippetClassName) { - tryInvokeStaticInitializer(snippetClassName, "Error getting snippet code for component class: %s: %s\n"); + tryInvokeStaticInitializer(snippetClassName, "Error getting snippet class: %s: %s\n"); } public static void tryInvokeStaticInitializer(String className, String errorMessageFormat) diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/SubmodelComponentDeserializer.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/SubmodelComponentDeserializer.java index ffb120db..e997ad28 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/SubmodelComponentDeserializer.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/SubmodelComponentDeserializer.java @@ -62,9 +62,8 @@ public final class SubmodelComponentDeserializer DeserializedSubmodelComponent comp = new DeserializedSubmodelComponent(model); comp.setSubmodelScale(params.submodel.innerScale); comp.setOutlineRenderer( - CodeSnippetSupplier.createOutlineRenderer(params.outlineRendererSnippetClass, comp, params.outlineRendererParams)); - comp.setSymbolRenderer( - CodeSnippetSupplier.createSymbolRenderer(params.symbolRendererSnippetClass, comp, params.symbolRendererParams)); + CodeSnippetSupplier.createOutlineRenderer(params.outlineRendererSnippetID, comp, params.outlineRendererParams)); + comp.setSymbolRenderer(CodeSnippetSupplier.createSymbolRenderer(params.symbolRendererSnippetID, comp, params.symbolRendererParams)); // TODO high level states comp.setSize(params.width, params.height); for (InterfacePinParams iPinParams : params.interfacePins) diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/SubmodelComponentParams.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/SubmodelComponentParams.java index a1f2c823..e2a0e482 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/SubmodelComponentParams.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/SubmodelComponentParams.java @@ -19,10 +19,10 @@ public class SubmodelComponentParams public SubmodelParameters submodel; // functionality that needs to be expressed in Java code - public String outlineRendererSnippetClass; + public String outlineRendererSnippetID; public JsonElement outlineRendererParams; - public String symbolRendererSnippetClass; + public String symbolRendererSnippetID; public JsonElement symbolRendererParams; public static class InterfacePinParams diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/outlinerenderers/DefaultOutlineRendererProvider.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/outlinerenderers/DefaultOutlineRendererProvider.java new file mode 100644 index 00000000..b236aa8c --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/outlinerenderers/DefaultOutlineRendererProvider.java @@ -0,0 +1,26 @@ +package net.mograsim.logic.ui.serializing.snippets.outlinerenderers; + +import com.google.gson.JsonElement; + +import net.mograsim.logic.ui.serializing.DeserializedSubmodelComponent; +import net.mograsim.logic.ui.serializing.snippets.Renderer; +import net.mograsim.logic.ui.serializing.snippets.RendererProvider; +import net.mograsim.preferences.ColorDefinition; +import net.mograsim.preferences.ColorManager; +import net.mograsim.preferences.Preferences; + +public class DefaultOutlineRendererProvider implements RendererProvider +{ + @Override + public Renderer create(DeserializedSubmodelComponent component, JsonElement params) + { + return (gc, visReg) -> + { + ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.ui.color.foreground"); + if (fg != null) + gc.setForeground(ColorManager.current().toColor(fg)); + gc.drawRectangle(component.getBounds()); + }; + + } +} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRendererProvider.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRendererProvider.java new file mode 100644 index 00000000..de1551bd --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRendererProvider.java @@ -0,0 +1,57 @@ +package net.mograsim.logic.ui.serializing.snippets.symbolrenderers; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +import net.haspamelodica.swt.helper.swtobjectwrappers.Font; +import net.haspamelodica.swt.helper.swtobjectwrappers.Point; +import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; +import net.mograsim.logic.ui.serializing.CodeSnippetSupplier; +import net.mograsim.logic.ui.serializing.DeserializedSubmodelComponent; +import net.mograsim.logic.ui.serializing.snippets.Renderer; +import net.mograsim.logic.ui.serializing.snippets.RendererProvider; +import net.mograsim.preferences.ColorDefinition; +import net.mograsim.preferences.ColorManager; +import net.mograsim.preferences.Preferences; + +/** + * Renders a text ("text") with a given font height ("height") in the center of the component.
+ * Parameter format: + * + *
+ * {
+ *   "text": [String]
+ *   "height": [int]
+ * }
+ * 
+ * + * @author Daniel Kirschten + */ +public class CenteredTextSymbolRendererProvider implements RendererProvider +{ + @Override + public Renderer create(DeserializedSubmodelComponent component, JsonElement params) + { + JsonObject asJsonObject = params.getAsJsonObject(); + String text = asJsonObject.getAsJsonPrimitive("text").getAsString(); + int fontHeight = asJsonObject.getAsJsonPrimitive("height").getAsInt(); + return (gc, visReg) -> + { + Font oldFont = gc.getFont(); + gc.setFont(new Font(oldFont.getName(), fontHeight, oldFont.getStyle())); + ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.ui.color.text"); + if (fg != null) + gc.setForeground(ColorManager.current().toColor(fg)); + Point idSize = gc.textExtent(text); + Rectangle bounds = component.getBounds(); + gc.drawText(text, bounds.x + (bounds.width - idSize.x) / 2, bounds.y + (bounds.height - idSize.y) / 2, true); + gc.setFont(oldFont); + }; + } + + static + { + CodeSnippetSupplier.setSymbolRendererProvider(CenteredTextSymbolRendererProvider.class.getCanonicalName(), + new CenteredTextSymbolRendererProvider()); + } +} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/DefaultSymbolRendererProvider.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/DefaultSymbolRendererProvider.java new file mode 100644 index 00000000..4d445d67 --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/DefaultSymbolRendererProvider.java @@ -0,0 +1,31 @@ +package net.mograsim.logic.ui.serializing.snippets.symbolrenderers; + +import com.google.gson.JsonElement; + +import net.haspamelodica.swt.helper.swtobjectwrappers.Point; +import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; +import net.mograsim.logic.ui.serializing.DeserializedSubmodelComponent; +import net.mograsim.logic.ui.serializing.snippets.Renderer; +import net.mograsim.logic.ui.serializing.snippets.RendererProvider; +import net.mograsim.preferences.ColorDefinition; +import net.mograsim.preferences.ColorManager; +import net.mograsim.preferences.Preferences; + +public class DefaultSymbolRendererProvider implements RendererProvider +{ + private static final String id = ""; + + @Override + public Renderer create(DeserializedSubmodelComponent component, JsonElement params) + { + return (gc, visReg) -> + { + ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.ui.color.text"); + if (fg != null) + gc.setForeground(ColorManager.current().toColor(fg)); + Point idSize = gc.textExtent(id); + Rectangle bounds = component.getBounds(); + gc.drawText(id, bounds.x + (bounds.width - idSize.x) / 2, bounds.y + (bounds.height - idSize.y) / 2, true); + }; + } +} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRendererProvider.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRendererProvider.java new file mode 100644 index 00000000..a47c47fc --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRendererProvider.java @@ -0,0 +1,83 @@ +package net.mograsim.logic.ui.serializing.snippets.symbolrenderers; + +import java.util.Map.Entry; + +import org.eclipse.swt.graphics.Color; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + +import net.haspamelodica.swt.helper.swtobjectwrappers.Font; +import net.haspamelodica.swt.helper.swtobjectwrappers.Point; +import net.mograsim.logic.ui.model.wires.Pin; +import net.mograsim.logic.ui.serializing.CodeSnippetSupplier; +import net.mograsim.logic.ui.serializing.DeserializedSubmodelComponent; +import net.mograsim.logic.ui.serializing.snippets.Renderer; +import net.mograsim.logic.ui.serializing.snippets.RendererProvider; +import net.mograsim.preferences.Preferences; + +/** + * Renders a text ("centerText") with a given font height ("centerTextHeight") in the center of the component and + * draws a label for each pin with a given font height ("pinLabelHeight"). The labels of pins to the left of a given x + * coordinate ("horizontalComponentCenter") are drawn to the right of the respective pin; labels of pins to the right are drawn + * left. A margin ("pinLabelMargin") is applied for pin label drawing.
+ * Parameter format: + * + *
+ * {
+ *   "centerText": [String]
+ *   "centerTextHeight": [double]
+ *   "horizontalComponentCenter": [double]
+ *   "pinLabelHeight": [double]
+ *   "pinLabelMargin": [double]
+ * }
+ * 
+ * + * @author Daniel Kirschten + */ +public class SimpleRectangularLikeSymbolRendererProvider implements RendererProvider +{ + @Override + public Renderer create(DeserializedSubmodelComponent component, JsonElement params) + { + JsonObject asJsonObject = params.getAsJsonObject(); + String centerText = asJsonObject.getAsJsonPrimitive("centerText").getAsString(); + double centerTextHeight = asJsonObject.getAsJsonPrimitive("centerTextHeight").getAsDouble(); + double horizontalComponentCenter = asJsonObject.getAsJsonPrimitive("horizontalComponentCenter").getAsDouble(); + double pinLabelHeight = asJsonObject.getAsJsonPrimitive("pinLabelHeight").getAsDouble(); + double pinLabelMargin = asJsonObject.getAsJsonPrimitive("pinLabelMargin").getAsDouble(); + return (gc, visReg) -> + { + double posX = component.getPosX(); + double posY = component.getPosY(); + double width = component.getWidth(); + double height = component.getHeight(); + + Font oldFont = gc.getFont(); + gc.setFont(new Font(oldFont.getName(), centerTextHeight, oldFont.getStyle())); + Point textExtent = gc.textExtent(centerText); + Color textColor = Preferences.current().getColor("net.mograsim.logic.ui.color.text"); + if (textColor != null) + gc.setForeground(textColor); + gc.drawText(centerText, posX + (width - textExtent.x) / 2, posY + (height - textExtent.y) / 2, true); + gc.setFont(new Font(oldFont.getName(), pinLabelHeight, oldFont.getStyle())); + for (Entry pinEntry : component.getPins().entrySet()) + { + String pinName = pinEntry.getKey(); + Pin pin = pinEntry.getValue(); + double pinX = pin.getRelX(); + double pinY = posY + pin.getRelY(); + textExtent = gc.textExtent(pinName); + gc.drawText(pinName, posX + pinX + (pinX > horizontalComponentCenter ? -textExtent.x - pinLabelMargin : pinLabelMargin), + pinY - textExtent.y / 2, true); + } + gc.setFont(oldFont); + }; + } + + static + { + CodeSnippetSupplier.setSymbolRendererProvider(SimpleRectangularLikeSymbolRendererProvider.class.getCanonicalName(), + new SimpleRectangularLikeSymbolRendererProvider()); + } +} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json index 82249515..850d54cd 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json @@ -1,3 +1,5 @@ mograsim version: 0.1.3 { + "CenteredTextSymbolRenderer": "net.mograsim.logic.ui.serializing.snippets.symbolrenderers.CenteredTextSymbolRendererProvider", + "SimpleRectangularLikeSymbolRenderer": "net.mograsim.logic.ui.serializing.snippets.symbolrenderers.SimpleRectangularLikeSymbolRendererProvider" } \ No newline at end of file -- 2.17.1 From 1c8f03ff4ef9514bf2c77fcba94865a59efcbca7 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Thu, 4 Jul 2019 10:30:35 +0200 Subject: [PATCH 10/16] Moved code serializing a symbol renderer to where it belongs --- .../components/GUI_rsLatch.json | 2 +- .../components/GUIand.json | 4 ++-- .../components/GUIand41.json | 4 ++-- .../components/GUIandor414.json | 4 ++-- .../components/GUIdemux2.json | 4 ++-- .../components/GUIdff.json | 4 ++-- .../components/GUIdlatch.json | 4 ++-- .../components/GUIdlatch4.json | 4 ++-- .../components/GUIfulladder.json | 4 ++-- .../components/GUIhalfadder.json | 4 ++-- .../components/GUImux1.json | 4 ++-- .../components/GUImux1_4.json | 4 ++-- .../components/GUInand3.json | 4 ++-- .../components/GUInot4.json | 4 ++-- .../components/GUIor4.json | 4 ++-- .../components/GUIor_4.json | 4 ++-- .../components/GUIram2.json | 4 ++-- .../components/GUIram4.json | 4 ++-- .../components/GUIsel2_4.json | 4 ++-- .../components/GUIsel3_4.json | 4 ++-- .../components/GUIxor.json | 4 ++-- .../components/am2901/GUIAm2901.json | 4 ++-- .../am2901/GUIAm2901ALUFuncDecode.json | 4 ++-- .../am2901/GUIAm2901ALUInclDecode.json | 4 ++-- ...ALUInclSourceDecodeInclFunctionDecode.json | 4 ++-- .../components/am2901/GUIAm2901ALUOneBit.json | 4 ++-- .../am2901/GUIAm2901DestDecode.json | 4 ++-- .../components/am2901/GUIAm2901QReg.json | 4 ++-- .../am2901/GUIAm2901SourceDecode.json | 2 +- .../ui/examples/ComponenetSerializer.java | 11 ---------- .../SimpleRectangularSubmodelComponent.java | 22 +++++++++++++++++++ 31 files changed, 78 insertions(+), 67 deletions(-) diff --git a/net.mograsim.logic.ui.am2900/components/GUI_rsLatch.json b/net.mograsim.logic.ui.am2900/components/GUI_rsLatch.json index 35ebc03d..39ef290c 100644 --- a/net.mograsim.logic.ui.am2900/components/GUI_rsLatch.json +++ b/net.mograsim.logic.ui.am2900/components/GUI_rsLatch.json @@ -211,7 +211,7 @@ mograsim version: 0.1.3 "symbolRendererParams": { "centerText": "_rsLatch", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIand.json b/net.mograsim.logic.ui.am2900/components/GUIand.json index d717447e..9e801e1c 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIand.json +++ b/net.mograsim.logic.ui.am2900/components/GUIand.json @@ -134,9 +134,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "and", + "centerText": "GUIand", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIand41.json b/net.mograsim.logic.ui.am2900/components/GUIand41.json index 2e9d9531..c3157e9f 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIand41.json +++ b/net.mograsim.logic.ui.am2900/components/GUIand41.json @@ -312,9 +312,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "and41", + "centerText": "GUIand41", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIandor414.json b/net.mograsim.logic.ui.am2900/components/GUIandor414.json index 0a9f2645..5021dbaa 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIandor414.json +++ b/net.mograsim.logic.ui.am2900/components/GUIandor414.json @@ -476,9 +476,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "andor414", + "centerText": "GUIandor414", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIdemux2.json b/net.mograsim.logic.ui.am2900/components/GUIdemux2.json index 07bf5ada..13ff9694 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIdemux2.json +++ b/net.mograsim.logic.ui.am2900/components/GUIdemux2.json @@ -488,9 +488,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "demux2", + "centerText": "GUIdemux2", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIdff.json b/net.mograsim.logic.ui.am2900/components/GUIdff.json index 4902e6c8..cc8ed5ee 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIdff.json +++ b/net.mograsim.logic.ui.am2900/components/GUIdff.json @@ -311,9 +311,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "dff", + "centerText": "GUIdff", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIdlatch.json b/net.mograsim.logic.ui.am2900/components/GUIdlatch.json index a5c6b432..4b393472 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIdlatch.json +++ b/net.mograsim.logic.ui.am2900/components/GUIdlatch.json @@ -224,9 +224,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "dlatch", + "centerText": "GUIdlatch", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIdlatch4.json b/net.mograsim.logic.ui.am2900/components/GUIdlatch4.json index 8dddd05f..a1d560c4 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIdlatch4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIdlatch4.json @@ -312,9 +312,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "dlatch4", + "centerText": "GUIdlatch4", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIfulladder.json b/net.mograsim.logic.ui.am2900/components/GUIfulladder.json index 34cc7ea4..aef6aee7 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIfulladder.json +++ b/net.mograsim.logic.ui.am2900/components/GUIfulladder.json @@ -176,9 +176,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "fulladder", + "centerText": "GUIfulladder", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIhalfadder.json b/net.mograsim.logic.ui.am2900/components/GUIhalfadder.json index 36885ac5..948192b3 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIhalfadder.json +++ b/net.mograsim.logic.ui.am2900/components/GUIhalfadder.json @@ -301,9 +301,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "halfadder", + "centerText": "GUIhalfadder", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUImux1.json b/net.mograsim.logic.ui.am2900/components/GUImux1.json index 90e90132..4cc997ce 100644 --- a/net.mograsim.logic.ui.am2900/components/GUImux1.json +++ b/net.mograsim.logic.ui.am2900/components/GUImux1.json @@ -215,9 +215,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "mux1", + "centerText": "GUImux1", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUImux1_4.json b/net.mograsim.logic.ui.am2900/components/GUImux1_4.json index d4f23ba1..b7a8e71f 100644 --- a/net.mograsim.logic.ui.am2900/components/GUImux1_4.json +++ b/net.mograsim.logic.ui.am2900/components/GUImux1_4.json @@ -452,9 +452,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "mux1_4", + "centerText": "GUImux1_4", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUInand3.json b/net.mograsim.logic.ui.am2900/components/GUInand3.json index be950652..559238d7 100644 --- a/net.mograsim.logic.ui.am2900/components/GUInand3.json +++ b/net.mograsim.logic.ui.am2900/components/GUInand3.json @@ -191,9 +191,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "nand3", + "centerText": "GUInand3", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUInot4.json b/net.mograsim.logic.ui.am2900/components/GUInot4.json index ff9a8da3..a6268de7 100644 --- a/net.mograsim.logic.ui.am2900/components/GUInot4.json +++ b/net.mograsim.logic.ui.am2900/components/GUInot4.json @@ -357,9 +357,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "not4", + "centerText": "GUInot4", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIor4.json b/net.mograsim.logic.ui.am2900/components/GUIor4.json index 92e54aa4..54933c40 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIor4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIor4.json @@ -501,9 +501,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "or4", + "centerText": "GUIor4", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIor_4.json b/net.mograsim.logic.ui.am2900/components/GUIor_4.json index 53ad0d69..7db8660f 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIor_4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIor_4.json @@ -817,9 +817,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "or_4", + "centerText": "GUIor_4", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIram2.json b/net.mograsim.logic.ui.am2900/components/GUIram2.json index dd051675..f748b0b0 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIram2.json +++ b/net.mograsim.logic.ui.am2900/components/GUIram2.json @@ -2773,9 +2773,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "ram2", + "centerText": "GUIram2", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIram4.json b/net.mograsim.logic.ui.am2900/components/GUIram4.json index 16f912e2..976f09cc 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIram4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIram4.json @@ -3145,9 +3145,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "ram4", + "centerText": "GUIram4", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIsel2_4.json b/net.mograsim.logic.ui.am2900/components/GUIsel2_4.json index 6fa6d3af..9f7babea 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIsel2_4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIsel2_4.json @@ -785,9 +785,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "sel2_4", + "centerText": "GUIsel2_4", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIsel3_4.json b/net.mograsim.logic.ui.am2900/components/GUIsel3_4.json index e5b5d461..f999b22f 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIsel3_4.json +++ b/net.mograsim.logic.ui.am2900/components/GUIsel3_4.json @@ -856,9 +856,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "sel3_4", + "centerText": "GUIsel3_4", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/GUIxor.json b/net.mograsim.logic.ui.am2900/components/GUIxor.json index 001f5542..8f589d5a 100644 --- a/net.mograsim.logic.ui.am2900/components/GUIxor.json +++ b/net.mograsim.logic.ui.am2900/components/GUIxor.json @@ -251,9 +251,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "xor", + "centerText": "GUIxor", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901.json index 9fc9e8d4..af066819 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901.json @@ -3182,9 +3182,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "Am2901", + "centerText": "GUIAm2901", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUFuncDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUFuncDecode.json index b30dcdd2..dfa954ab 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUFuncDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUFuncDecode.json @@ -654,9 +654,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "Am2901ALUFuncDecode", + "centerText": "GUIAm2901ALUFuncDecode", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclDecode.json index 39aac796..9d6395c6 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclDecode.json @@ -1418,9 +1418,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "Am2901ALUInclDecode", + "centerText": "GUIAm2901ALUInclDecode", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json index 6c9e6d35..fb6e9112 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json @@ -1296,9 +1296,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "Am2901ALUInclSourceDecodeInclFunctionDecode", + "centerText": "GUIAm2901ALUInclSourceDecodeInclFunctionDecode", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUOneBit.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUOneBit.json index 5c6215db..ac53c55c 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUOneBit.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901ALUOneBit.json @@ -502,9 +502,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "Am2901ALUOneBit", + "centerText": "GUIAm2901ALUOneBit", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901DestDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901DestDecode.json index 621fccd3..613b9b93 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901DestDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901DestDecode.json @@ -997,9 +997,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "Am2901DestDecode", + "centerText": "GUIAm2901DestDecode", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901QReg.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901QReg.json index 6bc113d5..71889721 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901QReg.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901QReg.json @@ -391,9 +391,9 @@ mograsim version: 0.1.3 }, "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer", "symbolRendererParams": { - "centerText": "Am2901QReg", + "centerText": "GUIAm2901QReg", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901SourceDecode.json b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901SourceDecode.json index 33b3ff10..75b5f703 100644 --- a/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901SourceDecode.json +++ b/net.mograsim.logic.ui.am2900/components/am2901/GUIAm2901SourceDecode.json @@ -1038,7 +1038,7 @@ mograsim version: 0.1.3 "symbolRendererParams": { "centerText": "Am2901SourceDecode", "horizontalComponentCenter": 17.5, - "centerTextHeight": 5, + "centerTextHeight": 5.0, "pinLabelHeight": 3.5, "pinLabelMargin": 0.5 } diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java index 397592e1..4c7b5d9f 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/ComponenetSerializer.java @@ -3,8 +3,6 @@ package net.mograsim.logic.ui.examples; import java.io.IOException; import java.util.function.Function; -import com.google.gson.JsonObject; - import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUIComponent; import net.mograsim.logic.ui.model.components.mi.nandbased.GUI_rsLatch; @@ -59,15 +57,6 @@ public class ComponenetSerializer for (SubmodelComponent comp : components) { SubmodelComponentParams params = comp.calculateParams(getIdentifier); - JsonObject symbolRendererParams = new JsonObject(); - symbolRendererParams.addProperty("centerText", comp.getClass().getSimpleName().substring(3)); // cut away the "GUI" part - symbolRendererParams.addProperty("horizontalComponentCenter", comp.getWidth() / 2); - // use the defaults from SimpleRectangularSubmodelComponent - symbolRendererParams.addProperty("centerTextHeight", 5); - symbolRendererParams.addProperty("pinLabelHeight", 3.5); - symbolRendererParams.addProperty("pinLabelMargin", .5); - params.symbolRendererSnippetID = "SimpleRectangularLikeSymbolRenderer"; - params.symbolRendererParams = symbolRendererParams; JsonHandler.writeJson(params, "components/" + comp.getClass().getName().substring("net.mograsim.logic.ui.model.components.mi.nandbased.".length()).replace('.', '/') + ".json"); diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/submodels/SimpleRectangularSubmodelComponent.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/submodels/SimpleRectangularSubmodelComponent.java index 2bc062e9..529767e7 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/submodels/SimpleRectangularSubmodelComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/submodels/SimpleRectangularSubmodelComponent.java @@ -5,16 +5,21 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.function.Function; import org.eclipse.swt.graphics.Color; +import com.google.gson.JsonObject; + import net.haspamelodica.swt.helper.gcs.GeneralGC; import net.haspamelodica.swt.helper.swtobjectwrappers.Font; import net.haspamelodica.swt.helper.swtobjectwrappers.Point; import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; import net.mograsim.logic.ui.model.ViewModelModifiable; +import net.mograsim.logic.ui.model.components.GUIComponent; import net.mograsim.logic.ui.model.wires.MovablePin; import net.mograsim.logic.ui.model.wires.Pin; +import net.mograsim.logic.ui.serializing.SubmodelComponentParams; import net.mograsim.preferences.Preferences; public class SimpleRectangularSubmodelComponent extends SubmodelComponent @@ -127,6 +132,23 @@ public class SimpleRectangularSubmodelComponent extends SubmodelComponent gc.drawRectangle(getBounds()); } + // serializing + + @Override + public SubmodelComponentParams calculateParams(Function getIdentifier) + { + SubmodelComponentParams params = super.calculateParams(getIdentifier); + JsonObject symbolRendererParams = new JsonObject(); + symbolRendererParams.addProperty("centerText", label); + symbolRendererParams.addProperty("horizontalComponentCenter", getWidth() / 2); + symbolRendererParams.addProperty("centerTextHeight", labelFontHeight); + symbolRendererParams.addProperty("pinLabelHeight", pinNameFontHeight); + symbolRendererParams.addProperty("pinLabelMargin", pinNameMargin); + params.symbolRendererSnippetID = "SimpleRectangularLikeSymbolRenderer"; + params.symbolRendererParams = symbolRendererParams; + return params; + } + @Override protected Pin addSubmodelInterface(MovablePin supermodelPin) { -- 2.17.1 From 8aed1683d23801b354dd521ad5afe56fccc8f4f9 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Thu, 4 Jul 2019 10:31:00 +0200 Subject: [PATCH 11/16] Updated MANIFEST.MF --- net.mograsim.logic.ui/META-INF/MANIFEST.MF | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net.mograsim.logic.ui/META-INF/MANIFEST.MF b/net.mograsim.logic.ui/META-INF/MANIFEST.MF index 2c3c9299..b8c297a9 100644 --- a/net.mograsim.logic.ui/META-INF/MANIFEST.MF +++ b/net.mograsim.logic.ui/META-INF/MANIFEST.MF @@ -14,6 +14,8 @@ Export-Package: net.mograsim.logic.ui, net.mograsim.logic.ui.modeladapter.componentadapters, net.mograsim.logic.ui.serializing, net.mograsim.logic.ui.serializing.snippets, + net.mograsim.logic.ui.serializing.snippets.outlinerenderers, + net.mograsim.logic.ui.serializing.snippets.symbolrenderers, net.mograsim.logic.ui.util Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.swt;bundle-version="3.0.0";visibility:=reexport, -- 2.17.1 From dbda073d92ae9dd8e701d904c4c71dd0edd1fce7 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Thu, 4 Jul 2019 10:50:11 +0200 Subject: [PATCH 12/16] Made CodeSnippetSupplier generic --- .../ui/serializing/CodeSnippetSupplier.java | 103 +++++++++--------- .../SubmodelComponentDeserializer.java | 7 +- .../CenteredTextSymbolRendererProvider.java | 2 +- ...RectangularLikeSymbolRendererProvider.java | 4 +- .../serializing/standardSnippetIDMapping.json | 7 +- 5 files changed, 64 insertions(+), 59 deletions(-) diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java index 8c13e96a..453e2ac3 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java @@ -5,89 +5,89 @@ import java.io.InputStream; import java.util.HashMap; import java.util.Map; -import com.google.gson.JsonElement; - -import net.mograsim.logic.ui.serializing.snippets.Renderer; import net.mograsim.logic.ui.serializing.snippets.RendererProvider; import net.mograsim.logic.ui.serializing.snippets.outlinerenderers.DefaultOutlineRendererProvider; import net.mograsim.logic.ui.serializing.snippets.symbolrenderers.DefaultSymbolRendererProvider; import net.mograsim.logic.ui.util.JsonHandler; -public class CodeSnippetSupplier +public class CodeSnippetSupplier { - private static final Map standardSnippetIDClassNames = new HashMap<>(); - - private static final Map outlineRendererProvidersForComponentClassNames = new HashMap<>(); - private static final Map symbolRendererProvidersForComponentClassNames = new HashMap<>(); + // public static members + public static final CodeSnippetSupplier symbolRendererProviderSupplier; + public static final CodeSnippetSupplier outlineRendererProviderSupplier; - private static final RendererProvider defaultOutlineRendererProvider; - private static final RendererProvider defaultSymbolRendererProvider; static { - defaultOutlineRendererProvider = new DefaultOutlineRendererProvider(); - defaultSymbolRendererProvider = new DefaultSymbolRendererProvider(); - } - - static - { - try (InputStream s = IndirectGUIComponentCreator.class.getResourceAsStream("./standardSnippetIDMapping.json")) - { - if (s == null) - throw new IOException("Resource not found"); - Map tmp = JsonHandler.readJson(s, Map.class); - standardSnippetIDClassNames.putAll(tmp); - } - catch (IOException e) - { - System.err.println("Failed to initialize standard snippet ID mapping: " + e.getMessage()); - } + symbolRendererProviderSupplier = new CodeSnippetSupplier<>(new DefaultSymbolRendererProvider()); + outlineRendererProviderSupplier = new CodeSnippetSupplier<>(new DefaultOutlineRendererProvider()); } - public static void addStandardSnippetID(String standardSnippetID, String associatedSnippetClassName) - { - standardSnippetIDClassNames.put(standardSnippetID, associatedSnippetClassName); - } + // per-instance members - public static void setOutlineRendererProvider(String id, RendererProvider outlineRendererProvider) - { - outlineRendererProvidersForComponentClassNames.put(id, outlineRendererProvider); - } + private final Map standardSnippetIDClassNames = new HashMap<>(); + private final Map snippetProvidersForClassNames = new HashMap<>(); + private final S defaultSnippetProvider; - public static void setSymbolRendererProvider(String id, RendererProvider symbolRendererProvider) + private CodeSnippetSupplier(S defaultSnippetProvider) { - symbolRendererProvidersForComponentClassNames.put(id, symbolRendererProvider); + this.defaultSnippetProvider = defaultSnippetProvider; } - public static Renderer createOutlineRenderer(String id, DeserializedSubmodelComponent component, JsonElement params) + public void addStandardSnippetID(String standardSnippetID, String associatedSnippetClassName) { - return getSnippet(id, outlineRendererProvidersForComponentClassNames, defaultOutlineRendererProvider).create(component, params); + standardSnippetIDClassNames.put(standardSnippetID, associatedSnippetClassName); } - public static Renderer createSymbolRenderer(String id, DeserializedSubmodelComponent component, JsonElement params) + public void setSnippetProvider(String id, S snippetProvider) { - return getSnippet(id, symbolRendererProvidersForComponentClassNames, defaultSymbolRendererProvider).create(component, params); + snippetProvidersForClassNames.put(id, snippetProvider); } // TODO report errors - private static C getSnippet(String id, Map specializedCodeMap, C defaultSnippet) + public S getSnippetProvider(String id) { if (id != null) { - String snippetClassName; + String snippetProviderClassName; if (id.startsWith("class:")) - snippetClassName = id.substring(6); + snippetProviderClassName = id.substring(6); else - snippetClassName = standardSnippetIDClassNames.get(id); - if (snippetClassName != null) + snippetProviderClassName = standardSnippetIDClassNames.get(id); + if (snippetProviderClassName != null) { - tryLoadSnippetClass(snippetClassName); - C specializedCode = specializedCodeMap.get(snippetClassName); - if (specializedCode != null) - return specializedCode; + tryLoadSnippetClass(snippetProviderClassName); + S snippetProvider = snippetProvidersForClassNames.get(snippetProviderClassName); + if (snippetProvider != null) + return snippetProvider; } } System.err.println("Couldn't load snippet " + id + "; using default"); - return defaultSnippet; + return defaultSnippetProvider; + } + + // static helpers + + static + { + try (InputStream s = IndirectGUIComponentCreator.class.getResourceAsStream("./standardSnippetIDMapping.json")) + { + if (s == null) + throw new IOException("Resource not found"); + SnippetIDClassNames tmp = JsonHandler.readJson(s, SnippetIDClassNames.class); + tmp.standardOutlineRendererProviders.forEach(outlineRendererProviderSupplier::addStandardSnippetID); + tmp.standardSymbolRendererProviders.forEach(symbolRendererProviderSupplier::addStandardSnippetID); + } + catch (Exception e) + { + System.err.println("Failed to initialize standard snippet ID mapping: "); + e.printStackTrace(); + } + } + + private static class SnippetIDClassNames + { + public Map standardOutlineRendererProviders; + public Map standardSymbolRendererProviders; } private static void tryLoadSnippetClass(String snippetClassName) @@ -106,4 +106,5 @@ public class CodeSnippetSupplier System.err.printf(errorMessageFormat, className, "ClassNotFoundException thrown: " + e.getMessage()); } } + } \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/SubmodelComponentDeserializer.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/SubmodelComponentDeserializer.java index e997ad28..20961a7d 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/SubmodelComponentDeserializer.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/SubmodelComponentDeserializer.java @@ -61,9 +61,10 @@ public final class SubmodelComponentDeserializer { DeserializedSubmodelComponent comp = new DeserializedSubmodelComponent(model); comp.setSubmodelScale(params.submodel.innerScale); - comp.setOutlineRenderer( - CodeSnippetSupplier.createOutlineRenderer(params.outlineRendererSnippetID, comp, params.outlineRendererParams)); - comp.setSymbolRenderer(CodeSnippetSupplier.createSymbolRenderer(params.symbolRendererSnippetID, comp, params.symbolRendererParams)); + comp.setOutlineRenderer(CodeSnippetSupplier.outlineRendererProviderSupplier.getSnippetProvider(params.outlineRendererSnippetID) + .create(comp, params.outlineRendererParams)); + comp.setSymbolRenderer(CodeSnippetSupplier.symbolRendererProviderSupplier.getSnippetProvider(params.symbolRendererSnippetID) + .create(comp, params.symbolRendererParams)); // TODO high level states comp.setSize(params.width, params.height); for (InterfacePinParams iPinParams : params.interfacePins) diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRendererProvider.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRendererProvider.java index de1551bd..98e6c439 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRendererProvider.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRendererProvider.java @@ -51,7 +51,7 @@ public class CenteredTextSymbolRendererProvider implements RendererProvider static { - CodeSnippetSupplier.setSymbolRendererProvider(CenteredTextSymbolRendererProvider.class.getCanonicalName(), + CodeSnippetSupplier.symbolRendererProviderSupplier.setSnippetProvider(CenteredTextSymbolRendererProvider.class.getCanonicalName(), new CenteredTextSymbolRendererProvider()); } } \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRendererProvider.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRendererProvider.java index a47c47fc..c7a8fa1e 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRendererProvider.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRendererProvider.java @@ -77,7 +77,7 @@ public class SimpleRectangularLikeSymbolRendererProvider implements RendererProv static { - CodeSnippetSupplier.setSymbolRendererProvider(SimpleRectangularLikeSymbolRendererProvider.class.getCanonicalName(), - new SimpleRectangularLikeSymbolRendererProvider()); + CodeSnippetSupplier.symbolRendererProviderSupplier.setSnippetProvider( + SimpleRectangularLikeSymbolRendererProvider.class.getCanonicalName(), new SimpleRectangularLikeSymbolRendererProvider()); } } \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json index 850d54cd..30976a09 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json @@ -1,5 +1,8 @@ mograsim version: 0.1.3 { - "CenteredTextSymbolRenderer": "net.mograsim.logic.ui.serializing.snippets.symbolrenderers.CenteredTextSymbolRendererProvider", - "SimpleRectangularLikeSymbolRenderer": "net.mograsim.logic.ui.serializing.snippets.symbolrenderers.SimpleRectangularLikeSymbolRendererProvider" + "standardOutlineRendererProviders": {}, + "standardSymbolRendererProviders": { + "CenteredTextSymbolRenderer": "net.mograsim.logic.ui.serializing.snippets.symbolrenderers.CenteredTextSymbolRendererProvider", + "SimpleRectangularLikeSymbolRenderer": "net.mograsim.logic.ui.serializing.snippets.symbolrenderers.SimpleRectangularLikeSymbolRendererProvider" + } } \ No newline at end of file -- 2.17.1 From f594aef8abc8f444911333f6c32ef0fca18e18ba Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Thu, 4 Jul 2019 16:12:43 +0200 Subject: [PATCH 13/16] Made Renderers usable without JSON --- .../SimpleRectangularSubmodelComponent.java | 39 ++++----- .../ui/serializing/CodeSnippetSupplier.java | 27 +++--- .../ui/serializing/snippets/Renderer.java | 2 +- .../snippets/RendererProvider.java | 10 --- .../serializing/snippets/SnippetSupplier.java | 38 +++++++++ .../DefaultOutlineRenderer.java | 37 +++++++++ .../DefaultOutlineRendererProvider.java | 26 ------ .../CenteredTextSymbolRenderer.java | 58 +++++++++++++ .../CenteredTextSymbolRendererProvider.java | 57 ------------- .../DefaultSymbolRenderer.java | 42 ++++++++++ .../DefaultSymbolRendererProvider.java | 31 ------- .../SimpleRectangularLikeSymbolRenderer.java | 82 ++++++++++++++++++ ...RectangularLikeSymbolRendererProvider.java | 83 ------------------- .../serializing/standardSnippetIDMapping.json | 4 +- 14 files changed, 288 insertions(+), 248 deletions(-) delete mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/RendererProvider.java create mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/SnippetSupplier.java create mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/outlinerenderers/DefaultOutlineRenderer.java delete mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/outlinerenderers/DefaultOutlineRendererProvider.java create mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRenderer.java delete mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRendererProvider.java create mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/DefaultSymbolRenderer.java delete mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/DefaultSymbolRendererProvider.java create mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRenderer.java delete mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRendererProvider.java diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/submodels/SimpleRectangularSubmodelComponent.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/submodels/SimpleRectangularSubmodelComponent.java index 529767e7..d7ac643d 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/submodels/SimpleRectangularSubmodelComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/submodels/SimpleRectangularSubmodelComponent.java @@ -12,14 +12,15 @@ import org.eclipse.swt.graphics.Color; import com.google.gson.JsonObject; import net.haspamelodica.swt.helper.gcs.GeneralGC; -import net.haspamelodica.swt.helper.swtobjectwrappers.Font; -import net.haspamelodica.swt.helper.swtobjectwrappers.Point; import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUIComponent; import net.mograsim.logic.ui.model.wires.MovablePin; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.serializing.SubmodelComponentParams; +import net.mograsim.logic.ui.serializing.snippets.Renderer; +import net.mograsim.logic.ui.serializing.snippets.symbolrenderers.SimpleRectangularLikeSymbolRenderer; +import net.mograsim.logic.ui.serializing.snippets.symbolrenderers.SimpleRectangularLikeSymbolRenderer.SimpleRectangularLikeParams; import net.mograsim.preferences.Preferences; public class SimpleRectangularSubmodelComponent extends SubmodelComponent @@ -38,6 +39,8 @@ public class SimpleRectangularSubmodelComponent extends SubmodelComponent private final List outputPinNames; private final List outputPinNamesUnmodifiable; + private Renderer symbolRenderer; + public SimpleRectangularSubmodelComponent(ViewModelModifiable model, int logicWidth, String label) { super(model); @@ -47,6 +50,14 @@ public class SimpleRectangularSubmodelComponent extends SubmodelComponent this.inputPinNamesUnmodifiable = Collections.unmodifiableList(inputPinNames); this.outputPinNames = new ArrayList<>(); this.outputPinNamesUnmodifiable = Collections.unmodifiableList(outputPinNames); + + SimpleRectangularLikeParams rendererParams = new SimpleRectangularLikeParams(); + rendererParams.centerText = label; + rendererParams.centerTextHeight = labelFontHeight; + rendererParams.horizontalComponentCenter = getWidth() / 2; + rendererParams.pinLabelHeight = pinNameFontHeight; + rendererParams.pinLabelMargin = pinNameMargin; + symbolRenderer = new SimpleRectangularLikeSymbolRenderer(this, rendererParams); } protected void setInputPins(String... pinNames) @@ -98,29 +109,7 @@ public class SimpleRectangularSubmodelComponent extends SubmodelComponent @Override protected void renderSymbol(GeneralGC gc, Rectangle visibleRegion) { - // TODO code duplication: see SimpleRectagularLikeSymbolRendererProvider - Font oldFont = gc.getFont(); - gc.setFont(new Font(oldFont.getName(), labelFontHeight, oldFont.getStyle())); - Point textExtent = gc.textExtent(label); - Color textColor = Preferences.current().getColor("net.mograsim.logic.ui.color.text"); - if (textColor != null) - gc.setForeground(textColor); - gc.drawText(label, getPosX() + (getWidth() - textExtent.x) / 2, getPosY() + (getHeight() - textExtent.y) / 2, true); - gc.setFont(new Font(oldFont.getName(), pinNameFontHeight, oldFont.getStyle())); - for (int i = 0; i < inputPinNames.size(); i++) - { - String pinName = inputPinNames.get(i); - textExtent = gc.textExtent(pinName); - gc.drawText(pinName, getPosX() + pinNameMargin, getPosY() + i * pinDistance + (pinDistance - textExtent.y) / 2, true); - } - for (int i = 0; i < outputPinNames.size(); i++) - { - String pinName = outputPinNames.get(i); - textExtent = gc.textExtent(pinName); - gc.drawText(pinName, getPosX() + width - textExtent.x - pinNameMargin, - getPosY() + i * pinDistance + (pinDistance - textExtent.y) / 2, true); - } - gc.setFont(oldFont); + symbolRenderer.render(gc, visibleRegion); } @Override diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java index 453e2ac3..d6bdbb45 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/CodeSnippetSupplier.java @@ -5,30 +5,31 @@ import java.io.InputStream; import java.util.HashMap; import java.util.Map; -import net.mograsim.logic.ui.serializing.snippets.RendererProvider; -import net.mograsim.logic.ui.serializing.snippets.outlinerenderers.DefaultOutlineRendererProvider; -import net.mograsim.logic.ui.serializing.snippets.symbolrenderers.DefaultSymbolRendererProvider; +import net.mograsim.logic.ui.serializing.snippets.Renderer; +import net.mograsim.logic.ui.serializing.snippets.SnippetSupplier; +import net.mograsim.logic.ui.serializing.snippets.outlinerenderers.DefaultOutlineRenderer; +import net.mograsim.logic.ui.serializing.snippets.symbolrenderers.DefaultSymbolRenderer; import net.mograsim.logic.ui.util.JsonHandler; public class CodeSnippetSupplier { // public static members - public static final CodeSnippetSupplier symbolRendererProviderSupplier; - public static final CodeSnippetSupplier outlineRendererProviderSupplier; + public static final CodeSnippetSupplier symbolRendererProviderSupplier; + public static final CodeSnippetSupplier outlineRendererProviderSupplier; static { - symbolRendererProviderSupplier = new CodeSnippetSupplier<>(new DefaultSymbolRendererProvider()); - outlineRendererProviderSupplier = new CodeSnippetSupplier<>(new DefaultOutlineRendererProvider()); + symbolRendererProviderSupplier = new CodeSnippetSupplier<>(SnippetSupplier.create(Void.class, DefaultSymbolRenderer::new)); + outlineRendererProviderSupplier = new CodeSnippetSupplier<>(SnippetSupplier.create(Void.class, DefaultOutlineRenderer::new)); } // per-instance members private final Map standardSnippetIDClassNames = new HashMap<>(); - private final Map snippetProvidersForClassNames = new HashMap<>(); - private final S defaultSnippetProvider; + private final Map> snippetProvidersForClassNames = new HashMap<>(); + private final SnippetSupplier defaultSnippetProvider; - private CodeSnippetSupplier(S defaultSnippetProvider) + private CodeSnippetSupplier(SnippetSupplier defaultSnippetProvider) { this.defaultSnippetProvider = defaultSnippetProvider; } @@ -38,13 +39,13 @@ public class CodeSnippetSupplier standardSnippetIDClassNames.put(standardSnippetID, associatedSnippetClassName); } - public void setSnippetProvider(String id, S snippetProvider) + public void setSnippetProvider(String id, SnippetSupplier snippetProvider) { snippetProvidersForClassNames.put(id, snippetProvider); } // TODO report errors - public S getSnippetProvider(String id) + public SnippetSupplier getSnippetProvider(String id) { if (id != null) { @@ -56,7 +57,7 @@ public class CodeSnippetSupplier if (snippetProviderClassName != null) { tryLoadSnippetClass(snippetProviderClassName); - S snippetProvider = snippetProvidersForClassNames.get(snippetProviderClassName); + SnippetSupplier snippetProvider = snippetProvidersForClassNames.get(snippetProviderClassName); if (snippetProvider != null) return snippetProvider; } diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/Renderer.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/Renderer.java index 82e24928..bc0f3939 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/Renderer.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/Renderer.java @@ -5,5 +5,5 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; public interface Renderer { - public void render(GeneralGC t, Rectangle u); + public void render(GeneralGC gc, Rectangle visibleRegion); } \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/RendererProvider.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/RendererProvider.java deleted file mode 100644 index a178e710..00000000 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/RendererProvider.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.mograsim.logic.ui.serializing.snippets; - -import com.google.gson.JsonElement; - -import net.mograsim.logic.ui.serializing.DeserializedSubmodelComponent; - -public interface RendererProvider -{ - public Renderer create(DeserializedSubmodelComponent component, JsonElement params); -} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/SnippetSupplier.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/SnippetSupplier.java new file mode 100644 index 00000000..3adb9e8d --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/SnippetSupplier.java @@ -0,0 +1,38 @@ +package net.mograsim.logic.ui.serializing.snippets; + +import java.util.function.BiFunction; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; + +import net.mograsim.logic.ui.model.components.submodels.SubmodelComponent; + +public interface SnippetSupplier +{ + public Class

getParamClass(); + + public S create(SubmodelComponent component, P params); + + public default S create(SubmodelComponent component, JsonElement params) + { + return create(component, new Gson().fromJson(params, getParamClass())); + } + + public static SnippetSupplier create(Class

paramClass, BiFunction supplier) + { + return new SnippetSupplier<>() + { + @Override + public Class

getParamClass() + { + return paramClass; + } + + @Override + public S create(SubmodelComponent component, P params) + { + return supplier.apply(component, params); + } + }; + } +} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/outlinerenderers/DefaultOutlineRenderer.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/outlinerenderers/DefaultOutlineRenderer.java new file mode 100644 index 00000000..8fe41c65 --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/outlinerenderers/DefaultOutlineRenderer.java @@ -0,0 +1,37 @@ +package net.mograsim.logic.ui.serializing.snippets.outlinerenderers; + +import net.haspamelodica.swt.helper.gcs.GeneralGC; +import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; +import net.mograsim.logic.ui.model.components.GUIComponent; +import net.mograsim.logic.ui.model.components.submodels.SubmodelComponent; +import net.mograsim.logic.ui.serializing.CodeSnippetSupplier; +import net.mograsim.logic.ui.serializing.snippets.Renderer; +import net.mograsim.logic.ui.serializing.snippets.SnippetSupplier; +import net.mograsim.preferences.ColorDefinition; +import net.mograsim.preferences.ColorManager; +import net.mograsim.preferences.Preferences; + +public class DefaultOutlineRenderer implements Renderer +{ + private final GUIComponent component; + + public DefaultOutlineRenderer(SubmodelComponent component, @SuppressWarnings("unused") Void params) + { + this.component = component; + } + + @Override + public void render(GeneralGC gc, Rectangle visibleRegion) + { + ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.ui.color.foreground"); + if (fg != null) + gc.setForeground(ColorManager.current().toColor(fg)); + gc.drawRectangle(component.getBounds()); + } + + static + { + CodeSnippetSupplier.outlineRendererProviderSupplier.setSnippetProvider(DefaultOutlineRenderer.class.getCanonicalName(), + SnippetSupplier.create(Void.class, DefaultOutlineRenderer::new)); + } +} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/outlinerenderers/DefaultOutlineRendererProvider.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/outlinerenderers/DefaultOutlineRendererProvider.java deleted file mode 100644 index b236aa8c..00000000 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/outlinerenderers/DefaultOutlineRendererProvider.java +++ /dev/null @@ -1,26 +0,0 @@ -package net.mograsim.logic.ui.serializing.snippets.outlinerenderers; - -import com.google.gson.JsonElement; - -import net.mograsim.logic.ui.serializing.DeserializedSubmodelComponent; -import net.mograsim.logic.ui.serializing.snippets.Renderer; -import net.mograsim.logic.ui.serializing.snippets.RendererProvider; -import net.mograsim.preferences.ColorDefinition; -import net.mograsim.preferences.ColorManager; -import net.mograsim.preferences.Preferences; - -public class DefaultOutlineRendererProvider implements RendererProvider -{ - @Override - public Renderer create(DeserializedSubmodelComponent component, JsonElement params) - { - return (gc, visReg) -> - { - ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.ui.color.foreground"); - if (fg != null) - gc.setForeground(ColorManager.current().toColor(fg)); - gc.drawRectangle(component.getBounds()); - }; - - } -} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRenderer.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRenderer.java new file mode 100644 index 00000000..2309f148 --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRenderer.java @@ -0,0 +1,58 @@ +package net.mograsim.logic.ui.serializing.snippets.symbolrenderers; + +import net.haspamelodica.swt.helper.gcs.GeneralGC; +import net.haspamelodica.swt.helper.swtobjectwrappers.Font; +import net.haspamelodica.swt.helper.swtobjectwrappers.Point; +import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; +import net.mograsim.logic.ui.model.components.GUIComponent; +import net.mograsim.logic.ui.model.components.submodels.SubmodelComponent; +import net.mograsim.logic.ui.serializing.CodeSnippetSupplier; +import net.mograsim.logic.ui.serializing.snippets.Renderer; +import net.mograsim.logic.ui.serializing.snippets.SnippetSupplier; +import net.mograsim.preferences.ColorDefinition; +import net.mograsim.preferences.ColorManager; +import net.mograsim.preferences.Preferences; + +/** + * Renders a text ("text") with a given font height ("height") in the center of the component. + * + * @author Daniel Kirschten + */ +public class CenteredTextSymbolRenderer implements Renderer +{ + private final GUIComponent component; + private final CenteredTextParams params; + + public CenteredTextSymbolRenderer(SubmodelComponent component, CenteredTextParams params) + { + this.component = component; + this.params = params; + + } + + @Override + public void render(GeneralGC gc, Rectangle visibleRegion) + { + Font oldFont = gc.getFont(); + gc.setFont(new Font(oldFont.getName(), params.fontHeight, oldFont.getStyle())); + ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.ui.color.text"); + if (fg != null) + gc.setForeground(ColorManager.current().toColor(fg)); + Point idSize = gc.textExtent(params.text); + Rectangle bounds = component.getBounds(); + gc.drawText(params.text, bounds.x + (bounds.width - idSize.x) / 2, bounds.y + (bounds.height - idSize.y) / 2, true); + gc.setFont(oldFont); + } + + public static class CenteredTextParams + { + public String text; + public double fontHeight; + } + + static + { + CodeSnippetSupplier.symbolRendererProviderSupplier.setSnippetProvider(CenteredTextSymbolRenderer.class.getCanonicalName(), + SnippetSupplier.create(CenteredTextParams.class, CenteredTextSymbolRenderer::new)); + } +} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRendererProvider.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRendererProvider.java deleted file mode 100644 index 98e6c439..00000000 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/CenteredTextSymbolRendererProvider.java +++ /dev/null @@ -1,57 +0,0 @@ -package net.mograsim.logic.ui.serializing.snippets.symbolrenderers; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; - -import net.haspamelodica.swt.helper.swtobjectwrappers.Font; -import net.haspamelodica.swt.helper.swtobjectwrappers.Point; -import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; -import net.mograsim.logic.ui.serializing.CodeSnippetSupplier; -import net.mograsim.logic.ui.serializing.DeserializedSubmodelComponent; -import net.mograsim.logic.ui.serializing.snippets.Renderer; -import net.mograsim.logic.ui.serializing.snippets.RendererProvider; -import net.mograsim.preferences.ColorDefinition; -import net.mograsim.preferences.ColorManager; -import net.mograsim.preferences.Preferences; - -/** - * Renders a text ("text") with a given font height ("height") in the center of the component.
- * Parameter format: - * - *

- * {
- *   "text": [String]
- *   "height": [int]
- * }
- * 
- * - * @author Daniel Kirschten - */ -public class CenteredTextSymbolRendererProvider implements RendererProvider -{ - @Override - public Renderer create(DeserializedSubmodelComponent component, JsonElement params) - { - JsonObject asJsonObject = params.getAsJsonObject(); - String text = asJsonObject.getAsJsonPrimitive("text").getAsString(); - int fontHeight = asJsonObject.getAsJsonPrimitive("height").getAsInt(); - return (gc, visReg) -> - { - Font oldFont = gc.getFont(); - gc.setFont(new Font(oldFont.getName(), fontHeight, oldFont.getStyle())); - ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.ui.color.text"); - if (fg != null) - gc.setForeground(ColorManager.current().toColor(fg)); - Point idSize = gc.textExtent(text); - Rectangle bounds = component.getBounds(); - gc.drawText(text, bounds.x + (bounds.width - idSize.x) / 2, bounds.y + (bounds.height - idSize.y) / 2, true); - gc.setFont(oldFont); - }; - } - - static - { - CodeSnippetSupplier.symbolRendererProviderSupplier.setSnippetProvider(CenteredTextSymbolRendererProvider.class.getCanonicalName(), - new CenteredTextSymbolRendererProvider()); - } -} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/DefaultSymbolRenderer.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/DefaultSymbolRenderer.java new file mode 100644 index 00000000..4600531f --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/DefaultSymbolRenderer.java @@ -0,0 +1,42 @@ +package net.mograsim.logic.ui.serializing.snippets.symbolrenderers; + +import net.haspamelodica.swt.helper.gcs.GeneralGC; +import net.haspamelodica.swt.helper.swtobjectwrappers.Point; +import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; +import net.mograsim.logic.ui.model.components.GUIComponent; +import net.mograsim.logic.ui.model.components.submodels.SubmodelComponent; +import net.mograsim.logic.ui.serializing.CodeSnippetSupplier; +import net.mograsim.logic.ui.serializing.snippets.Renderer; +import net.mograsim.logic.ui.serializing.snippets.SnippetSupplier; +import net.mograsim.preferences.ColorDefinition; +import net.mograsim.preferences.ColorManager; +import net.mograsim.preferences.Preferences; + +public class DefaultSymbolRenderer implements Renderer +{ + private static final String id = ""; + + private final GUIComponent component; + + public DefaultSymbolRenderer(SubmodelComponent component, @SuppressWarnings("unused") Void params) + { + this.component = component; + } + + @Override + public void render(GeneralGC gc, Rectangle visibleRegion) + { + ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.ui.color.text"); + if (fg != null) + gc.setForeground(ColorManager.current().toColor(fg)); + Point idSize = gc.textExtent(id); + Rectangle bounds = component.getBounds(); + gc.drawText(id, bounds.x + (bounds.width - idSize.x) / 2, bounds.y + (bounds.height - idSize.y) / 2, true); + } + + static + { + CodeSnippetSupplier.symbolRendererProviderSupplier.setSnippetProvider(DefaultSymbolRenderer.class.getCanonicalName(), + SnippetSupplier.create(Void.class, DefaultSymbolRenderer::new)); + } +} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/DefaultSymbolRendererProvider.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/DefaultSymbolRendererProvider.java deleted file mode 100644 index 4d445d67..00000000 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/DefaultSymbolRendererProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.mograsim.logic.ui.serializing.snippets.symbolrenderers; - -import com.google.gson.JsonElement; - -import net.haspamelodica.swt.helper.swtobjectwrappers.Point; -import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; -import net.mograsim.logic.ui.serializing.DeserializedSubmodelComponent; -import net.mograsim.logic.ui.serializing.snippets.Renderer; -import net.mograsim.logic.ui.serializing.snippets.RendererProvider; -import net.mograsim.preferences.ColorDefinition; -import net.mograsim.preferences.ColorManager; -import net.mograsim.preferences.Preferences; - -public class DefaultSymbolRendererProvider implements RendererProvider -{ - private static final String id = ""; - - @Override - public Renderer create(DeserializedSubmodelComponent component, JsonElement params) - { - return (gc, visReg) -> - { - ColorDefinition fg = Preferences.current().getColorDefinition("net.mograsim.logic.ui.color.text"); - if (fg != null) - gc.setForeground(ColorManager.current().toColor(fg)); - Point idSize = gc.textExtent(id); - Rectangle bounds = component.getBounds(); - gc.drawText(id, bounds.x + (bounds.width - idSize.x) / 2, bounds.y + (bounds.height - idSize.y) / 2, true); - }; - } -} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRenderer.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRenderer.java new file mode 100644 index 00000000..515c9c44 --- /dev/null +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRenderer.java @@ -0,0 +1,82 @@ +package net.mograsim.logic.ui.serializing.snippets.symbolrenderers; + +import java.util.Map.Entry; + +import org.eclipse.swt.graphics.Color; + +import net.haspamelodica.swt.helper.gcs.GeneralGC; +import net.haspamelodica.swt.helper.swtobjectwrappers.Font; +import net.haspamelodica.swt.helper.swtobjectwrappers.Point; +import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; +import net.mograsim.logic.ui.model.components.GUIComponent; +import net.mograsim.logic.ui.model.components.submodels.SubmodelComponent; +import net.mograsim.logic.ui.model.wires.Pin; +import net.mograsim.logic.ui.serializing.CodeSnippetSupplier; +import net.mograsim.logic.ui.serializing.snippets.Renderer; +import net.mograsim.logic.ui.serializing.snippets.SnippetSupplier; +import net.mograsim.preferences.Preferences; + +/** + * Renders a text ("centerText") with a given font height ("centerTextHeight") in the center of the component and + * draws a label for each pin with a given font height ("pinLabelHeight"). The labels of pins to the left of a given x + * coordinate ("horizontalComponentCenter") are drawn to the right of the respective pin; labels of pins to the right are drawn + * left. A margin ("pinLabelMargin") is applied for pin label drawing. + * + * @author Daniel Kirschten + */ +public class SimpleRectangularLikeSymbolRenderer implements Renderer +{ + private final GUIComponent component; + private final SimpleRectangularLikeParams params; + + public SimpleRectangularLikeSymbolRenderer(SubmodelComponent component, SimpleRectangularLikeParams params) + { + this.component = component; + this.params = params; + } + + @Override + public void render(GeneralGC gc, Rectangle visibleRegion) + { + double posX = component.getPosX(); + double posY = component.getPosY(); + double width = component.getWidth(); + double height = component.getHeight(); + + Font oldFont = gc.getFont(); + gc.setFont(new Font(oldFont.getName(), params.centerTextHeight, oldFont.getStyle())); + Point textExtent = gc.textExtent(params.centerText); + Color textColor = Preferences.current().getColor("net.mograsim.logic.ui.color.text"); + if (textColor != null) + gc.setForeground(textColor); + gc.drawText(params.centerText, posX + (width - textExtent.x) / 2, posY + (height - textExtent.y) / 2, true); + gc.setFont(new Font(oldFont.getName(), params.pinLabelHeight, oldFont.getStyle())); + for (Entry pinEntry : component.getPins().entrySet()) + { + String pinName = pinEntry.getKey(); + Pin pin = pinEntry.getValue(); + double pinX = pin.getRelX(); + double pinY = posY + pin.getRelY(); + textExtent = gc.textExtent(pinName); + gc.drawText(pinName, + posX + pinX + (pinX > params.horizontalComponentCenter ? -textExtent.x - params.pinLabelMargin : params.pinLabelMargin), + pinY - textExtent.y / 2, true); + } + gc.setFont(oldFont); + } + + public static class SimpleRectangularLikeParams + { + public String centerText; + public double centerTextHeight; + public double horizontalComponentCenter; + public double pinLabelHeight; + public double pinLabelMargin; + } + + static + { + CodeSnippetSupplier.symbolRendererProviderSupplier.setSnippetProvider(SimpleRectangularLikeSymbolRenderer.class.getCanonicalName(), + SnippetSupplier.create(SimpleRectangularLikeParams.class, SimpleRectangularLikeSymbolRenderer::new)); + } +} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRendererProvider.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRendererProvider.java deleted file mode 100644 index c7a8fa1e..00000000 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/snippets/symbolrenderers/SimpleRectangularLikeSymbolRendererProvider.java +++ /dev/null @@ -1,83 +0,0 @@ -package net.mograsim.logic.ui.serializing.snippets.symbolrenderers; - -import java.util.Map.Entry; - -import org.eclipse.swt.graphics.Color; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; - -import net.haspamelodica.swt.helper.swtobjectwrappers.Font; -import net.haspamelodica.swt.helper.swtobjectwrappers.Point; -import net.mograsim.logic.ui.model.wires.Pin; -import net.mograsim.logic.ui.serializing.CodeSnippetSupplier; -import net.mograsim.logic.ui.serializing.DeserializedSubmodelComponent; -import net.mograsim.logic.ui.serializing.snippets.Renderer; -import net.mograsim.logic.ui.serializing.snippets.RendererProvider; -import net.mograsim.preferences.Preferences; - -/** - * Renders a text ("centerText") with a given font height ("centerTextHeight") in the center of the component and - * draws a label for each pin with a given font height ("pinLabelHeight"). The labels of pins to the left of a given x - * coordinate ("horizontalComponentCenter") are drawn to the right of the respective pin; labels of pins to the right are drawn - * left. A margin ("pinLabelMargin") is applied for pin label drawing.
- * Parameter format: - * - *
- * {
- *   "centerText": [String]
- *   "centerTextHeight": [double]
- *   "horizontalComponentCenter": [double]
- *   "pinLabelHeight": [double]
- *   "pinLabelMargin": [double]
- * }
- * 
- * - * @author Daniel Kirschten - */ -public class SimpleRectangularLikeSymbolRendererProvider implements RendererProvider -{ - @Override - public Renderer create(DeserializedSubmodelComponent component, JsonElement params) - { - JsonObject asJsonObject = params.getAsJsonObject(); - String centerText = asJsonObject.getAsJsonPrimitive("centerText").getAsString(); - double centerTextHeight = asJsonObject.getAsJsonPrimitive("centerTextHeight").getAsDouble(); - double horizontalComponentCenter = asJsonObject.getAsJsonPrimitive("horizontalComponentCenter").getAsDouble(); - double pinLabelHeight = asJsonObject.getAsJsonPrimitive("pinLabelHeight").getAsDouble(); - double pinLabelMargin = asJsonObject.getAsJsonPrimitive("pinLabelMargin").getAsDouble(); - return (gc, visReg) -> - { - double posX = component.getPosX(); - double posY = component.getPosY(); - double width = component.getWidth(); - double height = component.getHeight(); - - Font oldFont = gc.getFont(); - gc.setFont(new Font(oldFont.getName(), centerTextHeight, oldFont.getStyle())); - Point textExtent = gc.textExtent(centerText); - Color textColor = Preferences.current().getColor("net.mograsim.logic.ui.color.text"); - if (textColor != null) - gc.setForeground(textColor); - gc.drawText(centerText, posX + (width - textExtent.x) / 2, posY + (height - textExtent.y) / 2, true); - gc.setFont(new Font(oldFont.getName(), pinLabelHeight, oldFont.getStyle())); - for (Entry pinEntry : component.getPins().entrySet()) - { - String pinName = pinEntry.getKey(); - Pin pin = pinEntry.getValue(); - double pinX = pin.getRelX(); - double pinY = posY + pin.getRelY(); - textExtent = gc.textExtent(pinName); - gc.drawText(pinName, posX + pinX + (pinX > horizontalComponentCenter ? -textExtent.x - pinLabelMargin : pinLabelMargin), - pinY - textExtent.y / 2, true); - } - gc.setFont(oldFont); - }; - } - - static - { - CodeSnippetSupplier.symbolRendererProviderSupplier.setSnippetProvider( - SimpleRectangularLikeSymbolRendererProvider.class.getCanonicalName(), new SimpleRectangularLikeSymbolRendererProvider()); - } -} \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json index 30976a09..7cdc9f32 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/standardSnippetIDMapping.json @@ -2,7 +2,7 @@ mograsim version: 0.1.3 { "standardOutlineRendererProviders": {}, "standardSymbolRendererProviders": { - "CenteredTextSymbolRenderer": "net.mograsim.logic.ui.serializing.snippets.symbolrenderers.CenteredTextSymbolRendererProvider", - "SimpleRectangularLikeSymbolRenderer": "net.mograsim.logic.ui.serializing.snippets.symbolrenderers.SimpleRectangularLikeSymbolRendererProvider" + "CenteredTextSymbolRenderer": "net.mograsim.logic.ui.serializing.snippets.symbolrenderers.CenteredTextSymbolRenderer", + "SimpleRectangularLikeSymbolRenderer": "net.mograsim.logic.ui.serializing.snippets.symbolrenderers.SimpleRectangularLikeSymbolRenderer" } } \ No newline at end of file -- 2.17.1 From 424b7fd8ab66774d942748fbb12ecf84101aae0d Mon Sep 17 00:00:00 2001 From: Fabian Stemmler Date: Fri, 5 Jul 2019 15:03:28 +0200 Subject: [PATCH 14/16] Added a GUIComponent resize listener --- .../ui/model/components/GUIComponent.java | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java index 58c725df..83e6d61d 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java @@ -38,12 +38,12 @@ public abstract class GUIComponent protected final Map pinsUnmodifiable; private final List> componentMovedListeners; + private final List> componentResizedListeners; private final List> pinAddedListeners; private final List> pinRemovedListeners; private final List redrawListeners; private final Runnable redrawListenerForSubcomponents; - // creation and destruction public GUIComponent(ViewModelModifiable model) @@ -54,6 +54,7 @@ public abstract class GUIComponent this.pinsUnmodifiable = Collections.unmodifiableMap(pinsByName); this.componentMovedListeners = new ArrayList<>(); + this.componentResizedListeners = new ArrayList<>(); this.pinAddedListeners = new ArrayList<>(); this.pinRemovedListeners = new ArrayList<>(); this.redrawListeners = new ArrayList<>(); @@ -193,6 +194,7 @@ public abstract class GUIComponent { bounds.width = width; bounds.height = height; + callComponentResizedListener(); requestRedraw(); } @@ -287,19 +289,22 @@ public abstract class GUIComponent } // @formatter:off - public void addComponentMovedListener (Consumer listener) {componentMovedListeners.add (listener);} - public void addPinAddedListener (Consumer listener) {pinAddedListeners .add (listener);} - public void addPinRemovedListener (Consumer listener) {pinRemovedListeners .add (listener);} - public void addRedrawListener (Runnable listener) {redrawListeners .add (listener);} - - public void removeComponentMovedListener(Consumer listener) {componentMovedListeners .remove(listener);} - public void removePinAddedListener (Consumer listener) {pinAddedListeners .remove(listener);} - public void removePinRemovedListener (Consumer listener) {pinRemovedListeners .remove(listener);} - public void removeRedrawListener (Runnable listener) {redrawListeners .remove(listener);} - - private void callComponentMovedListeners( ) {componentMovedListeners.forEach(l -> l.accept(this));} - private void callPinAddedListeners (Pin p) {pinAddedListeners .forEach(l -> l.accept(p ));} - private void callPinRemovedListeners (Pin p) {pinRemovedListeners .forEach(l -> l.accept(p ));} - private void callRedrawListeners ( ) {redrawListeners .forEach(l -> l.run( ));} + public void addComponentMovedListener (Consumer listener) {componentMovedListeners .add (listener);} + public void addComponentResizedListener (Consumer listener) {componentResizedListeners.add (listener);} + public void addPinAddedListener (Consumer listener) {pinAddedListeners .add (listener);} + public void addPinRemovedListener (Consumer listener) {pinRemovedListeners .add (listener);} + public void addRedrawListener (Runnable listener) {redrawListeners .add (listener);} + + public void removeComponentMovedListener (Consumer listener) {componentMovedListeners .remove(listener);} + public void removeComponentResizedListener (Consumer listener) {componentResizedListeners.remove(listener);} + public void removePinAddedListener (Consumer listener) {pinAddedListeners .remove(listener);} + public void removePinRemovedListener (Consumer listener) {pinRemovedListeners .remove(listener);} + public void removeRedrawListener (Runnable listener) {redrawListeners .remove(listener);} + + private void callComponentMovedListeners ( ) {componentMovedListeners .forEach(l -> l.accept(this));} + private void callComponentResizedListener( ) {componentResizedListeners.forEach(l -> l.accept(this));} + private void callPinAddedListeners (Pin p) {pinAddedListeners .forEach(l -> l.accept(p ));} + private void callPinRemovedListeners (Pin p) {pinRemovedListeners .forEach(l -> l.accept(p ));} + private void callRedrawListeners ( ) {redrawListeners .forEach(l -> l.run( ));} // @formatter:on } \ No newline at end of file -- 2.17.1 From a2eef1d1616d03af5b464f347f6176ea9d2cc75e Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Fri, 5 Jul 2019 16:03:47 +0200 Subject: [PATCH 15/16] Removed ConnectionPoint causing confusion --- .../logic/ui/am2900/Am2901Testbench.java | 7 ++- .../logic/ui/model/wires/ConnectionPoint.java | 13 ----- .../logic/ui/model/wires/GUIWire.java | 56 ++++++++++++++++++- .../mograsim/logic/ui/model/wires/Pin.java | 8 +-- .../logic/ui/model/wires/WireCrossPoint.java | 3 +- .../mograsim/logic/ui/util/ModellingTool.java | 37 +++++++++++- 6 files changed, 93 insertions(+), 31 deletions(-) delete mode 100644 net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/ConnectionPoint.java diff --git a/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/Am2901Testbench.java b/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/Am2901Testbench.java index 34c4cbe7..0a06914b 100644 --- a/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/Am2901Testbench.java +++ b/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/Am2901Testbench.java @@ -2,6 +2,7 @@ package net.mograsim.logic.ui.am2900; import net.mograsim.logic.ui.SimpleLogicUIStandalone; import net.mograsim.logic.ui.model.ViewModelModifiable; +import net.mograsim.logic.ui.model.components.GUIComponent; import net.mograsim.logic.ui.model.components.atomic.GUIAndGate; import net.mograsim.logic.ui.model.components.atomic.GUIBitDisplay; import net.mograsim.logic.ui.model.components.atomic.GUIManualSwitch; @@ -10,7 +11,7 @@ import net.mograsim.logic.ui.model.components.atomic.TextComponent; import net.mograsim.logic.ui.model.components.mi.nandbased.GUIdff; import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901; import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmodelComponent; -import net.mograsim.logic.ui.model.wires.ConnectionPoint; +import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; import net.mograsim.logic.ui.util.ModellingTool; @@ -46,7 +47,7 @@ public class Am2901Testbench not2.moveTo(80, -20); not3.moveTo(110, -20); and.moveTo(135, -30); - ConnectionPoint last = and.getPin("Y"); + Pin last = and.getPin("Y"); for (int i = 0; i < comp.getInputPinNames().size(); i++) { @@ -54,7 +55,7 @@ public class Am2901Testbench double y = 10 * i; WireCrossPoint wcp = new WireCrossPoint(model, 1); - GUIdff d_ff = new GUIdff(model); + GUIComponent d_ff = new GUIdff(model); GUIManualSwitch sw = new GUIManualSwitch(model); tool.connect(last, wcp); diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/ConnectionPoint.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/ConnectionPoint.java deleted file mode 100644 index ed10286d..00000000 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/ConnectionPoint.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.mograsim.logic.ui.model.wires; - -public interface ConnectionPoint -{ - /** - * Retrieves the {@link Pin}, that is used by the {@link GUIWire} to connect to. - * - * @return the {@link Pin} for the wire to connect to. - * - * @author Christian Femers - */ - Pin getPin(); -} diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/GUIWire.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/GUIWire.java index 6f6147ad..7b641ff3 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/GUIWire.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/GUIWire.java @@ -74,7 +74,37 @@ public class GUIWire * * @author Daniel Kirschten */ - public GUIWire(ViewModelModifiable model, ConnectionPoint pin1, ConnectionPoint pin2) + public GUIWire(ViewModelModifiable model, WireCrossPoint pin1, WireCrossPoint pin2) + { + this(model, pin1, pin2, (Point[]) null); + } + + /** + * Creates a new {@link GUIWire} with automatic interpolation. + * + * @author Daniel Kirschten + */ + public GUIWire(ViewModelModifiable model, WireCrossPoint pin1, Pin pin2) + { + this(model, pin1, pin2, (Point[]) null); + } + + /** + * Creates a new {@link GUIWire} with automatic interpolation. + * + * @author Daniel Kirschten + */ + public GUIWire(ViewModelModifiable model, Pin pin1, WireCrossPoint pin2) + { + this(model, pin1, pin2, (Point[]) null); + } + + /** + * Creates a new {@link GUIWire} with automatic interpolation. + * + * @author Daniel Kirschten + */ + public GUIWire(ViewModelModifiable model, Pin pin1, Pin pin2) { this(model, pin1, pin2, (Point[]) null); } @@ -84,7 +114,7 @@ public class GUIWire * * @author Daniel Kirschten */ - public GUIWire(ViewModelModifiable model, ConnectionPoint pin1, ConnectionPoint pin2, Point... path) + public GUIWire(ViewModelModifiable model, WireCrossPoint pin1, WireCrossPoint pin2, Point... path) { this(model, pin1.getPin(), pin2.getPin(), path); } @@ -94,7 +124,27 @@ public class GUIWire * * @author Daniel Kirschten */ - GUIWire(ViewModelModifiable model, Pin pin1, Pin pin2, Point... path) + public GUIWire(ViewModelModifiable model, WireCrossPoint pin1, Pin pin2, Point... path) + { + this(model, pin1.getPin(), pin2, path); + } + + /** + * Creates a new {@link GUIWire} without automatic interpolation. + * + * @author Daniel Kirschten + */ + public GUIWire(ViewModelModifiable model, Pin pin1, WireCrossPoint pin2, Point... path) + { + this(model, pin1, pin2.getPin(), path); + } + + /** + * Creates a new {@link GUIWire} without automatic interpolation. + * + * @author Daniel Kirschten + */ + public GUIWire(ViewModelModifiable model, Pin pin1, Pin pin2, Point... path) { logicObs = (i) -> callRedrawListeners(); this.model = model; diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/Pin.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/Pin.java index b761c0e7..287a6237 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/Pin.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/Pin.java @@ -15,7 +15,7 @@ import net.mograsim.logic.ui.model.components.GUIComponent; * * @author Daniel Kirschten */ -public class Pin implements ConnectionPoint +public class Pin { /** * The {@link GUIComponent} this pin belongs to @@ -136,10 +136,4 @@ public class Pin implements ConnectionPoint { return "Pin [" + name + ", point=" + getPos() + "]"; } - - @Override - public Pin getPin() - { - return this; - } } \ No newline at end of file diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/WireCrossPoint.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/WireCrossPoint.java index 1a3f893a..7a2fcf4b 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/WireCrossPoint.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/WireCrossPoint.java @@ -23,7 +23,7 @@ import net.mograsim.preferences.ColorManager; * * @author Daniel Kirschten */ -public class WireCrossPoint extends GUIComponent implements ConnectionPoint +public class WireCrossPoint extends GUIComponent { private static final int CIRCLE_RADIUS = 1; private static final int CIRCLE_DIAM = CIRCLE_RADIUS * 2; @@ -55,7 +55,6 @@ public class WireCrossPoint extends GUIComponent implements ConnectionPoint // pins - @Override public Pin getPin() { return pin; diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/util/ModellingTool.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/util/ModellingTool.java index 61252ea4..c8cd5b92 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/util/ModellingTool.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/util/ModellingTool.java @@ -2,8 +2,9 @@ package net.mograsim.logic.ui.util; import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUIComponent; -import net.mograsim.logic.ui.model.wires.ConnectionPoint; import net.mograsim.logic.ui.model.wires.GUIWire; +import net.mograsim.logic.ui.model.wires.Pin; +import net.mograsim.logic.ui.model.wires.WireCrossPoint; public class ModellingTool { @@ -19,12 +20,42 @@ public class ModellingTool return connect(a.getPin(pinA), b.getPin(pinB)); } - public GUIWire connect(ConnectionPoint a, GUIComponent b, String pinB) + public GUIWire connect(WireCrossPoint a, GUIComponent b, String pinB) + { + return connect(a.getPin(), b.getPin(pinB)); + } + + public GUIWire connect(Pin a, GUIComponent b, String pinB) { return connect(a, b.getPin(pinB)); } - public GUIWire connect(ConnectionPoint a, ConnectionPoint b) + public GUIWire connect(GUIComponent a, WireCrossPoint b, String pinA) + { + return connect(a.getPin(pinA), b.getPin()); + } + + public GUIWire connect(WireCrossPoint a, WireCrossPoint b) + { + return connect(a.getPin(), b.getPin()); + } + + public GUIWire connect(Pin a, WireCrossPoint b) + { + return connect(a, b.getPin()); + } + + public GUIWire connect(GUIComponent a, Pin b, String pinA) + { + return connect(a.getPin(pinA), b); + } + + public GUIWire connect(WireCrossPoint a, Pin b) + { + return connect(a.getPin(), b); + } + + public GUIWire connect(Pin a, Pin b) { return new GUIWire(model, a, b); } -- 2.17.1 From 0885062ad73925732b1a4e4c79f910dec9862fd3 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Fri, 5 Jul 2019 16:16:01 +0200 Subject: [PATCH 16/16] Switched mostly to using deserialized component versions Didn't switch where high level states are needed --- .../examples/SubmodelComponentTestbench.java | 1 + .../logic/ui/am2900/Am2901Testbench.java | 33 ++++++++++++------- .../logic/ui/am2900/TestableAm2901Impl.java | 20 +++++++++-- .../IndirectGUIComponentCreator.java | 6 ++++ 4 files changed, 46 insertions(+), 14 deletions(-) diff --git a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java index 5f10c729..9215db1a 100644 --- a/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java +++ b/net.mograsim.logic.ui.am2900/src/net/mograsim/logic/ui/examples/SubmodelComponentTestbench.java @@ -25,6 +25,7 @@ public class SubmodelComponentTestbench SubmodelComponent comp = SubmodelComponentDeserializer.create(model, "components/am2901/GUIAm2901.json"); // guess which pins are outputs and which are inputs + // TODO this code exists three times... but it seems too "hacky" to put it in a helper class List inputPinNames = new ArrayList<>(); List outputPinNames = new ArrayList<>(); for (Pin p : comp.getPins().values()) diff --git a/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/Am2901Testbench.java b/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/Am2901Testbench.java index 0a06914b..c35402b1 100644 --- a/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/Am2901Testbench.java +++ b/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/Am2901Testbench.java @@ -1,5 +1,8 @@ package net.mograsim.logic.ui.am2900; +import java.util.ArrayList; +import java.util.List; + import net.mograsim.logic.ui.SimpleLogicUIStandalone; import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUIComponent; @@ -8,11 +11,9 @@ import net.mograsim.logic.ui.model.components.atomic.GUIBitDisplay; import net.mograsim.logic.ui.model.components.atomic.GUIManualSwitch; import net.mograsim.logic.ui.model.components.atomic.GUINotGate; import net.mograsim.logic.ui.model.components.atomic.TextComponent; -import net.mograsim.logic.ui.model.components.mi.nandbased.GUIdff; -import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901; -import net.mograsim.logic.ui.model.components.submodels.SimpleRectangularSubmodelComponent; import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.model.wires.WireCrossPoint; +import net.mograsim.logic.ui.serializing.IndirectGUIComponentCreator; import net.mograsim.logic.ui.util.ModellingTool; public class Am2901Testbench @@ -24,7 +25,7 @@ public class Am2901Testbench public static void createTestbench(ViewModelModifiable model) { - SimpleRectangularSubmodelComponent comp = new GUIAm2901(model); + GUIComponent comp = IndirectGUIComponentCreator.createComponent(model, "GUIAm2901"); ModellingTool tool = ModellingTool.createFor(model); comp.moveTo(240, 0); @@ -49,22 +50,32 @@ public class Am2901Testbench and.moveTo(135, -30); Pin last = and.getPin("Y"); - for (int i = 0; i < comp.getInputPinNames().size(); i++) + // guess which pins are outputs and which are inputs + // TODO this code exists three times... but it seems too "hacky" to put it in a helper class + List inputPinNames = new ArrayList<>(); + List outputPinNames = new ArrayList<>(); + for (Pin p : comp.getPins().values()) + if (p.getRelX() == 0) + inputPinNames.add(p.name); + else + outputPinNames.add(p.name); + + for (int i = 0; i < inputPinNames.size(); i++) { double x = 55 + 70 * (i % 2); double y = 10 * i; WireCrossPoint wcp = new WireCrossPoint(model, 1); - GUIComponent d_ff = new GUIdff(model); + GUIComponent d_ff = IndirectGUIComponentCreator.createComponent(model, "GUIdff"); GUIManualSwitch sw = new GUIManualSwitch(model); tool.connect(last, wcp); tool.connect(wcp, d_ff, "C"); tool.connect(sw, d_ff, "", "D"); - tool.connect(d_ff, comp, "Q", comp.getInputPinNames().get(i)); + tool.connect(d_ff, comp, "Q", inputPinNames.get(i)); last = wcp.getPin(); - TextComponent label = new TextComponent(model, comp.getInputPinNames().get(i)); + TextComponent label = new TextComponent(model, inputPinNames.get(i)); sw.moveTo(x, y + 7.5); wcp.moveTo(160, y); @@ -72,15 +83,15 @@ public class Am2901Testbench label.moveTo(x - 25, y + 15); } - for (int i = 0; i < comp.getOutputPinNames().size(); i++) + for (int i = 0; i < outputPinNames.size(); i++) { double x = 300 + 75 * (i % 2); double y = 10 * i - 2.5; GUIBitDisplay bd = new GUIBitDisplay(model); bd.moveTo(x, y); - tool.connect(bd.getInputPin(), comp, comp.getOutputPinNames().get(i)); + tool.connect(bd.getInputPin(), comp, outputPinNames.get(i)); - TextComponent label = new TextComponent(model, comp.getOutputPinNames().get(i)); + TextComponent label = new TextComponent(model, outputPinNames.get(i)); label.moveTo(x + 50, y + 8); } } diff --git a/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/TestableAm2901Impl.java b/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/TestableAm2901Impl.java index 9ca395af..25f15669 100644 --- a/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/TestableAm2901Impl.java +++ b/net.mograsim.logic.ui.am2900/test/net/mograsim/logic/ui/am2900/TestableAm2901Impl.java @@ -3,9 +3,11 @@ package net.mograsim.logic.ui.am2900; import static org.junit.jupiter.api.Assertions.fail; import java.lang.reflect.Field; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; +import java.util.List; import java.util.Objects; import java.util.Queue; import java.util.Set; @@ -25,12 +27,13 @@ import net.mograsim.logic.ui.model.components.atomic.GUIManualSwitch; import net.mograsim.logic.ui.model.components.mi.nandbased.am2901.GUIAm2901; import net.mograsim.logic.ui.model.components.submodels.SubmodelComponent; import net.mograsim.logic.ui.model.wires.GUIWire; +import net.mograsim.logic.ui.model.wires.Pin; import net.mograsim.logic.ui.modeladapter.LogicModelParameters; import net.mograsim.logic.ui.modeladapter.ViewLogicModelAdapter; public class TestableAm2901Impl implements TestableAm2901 { - private GUIAm2901 am2901; + private GUIComponent am2901; private Timeline timeline; private ManualSwitch I8, I7, I6, I5, I4, I3, I2, I1, I0; private ManualSwitch C; @@ -100,10 +103,21 @@ public class TestableAm2901Impl implements TestableAm2901 { // Create view model ViewModelModifiable viewModel = new ViewModelModifiable(); + // TODO replace with deserialized version as soon as high level states work for deserialized components am2901 = new GUIAm2901(viewModel); +// am2901 = IndirectGUIComponentCreator.createComponent(viewModel, "GUIAm2901"); + // guess which pins are outputs and which are inputs + // TODO this code exists three times... but it seems too "hacky" to put it in a helper class + List inputPinNames = new ArrayList<>(); + List outputPinNames = new ArrayList<>(); + for (Pin p : am2901.getPins().values()) + if (p.getRelX() == 0) + inputPinNames.add(p.name); + else + outputPinNames.add(p.name); // Get switches HashMap idSwitchMap = new HashMap<>(); - for (String id : am2901.getInputPinNames()) + for (String id : inputPinNames) { GUIManualSwitch sw = new GUIManualSwitch(viewModel); new GUIWire(viewModel, am2901.getPin(id), sw.getOutputPin()); @@ -111,7 +125,7 @@ public class TestableAm2901Impl implements TestableAm2901 } // Get displays HashMap idDisplayMap = new HashMap<>(); - for (String id : am2901.getOutputPinNames()) + for (String id : outputPinNames) { GUIBitDisplay bd = new GUIBitDisplay(viewModel); // bd.addRedrawListener(() -> System.out.println(id + " " + bd.getBitDisplay().getDisplayedValue())); diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/IndirectGUIComponentCreator.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/IndirectGUIComponentCreator.java index c40897a9..456d19c1 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/IndirectGUIComponentCreator.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/serializing/IndirectGUIComponentCreator.java @@ -6,6 +6,7 @@ import java.util.HashMap; import java.util.Map; import com.google.gson.JsonElement; +import com.google.gson.JsonNull; import net.mograsim.logic.ui.model.ViewModelModifiable; import net.mograsim.logic.ui.model.components.GUIComponent; @@ -55,6 +56,11 @@ public class IndirectGUIComponentCreator componentProviders.put(className, componentProvider); } + public static GUIComponent createComponent(ViewModelModifiable model, String id) + { + return createComponent(model, id, JsonNull.INSTANCE); + } + public static GUIComponent createComponent(ViewModelModifiable model, String id, JsonElement params) { if (id != null) -- 2.17.1