X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=LogicUI%2Fsrc%2FLogicUI.java;h=3bce12d4acb8106d7b1795db95946d65ced6f510;hb=2fed19adf0824a372e1e6cbdf648191f7adac4a3;hp=80c8522d907d00fcccfab21d0c7358d3b51f3b1e;hpb=a906e7bfaefc112579625d186a9fd790bbc758b3;p=Mograsim.git diff --git a/LogicUI/src/LogicUI.java b/LogicUI/src/LogicUI.java index 80c8522d..3bce12d4 100644 --- a/LogicUI/src/LogicUI.java +++ b/LogicUI/src/LogicUI.java @@ -16,6 +16,7 @@ import era.mi.logic.components.Splitter; import era.mi.logic.components.gates.AndGate; import era.mi.logic.components.gates.NotGate; import era.mi.logic.wires.WireArray; +import net.haspamelodica.swt.helper.gcs.GeneralGC; import net.haspamelodica.swt.helper.gcs.TranslatedGC; import net.haspamelodica.swt.helper.swtobjectwrappers.Point; import net.haspamelodica.swt.helper.zoomablecanvas.ZoomableCanvas; @@ -40,8 +41,7 @@ public class LogicUI componentPositions = new HashMap<>(); initComponents(); - canvas.addZoomedRenderer(gc -> components.forEach( - component -> component.render(new TranslatedGC(gc, componentPositions.get(component))))); + canvas.addZoomedRenderer(gc -> components.forEach(component -> drawComponent(gc, component))); new ZoomableCanvasUserInput(canvas).enableUserInput(); new ZoomableCanvasOverlay(canvas, null).enableScale(); } @@ -61,6 +61,18 @@ public class LogicUI components.add(component); componentPositions.put(component, new Point(x, y)); } + private void drawComponent(GeneralGC gc, BasicGUIComponent component) + { + TranslatedGC tgc = new TranslatedGC(gc, componentPositions.get(component)); + component.render(tgc); + tgc.setBackground(display.getSystemColor(SWT.COLOR_BLUE)); + for(int i = 0; i < component.getConnectedWireArraysCount(); i ++) + { + Point connectionPoint = component.getWireArrayConnectionPoint(i); + if(connectionPoint != null) + tgc.fillOval(connectionPoint.x - 2, connectionPoint.y - 2, 4, 4); + } + } public void run() { shell.open();