mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
@@ -3589,5 +3589,21 @@
|
|||||||
</changes>
|
</changes>
|
||||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
</org.diylc.appframework.update.Version>
|
</org.diylc.appframework.update.Version>
|
||||||
|
<org.diylc.appframework.update.Version>
|
||||||
|
<versionNumber>
|
||||||
|
<major>4</major>
|
||||||
|
<minor>20</minor>
|
||||||
|
<build>0</build>
|
||||||
|
</versionNumber>
|
||||||
|
<releaseDate>2021-09-12 00:00:00.000 CET</releaseDate>
|
||||||
|
<name></name>
|
||||||
|
<changes>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Added 'Open 1/8" Jack' component</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
</changes>
|
||||||
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
|
</org.diylc.appframework.update.Version>
|
||||||
</a>
|
</a>
|
||||||
</java.util.Arrays_-ArrayList>
|
</java.util.Arrays_-ArrayList>
|
||||||
|
|||||||
Binary file not shown.
@@ -25,6 +25,7 @@ import java.awt.AlphaComposite;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.RenderingHints;
|
||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
@@ -58,6 +59,7 @@ import org.diylc.utils.Constants;
|
|||||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", enableCache = true)
|
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", enableCache = true)
|
||||||
public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||||
|
|
||||||
|
private static final float FONT_SCALE = 0.8f;
|
||||||
private static final double RING_THETA = Math.PI * 0.795;
|
private static final double RING_THETA = Math.PI * 0.795;
|
||||||
private static final double SLEEVE_THETA = Math.PI * 0.29444444444;
|
private static final double SLEEVE_THETA = Math.PI * 0.29444444444;
|
||||||
private static final double SLEEVE_SWITCHED_THETA = Math.PI * 4 / 3;
|
private static final double SLEEVE_SWITCHED_THETA = Math.PI * 4 / 3;
|
||||||
@@ -158,7 +160,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
|||||||
// draw labels
|
// draw labels
|
||||||
if (showLabels) {
|
if (showLabels) {
|
||||||
g2d.setColor(BASE_COLOR.darker());
|
g2d.setColor(BASE_COLOR.darker());
|
||||||
g2d.setFont(project.getFont().deriveFont(project.getFont().getSize2D() * 0.8f));
|
g2d.setFont(project.getFont().deriveFont(project.getFont().getSize2D() * FONT_SCALE));
|
||||||
int springLength = (int) SPRING_LENGTH.convertToPixels();
|
int springLength = (int) SPRING_LENGTH.convertToPixels();
|
||||||
int holeToEdge = (int) HOLE_TO_EDGE.convertToPixels();
|
int holeToEdge = (int) HOLE_TO_EDGE.convertToPixels();
|
||||||
double centerY = controlPoints[0].getY() + springLength - holeToEdge;
|
double centerY = controlPoints[0].getY() + springLength - holeToEdge;
|
||||||
@@ -287,7 +289,9 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
|||||||
@Override
|
@Override
|
||||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
int waferDiameter = 15 * width / 32;
|
int waferDiameter = 15 * width / 32;
|
||||||
int sleeveDiameter = 9 * width / 32;
|
int sleeveDiameter = 9 * width / 32;
|
||||||
|
|
||||||
|
AffineTransform tx = g2d.getTransform();
|
||||||
|
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(6f * width / 32));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(6f * width / 32));
|
||||||
g2d.setColor(BASE_COLOR);
|
g2d.setColor(BASE_COLOR);
|
||||||
@@ -309,7 +313,18 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
|||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(6f * width / 32));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(6f * width / 32));
|
||||||
g2d.rotate(-Math.PI / 2, width / 2, height / 2);
|
g2d.rotate(-Math.PI / 2, width / 2, height / 2);
|
||||||
|
|
||||||
g2d.drawLine(width / 2, 4 * width / 32, width / 2, width / 3);
|
g2d.drawLine(width / 2, 4 * width / 32, width / 2, width / 3);
|
||||||
|
|
||||||
|
g2d.setTransform(tx);
|
||||||
|
g2d.setColor(LABEL_COLOR);
|
||||||
|
g2d.setFont(LABEL_FONT.deriveFont(width / 3.5f));
|
||||||
|
|
||||||
|
RenderingHints rh = new RenderingHints(
|
||||||
|
RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||||
|
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||||
|
g2d.setRenderingHints(rh);
|
||||||
|
|
||||||
|
StringUtils.drawCenteredText(g2d, "1/4\"", width / 2, height / 2, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,449 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
DIY Layout Creator (DIYLC).
|
||||||
|
Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||||
|
|
||||||
|
This file is part of DIYLC.
|
||||||
|
|
||||||
|
DIYLC is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
DIYLC is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
*/
|
||||||
|
package org.diylc.components.electromechanical;
|
||||||
|
|
||||||
|
import java.awt.AlphaComposite;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Composite;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.RenderingHints;
|
||||||
|
import java.awt.Shape;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.awt.geom.Area;
|
||||||
|
import java.awt.geom.Ellipse2D;
|
||||||
|
import java.awt.geom.Point2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.awt.geom.RoundRectangle2D;
|
||||||
|
|
||||||
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
|
import org.diylc.awt.StringUtils;
|
||||||
|
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.AbstractMultiPartComponent;
|
||||||
|
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.measures.Size;
|
||||||
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
import org.diylc.utils.Constants;
|
||||||
|
|
||||||
|
@ComponentDescriptor(name = "Open 1/8\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||||
|
description = "Switchcraft-style open panel mount 1/8\" phono jack, stereo and mono",
|
||||||
|
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", enableCache = true)
|
||||||
|
public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||||
|
|
||||||
|
private static final float FONT_SCALE = 0.6f;
|
||||||
|
private static final double RING_THETA = Math.PI * 0.795;
|
||||||
|
private static final double SLEEVE_THETA = Math.PI * 0.29444444444;
|
||||||
|
private static final double SLEEVE_SWITCHED_THETA = Math.PI * 4 / 3;
|
||||||
|
private static final double SWITCH_THETA = Math.PI * 5 / 3;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private static Color BASE_COLOR = Color.lightGray;
|
||||||
|
private static Color WAFER_COLOR = Color.decode("#CD8500");
|
||||||
|
|
||||||
|
private static Size OUTER_DIAMETER = new Size(0.375d, SizeUnit.in);
|
||||||
|
private static Size INNER_DIAMETER = new Size(0.125d, SizeUnit.in);
|
||||||
|
private static Size RING_DIAMETER = new Size(0.165d, SizeUnit.in);
|
||||||
|
private static Size SPRING_LENGTH = new Size(0.2815d, SizeUnit.in);
|
||||||
|
private static Size SPRING_WIDTH = new Size(0.06d, SizeUnit.in);
|
||||||
|
private static Size HOLE_DIAMETER = new Size(0.025d, SizeUnit.in);
|
||||||
|
private static Size HOLE_TO_EDGE = new Size(0.0315d, SizeUnit.in);
|
||||||
|
|
||||||
|
private String value = "";
|
||||||
|
private Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0), new Point2D.Double(0, 0), new Point2D.Double(0, 0)};
|
||||||
|
transient Area[] body;
|
||||||
|
@Deprecated
|
||||||
|
private Orientation orientation = Orientation.DEFAULT;
|
||||||
|
private Integer angle = 0;
|
||||||
|
private OpenJackType type = OpenJackType.MONO;
|
||||||
|
private boolean showLabels = true;
|
||||||
|
|
||||||
|
public OpenJack1_8() {
|
||||||
|
super();
|
||||||
|
updateControlPoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 : WAFER_COLOR);
|
||||||
|
g2d.fill(body[0]);
|
||||||
|
|
||||||
|
g2d.setComposite(oldComposite);
|
||||||
|
// }
|
||||||
|
|
||||||
|
Color finalBorderColor;
|
||||||
|
|
||||||
|
if (outlineMode) {
|
||||||
|
Theme theme =
|
||||||
|
(Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||||
|
finalBorderColor = theme.getOutlineColor();
|
||||||
|
} else {
|
||||||
|
finalBorderColor = WAFER_COLOR.darker();
|
||||||
|
}
|
||||||
|
|
||||||
|
g2d.setColor(finalBorderColor);
|
||||||
|
g2d.draw(body[0]);
|
||||||
|
|
||||||
|
// if (componentState != ComponentState.DRAGGING) {
|
||||||
|
oldComposite = g2d.getComposite();
|
||||||
|
if (alpha < MAX_ALPHA) {
|
||||||
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||||
|
}
|
||||||
|
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||||
|
|
||||||
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
|
g2d.fill(body[1]);
|
||||||
|
g2d.fill(body[2]);
|
||||||
|
if (body[3] != null)
|
||||||
|
g2d.fill(body[3]);
|
||||||
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
|
|
||||||
|
g2d.setComposite(oldComposite);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (outlineMode) {
|
||||||
|
Theme theme =
|
||||||
|
(Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||||
|
finalBorderColor = theme.getOutlineColor();
|
||||||
|
} else {
|
||||||
|
finalBorderColor = BASE_COLOR.darker();
|
||||||
|
}
|
||||||
|
|
||||||
|
drawingObserver.stopTracking();
|
||||||
|
|
||||||
|
g2d.setColor(finalBorderColor);
|
||||||
|
g2d.draw(body[1]);
|
||||||
|
g2d.draw(body[2]);
|
||||||
|
if (body[3] != null)
|
||||||
|
g2d.draw(body[3]);
|
||||||
|
|
||||||
|
drawingObserver.startTracking();
|
||||||
|
|
||||||
|
// draw labels
|
||||||
|
if (showLabels) {
|
||||||
|
g2d.setColor(BASE_COLOR.darker());
|
||||||
|
g2d.setFont(project.getFont().deriveFont(project.getFont().getSize2D() * FONT_SCALE));
|
||||||
|
int springLength = (int) SPRING_LENGTH.convertToPixels();
|
||||||
|
int holeToEdge = (int) HOLE_TO_EDGE.convertToPixels();
|
||||||
|
double centerY = controlPoints[0].getY() + springLength - holeToEdge;
|
||||||
|
Point2D tipLabel = new Point2D.Double(controlPoints[0].getX(), (int) (controlPoints[0].getY() + holeToEdge * 1.25));
|
||||||
|
AffineTransform ringTransform = AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, controlPoints[0].getX(), centerY);
|
||||||
|
AffineTransform sleeveTransform = AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, controlPoints[0].getX(), centerY);
|
||||||
|
Point2D ringOrSwitchLabel = new Point2D.Double(0, 0);
|
||||||
|
Point2D sleeveLabel = new Point2D.Double(0, 0);
|
||||||
|
ringTransform.transform(tipLabel, ringOrSwitchLabel);
|
||||||
|
sleeveTransform.transform(tipLabel, sleeveLabel);
|
||||||
|
|
||||||
|
if (getTheta() != 0) {
|
||||||
|
AffineTransform rotation = AffineTransform.getRotateInstance(getTheta(), controlPoints[0].getX(), controlPoints[0].getY());
|
||||||
|
rotation.transform(tipLabel, tipLabel);
|
||||||
|
rotation.transform(ringOrSwitchLabel, ringOrSwitchLabel);
|
||||||
|
rotation.transform(sleeveLabel, sleeveLabel);
|
||||||
|
}
|
||||||
|
StringUtils.drawCenteredText(g2d, "T", tipLabel.getX(), tipLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||||
|
StringUtils.drawCenteredText(g2d, "S", sleeveLabel.getX(), sleeveLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||||
|
if (getType() == OpenJackType.STEREO)
|
||||||
|
StringUtils.drawCenteredText(g2d, "R", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||||
|
if (getType() == OpenJackType.SWITCHED)
|
||||||
|
StringUtils.drawCenteredText(g2d, "Sw", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawSelectionOutline(g2d, componentState, outlineMode, project, drawingObserver);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Area[] getBody() {
|
||||||
|
if (body == null) {
|
||||||
|
body = new Area[4];
|
||||||
|
|
||||||
|
double x = controlPoints[0].getX();
|
||||||
|
double y = controlPoints[0].getY();
|
||||||
|
int outerDiameter = getClosestOdd(OUTER_DIAMETER.convertToPixels());
|
||||||
|
int innerDiameter = getClosestOdd(INNER_DIAMETER.convertToPixels());
|
||||||
|
int ringDiameter = getClosestOdd(RING_DIAMETER.convertToPixels());
|
||||||
|
int springLength = (int) SPRING_LENGTH.convertToPixels();
|
||||||
|
int springWidth = (int) SPRING_WIDTH.convertToPixels();
|
||||||
|
int holeDiameter = getClosestOdd(HOLE_DIAMETER.convertToPixels());
|
||||||
|
int holeToEdge = (int) HOLE_TO_EDGE.convertToPixels();
|
||||||
|
|
||||||
|
double centerY = y + springLength - holeToEdge;
|
||||||
|
|
||||||
|
Area wafer =
|
||||||
|
new Area(new Ellipse2D.Double(x - outerDiameter / 2, centerY - outerDiameter / 2, outerDiameter,
|
||||||
|
outerDiameter));
|
||||||
|
wafer.subtract(new Area(new Ellipse2D.Double(x - ringDiameter / 2, centerY - ringDiameter / 2, ringDiameter,
|
||||||
|
ringDiameter)));
|
||||||
|
|
||||||
|
body[0] = wafer;
|
||||||
|
|
||||||
|
Area tip =
|
||||||
|
new Area(new RoundRectangle2D.Double(x - springWidth / 2, y - holeToEdge, springWidth, springLength
|
||||||
|
- ringDiameter / 2, springWidth, springWidth));
|
||||||
|
tip.subtract(new Area(
|
||||||
|
new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter, holeDiameter)));
|
||||||
|
tip.subtract(wafer);
|
||||||
|
|
||||||
|
body[1] = tip;
|
||||||
|
|
||||||
|
Area sleeve =
|
||||||
|
new Area(new RoundRectangle2D.Double(x - springWidth / 2, y - holeToEdge, springWidth, springLength,
|
||||||
|
springWidth, springWidth));
|
||||||
|
sleeve.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter,
|
||||||
|
holeDiameter)));
|
||||||
|
sleeve.transform(AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY));
|
||||||
|
sleeve.add(new Area(new Ellipse2D.Double(x - ringDiameter / 2, centerY - ringDiameter / 2, ringDiameter,
|
||||||
|
ringDiameter)));
|
||||||
|
sleeve.subtract(new Area(new Ellipse2D.Double(x - innerDiameter / 2, centerY - innerDiameter / 2, innerDiameter,
|
||||||
|
innerDiameter)));
|
||||||
|
|
||||||
|
body[2] = sleeve;
|
||||||
|
|
||||||
|
if (getType() != OpenJackType.MONO) {
|
||||||
|
Area ringOrSwitch =
|
||||||
|
new Area(new RoundRectangle2D.Double(x - springWidth / 2, y - holeToEdge, springWidth, springLength,
|
||||||
|
springWidth, springWidth));
|
||||||
|
ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter,
|
||||||
|
holeDiameter)));
|
||||||
|
ringOrSwitch.transform(AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY));
|
||||||
|
ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - outerDiameter / 2, centerY - outerDiameter / 2, outerDiameter,
|
||||||
|
outerDiameter)));
|
||||||
|
|
||||||
|
body[3] = ringOrSwitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rotate if needed
|
||||||
|
if (getTheta() != 0) {
|
||||||
|
AffineTransform rotation = AffineTransform.getRotateInstance(getTheta(), x, y);
|
||||||
|
// Skip the last one because it's already rotated
|
||||||
|
for (int i = 0; i < body.length; i++) {
|
||||||
|
Shape shape = body[i];
|
||||||
|
Area area = (Area) shape;
|
||||||
|
if (area != null) {
|
||||||
|
area.transform(rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateControlPoints() {
|
||||||
|
double x = controlPoints[0].getX();
|
||||||
|
double y = controlPoints[0].getY();
|
||||||
|
|
||||||
|
int springLength = (int) SPRING_LENGTH.convertToPixels();
|
||||||
|
int holeToEdge = (int) HOLE_TO_EDGE.convertToPixels();
|
||||||
|
|
||||||
|
double centerY = y + springLength - holeToEdge;
|
||||||
|
|
||||||
|
AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY).transform(controlPoints[0], controlPoints[1]);
|
||||||
|
AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY).transform(controlPoints[0], controlPoints[2]);
|
||||||
|
|
||||||
|
// Rotate if needed
|
||||||
|
if (getTheta() != 0) {
|
||||||
|
AffineTransform rotation = AffineTransform.getRotateInstance(getTheta(), x, y);
|
||||||
|
for (Point2D point : controlPoints) {
|
||||||
|
rotation.transform(point, point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
|
int waferDiameter = 15 * width / 32;
|
||||||
|
int sleeveDiameter = 9 * width / 32;
|
||||||
|
|
||||||
|
AffineTransform tx = g2d.getTransform();
|
||||||
|
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(6f * width / 32));
|
||||||
|
g2d.setColor(BASE_COLOR);
|
||||||
|
g2d.drawLine(width / 2, 4 * width / 32, width / 2, width / 4);
|
||||||
|
|
||||||
|
g2d.rotate(RING_THETA, width / 2, height / 2);
|
||||||
|
|
||||||
|
g2d.drawLine(width / 2, 4 * width / 32, width / 2, width / 4);
|
||||||
|
|
||||||
|
g2d.setColor(WAFER_COLOR);
|
||||||
|
g2d.draw(new Ellipse2D.Double(width / 2 - waferDiameter / 2, height / 2 - waferDiameter / 2, waferDiameter,
|
||||||
|
waferDiameter));
|
||||||
|
|
||||||
|
g2d.setColor(BASE_COLOR);
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2f * width / 32));
|
||||||
|
g2d.draw(new Ellipse2D.Double(width / 2 - sleeveDiameter / 2, height / 2 - sleeveDiameter / 2, sleeveDiameter,
|
||||||
|
sleeveDiameter));
|
||||||
|
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(6f * width / 32));
|
||||||
|
g2d.rotate(-Math.PI / 2, width / 2, height / 2);
|
||||||
|
|
||||||
|
g2d.drawLine(width / 2, 4 * width / 32, width / 2, width / 3);
|
||||||
|
|
||||||
|
g2d.setTransform(tx);
|
||||||
|
g2d.setColor(LABEL_COLOR);
|
||||||
|
g2d.setFont(LABEL_FONT.deriveFont(width / 3.5f));
|
||||||
|
|
||||||
|
RenderingHints rh = new RenderingHints(
|
||||||
|
RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||||
|
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||||
|
g2d.setRenderingHints(rh);
|
||||||
|
|
||||||
|
StringUtils.drawCenteredText(g2d, "1/8\"", width / 2 - 1, height / 2, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getControlPointCount() {
|
||||||
|
return controlPoints.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||||
|
return VisibilityPolicy.NEVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isControlPointSticky(int index) {
|
||||||
|
return index < 2 || (getType() == OpenJackType.STEREO || getType() == OpenJackType.SWITCHED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Point2D getControlPoint(int index) {
|
||||||
|
return controlPoints[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setControlPoint(Point2D point, int index) {
|
||||||
|
this.controlPoints[index].setLocation(point);
|
||||||
|
// Invalidate the body
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public Integer getAngle() {
|
||||||
|
if (angle == null || (orientation != null && orientation != Orientation.DEFAULT)) {
|
||||||
|
if (orientation != null && orientation != Orientation.DEFAULT)
|
||||||
|
angle = Integer.parseInt(orientation.name().replace("_", ""));
|
||||||
|
else
|
||||||
|
angle = 0;
|
||||||
|
}
|
||||||
|
return angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAngle(Integer angle) {
|
||||||
|
this.angle = angle;
|
||||||
|
updateControlPoints();
|
||||||
|
// Invalidate the body
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected double getTheta() {
|
||||||
|
return Math.toRadians(getAngle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public OpenJackType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(OpenJackType type) {
|
||||||
|
this.type = type;
|
||||||
|
updateControlPoints();
|
||||||
|
// Invalidate the body
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Labels")
|
||||||
|
public boolean getShowLabels() {
|
||||||
|
return showLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShowLabels(boolean showLabels) {
|
||||||
|
this.showLabels = showLabels;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getControlPointNodeName(int index) {
|
||||||
|
if (index == 0)
|
||||||
|
return "Tip";
|
||||||
|
if (index == 1)
|
||||||
|
return "Sleeve";
|
||||||
|
if (index == 2 && getType() == OpenJackType.STEREO)
|
||||||
|
return "Ring";
|
||||||
|
if (index == 2 && getType() == OpenJackType.SWITCHED)
|
||||||
|
return "Shunt";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
Area area = new Area();
|
||||||
|
Area[] body = getBody();
|
||||||
|
int margin = 20;
|
||||||
|
for (Area a : body)
|
||||||
|
if (a != null)
|
||||||
|
area.add(a);
|
||||||
|
Rectangle2D bounds = area.getBounds2D();
|
||||||
|
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin, bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum OpenJackType {
|
||||||
|
|
||||||
|
MONO, STEREO, SWITCHED;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name().substring(0, 1) + name().substring(1).toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
|
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/app-framework.jar" sourcepath="/app-framework"/>
|
<classpathentry kind="lib" path="lib/app-framework.jar" sourcepath="/app-framework"/>
|
||||||
<classpathentry kind="lib" path="lib/swing-framework.jar" sourcepath="/swing-framework"/>
|
<classpathentry kind="lib" path="lib/swing-framework.jar" sourcepath="/swing-framework"/>
|
||||||
<classpathentry kind="lib" path="library/main.jar" sourcepath="/diylc-library"/>
|
|
||||||
<classpathentry kind="lib" path="lib/balloontip-1.2.4.1.jar"/>
|
<classpathentry kind="lib" path="lib/balloontip-1.2.4.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jep-2.4.1.jar"/>
|
<classpathentry kind="lib" path="lib/jep-2.4.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/poi-3.5-FINAL-20090928.jar"/>
|
<classpathentry kind="lib" path="lib/poi-3.5-FINAL-20090928.jar"/>
|
||||||
@@ -18,6 +17,7 @@
|
|||||||
<classpathentry kind="lib" path="lib/gestures-wrapper-0.2.jar"/>
|
<classpathentry kind="lib" path="lib/gestures-wrapper-0.2.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jar-loader.jar"/>
|
<classpathentry kind="lib" path="lib/jar-loader.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/svgSalamander-1.1.2.4.jar"/>
|
<classpathentry kind="lib" path="lib/svgSalamander-1.1.2.4.jar"/>
|
||||||
|
<classpathentry kind="lib" path="library/main.jar"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/diylc-core"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/diylc-core"/>
|
||||||
<classpathentry kind="lib" path="lib/xstream-1.4.3.jar"/>
|
<classpathentry kind="lib" path="lib/xstream-1.4.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/java-http-proxy.jar"/>
|
<classpathentry kind="lib" path="lib/java-http-proxy.jar"/>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<property name="jar.dir" value="${build.dir}/jar" />
|
<property name="jar.dir" value="${build.dir}/jar" />
|
||||||
<property name="report.dir" value="${build.dir}/junitreport" />
|
<property name="report.dir" value="${build.dir}/junitreport" />
|
||||||
<property name="main.class" value="org.diylc.DIYLCStarter" />
|
<property name="main.class" value="org.diylc.DIYLCStarter" />
|
||||||
<property name="diylc.version" value="4.19.0" />
|
<property name="diylc.version" value="4.20.0" />
|
||||||
|
|
||||||
<property name="osx.jre8.path" value="jre\osx\jdk8u275-b01-jre\Contents\Home\" />
|
<property name="osx.jre8.path" value="jre\osx\jdk8u275-b01-jre\Contents\Home\" />
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
AWG
|
AWG
|
||||||
And
|
And
|
||||||
C-B-E BJT
|
C-B-E BJT
|
||||||
|
Check Trace Proximity
|
||||||
D-G-S JFET
|
D-G-S JFET
|
||||||
D-G-S MOSFET
|
D-G-S MOSFET
|
||||||
D-S-G JFET
|
D-S-G JFET
|
||||||
@@ -39,6 +40,8 @@ DPDT (Center OFF)
|
|||||||
Deutsch
|
Deutsch
|
||||||
Dimension Mode
|
Dimension Mode
|
||||||
Donate
|
Donate
|
||||||
|
Dots (Gradual)
|
||||||
|
Dots (Uniform)
|
||||||
E-B-C BJT
|
E-B-C BJT
|
||||||
English
|
English
|
||||||
Español
|
Español
|
||||||
@@ -47,18 +50,28 @@ G-D-S JFET
|
|||||||
G-D-S MOSFET
|
G-D-S MOSFET
|
||||||
G-S-D JFET
|
G-S-D JFET
|
||||||
G-S-D MOSFET
|
G-S-D MOSFET
|
||||||
|
Import Netlist
|
||||||
Italiano
|
Italiano
|
||||||
Lin
|
Lin
|
||||||
Log
|
Log
|
||||||
|
Marker Size
|
||||||
NPN
|
NPN
|
||||||
Nand
|
Nand
|
||||||
Nederlands
|
Nederlands
|
||||||
Nor
|
Nor
|
||||||
Not
|
Not
|
||||||
|
Numeric (0-10)
|
||||||
|
Numeric (1-10)
|
||||||
|
Numeric (1-11)
|
||||||
|
Numeric (1-12)
|
||||||
|
Numeric (Even, No Ticks)
|
||||||
|
Numeric (Even, With Ticks)
|
||||||
Or
|
Or
|
||||||
PAF
|
PAF
|
||||||
PCB
|
PCB
|
||||||
PNP
|
PNP
|
||||||
|
Panel
|
||||||
|
Português
|
||||||
Rev log
|
Rev log
|
||||||
S-G-D JFET
|
S-G-D JFET
|
||||||
S-G-D MOSFET
|
S-G-D MOSFET
|
||||||
@@ -67,6 +80,8 @@ SPDT
|
|||||||
SPDT (Center OFF)
|
SPDT (Center OFF)
|
||||||
SPST
|
SPST
|
||||||
Srpski
|
Srpski
|
||||||
|
Tick Width
|
||||||
|
Ticks
|
||||||
Xnor
|
Xnor
|
||||||
Xor
|
Xor
|
||||||
cm
|
cm
|
||||||
|
|||||||
@@ -37,6 +37,14 @@
|
|||||||
<update_contact>nbenitezl_AT_gmail.com</update_contact>
|
<update_contact>nbenitezl_AT_gmail.com</update_contact>
|
||||||
<content_rating type="oars-1.1"/>
|
<content_rating type="oars-1.1"/>
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="4.20.0" date="2021-09-12">
|
||||||
|
<description>
|
||||||
|
<ul>
|
||||||
|
<li>[New Feature] Added 'Open 1/8" Jack' component</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
<url>https://github.com/bancika/diy-layout-creator/releases/tag/v4.20.0</url>
|
||||||
|
</release>
|
||||||
<release version="4.19.0" date="2021-08-21">
|
<release version="4.19.0" date="2021-08-21">
|
||||||
<description>
|
<description>
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user