mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
3.29.0 release
[Bug Fix] Issue with losing saved user configuration [Bug Fix] Issue with disabled "Save as Template" context menu item problem, as well as issue with strange rotation and probably few more [Bug Fix] Undo steps kept after opening a new file [New Feature] Transistors can be rotated and flipped vertically [New Feature] DIL ICs can show pin numbers [New Feature] Display both component value and name or neither of them [New Feature] Potentiometer schematic symbol added
This commit is contained in:
+1
-1
@@ -74,7 +74,7 @@ public class HelpMenuPlugin implements IPlugIn {
|
|||||||
aboutDialog = DialogFactory.getInstance().createAboutDialog("DIY Layout Creator",
|
aboutDialog = DialogFactory.getInstance().createAboutDialog("DIY Layout Creator",
|
||||||
IconLoader.IconLarge.getIcon(),
|
IconLoader.IconLarge.getIcon(),
|
||||||
plugInPort.getCurrentVersionNumber().toString(), "Branislav Stojkovic",
|
plugInPort.getCurrentVersionNumber().toString(), "Branislav Stojkovic",
|
||||||
"diylc.org", "bancika@gmail.com", "");
|
"https://github.com/bancika/diy-layout-creator", "bancika@gmail.com", "");
|
||||||
}
|
}
|
||||||
return aboutDialog;
|
return aboutDialog;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" path="test"/>
|
<classpathentry kind="src" path="test"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/junit-4.7.jar"/>
|
<classpathentry kind="lib" path="lib/junit-4.7.jar"/>
|
||||||
<classpathentry kind="lib" path="library/main.jar"/>
|
<classpathentry kind="lib" path="library/main.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/app-framework.jar"/>
|
<classpathentry kind="lib" path="lib/app-framework.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
|
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/xstream-1.3.1.jar"/>
|
<classpathentry kind="lib" path="lib/xstream-1.3.1.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_40"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
Binary file not shown.
+1
-1
@@ -2,7 +2,7 @@ package org.diylc.common;
|
|||||||
|
|
||||||
public enum Display {
|
public enum Display {
|
||||||
|
|
||||||
NAME, VALUE;
|
NAME, VALUE, NONE, BOTH;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|||||||
+55
-91
@@ -33,8 +33,7 @@ import org.diylc.utils.Constants;
|
|||||||
*
|
*
|
||||||
* @author Branislav Stojkovic
|
* @author Branislav Stojkovic
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractLeadedComponent<T> extends
|
public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComponent<T> {
|
||||||
AbstractTransparentComponent<T> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -45,8 +44,7 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
|
|
||||||
protected Size length;
|
protected Size length;
|
||||||
protected Size width;
|
protected Size width;
|
||||||
protected Point[] points = new Point[] {
|
protected Point[] points = new Point[] { new Point((int) (-DEFAULT_SIZE.convertToPixels() / 2), 0),
|
||||||
new Point((int) (-DEFAULT_SIZE.convertToPixels() / 2), 0),
|
|
||||||
new Point((int) (DEFAULT_SIZE.convertToPixels() / 2), 0) };
|
new Point((int) (DEFAULT_SIZE.convertToPixels() / 2), 0) };
|
||||||
protected Color bodyColor = Color.white;
|
protected Color bodyColor = Color.white;
|
||||||
protected Color borderColor = Color.black;
|
protected Color borderColor = Color.black;
|
||||||
@@ -68,44 +66,35 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState,
|
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||||
boolean outlineMode, Project project,
|
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
double distance = points[0].distance(points[1]);
|
double distance = points[0].distance(points[1]);
|
||||||
Shape shape = getBodyShape();
|
Shape shape = getBodyShape();
|
||||||
// If there's no body, just draw the line connecting the ending points.
|
// If there's no body, just draw the line connecting the ending points.
|
||||||
if (shape == null) {
|
if (shape == null) {
|
||||||
drawLead(g2d, componentState);
|
drawLead(g2d, componentState);
|
||||||
} else if (supportsStandingMode()
|
} else if (supportsStandingMode() && length.convertToPixels() > points[0].distance(points[1])) {
|
||||||
&& length.convertToPixels() > points[0].distance(points[1])) {
|
|
||||||
// When ending points are too close draw the component in standing
|
// When ending points are too close draw the component in standing
|
||||||
// mode.
|
// mode.
|
||||||
int width = getClosestOdd(this.width.convertToPixels());
|
int width = getClosestOdd(this.width.convertToPixels());
|
||||||
Shape body = new Ellipse2D.Double((getFlipStanding() ? points[1]
|
Shape body = new Ellipse2D.Double((getFlipStanding() ? points[1] : points[0]).x - width / 2,
|
||||||
: points[0]).x
|
(getFlipStanding() ? points[1] : points[0]).y - width / 2, width, width);
|
||||||
- width / 2, (getFlipStanding() ? points[1] : points[0]).y
|
|
||||||
- width / 2, width, width);
|
|
||||||
Composite oldComposite = g2d.getComposite();
|
Composite oldComposite = g2d.getComposite();
|
||||||
if (alpha < MAX_ALPHA) {
|
if (alpha < MAX_ALPHA) {
|
||||||
g2d.setComposite(AlphaComposite.getInstance(
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||||
AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
|
||||||
}
|
}
|
||||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR
|
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getStandingBodyColor());
|
||||||
: getStandingBodyColor());
|
|
||||||
g2d.fill(body);
|
g2d.fill(body);
|
||||||
g2d.setComposite(oldComposite);
|
g2d.setComposite(oldComposite);
|
||||||
Color finalBorderColor;
|
Color finalBorderColor;
|
||||||
if (outlineMode) {
|
if (outlineMode) {
|
||||||
Theme theme = (Theme) ConfigurationManager.getInstance()
|
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY,
|
||||||
.readObject(IPlugInPort.THEME_KEY,
|
Constants.DEFAULT_THEME);
|
||||||
Constants.DEFAULT_THEME);
|
|
||||||
finalBorderColor = componentState == ComponentState.SELECTED
|
finalBorderColor = componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : theme.getOutlineColor();
|
||||||
: theme.getOutlineColor();
|
|
||||||
} else {
|
} else {
|
||||||
finalBorderColor = componentState == ComponentState.SELECTED
|
finalBorderColor = componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor;
|
||||||
: borderColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g2d.setColor(finalBorderColor);
|
g2d.setColor(finalBorderColor);
|
||||||
@@ -116,8 +105,7 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
} else {
|
} else {
|
||||||
// Normal mode with component body in the center and two lead parts.
|
// Normal mode with component body in the center and two lead parts.
|
||||||
Rectangle shapeRect = shape.getBounds();
|
Rectangle shapeRect = shape.getBounds();
|
||||||
Double theta = Math.atan2(points[1].y - points[0].y, points[1].x
|
Double theta = Math.atan2(points[1].y - points[0].y, points[1].x - points[0].x);
|
||||||
- points[0].x);
|
|
||||||
// Go back to the original transformation to draw leads.
|
// Go back to the original transformation to draw leads.
|
||||||
if (!outlineMode) {
|
if (!outlineMode) {
|
||||||
AffineTransform textTransform = g2d.getTransform();
|
AffineTransform textTransform = g2d.getTransform();
|
||||||
@@ -127,36 +115,25 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
// 0.5f));
|
// 0.5f));
|
||||||
// }
|
// }
|
||||||
int leadThickness = getClosestOdd(getLeadThickness());
|
int leadThickness = getClosestOdd(getLeadThickness());
|
||||||
double leadLength = (distance - calculatePinSpacing(shapeRect))
|
double leadLength = (distance - calculatePinSpacing(shapeRect)) / 2 - leadThickness / 2;
|
||||||
/ 2 - leadThickness / 2;
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness));
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(
|
Color leadColor = shouldShadeLeads() ? getLeadColorForPainting(componentState).darker()
|
||||||
leadThickness));
|
|
||||||
Color leadColor = shouldShadeLeads() ? getLeadColorForPainting(
|
|
||||||
componentState).darker()
|
|
||||||
: getLeadColorForPainting(componentState);
|
: getLeadColorForPainting(componentState);
|
||||||
g2d.setColor(leadColor);
|
g2d.setColor(leadColor);
|
||||||
int endX = (int) (points[0].x + Math.cos(theta) * leadLength);
|
int endX = (int) (points[0].x + Math.cos(theta) * leadLength);
|
||||||
int endY = (int) Math.round(points[0].y + Math.sin(theta)
|
int endY = (int) Math.round(points[0].y + Math.sin(theta) * leadLength);
|
||||||
* leadLength);
|
|
||||||
g2d.drawLine(points[0].x, points[0].y, endX, endY);
|
g2d.drawLine(points[0].x, points[0].y, endX, endY);
|
||||||
endX = (int) (points[1].x + Math.cos(theta - Math.PI)
|
endX = (int) (points[1].x + Math.cos(theta - Math.PI) * leadLength);
|
||||||
* leadLength);
|
endY = (int) Math.round(points[1].y + Math.sin(theta - Math.PI) * leadLength);
|
||||||
endY = (int) Math.round(points[1].y + Math.sin(theta - Math.PI)
|
|
||||||
* leadLength);
|
|
||||||
g2d.drawLine(points[1].x, points[1].y, endX, endY);
|
g2d.drawLine(points[1].x, points[1].y, endX, endY);
|
||||||
if (shouldShadeLeads()) {
|
if (shouldShadeLeads()) {
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(leadThickness - 2));
|
||||||
leadThickness - 2));
|
|
||||||
leadColor = getLeadColorForPainting(componentState);
|
leadColor = getLeadColorForPainting(componentState);
|
||||||
g2d.setColor(leadColor);
|
g2d.setColor(leadColor);
|
||||||
g2d.drawLine(points[0].x, points[0].y,
|
g2d.drawLine(points[0].x, points[0].y, (int) (points[0].x + Math.cos(theta) * leadLength),
|
||||||
(int) (points[0].x + Math.cos(theta) * leadLength),
|
|
||||||
(int) (points[0].y + Math.sin(theta) * leadLength));
|
(int) (points[0].y + Math.sin(theta) * leadLength));
|
||||||
g2d.drawLine(points[1].x, points[1].y,
|
g2d.drawLine(points[1].x, points[1].y, (int) (points[1].x + Math.cos(theta - Math.PI) * leadLength),
|
||||||
(int) (points[1].x + Math.cos(theta - Math.PI)
|
(int) (points[1].y + Math.sin(theta - Math.PI) * leadLength));
|
||||||
* leadLength), (int) (points[1].y + Math
|
|
||||||
.sin(theta - Math.PI)
|
|
||||||
* leadLength));
|
|
||||||
}
|
}
|
||||||
g2d.setTransform(textTransform);
|
g2d.setTransform(textTransform);
|
||||||
}
|
}
|
||||||
@@ -173,19 +150,16 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
length = getLength().convertToPixels();
|
length = getLength().convertToPixels();
|
||||||
}
|
}
|
||||||
oldTransform = g2d.getTransform();
|
oldTransform = g2d.getTransform();
|
||||||
g2d.translate((points[0].x + points[1].x - length) / 2,
|
g2d.translate((points[0].x + points[1].x - length) / 2, (points[0].y + points[1].y - width) / 2);
|
||||||
(points[0].y + points[1].y - width) / 2);
|
|
||||||
g2d.rotate(theta, length / 2, width / 2);
|
g2d.rotate(theta, length / 2, width / 2);
|
||||||
// Draw body.
|
// Draw body.
|
||||||
Composite oldComposite = g2d.getComposite();
|
Composite oldComposite = g2d.getComposite();
|
||||||
if (alpha < MAX_ALPHA) {
|
if (alpha < MAX_ALPHA) {
|
||||||
g2d.setComposite(AlphaComposite.getInstance(
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||||
AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
|
||||||
}
|
}
|
||||||
if (bodyColor != null) {
|
if (bodyColor != null) {
|
||||||
if (bodyColor != null) {
|
if (bodyColor != null) {
|
||||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR
|
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : bodyColor);
|
||||||
: bodyColor);
|
|
||||||
g2d.fill(shape);
|
g2d.fill(shape);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,16 +168,13 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
Color finalBorderColor;
|
Color finalBorderColor;
|
||||||
if (outlineMode) {
|
if (outlineMode) {
|
||||||
Theme theme = (Theme) ConfigurationManager.getInstance()
|
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY,
|
||||||
.readObject(IPlugInPort.THEME_KEY,
|
Constants.DEFAULT_THEME);
|
||||||
Constants.DEFAULT_THEME);
|
|
||||||
finalBorderColor = componentState == ComponentState.SELECTED
|
finalBorderColor = componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : theme.getOutlineColor();
|
||||||
: theme.getOutlineColor();
|
|
||||||
} else {
|
} else {
|
||||||
finalBorderColor = componentState == ComponentState.SELECTED
|
finalBorderColor = componentState == ComponentState.SELECTED
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor;
|
||||||
: borderColor;
|
|
||||||
}
|
}
|
||||||
g2d.setColor(finalBorderColor);
|
g2d.setColor(finalBorderColor);
|
||||||
g2d.draw(shape);
|
g2d.draw(shape);
|
||||||
@@ -259,49 +230,46 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
}
|
}
|
||||||
Color finalLabelColor;
|
Color finalLabelColor;
|
||||||
if (outlineMode) {
|
if (outlineMode) {
|
||||||
Theme theme = (Theme) ConfigurationManager.getInstance()
|
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY,
|
||||||
.readObject(IPlugInPort.THEME_KEY,
|
Constants.DEFAULT_THEME);
|
||||||
Constants.DEFAULT_THEME);
|
finalLabelColor = componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||||
finalLabelColor = componentState == ComponentState.SELECTED
|
? LABEL_COLOR_SELECTED : theme.getOutlineColor();
|
||||||
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
|
||||||
: theme.getOutlineColor();
|
|
||||||
} else {
|
} else {
|
||||||
finalLabelColor = componentState == ComponentState.SELECTED
|
finalLabelColor = componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||||
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
? LABEL_COLOR_SELECTED : labelColor;
|
||||||
: labelColor;
|
|
||||||
}
|
}
|
||||||
g2d.setColor(finalLabelColor);
|
g2d.setColor(finalLabelColor);
|
||||||
FontMetrics fontMetrics = g2d.getFontMetrics();
|
FontMetrics fontMetrics = g2d.getFontMetrics();
|
||||||
String label = display == Display.NAME ? getName()
|
String label = "";
|
||||||
: (getValue() == null ? "" : getValue().toString());
|
label = display == Display.NAME ? getName() : (getValue() == null ? "" : getValue().toString());
|
||||||
|
if (display == Display.NONE) {
|
||||||
|
label = "";
|
||||||
|
}
|
||||||
|
if (display == Display.BOTH) {
|
||||||
|
label = getName() + " " + (getValue() == null ? "" : getValue().toString());
|
||||||
|
}
|
||||||
Rectangle2D textRect = fontMetrics.getStringBounds(label, g2d);
|
Rectangle2D textRect = fontMetrics.getStringBounds(label, g2d);
|
||||||
// Don't offset in outline mode.
|
// Don't offset in outline mode.
|
||||||
int offset = outlineMode ? 0 : getLabelOffset((int) length,
|
int offset = outlineMode ? 0 : getLabelOffset((int) length, (int) width);
|
||||||
(int) width);
|
|
||||||
// Adjust label angle if needed to make sure that it's readable.
|
// Adjust label angle if needed to make sure that it's readable.
|
||||||
if ((theta >= Math.PI / 2 && theta <= Math.PI)
|
if ((theta >= Math.PI / 2 && theta <= Math.PI) || (theta < -Math.PI / 2 && theta > -Math.PI)) {
|
||||||
|| (theta < -Math.PI / 2 && theta > -Math.PI)) {
|
|
||||||
g2d.rotate(Math.PI, length / 2, width / 2);
|
g2d.rotate(Math.PI, length / 2, width / 2);
|
||||||
offset = -offset;
|
offset = -offset;
|
||||||
}
|
}
|
||||||
g2d.drawString(label, (int) (length - textRect.getWidth()) / 2
|
g2d.drawString(label, (int) (length - textRect.getWidth()) / 2 + offset,
|
||||||
+ offset, calculateLabelYCoordinate(shapeRect, textRect,
|
calculateLabelYCoordinate(shapeRect, textRect, fontMetrics));
|
||||||
fontMetrics));
|
|
||||||
g2d.setTransform(oldTransform);
|
g2d.setTransform(oldTransform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawLead(Graphics2D g2d, ComponentState componentState) {
|
private void drawLead(Graphics2D g2d, ComponentState componentState) {
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(getLeadThickness()));
|
||||||
getLeadThickness()));
|
Color leadColor = shouldShadeLeads() ? getLeadColorForPainting(componentState).darker()
|
||||||
Color leadColor = shouldShadeLeads() ? getLeadColorForPainting(
|
|
||||||
componentState).darker()
|
|
||||||
: getLeadColorForPainting(componentState);
|
: getLeadColorForPainting(componentState);
|
||||||
g2d.setColor(leadColor);
|
g2d.setColor(leadColor);
|
||||||
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
||||||
if (shouldShadeLeads()) {
|
if (shouldShadeLeads()) {
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(getLeadThickness() - 2));
|
||||||
getLeadThickness() - 2));
|
|
||||||
leadColor = getLeadColorForPainting(componentState);
|
leadColor = getLeadColorForPainting(componentState);
|
||||||
g2d.setColor(leadColor);
|
g2d.setColor(leadColor);
|
||||||
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
||||||
@@ -312,10 +280,8 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
// Do nothing.
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int calculateLabelYCoordinate(Rectangle2D shapeRect,
|
protected int calculateLabelYCoordinate(Rectangle2D shapeRect, Rectangle2D textRect, FontMetrics fontMetrics) {
|
||||||
Rectangle2D textRect, FontMetrics fontMetrics) {
|
return (int) (shapeRect.getHeight() - textRect.getHeight()) / 2 + fontMetrics.getAscent();
|
||||||
return (int) (shapeRect.getHeight() - textRect.getHeight()) / 2
|
|
||||||
+ fontMetrics.getAscent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean shouldShadeLeads() {
|
protected boolean shouldShadeLeads() {
|
||||||
@@ -352,8 +318,7 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
* Controls how component shape should be placed relative to start and end
|
* Controls how component shape should be placed relative to start and end
|
||||||
* point.
|
* point.
|
||||||
*
|
*
|
||||||
* @return
|
* @return <code>true<code> if shape rect should be used to center the component or <code>false</code>
|
||||||
* <code>true<code> if shape rect should be used to center the component or <code>false</code>
|
|
||||||
* to place the component relative to <code>length</code> and
|
* to place the component relative to <code>length</code> and
|
||||||
* <code>width</code> values.
|
* <code>width</code> values.
|
||||||
*/
|
*/
|
||||||
@@ -372,8 +337,7 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
* @return default lead color. Override this method to change it.
|
* @return default lead color. Override this method to change it.
|
||||||
*/
|
*/
|
||||||
protected Color getLeadColorForPainting(ComponentState componentState) {
|
protected Color getLeadColorForPainting(ComponentState componentState) {
|
||||||
return componentState == ComponentState.SELECTED
|
return componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
|
||||||
: getLeadColor();
|
: getLeadColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -591,7 +591,7 @@ public class Presenter implements IPlugInPort {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Otherwise just select that one component.
|
// Otherwise just select that one component.
|
||||||
if (button == BUTTON1
|
if (button == BUTTON1 || (button == BUTTON3 && newSelection.size() == 1)
|
||||||
|| !newSelection.contains(topComponent)) {
|
|| !newSelection.contains(topComponent)) {
|
||||||
newSelection.clear();
|
newSelection.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/app-framework.jar"/>
|
<classpathentry kind="lib" path="lib/app-framework.jar"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/diylc-core"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/diylc-core"/>
|
||||||
<classpathentry kind="lib" path="lib/xstream-1.4.3.jar"/>
|
<classpathentry kind="lib" path="lib/xstream-1.4.3.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_40"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
Binary file not shown.
+8
-1
@@ -346,7 +346,14 @@ public class MiniRelay extends AbstractTransparentComponent<String> {
|
|||||||
}
|
}
|
||||||
g2d.setColor(finalLabelColor);
|
g2d.setColor(finalLabelColor);
|
||||||
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
||||||
String label = display == Display.NAME ? getName() : getValue();
|
String label="";
|
||||||
|
label = display == Display.VALUE ? getValue() : getName();
|
||||||
|
if (display==Display.NONE) {
|
||||||
|
label="";
|
||||||
|
}
|
||||||
|
if (display==Display.BOTH) {
|
||||||
|
label=getName()+" "+(getValue() == null ? "" : getValue().toString());
|
||||||
|
}
|
||||||
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
||||||
int textHeight = (int) (rect.getHeight());
|
int textHeight = (int) (rect.getHeight());
|
||||||
int textWidth = (int) (rect.getWidth());
|
int textWidth = (int) (rect.getWidth());
|
||||||
|
|||||||
+25
-1
@@ -13,6 +13,7 @@ import java.awt.geom.Ellipse2D;
|
|||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
|
import org.diylc.common.Display;
|
||||||
import org.diylc.common.IPlugInPort;
|
import org.diylc.common.IPlugInPort;
|
||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.common.Orientation;
|
import org.diylc.common.Orientation;
|
||||||
@@ -45,9 +46,11 @@ public class TrimmerPotentiometer extends AbstractPotentiometer {
|
|||||||
public static Color PIN_COLOR = Color.decode("#00B2EE");
|
public static Color PIN_COLOR = Color.decode("#00B2EE");
|
||||||
public static Color PIN_BORDER_COLOR = PIN_COLOR.darker();
|
public static Color PIN_BORDER_COLOR = PIN_COLOR.darker();
|
||||||
public static Size PIN_SIZE = new Size(0.03d, SizeUnit.in);
|
public static Size PIN_SIZE = new Size(0.03d, SizeUnit.in);
|
||||||
|
protected static Display DISPLAY = Display.NAME;
|
||||||
|
|
||||||
protected Color bodyColor = BODY_COLOR;
|
protected Color bodyColor = BODY_COLOR;
|
||||||
protected Color borderColor = BORDER_COLOR;
|
protected Color borderColor = BORDER_COLOR;
|
||||||
|
protected static Display display = DISPLAY;
|
||||||
// Array of 7 elements: 3 lug connectors, 1 pot body and 3 lugs
|
// Array of 7 elements: 3 lug connectors, 1 pot body and 3 lugs
|
||||||
transient protected Shape[] body = null;
|
transient protected Shape[] body = null;
|
||||||
|
|
||||||
@@ -333,7 +336,16 @@ public class TrimmerPotentiometer extends AbstractPotentiometer {
|
|||||||
int x = (panelWidth - textWidth) / 2;
|
int x = (panelWidth - textWidth) / 2;
|
||||||
int y = (panelHeight - textHeight) / 2 + fontMetrics.getAscent();
|
int y = (panelHeight - textHeight) / 2 + fontMetrics.getAscent();
|
||||||
|
|
||||||
g2d.drawString(getName(), (int) (bodyRect.getX() + x), (int) (bodyRect
|
String label="";
|
||||||
|
label = (getDisplay() == Display.NAME) ? getName() : getValue().toString();
|
||||||
|
if (getDisplay() ==Display.NONE) {
|
||||||
|
label="";
|
||||||
|
}
|
||||||
|
if (getDisplay() ==Display.BOTH) {
|
||||||
|
label=getName()+" "+(getValue() == null ? "" : getValue().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
g2d.drawString(label, (int) (bodyRect.getX() + x), (int) (bodyRect
|
||||||
.getY() + y));
|
.getY() + y));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,6 +398,18 @@ public class TrimmerPotentiometer extends AbstractPotentiometer {
|
|||||||
public void setBodyColor(Color bodyColor) {
|
public void setBodyColor(Color bodyColor) {
|
||||||
this.bodyColor = bodyColor;
|
this.bodyColor = bodyColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public Display getDisplay() {
|
||||||
|
if (display == null) {
|
||||||
|
display = Display.VALUE;
|
||||||
|
}
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplay(Display display) {
|
||||||
|
this.display = display;
|
||||||
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Border")
|
@EditableProperty(name = "Border")
|
||||||
public Color getBorderColor() {
|
public Color getBorderColor() {
|
||||||
|
|||||||
+50
-2
@@ -4,6 +4,7 @@ import java.awt.Color;
|
|||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
import org.diylc.common.Display;
|
import org.diylc.common.Display;
|
||||||
@@ -28,11 +29,13 @@ public abstract class AbstractTransistorSymbol extends AbstractComponent<String>
|
|||||||
|
|
||||||
public static Size PIN_SPACING = new Size(0.1d, SizeUnit.in);
|
public static Size PIN_SPACING = new Size(0.1d, SizeUnit.in);
|
||||||
public static Color COLOR = Color.black;
|
public static Color COLOR = Color.black;
|
||||||
|
|
||||||
|
public static SymbolFlipping FLIPPING = SymbolFlipping.NONE;
|
||||||
protected String value = "";
|
protected String value = "";
|
||||||
protected Point[] controlPoints = new Point[] { new Point(0, 0), new Point(0, 0),
|
protected Point[] controlPoints = new Point[] { new Point(0, 0), new Point(0, 0),
|
||||||
new Point(0, 0) };
|
new Point(0, 0) };
|
||||||
protected Color color = COLOR;
|
protected Color color = COLOR;
|
||||||
|
protected SymbolFlipping flipping = FLIPPING;
|
||||||
protected Display display = Display.NAME;
|
protected Display display = Display.NAME;
|
||||||
transient protected Shape[] body;
|
transient protected Shape[] body;
|
||||||
|
|
||||||
@@ -67,6 +70,32 @@ public abstract class AbstractTransistorSymbol extends AbstractComponent<String>
|
|||||||
|
|
||||||
Shape[] body = getBody();
|
Shape[] body = getBody();
|
||||||
|
|
||||||
|
int rotation=0;
|
||||||
|
//determine rotation using control points
|
||||||
|
if (controlPoints[1].x==controlPoints[2].x)
|
||||||
|
{
|
||||||
|
if (controlPoints[0].x>controlPoints[1].x)
|
||||||
|
{
|
||||||
|
rotation=180;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (controlPoints[1].y==controlPoints[2].y)
|
||||||
|
{
|
||||||
|
rotation=90;
|
||||||
|
if (controlPoints[0].y>controlPoints[1].y)
|
||||||
|
{
|
||||||
|
rotation=270;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AffineTransform old = g2d.getTransform();
|
||||||
|
g2d.rotate(Math.toRadians(rotation),controlPoints[0].x,controlPoints[0].y);
|
||||||
|
|
||||||
|
if (this.flipping==SymbolFlipping.Y){
|
||||||
|
g2d.translate(0,controlPoints[0].y);
|
||||||
|
g2d.scale(1, -1);
|
||||||
|
g2d.translate(0, -1*controlPoints[0].y);
|
||||||
|
}
|
||||||
|
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2));
|
||||||
g2d.draw(body[0]);
|
g2d.draw(body[0]);
|
||||||
|
|
||||||
@@ -74,6 +103,7 @@ public abstract class AbstractTransistorSymbol extends AbstractComponent<String>
|
|||||||
g2d.draw(body[1]);
|
g2d.draw(body[1]);
|
||||||
|
|
||||||
g2d.fill(body[2]);
|
g2d.fill(body[2]);
|
||||||
|
g2d.setTransform(old);
|
||||||
|
|
||||||
// Draw label
|
// Draw label
|
||||||
g2d.setFont(LABEL_FONT);
|
g2d.setFont(LABEL_FONT);
|
||||||
@@ -90,7 +120,16 @@ public abstract class AbstractTransistorSymbol extends AbstractComponent<String>
|
|||||||
: LABEL_COLOR;
|
: LABEL_COLOR;
|
||||||
}
|
}
|
||||||
g2d.setColor(finalLabelColor);
|
g2d.setColor(finalLabelColor);
|
||||||
drawCenteredText(g2d, display == Display.VALUE ? getValue() : getName(),
|
String label="";
|
||||||
|
label = display == Display.NAME ? getName()
|
||||||
|
: (getValue() == null ? "" : getValue().toString());
|
||||||
|
if (display==Display.NONE) {
|
||||||
|
label="";
|
||||||
|
}
|
||||||
|
if (display==Display.BOTH) {
|
||||||
|
label=getName()+" "+(getValue() == null ? "" : getValue().toString());
|
||||||
|
}
|
||||||
|
drawCenteredText(g2d, label,
|
||||||
x + pinSpacing * 2, y, HorizontalAlignment.LEFT, VerticalAlignment.CENTER);
|
x + pinSpacing * 2, y, HorizontalAlignment.LEFT, VerticalAlignment.CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,6 +183,15 @@ public abstract class AbstractTransistorSymbol extends AbstractComponent<String>
|
|||||||
// Invalidate body
|
// Invalidate body
|
||||||
body = null;
|
body = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public SymbolFlipping getFlipping() {
|
||||||
|
return flipping;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlipping(SymbolFlipping flipping) {
|
||||||
|
this.flipping = flipping;
|
||||||
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ import org.diylc.core.IDIYComponent;
|
|||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "BJT Symbol", author = "Branislav Stojkovic", category = "Schematics", instanceNamePrefix = "Q", description = "Bipolar junction transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = false)
|
@ComponentDescriptor(name = "BJT Symbol", author = "Branislav Stojkovic", category = "Schematics", instanceNamePrefix = "Q", description = "Bipolar junction transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = true)
|
||||||
public class BJTSymbol extends AbstractTransistorSymbol {
|
public class BJTSymbol extends AbstractTransistorSymbol {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
+84
-1
@@ -18,6 +18,7 @@ import org.diylc.common.IPlugInPort;
|
|||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.common.Orientation;
|
import org.diylc.common.Orientation;
|
||||||
import org.diylc.components.AbstractTransparentComponent;
|
import org.diylc.components.AbstractTransparentComponent;
|
||||||
|
import org.diylc.components.misc.Label;
|
||||||
import org.diylc.core.ComponentState;
|
import org.diylc.core.ComponentState;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.IDrawingObserver;
|
import org.diylc.core.IDrawingObserver;
|
||||||
@@ -44,6 +45,7 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
|||||||
public static int EDGE_RADIUS = 6;
|
public static int EDGE_RADIUS = 6;
|
||||||
public static Size PIN_SIZE = new Size(0.04d, SizeUnit.in);
|
public static Size PIN_SIZE = new Size(0.04d, SizeUnit.in);
|
||||||
public static Size INDENT_SIZE = new Size(0.07d, SizeUnit.in);
|
public static Size INDENT_SIZE = new Size(0.07d, SizeUnit.in);
|
||||||
|
public static DisplayNumbers DISPLAY_NUMBERS = DisplayNumbers.NO;
|
||||||
|
|
||||||
private String value = "";
|
private String value = "";
|
||||||
private Orientation orientation = Orientation.DEFAULT;
|
private Orientation orientation = Orientation.DEFAULT;
|
||||||
@@ -56,6 +58,7 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
|||||||
private Color borderColor = BORDER_COLOR;
|
private Color borderColor = BORDER_COLOR;
|
||||||
private Color labelColor = LABEL_COLOR;
|
private Color labelColor = LABEL_COLOR;
|
||||||
private Color indentColor = INDENT_COLOR;
|
private Color indentColor = INDENT_COLOR;
|
||||||
|
private DisplayNumbers displayNumbers = DISPLAY_NUMBERS;
|
||||||
// new Point(0, pinSpacing.convertToPixels()),
|
// new Point(0, pinSpacing.convertToPixels()),
|
||||||
// new Point(0, 2 * pinSpacing.convertToPixels()),
|
// new Point(0, 2 * pinSpacing.convertToPixels()),
|
||||||
// new Point(0, 3 * pinSpacing.convertToPixels()),
|
// new Point(0, 3 * pinSpacing.convertToPixels()),
|
||||||
@@ -334,7 +337,14 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
|||||||
}
|
}
|
||||||
g2d.setColor(finalLabelColor);
|
g2d.setColor(finalLabelColor);
|
||||||
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
||||||
String label = display == Display.NAME ? getName() : getValue();
|
String label="";
|
||||||
|
label = (getDisplay() == Display.NAME) ? getName() : getValue();
|
||||||
|
if (getDisplay() ==Display.NONE) {
|
||||||
|
label="";
|
||||||
|
}
|
||||||
|
if (getDisplay() ==Display.BOTH) {
|
||||||
|
label=getName()+" "+(getValue() == null ? "" : getValue().toString());
|
||||||
|
}
|
||||||
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
||||||
int textHeight = (int) (rect.getHeight());
|
int textHeight = (int) (rect.getHeight());
|
||||||
int textWidth = (int) (rect.getWidth());
|
int textWidth = (int) (rect.getWidth());
|
||||||
@@ -343,6 +353,60 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
|||||||
int x = bounds.x + (bounds.width - textWidth) / 2;
|
int x = bounds.x + (bounds.width - textWidth) / 2;
|
||||||
int y = bounds.y + (bounds.height - textHeight) / 2 + fontMetrics.getAscent();
|
int y = bounds.y + (bounds.height - textHeight) / 2 + fontMetrics.getAscent();
|
||||||
g2d.drawString(label, x, y);
|
g2d.drawString(label, x, y);
|
||||||
|
|
||||||
|
//draw pin numbers
|
||||||
|
int pinNo=0;
|
||||||
|
int j=0;
|
||||||
|
int k=0;
|
||||||
|
int pinSize=(int)PIN_SIZE.convertToPixels();
|
||||||
|
for (Point point : controlPoints) {
|
||||||
|
pinNo++;
|
||||||
|
|
||||||
|
//determine points relative to rotation
|
||||||
|
int textX1=point.x-2*pinSize;
|
||||||
|
int textY1=point.y+pinSize/2;
|
||||||
|
int textX2=point.x+pinSize;
|
||||||
|
int textY2=point.y+pinSize/2;
|
||||||
|
if (orientation==Orientation._90) {
|
||||||
|
textX2=textX2-pinSize-pinSize/2;
|
||||||
|
textY2=textY2+pinSize;
|
||||||
|
textX1=textX1+2*pinSize-pinSize/2;
|
||||||
|
textY1=textY1-pinSize;
|
||||||
|
}
|
||||||
|
if (orientation==Orientation._180) {
|
||||||
|
textX1=textX1+3*pinSize;
|
||||||
|
textX2=textX2-3*pinSize;
|
||||||
|
}
|
||||||
|
if (orientation==Orientation._270) {
|
||||||
|
textX1 = textX1+pinSize+pinSize/2;
|
||||||
|
textY1 = textY1+pinSize;
|
||||||
|
textX2 = textX2-pinSize-pinSize/2;
|
||||||
|
textY2 = textY2-pinSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
g2d.setFont(LABEL_FONT.deriveFont((float)(Label.LABEL_FONT.getSize2D()*0.66)));
|
||||||
|
if (displayNumbers==DisplayNumbers.DIP){
|
||||||
|
if (pinNo>pinCount.getValue()/2) {
|
||||||
|
g2d.drawString(Integer.toString(pinCount.getValue()-j), textX1, textY1);
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g2d.drawString(Integer.toString(pinNo), textX2, textY2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (displayNumbers==DisplayNumbers.CONNECTOR){
|
||||||
|
if (pinNo>pinCount.getValue()/2) {
|
||||||
|
k++;
|
||||||
|
g2d.drawString(Integer.toString(pinNo-(pinCount.getValue()/2)+k), textX1, textY1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g2d.drawString(Integer.toString(pinNo+j), textX2, textY2);
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -407,6 +471,15 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
|||||||
public void setIndentColor(Color indentColor) {
|
public void setIndentColor(Color indentColor) {
|
||||||
this.indentColor = indentColor;
|
this.indentColor = indentColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Display pin numbers")
|
||||||
|
public DisplayNumbers getDisplayNumbers() {
|
||||||
|
return displayNumbers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplayNumbers(DisplayNumbers numbers) {
|
||||||
|
this.displayNumbers=numbers;
|
||||||
|
}
|
||||||
|
|
||||||
public static enum PinCount {
|
public static enum PinCount {
|
||||||
|
|
||||||
@@ -421,4 +494,14 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
|||||||
return Integer.parseInt(toString());
|
return Integer.parseInt(toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum DisplayNumbers {
|
||||||
|
|
||||||
|
NO, DIP, CONNECTOR;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-1
@@ -102,7 +102,15 @@ public class ICSymbol extends AbstractTransparentComponent<String> {
|
|||||||
}
|
}
|
||||||
g2d.setColor(finalLabelColor);
|
g2d.setColor(finalLabelColor);
|
||||||
int x = (controlPoints[0].x + controlPoints[2].x) / 2;
|
int x = (controlPoints[0].x + controlPoints[2].x) / 2;
|
||||||
drawCenteredText(g2d, display == Display.VALUE ? getValue() : getName(), x,
|
String label="";
|
||||||
|
label = display == Display.VALUE ? getValue() : getName();
|
||||||
|
if (display==Display.NONE) {
|
||||||
|
label="";
|
||||||
|
}
|
||||||
|
if (display==Display.BOTH) {
|
||||||
|
label=getName()+" "+(getValue() == null ? "" : getValue().toString());
|
||||||
|
}
|
||||||
|
drawCenteredText(g2d, label, x,
|
||||||
controlPoints[0].y + pinSpacing, HorizontalAlignment.CENTER,
|
controlPoints[0].y + pinSpacing, HorizontalAlignment.CENTER,
|
||||||
VerticalAlignment.CENTER);
|
VerticalAlignment.CENTER);
|
||||||
// Draw +/- markers
|
// Draw +/- markers
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ import org.diylc.core.IDIYComponent;
|
|||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "JFET Symbol", author = "Branislav Stojkovic", category = "Schematics", instanceNamePrefix = "Q", description = "JFET transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = false)
|
@ComponentDescriptor(name = "JFET Symbol", author = "Branislav Stojkovic", category = "Schematics", instanceNamePrefix = "Q", description = "JFET transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = true)
|
||||||
public class JFETSymbol extends AbstractTransistorSymbol {
|
public class JFETSymbol extends AbstractTransistorSymbol {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ import org.diylc.core.IDIYComponent;
|
|||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "MOSFET Symbol", author = "Branislav Stojkovic", category = "Schematics", instanceNamePrefix = "Q", description = "MOSFET transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = false)
|
@ComponentDescriptor(name = "MOSFET Symbol", author = "Branislav Stojkovic", category = "Schematics", instanceNamePrefix = "Q", description = "MOSFET transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = true)
|
||||||
public class MOSFETSymbol extends AbstractTransistorSymbol {
|
public class MOSFETSymbol extends AbstractTransistorSymbol {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
+8
-1
@@ -320,7 +320,14 @@ public class SIL_IC extends AbstractTransparentComponent<String> {
|
|||||||
}
|
}
|
||||||
g2d.setColor(finalLabelColor);
|
g2d.setColor(finalLabelColor);
|
||||||
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
||||||
String label = display == Display.NAME ? getName() : getValue();
|
String label="";
|
||||||
|
label = (getDisplay() == Display.NAME) ? getName() : getValue();
|
||||||
|
if (getDisplay() ==Display.NONE) {
|
||||||
|
label="";
|
||||||
|
}
|
||||||
|
if (getDisplay() ==Display.BOTH) {
|
||||||
|
label=getName()+" "+(getValue() == null ? "" : getValue().toString());
|
||||||
|
}
|
||||||
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
||||||
int textHeight = (int) (rect.getHeight());
|
int textHeight = (int) (rect.getHeight());
|
||||||
int textWidth = (int) (rect.getWidth());
|
int textWidth = (int) (rect.getWidth());
|
||||||
|
|||||||
+8
-1
@@ -252,7 +252,14 @@ public class TransistorTO1 extends AbstractTransparentComponent<String> {
|
|||||||
: getLabelColor();
|
: getLabelColor();
|
||||||
}
|
}
|
||||||
g2d.setColor(finalLabelColor);
|
g2d.setColor(finalLabelColor);
|
||||||
String label = (getDisplay() == Display.NAME) ? getName() : getValue();
|
String label="";
|
||||||
|
label = (getDisplay() == Display.NAME) ? getName() : getValue();
|
||||||
|
if (getDisplay() ==Display.NONE) {
|
||||||
|
label="";
|
||||||
|
}
|
||||||
|
if (getDisplay() ==Display.BOTH) {
|
||||||
|
label=getName()+" "+(getValue() == null ? "" : getValue().toString());
|
||||||
|
}
|
||||||
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
||||||
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
||||||
int textHeight = (int) (rect.getHeight());
|
int textHeight = (int) (rect.getHeight());
|
||||||
|
|||||||
+8
-1
@@ -398,7 +398,14 @@ public class TransistorTO220 extends AbstractTransparentComponent<String> {
|
|||||||
: LABEL_COLOR;
|
: LABEL_COLOR;
|
||||||
}
|
}
|
||||||
g2d.setColor(finalLabelColor);
|
g2d.setColor(finalLabelColor);
|
||||||
String label = (getDisplay() == Display.NAME) ? getName() : getValue();
|
String label="";
|
||||||
|
label = (getDisplay() == Display.NAME) ? getName() : getValue();
|
||||||
|
if (getDisplay() ==Display.NONE) {
|
||||||
|
label="";
|
||||||
|
}
|
||||||
|
if (getDisplay() ==Display.BOTH) {
|
||||||
|
label=getName()+" "+(getValue() == null ? "" : getValue().toString());
|
||||||
|
}
|
||||||
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
||||||
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
||||||
int textHeight = (int) (rect.getHeight());
|
int textHeight = (int) (rect.getHeight());
|
||||||
|
|||||||
+8
-1
@@ -291,7 +291,14 @@ public class TransistorTO3 extends AbstractTransparentComponent<String> {
|
|||||||
: getLabelColor();
|
: getLabelColor();
|
||||||
}
|
}
|
||||||
g2d.setColor(finalLabelColor);
|
g2d.setColor(finalLabelColor);
|
||||||
String label = (getDisplay() == Display.NAME) ? getName() : getValue();
|
String label="";
|
||||||
|
label = (getDisplay() == Display.NAME) ? getName() : getValue();
|
||||||
|
if (getDisplay() ==Display.NONE) {
|
||||||
|
label="";
|
||||||
|
}
|
||||||
|
if (getDisplay() ==Display.BOTH) {
|
||||||
|
label=getName()+" "+(getValue() == null ? "" : getValue().toString());
|
||||||
|
}
|
||||||
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
||||||
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
||||||
int textHeight = (int) (rect.getHeight());
|
int textHeight = (int) (rect.getHeight());
|
||||||
|
|||||||
+8
-1
@@ -288,7 +288,14 @@ public class TransistorTO92 extends AbstractTransparentComponent<String> {
|
|||||||
: getLabelColor();
|
: getLabelColor();
|
||||||
}
|
}
|
||||||
g2d.setColor(finalLabelColor);
|
g2d.setColor(finalLabelColor);
|
||||||
String label = (getDisplay() == Display.NAME) ? getName() : getValue();
|
String label="";
|
||||||
|
label = (getDisplay() == Display.NAME) ? getName() : getValue();
|
||||||
|
if (display==Display.NONE) {
|
||||||
|
label="";
|
||||||
|
}
|
||||||
|
if (display==Display.BOTH) {
|
||||||
|
label=getName()+" "+getValue();
|
||||||
|
}
|
||||||
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
||||||
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
Rectangle2D rect = fontMetrics.getStringBounds(label, g2d);
|
||||||
int textHeight = (int) (rect.getHeight());
|
int textHeight = (int) (rect.getHeight());
|
||||||
|
|||||||
+9
-1
@@ -85,8 +85,16 @@ public abstract class AbstractTubeSymbol extends AbstractComponent<String> {
|
|||||||
}
|
}
|
||||||
g2d.setColor(finalLabelColor);
|
g2d.setColor(finalLabelColor);
|
||||||
Point p = getTextLocation();
|
Point p = getTextLocation();
|
||||||
|
String label="";
|
||||||
|
label = display == Display.VALUE ? getValue() : getName();
|
||||||
|
if (display==Display.NONE) {
|
||||||
|
label="";
|
||||||
|
}
|
||||||
|
if (display==Display.BOTH) {
|
||||||
|
label=getName()+" "+(getValue() == null ? "" : getValue().toString());
|
||||||
|
}
|
||||||
drawCenteredText(g2d,
|
drawCenteredText(g2d,
|
||||||
display == Display.VALUE ? getValue() : getName(), p.x, p.y,
|
label, p.x, p.y,
|
||||||
HorizontalAlignment.LEFT, VerticalAlignment.TOP);
|
HorizontalAlignment.LEFT, VerticalAlignment.TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" path="test"/>
|
<classpathentry kind="src" path="test"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/junit-4.7.jar"/>
|
<classpathentry kind="lib" path="lib/junit-4.7.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/iText-2.1.7.jar"/>
|
<classpathentry kind="lib" path="lib/iText-2.1.7.jar"/>
|
||||||
@@ -16,5 +15,6 @@
|
|||||||
<classpathentry kind="lib" path="lib/swing-framework.jar"/>
|
<classpathentry kind="lib" path="lib/swing-framework.jar"/>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/diylc-core"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/diylc-core"/>
|
||||||
<classpathentry kind="lib" path="lib/xstream-1.4.3.jar"/>
|
<classpathentry kind="lib" path="lib/xstream-1.4.3.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_40"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
-Xms512m -Xmx1024m -Dorg.diylc.scriptRun=true
|
-Xms512m -Xmx1024m -Dorg.diylc.scriptRun=true -Dfile.encoding=UTF-8
|
||||||
Binary file not shown.
Binary file not shown.
+4
-1
@@ -261,7 +261,7 @@ public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
@Override
|
@Override
|
||||||
public EnumSet<EventType> getSubscribedEventTypes() {
|
public EnumSet<EventType> getSubscribedEventTypes() {
|
||||||
return EnumSet.of(EventType.SELECTION_CHANGED,
|
return EnumSet.of(EventType.SELECTION_CHANGED,
|
||||||
EventType.PROJECT_MODIFIED);
|
EventType.PROJECT_MODIFIED, EventType.PROJECT_LOADED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -274,6 +274,9 @@ public class EditMenuPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
undoHandler.stateChanged((Project) params[0], (Project) params[1],
|
undoHandler.stateChanged((Project) params[0], (Project) params[1],
|
||||||
(String) params[2]);
|
(String) params[2]);
|
||||||
break;
|
break;
|
||||||
|
case PROJECT_LOADED:
|
||||||
|
undoHandler.reset();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ public class HelpMenuPlugin implements IPlugIn {
|
|||||||
aboutDialog = DialogFactory.getInstance().createAboutDialog("DIY Layout Creator",
|
aboutDialog = DialogFactory.getInstance().createAboutDialog("DIY Layout Creator",
|
||||||
IconLoader.IconLarge.getIcon(),
|
IconLoader.IconLarge.getIcon(),
|
||||||
plugInPort.getCurrentVersionNumber().toString(), "Branislav Stojkovic",
|
plugInPort.getCurrentVersionNumber().toString(), "Branislav Stojkovic",
|
||||||
"diylc.org", "bancika@gmail.com", "");
|
"https://github.com/bancika/diy-layout-creator", "bancika@gmail.com", "");
|
||||||
}
|
}
|
||||||
return aboutDialog;
|
return aboutDialog;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1256,6 +1256,46 @@
|
|||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
</changes>
|
</changes>
|
||||||
<url>http://code.google.com/p/diy-layout-creator/downloads/list</url>
|
<url>http://code.google.com/p/diy-layout-creator/downloads/list</url>
|
||||||
|
</org.diylc.appframework.update.Version>
|
||||||
|
<org.diylc.appframework.update.Version>
|
||||||
|
<versionNumber>
|
||||||
|
<major>3</major>
|
||||||
|
<minor>29</minor>
|
||||||
|
<build>0</build>
|
||||||
|
</versionNumber>
|
||||||
|
<releaseDate>2016-04-20 20:00:00.000 CET</releaseDate>
|
||||||
|
<name></name>
|
||||||
|
<changes>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Issue with losing saved user configuration</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Issue with disabled "Save as Template" context menu item problem, as well as issue with strange rotation and probably few more</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Undo steps kept after opening a new file</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Transistors can be rotated and flipped vertically</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>DIL ICs can show pin numbers</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Display both component value and name or neither of them</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Potentiometer schematic symbol added</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
</changes>
|
||||||
|
<url>http://code.google.com/p/diy-layout-creator/downloads/list</url>
|
||||||
</org.diylc.appframework.update.Version>
|
</org.diylc.appframework.update.Version>
|
||||||
</a>
|
</a>
|
||||||
</java.util.Arrays_-ArrayList>
|
</java.util.Arrays_-ArrayList>
|
||||||
Reference in New Issue
Block a user