X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fgui%2FLogicUICanvas.java;h=a5713876cb697c0c0088e8ebb9c4842cc646ab8d;hb=daa558fbbd87e334d370f1a9d791adc6a3c14ca6;hp=c516e0c6d82424bc1293014e0f728b16400e434b;hpb=72d2d3f545040354e99f6761321c0f0365bc5bf1;p=Mograsim.git diff --git a/LogicUI/src/era/mi/gui/LogicUICanvas.java b/LogicUI/src/era/mi/gui/LogicUICanvas.java index c516e0c6..a5713876 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); + } } }