diff --git a/diylc/diylc-library/lib/diylc-core.jar b/diylc/diylc-library/lib/diylc-core.jar index 985a3c07..6772b7db 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/electromechanical/OpenJack1_4.java b/diylc/diylc-library/src/org/diylc/components/electromechanical/OpenJack1_4.java index 148bed71..e39251c8 100644 --- a/diylc/diylc-library/src/org/diylc/components/electromechanical/OpenJack1_4.java +++ b/diylc/diylc-library/src/org/diylc/components/electromechanical/OpenJack1_4.java @@ -56,6 +56,11 @@ import org.diylc.utils.Constants; zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J") public class OpenJack1_4 extends AbstractMultiPartComponent { + private static final double RING_THETA = Math.PI * 0.795; + private static final double SLEEVE_THETA = Math.PI * 0.295; + 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; @@ -73,7 +78,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent { private Point[] controlPoints = new Point[] {new Point(0, 0), new Point(0, 0), new Point(0, 0)}; transient Area[] body; private Orientation orientation = Orientation.DEFAULT; - private JackType type = JackType.MONO; + private OpenJackType type = OpenJackType.MONO; private boolean showLabels = true; public OpenJack1_4() { @@ -151,11 +156,11 @@ public class OpenJack1_4 extends AbstractMultiPartComponent { int holeToEdge = (int) HOLE_TO_EDGE.convertToPixels(); int centerY = controlPoints[0].y + springLength - holeToEdge; Point tipLabel = new Point(controlPoints[0].x, (int) (controlPoints[0].y + holeToEdge * 1.25)); - AffineTransform ringTransform = AffineTransform.getRotateInstance(Math.PI * 0.795, controlPoints[0].x, centerY); - AffineTransform sleeveTransform = AffineTransform.getRotateInstance(Math.PI * 0.295, controlPoints[0].x, centerY); - Point ringLabel = new Point(0, 0); + AffineTransform ringTransform = AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, controlPoints[0].x, centerY); + AffineTransform sleeveTransform = AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, controlPoints[0].x, centerY); + Point ringOrSwitchLabel = new Point(0, 0); Point sleeveLabel = new Point(0, 0); - ringTransform.transform(tipLabel, ringLabel); + ringTransform.transform(tipLabel, ringOrSwitchLabel); sleeveTransform.transform(tipLabel, sleeveLabel); double theta = 0; // Rotate if needed @@ -176,13 +181,15 @@ public class OpenJack1_4 extends AbstractMultiPartComponent { if (theta != 0) { AffineTransform rotation = AffineTransform.getRotateInstance(theta, controlPoints[0].x, controlPoints[0].y); rotation.transform(tipLabel, tipLabel); - rotation.transform(ringLabel, ringLabel); + rotation.transform(ringOrSwitchLabel, ringOrSwitchLabel); rotation.transform(sleeveLabel, sleeveLabel); } drawCenteredText(g2d, "T", tipLabel.x, tipLabel.y, HorizontalAlignment.CENTER, VerticalAlignment.CENTER); drawCenteredText(g2d, "S", sleeveLabel.x, sleeveLabel.y, HorizontalAlignment.CENTER, VerticalAlignment.CENTER); - if (getType() == JackType.STEREO) - drawCenteredText(g2d, "R", ringLabel.x, ringLabel.y, HorizontalAlignment.CENTER, VerticalAlignment.CENTER); + if (getType() == OpenJackType.STEREO) + drawCenteredText(g2d, "R", ringOrSwitchLabel.x, ringOrSwitchLabel.y, HorizontalAlignment.CENTER, VerticalAlignment.CENTER); + if (getType() == OpenJackType.SWITCHED) + drawCenteredText(g2d, "Sw", ringOrSwitchLabel.x, ringOrSwitchLabel.y, HorizontalAlignment.CENTER, VerticalAlignment.CENTER); } drawSelectionOutline(g2d, componentState, outlineMode, project, drawingObserver); @@ -227,7 +234,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent { springWidth, springWidth)); sleeve.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter, holeDiameter))); - sleeve.transform(AffineTransform.getRotateInstance(Math.PI * 0.295, x, centerY)); + 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, @@ -235,17 +242,17 @@ public class OpenJack1_4 extends AbstractMultiPartComponent { body[2] = sleeve; - if (getType() == JackType.STEREO) { - Area ring = + if (getType() != OpenJackType.MONO) { + Area ringOrSwitch = new Area(new RoundRectangle2D.Double(x - springWidth / 2, y - holeToEdge, springWidth, springLength, springWidth, springWidth)); - ring.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter, + ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter, holeDiameter))); - ring.transform(AffineTransform.getRotateInstance(Math.PI * 0.795, x, centerY)); - ring.subtract(new Area(new Ellipse2D.Double(x - outerDiameter / 2, centerY - outerDiameter / 2, outerDiameter, + 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] = ring; + body[3] = ringOrSwitch; } double theta = 0; @@ -291,8 +298,8 @@ public class OpenJack1_4 extends AbstractMultiPartComponent { int centerY = y + springLength - holeToEdge; - AffineTransform.getRotateInstance(Math.PI * 0.295, x, centerY).transform(controlPoints[0], controlPoints[1]); - AffineTransform.getRotateInstance(Math.PI * 0.795, x, centerY).transform(controlPoints[0], controlPoints[2]); + AffineTransform.getRotateInstance(SLEEVE_THETA, x, centerY).transform(controlPoints[0], controlPoints[1]); + AffineTransform.getRotateInstance(RING_THETA, x, centerY).transform(controlPoints[0], controlPoints[2]); // Rotate if needed if (orientation != Orientation.DEFAULT) { @@ -324,7 +331,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent { g2d.setColor(BASE_COLOR); g2d.drawLine(width / 2, 4 * width / 32, width / 2, width / 4); - g2d.rotate(Math.PI * 0.795, width / 2, height / 2); + g2d.rotate(RING_THETA, width / 2, height / 2); g2d.drawLine(width / 2, 4 * width / 32, width / 2, width / 4); @@ -355,7 +362,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent { @Override public boolean isControlPointSticky(int index) { - return index < 2 || getType() == JackType.STEREO; + return index < 2 || getType() == OpenJackType.STEREO; } @Override @@ -393,11 +400,11 @@ public class OpenJack1_4 extends AbstractMultiPartComponent { } @EditableProperty - public JackType getType() { + public OpenJackType getType() { return type; } - public void setType(JackType type) { + public void setType(OpenJackType type) { this.type = type; updateControlPoints(); // Invalidate the body @@ -411,5 +418,15 @@ public class OpenJack1_4 extends AbstractMultiPartComponent { public void setShowLabels(boolean showLabels) { this.showLabels = showLabels; + } + + public enum OpenJackType { + + MONO, STEREO, SWITCHED; + + @Override + public String toString() { + return name().substring(0, 1) + name().substring(1).toLowerCase(); + } } } diff --git a/diylc/diylc-swing/DIYLCStarter.launch b/diylc/diylc-swing/DIYLCStarter.launch index aff8a7cb..38c8ab51 100644 --- a/diylc/diylc-swing/DIYLCStarter.launch +++ b/diylc/diylc-swing/DIYLCStarter.launch @@ -11,5 +11,5 @@ - + diff --git a/diylc/diylc-swing/lib/diylc-core.jar b/diylc/diylc-swing/lib/diylc-core.jar index 985a3c07..6772b7db 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 3fd92285..b0cc4c78 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/update.xml b/diylc/diylc-swing/update.xml index 2adeddcf..5d0a4d0f 100644 --- a/diylc/diylc-swing/update.xml +++ b/diylc/diylc-swing/update.xml @@ -2409,6 +2409,10 @@ NEW_FEATURE "RCA Jack" added + + + NEW_FEATURE + Add switched type to "Open 1/4" Jack" component IMPROVEMENT diff --git a/diylc/diylc-swing/variants.xml b/diylc/diylc-swing/variants.xml index e1ef25a6..5f064f44 100644 --- a/diylc/diylc-swing/variants.xml +++ b/diylc/diylc-swing/variants.xml @@ -171,10 +171,6 @@ DPDT - - Alpha - 127 - Body @@ -184,10 +180,18 @@ 255 + + Alpha + 127 + Orientation VERTICAL + + Type + DPDT + Border @@ -197,10 +201,6 @@ 255 - - Type - DPDT - Spacing @@ -241,25 +241,25 @@ SPDT - Alpha - 127 + Body + - Body - + Alpha + 127 Orientation VERTICAL - - Border - - Type SPDT + + Border + + Spacing @@ -283,12 +283,20 @@ + + Electro-Mechanical.RCA Jack + + Guitar.Humbucker Pickup Covered PAF-Style + + Alpha + 127 + Bobin 1 @@ -298,18 +306,6 @@ 255 - - Alpha - 127 - - - Model - - - - Orientation - DEFAULT - Pole Color @@ -319,6 +315,14 @@ 255 + + Orientation + DEFAULT + + + Model + + Bobin 2 @@ -365,10 +369,6 @@ Uncovered PAF-Style - - Alpha - 127 - Bobin 1 @@ -378,6 +378,18 @@ 255 + + Alpha + 127 + + + Model + + + + Orientation + DEFAULT + Pole Color @@ -387,14 +399,6 @@ 255 - - Orientation - DEFAULT - - - Model - - Bobin 2 @@ -441,10 +445,6 @@ EMG-style - - Alpha - 127 - Bobin 1 @@ -454,6 +454,18 @@ 255 + + Alpha + 127 + + + Model + + + + Orientation + DEFAULT + Pole Color @@ -463,14 +475,6 @@ 255 - - Orientation - DEFAULT - - - Model - - Bobin 2 @@ -517,6 +521,10 @@ Filtertron-style + + Alpha + 127 + Bobin 1 @@ -526,18 +534,6 @@ 255 - - Alpha - 127 - - - Model - - - - Orientation - DEFAULT - Pole Color @@ -547,6 +543,14 @@ 255 + + Orientation + DEFAULT + + + Model + + Bobin 2 @@ -560,14 +564,14 @@ Type Filtertron - - Cover - true - Legs false + + Cover + true + Pole Pieces 1 Screws @@ -788,6 +792,14 @@ Alpha 127 + + Model + + + + Orientation + DEFAULT + Pole Color @@ -797,14 +809,6 @@ 255 - - Orientation - DEFAULT - - - Model - - Type Stratocaster @@ -843,16 +847,16 @@ 127 - Pole Color - + Model + Orientation DEFAULT - Model - + Pole Color + Type @@ -887,16 +891,16 @@ 127 - Pole Color - + Model + Orientation DEFAULT - Model - + Pole Color + Type @@ -931,16 +935,16 @@ 127 - Pole Color - + Model + Orientation DEFAULT - Model - + Pole Color + Type @@ -975,16 +979,16 @@ 127 - Pole Color - + Model + Orientation DEFAULT - Model - + Pole Color + Type @@ -1019,16 +1023,16 @@ 127 - Pole Color - + Model + Orientation DEFAULT - Model - + Pole Color + Type @@ -1053,6 +1057,123 @@ + + org.diylc.components.electromechanical.OpenJack1_4 + + + Mono + + + Alpha + 127 + + + Orientation + DEFAULT + + + Labels + true + + + Type + MONO + + + + + 0 + 0 + + + 80 + 40 + + + 60 + 180 + + + false + + + Stereo + + + Alpha + 127 + + + Orientation + DEFAULT + + + Labels + true + + + Type + STEREO + + + + + 0 + 0 + + + 80 + 40 + + + 60 + 180 + + + false + + + Switched + + + Alpha + 127 + + + Orientation + DEFAULT + + + Labels + true + + + Type + SWITCHED + + + + + 0 + 0 + + + 80 + 40 + + + 60 + 180 + + + false + + + + + org.diylc.components.passive.PotentiometerPanel + + Passive.Audio Transformer @@ -1460,10 +1581,8 @@ - Value - - - + Alpha + 127 Body @@ -1475,8 +1594,10 @@ - Alpha - 127 + Value + + + Orientation @@ -1491,14 +1612,14 @@ 255 - - Voltage - - Display BOTH + + Voltage + + Label @@ -1550,8 +1671,12 @@ - Alpha - 127 + Value + + + + + Body @@ -1563,12 +1688,8 @@ - Value - - - - - + Alpha + 127 Orientation @@ -1583,14 +1704,14 @@ 255 - - Display - BOTH - Voltage + + Display + BOTH + Label @@ -1650,13 +1771,8 @@ - Value - - - - - - + Alpha + 127 Body @@ -1668,8 +1784,13 @@ - Alpha - 127 + Value + + + + + + Orientation @@ -1684,14 +1805,14 @@ 255 - - Voltage - - Display BOTH + + Voltage + + Label @@ -1747,19 +1868,19 @@ - Value - - - - + Alpha + 127 Body - Alpha - 127 + Value + + + + Orientation @@ -1769,14 +1890,14 @@ Border - - Voltage - - Display BOTH + + Voltage + + Label @@ -2895,8 +3016,8 @@ Directional - Alpha - 127 + Value + Body @@ -2908,17 +3029,13 @@ - Value - + Alpha + 127 Orientation DEFAULT - - Type - MiniDIP1 - Border @@ -2929,13 +3046,17 @@ - Voltage - + Type + MiniDIP1 Display BOTH + + Voltage + + Label @@ -2978,37 +3099,37 @@ Directional - Alpha - 100 + Value + Body - Value - + Alpha + 100 Orientation DEFAULT + + Border + + Type MiniRound1 - Border - + Display + BOTH Voltage - - Display - BOTH - Label @@ -3046,37 +3167,37 @@ Directional - Alpha - 100 + Value + Body - Value - + Alpha + 100 Orientation DEFAULT + + Border + + Type InLine - Border - + Display + BOTH Voltage - - Display - BOTH - Label @@ -3114,8 +3235,8 @@ Horizontal - Value - + Alpha + 100 Body @@ -3127,13 +3248,17 @@ - Alpha - 100 + Value + Orientation DEFAULT + + Type + SquareBR3 + Border @@ -3144,17 +3269,13 @@ - Type - SquareBR3 + Voltage + Display BOTH - - Voltage - - Label @@ -3200,6 +3321,10 @@ DIP8 + + Pins + _8 + Row Spacing @@ -3208,21 +3333,17 @@ - Pins - _8 + Value + + + + Body + Alpha 127 - - Body - - - - Value - - Orientation DEFAULT @@ -3242,7 +3363,7 @@ Label - + Display Pin #s @@ -3304,6 +3425,10 @@ DIP16 + + Pins + _16 + Row Spacing @@ -3312,21 +3437,17 @@ - Pins - _16 + Value + + + + Body + Alpha 127 - - Body - - - - Value - - Orientation DEFAULT @@ -3341,7 +3462,7 @@ Label - + Display Pin #s @@ -3435,14 +3556,14 @@ PCB Noval - - Base - B9A - Angle 0 + + Base + B9A + Alpha 127 @@ -3508,14 +3629,14 @@ PCB Octal - - Base - OCTAL - Angle 0 + + Base + OCTAL + Alpha 127 @@ -3572,14 +3693,14 @@ Chassis Noval - - Angle - 0 - Base B9A + + Angle + 0 + Alpha 127 @@ -3657,14 +3778,14 @@ Chassis Octal - - Angle - 0 - Base OCTAL + + Angle + 0 + Alpha 127 @@ -3733,14 +3854,14 @@ Chassis Noval 9A (12A?7) - - Angle - 0 - Base B9A + + Angle + 0 + Alpha 127 @@ -3813,14 +3934,14 @@ Chassis Noval 9CV (EL84) - - Angle - 0 - Base B9A + + Angle + 0 + Alpha 127 @@ -3893,14 +4014,14 @@ Chassis Octal 5T - - Base - OCTAL - Angle 0 + + Base + OCTAL + Alpha 127 @@ -3969,14 +4090,14 @@ Chassis Octal 7AC (6?6) - - Base - OCTAL - Angle 0 + + Base + OCTAL + Alpha 127 @@ -4045,14 +4166,14 @@ Chassis 7-pin 7BK - - Angle - 0 - Base B7G + + Angle + 0 + Alpha 127 @@ -4127,14 +4248,14 @@ Chassis Octal 8ET (EL34) - - Angle - 0 - Base OCTAL + + Angle + 0 + Alpha 127