diff --git a/diylc/diylc-core/src/org/diylc/components/AbstractComponent.java b/diylc/diylc-core/src/org/diylc/components/AbstractComponent.java index c799d1f3..5126a647 100644 --- a/diylc/diylc-core/src/org/diylc/components/AbstractComponent.java +++ b/diylc/diylc-core/src/org/diylc/components/AbstractComponent.java @@ -42,6 +42,7 @@ public abstract class AbstractComponent implements IDIYComponent { public static Color LABEL_COLOR_SELECTED = Color.red; public static Font LABEL_FONT = new Font("Tahoma", Font.PLAIN, 14); public static Color METAL_COLOR = Color.decode("#236B8E"); + public static Color COPPER_COLOR = Color.decode("#DA8A67"); @EditableProperty(defaultable = false) @Override diff --git a/diylc/diylc-library/lib/diylc-core.jar b/diylc/diylc-library/lib/diylc-core.jar index f7d7dba7..27fcca1a 100644 Binary files a/diylc/diylc-library/lib/diylc-core.jar and b/diylc/diylc-library/lib/diylc-core.jar differ diff --git a/diylc/diylc-library/src/org/diylc/components/boards/AbstractBoard.java b/diylc/diylc-library/src/org/diylc/components/boards/AbstractBoard.java index 2fb5f8a8..e2651a25 100644 --- a/diylc/diylc-library/src/org/diylc/components/boards/AbstractBoard.java +++ b/diylc/diylc-library/src/org/diylc/components/boards/AbstractBoard.java @@ -79,7 +79,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent t = 1; while (p.x < secondPoint.x - spacing) { p.x += spacing; - super.drawCenteredText(g2d, getCoordinateLabel(t++), p.x, p.y - 2, HorizontalAlignment.CENTER, + super.drawCenteredText(g2d, Integer.toString(t++), p.x, p.y - 2, HorizontalAlignment.CENTER, VerticalAlignment.TOP); } } diff --git a/diylc/diylc-library/src/org/diylc/components/boards/TriPadBoard.java b/diylc/diylc-library/src/org/diylc/components/boards/TriPadBoard.java index c2ba28cc..83c38db2 100644 --- a/diylc/diylc-library/src/org/diylc/components/boards/TriPadBoard.java +++ b/diylc/diylc-library/src/org/diylc/components/boards/TriPadBoard.java @@ -26,8 +26,7 @@ import org.diylc.utils.Constants; public class TriPadBoard extends AbstractBoard { private static final long serialVersionUID = 1L; - - public static Color STRIP_COLOR = Color.decode("#DA8A67"); + public static Color BORDER_COLOR = BOARD_COLOR.darker(); public static Size SPACING = new Size(0.1d, SizeUnit.in); @@ -37,7 +36,7 @@ public class TriPadBoard extends AbstractBoard { protected int stripSpan = 3; // determines how many holes are covered by a // strip protected Size spacing = SPACING; - protected Color stripColor = STRIP_COLOR; + protected Color stripColor = COPPER_COLOR; protected OrientationHV orientation = OrientationHV.HORIZONTAL; @Override @@ -132,6 +131,8 @@ public class TriPadBoard extends AbstractBoard { } } g2d.setComposite(oldComposite); + + super.drawCoordinates(g2d, spacing); } } @@ -174,10 +175,10 @@ public class TriPadBoard extends AbstractBoard { final int verticalIndent = verticalSpacing / 2; for (int row = 0; row < 5; row++) { - g2d.setColor(STRIP_COLOR); + g2d.setColor(COPPER_COLOR); g2d.fillRect(0, row * verticalSpacing + 2, horizontalIndent / 2 + horizontalSpacing, verticalSpacing - 1); - g2d.setColor(STRIP_COLOR); + g2d.setColor(COPPER_COLOR); g2d.fillRect(horizontalSpacing + 2, row * verticalSpacing + 2, horizontalSpacing * 3 - 1, verticalSpacing - 1); g2d.fillRect(horizontalSpacing * 4 + 2, row * verticalSpacing + 2, horizontalIndent / 2 + horizontalSpacing, @@ -191,7 +192,7 @@ public class TriPadBoard extends AbstractBoard { int x = (horizontalSpacing * col) + horizontalIndent; g2d.setColor(Constants.CANVAS_COLOR); g2d.fillOval(x, y, 2, 2); - g2d.setColor(STRIP_COLOR.darker()); + g2d.setColor(COPPER_COLOR.darker()); g2d.drawOval(x, y, 2, 2); } } diff --git a/diylc/diylc-library/src/org/diylc/components/boards/VeroBoard.java b/diylc/diylc-library/src/org/diylc/components/boards/VeroBoard.java index 8edcf940..d0e69eaf 100644 --- a/diylc/diylc-library/src/org/diylc/components/boards/VeroBoard.java +++ b/diylc/diylc-library/src/org/diylc/components/boards/VeroBoard.java @@ -28,7 +28,6 @@ public class VeroBoard extends AbstractBoard { private static final long serialVersionUID = 1L; - public static Color STRIP_COLOR = Color.decode("#DA8A67"); public static Color BORDER_COLOR = BOARD_COLOR.darker(); public static Size SPACING = new Size(0.1d, SizeUnit.in); @@ -36,7 +35,7 @@ public class VeroBoard extends AbstractBoard { public static Size HOLE_SIZE = new Size(0.7d, SizeUnit.mm); protected Size spacing = SPACING; - protected Color stripColor = STRIP_COLOR; + protected Color stripColor = COPPER_COLOR; protected OrientationHV orientation = OrientationHV.HORIZONTAL; @Override @@ -127,19 +126,27 @@ public class VeroBoard extends AbstractBoard { public void drawIcon(Graphics2D g2d, int width, int height) { int factor = 32 / width; g2d.setColor(BOARD_COLOR); - g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor); + g2d.fillRect(0, 2 / factor, width - 1, height - 4 / factor); g2d.setColor(BORDER_COLOR); - g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor); - g2d.setColor(STRIP_COLOR); - g2d.fillRect(4 / factor, width / 4, width - 8 / factor, width / 2); - g2d.setColor(STRIP_COLOR.darker()); - g2d.drawRect(4 / factor, width / 4, width - 8 / factor, width / 2); + g2d.drawRect(0, 2 / factor, width - 1, height - 4 / factor); + g2d.setColor(COPPER_COLOR); + g2d.fillRect(1 / factor, width / 4, width - 2 / factor, width / 2); + g2d.setColor(COPPER_COLOR.darker()); + g2d.drawRect(1 / factor, width / 4, width - 2 / factor, width / 2); + + g2d.setColor(COPPER_COLOR); + g2d.fillRect(1 / factor, 2 / factor, width - 2 / factor, 3 / factor); + g2d.fillRect(1 / factor, height - 5 / factor, width - 2 / factor, 3 / factor); + g2d.setColor(COPPER_COLOR.darker()); + g2d.drawRect(1 / factor, 2 / factor, width - 2 / factor, 3 / factor); + g2d.drawRect(1 / factor, height - 5 / factor, width - 2 / factor, 3 / factor); + g2d.setColor(Constants.CANVAS_COLOR); g2d.fillOval(width / 3 - 2 / factor, width / 2 - 2 / factor, getClosestOdd(5.0 / factor), getClosestOdd(5.0 / factor)); g2d.fillOval(2 * width / 3 - 2 / factor, width / 2 - 2 / factor, getClosestOdd(5.0 / factor), getClosestOdd(5.0 / factor)); - g2d.setColor(STRIP_COLOR.darker()); + g2d.setColor(COPPER_COLOR.darker()); g2d.drawOval(width / 3 - 2 / factor, width / 2 - 2 / factor, getClosestOdd(5.0 / factor), getClosestOdd(5.0 / factor)); g2d.drawOval(2 * width / 3 - 2 / factor, width / 2 - 2 / factor, getClosestOdd(5.0 / factor), diff --git a/diylc/diylc-library/src/org/diylc/components/connectivity/TraceCut.java b/diylc/diylc-library/src/org/diylc/components/connectivity/TraceCut.java index 74fc0d11..ce98ab3c 100644 --- a/diylc/diylc-library/src/org/diylc/components/connectivity/TraceCut.java +++ b/diylc/diylc-library/src/org/diylc/components/connectivity/TraceCut.java @@ -4,7 +4,6 @@ import java.awt.Color; import java.awt.Graphics2D; import java.awt.Point; -import org.diylc.common.ObjectCache; import org.diylc.components.AbstractComponent; import org.diylc.components.boards.AbstractBoard; import org.diylc.components.boards.VeroBoard; @@ -18,6 +17,7 @@ import org.diylc.core.annotations.ComponentDescriptor; import org.diylc.core.annotations.EditableProperty; import org.diylc.core.measures.Size; import org.diylc.core.measures.SizeUnit; +import org.diylc.utils.Constants; @ComponentDescriptor(name = "Trace Cut", category = "Connectivity", author = "Branislav Stojkovic", description = "Designates the place where a trace on the vero board needs to be cut", instanceNamePrefix = "Cut", @@ -26,14 +26,16 @@ public class TraceCut extends AbstractComponent { private static final long serialVersionUID = 1L; - public static Size SIZE = new Size(0.07d, SizeUnit.in); + public static Size SIZE = new Size(0.08d, SizeUnit.in); public static Size CUT_WIDTH = new Size(0.5d, SizeUnit.mm); public static Color FILL_COLOR = Color.white; public static Color BORDER_COLOR = Color.red; - public static Color SELECTION_COLOR = Color.blue; + public static Color SELECTION_COLOR = Color.red; + public static Size HOLE_SIZE = new Size(0.7d, SizeUnit.mm); private Size size = SIZE; private Color fillColor = FILL_COLOR; + @Deprecated private Color borderColor = BORDER_COLOR; private Color boardColor = AbstractBoard.BOARD_COLOR; private Boolean cutBetweenHoles = false; @@ -55,27 +57,49 @@ public class TraceCut extends AbstractComponent { : boardColor); g2d.fillRect(point.x - holeSpacing / 2 - cutWidth / 2, point.y - size / 2 - 1, cutWidth, size + 2); } else { - int dotDiameter = size - 6; - g2d.setColor(fillColor); - g2d.fillRect(point.x - size / 2, point.y - size / 2, size, size); g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR - : borderColor); - g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1)); - g2d.drawRect(point.x - size / 2, point.y - size / 2, size, size); - g2d.fillOval(point.x - dotDiameter / 2, point.y - dotDiameter / 2, dotDiameter, dotDiameter); + : boardColor); + g2d.fillRoundRect(point.x - size / 2, point.y - size / 2, size, size, size, size); + + g2d.setColor(Constants.CANVAS_COLOR); + int holeSize = getClosestOdd((int) HOLE_SIZE.convertToPixels()); + g2d.fillOval(point.x - holeSize / 2, point.y - holeSize / 2, holeSize, holeSize); + g2d.setColor(boardColor.darker()); + g2d.drawOval(point.x - holeSize / 2, point.y - holeSize / 2, holeSize, holeSize); } } @Override public void drawIcon(Graphics2D g2d, int width, int height) { - int size = 16; - int dotDiameter = size / 4 * 2; - g2d.setColor(FILL_COLOR); - g2d.fillRect((width - size) / 2, (height - size) / 2, size, size); - g2d.setColor(BORDER_COLOR); - g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1)); - g2d.drawRect((width - size) / 2, (height - size) / 2, size, size); - g2d.fillOval((width - dotDiameter) / 2, (height - dotDiameter) / 2, dotDiameter, dotDiameter); + int factor = 32 / width; + g2d.setColor(AbstractBoard.BOARD_COLOR); + g2d.fillRect(0, 2 / factor, width - 1, height - 4 / factor); + g2d.setColor(AbstractBoard.BORDER_COLOR); + g2d.drawRect(0, 2 / factor, width - 1, height - 4 / factor); + g2d.setColor(COPPER_COLOR); + g2d.fillRect(1 / factor, width / 3, width - 2 / factor, getClosestOdd(width / 3) + 1); + g2d.setColor(COPPER_COLOR.darker()); + g2d.drawRect(1 / factor, width / 3, width - 2 / factor, getClosestOdd(width / 3) + 1); + + g2d.setColor(AbstractBoard.BOARD_COLOR); + g2d.fillRoundRect(width / 3, width / 3, getClosestOdd(width / 3) + 2, getClosestOdd(width / 3) + 2, width / 3, + width / 3); + + g2d.setColor(COPPER_COLOR); + g2d.fillRect(1 / factor, 2 / factor, width - 2 / factor, 4 / factor); + g2d.fillRect(1 / factor, height - 6 / factor, width - 2 / factor, 4 / factor); + g2d.setColor(COPPER_COLOR.darker()); + g2d.drawRect(1 / factor, 2 / factor, width - 2 / factor, 4 / factor); + g2d.drawRect(1 / factor, height - 6 / factor, width - 2 / factor, 4 / factor); + + g2d.setColor(Constants.CANVAS_COLOR); + g2d.fillOval(width / 6 - 1, width / 2 - 1, getClosestOdd(3.0 / factor), getClosestOdd(3.0 / factor)); + g2d.fillOval(width / 2 - 1, width / 2 - 1, getClosestOdd(3.0 / factor), getClosestOdd(3.0 / factor)); + g2d.fillOval(5 * width / 6 - 1, width / 2 - 1, getClosestOdd(3.0 / factor), getClosestOdd(3.0 / factor)); + g2d.setColor(COPPER_COLOR.darker()); + g2d.drawOval(width / 6 - 1, width / 2 - 1, getClosestOdd(3.0 / factor), getClosestOdd(3.0 / factor)); + g2d.drawOval(width / 2 - 1, width / 2 - 1, getClosestOdd(3.0 / factor), getClosestOdd(3.0 / factor)); + g2d.drawOval(5 * width / 6 - 1, width / 2 - 1, getClosestOdd(3.0 / factor), getClosestOdd(3.0 / factor)); } @Override @@ -129,11 +153,12 @@ public class TraceCut extends AbstractComponent { this.fillColor = fillColor; } - @EditableProperty(name = "Border") + @Deprecated public Color getBorderColor() { return borderColor; } + @Deprecated public void setBorderColor(Color borderColor) { this.borderColor = borderColor; } diff --git a/diylc/diylc-swing/lib/diylc-core.jar b/diylc/diylc-swing/lib/diylc-core.jar index f7d7dba7..27fcca1a 100644 Binary files a/diylc/diylc-swing/lib/diylc-core.jar and b/diylc/diylc-swing/lib/diylc-core.jar differ diff --git a/diylc/diylc-swing/library/main.jar b/diylc/diylc-swing/library/main.jar index d393bb23..c36d11a9 100644 Binary files a/diylc/diylc-swing/library/main.jar and b/diylc/diylc-swing/library/main.jar differ diff --git a/diylc/diylc-swing/src/org/diylc/swing/plugins/tree/TreePanel.java b/diylc/diylc-swing/src/org/diylc/swing/plugins/tree/TreePanel.java index 8c85db3c..4d102b18 100644 --- a/diylc/diylc-swing/src/org/diylc/swing/plugins/tree/TreePanel.java +++ b/diylc/diylc-swing/src/org/diylc/swing/plugins/tree/TreePanel.java @@ -197,19 +197,18 @@ public class TreePanel extends JPanel { @Override public void mouseClicked(MouseEvent e) { + TreePath path = tree.getClosestPathForLocation(e.getX(), e.getY()); + DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); + if (node != null && node.getUserObject() != null) { + Payload payload = (Payload) node.getUserObject(); + if (payload.getComponentType() != null) { + plugInPort.setNewComponentTypeSlot(payload.getComponentType(), null); + } + } if (SwingUtilities.isRightMouseButton(e)) { int row = tree.getClosestRowForLocation(e.getX(), e.getY()); tree.setSelectionRow(row); getPopup().show(e.getComponent(), e.getX(), e.getY()); - } else { - TreePath path = tree.getClosestPathForLocation(e.getX(), e.getY()); - DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); - if (node != null && node.getUserObject() != null) { - Payload payload = (Payload) node.getUserObject(); - if (payload.getComponentType() != null) { - plugInPort.setNewComponentTypeSlot(payload.getComponentType(), null); - } - } } } }); diff --git a/diylc/diylc-swing/update.xml b/diylc/diylc-swing/update.xml index f167a538..0d9a25d4 100644 --- a/diylc/diylc-swing/update.xml +++ b/diylc/diylc-swing/update.xml @@ -1470,6 +1470,14 @@ NEW_FEATURE Mini humbucker pickup added as a variation of Humbucker pickup + + IMPROVEMENT + X-axis coordinates for all perfboards are now numberical + + + IMPROVEMENT + Improved trace cut rendering to look more natural + IMPROVEMENT Improved guitar pickup look @@ -1481,7 +1489,11 @@ BUG_FIX Fixed broken links in the Help menu - + + + BUG_FIX + TriPad board didn't show coordinate labels even when configured to do so + https://github.com/bancika/diy-layout-creator/releases