X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fgui%2FLogicUICanvas.java;h=6355044391b9dcfd8448e13bce4b9772b91f2f16;hb=80bfbd8ebf0ad8a7ad98584544a0c73f43e6f3b6;hp=7faefe392f1a3d2b572a6203292ef07b56617a33;hpb=86f2e11d28a4100a7fe142e103b7b5eeb9de4214;p=Mograsim.git diff --git a/LogicUI/src/era/mi/gui/LogicUICanvas.java b/LogicUI/src/era/mi/gui/LogicUICanvas.java index 7faefe39..63550443 100644 --- a/LogicUI/src/era/mi/gui/LogicUICanvas.java +++ b/LogicUI/src/era/mi/gui/LogicUICanvas.java @@ -22,6 +22,8 @@ import net.haspamelodica.swt.helper.zoomablecanvas.ZoomableCanvas; */ public class LogicUICanvas extends ZoomableCanvas { + private static final boolean DRAW_PINS = false; + private final ViewModel model; public LogicUICanvas(Composite parent, int style, ViewModel model) @@ -74,21 +76,25 @@ public class LogicUICanvas extends ZoomableCanvas addZoomedRenderer(gc -> { + gc.setLineWidth(.5); + model.getWires().forEach(w -> w.render(gc)); Rectangle visibleRegion = new Rectangle(offX, offY, gW / zoom, gH / zoom); model.getComponents().forEach(c -> drawComponent(gc, c, visibleRegion)); }); - addZoomedRenderer(gc -> model.getWires().forEach(w -> w.render(gc))); addListener(SWT.MouseDown, this::mouseDown); } private void drawComponent(GeneralGC gc, GUIComponent component, Rectangle visibleRegion) { component.render(gc, visibleRegion); - gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_CYAN)); - for (Pin p : component.getPins()) + if (DRAW_PINS) { - Point pos = p.getPos(); - gc.fillOval(pos.x - 1, pos.y - 1, 2, 2); + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_DARK_CYAN)); + for (Pin p : component.getPins()) + { + Point pos = p.getPos(); + gc.fillOval(pos.x - 1, pos.y - 1, 2, 2); + } } }