diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/config.xml b/ diy-layout-creator --username bancika@gmail.com/DIYLC/config.xml index 567e6f8a..29030c88 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/config.xml +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/config.xml @@ -1,15 +1,15 @@ - lastPath - C:\Documents and Settings\Branislav Stojkovic\Desktop\oldFiles + metric + true zoom 1.0 - metric - true + lastPath + C:\Documents and Settings\Branislav Stojkovic\Desktop\oldFiles default.org.diylc.components.misc.Label:Color diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/library/main.jar b/ diy-layout-creator --username bancika@gmail.com/DIYLC/library/main.jar index 7ab1a3b6..2005e958 100644 Binary files a/ diy-layout-creator --username bancika@gmail.com/DIYLC/library/main.jar and b/ diy-layout-creator --username bancika@gmail.com/DIYLC/library/main.jar differ diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/presenter/ProjectFileManager.java b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/presenter/ProjectFileManager.java index e06574f1..c20c71b9 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/presenter/ProjectFileManager.java +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/presenter/ProjectFileManager.java @@ -206,15 +206,16 @@ public class ProjectFileManager { IDIYComponent component = null; if (nodeName.equalsIgnoreCase("text")) { LOG.debug("Recognized " + nodeName); - Label pad = new Label(); - pad.setName(nameAttr); + Label label = new Label(); + label.setName(nameAttr); if (color != null) { - pad.setColor(color); + label.setColor(color); } - pad.setText(valueAttr); - pad.setControlPoint(convertV1CoordinatesToV3Point(referencePoint, x1Attr, + label.setText(valueAttr); + label.setCenter(false); + label.setControlPoint(convertV1CoordinatesToV3Point(referencePoint, x1Attr, y1Attr), 0); - component = pad; + component = label; } else if (nodeName.equalsIgnoreCase("pad")) { LOG.debug("Recognized " + nodeName); SolderPad pad = new SolderPad(); diff --git a/ diy-layout-creator --username bancika@gmail.com/Library/src/org/diylc/components/misc/Label.java b/ diy-layout-creator --username bancika@gmail.com/Library/src/org/diylc/components/misc/Label.java index faccec9b..b8164540 100644 --- a/ diy-layout-creator --username bancika@gmail.com/Library/src/org/diylc/components/misc/Label.java +++ b/ diy-layout-creator --username bancika@gmail.com/Library/src/org/diylc/components/misc/Label.java @@ -27,6 +27,7 @@ public class Label extends AbstractComponent { private String text = DEFAULT_TEXT; private Font font = LABEL_FONT; private Color color = LABEL_COLOR; + private boolean center = true; @Override public void draw(Graphics2D g2d, ComponentState componentState, Project project, @@ -39,9 +40,16 @@ public class Label extends AbstractComponent { int textHeight = (int) rect.getHeight(); int textWidth = (int) rect.getWidth(); - // Center text horizontally and vertically - int x = point.x - textWidth / 2; - int y = point.y - textHeight / 2 + fontMetrics.getAscent(); + int x; + int y; + if (center) { + // Center text horizontally and vertically + x = point.x - textWidth / 2; + y = point.y - textHeight / 2 + fontMetrics.getAscent(); + } else { + x = point.x; + y = point.y - textHeight; + } g2d.drawString(text, x, y); } @@ -107,6 +115,14 @@ public class Label extends AbstractComponent { this.color = color; } + public boolean getCenter() { + return center; + } + + public void setCenter(boolean center) { + this.center = center; + } + @Override public String getName() { return super.getName();