From 1c8f03ff4ef9514bf2c77fcba94865a59efcbca7 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Thu, 4 Jul 2019 10:30:35 +0200 Subject: [PATCH] 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