mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-13 10:42:09 +10:00
Improved data model for storing transparency alpha and other properties that are edited using a slider widget; as a result, the editing is more precise and does not randomly change to neighboring values
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
|
||||
DIY Layout Creator (DIYLC).
|
||||
Copyright (c) 2009-2025 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.common;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Percentage implements Serializable, Cloneable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int value;
|
||||
|
||||
public Percentage(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + value;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Percentage other = (Percentage) obj;
|
||||
if (value != other.value)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value + "%";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
}
|
||||
@@ -149,10 +149,7 @@ public abstract class AbstractCurvedComponent<T> extends AbstractTransparentComp
|
||||
path.curveTo(p[4].getX(), p[4].getY(), p[5].getX(), p[5].getY(), p[6].getX(), p[6].getY());
|
||||
}
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
drawCurve(path, g2d, componentState, drawingObserver);
|
||||
|
||||
|
||||
+31
-9
@@ -22,24 +22,46 @@
|
||||
package org.diylc.components;
|
||||
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.common.Percentage;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public abstract class AbstractTransparentComponent<T> extends AbstractComponent<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static byte MAX_ALPHA = 127;
|
||||
public static byte MAX_ALPHA_LEGACY = Byte.MAX_VALUE;
|
||||
public static int MAX_ALPHA = 100;
|
||||
|
||||
protected Byte alpha = MAX_ALPHA;
|
||||
@Deprecated
|
||||
protected Byte alpha;
|
||||
|
||||
@EditableProperty
|
||||
public Byte getAlpha() {
|
||||
if (alpha == null) {
|
||||
alpha = MAX_ALPHA;
|
||||
protected Percentage alphaPercent = new Percentage(100);
|
||||
|
||||
@EditableProperty(name = "Alpha")
|
||||
public Percentage getAlpha() {
|
||||
if (alphaPercent == null) {
|
||||
if (alpha != null) {
|
||||
alphaPercent = new Percentage(Math.round(100f * alpha / MAX_ALPHA_LEGACY));
|
||||
alpha = null;
|
||||
} else {
|
||||
alphaPercent = new Percentage(100);
|
||||
}
|
||||
}
|
||||
return alpha;
|
||||
return alphaPercent;
|
||||
}
|
||||
|
||||
public void setAlpha(Byte alpha) {
|
||||
this.alpha = alpha;
|
||||
public void setAlpha(Percentage alphaPercent) {
|
||||
this.alphaPercent = alphaPercent;
|
||||
}
|
||||
|
||||
public Composite applyAlpha(Graphics2D g2d, ComponentState componentState) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
int alpha = componentState == ComponentState.DRAGGING ? 0 : getAlpha().getValue();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha / 100f));
|
||||
}
|
||||
return oldComposite;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,5 +27,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface PercentEditor {
|
||||
|
||||
public byte _100PercentValue();
|
||||
public int minValue() default 0;
|
||||
|
||||
public int maxValue() default 100;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ import org.diylc.utils.Constants;
|
||||
public class DrawingManager {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(DrawingManager.class);
|
||||
public static final byte MIRROR_ALPHA = 64;
|
||||
public static final Percentage MIRROR_ALPHA = new Percentage(50);
|
||||
|
||||
public static int CONTROL_POINT_SIZE = 7;
|
||||
public static double EXTRA_SPACE = 0.25;
|
||||
|
||||
@@ -317,6 +317,10 @@
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added more ceramic resistor variants to 'Resistor' component</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Improved data model for storing transparency alpha and other properties that are edited using a slider widget; as a result, the editing is more precise and does not randomly change to neighboring values</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Improved editing experience of integer properties (e.g. number of terminals on a tag strip) by using the spinner text field</description>
|
||||
|
||||
@@ -235,7 +235,7 @@ public class CalcUtilsTest {
|
||||
assertEquals(Color.BLACK.getRed(), result.getRed());
|
||||
assertEquals(Color.BLACK.getGreen(), result.getGreen());
|
||||
assertEquals(Color.BLACK.getBlue(), result.getBlue());
|
||||
assertEquals(128, result.getAlpha());
|
||||
assertEquals(128, result.getAlpha().getValue());
|
||||
|
||||
// Test light color with alpha - should become WHITE
|
||||
Color transparentLight = new Color(255, 255, 200, 128);
|
||||
@@ -243,16 +243,16 @@ public class CalcUtilsTest {
|
||||
assertEquals(Color.WHITE.getRed(), result.getRed());
|
||||
assertEquals(Color.WHITE.getGreen(), result.getGreen());
|
||||
assertEquals(Color.WHITE.getBlue(), result.getBlue());
|
||||
assertEquals(128, result.getAlpha());
|
||||
assertEquals(128, result.getAlpha().getValue());
|
||||
|
||||
// Test fully transparent color
|
||||
Color transparent = new Color(100, 150, 200, 0);
|
||||
result = CalcUtils.convertToMonochrome(transparent);
|
||||
assertEquals(0, result.getAlpha());
|
||||
assertEquals(0, result.getAlpha().getValue());
|
||||
|
||||
// Test opaque color - alpha should remain 255
|
||||
Color opaque = new Color(50, 50, 50);
|
||||
result = CalcUtils.convertToMonochrome(opaque);
|
||||
assertEquals(255, result.getAlpha());
|
||||
assertEquals(255, result.getAlpha().getValue());
|
||||
}
|
||||
}
|
||||
|
||||
+3
-12
@@ -165,10 +165,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
|
||||
new Ellipse2D.Double((getFlipStanding() ? getPoints()[1] : getPoints()[0]).getX() - width / 2,
|
||||
(getFlipStanding() ? getPoints()[1] : getPoints()[0]).getY() - width / 2, width, width);
|
||||
shapeRect = body.getBounds();
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getStandingBodyColor());
|
||||
g2d.fill(body);
|
||||
g2d.setComposite(oldComposite);
|
||||
@@ -255,10 +252,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
|
||||
g2d.translate((getPoints()[0].getX() + getPoints()[1].getX() - length) / 2, (getPoints()[0].getY() + getPoints()[1].getY() - width) / 2);
|
||||
g2d.rotate(theta, length / 2, width / 2);
|
||||
// Draw body.
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
if (getBodyColor() != null) {
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
|
||||
@@ -440,10 +434,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractLabeledComponen
|
||||
break;
|
||||
}
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (getAlpha() < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * getAlpha() / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
if (shouldShadeLeads()) {
|
||||
Shape lineShape = stroke.createStrokedShape(line);
|
||||
|
||||
|
||||
@@ -88,12 +88,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
|
||||
Point2D finalSecondPoint = getFinalSecondPoint();
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
// render as transparent when dragging
|
||||
int alpha = componentState == ComponentState.DRAGGING ? 0 : this.alpha;
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(boardColor);
|
||||
g2d.fillRect((int)firstPoint.getX(), (int)firstPoint.getY(), (int)(finalSecondPoint.getX() - firstPoint.getX()), (int)(finalSecondPoint.getY() - firstPoint.getY()));
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
@@ -70,10 +70,7 @@ public class BlankBoard extends AbstractBoard {
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(boardColor);
|
||||
if (getType() == Type.SQUARE)
|
||||
g2d.fillRect((int)firstPoint.getX(), (int)firstPoint.getY(), (int)(finalSecondPoint.getX() - firstPoint.getX()), (int)(finalSecondPoint.getY() - firstPoint.getY()));
|
||||
|
||||
@@ -78,9 +78,7 @@ public class EyeletBoard extends AbstractBoard {
|
||||
}
|
||||
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
applyAlpha(g2d, componentState);
|
||||
double x = firstPoint.getX();
|
||||
double y = firstPoint.getY();
|
||||
int diameter = getClosestOdd((int) EYELET_SIZE.convertToPixels());
|
||||
|
||||
+1
-3
@@ -76,9 +76,7 @@ public class MarshallPerfBoard extends AbstractBoard {
|
||||
}
|
||||
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
applyAlpha(g2d, componentState);
|
||||
double x = firstPoint.getX();
|
||||
double y = firstPoint.getY();
|
||||
int holeDiameter = getClosestOdd((int) HOLE_SIZE.convertToPixels());
|
||||
|
||||
@@ -72,9 +72,7 @@ public class PerfBoard extends AbstractBoard implements ILayeredComponent {
|
||||
}
|
||||
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
applyAlpha(g2d, componentState);
|
||||
double x = firstPoint.getX();
|
||||
double y = firstPoint.getY();
|
||||
int diameter = getClosestOdd((int) PAD_SIZE.convertToPixels());
|
||||
|
||||
@@ -278,10 +278,7 @@ public class TagStrip extends AbstractTransparentComponent<String> implements IC
|
||||
Area[] area = getBody();
|
||||
Area mainArea = area[0];
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBoardColor());
|
||||
g2d.fill(mainArea);
|
||||
|
||||
|
||||
@@ -360,10 +360,7 @@ public class TerminalStrip extends AbstractTransparentComponent<String> implemen
|
||||
Area[] body = getBody();
|
||||
Area mainArea = getBody()[0];
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBoardColor());
|
||||
g2d.fill(mainArea);
|
||||
|
||||
|
||||
@@ -61,10 +61,7 @@ public class TriPadBoard extends AbstractVeroBoard implements ILayeredComponent
|
||||
}
|
||||
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
double x = firstPoint.getX();
|
||||
double y = firstPoint.getY();
|
||||
int stripSize = getClosestOdd((int) STRIP_SIZE.convertToPixels());
|
||||
|
||||
@@ -60,10 +60,7 @@ public class VeroBoard extends AbstractVeroBoard implements ILayeredComponent {
|
||||
}
|
||||
super.draw(g2d, componentState, outlineMode, project, drawingObserver);
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
double x = firstPoint.getX();
|
||||
double y = firstPoint.getY();
|
||||
int stripSize = getClosestOdd((int) STRIP_SIZE.convertToPixels());
|
||||
|
||||
@@ -59,10 +59,7 @@ public class ChassisPanel extends AbstractShape {
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke((int) borderThickness.convertToPixels()));
|
||||
int radius = (int) edgeRadius.convertToPixels();
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(color);
|
||||
if (radius == 0) {
|
||||
g2d.fillRect((int) firstPoint.getX(), (int) firstPoint.getY(),
|
||||
|
||||
+1
-4
@@ -48,10 +48,7 @@ public class EllipticalCutout extends AbstractShape {
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke((int) borderThickness.convertToPixels()));
|
||||
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(color);
|
||||
g2d.fillOval((int)firstPoint.getX(), (int)firstPoint.getY(), (int)(secondPoint.getX() - firstPoint.getX()), (int)(secondPoint.getY() - firstPoint.getY()));
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
@@ -66,10 +66,7 @@ public class PolygonalCutout extends AbstractShape {
|
||||
yPoints[i] = (int)controlPoints[i].getY();
|
||||
}
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (this.alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(3, 1.0F * this.alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.fillPolygon(xPoints, yPoints, controlPoints.length);
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
|
||||
+1
-4
@@ -54,10 +54,7 @@ public class RectangularCutout extends AbstractShape {
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke((int) borderThickness.convertToPixels()));
|
||||
int radius = (int) edgeRadius.convertToPixels();
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(color);
|
||||
g2d.fillRoundRect((int)firstPoint.getX(), (int)firstPoint.getY(), (int)(secondPoint.getX() - firstPoint.getX()), (int)(secondPoint.getY() - firstPoint.getY()), radius,
|
||||
radius);
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ import com.bancika.gerberwriter.GerberFunctions;
|
||||
import org.diylc.common.LineStyle;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.PCBLayer;
|
||||
import org.diylc.common.Percentage;
|
||||
import org.diylc.components.AbstractCurvedComponent;
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.components.LineEndingStyle;
|
||||
@@ -126,7 +127,7 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> implements ILayer
|
||||
public void setValue(Void value) {}
|
||||
|
||||
@Override
|
||||
public void setAlpha(Byte alpha) {
|
||||
public void setAlpha(Percentage alpha) {
|
||||
super.setAlpha(alpha);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,10 +64,7 @@ public class CutLine extends AbstractTransparentComponent<Void> {
|
||||
: color);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(w));
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
if (getOrientation() == OrientationHV.HORIZONTAL)
|
||||
g2d.drawLine((int)point.getX(), (int)point.getY(), (int)point.getX() + l, (int)point.getY());
|
||||
|
||||
@@ -72,10 +72,7 @@ public class Eyelet extends AbstractTransparentComponent<String> {
|
||||
int diameter = getClosestOdd((int) size.convertToPixels());
|
||||
int holeDiameter = getClosestOdd((int) holeSize.convertToPixels());
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (getAlpha() < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * getAlpha() / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
|
||||
g2d.setColor(color);
|
||||
|
||||
@@ -84,10 +84,7 @@ public class GroundFill extends AbstractTransparentComponent<Void>
|
||||
yPoints[i] = (int)controlPoints[i].getY();
|
||||
}
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (getAlpha() < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * getAlpha() / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.fillPolygon(xPoints, yPoints, controlPoints.length);
|
||||
g2d.setComposite(oldComposite);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
+3
-6
@@ -32,6 +32,7 @@ import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation45;
|
||||
import org.diylc.common.Percentage;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.transform.SimpleComponentTransformer;
|
||||
import org.diylc.core.*;
|
||||
@@ -67,7 +68,7 @@ public class MultimeterProbe extends AbstractTransparentComponent<Color> {
|
||||
private transient Shape[] body = null;
|
||||
|
||||
public MultimeterProbe() {
|
||||
this.alpha = (byte) (MAX_ALPHA / 2);
|
||||
this.alphaPercent = new Percentage(50);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,11 +86,7 @@ public class MultimeterProbe extends AbstractTransparentComponent<Color> {
|
||||
(int) (sensitivity * 2), (int) (sensitivity * 2));
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(
|
||||
AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : PROBE_COLOR);
|
||||
g2d.fill(shapes[0]);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : handleColor);
|
||||
|
||||
+1
-5
@@ -206,11 +206,7 @@ public class PCBTerminalBlock extends AbstractTransparentComponent<PCBTerminalBl
|
||||
Constants.DEFAULT_THEME);
|
||||
// Draw body if available.
|
||||
if (body != null) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(
|
||||
AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
g2d.fill(body[0]);
|
||||
// Do not track these changes because the whole switch has been tracked
|
||||
|
||||
@@ -80,10 +80,7 @@ public class SolderLug extends AbstractMultiPartComponent<String> {
|
||||
Shape[] body = getBody();
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||
g2d.fill(body[0]);
|
||||
|
||||
|
||||
@@ -91,10 +91,7 @@ public class SolderPad extends AbstractTransparentComponent<Void>
|
||||
gerberDrawingObserver.startGerberOutput(gerberCopperLayer, GerberFunctions.CONNECTOR_PAD, false);
|
||||
gerberDrawingObserver.startGerberOutput(org.diylc.core.gerber.GerberLayer.SolderMaskBot, "Material", false);
|
||||
}
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (getAlpha() < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * getAlpha() / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
if (type == Type.ROUND) {
|
||||
g2d.fill(new Ellipse2D.Double(point.getX() - diameter / 2, point.getY() - diameter / 2,
|
||||
|
||||
@@ -79,10 +79,7 @@ public class TraceCut extends AbstractTransparentComponent<Void> implements ILay
|
||||
if (checkPointsClipped(g2d.getClip())) {
|
||||
return;
|
||||
}
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (getAlpha() < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * getAlpha() / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchZoomableStroke(1f));
|
||||
int size = getClosestOdd((int) this.size.convertToPixels());
|
||||
int cutWidth = getClosestOdd((int) CUT_WIDTH.convertToPixels());
|
||||
|
||||
@@ -67,10 +67,7 @@ public class Turret extends AbstractTransparentComponent<String> {
|
||||
if (checkPointsClipped(g2d.getClip())) {
|
||||
return;
|
||||
}
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (getAlpha() < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * getAlpha() / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
int diameter = getClosestOdd((int) size.convertToPixels());
|
||||
int holeDiameter = getClosestOdd((int) holeSize.convertToPixels());
|
||||
g2d.setColor(color);
|
||||
|
||||
+1
-4
@@ -78,10 +78,7 @@ public class BatterySnap9V extends AbstractTransparentComponent<String> {
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : color);
|
||||
g2d.fill(body[0]);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : METAL_COLOR);
|
||||
|
||||
+1
-4
@@ -202,10 +202,7 @@ public class CliffJack1_4 extends AbstractMultiPartComponent<JackType> implement
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BODY_COLOR);
|
||||
for (int i = 0; i < body.length - 1; i++) {
|
||||
// Nut is brighter colored.
|
||||
|
||||
+1
-4
@@ -216,10 +216,7 @@ public class CliffJack1_8 extends AbstractMultiPartComponent<JackType> implement
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BODY_COLOR);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
g2d.fill(body[i]);
|
||||
|
||||
+1
-4
@@ -223,10 +223,7 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<JackType> implemen
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BODY_COLOR);
|
||||
g2d.fill(body[0]);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : SHAFT_COLOR);
|
||||
|
||||
+3
-9
@@ -31,10 +31,7 @@ import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
|
||||
import org.diylc.common.Display;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.*;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -97,7 +94,7 @@ public class DIPSwitch extends AbstractTransparentComponent<String> implements I
|
||||
public DIPSwitch() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
alpha = (byte) 100;
|
||||
this.alphaPercent = new Percentage(100);
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
@@ -348,10 +345,7 @@ public class DIPSwitch extends AbstractTransparentComponent<String> implements I
|
||||
pinWidth, pinHeight);
|
||||
}
|
||||
}
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
g2d.fill(mainArea);
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
+1
-4
@@ -79,10 +79,7 @@ public class DrillHole extends AbstractTransparentComponent<Void>
|
||||
gerberDrawingObserver.startGerberOutput(drillLayer, GerberFunctions.COMPONENT_DRILL, false);
|
||||
}
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (getAlpha() < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * getAlpha() / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
// Draw white circle (hole)
|
||||
g2d.setColor(Color.white);
|
||||
|
||||
+1
-4
@@ -174,10 +174,7 @@ public class FuseHolderPanel extends AbstractMultiPartComponent<String> {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
// Draw body if available.
|
||||
if (body != null) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
for (Area a : body)
|
||||
if (a != null) {
|
||||
|
||||
+1
-4
@@ -197,10 +197,7 @@ public class IECSocket extends AbstractMultiPartComponent<String> {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
// Draw body if available.
|
||||
if (body != null) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
for (Area a : body)
|
||||
if (a != null) {
|
||||
|
||||
+1
-4
@@ -297,10 +297,7 @@ public class MiniRelay extends AbstractLabeledComponent<String> implements IGerb
|
||||
return;
|
||||
}
|
||||
Area mainArea = getBody()[0];
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BODY_COLOR);
|
||||
g2d.fill(mainArea);
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
+1
-4
@@ -277,10 +277,7 @@ public class MiniToggleSwitch extends AbstractTransparentComponent<ToggleSwitchT
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
// Draw body if available.
|
||||
if (body != null) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
g2d.fill(body);
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
+1
-4
@@ -215,10 +215,7 @@ public class NeutrikJack1_4 extends AbstractMultiPartComponent<JackType> {
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BODY_COLOR);
|
||||
for (int i = 0; i < body.length - 1; i++) {
|
||||
// Nut is brighter colored.
|
||||
|
||||
+2
-8
@@ -102,10 +102,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<OpenJackType> {
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : WAFER_COLOR);
|
||||
g2d.fill(body[0]);
|
||||
|
||||
@@ -126,10 +123,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<OpenJackType> {
|
||||
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));
|
||||
}
|
||||
oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
g2d.setColor(Constants.TRANSPARENT_COLOR);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
|
||||
+2
-8
@@ -102,10 +102,7 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<OpenJackType> {
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : WAFER_COLOR);
|
||||
g2d.fill(body[0]);
|
||||
|
||||
@@ -126,10 +123,7 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<OpenJackType> {
|
||||
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));
|
||||
}
|
||||
oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
|
||||
+2
-8
@@ -94,10 +94,7 @@ public class PilotLampHolder extends AbstractMultiPartComponent<String> {
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : WAFER_COLOR);
|
||||
g2d.fill(body[0]);
|
||||
|
||||
@@ -118,10 +115,7 @@ public class PilotLampHolder extends AbstractMultiPartComponent<String> {
|
||||
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));
|
||||
}
|
||||
oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
|
||||
+1
-4
@@ -222,10 +222,7 @@ public class PinHeader extends AbstractTransparentComponent<Void> {
|
||||
Area[] body = getBody();
|
||||
Area mainArea = body[0];
|
||||
Area shroudArea = body[1];
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||
g2d.fill(mainArea);
|
||||
if (shroudArea != null) {
|
||||
|
||||
+1
-4
@@ -136,10 +136,7 @@ public class PlasticDCJack extends AbstractMultiPartComponent<String> implements
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BODY_COLOR);
|
||||
g2d.fill(body[0]);
|
||||
drawingObserver.stopTracking();
|
||||
|
||||
+2
-8
@@ -86,10 +86,7 @@ public class RCAJack extends AbstractMultiPartComponent<String> {
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : WAFER_COLOR);
|
||||
g2d.fill(body[0]);
|
||||
|
||||
@@ -111,10 +108,7 @@ public class RCAJack extends AbstractMultiPartComponent<String> {
|
||||
g2d.setColor(finalBorderColor);
|
||||
g2d.draw(body[0]);
|
||||
|
||||
oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
|
||||
+2
-8
@@ -94,10 +94,7 @@ public class RotarySelectorSwitch extends AbstractMultiPartComponent<String> imp
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BODY_COLOR);
|
||||
g2d.fill(body[0]);
|
||||
|
||||
@@ -117,10 +114,7 @@ public class RotarySelectorSwitch extends AbstractMultiPartComponent<String> imp
|
||||
g2d.setColor(finalBorderColor);
|
||||
g2d.draw(body[0]);
|
||||
|
||||
oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : TERMINAL_COLOR);
|
||||
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
|
||||
+9
-5
@@ -349,10 +349,8 @@ public class RotarySwitchOpen extends AbstractAngledComponent<RotarySwitchOpenTy
|
||||
: getColor().darker();
|
||||
}
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
Composite alphaComposite = g2d.getComposite();
|
||||
|
||||
int commonPinCount = 2;
|
||||
int secondLevelStart = 2 * configuration.getPositionCount() + commonPinCount;
|
||||
@@ -365,8 +363,10 @@ public class RotarySwitchOpen extends AbstractAngledComponent<RotarySwitchOpenTy
|
||||
drawingObserver.startTracking();
|
||||
g2d.fill(body[i]);
|
||||
drawingObserver.stopTracking();
|
||||
g2d.setComposite(oldComposite);
|
||||
g2d.setColor(outlineMode ? finalBorderColor : pinColor.darker());
|
||||
g2d.draw(body[i]);
|
||||
g2d.setComposite(alphaComposite);
|
||||
}
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
}
|
||||
@@ -380,7 +380,9 @@ public class RotarySwitchOpen extends AbstractAngledComponent<RotarySwitchOpenTy
|
||||
}
|
||||
|
||||
g2d.setColor(finalBorderColor);
|
||||
g2d.setComposite(oldComposite);
|
||||
g2d.draw(body[0]);
|
||||
g2d.setComposite(alphaComposite);
|
||||
|
||||
// Draw pins
|
||||
for (int i = 1; i <= secondLevelStart; i++) {
|
||||
@@ -389,8 +391,10 @@ public class RotarySwitchOpen extends AbstractAngledComponent<RotarySwitchOpenTy
|
||||
g2d.fill(body[i]);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
if (!outlineMode) {
|
||||
g2d.setColor(outlineMode ? finalBorderColor : pinColor.darker());
|
||||
g2d.setComposite(oldComposite);
|
||||
g2d.setColor(pinColor.darker());
|
||||
g2d.draw(body[i]);
|
||||
g2d.setComposite(alphaComposite);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -174,10 +174,7 @@ public class RotarySwitchSealed extends AbstractAngledComponent<RotarySwitchSeal
|
||||
|
||||
// Draw body
|
||||
Shape[] body = getBody();
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getColor());
|
||||
g2d.fill(body[0]);
|
||||
|
||||
+1
-5
@@ -234,11 +234,7 @@ public class SlideSwitch extends AbstractTransparentComponent<SlideSwitchType> i
|
||||
Constants.DEFAULT_THEME);
|
||||
// Draw body if available.
|
||||
if (body != null) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(
|
||||
AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
if (getShowBracket()) {
|
||||
g2d.setColor(getBracketColor());
|
||||
|
||||
+1
-4
@@ -242,10 +242,7 @@ public class TactileMicroSwitch extends AbstractLabeledComponent<String> impleme
|
||||
g2d.draw(rect);
|
||||
}
|
||||
}
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
drawingObserver.startTracking();
|
||||
g2d.fill(mainArea);
|
||||
|
||||
@@ -146,10 +146,7 @@ public class Freeway3x3_03 extends AbstractTransparentComponent<Void> implements
|
||||
List<Shape> labels = getLabels();
|
||||
Shape caseShape = getCase();
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
AffineTransform oldTx = new AffineTransform(g2d.getTransform());
|
||||
|
||||
|
||||
@@ -121,10 +121,7 @@ public class Freeway3x3_05 extends AbstractTransparentComponent<Void> implements
|
||||
g2d.rotate(theta, x, y);
|
||||
}
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
double offsetX = getXOffsetsPx()[0];
|
||||
double offsetY = getYOffsetsPx()[0];
|
||||
|
||||
@@ -98,10 +98,7 @@ public class HumbuckerPickup extends AbstractGuitarPickup {
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : color);
|
||||
if (getType() != HumbuckerType.Filtertron) {
|
||||
drawingObserver.startTracking();
|
||||
|
||||
@@ -85,10 +85,7 @@ public class JazzBassPickup extends AbstractSingleOrHumbuckerPickup {
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : color);
|
||||
g2d.fill(body[0]);
|
||||
g2d.fill(body[1]);
|
||||
|
||||
@@ -85,10 +85,7 @@ public class LPSwitch extends AbstractTransparentComponent<String> implements IS
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : WAFER_COLOR);
|
||||
g2d.fill(body[1]);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||
|
||||
@@ -100,10 +100,7 @@ public class LeverSwitch extends AbstractAngledComponent<LeverSwitch.LeverSwitch
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||
g2d.fill(body[0]);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : WAFER_COLOR);
|
||||
|
||||
@@ -96,10 +96,7 @@ public class P90Pickup extends AbstractSingleOrHumbuckerPickup {
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : color);
|
||||
g2d.fill(body[0]);
|
||||
if (body[1] != null)
|
||||
|
||||
@@ -82,10 +82,7 @@ public class PBassPickup extends AbstractSingleOrHumbuckerPickup {
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : color);
|
||||
g2d.fill(body[0]);
|
||||
g2d.fill(body[1]);
|
||||
|
||||
@@ -156,10 +156,7 @@ public class S1Switch extends AbstractTransparentComponent<Void> implements ISwi
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
// Draw body if available.
|
||||
if (body != null) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BODY_COLOR);
|
||||
g2d.fill(body);
|
||||
drawingObserver.stopTracking();
|
||||
|
||||
+1
-5
@@ -103,11 +103,7 @@ public class SchallerMegaSwitch extends AbstractAngledComponent<String> implemen
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||
g2d.fill(body[0]);
|
||||
drawingObserver.stopTracking();
|
||||
|
||||
@@ -109,10 +109,7 @@ public class SingleCoilPickup extends AbstractSingleOrHumbuckerPickup {
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
Theme theme =
|
||||
(Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
|
||||
+1
-5
@@ -82,11 +82,7 @@ import java.awt.geom.*;
|
||||
|
||||
Shape[] body = getBody();
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : color);
|
||||
g2d.fill(body[0]);
|
||||
|
||||
@@ -128,10 +128,7 @@ public class Image extends AbstractTransparentComponent<Void> {
|
||||
.getIconHeight() * scaleY))) {
|
||||
return;
|
||||
}
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
double x;
|
||||
double y;
|
||||
@@ -242,7 +239,7 @@ public class Image extends AbstractTransparentComponent<Void> {
|
||||
}
|
||||
}
|
||||
|
||||
@PercentEditor(_100PercentValue = 25)
|
||||
@PercentEditor(minValue = 1, maxValue = 1000)
|
||||
@EditableProperty(defaultable = false)
|
||||
public byte getScale() {
|
||||
if (scale != null) {
|
||||
|
||||
@@ -72,11 +72,7 @@ public class Loadline extends AbstractBoard {
|
||||
|
||||
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));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(boardColor);
|
||||
|
||||
g2d.fillRect((int)firstPoint.getX(), (int)firstPoint.getY(), (int)(finalSecondPoint.getX() - firstPoint.getX()),
|
||||
|
||||
@@ -107,10 +107,7 @@ public class SVGImage extends AbstractTransparentComponent<Void> {
|
||||
svgDiagram.getWidth() * scaleX, svgDiagram.getHeight() * scaleY))) {
|
||||
return;
|
||||
}
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
double x;
|
||||
double y;
|
||||
@@ -229,7 +226,7 @@ public class SVGImage extends AbstractTransparentComponent<Void> {
|
||||
this.svgDiagram = null;
|
||||
}
|
||||
|
||||
@PercentEditor(_100PercentValue = 25)
|
||||
@PercentEditor(minValue = 0, maxValue = 1000)
|
||||
@EditableProperty(defaultable = false)
|
||||
public byte getScale() {
|
||||
if (scale != null) {
|
||||
|
||||
+2
-5
@@ -97,7 +97,7 @@ public class AudioTransformer extends AbstractMultiPartComponent<String> impleme
|
||||
public AudioTransformer() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
alpha = 100;
|
||||
// alpha = 100;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
@@ -276,10 +276,7 @@ public class AudioTransformer extends AbstractMultiPartComponent<String> impleme
|
||||
g2d.drawOval((int)(point.getX() - pinSize / 2), (int)(point.getY() - pinSize / 2), pinSize, pinSize);
|
||||
}
|
||||
}
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
// render coil
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getCoilColor());
|
||||
|
||||
@@ -110,10 +110,7 @@ public class BoxTrimmer extends AbstractTransparentComponent<Resistance> {
|
||||
}
|
||||
|
||||
// Draw body
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||
g2d.fillRoundRect(bodyX, bodyY, bodyW, bodyH, bodyW / 10, bodyH / 10);
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
+1
-4
@@ -351,10 +351,7 @@ public class MultiSectionCapacitor extends AbstractLabeledComponent<Capacitance[
|
||||
}
|
||||
int pinSize = (int) PIN_SIZE.convertToPixels() / 2 * 2;
|
||||
Area[] area = getBody();
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||
g2d.fill(area[0]);
|
||||
drawingObserver.startTracking();
|
||||
|
||||
+1
-4
@@ -289,10 +289,7 @@ public class PotentiometerPanel extends AbstractPotentiometer implements ILayere
|
||||
g2d.setColor(getBodyColor());
|
||||
}
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
if (!outlineMode) {
|
||||
if (i >= 10)
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
|
||||
+1
-4
@@ -376,10 +376,7 @@ public class TrimmerPotentiometer extends AbstractPotentiometer {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
if (mainShape != null) {
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.fill(mainShape);
|
||||
drawingObserver.stopTracking();
|
||||
if (!outlineMode && shaftShape != null) {
|
||||
|
||||
+3
-11
@@ -34,12 +34,7 @@ import java.awt.geom.RoundRectangle2D;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
|
||||
import org.diylc.awt.StringUtils;
|
||||
import org.diylc.common.Display;
|
||||
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.common.*;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.components.RoundedPolygon;
|
||||
import org.diylc.components.AbstractLeadedComponent.LabelOriantation;
|
||||
@@ -117,7 +112,7 @@ public class BridgeRectifier extends AbstractLabeledComponent<String> implements
|
||||
public BridgeRectifier() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
alpha = 100;
|
||||
this.alphaPercent = new Percentage(100);
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
@@ -380,10 +375,7 @@ public class BridgeRectifier extends AbstractLabeledComponent<String> implements
|
||||
}
|
||||
}
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
g2d.fill(mainArea);
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
@@ -322,10 +322,7 @@ public class DIL_IC extends AbstractLabeledComponent<String> implements IGerberC
|
||||
g2d.draw(rect);
|
||||
}
|
||||
}
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
drawingObserver.startTracking();
|
||||
g2d.fill(mainArea);
|
||||
|
||||
@@ -86,10 +86,7 @@ public class ICSymbol extends AbstractTransparentComponent<String> {
|
||||
return;
|
||||
}
|
||||
int pinSpacing = (int) PIN_SPACING.convertToPixels();
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
Shape[] body = getBody();
|
||||
|
||||
|
||||
+1
-4
@@ -82,10 +82,7 @@ public class LogicGateSymbol extends AbstractTransparentComponent<String> {
|
||||
return;
|
||||
}
|
||||
int pinSpacing = (int) PIN_SPACING.convertToPixels();
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
|
||||
Shape[] body = getBody();
|
||||
|
||||
|
||||
+3
-9
@@ -32,10 +32,7 @@ import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
|
||||
import org.diylc.common.Display;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.*;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -92,7 +89,7 @@ public class MultiwattIC extends AbstractTransparentComponent<String> implements
|
||||
public MultiwattIC() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
alpha = 100;
|
||||
this.alphaPercent = new Percentage(100);
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
@@ -421,10 +418,7 @@ public class MultiwattIC extends AbstractTransparentComponent<String> implements
|
||||
}
|
||||
|
||||
drawingObserver.startTracking();
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
g2d.fill(mainArea);
|
||||
drawingObserver.stopTracking();
|
||||
|
||||
@@ -34,10 +34,7 @@ import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
|
||||
import org.diylc.common.Display;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.*;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.transform.SIL_ICTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
@@ -99,7 +96,7 @@ public class SIL_IC extends AbstractTransparentComponent<String> implements IGer
|
||||
public SIL_IC() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
alpha = 100;
|
||||
this.alphaPercent = new Percentage(100);
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
@@ -302,10 +299,7 @@ public class SIL_IC extends AbstractTransparentComponent<String> implements IGer
|
||||
}
|
||||
}
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
g2d.fill(mainArea);
|
||||
drawingObserver.stopTracking();
|
||||
|
||||
+3
-5
@@ -37,6 +37,7 @@ import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Percentage;
|
||||
import org.diylc.components.transform.TO1Transformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -74,7 +75,7 @@ public class TransistorTO1 extends AbstractTransistorPackage {
|
||||
public TransistorTO1() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
alpha = (byte) 100;
|
||||
this.alphaPercent = new Percentage(100);
|
||||
bodyColor = BODY_COLOR;
|
||||
borderColor = BORDER_COLOR;
|
||||
}
|
||||
@@ -181,10 +182,7 @@ public class TransistorTO1 extends AbstractTransistorPackage {
|
||||
}
|
||||
|
||||
Area mainArea = getBody()[0];
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||
drawingObserver.startTracking();
|
||||
g2d.fill(mainArea);
|
||||
|
||||
+3
-5
@@ -37,6 +37,7 @@ import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Percentage;
|
||||
import org.diylc.components.transform.TO220Transformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -78,7 +79,7 @@ public class TransistorTO126 extends AbstractTransistorPackage {
|
||||
public TransistorTO126() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
alpha = (byte) 100;
|
||||
this.alphaPercent = new Percentage(100);
|
||||
bodyColor = BODY_COLOR;
|
||||
borderColor = BORDER_COLOR;
|
||||
}
|
||||
@@ -270,10 +271,7 @@ public class TransistorTO126 extends AbstractTransistorPackage {
|
||||
|
||||
|
||||
Shape mainArea = getBody()[0];
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||
drawingObserver.startTracking();
|
||||
g2d.fill(mainArea);
|
||||
|
||||
+3
-5
@@ -37,6 +37,7 @@ import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Percentage;
|
||||
import org.diylc.components.transform.TO220Transformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -83,7 +84,7 @@ public class TransistorTO220 extends AbstractTransistorPackage {
|
||||
public TransistorTO220() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
alpha = (byte) 100;
|
||||
this.alphaPercent = new Percentage(100);
|
||||
bodyColor = BODY_COLOR;
|
||||
borderColor = BORDER_COLOR;
|
||||
}
|
||||
@@ -298,10 +299,7 @@ public class TransistorTO220 extends AbstractTransistorPackage {
|
||||
|
||||
Shape mainArea = getBody()[0];
|
||||
Shape tabArea = getBody()[1];
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||
drawingObserver.startTracking();
|
||||
g2d.fill(mainArea);
|
||||
|
||||
+3
-9
@@ -37,10 +37,7 @@ import java.awt.geom.Rectangle2D;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
|
||||
import org.diylc.awt.TwoCircleTangent;
|
||||
import org.diylc.common.Display;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.*;
|
||||
import org.diylc.components.AbstractLabeledComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -89,7 +86,7 @@ public class TransistorTO3 extends AbstractLabeledComponent<String> {
|
||||
public TransistorTO3() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
alpha = (byte) 100;
|
||||
this.alphaPercent = new Percentage(100);
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
@@ -247,10 +244,7 @@ public class TransistorTO3 extends AbstractLabeledComponent<String> {
|
||||
|
||||
Area mainArea = getBody()[0];
|
||||
Area innerArea = getBody()[1];
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||
drawingObserver.startTracking();
|
||||
g2d.fill(mainArea);
|
||||
|
||||
+3
-5
@@ -37,6 +37,7 @@ import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Percentage;
|
||||
import org.diylc.components.transform.TO92Transformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -72,7 +73,7 @@ public class TransistorTO92 extends AbstractTransistorPackage {
|
||||
public TransistorTO92() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
alpha = (byte) 100;
|
||||
this.alphaPercent = new Percentage(100);
|
||||
bodyColor = BODY_COLOR;
|
||||
borderColor = BORDER_COLOR;
|
||||
}
|
||||
@@ -202,10 +203,7 @@ public class TransistorTO92 extends AbstractTransistorPackage {
|
||||
}
|
||||
|
||||
Area mainArea = getBody()[0];
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||
drawingObserver.startTracking();
|
||||
g2d.fill(mainArea);
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Percentage;
|
||||
import org.diylc.components.transform.SimpleComponentTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -46,13 +47,7 @@ public class Ellipse extends AbstractShapeWithDimensions {
|
||||
IDrawingObserver drawingObserver) {
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke((int) borderThickness.convertToPixels()));
|
||||
|
||||
float alpha = this.alpha;
|
||||
if (componentState == ComponentState.DRAGGING)
|
||||
alpha = 0;
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(color);
|
||||
g2d.fillOval((int)firstPoint.getX(), (int)firstPoint.getY(), (int)(secondPoint.getX() - firstPoint.getX()), (int)(secondPoint.getY() - firstPoint.getY()));
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
@@ -69,10 +69,7 @@ public class Polygon extends AbstractShape {
|
||||
yPoints[i] = (int)controlPoints[i].getY();
|
||||
}
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (this.alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(3, 1.0F * this.alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.fillPolygon(xPoints, yPoints, controlPoints.length);
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
|
||||
@@ -53,14 +53,7 @@ public class Rectangle extends AbstractShapeWithDimensions {
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke((int) borderThickness.convertToPixels()));
|
||||
int radius = (int) edgeRadius.convertToPixels();
|
||||
|
||||
float alpha = this.alpha;
|
||||
if (componentState == ComponentState.DRAGGING)
|
||||
alpha = 0;
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(color);
|
||||
g2d.fillRoundRect((int)firstPoint.getX(), (int)firstPoint.getY(), (int)(secondPoint.getX() - firstPoint.getX()), (int)(secondPoint.getY() - firstPoint.getY()), radius,
|
||||
radius);
|
||||
|
||||
@@ -38,6 +38,7 @@ import java.text.DecimalFormat;
|
||||
import org.diylc.common.Display;
|
||||
import org.diylc.common.LineStyle;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Percentage;
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.components.transform.SimpleComponentTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
@@ -276,7 +277,7 @@ public class TapeMeasure extends AbstractLeadedComponent<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Byte getAlpha() {
|
||||
public Percentage getAlpha() {
|
||||
return super.getAlpha();
|
||||
}
|
||||
|
||||
|
||||
@@ -240,10 +240,7 @@ public abstract class PassiveSMDComponent<T> extends AbstractLabeledComponent<T>
|
||||
|
||||
// draw main area
|
||||
Area mainArea = getBody()[0];
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
g2d.fill(mainArea);
|
||||
g2d.setComposite(oldComposite);
|
||||
@@ -269,9 +266,7 @@ public abstract class PassiveSMDComponent<T> extends AbstractLabeledComponent<T>
|
||||
Area contactArea = getBody()[1];
|
||||
if (!outlineMode) {
|
||||
g2d.setColor(PIN_COLOR);
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
applyAlpha(g2d, componentState);
|
||||
g2d.fill(contactArea);
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
@@ -266,8 +266,8 @@ package org.diylc.components.smd;
|
||||
// // draw main area
|
||||
// Area mainArea = getBody()[0];
|
||||
// Composite oldComposite = g2d.getComposite();
|
||||
// if (alpha < MAX_ALPHA) {
|
||||
// g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
// if (getAlpha().getValue() < MAX_ALPHA) {
|
||||
// g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getAlpha().getValue() / 100f));
|
||||
// }
|
||||
// g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
// g2d.fill(mainArea);
|
||||
@@ -294,8 +294,8 @@ package org.diylc.components.smd;
|
||||
// Area contactArea = getBody()[1];
|
||||
// if (!outlineMode) {
|
||||
// g2d.setColor(PIN_COLOR);
|
||||
// if (alpha < MAX_ALPHA) {
|
||||
// g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
// if (getAlpha().getValue() < MAX_ALPHA) {
|
||||
// g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getAlpha().getValue() / 100f));
|
||||
// }
|
||||
// g2d.fill(contactArea);
|
||||
// g2d.setComposite(oldComposite);
|
||||
|
||||
+1
-4
@@ -206,10 +206,7 @@ public class Jumbo4PinTubeSocket extends AbstractAngledComponent<String> {
|
||||
|
||||
Shape baseShape = body[0];
|
||||
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getColor());
|
||||
g2d.fill(baseShape);
|
||||
|
||||
@@ -306,10 +306,7 @@ public class SubminiTube extends AbstractLabeledComponent<String> {
|
||||
}
|
||||
int pinSize = (int) LEAD_THICKNESS.convertToPixels() / 2 * 2;
|
||||
Shape mainArea = getBody()[0];
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||
g2d.fill(mainArea);
|
||||
|
||||
|
||||
@@ -241,10 +241,7 @@ public class TubeSocket extends AbstractAngledComponent<String> implements IGerb
|
||||
|
||||
// Draw body
|
||||
Shape[] body = getBody();
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
Composite oldComposite = applyAlpha(g2d, componentState);
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getColor());
|
||||
g2d.fill(body[0]);
|
||||
|
||||
@@ -31,15 +31,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.common.*;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import org.diylc.common.Display;
|
||||
import org.diylc.common.HorizontalAlignment;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.OrientationHV;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.boards.AbstractBoard;
|
||||
@@ -673,7 +669,7 @@ public class V1FileParser implements IOldFileParser {
|
||||
((AbstractLeadedComponent<?>) component).setDisplay(Display.NAME);
|
||||
}
|
||||
if (component instanceof AbstractTransparentComponent<?>) {
|
||||
((AbstractTransparentComponent<?>) component).setAlpha((byte) 100);
|
||||
((AbstractTransparentComponent<?>) component).setAlpha(new Percentage(100));
|
||||
}
|
||||
project.getComponents().add(component);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.Percentage;
|
||||
import org.nfunk.jep.JEP;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
@@ -83,10 +84,8 @@ import org.diylc.core.measures.ResistanceUnit;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.presenter.Presenter;
|
||||
import org.diylc.serialization.IOldFileParser;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
|
||||
public class V2FileParser implements IOldFileParser {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(V2FileParser.class);
|
||||
@@ -142,9 +141,9 @@ public class V2FileParser implements IOldFileParser {
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
if (node.getNodeName().equalsIgnoreCase("component")) {
|
||||
LOG.debug(node.getAttributes().getNamedItem("name").getNodeValue());
|
||||
NodeList unuci = node.getChildNodes();
|
||||
Node properties = unuci.item(1);
|
||||
Node points = unuci.item(3);
|
||||
NodeList grandchildNodes = node.getChildNodes();
|
||||
Node properties = grandchildNodes.item(1);
|
||||
Node points = grandchildNodes.item(3);
|
||||
|
||||
NodeList propertyList = properties.getChildNodes();
|
||||
NodeList pointList = points.getChildNodes();
|
||||
@@ -174,7 +173,6 @@ public class V2FileParser implements IOldFileParser {
|
||||
// // gives Name Part# Thickness Color Group
|
||||
if (propertyList.item(j).getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("color")) {
|
||||
String color = propertyList.item(j).getAttributes().getNamedItem("value").getNodeValue();
|
||||
System.out.println(color);
|
||||
String hex_r = color.substring(0, 2);
|
||||
int value_r = Integer.parseInt(hex_r, 16);
|
||||
String hex_g = color.substring(2, 4);
|
||||
@@ -234,7 +232,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
} else if (propertyList.item(j).getAttributes().getNamedItem("name").getNodeValue()
|
||||
.equalsIgnoreCase("Value")) {
|
||||
String pr8 = propertyList.item(j).getAttributes().getNamedItem("value").getNodeValue();
|
||||
if (pr8 != "") {
|
||||
if (!pr8.isEmpty()) {
|
||||
value_s = pr8;
|
||||
String pr9 = pr8.replaceAll("[^0-9.]", "");
|
||||
String pr10 = pr8.replaceAll("[^a-zA-Z]", "");
|
||||
@@ -287,7 +285,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
if (cl != null) {
|
||||
board.setBoardColor(cl);
|
||||
}
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
board.setName(com_name);
|
||||
} else {
|
||||
board.setName("Main board");
|
||||
@@ -298,7 +296,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Perfboard")) {
|
||||
PerfBoard board = new PerfBoard();
|
||||
board.setBoardColor(Color.white);
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
board.setName(com_name);
|
||||
} else {
|
||||
board.setName("Main board");
|
||||
@@ -309,7 +307,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(board);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Copper Trace")) {
|
||||
CopperTrace trace = new CopperTrace();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
trace.setName(com_name);
|
||||
} else {
|
||||
trace.setName("t");
|
||||
@@ -324,7 +322,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Copper Trace Curved")) {
|
||||
CurvedTrace trace = new CurvedTrace();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
trace.setName(com_name);
|
||||
} else {
|
||||
trace.setName("t");
|
||||
@@ -340,7 +338,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(trace);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Eyelet")) {
|
||||
Eyelet eyelet = new Eyelet();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
eyelet.setName(com_name);
|
||||
} else {
|
||||
eyelet.setName("eyelet");
|
||||
@@ -350,7 +348,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(eyelet);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Solder pad")) {
|
||||
SolderPad pad = new SolderPad();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
pad.setName(com_name);
|
||||
} else
|
||||
pad.setName("pad");
|
||||
@@ -363,7 +361,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(pad);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Stripboard")) {
|
||||
VeroBoard board = new VeroBoard();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
board.setName(com_name);
|
||||
} else {
|
||||
board.setName("Main board");
|
||||
@@ -374,7 +372,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(board);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Trace Cut")) {
|
||||
TraceCut cut = new TraceCut();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
cut.setName(com_name);
|
||||
} else
|
||||
cut.setName("cut");
|
||||
@@ -383,7 +381,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Switch")) {
|
||||
MiniToggleSwitch sw = new MiniToggleSwitch();
|
||||
sw.setValue(ToggleSwitchType.DPDT);
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
sw.setName(com_name);
|
||||
} else
|
||||
sw.setName("sw");
|
||||
@@ -416,7 +414,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(sw);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Wire")) {
|
||||
HookupWire hw = new HookupWire();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
hw.setName(com_name);
|
||||
} else
|
||||
hw.setName("hookup_wire");
|
||||
@@ -472,11 +470,11 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(hw);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Electrolytic (Axial)")) {
|
||||
AxialElectrolyticCapacitor capacitor = new AxialElectrolyticCapacitor();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
capacitor.setName(com_name);
|
||||
} else
|
||||
capacitor.setName("A_E_C");
|
||||
capacitor.setAlpha((byte) transparency);
|
||||
capacitor.setAlpha(new Percentage(transparency));
|
||||
if (value != -9999) {
|
||||
capacitor.setValue(new Capacitance(value, cp));
|
||||
}
|
||||
@@ -492,10 +490,10 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(capacitor);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Capacitor (Axial)")) {
|
||||
AxialFilmCapacitor capacitor = new AxialFilmCapacitor();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
capacitor.setName(com_name);
|
||||
}
|
||||
capacitor.setAlpha((byte) transparency);
|
||||
capacitor.setAlpha(new Percentage(transparency));
|
||||
if (value != -9999) {
|
||||
capacitor.setValue(new Capacitance(value, cp));
|
||||
} else
|
||||
@@ -512,11 +510,11 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(capacitor);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Capacitor (Ceramic)")) {
|
||||
RadialCeramicDiskCapacitor capacitor = new RadialCeramicDiskCapacitor();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
capacitor.setName(com_name);
|
||||
} else
|
||||
capacitor.setName("Radial_Ceramic_Capacitor");
|
||||
capacitor.setAlpha((byte) transparency);
|
||||
capacitor.setAlpha(new Percentage(transparency));
|
||||
if (value != -9999) {
|
||||
capacitor.setValue(new Capacitance(value, cp));
|
||||
}
|
||||
@@ -532,11 +530,11 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(capacitor);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Capacitor (Radial)")) {
|
||||
RadialFilmCapacitor capacitor = new RadialFilmCapacitor();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
capacitor.setName(com_name);
|
||||
} else
|
||||
capacitor.setName("Radial_Film_Capacitor");
|
||||
capacitor.setAlpha((byte) transparency);
|
||||
capacitor.setAlpha(new Percentage(transparency));
|
||||
if (value != -9999) {
|
||||
capacitor.setValue(new Capacitance(value, cp));
|
||||
}
|
||||
@@ -552,28 +550,28 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(capacitor);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Electrolytic (Radial)")) {
|
||||
RadialElectrolytic capacitor = new RadialElectrolytic();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
capacitor.setName(com_name);
|
||||
} else
|
||||
capacitor.setName("Radial_Electrolytic_Capacitor");
|
||||
if (value != -9999) {
|
||||
capacitor.setValue(new Capacitance(value, cp));
|
||||
}
|
||||
capacitor.setAlpha((byte) transparency);
|
||||
capacitor.setAlpha(new Percentage(transparency));
|
||||
capacitor.setLength(diameterPro);
|
||||
capacitor.setControlPoint(tacke.get(0), 0);
|
||||
capacitor.setControlPoint(tacke.get(1), 1);
|
||||
project.getComponents().add(capacitor);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Potentiometer Lug")) {
|
||||
PotentiometerPanel panel = new PotentiometerPanel();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
panel.setName(com_name);
|
||||
} else
|
||||
panel.setName("potentiometer_panel");
|
||||
if (value != -9999) {
|
||||
panel.setValue(new Resistance(value, ru));
|
||||
}
|
||||
panel.setAlpha((byte) transparency);
|
||||
panel.setAlpha(new Percentage(transparency));
|
||||
if (angle > 45 && angle <= 135)
|
||||
panel.setOrientation(Orientation._90);
|
||||
else if (angle > 135 && angle <= 225)
|
||||
@@ -592,14 +590,14 @@ public class V2FileParser implements IOldFileParser {
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Resistor")
|
||||
|| node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Resistor Standing")) {
|
||||
Resistor resistor = new Resistor();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
resistor.setName(com_name);
|
||||
} else
|
||||
resistor.setName("resistor");
|
||||
if (value != -9999) {
|
||||
resistor.setValue(new Resistance(value, ru));
|
||||
}
|
||||
resistor.setAlpha((byte) transparency);
|
||||
resistor.setAlpha(new Percentage(transparency));
|
||||
resistor.setWidth(diameterPro);
|
||||
if (lengthPro.getValue() != 0) {
|
||||
resistor.setLength(lengthPro);
|
||||
@@ -609,7 +607,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(resistor);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Capacitor Symbol")) {
|
||||
CapacitorSymbol cap = new CapacitorSymbol();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
cap.setName(com_name);
|
||||
} else
|
||||
cap.setName("cap_simbol");
|
||||
@@ -625,7 +623,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(cap);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Diode Symbol")) {
|
||||
DiodeSymbol dio = new DiodeSymbol();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
dio.setName(com_name);
|
||||
} else
|
||||
dio.setName("dp");
|
||||
@@ -639,7 +637,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(dio);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Ground Symbol")) {
|
||||
GroundSymbol gs = new GroundSymbol();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
gs.setName(com_name);
|
||||
} else
|
||||
gs.setName("gs");
|
||||
@@ -648,11 +646,11 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(gs);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("LED Symbol")) {
|
||||
LEDSymbol ls = new LEDSymbol();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
ls.setName(com_name);
|
||||
} else
|
||||
ls.setName("ls");
|
||||
if (value_s != "") {
|
||||
if (!value_s.isEmpty()) {
|
||||
ls.setValue(value_s);
|
||||
}
|
||||
ls.setBodyColor(cl);
|
||||
@@ -662,12 +660,12 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(ls);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Pentode")) {
|
||||
PentodeSymbol ps = new PentodeSymbol();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
ps.setName(com_name);
|
||||
} else
|
||||
ps.setName("ps");
|
||||
ps.setColor(cl);
|
||||
if (value_s != "")
|
||||
if (!value_s.isEmpty())
|
||||
ps.setValue(value_s);
|
||||
|
||||
Point point;
|
||||
@@ -678,7 +676,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(ps);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Electrolytic Symbol")) {
|
||||
CapacitorSymbol cs = new CapacitorSymbol();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
cs.setName(com_name);
|
||||
} else
|
||||
cs.setName("cs");
|
||||
@@ -694,13 +692,13 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(cs);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Opamp Symbol")) {
|
||||
ICSymbol ic = new ICSymbol();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
ic.setName(com_name);
|
||||
} else
|
||||
ic.setName("ics");
|
||||
if (value_s != "")
|
||||
if (!value_s.isEmpty())
|
||||
ic.setValue(value_s);
|
||||
ic.setAlpha((byte) transparency);
|
||||
ic.setAlpha(new Percentage(transparency));
|
||||
Point point;
|
||||
int x = (int) (tacke.get(0).getX() - 70);
|
||||
int y = (int) tacke.get(0).getY() - 20;
|
||||
@@ -710,12 +708,12 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(ic);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Potentiometer Symbol")) {
|
||||
PotentiometerSymbol ps = new PotentiometerSymbol();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
ps.setName(com_name);
|
||||
} else
|
||||
ps.setName("ps");
|
||||
ps.setOrientation(Orientation._270);
|
||||
if (value_s != "")
|
||||
if (!value_s.isEmpty())
|
||||
ps.setValue(value_s);
|
||||
ps.setColor(cl);
|
||||
Point point;
|
||||
@@ -730,7 +728,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(ps);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Resistor Symbol")) {
|
||||
ResistorSymbol rs = new ResistorSymbol();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
rs.setName(com_name);
|
||||
} else
|
||||
rs.setName("rs");
|
||||
@@ -746,11 +744,11 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(rs);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Triode")) {
|
||||
TriodeSymbol ts = new TriodeSymbol();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
ts.setName(com_name);
|
||||
} else
|
||||
ts.setName("ts");
|
||||
if (value_s != "") {
|
||||
if (!value_s.isEmpty()) {
|
||||
ts.setValue(value_s);
|
||||
}
|
||||
ts.setColor(cl);
|
||||
@@ -762,14 +760,14 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(ts);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Diode")) {
|
||||
DiodePlastic dp = new DiodePlastic();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
dp.setName(com_name);
|
||||
} else
|
||||
dp.setName("dp");
|
||||
if (value_s != "") {
|
||||
if (!value_s.isEmpty()) {
|
||||
dp.setValue(value_s);
|
||||
}
|
||||
dp.setAlpha((byte) transparency);
|
||||
dp.setAlpha(new Percentage(transparency));
|
||||
if (display.equals("Name"))
|
||||
dp.setDisplay(Display.NAME);
|
||||
else
|
||||
@@ -781,7 +779,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(dp);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("IC DIL")) {
|
||||
DIL_IC dil = new DIL_IC();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
dil.setName(com_name);
|
||||
} else
|
||||
dil.setName("dil");
|
||||
@@ -795,8 +793,6 @@ public class V2FileParser implements IOldFileParser {
|
||||
dil.setPinCount(PinCount._10);
|
||||
else if (pins == 12)
|
||||
dil.setPinCount(PinCount._12);
|
||||
else if (pins == 12)
|
||||
dil.setPinCount(PinCount._12);
|
||||
else if (pins == 14)
|
||||
dil.setPinCount(PinCount._14);
|
||||
else if (pins == 16)
|
||||
@@ -835,8 +831,8 @@ public class V2FileParser implements IOldFileParser {
|
||||
dil.setPinCount(PinCount._48);
|
||||
else if (pins == 50)
|
||||
dil.setPinCount(PinCount._50);
|
||||
dil.setAlpha((byte) transparency);
|
||||
if (value_s != "")
|
||||
dil.setAlpha(new Percentage(transparency));
|
||||
if (!value_s.isEmpty())
|
||||
dil.setValue(value_s);
|
||||
dil.setRowSpacing(spacingPro);
|
||||
dil.setControlPoint(tacke.get(0), 0);
|
||||
@@ -844,12 +840,12 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(dil);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Transistor")) {
|
||||
TransistorTO92 trans = new TransistorTO92();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
trans.setName(com_name);
|
||||
} else
|
||||
trans.setName("tr");
|
||||
trans.setAlpha((byte) transparency);
|
||||
if (value_s != "") {
|
||||
trans.setAlpha(new Percentage(transparency));
|
||||
if (!value_s.isEmpty()) {
|
||||
trans.setValue(value_s);
|
||||
}
|
||||
trans.setPinSpacing(new Size(0.1, SizeUnit.in));
|
||||
@@ -898,7 +894,7 @@ public class V2FileParser implements IOldFileParser {
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Ellipse")) {
|
||||
Ellipse el = new Ellipse();
|
||||
el.setName("elipse");
|
||||
el.setAlpha((byte) transparency);
|
||||
el.setAlpha(new Percentage(transparency));
|
||||
el.setColor(cl);
|
||||
el.setControlPoint(tacke.get(0), 0);
|
||||
el.setControlPoint(tacke.get(1), 1);
|
||||
@@ -915,19 +911,19 @@ public class V2FileParser implements IOldFileParser {
|
||||
Rectangle rec = new Rectangle();
|
||||
rec.setName("rec");
|
||||
rec.setColor(cl);
|
||||
rec.setAlpha((byte) transparency);
|
||||
rec.setAlpha(new Percentage(transparency));
|
||||
rec.setEdgeRadius(radiusPro);
|
||||
rec.setControlPoint(tacke.get(0), 0);
|
||||
rec.setControlPoint(tacke.get(1), 1);
|
||||
project.getComponents().add(rec);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Noval Tube Socket")) {
|
||||
TubeSocket ts = new TubeSocket();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
ts.setName(com_name);
|
||||
} else
|
||||
ts.setName("ts");
|
||||
ts.setAlpha((byte) transparency);
|
||||
if (value_s != "")
|
||||
ts.setAlpha(new Percentage(transparency));
|
||||
if (!value_s.isEmpty())
|
||||
ts.setValue(value_s);
|
||||
ts.setAngle(Angle.of((int) angle));
|
||||
ts.setControlPoint(tacke.get(0), 0);
|
||||
@@ -935,12 +931,12 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(ts);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("BJT Transistor")) {
|
||||
BJTSymbol bjt = new BJTSymbol();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
bjt.setName(com_name);
|
||||
} else
|
||||
bjt.setName("bjt");
|
||||
bjt.setColor(cl);
|
||||
if (value_s != "")
|
||||
if (!value_s.isEmpty())
|
||||
bjt.setValue(value_s);
|
||||
if (angle <= 45 || angle > 315)
|
||||
bjt.setOrientation(Orientation.DEFAULT);
|
||||
@@ -958,12 +954,12 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(bjt);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("Octal Tube Socket")) {
|
||||
TubeSocket ts = new TubeSocket();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
ts.setName(com_name);
|
||||
} else
|
||||
ts.setName("ts");
|
||||
ts.setAlpha((byte) transparency);
|
||||
if (value_s != "")
|
||||
ts.setAlpha(new Percentage(transparency));
|
||||
if (!value_s.isEmpty())
|
||||
ts.setValue(value_s);
|
||||
ts.setAngle(Angle.of((int) angle));
|
||||
ts.setControlPoint(tacke.get(0), 0);
|
||||
@@ -971,12 +967,12 @@ public class V2FileParser implements IOldFileParser {
|
||||
project.getComponents().add(ts);
|
||||
} else if (node.getAttributes().getNamedItem("name").getNodeValue().equalsIgnoreCase("7-pin Tube Socket")) {
|
||||
TubeSocket ts = new TubeSocket();
|
||||
if (com_name != "") {
|
||||
if (!com_name.isEmpty()) {
|
||||
ts.setName(com_name);
|
||||
} else
|
||||
ts.setName("ts");
|
||||
ts.setAlpha((byte) transparency);
|
||||
if (value_s != "")
|
||||
ts.setAlpha(new Percentage(transparency));
|
||||
if (!value_s.isEmpty())
|
||||
ts.setValue(value_s);
|
||||
ts.setAngle(Angle.of((int)angle));
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JLabel;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.common.Percentage;
|
||||
import org.diylc.components.misc.LoadlineEntity;
|
||||
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
@@ -99,8 +100,8 @@ public class FieldEditorFactory {
|
||||
DynamicValueEditor editor = new DynamicValueEditor(property);
|
||||
return editor;
|
||||
}
|
||||
if (Byte.class.isAssignableFrom(property.getType()) || byte.class.isAssignableFrom(property.getType())) {
|
||||
ByteEditor editor = new ByteEditor(property);
|
||||
if (Percentage.class.isAssignableFrom(property.getType())) {
|
||||
PercentageEditor editor = new PercentageEditor(property);
|
||||
return editor;
|
||||
}
|
||||
if (Boolean.class.isAssignableFrom(property.getType()) || boolean.class.isAssignableFrom(property.getType())) {
|
||||
|
||||
+26
-23
@@ -33,33 +33,32 @@ import javax.swing.event.ChangeListener;
|
||||
|
||||
import org.diylc.swingframework.DoubleTextField;
|
||||
|
||||
import org.diylc.common.Percentage;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.core.annotations.PercentEditor;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
public class ByteEditor extends JPanel {
|
||||
public class PercentageEditor extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Color oldBg = getBackground();
|
||||
|
||||
private static final byte default100Percent = 127;
|
||||
private int minValue = 0;
|
||||
private int maxValue = 100;
|
||||
|
||||
private byte _100PercentValue;
|
||||
|
||||
public ByteEditor(final PropertyWrapper property) {
|
||||
public PercentageEditor(final PropertyWrapper property) {
|
||||
super();
|
||||
|
||||
setLayout(new FlowLayout());
|
||||
|
||||
try {
|
||||
PercentEditor percentEditor = property.getGetter().getAnnotation(PercentEditor.class);
|
||||
if (percentEditor == null)
|
||||
_100PercentValue = default100Percent;
|
||||
else
|
||||
_100PercentValue = percentEditor._100PercentValue();
|
||||
if (percentEditor != null) {
|
||||
minValue = percentEditor.minValue();
|
||||
maxValue = percentEditor.maxValue();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
_100PercentValue = default100Percent;
|
||||
}
|
||||
|
||||
final JSlider slider = new JSlider();
|
||||
@@ -70,10 +69,8 @@ public class ByteEditor extends JPanel {
|
||||
valueField.setEnabled(false);
|
||||
}
|
||||
|
||||
final double percentFactor = (double) default100Percent / _100PercentValue;
|
||||
|
||||
slider.setMinimum(0);
|
||||
slider.setMaximum(default100Percent * 100);
|
||||
slider.setMinimum(minValue);
|
||||
slider.setMaximum(maxValue);
|
||||
|
||||
slider.addChangeListener(new ChangeListener() {
|
||||
|
||||
@@ -82,24 +79,30 @@ public class ByteEditor extends JPanel {
|
||||
property.setChanged(true);
|
||||
setBackground(oldBg);
|
||||
slider.setBackground(oldBg);
|
||||
property.setValue(Integer.valueOf(slider.getValue() / 100).byteValue());
|
||||
valueField.setText(Integer.toString((int) Math.round(percentFactor * (double) slider.getValue()
|
||||
/ default100Percent)));
|
||||
|
||||
property.setValue(new Percentage(slider.getValue()));
|
||||
valueField.setText(Integer.toString(slider.getValue()));
|
||||
}
|
||||
});
|
||||
slider.setValue((Byte) property.getValue() * 100);
|
||||
|
||||
valueField
|
||||
.setText(Integer.toString((int) Math.round(percentFactor * (double) slider.getValue() / default100Percent)));
|
||||
Object val = property.getValue();
|
||||
if (val != null) {
|
||||
slider.setValue(((Percentage) val).getValue());
|
||||
} else {
|
||||
slider.setValue(minValue);
|
||||
}
|
||||
|
||||
valueField.setText(Integer.toString(slider.getValue()));
|
||||
valueField.setColumns(3);
|
||||
valueField.addKeyListener(new KeyAdapter() {
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
try {
|
||||
int newPosition = (int) (Double.parseDouble(valueField.getText()) * default100Percent / percentFactor);
|
||||
System.out.println("keyReleased, pos: " + newPosition);
|
||||
slider.setValue(newPosition);
|
||||
int newPosition = (int) Double.parseDouble(valueField.getText());
|
||||
if (newPosition >= minValue && newPosition <= maxValue) {
|
||||
slider.setValue(newPosition);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import org.apache.poi.util.IOUtils;
|
||||
import org.diylc.appframework.miscutils.IConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.InMemoryConfigurationManager;
|
||||
import org.diylc.appframework.miscutils.Utils;
|
||||
import org.diylc.common.*;
|
||||
import org.diylc.components.connectivity.Dot;
|
||||
import org.diylc.components.connectivity.Line;
|
||||
import org.diylc.components.misc.Image;
|
||||
@@ -47,12 +48,6 @@ import org.diylc.swingframework.DoubleTextField;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.io.xml.DomDriver;
|
||||
|
||||
import org.diylc.common.EventType;
|
||||
import org.diylc.common.HorizontalAlignment;
|
||||
import org.diylc.common.IPlugIn;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.PropertyWrapper;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractCurvedComponent.PointCount;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IView;
|
||||
@@ -687,7 +682,7 @@ public class LoadlineEditorFrame extends JFrame implements IView {
|
||||
image.setControlPoint(new Point((int) spacing, (int) spacing), 0);
|
||||
image.setControlPoint(new Point((int) (canvasDimensions.width - spacing),
|
||||
(int) (canvasDimensions.height - spacing)), 1);
|
||||
image.setAlpha((byte) 50); // make it transparent
|
||||
image.setAlpha(new Percentage(50)); // make it transparent
|
||||
fis.close();
|
||||
// add to the bottom
|
||||
project.getComponents().add(0, image);
|
||||
|
||||
Reference in New Issue
Block a user