Merge branch 'next' into lang

Conflicts:
	diylc/diylc-library/lib/diylc-core.jar
	diylc/diylc-swing/lib/diylc-core.jar
	diylc/diylc-swing/library/main.jar
This commit is contained in:
bancika
2020-04-24 13:23:26 +02:00
20 changed files with 199 additions and 28 deletions
Binary file not shown.
@@ -87,6 +87,8 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
// parameters for adjusting the label control point
protected transient Double gamma = null;
protected transient Double r = null;
private Boolean hideShortLeads = false;
protected AbstractLeadedComponent() {
super();
@@ -205,7 +207,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
double leadLength = (distance - calculatePinSpacing(shapeRect)) / 2;
// only draw leads longer than threshold
if (leadLength > LEAD_RENDER_THRESHOLD) {
if (leadLength > LEAD_RENDER_THRESHOLD || !getHideShortLeads()) {
if (shouldShadeLeads()) {
Stroke leadStroke = ObjectCache.getInstance().fetchBasicStroke(leadThickness - 1);
Color leadColor = getLeadColorForPainting(componentState);
@@ -716,6 +718,17 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
return new Rectangle2D.Double(minX - margin, minY - margin, maxX - minX + 2 * margin, maxY - minY + 2 * margin);
}
// for internal use. Set this flag to true when replacing standard leads with flexible ones
public Boolean getHideShortLeads() {
if (hideShortLeads == null)
hideShortLeads = false;
return hideShortLeads;
}
public void setHideShortLeads(Boolean hideShortLeads) {
this.hideShortLeads = hideShortLeads;
}
public enum LabelOriantation {
Directional, Horizontal
@@ -337,7 +337,8 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
@Override
public Rectangle2D getCachingBounds() {
Point finalSecondPoint = getFinalSecondPoint();
return new Rectangle2D.Double(firstPoint.x, firstPoint.y, finalSecondPoint.x - firstPoint.x + 1, finalSecondPoint.y - firstPoint.y + 1);
return new Rectangle2D.Double(Math.min(firstPoint.x, finalSecondPoint.x), Math.min(firstPoint.y, finalSecondPoint.y),
Math.abs(finalSecondPoint.x - firstPoint.x) + 2, Math.abs(finalSecondPoint.y - firstPoint.y) + 2);
}
public static enum CoordinateType {
@@ -382,7 +382,8 @@ public class Breadboard extends AbstractComponent<Void> {
@Override
public Rectangle2D getCachingBounds() {
Point finalSecondPoint = getControlPoint(1);
return new Rectangle2D.Double(point.x, point.y, finalSecondPoint.x - point.x + 1, finalSecondPoint.y - point.y + 1);
return new Rectangle2D.Double(Math.min(point.x, finalSecondPoint.x), Math.min(point.y, finalSecondPoint.y),
Math.abs(finalSecondPoint.x - point.x) + 2, Math.abs(finalSecondPoint.y - point.y) + 2);
}
public enum BreadboardSize {
@@ -700,6 +700,7 @@ public class ProtoBoard extends AbstractComponent<Void> {
@Override
public Rectangle2D getCachingBounds() {
Point finalSecondPoint = getControlPoint(1);
return new Rectangle2D.Double(point.x, point.y, finalSecondPoint.x - point.x + 1, finalSecondPoint.y - point.y + 1);
return new Rectangle2D.Double(Math.min(point.x, finalSecondPoint.x), Math.min(point.y, finalSecondPoint.y),
Math.abs(finalSecondPoint.x - point.x) + 2, Math.abs(finalSecondPoint.y - point.y) + 2);
}
}
@@ -48,11 +48,6 @@ public abstract class AbstractFilmCapacitor extends AbstractLeadedComponent<Capa
protected Boolean showOuterFoil = false;
protected Color outerFoilColor = OUTER_FOIL_COLOR;
@Override
protected boolean supportsStandingMode() {
return true;
}
@EditableProperty(validatorClass = PositiveMeasureValidator.class)
public Capacitance getValue() {
return value;
@@ -61,4 +61,9 @@ public class AxialFilmCapacitor extends AbstractFilmCapacitor {
return new Rectangle2D.Double(0f, 0f, getLength().convertToPixels(),
getClosestOdd(getWidth().convertToPixels()));
}
@Override
protected boolean supportsStandingMode() {
return true;
}
}
@@ -74,6 +74,9 @@ public class FlexibleLeadsEditor implements IProjectEditor {
Point newP2 = new Point((int)Math.round(centerX + Math.cos(theta) * len / 2), (int)Math.round(centerY + Math.sin(theta) * len / 2));
leaded.setControlPoint(newP1, 0);
leaded.setControlPoint(newP2, 1);
// make the standard leads go away
leaded.setHideShortLeads(true);
// create leads
HookupWire w1 = new HookupWire();