revert border color changes

This commit is contained in:
bancika
2020-04-13 15:29:01 +02:00
parent 9963b7b3d3
commit f299106430
6 changed files with 296 additions and 287 deletions
@@ -2954,10 +2954,6 @@
<changeType>IMPROVEMENT</changeType> <changeType>IMPROVEMENT</changeType>
<description>Prevent the app from closing while running background operations, like saving and exporting files</description> <description>Prevent the app from closing while running background operations, like saving and exporting files</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Automatically determine border color of board components</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change> <org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType> <changeType>BUG_FIX</changeType>
<description>Fixed the issue with "Highlight Connected Areas" not recognizing some conductive areas</description> <description>Fixed the issue with "Highlight Connected Areas" not recognizing some conductive areas</description>
@@ -46,6 +46,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static Color BOARD_COLOR = Color.decode("#F8EBB3"); public static Color BOARD_COLOR = Color.decode("#F8EBB3");
public static Color BORDER_COLOR = BOARD_COLOR.darker();
public static Color COORDINATE_COLOR = Color.gray.brighter(); public static Color COORDINATE_COLOR = Color.gray.brighter();
public static float COORDINATE_FONT_SIZE = 9f; public static float COORDINATE_FONT_SIZE = 9f;
public static Size DEFAULT_WIDTH = new Size(1.5d, SizeUnit.in); public static Size DEFAULT_WIDTH = new Size(1.5d, SizeUnit.in);
@@ -58,8 +59,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
protected Point secondPoint = new Point(); protected Point secondPoint = new Point();
protected Color boardColor = BOARD_COLOR; protected Color boardColor = BOARD_COLOR;
@Deprecated protected Color borderColor = BORDER_COLOR;
protected Color borderColor;
protected Color coordinateColor = COORDINATE_COLOR; protected Color coordinateColor = COORDINATE_COLOR;
protected Boolean drawCoordinates = null; protected Boolean drawCoordinates = null;
protected CoordinateType xType = CoordinateType.Numbers; protected CoordinateType xType = CoordinateType.Numbers;
@@ -92,7 +92,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
// tracked so far. // tracked so far.
drawingObserver.stopTracking(); drawingObserver.stopTracking();
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: getBoardColor().darker()); : borderColor);
g2d.drawRect(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y); g2d.drawRect(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y);
} }
@@ -167,7 +167,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
drawPoint.x += xOffset; drawPoint.x += xOffset;
StringUtils.drawCenteredText(g2d, label, StringUtils.drawCenteredText(g2d, label,
drawPoint.x, firstPoint.y - 2, drawPoint.x, firstPoint.y + 2,
HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM); HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM);
if (getCoordinateDisplay() == CoordinateDisplay.Both_Sides) { if (getCoordinateDisplay() == CoordinateDisplay.Both_Sides) {
StringUtils.drawCenteredText(g2d, label, StringUtils.drawCenteredText(g2d, label,
@@ -212,6 +212,15 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
this.coordinateColor = coordinateColor; this.coordinateColor = coordinateColor;
} }
@EditableProperty(name = "Border")
public Color getBorderColor() {
return borderColor;
}
public void setBorderColor(Color borderColor) {
this.borderColor = borderColor;
}
@EditableProperty(name = "X") @EditableProperty(name = "X")
public CoordinateType getxType() { public CoordinateType getxType() {
if (xType == null) if (xType == null)
@@ -52,7 +52,7 @@ public class BlankBoard extends AbstractBoard {
int factor = 32 / width; int factor = 32 / width;
g2d.setColor(BOARD_COLOR); g2d.setColor(BOARD_COLOR);
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor); g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
g2d.setColor(BOARD_COLOR.darker()); g2d.setColor(BORDER_COLOR);
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor); g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
} }
@@ -84,7 +84,7 @@ public class BlankBoard extends AbstractBoard {
// tracked so far. // tracked so far.
drawingObserver.stopTracking(); drawingObserver.stopTracking();
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: getBoardColor().darker()); : borderColor);
if (getType() == Type.SQUARE) if (getType() == Type.SQUARE)
g2d.drawRect(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y); g2d.drawRect(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x, finalSecondPoint.y - firstPoint.y);
else else
@@ -49,6 +49,7 @@ public class EyeletBoard extends AbstractBoard {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static Color BOARD_COLOR = Color.decode("#E3EAB4"); public static Color BOARD_COLOR = Color.decode("#E3EAB4");
public static Color BORDER_COLOR = BOARD_COLOR.darker();
public static Color EYELET_COLOR = Color.decode("#C3E4ED"); public static Color EYELET_COLOR = Color.decode("#C3E4ED");
public static Size SPACING = new Size(0.5d, SizeUnit.in); public static Size SPACING = new Size(0.5d, SizeUnit.in);
@@ -62,6 +63,7 @@ public class EyeletBoard extends AbstractBoard {
public EyeletBoard() { public EyeletBoard() {
super(); super();
this.boardColor = BOARD_COLOR; this.boardColor = BOARD_COLOR;
this.borderColor = BORDER_COLOR;
} }
@Override @Override
@@ -131,7 +133,7 @@ public class EyeletBoard extends AbstractBoard {
int factor = 32 / width; int factor = 32 / width;
g2d.setColor(BOARD_COLOR); g2d.setColor(BOARD_COLOR);
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor); g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
g2d.setColor(BOARD_COLOR.darker()); g2d.setColor(BORDER_COLOR);
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor); g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
g2d.setColor(EYELET_COLOR); g2d.setColor(EYELET_COLOR);
g2d.fillOval(width / 4, width / 4, width / 2, width / 2); g2d.fillOval(width / 4, width / 4, width / 2, width / 2);
@@ -51,6 +51,7 @@ public class MarshallPerfBoard extends AbstractBoard {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static Color BOARD_COLOR = Color.decode("#CD8500"); public static Color BOARD_COLOR = Color.decode("#CD8500");
public static Color BORDER_COLOR = BOARD_COLOR.darker();
public static Size SPACING = new Size(3 / 8d, SizeUnit.in); public static Size SPACING = new Size(3 / 8d, SizeUnit.in);
public static Size HOLE_SIZE = new Size(1 / 8d, SizeUnit.in); public static Size HOLE_SIZE = new Size(1 / 8d, SizeUnit.in);
@@ -60,6 +61,7 @@ public class MarshallPerfBoard extends AbstractBoard {
public MarshallPerfBoard() { public MarshallPerfBoard() {
super(); super();
this.boardColor = BOARD_COLOR; this.boardColor = BOARD_COLOR;
this.borderColor = BORDER_COLOR;
} }
@Override @Override
@@ -88,7 +90,7 @@ public class MarshallPerfBoard extends AbstractBoard {
p.x += spacing; p.x += spacing;
g2d.setColor(Constants.CANVAS_COLOR); g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter, holeDiameter); g2d.fillOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter, holeDiameter);
g2d.setColor(getBoardColor().darker()); g2d.setColor(borderColor);
g2d.drawOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter, holeDiameter); g2d.drawOval(p.x - holeDiameter / 2, p.y - holeDiameter / 2, holeDiameter, holeDiameter);
} }
} }
@@ -115,34 +117,34 @@ public class MarshallPerfBoard extends AbstractBoard {
int factor = 32 / width; int factor = 32 / width;
g2d.setColor(BOARD_COLOR); g2d.setColor(BOARD_COLOR);
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor); g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
g2d.setColor(BOARD_COLOR.darker()); g2d.setColor(BORDER_COLOR);
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor); g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
g2d.setColor(Constants.CANVAS_COLOR); g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor), g2d.fillOval(width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
getClosestOdd(5.0 / factor)); getClosestOdd(5.0 / factor));
g2d.setColor(BOARD_COLOR.darker()); g2d.setColor(BORDER_COLOR);
g2d.drawOval(width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor), g2d.drawOval(width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
getClosestOdd(5.0 / factor)); getClosestOdd(5.0 / factor));
g2d.setColor(Constants.CANVAS_COLOR); g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(2 * width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor), g2d.fillOval(2 * width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
getClosestOdd(5.0 / factor)); getClosestOdd(5.0 / factor));
g2d.setColor(BOARD_COLOR.darker()); g2d.setColor(BORDER_COLOR);
g2d.drawOval(2 * width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor), g2d.drawOval(2 * width / 3 - 2 / factor, width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
getClosestOdd(5.0 / factor)); getClosestOdd(5.0 / factor));
g2d.setColor(Constants.CANVAS_COLOR); g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor), g2d.fillOval(width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
getClosestOdd(5.0 / factor)); getClosestOdd(5.0 / factor));
g2d.setColor(BOARD_COLOR.darker()); g2d.setColor(BORDER_COLOR);
g2d.drawOval(width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor), g2d.drawOval(width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
getClosestOdd(5.0 / factor)); getClosestOdd(5.0 / factor));
g2d.setColor(Constants.CANVAS_COLOR); g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(2 * width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor), g2d.fillOval(2 * width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
getClosestOdd(5.0 / factor)); getClosestOdd(5.0 / factor));
g2d.setColor(BOARD_COLOR.darker()); g2d.setColor(BORDER_COLOR);
g2d.drawOval(2 * width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor), g2d.drawOval(2 * width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, getClosestOdd(5.0 / factor),
getClosestOdd(5.0 / factor)); getClosestOdd(5.0 / factor));
} }
@@ -126,7 +126,7 @@ public class PerfBoard extends AbstractBoard {
int factor = 32 / width; int factor = 32 / width;
g2d.setColor(BOARD_COLOR); g2d.setColor(BOARD_COLOR);
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor); g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
g2d.setColor(BOARD_COLOR.darker()); g2d.setColor(BORDER_COLOR);
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor); g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
g2d.setColor(COPPER_COLOR); g2d.setColor(COPPER_COLOR);
g2d.fillOval(width / 4, width / 4, width / 2, width / 2); g2d.fillOval(width / 4, width / 4, width / 2, width / 2);