mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
pickup improvements
This commit is contained in:
@@ -62,10 +62,13 @@ public class HumbuckerPickup extends AbstractTransparentComponent<String> {
|
|||||||
transient Shape[] body;
|
transient Shape[] body;
|
||||||
private Orientation orientation = Orientation.DEFAULT;
|
private Orientation orientation = Orientation.DEFAULT;
|
||||||
private Color color = BASE_COLOR;
|
private Color color = BASE_COLOR;
|
||||||
|
private Color poleColor = METAL_COLOR;
|
||||||
private HumbuckerType type;
|
private HumbuckerType type;
|
||||||
private boolean cover;
|
private boolean cover;
|
||||||
private Color bobinColor1 = BOBIN_COLOR1;
|
private Color bobinColor1 = BOBIN_COLOR1;
|
||||||
private Color bobinColor2 = BOBIN_COLOR2;
|
private Color bobinColor2 = BOBIN_COLOR2;
|
||||||
|
private PolePieceType coilType1;
|
||||||
|
private PolePieceType coilType2;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||||
@@ -114,9 +117,9 @@ public class HumbuckerPickup extends AbstractTransparentComponent<String> {
|
|||||||
g2d.draw(body[0]);
|
g2d.draw(body[0]);
|
||||||
g2d.draw(body[1]);
|
g2d.draw(body[1]);
|
||||||
if (!outlineMode && componentState != ComponentState.DRAGGING) {
|
if (!outlineMode && componentState != ComponentState.DRAGGING) {
|
||||||
g2d.setColor(METAL_COLOR);
|
g2d.setColor(getPoleColor());
|
||||||
g2d.fill(body[3]);
|
g2d.fill(body[3]);
|
||||||
g2d.setColor(METAL_COLOR.darker());
|
g2d.setColor(darkerOrLighter(getPoleColor()));
|
||||||
g2d.draw(body[3]);
|
g2d.draw(body[3]);
|
||||||
|
|
||||||
if (body[4] != null) {
|
if (body[4] != null) {
|
||||||
@@ -196,19 +199,35 @@ public class HumbuckerPickup extends AbstractTransparentComponent<String> {
|
|||||||
int coilMargin = (width - coilSpacing) / 2;
|
int coilMargin = (width - coilSpacing) / 2;
|
||||||
int poleMargin = (length - poleSpacing * 5) / 2;
|
int poleMargin = (length - poleSpacing * 5) / 2;
|
||||||
Area poleArea = new Area();
|
Area poleArea = new Area();
|
||||||
for (int i = 0; i < 6; i++) {
|
|
||||||
if (getType() == HumbuckerType.PAF || !getCover()) {
|
if (getCoilType1() == PolePieceType.Rail) {
|
||||||
|
poleArea.add(new Area(
|
||||||
|
new RoundRectangle2D.Double(x + pointMargin - length + poleMargin - poleSize / 2, y - pointMargin
|
||||||
|
+ coilMargin - poleSize / 2, poleSpacing * 5 + poleSize, poleSize, poleSize / 2, poleSize / 2)));
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
if (getType() == HumbuckerType.PAF || !getCover()) {
|
||||||
|
Ellipse2D pole =
|
||||||
|
new Ellipse2D.Double(x + pointMargin - length + poleMargin + i * poleSpacing - poleSize / 2, y
|
||||||
|
- pointMargin + coilMargin - poleSize / 2, poleSize, poleSize);
|
||||||
|
poleArea.add(new Area(pole));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getCoilType2() == PolePieceType.Rail) {
|
||||||
|
poleArea.add(new Area(new RoundRectangle2D.Double(x + pointMargin - length + poleMargin - poleSize / 2, y
|
||||||
|
- pointMargin + width - coilMargin - poleSize / 2, poleSpacing * 5 + poleSize, poleSize, poleSize / 2,
|
||||||
|
poleSize / 2)));
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
Ellipse2D pole =
|
Ellipse2D pole =
|
||||||
new Ellipse2D.Double(x + pointMargin - length + poleMargin + i * poleSpacing - poleSize / 2, y
|
new Ellipse2D.Double(x + pointMargin - length + poleMargin + i * poleSpacing - poleSize / 2, y
|
||||||
- pointMargin + coilMargin - poleSize / 2, poleSize, poleSize);
|
- pointMargin + width - coilMargin - poleSize / 2, poleSize, poleSize);
|
||||||
poleArea.add(new Area(pole));
|
poleArea.add(new Area(pole));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ellipse2D pole =
|
|
||||||
new Ellipse2D.Double(x + pointMargin - length + poleMargin + i * poleSpacing - poleSize / 2, y
|
|
||||||
- pointMargin + width - coilMargin - poleSize / 2, poleSize, poleSize);
|
|
||||||
poleArea.add(new Area(pole));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body[3] = poleArea;
|
body[3] = poleArea;
|
||||||
|
|
||||||
// Rotate if needed
|
// Rotate if needed
|
||||||
@@ -264,8 +283,10 @@ public class HumbuckerPickup extends AbstractTransparentComponent<String> {
|
|||||||
int poleSize = 2;
|
int poleSize = 2;
|
||||||
int poleSpacing = 17 * width / 32;
|
int poleSpacing = 17 * width / 32;
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
g2d.fillOval((width - poleSize - baseWidth / 2) / 2, (height - poleSpacing) / 2 + (i * poleSpacing / 5), poleSize, poleSize);
|
g2d.fillOval((width - poleSize - baseWidth / 2) / 2, (height - poleSpacing) / 2 + (i * poleSpacing / 5),
|
||||||
g2d.fillOval((width - poleSize + baseWidth / 2) / 2, (height - poleSpacing) / 2 + (i * poleSpacing / 5), poleSize, poleSize);
|
poleSize, poleSize);
|
||||||
|
g2d.fillOval((width - poleSize + baseWidth / 2) / 2, (height - poleSpacing) / 2 + (i * poleSpacing / 5),
|
||||||
|
poleSize, poleSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,6 +394,45 @@ public class HumbuckerPickup extends AbstractTransparentComponent<String> {
|
|||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Pole Color")
|
||||||
|
public Color getPoleColor() {
|
||||||
|
if (poleColor == null)
|
||||||
|
poleColor = METAL_COLOR;
|
||||||
|
return poleColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoleColor(Color poleColor) {
|
||||||
|
this.poleColor = poleColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Pole Pieces 1")
|
||||||
|
public PolePieceType getCoilType1() {
|
||||||
|
if (coilType1 == null) {
|
||||||
|
return PolePieceType.Rods;
|
||||||
|
}
|
||||||
|
return coilType1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoilType1(PolePieceType coilType1) {
|
||||||
|
this.coilType1 = coilType1;
|
||||||
|
// Invalidate the body
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Pole Pieces 2")
|
||||||
|
public PolePieceType getCoilType2() {
|
||||||
|
if (coilType2 == null) {
|
||||||
|
return PolePieceType.Rods;
|
||||||
|
}
|
||||||
|
return coilType2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoilType2(PolePieceType coilType2) {
|
||||||
|
this.coilType2 = coilType2;
|
||||||
|
// Invalidate the body
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
public static enum HumbuckerType {
|
public static enum HumbuckerType {
|
||||||
|
|
||||||
PAF(WIDTH, LENGTH), Mini(WIDTH_MINI, LENGTH_MINI);
|
PAF(WIDTH, LENGTH), Mini(WIDTH_MINI, LENGTH_MINI);
|
||||||
@@ -398,4 +458,8 @@ public class HumbuckerPickup extends AbstractTransparentComponent<String> {
|
|||||||
return name();
|
return name();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum PolePieceType {
|
||||||
|
Rods, Rail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ public class P90Pickup extends AbstractTransparentComponent<String> {
|
|||||||
private Orientation orientation = Orientation.DEFAULT;
|
private Orientation orientation = Orientation.DEFAULT;
|
||||||
private Color color = BODY_COLOR;
|
private Color color = BODY_COLOR;
|
||||||
private P90Type type = P90Type.DOG_EAR;
|
private P90Type type = P90Type.DOG_EAR;
|
||||||
|
private Color poleColor = METAL_COLOR;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||||
@@ -108,9 +109,9 @@ public class P90Pickup extends AbstractTransparentComponent<String> {
|
|||||||
if (body[1] != null)
|
if (body[1] != null)
|
||||||
g2d.draw(body[1]);
|
g2d.draw(body[1]);
|
||||||
if (!outlineMode && componentState != ComponentState.DRAGGING) {
|
if (!outlineMode && componentState != ComponentState.DRAGGING) {
|
||||||
g2d.setColor(METAL_COLOR);
|
g2d.setColor(getPoleColor());
|
||||||
g2d.fill(body[3]);
|
g2d.fill(body[3]);
|
||||||
g2d.setColor(METAL_COLOR.darker());
|
g2d.setColor(darkerOrLighter(getPoleColor()));
|
||||||
g2d.draw(body[3]);
|
g2d.draw(body[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,6 +319,17 @@ public class P90Pickup extends AbstractTransparentComponent<String> {
|
|||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Pole Color")
|
||||||
|
public Color getPoleColor() {
|
||||||
|
if (poleColor == null)
|
||||||
|
poleColor = METAL_COLOR;
|
||||||
|
return poleColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoleColor(Color poleColor) {
|
||||||
|
this.poleColor = poleColor;
|
||||||
|
}
|
||||||
|
|
||||||
public enum P90Type {
|
public enum P90Type {
|
||||||
DOG_EAR("Dog Ear", DOG_EAR_LENGTH, DOG_EAR_WIDTH, DOG_EAR_EDGE_RADIUS), SOAP_BAR("Soap Bar", SOAP_BAR_LENGTH,
|
DOG_EAR("Dog Ear", DOG_EAR_LENGTH, DOG_EAR_WIDTH, DOG_EAR_EDGE_RADIUS), SOAP_BAR("Soap Bar", SOAP_BAR_LENGTH,
|
||||||
SOAP_BAR_WIDTH, SOAP_BAR_EDGE_RADIUS);
|
SOAP_BAR_WIDTH, SOAP_BAR_EDGE_RADIUS);
|
||||||
|
|||||||
Binary file not shown.
@@ -1590,6 +1590,14 @@
|
|||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Editable single coil pickup pole pieces (rods or rails) and pole piece color</description>
|
<description>Editable single coil pickup pole pieces (rods or rails) and pole piece color</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Editable humbucker pickup pole pieces (rods or rails) and pole piece color</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Editable P90 pickup pole piece color</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>Component type gets selected while expanding folders in the component tree</description>
|
<description>Component type gets selected while expanding folders in the component tree</description>
|
||||||
|
|||||||
Reference in New Issue
Block a user