diff --git a/diylc/diylc-library/lib/diylc-core.jar b/diylc/diylc-library/lib/diylc-core.jar index 225fea3f..7a02be5b 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/guitar/HumbuckerPickup.java b/diylc/diylc-library/src/org/diylc/components/guitar/HumbuckerPickup.java index 25e66536..61433e2f 100644 --- a/diylc/diylc-library/src/org/diylc/components/guitar/HumbuckerPickup.java +++ b/diylc/diylc-library/src/org/diylc/components/guitar/HumbuckerPickup.java @@ -42,8 +42,11 @@ public class HumbuckerPickup extends AbstractTransparentComponent { private static Color BODY_COLOR = Color.lightGray; private static Color POINT_COLOR = Color.darkGray; + public static Color PIN_COLOR = Color.decode("#C3E4ED"); private static Size WIDTH = new Size(36.5d, SizeUnit.mm); private static Size LENGTH = new Size(68.58d, SizeUnit.mm); + private static Size WIDTH_MINI = new Size(29.3d, SizeUnit.mm); + private static Size LENGTH_MINI = new Size(67.4d, SizeUnit.mm); private static Size LIP_WIDTH = new Size(12.7d, SizeUnit.mm); private static Size LIP_LENGTH = new Size(7.9d, SizeUnit.mm); private static Size EDGE_RADIUS = new Size(4d, SizeUnit.mm); @@ -59,6 +62,7 @@ public class HumbuckerPickup extends AbstractTransparentComponent { transient Shape[] body; private Orientation orientation = Orientation.DEFAULT; private Color color = BODY_COLOR; + private HumbuckerType type; @Override public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project, @@ -96,6 +100,8 @@ public class HumbuckerPickup extends AbstractTransparentComponent { g2d.draw(body[0]); g2d.draw(body[1]); if (!outlineMode) { + g2d.setColor(PIN_COLOR); + g2d.fill(body[3]); g2d.setColor(color.darker()); g2d.draw(body[3]); } @@ -126,8 +132,8 @@ public class HumbuckerPickup extends AbstractTransparentComponent { int x = controlPoint.x; int y = controlPoint.y; - int width = (int) WIDTH.convertToPixels(); - int length = (int) LENGTH.convertToPixels(); + int width = (int) getType().getWidth().convertToPixels(); + int length = (int) getType().getLength().convertToPixels(); int lipWidth = (int) LIP_WIDTH.convertToPixels(); int lipLength = (int) LIP_LENGTH.convertToPixels(); int edgeRadius = (int) EDGE_RADIUS.convertToPixels(); @@ -142,7 +148,7 @@ public class HumbuckerPickup extends AbstractTransparentComponent { new Area(new RoundRectangle2D.Double(x + pointMargin - length - lipLength, y - pointMargin + width / 2 - lipWidth / 2, length + 2 * lipLength, lipWidth, edgeRadius / 2, edgeRadius / 2)); Area lipArea = new Area(body[1]); - lipArea.subtract(new Area(body[0])); + lipArea.subtract((Area) (body[0])); lipArea.subtract(new Area(new Ellipse2D.Double(x + pointMargin - length - lipLength / 2, y - pointMargin + width / 2 - lipHoleSize / 2, lipHoleSize, lipHoleSize))); lipArea.subtract(new Area(new Ellipse2D.Double(x + pointMargin + lipLength / 2, y - pointMargin + width / 2 @@ -157,11 +163,14 @@ public class HumbuckerPickup extends AbstractTransparentComponent { int poleMargin = (length - poleSpacing * 5) / 2; Area poleArea = new Area(); for (int i = 0; i < 6; i++) { + if (getType() == HumbuckerType.PAF) { + 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)); + } + 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)); - 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)); @@ -194,6 +203,8 @@ public class HumbuckerPickup extends AbstractTransparentComponent { @Override public void drawIcon(Graphics2D g2d, int width, int height) { + g2d.rotate(Math.PI / 4, width / 2, height / 2); + int baseWidth = 16 * width / 32; int baseLength = 27 * width / 32; @@ -210,6 +221,19 @@ public class HumbuckerPickup extends AbstractTransparentComponent { 4 * width / 32); } + @EditableProperty + public HumbuckerType getType() { + if (type == null) + type = HumbuckerType.PAF; + return type; + } + + public void setType(HumbuckerType type) { + this.type = type; + // Invalidate the body + body = null; + } + @Override public int getControlPointCount() { return 1; @@ -267,4 +291,30 @@ public class HumbuckerPickup extends AbstractTransparentComponent { public void setColor(Color color) { this.color = color; } + + public static enum HumbuckerType { + + PAF(WIDTH, LENGTH), Mini(WIDTH_MINI, LENGTH_MINI); + + private Size width; + private Size length; + + private HumbuckerType(Size width, Size length) { + this.width = width; + this.length = length; + } + + public Size getWidth() { + return width; + } + + public Size getLength() { + return length; + } + + @Override + public String toString() { + return name(); + } + } } diff --git a/diylc/diylc-library/src/org/diylc/components/guitar/P90DogEarPickup.java b/diylc/diylc-library/src/org/diylc/components/guitar/P90DogEarPickup.java new file mode 100644 index 00000000..9ac491f0 --- /dev/null +++ b/diylc/diylc-library/src/org/diylc/components/guitar/P90DogEarPickup.java @@ -0,0 +1,284 @@ +package org.diylc.components.guitar; + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Composite; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Shape; +import java.awt.geom.AffineTransform; +import java.awt.geom.Area; +import java.awt.geom.Ellipse2D; +import java.awt.geom.RoundRectangle2D; + +import org.diylc.appframework.miscutils.ConfigurationManager; +import org.diylc.common.HorizontalAlignment; +import org.diylc.common.IPlugInPort; +import org.diylc.common.ObjectCache; +import org.diylc.common.Orientation; +import org.diylc.common.VerticalAlignment; +import org.diylc.components.AbstractTransparentComponent; +import org.diylc.core.ComponentState; +import org.diylc.core.IDIYComponent; +import org.diylc.core.IDrawingObserver; +import org.diylc.core.Project; +import org.diylc.core.Theme; +import org.diylc.core.VisibilityPolicy; +import org.diylc.core.annotations.ComponentDescriptor; +import org.diylc.core.annotations.EditableProperty; +import org.diylc.core.annotations.KeywordPolicy; +import org.diylc.core.measures.Size; +import org.diylc.core.measures.SizeUnit; +import org.diylc.utils.Constants; + +@ComponentDescriptor(name = "P-90 \"Dog Ear\" Pickup", category = "Guitar", author = "Branislav Stojkovic", + description = "Single coil P-90 guitar pickup with \"dog ears\"", stretchable = false, + zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "PKP", autoEdit = false, + keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram") +public class P90DogEarPickup extends AbstractTransparentComponent { + + private static final long serialVersionUID = 1L; + + private static Color BODY_COLOR = Color.decode("#D8C989");; + private static Color POINT_COLOR = Color.darkGray; + public static Color POLE_COLOR = Color.decode("#C3E4ED"); + private static Size WIDTH = new Size(41d, SizeUnit.mm); + private static Size LENGTH = new Size(86.9d, SizeUnit.mm); + private static Size TOTAL_LENGTH = new Size(118.7d, SizeUnit.mm); + private static Size LIP_RADIUS = new Size(10d, SizeUnit.mm); + private static Size EDGE_RADIUS = new Size(4d, SizeUnit.mm); + private static Size POINT_MARGIN = new Size(5d, SizeUnit.mm); + private static Size POINT_SIZE = new Size(3d, SizeUnit.mm); + private static Size LIP_HOLE_SIZE = new Size(2.5d, SizeUnit.mm); + private static Size LIP_HOLE_SPACING = new Size(97d, SizeUnit.mm); + private static Size POLE_SIZE = new Size(3d, SizeUnit.mm); + private static Size POLE_SPACING = new Size(10.1d, SizeUnit.mm); + + private String value = ""; + private Point controlPoint = new Point(0, 0); + transient Shape[] body; + private Orientation orientation = Orientation.DEFAULT; + private Color color = BODY_COLOR; + + @Override + public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project, + IDrawingObserver drawingObserver) { + Shape[] body = getBody(); + + g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1)); + if (componentState != ComponentState.DRAGGING) { + Composite oldComposite = g2d.getComposite(); + if (alpha < MAX_ALPHA) { + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA)); + } + g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : color); + g2d.fill(body[0]); + g2d.fill(body[1]); + g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : POINT_COLOR); + g2d.fill(body[2]); + g2d.setComposite(oldComposite); + } + + Color finalBorderColor; + if (outlineMode) { + Theme theme = + (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME); + finalBorderColor = + componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR + : theme.getOutlineColor(); + } else { + finalBorderColor = + componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR + : color.darker(); + } + + g2d.setColor(finalBorderColor); + g2d.draw(body[0]); + g2d.draw(body[1]); + if (!outlineMode) { + g2d.setColor(POLE_COLOR); + g2d.fill(body[3]); + g2d.setColor(color.darker()); + g2d.draw(body[3]); + } + + Color finalLabelColor; + if (outlineMode) { + Theme theme = + (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME); + finalLabelColor = + componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED + : theme.getOutlineColor(); + } else { + finalLabelColor = + componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED + : LABEL_COLOR; + } + g2d.setColor(finalLabelColor); + g2d.setFont(LABEL_FONT); + Rectangle bounds = body[0].getBounds(); + drawCenteredText(g2d, value, bounds.x + bounds.width / 2, bounds.y + bounds.height / 2, HorizontalAlignment.CENTER, + VerticalAlignment.CENTER); + } + + @SuppressWarnings("incomplete-switch") + public Shape[] getBody() { + if (body == null) { + body = new Shape[4]; + + int x = controlPoint.x; + int y = controlPoint.y; + int width = (int) WIDTH.convertToPixels(); + int length = (int) LENGTH.convertToPixels(); + int edgeRadius = (int) EDGE_RADIUS.convertToPixels(); + int pointMargin = (int) POINT_MARGIN.convertToPixels(); + int totalLength = (int) TOTAL_LENGTH.convertToPixels(); + int lipRadius = (int) LIP_RADIUS.convertToPixels(); + int pointSize = getClosestOdd(POINT_SIZE.convertToPixels()); + int lipHoleSize = getClosestOdd(LIP_HOLE_SIZE.convertToPixels()); + int lipHoleSpacing = getClosestOdd(LIP_HOLE_SPACING.convertToPixels()); + + body[0] = + new Area(new RoundRectangle2D.Double(x + pointMargin - length, y - pointMargin, length, width, edgeRadius, + edgeRadius)); + + double rectWidth = (totalLength - length) / Math.sqrt(2); + RoundRectangle2D roundRect = + new RoundRectangle2D.Double(-rectWidth / 2, -rectWidth / 2, rectWidth, rectWidth, lipRadius, lipRadius); + Area leftEar = new Area(roundRect); + leftEar.transform(AffineTransform.getRotateInstance(Math.PI / 4)); + leftEar.transform(AffineTransform.getScaleInstance(1.1, 1.45)); + leftEar.transform(AffineTransform.getTranslateInstance(x + pointMargin - length, y - pointMargin + width / 2)); + leftEar.subtract((Area) body[0]); + Area rightEar = new Area(roundRect); + rightEar.transform(AffineTransform.getRotateInstance(Math.PI / 4)); + rightEar.transform(AffineTransform.getScaleInstance(1.1, 1.45)); + rightEar.transform(AffineTransform.getTranslateInstance(x + pointMargin, y - pointMargin + width / 2)); + rightEar.subtract((Area) body[0]); + Area lipArea = leftEar; + lipArea.add(rightEar); + lipArea.subtract(new Area(new Ellipse2D.Double(x + pointMargin - length / 2 - lipHoleSpacing / 2 - lipHoleSize + / 2, y - pointMargin + width / 2 - lipHoleSize / 2, lipHoleSize, lipHoleSize))); + lipArea.subtract(new Area(new Ellipse2D.Double(x + pointMargin - length / 2 + lipHoleSpacing / 2 - lipHoleSize + / 2, y - pointMargin + width / 2 - lipHoleSize / 2, lipHoleSize, lipHoleSize))); + + + body[1] = lipArea; + body[2] = new Area(new Ellipse2D.Double(x - pointSize / 2, y - pointSize / 2, pointSize, pointSize)); + + int poleSize = (int) POLE_SIZE.convertToPixels(); + int poleSpacing = (int) POLE_SPACING.convertToPixels(); + int poleMargin = (length - poleSpacing * 5) / 2; + Area poleArea = new Area(); + for (int i = 0; i < 6; i++) { + Ellipse2D pole = + new Ellipse2D.Double(x + pointMargin - length + poleMargin + i * poleSpacing - poleSize / 2, y + - pointMargin - poleSize / 2 + width / 2, poleSize, poleSize); + poleArea.add(new Area(pole)); + } + body[3] = poleArea; + + // Rotate if needed + if (orientation != Orientation.DEFAULT) { + double theta = 0; + switch (orientation) { + case _90: + theta = Math.PI / 2; + break; + case _180: + theta = Math.PI; + break; + case _270: + theta = Math.PI * 3 / 2; + break; + } + AffineTransform rotation = AffineTransform.getRotateInstance(theta, x, y); + for (Shape shape : body) { + Area area = (Area) shape; + area.transform(rotation); + } + } + } + return body; + } + + @Override + public void drawIcon(Graphics2D g2d, int width, int height) { + g2d.rotate(Math.PI / 4, width / 2, height / 2); + + int baseWidth = 13 * width / 32; + int baseLength = 27 * width / 32; + int radius = 6 * width / 32; + + g2d.setColor(BODY_COLOR); + g2d.fillRoundRect((width - baseWidth) / 2, (height - baseLength) / 2, baseWidth, baseLength, radius, radius); + g2d.setColor(BODY_COLOR.darker()); + g2d.drawRoundRect((width - baseWidth) / 2, (height - baseLength) / 2, baseWidth, baseLength, radius, radius); + + g2d.setColor(POLE_COLOR.darker()); + int poleSize = 2; + int poleSpacing = 17 * width / 32; + for (int i = 0; i < 6; i++) { + g2d.fillOval((width - poleSize) / 2, (height - poleSpacing) / 2 + (i * poleSpacing / 5), poleSize, poleSize); + } + } + + @Override + public int getControlPointCount() { + return 1; + } + + @Override + public VisibilityPolicy getControlPointVisibilityPolicy(int index) { + return VisibilityPolicy.WHEN_SELECTED; + } + + @Override + public boolean isControlPointSticky(int index) { + return true; + } + + @Override + public Point getControlPoint(int index) { + return controlPoint; + } + + @Override + public void setControlPoint(Point point, int index) { + this.controlPoint.setLocation(point); + // Invalidate the body + body = null; + } + + @EditableProperty(name = "Model") + @Override + public String getValue() { + return value; + } + + @Override + public void setValue(String value) { + this.value = value; + } + + @EditableProperty + public Orientation getOrientation() { + return orientation; + } + + public void setOrientation(Orientation orientation) { + this.orientation = orientation; + // Invalidate the body + body = null; + } + + @EditableProperty + public Color getColor() { + return color; + } + + public void setColor(Color color) { + this.color = color; + } +} diff --git a/diylc/diylc-library/src/org/diylc/components/guitar/P90SoapBarPickup.java b/diylc/diylc-library/src/org/diylc/components/guitar/P90SoapBarPickup.java new file mode 100644 index 00000000..e2569cca --- /dev/null +++ b/diylc/diylc-library/src/org/diylc/components/guitar/P90SoapBarPickup.java @@ -0,0 +1,255 @@ +package org.diylc.components.guitar; + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Composite; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Shape; +import java.awt.geom.AffineTransform; +import java.awt.geom.Area; +import java.awt.geom.Ellipse2D; +import java.awt.geom.RoundRectangle2D; + +import org.diylc.appframework.miscutils.ConfigurationManager; +import org.diylc.common.HorizontalAlignment; +import org.diylc.common.IPlugInPort; +import org.diylc.common.ObjectCache; +import org.diylc.common.Orientation; +import org.diylc.common.VerticalAlignment; +import org.diylc.components.AbstractTransparentComponent; +import org.diylc.core.ComponentState; +import org.diylc.core.IDIYComponent; +import org.diylc.core.IDrawingObserver; +import org.diylc.core.Project; +import org.diylc.core.Theme; +import org.diylc.core.VisibilityPolicy; +import org.diylc.core.annotations.ComponentDescriptor; +import org.diylc.core.annotations.EditableProperty; +import org.diylc.core.annotations.KeywordPolicy; +import org.diylc.core.measures.Size; +import org.diylc.core.measures.SizeUnit; +import org.diylc.utils.Constants; + +@ComponentDescriptor(name = "P-90 \"Soap Bar\" Pickup", category = "Guitar", author = "Branislav Stojkovic", + description = "Single coil P-90 guitar pickup in \"soap bar\" shape", stretchable = false, + zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "PKP", autoEdit = false, + keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Guitar Wiring Diagram") +public class P90SoapBarPickup extends AbstractTransparentComponent { + + private static final long serialVersionUID = 1L; + + private static Color BODY_COLOR = Color.decode("#D8C989"); + private static Color POINT_COLOR = Color.darkGray; + public static Color POLE_COLOR = Color.decode("#C3E4ED"); + private static Size WIDTH = new Size(35.3d, SizeUnit.mm); + private static Size LENGTH = new Size(85.6d, SizeUnit.mm); + private static Size EDGE_RADIUS = new Size(8d, SizeUnit.mm); + private static Size POINT_MARGIN = new Size(5d, SizeUnit.mm); + private static Size POINT_SIZE = new Size(3d, SizeUnit.mm); + private static Size POLE_SIZE = new Size(3d, SizeUnit.mm); + private static Size POLE_SPACING = new Size(10.1d, SizeUnit.mm); + + private String value = ""; + private Point controlPoint = new Point(0, 0); + transient Shape[] body; + private Orientation orientation = Orientation.DEFAULT; + private Color color = BODY_COLOR; + + @Override + public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project, + IDrawingObserver drawingObserver) { + Shape[] body = getBody(); + + g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1)); + if (componentState != ComponentState.DRAGGING) { + Composite oldComposite = g2d.getComposite(); + if (alpha < MAX_ALPHA) { + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA)); + } + g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : color); + g2d.fill(body[0]); + // g2d.fill(body[1]); + g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : POINT_COLOR); + g2d.fill(body[2]); + g2d.setComposite(oldComposite); + } + + Color finalBorderColor; + if (outlineMode) { + Theme theme = + (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME); + finalBorderColor = + componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR + : theme.getOutlineColor(); + } else { + finalBorderColor = + componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR + : color.darker(); + } + + g2d.setColor(finalBorderColor); + g2d.draw(body[0]); + // g2d.draw(body[1]); + if (!outlineMode) { + g2d.setColor(POLE_COLOR); + g2d.fill(body[3]); + g2d.setColor(color.darker()); + g2d.draw(body[3]); + } + + Color finalLabelColor; + if (outlineMode) { + Theme theme = + (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME); + finalLabelColor = + componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED + : theme.getOutlineColor(); + } else { + finalLabelColor = + componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED + : LABEL_COLOR; + } + g2d.setColor(finalLabelColor); + g2d.setFont(LABEL_FONT); + Rectangle bounds = body[0].getBounds(); + drawCenteredText(g2d, value, bounds.x + bounds.width / 2, bounds.y + bounds.height / 2, HorizontalAlignment.CENTER, + VerticalAlignment.CENTER); + } + + @SuppressWarnings("incomplete-switch") + public Shape[] getBody() { + if (body == null) { + body = new Shape[4]; + + int x = controlPoint.x; + int y = controlPoint.y; + int width = (int) WIDTH.convertToPixels(); + int length = (int) LENGTH.convertToPixels(); + int edgeRadius = (int) EDGE_RADIUS.convertToPixels(); + int pointMargin = (int) POINT_MARGIN.convertToPixels(); + int pointSize = getClosestOdd(POINT_SIZE.convertToPixels()); + + body[0] = + new Area(new RoundRectangle2D.Double(x + pointMargin - length, y - pointMargin, length, width, edgeRadius, + edgeRadius)); + + body[2] = new Area(new Ellipse2D.Double(x - pointSize / 2, y - pointSize / 2, pointSize, pointSize)); + + int poleSize = (int) POLE_SIZE.convertToPixels(); + int poleSpacing = (int) POLE_SPACING.convertToPixels(); + int poleMargin = (length - poleSpacing * 5) / 2; + Area poleArea = new Area(); + for (int i = 0; i < 6; i++) { + Ellipse2D pole = + new Ellipse2D.Double(x + pointMargin - length + poleMargin + i * poleSpacing - poleSize / 2, y + - pointMargin - poleSize / 2 + width / 2, poleSize, poleSize); + poleArea.add(new Area(pole)); + } + body[3] = poleArea; + + // Rotate if needed + if (orientation != Orientation.DEFAULT) { + double theta = 0; + switch (orientation) { + case _90: + theta = Math.PI / 2; + break; + case _180: + theta = Math.PI; + break; + case _270: + theta = Math.PI * 3 / 2; + break; + } + AffineTransform rotation = AffineTransform.getRotateInstance(theta, x, y); + for (Shape shape : body) { + Area area = (Area) shape; + if (shape != null) + area.transform(rotation); + } + } + } + return body; + } + + @Override + public void drawIcon(Graphics2D g2d, int width, int height) { + g2d.rotate(Math.PI / 4, width / 2, height / 2); + + int baseWidth = 13 * width / 32; + int baseLength = 27 * width / 32; + int radius = 6 * width / 32; + + g2d.setColor(BODY_COLOR); + g2d.fillRoundRect((width - baseWidth) / 2, (height - baseLength) / 2, baseWidth, baseLength, radius, radius); + g2d.setColor(BODY_COLOR.darker()); + g2d.drawRoundRect((width - baseWidth) / 2, (height - baseLength) / 2, baseWidth, baseLength, radius, radius); + + g2d.setColor(POLE_COLOR.darker()); + int poleSize = 2; + int poleSpacing = 17 * width / 32; + for (int i = 0; i < 6; i++) { + g2d.fillOval((width - poleSize) / 2, (height - poleSpacing) / 2 + (i * poleSpacing / 5), poleSize, poleSize); + } + } + + @Override + public int getControlPointCount() { + return 1; + } + + @Override + public VisibilityPolicy getControlPointVisibilityPolicy(int index) { + return VisibilityPolicy.WHEN_SELECTED; + } + + @Override + public boolean isControlPointSticky(int index) { + return true; + } + + @Override + public Point getControlPoint(int index) { + return controlPoint; + } + + @Override + public void setControlPoint(Point point, int index) { + this.controlPoint.setLocation(point); + // Invalidate the body + body = null; + } + + @EditableProperty(name = "Model") + @Override + public String getValue() { + return value; + } + + @Override + public void setValue(String value) { + this.value = value; + } + + @EditableProperty + public Orientation getOrientation() { + return orientation; + } + + public void setOrientation(Orientation orientation) { + this.orientation = orientation; + // Invalidate the body + body = null; + } + + @EditableProperty + public Color getColor() { + return color; + } + + public void setColor(Color color) { + this.color = color; + } +} diff --git a/diylc/diylc-library/src/org/diylc/components/guitar/SingleCoilPickup.java b/diylc/diylc-library/src/org/diylc/components/guitar/SingleCoilPickup.java index ce1a00cb..96f20c69 100644 --- a/diylc/diylc-library/src/org/diylc/components/guitar/SingleCoilPickup.java +++ b/diylc/diylc-library/src/org/diylc/components/guitar/SingleCoilPickup.java @@ -183,6 +183,8 @@ public class SingleCoilPickup extends AbstractTransparentComponent { @Override public void drawIcon(Graphics2D g2d, int width, int height) { + g2d.rotate(Math.PI / 4, width / 2, height / 2); + int bodyWidth = 8 * width / 32; int bodyLength = 30 * width / 32; g2d.setColor(BODY_COLOR); diff --git a/diylc/diylc-swing/lib/diylc-core.jar b/diylc/diylc-swing/lib/diylc-core.jar index 225fea3f..7a02be5b 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 be0a8f4f..d96c670f 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/help/HelpMenuPlugin.java b/diylc/diylc-swing/src/org/diylc/swing/plugins/help/HelpMenuPlugin.java index 128de18d..e0dbd243 100644 --- a/diylc/diylc-swing/src/org/diylc/swing/plugins/help/HelpMenuPlugin.java +++ b/diylc/diylc-swing/src/org/diylc/swing/plugins/help/HelpMenuPlugin.java @@ -26,12 +26,12 @@ public class HelpMenuPlugin implements IPlugIn { private static final String HELP_TITLE = "Help"; - public static String MANUAL_URL = "http://code.google.com/p/diy-layout-creator/wiki/Manual"; - public static String FAQ_URL = "http://code.google.com/p/diy-layout-creator/wiki/FAQ"; - public static String COMPONENT_URL = "http://code.google.com/p/diy-layout-creator/wiki/ComponentAPI"; - public static String PLUGIN_URL = "http://code.google.com/p/diy-layout-creator/wiki/PluginAPI"; - public static String BUG_URL = "http://code.google.com/p/diy-layout-creator/issues/entry"; - public static String DONATE_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=25161"; + public static String MANUAL_URL = "https://github.com/bancika/diy-layout-creator/blob/wiki/Manual.md"; + public static String FAQ_URL = "https://github.com/bancika/diy-layout-creator/blob/wiki/FAQ.md"; + public static String COMPONENT_URL = "https://github.com/bancika/diy-layout-creator/blob/wiki/ComponentAPI.md"; + public static String PLUGIN_URL = "https://github.com/bancika/diy-layout-creator/blob/wiki/PluginAPI.md"; + public static String BUG_URL = "https://github.com/bancika/diy-layout-creator/issues"; + public static String DONATE_URL = "http://diy-fever.com/donate"; private IPlugInPort plugInPort; private AboutDialog aboutDialog; diff --git a/diylc/diylc-swing/update.xml b/diylc/diylc-swing/update.xml index 1475b67a..a5f4c8d3 100644 --- a/diylc/diylc-swing/update.xml +++ b/diylc/diylc-swing/update.xml @@ -1403,7 +1403,7 @@ 33 0 - 2016-11-12 20:00:00.000 CET + 2016-12-23 20:00:00.000 CET @@ -1444,6 +1444,30 @@ https://github.com/bancika/diy-layout-creator/releases + + + + 3 + 34 + 0 + + 2016-12-23 20:00:00.000 CET + + + + NEW_FEATURE + P-90 pickup in both "dog ear" and "soap bar" variations added + + + NEW_FEATURE + Mini humbucker pickup added + + + BUG_FIX + Fixed broken links in the Help menu + + + https://github.com/bancika/diy-layout-creator/releases \ No newline at end of file