Merge branch 'development' of https://gitlab.lrz.de/lrr-tum/students/eragp-misim...
authorFabian Stemmler <stemmler@in.tum.de>
Wed, 17 Jul 2019 10:43:13 +0000 (12:43 +0200)
committerFabian Stemmler <stemmler@in.tum.de>
Wed, 17 Jul 2019 10:43:13 +0000 (12:43 +0200)
33 files changed:
net.mograsim.logic.model.editor/components/GUI_rsLatch.json
net.mograsim.logic.model.editor/components/GUIand.json
net.mograsim.logic.model.editor/components/GUIand41.json
net.mograsim.logic.model.editor/components/GUIandor414.json
net.mograsim.logic.model.editor/components/GUIdemux2.json
net.mograsim.logic.model.editor/components/GUIdff.json
net.mograsim.logic.model.editor/components/GUIdlatch.json
net.mograsim.logic.model.editor/components/GUIdlatch4.json
net.mograsim.logic.model.editor/components/GUIfulladder.json
net.mograsim.logic.model.editor/components/GUIhalfadder.json
net.mograsim.logic.model.editor/components/GUImux1.json
net.mograsim.logic.model.editor/components/GUImux1_4.json
net.mograsim.logic.model.editor/components/GUInand3.json
net.mograsim.logic.model.editor/components/GUInot4.json
net.mograsim.logic.model.editor/components/GUIor4.json
net.mograsim.logic.model.editor/components/GUIor_4.json
net.mograsim.logic.model.editor/components/GUIram2.json
net.mograsim.logic.model.editor/components/GUIram4.json
net.mograsim.logic.model.editor/components/GUIsel2_4.json
net.mograsim.logic.model.editor/components/GUIsel3_4.json
net.mograsim.logic.model.editor/components/GUIxor.json
net.mograsim.logic.model.editor/components/am2901/GUIAm2901.json
net.mograsim.logic.model.editor/components/am2901/GUIAm2901ALUFuncDecode.json
net.mograsim.logic.model.editor/components/am2901/GUIAm2901ALUInclDecode.json
net.mograsim.logic.model.editor/components/am2901/GUIAm2901ALUInclSourceDecodeInclFunctionDecode.json
net.mograsim.logic.model.editor/components/am2901/GUIAm2901ALUOneBit.json
net.mograsim.logic.model.editor/components/am2901/GUIAm2901DestDecode.json
net.mograsim.logic.model.editor/components/am2901/GUIAm2901QReg.json
net.mograsim.logic.model.editor/components/am2901/GUIAm2901SourceDecode.json
net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/HandleManager.java
net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/handles/WirePointHandle.java
net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/ui/EditorCanvas.java
net.mograsim.logic.model/src/net/mograsim/logic/model/model/wires/GUIWire.java

index a91b815..1e846c4 100644 (file)
@@ -211,11 +211,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "_rsLatch",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 5877291..c19d8f9 100644 (file)
@@ -135,11 +135,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIand",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 973a4c9..98ebfa1 100644 (file)
@@ -317,11 +317,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIand41",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 5cadf0f..3042690 100644 (file)
@@ -476,11 +476,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIandor414",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 5ded84b..29440a2 100644 (file)
@@ -500,11 +500,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIdemux2",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 55151f8..80794ee 100644 (file)
@@ -317,11 +317,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIdff",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 69562ce..d83cc99 100644 (file)
@@ -227,11 +227,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIdlatch",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 29f4ac0..c42e6d0 100644 (file)
@@ -317,11 +317,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIdlatch4",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index dc4c616..c523394 100644 (file)
@@ -177,11 +177,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIfulladder",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 761d6ce..dd070ea 100644 (file)
@@ -306,11 +306,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIhalfadder",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 7ce9002..60b22cd 100644 (file)
@@ -219,11 +219,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUImux1",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 21e2f21..7689ec7 100644 (file)
@@ -457,11 +457,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUImux1_4",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index b3a6300..f9fbb80 100644 (file)
@@ -193,11 +193,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUInand3",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 7d575c8..98f4cbe 100644 (file)
@@ -363,11 +363,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUInot4",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index d4bcd57..47755a3 100644 (file)
@@ -514,11 +514,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIor4",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 86b4413..0e88690 100644 (file)
@@ -835,11 +835,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIor_4",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 3cb8583..a3e9e76 100644 (file)
@@ -2818,11 +2818,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIram2",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 99f606d..d6d7ea8 100644 (file)
@@ -3186,11 +3186,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIram4",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 219e1b9..099fb5f 100644 (file)
@@ -801,11 +801,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIsel2_4",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 1cae789..c85cf05 100644 (file)
@@ -867,11 +867,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIsel3_4",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 9e3ec59..d4e28ed 100644 (file)
@@ -256,11 +256,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIxor",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 7563d83..b40848d 100644 (file)
@@ -3234,11 +3234,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIAm2901",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index a24476b..b9c4492 100644 (file)
@@ -670,11 +670,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIAm2901ALUFuncDecode",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 62d78f1..ee540ec 100644 (file)
@@ -1442,11 +1442,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIAm2901ALUInclDecode",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 75c63dd..5e9bea0 100644 (file)
@@ -1302,11 +1302,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIAm2901ALUInclSourceDecodeInclFunctionDecode",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index b6b05e1..1dffc50 100644 (file)
@@ -510,11 +510,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIAm2901ALUOneBit",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index d80d080..3a75574 100644 (file)
@@ -1024,11 +1024,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIAm2901DestDecode",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 6af804d..ec0983e 100644 (file)
@@ -397,11 +397,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "GUIAm2901QReg",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index e36193d..a995649 100644 (file)
@@ -1065,11 +1065,11 @@ mograsim version: 0.1.3
       }
     ]
   },
