use red when selected

This commit is contained in:
bancika
2011-01-11 21:22:07 +00:00
parent e3a3dfe82e
commit 070e3edf52
7 changed files with 21 additions and 9 deletions
@@ -6,6 +6,7 @@ import java.awt.Graphics2D;
import java.awt.Shape;
import org.diylc.components.AbstractLeadedComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
@@ -32,8 +33,9 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
@Override
@EditableProperty(name = "Color")
public Color getLeadColor() {
return leadColor;
public Color getLeadColor(ComponentState componentState) {
return componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : leadColor;
}
public void setLeadColor(Color leadColor) {
@@ -6,8 +6,10 @@ import java.awt.Graphics2D;
import java.awt.Shape;
import org.diylc.components.AbstractLeadedComponent;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.annotations.ComponentDescriptor;
import org.diylc.core.annotations.EditableProperty;
import org.diylc.core.measures.Size;
@ComponentDescriptor(name = "Jumper", author = "Branislav Stojkovic", category = "Connectivity", instanceNamePrefix = "J", description = "", zOrder = IDIYComponent.ABOVE_BOARD)
@@ -25,8 +27,10 @@ public class Jumper extends AbstractLeadedComponent<Void> {
}
@Override
protected Color getLeadColor() {
return COLOR;
@EditableProperty(name = "Color")
public Color getLeadColor(ComponentState componentState) {
return componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : COLOR;
}
@Deprecated
@@ -31,7 +31,8 @@ public class SolderPad extends AbstractComponent<Color> {
public void draw(Graphics2D g2d, ComponentState componentState, Project project) {
int diameter = getClosestOdd(size.convertToPixels());
int holeDiameter = getClosestOdd(HOLE_SIZE.convertToPixels());
g2d.setColor(color);
g2d.setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color);
g2d.fillOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
g2d.setColor(Constants.CANVAS_COLOR);
g2d.fillOval(point.x - holeDiameter / 2, point.y - holeDiameter / 2, holeDiameter,
@@ -21,6 +21,7 @@ public class TraceCut extends AbstractSinglePointComponent {
public static Size SIZE = new Size(0.085d, SizeUnit.in);
public static Color FILL_COLOR = Color.white;
public static Color BORDER_COLOR = Color.red;
public static Color SELECTION_COLOR = Color.blue;
private Size size = SIZE;
private Color fillColor = FILL_COLOR;
@@ -32,7 +33,8 @@ public class TraceCut extends AbstractSinglePointComponent {
int dotDiameter = (size / 3 * 2) / 2 * 2 + 1;
g2d.setColor(fillColor);
g2d.fillRect(point.x - size / 2, point.y - size / 2, size, size);
g2d.setColor(borderColor);
g2d.setColor(componentState == ComponentState.SELECTED
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
g2d.setStroke(new BasicStroke(1));
g2d.drawRect(point.x - size / 2, point.y - size / 2, size, size);
g2d