mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Editable lead color; changed default lead color
This commit is contained in:
Binary file not shown.
+8
-7
@@ -25,10 +25,14 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
|
|||||||
public static Size THICKNESS = new Size(1d, SizeUnit.mm);
|
public static Size THICKNESS = new Size(1d, SizeUnit.mm);
|
||||||
public static Color COLOR = Color.black;
|
public static Color COLOR = Color.black;
|
||||||
|
|
||||||
private Color leadColor = COLOR;
|
|
||||||
private Size thickness = THICKNESS;
|
private Size thickness = THICKNESS;
|
||||||
private PCBLayer layer = PCBLayer._1;
|
private PCBLayer layer = PCBLayer._1;
|
||||||
|
|
||||||
|
public CopperTrace() {
|
||||||
|
super();
|
||||||
|
this.leadColor = COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(3));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(3));
|
||||||
@@ -37,9 +41,9 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Color getLeadColor(ComponentState componentState) {
|
protected Color getLeadColorForPainting(ComponentState componentState) {
|
||||||
return componentState == ComponentState.SELECTED
|
return componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : leadColor;
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : getLeadColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,15 +51,12 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
|
|||||||
return VisibilityPolicy.WHEN_SELECTED;
|
return VisibilityPolicy.WHEN_SELECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@EditableProperty(name = "Color")
|
@EditableProperty(name = "Color")
|
||||||
public Color getLeadColor() {
|
public Color getLeadColor() {
|
||||||
return leadColor;
|
return leadColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLeadColor(Color leadColor) {
|
|
||||||
this.leadColor = leadColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Width")
|
@EditableProperty(name = "Width")
|
||||||
public Size getThickness() {
|
public Size getThickness() {
|
||||||
return thickness;
|
return thickness;
|
||||||
|
|||||||
+35
-10
@@ -4,6 +4,7 @@ import java.awt.Color;
|
|||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
|
|
||||||
|
import org.diylc.common.Display;
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
@@ -21,7 +22,13 @@ public class Jumper extends AbstractLeadedComponent<Void> {
|
|||||||
|
|
||||||
public static Color COLOR = Color.blue;
|
public static Color COLOR = Color.blue;
|
||||||
|
|
||||||
private Color color = COLOR;
|
@Deprecated
|
||||||
|
private Color color;
|
||||||
|
|
||||||
|
public Jumper() {
|
||||||
|
super();
|
||||||
|
this.leadColor = COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
@@ -34,18 +41,18 @@ public class Jumper extends AbstractLeadedComponent<Void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Color getLeadColor(ComponentState componentState) {
|
public Color getLeadColorForPainting(ComponentState componentState) {
|
||||||
return componentState == ComponentState.SELECTED
|
return componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color;
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : getLeadColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@Override
|
||||||
public Color getColor() {
|
@EditableProperty(name = "Color")
|
||||||
return color;
|
public Color getLeadColor() {
|
||||||
}
|
if (color != null) {
|
||||||
|
this.leadColor = color;
|
||||||
public void setColor(Color color) {
|
}
|
||||||
this.color = color;
|
return super.getLeadColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color getBodyColor() {
|
public Color getBodyColor() {
|
||||||
@@ -95,4 +102,22 @@ public class Jumper extends AbstractLeadedComponent<Void> {
|
|||||||
protected Size getDefaultLength() {
|
protected Size getDefaultLength() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public Color getLabelColor() {
|
||||||
|
return super.getLabelColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return super.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public Display getDisplay() {
|
||||||
|
return super.getDisplay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-1
@@ -4,6 +4,7 @@ import java.awt.Color;
|
|||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
|
|
||||||
|
import org.diylc.common.Display;
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.components.AbstractLeadedComponent;
|
import org.diylc.components.AbstractLeadedComponent;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
@@ -42,11 +43,16 @@ public class Line extends AbstractLeadedComponent<Void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Color getLeadColor(ComponentState componentState) {
|
public Color getLeadColorForPainting(ComponentState componentState) {
|
||||||
return componentState == ComponentState.SELECTED
|
return componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color;
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getLeadColor() {
|
||||||
|
return super.getLeadColor();
|
||||||
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
return color;
|
return color;
|
||||||
@@ -103,4 +109,22 @@ public class Line extends AbstractLeadedComponent<Void> {
|
|||||||
protected Size getDefaultLength() {
|
protected Size getDefaultLength() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public Color getLabelColor() {
|
||||||
|
return super.getLabelColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return super.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
@Override
|
||||||
|
public Display getDisplay() {
|
||||||
|
return super.getDisplay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -4,6 +4,7 @@ import java.awt.Color;
|
|||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
|
||||||
|
import org.diylc.common.Display;
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.components.AbstractComponent;
|
import org.diylc.components.AbstractComponent;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
@@ -126,6 +127,7 @@ public class TraceCut extends AbstractComponent<Void> {
|
|||||||
this.borderColor = borderColor;
|
this.borderColor = borderColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return super.getName();
|
return super.getName();
|
||||||
|
|||||||
Reference in New Issue
Block a user