-  "symbolRendererSnippetID": "SimpleRectangularLikeSymbolRenderer",
+  "symbolRendererSnippetID": "simpleRectangularLike",
   "symbolRendererParams": {
     "centerText": "Am2901SourceDecode",
-    "horizontalComponentCenter": 17.5,
     "centerTextHeight": 5.0,
+    "horizontalComponentCenter": 17.5,
     "pinLabelHeight": 3.5,
     "pinLabelMargin": 0.5
   }
index 7e23160..ee755f9 100644 (file)
@@ -121,7 +121,7 @@ public class HandleManager
                {
                        Point[] newPath = w.getPath();
                        int newLength = newPath == null ? 0 : newPath.length;
-                       int diff = oldLength.getAndSet(newLength) - newLength;
+                       int diff = newLength - oldLength.getAndSet(newLength);
                        if (diff != 0)
                        {
                                if (diff > 0)
@@ -216,11 +216,14 @@ public class HandleManager
 
        void destroyWirePointHandle(GUIWire owner, WirePointHandle h)
        {
-               List<WirePointHandle> handles = pointHandlesPerWire.get(owner);
-               int pointIndex = handles.indexOf(h);
-               handles.remove(pointIndex);
-               removeHandle(h);
-               owner.removePathPoint(pointIndex);
+               if (pointHandlesPerWire.containsKey(owner))
+               {
+                       List<WirePointHandle> handles = pointHandlesPerWire.get(owner);
+                       int pointIndex = handles.indexOf(h);
+                       handles.remove(pointIndex);
+                       removeHandle(h);
+                       owner.removePathPoint(pointIndex);
+               }
        }
 
        private void removeWirePointHandles(GUIWire owner)
index 8fd0acd..48c7c22 100644 (file)
@@ -32,6 +32,7 @@ public class WirePointHandle extends Handle
        {
                Point p = parent.getPathPoint(pointIndex);
                moveTo(p.x, p.y);
+               callRedrawListeners();
        }
 
        @Override
index 641aaa4..aedaa48 100644 (file)
@@ -22,9 +22,17 @@ public class EditorCanvas extends LogicUICanvas
                super(parent, style, editor.toBeEdited.submodel);
 
                handles = editor.handleManager.getHandles();
-               editor.handleManager.addHandleAddedListener(h -> h.addRedrawListener(this::redrawThreadsafe));
+               editor.handleManager.addHandleAddedListener(h ->
+               {
+                       redrawThreadsafe();
+                       h.addRedrawListener(this::redrawThreadsafe);
+               });
                // TODO: Is this even necessary? The Handle should be finalized by the gc
-               editor.handleManager.addHandleRemovedListener(h -> h.removeRedrawListener(this::redrawThreadsafe));
+               editor.handleManager.addHandleRemovedListener(h ->
+               {
+                       redrawThreadsafe();
+                       h.removeRedrawListener(this::redrawThreadsafe);
+               });
 
                addZoomedRenderer(gc ->
                {
index f59355c..144a1a3 100644 (file)
@@ -421,6 +421,8 @@ public class GUIWire
                                System.arraycopy(oldPath, index, path, index + 1, oldPath.length - index);
                        path[index] = pointCopy(p);
                }
+               recalculateEffectivePath();
+               callPathChangedListeners();
        }
 
        public void removePathPoint(int index)
@@ -435,6 +437,8 @@ public class GUIWire
                        if (index < oldPath.length - 1)
                                System.arraycopy(oldPath, index + 1, path, index, oldPath.length - index - 1);
                }
+               recalculateEffectivePath();
+               callPathChangedListeners();
        }
 
        public double[] getEffectivePath()