diff --git a/diylc/diylc-core/.classpath b/diylc/diylc-core/.classpath
index d10fce33..b52b9a35 100644
--- a/diylc/diylc-core/.classpath
+++ b/diylc/diylc-core/.classpath
@@ -6,9 +6,9 @@
-
+
diff --git a/diylc/diylc-core/lib/xstream-1.3.1.jar b/diylc/diylc-core/lib/xstream-1.3.1.jar
deleted file mode 100644
index 4ef4219c..00000000
Binary files a/diylc/diylc-core/lib/xstream-1.3.1.jar and /dev/null differ
diff --git a/diylc/diylc-core/lib/xstream-1.4.3.jar b/diylc/diylc-core/lib/xstream-1.4.3.jar
new file mode 100644
index 00000000..815ed039
Binary files /dev/null and b/diylc/diylc-core/lib/xstream-1.4.3.jar differ
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/BinaryType.java b/diylc/diylc-core/src/org/diylc/core/annotations/BinaryType.java
new file mode 100644
index 00000000..87f25688
--- /dev/null
+++ b/diylc/diylc-core/src/org/diylc/core/annotations/BinaryType.java
@@ -0,0 +1,5 @@
+package org.diylc.core.annotations;
+
+public enum BinaryType {
+ IMAGE, SVG
+}
diff --git a/diylc/diylc-core/src/org/diylc/core/annotations/ByteArrayProperty.java b/diylc/diylc-core/src/org/diylc/core/annotations/ByteArrayProperty.java
new file mode 100644
index 00000000..eb1d4795
--- /dev/null
+++ b/diylc/diylc-core/src/org/diylc/core/annotations/ByteArrayProperty.java
@@ -0,0 +1,31 @@
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 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 .
+
+*/
+package org.diylc.core.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ByteArrayProperty {
+
+ public BinaryType binaryType();
+}
diff --git a/diylc/diylc-core/src/org/diylc/presenter/update.xml b/diylc/diylc-core/src/org/diylc/presenter/update.xml
index cccab76c..97ee3fa7 100644
--- a/diylc/diylc-core/src/org/diylc/presenter/update.xml
+++ b/diylc/diylc-core/src/org/diylc/presenter/update.xml
@@ -3545,5 +3545,29 @@
https://github.com/bancika/diy-layout-creator/releases
+
+
+ 4
+ 18
+ 0
+
+ 2021-07-11 00:00:00.000 CET
+
+
+
+ NEW_FEATURE
+ Added 'SVG Image' component, to allow importing vector graphics into projects
+
+
+ BUG_FIX
+ Mini Toggle Switch - lugs do not get rotated when changing orientation; rotate from the context menu doesn't work
+
+
+ BUG_FIX
+ Fixed the issue with Perf Board, Vero Board and TriPad Board sometimes rendering an extra row with pads when there's no space for them
+
+
+ https://github.com/bancika/diy-layout-creator/releases
+
diff --git a/diylc/diylc-library/.classpath b/diylc/diylc-library/.classpath
index 5711e9dc..0b3ed2f4 100644
--- a/diylc/diylc-library/.classpath
+++ b/diylc/diylc-library/.classpath
@@ -6,6 +6,7 @@
+
diff --git a/diylc/diylc-library/lib/diylc-core.jar b/diylc/diylc-library/lib/diylc-core.jar
index 4cca113c..129672d8 100644
Binary files a/diylc/diylc-library/lib/diylc-core.jar and b/diylc/diylc-library/lib/diylc-core.jar differ
diff --git a/diylc/diylc-library/lib/svgSalamander-1.1.2.4.jar b/diylc/diylc-library/lib/svgSalamander-1.1.2.4.jar
new file mode 100644
index 00000000..e825b66b
Binary files /dev/null and b/diylc/diylc-library/lib/svgSalamander-1.1.2.4.jar differ
diff --git a/diylc/diylc-library/src/org/diylc/components/boards/PerfBoard.java b/diylc/diylc-library/src/org/diylc/components/boards/PerfBoard.java
index 5e8bb597..aa8d396f 100644
--- a/diylc/diylc-library/src/org/diylc/components/boards/PerfBoard.java
+++ b/diylc/diylc-library/src/org/diylc/components/boards/PerfBoard.java
@@ -80,7 +80,7 @@ public class PerfBoard extends AbstractBoard {
int holeDiameter = getClosestOdd((int) HOLE_SIZE.convertToPixels());
double spacing = this.spacing.convertToPixels();
- while (y < finalSecondPoint.getY() - spacing) {
+ while (y < finalSecondPoint.getY() - spacing - diameter / 2) {
x = firstPoint.getX();
y += spacing;
while (x < finalSecondPoint.getX() - spacing - diameter) {
diff --git a/diylc/diylc-library/src/org/diylc/components/boards/TriPadBoard.java b/diylc/diylc-library/src/org/diylc/components/boards/TriPadBoard.java
index 79840488..ac2f1495 100644
--- a/diylc/diylc-library/src/org/diylc/components/boards/TriPadBoard.java
+++ b/diylc/diylc-library/src/org/diylc/components/boards/TriPadBoard.java
@@ -71,7 +71,7 @@ public class TriPadBoard extends AbstractVeroBoard {
double spacing = this.spacing.convertToPixels();
if (orientation == OrientationHV.HORIZONTAL) {
- while (y < finalSecondPoint.getY() - spacing) {
+ while (y < finalSecondPoint.getY() - spacing - stripSize / 2) {
x = firstPoint.getX();
y += spacing;
diff --git a/diylc/diylc-library/src/org/diylc/components/boards/VeroBoard.java b/diylc/diylc-library/src/org/diylc/components/boards/VeroBoard.java
index d4067307..dbf55ab4 100644
--- a/diylc/diylc-library/src/org/diylc/components/boards/VeroBoard.java
+++ b/diylc/diylc-library/src/org/diylc/components/boards/VeroBoard.java
@@ -70,7 +70,7 @@ public class VeroBoard extends AbstractVeroBoard {
int spacing = (int) this.spacing.convertToPixels();
if (orientation == OrientationHV.HORIZONTAL) {
- while (y < finalSecondPoint.getY() - spacing) {
+ while (y < finalSecondPoint.getY() - spacing - stripSize / 2) {
x = firstPoint.getX();
y += spacing;
g2d.setColor(stripColor);
diff --git a/diylc/diylc-library/src/org/diylc/components/electromechanical/MiniToggleSwitch.java b/diylc/diylc-library/src/org/diylc/components/electromechanical/MiniToggleSwitch.java
index 2708fb10..85edd1e0 100644
--- a/diylc/diylc-library/src/org/diylc/components/electromechanical/MiniToggleSwitch.java
+++ b/diylc/diylc-library/src/org/diylc/components/electromechanical/MiniToggleSwitch.java
@@ -37,6 +37,7 @@ import org.diylc.common.IPlugInPort;
import org.diylc.common.ObjectCache;
import org.diylc.common.OrientationHV;
import org.diylc.components.AbstractTransparentComponent;
+import org.diylc.components.transform.MiniToggleSwitchTransformer;
import org.diylc.core.ComponentState;
import org.diylc.core.IDIYComponent;
import org.diylc.core.IDrawingObserver;
@@ -53,7 +54,7 @@ import org.diylc.utils.Constants;
@ComponentDescriptor(name = "Mini Toggle Switch", category = "Electro-Mechanical", author = "Branislav Stojkovic",
description = "Panel mounted mini toggle switch", zOrder = IDIYComponent.COMPONENT,
- instanceNamePrefix = "SW", autoEdit = false, enableCache = true)
+ instanceNamePrefix = "SW", autoEdit = false, enableCache = true, transformer = MiniToggleSwitchTransformer.class)
public class MiniToggleSwitch extends AbstractTransparentComponent implements ISwitch {
private static final long serialVersionUID = 1L;
@@ -286,9 +287,19 @@ public class MiniToggleSwitch extends AbstractTransparentComponent {
return new ImageIcon(data);
}
+ @ByteArrayProperty(binaryType = BinaryType.IMAGE)
@EditableProperty(name = "Image")
public byte[] getData() {
return data;
diff --git a/diylc/diylc-library/src/org/diylc/components/misc/SVGImage.java b/diylc/diylc-library/src/org/diylc/components/misc/SVGImage.java
new file mode 100644
index 00000000..af512050
--- /dev/null
+++ b/diylc/diylc-library/src/org/diylc/components/misc/SVGImage.java
@@ -0,0 +1,294 @@
+/*
+ *
+ * DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 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
+ * .
+ */
+package org.diylc.components.misc;
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Composite;
+import java.awt.Graphics2D;
+import java.awt.Shape;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Random;
+
+import org.apache.log4j.Logger;
+import org.apache.poi.util.IOUtils;
+import org.diylc.common.ObjectCache;
+import org.diylc.common.Orientation;
+import org.diylc.components.AbstractTransparentComponent;
+import org.diylc.components.transform.ImageTransformer;
+import org.diylc.core.ComponentState;
+import org.diylc.core.IDIYComponent;
+import org.diylc.core.IDrawingObserver;
+import org.diylc.core.Project;
+import org.diylc.core.VisibilityPolicy;
+import org.diylc.core.annotations.BinaryType;
+import org.diylc.core.annotations.BomPolicy;
+import org.diylc.core.annotations.ByteArrayProperty;
+import org.diylc.core.annotations.ComponentDescriptor;
+import org.diylc.core.annotations.EditableProperty;
+import org.diylc.core.annotations.PercentEditor;
+
+import com.kitfox.svg.SVGDiagram;
+import com.kitfox.svg.SVGException;
+import com.kitfox.svg.SVGUniverse;
+
+@ComponentDescriptor(name = "SVG Image", author = "Branislav Stojkovic", category = "Misc",
+ description = "Scalable Vector Graphics", instanceNamePrefix = "Svg",
+ zOrder = IDIYComponent.COMPONENT, flexibleZOrder = true, bomPolicy = BomPolicy.NEVER_SHOW,
+ transformer = ImageTransformer.class)
+public class SVGImage extends AbstractTransparentComponent {
+
+ private static final Logger LOG = Logger.getLogger(SVGImage.class);
+
+ private static final long serialVersionUID = 1L;
+ public static String DEFAULT_TEXT = "Double click to edit text";
+ private static byte DEFAULT_SCALE = 25;
+
+ private Point2D.Double point = new Point2D.Double(0, 0);
+ private Point2D.Double secondPoint = null;
+
+ private Orientation orientation;
+
+ @Override
+ public String getControlPointNodeName(int index) {
+ return null;
+ }
+
+ private byte[] data;
+ private Byte scale;
+ private byte newScale = DEFAULT_SCALE;
+ private ImageSizingMode sizingMode = ImageSizingMode.Scale;
+ private transient SVGDiagram svgDiagram;
+
+ public SVGImage() {
+ try {
+ data = IOUtils.toByteArray(SVGImage.class.getResourceAsStream("diylc.svg"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
+ Project project, IDrawingObserver drawingObserver) {
+ double scaleX;
+ double scaleY;
+ SVGDiagram svgDiagram = getSvgDiagram();
+ if (getSizingMode() == ImageSizingMode.Scale) {
+ scaleX = scaleY = 1d * getScale() / DEFAULT_SCALE;
+ } else {
+ Point2D secondPoint = getControlPoint(1);
+ scaleX = 1d * Math.abs(point.getX() - secondPoint.getX()) / svgDiagram.getWidth();
+ scaleY = 1d * Math.abs(point.getY() - secondPoint.getY()) / svgDiagram.getHeight();
+ }
+
+ Shape clip = g2d.getClip().getBounds();
+ if (!clip.intersects(new Rectangle2D.Double(point.getX(), point.getY(),
+ 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));
+ }
+
+ double x;
+ double y;
+ if (getSizingMode() == ImageSizingMode.Scale) {
+ x = point.getX();
+ y = point.getY();
+ } else {
+ Point2D secondPoint = getControlPoint(1);
+ x = Math.min(point.getX(), secondPoint.getX());
+ y = Math.min(point.getY(), secondPoint.getY());
+ }
+
+ if (getOrientation() != Orientation.DEFAULT) {
+ double theta = getOrientation().toRadians();
+ g2d.rotate(theta, x, y);
+ }
+
+ g2d.scale(scaleX, scaleY);
+
+ g2d.translate(x / scaleX, y / scaleY);
+
+ try {
+ svgDiagram.render(g2d);
+ } catch (SVGException e) {
+ LOG.error("Error rendering SVG", e);
+ }
+
+ if (componentState == ComponentState.SELECTED) {
+ g2d.translate(-x / scaleX, -y / scaleY);
+ g2d.setComposite(oldComposite);
+ g2d.scale(1 / scaleX, 1 / scaleY);
+ g2d.setColor(SELECTION_COLOR);
+ g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
+ g2d.drawRect((int) x, (int) y, (int) (svgDiagram.getWidth() * scaleX),
+ (int) (svgDiagram.getHeight() * scaleY));
+ }
+ }
+
+ @Override
+ public void drawIcon(Graphics2D g2d, int width, int height) {
+ int factor = 32 / width;
+ g2d.setColor(Color.decode("#91D4FF"));
+ g2d.fillOval(2 / factor, 2 / factor, width / 2 + 2 / factor, height / 2 + 2 / factor);
+ g2d.setColor(Color.decode("#91D4FF").darker());
+ g2d.drawOval(2 / factor, 2 / factor, width / 2 + 2 / factor, height / 2 + 2 / factor);
+
+ g2d.setColor(Color.decode("#A2D383"));
+ g2d.fillRect(width / 2 - 2 / factor, height / 2 - 2 / factor, width / 2, height / 2);
+ g2d.setColor(Color.decode("#A2D383").darker());
+ g2d.drawRect(width / 2 - 2 / factor, height / 2 - 2 / factor, width / 2, height / 2);
+ }
+
+ @Override
+ public int getControlPointCount() {
+ return getSizingMode() == ImageSizingMode.Scale ? 1 : 2;
+ }
+
+ @Override
+ public Point2D getControlPoint(int index) {
+ if (index == 0)
+ return point;
+ if (secondPoint == null) {
+ SVGDiagram svgDiagram = getSvgDiagram();
+ secondPoint = new Point2D.Double(point.getX() + svgDiagram.getWidth(),
+ point.getY() + svgDiagram.getHeight());
+ }
+ return secondPoint;
+ }
+
+ private SVGDiagram getSvgDiagram() {
+ if (svgDiagram == null) {
+ ByteArrayInputStream bis = new ByteArrayInputStream(data);
+ SVGUniverse universe = new SVGUniverse();
+ try {
+ URI url = universe.loadSVG(bis, "SVG-" + Integer.toHexString(new Random(System.currentTimeMillis()).nextInt()));
+ svgDiagram = universe.getDiagram(url);
+ svgDiagram.setIgnoringClipHeuristic(true);
+ } catch (IOException e) {
+ LOG.error("Error loading SVG", e);
+ }
+ }
+ return svgDiagram;
+ }
+
+ @Override
+ public boolean isControlPointSticky(int index) {
+ return false;
+ }
+
+ @Override
+ public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
+ return getSizingMode() == ImageSizingMode.Scale ? VisibilityPolicy.NEVER
+ : VisibilityPolicy.WHEN_SELECTED;
+ }
+
+ @Override
+ public void setControlPoint(Point2D point, int index) {
+ if (index == 0) {
+ this.point.setLocation(point.getX(), point.getY());
+ } else {
+ if (secondPoint == null)
+ secondPoint = new Point2D.Double(point.getX(), point.getY());
+ else
+ secondPoint.setLocation(point.getX(), point.getY());
+ }
+ }
+
+ @ByteArrayProperty(binaryType = BinaryType.SVG)
+ @EditableProperty(name = "Image")
+ public byte[] getData() {
+ return data;
+ }
+
+ public void setData(byte[] data) {
+ this.data = data;
+ this.svgDiagram = null;
+ }
+
+ @PercentEditor(_100PercentValue = 25)
+ @EditableProperty(defaultable = false)
+ public byte getScale() {
+ if (scale != null) {
+ newScale = (byte) (scale / 2);
+ scale = null;
+ }
+ return newScale;
+ }
+
+ public void setScale(byte scale) {
+ this.newScale = scale;
+ }
+
+ @Override
+ public String getName() {
+ return super.getName();
+ }
+
+ @Override
+ public Void getValue() {
+ return null;
+ }
+
+ @EditableProperty(name = "Sizing Mode")
+ public ImageSizingMode getSizingMode() {
+ if (sizingMode == null)
+ sizingMode = ImageSizingMode.Scale;
+ return sizingMode;
+ }
+
+ public void setSizingMode(ImageSizingMode sizingMode) {
+ this.sizingMode = sizingMode;
+ }
+
+ @Override
+ public void setValue(Void value) {}
+
+ @EditableProperty
+ public Orientation getOrientation() {
+ if (orientation == null)
+ orientation = Orientation.DEFAULT;
+ return orientation;
+ }
+
+ public void setOrientation(Orientation orientation) {
+ this.orientation = orientation;
+ }
+
+ public static enum ImageSizingMode {
+ TwoPoints("Opposing Points"), Scale("Scale");
+
+ private String label;
+
+ private ImageSizingMode(String label) {
+ this.label = label;
+ }
+
+ @Override
+ public String toString() {
+ return label;
+ }
+ }
+}
diff --git a/diylc/diylc-library/src/org/diylc/components/misc/diylc.svg b/diylc/diylc-library/src/org/diylc/components/misc/diylc.svg
new file mode 100644
index 00000000..97302e81
--- /dev/null
+++ b/diylc/diylc-library/src/org/diylc/components/misc/diylc.svg
@@ -0,0 +1,84 @@
+
+
+
+
diff --git a/diylc/diylc-library/src/org/diylc/components/transform/MiniToggleSwitchTransformer.java b/diylc/diylc-library/src/org/diylc/components/transform/MiniToggleSwitchTransformer.java
new file mode 100644
index 00000000..21da24ee
--- /dev/null
+++ b/diylc/diylc-library/src/org/diylc/components/transform/MiniToggleSwitchTransformer.java
@@ -0,0 +1,92 @@
+/*
+
+ DIY Layout Creator (DIYLC).
+ Copyright (c) 2009-2018 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 .
+
+*/
+package org.diylc.components.transform;
+
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+
+import org.diylc.common.IComponentTransformer;
+import org.diylc.common.OrientationHV;
+import org.diylc.components.electromechanical.MiniToggleSwitch;
+import org.diylc.core.IDIYComponent;
+
+public class MiniToggleSwitchTransformer implements IComponentTransformer {
+
+ @Override
+ public boolean canRotate(IDIYComponent> component) {
+ return component.getClass().equals(MiniToggleSwitch.class);
+ }
+
+ @Override
+ public boolean canMirror(IDIYComponent> component) {
+ return component.getClass().equals(MiniToggleSwitch.class);
+ }
+
+ @Override
+ public boolean mirroringChangesCircuit() {
+ return true;
+ }
+
+ @Override
+ public void rotate(IDIYComponent> component, Point2D center, int direction) {
+ AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI / 2 * direction, center.getX(), center.getY());
+ for (int index = 0; index < component.getControlPointCount(); index++) {
+ Point2D p = new Point2D.Double();
+ rotate.transform(component.getControlPoint(index), p);
+ component.setControlPoint(p, index);
+ }
+
+ MiniToggleSwitch sw = (MiniToggleSwitch) component;
+ OrientationHV o = sw.getOrientation();
+ int oValue = o.ordinal();
+ oValue += direction;
+ if (oValue < 0)
+ oValue = OrientationHV.values().length - 1;
+ if (oValue >= OrientationHV.values().length)
+ oValue = 0;
+ o = OrientationHV.values()[oValue];
+ sw.setOrientation(o);
+ }
+
+ @Override
+ public void mirror(IDIYComponent> component, Point2D center, int direction) {
+ MiniToggleSwitch sw = (MiniToggleSwitch) component;
+
+ if (direction == IComponentTransformer.HORIZONTAL) {
+ double dx = 2 * (center.getX() - sw.getControlPoint(1).getX());
+ double dy = 0;
+
+ for (int i = 0; i < sw.getControlPointCount(); i++) {
+ Point2D p = sw.getControlPoint(i);
+ sw.setControlPoint(new Point2D.Double(p.getX() + dx, p.getY() + dy), i);
+ }
+ } else {
+ double dx = 0;
+ double dy = 2 * (center.getY() - sw.getControlPoint(1).getY());
+
+ for (int i = 0; i < sw.getControlPointCount(); i++) {
+ Point2D p = sw.getControlPoint(i);
+ sw.setControlPoint(new Point2D.Double(p.getX() + dx, p.getY() + dy), i);
+ }
+ }
+ }
+}
diff --git a/diylc/diylc-swing/.classpath b/diylc/diylc-swing/.classpath
index eaf2020c..7041ee5a 100644
--- a/diylc/diylc-swing/.classpath
+++ b/diylc/diylc-swing/.classpath
@@ -17,6 +17,7 @@
+
diff --git a/diylc/diylc-swing/build.xml b/diylc/diylc-swing/build.xml
index dbdc9d84..da0188ba 100644
--- a/diylc/diylc-swing/build.xml
+++ b/diylc/diylc-swing/build.xml
@@ -10,7 +10,7 @@
-
+
@@ -163,6 +163,7 @@
+
diff --git a/diylc/diylc-swing/flatpak/com.diy_fever.DIYLayoutCreator.metainfo.xml b/diylc/diylc-swing/flatpak/com.diy_fever.DIYLayoutCreator.metainfo.xml
index 695b0e72..640fb923 100644
--- a/diylc/diylc-swing/flatpak/com.diy_fever.DIYLayoutCreator.metainfo.xml
+++ b/diylc/diylc-swing/flatpak/com.diy_fever.DIYLayoutCreator.metainfo.xml
@@ -33,10 +33,31 @@
http://diy-fever.com/donate
https://github.com/bancika/diy-layout-creator/tree/wiki
https://github.com/bancika/diy-layout-creator/blob/wiki/FAQ.md
- bancika_AT_gmail.com
+
nbenitezl_AT_gmail.com
+
+
+
+ - [New Feature] Added 'SVG Image' component, to allow importing vector graphics into projects
+ - [Bug Fix] Mini Toggle Switch - lugs do not get rotated when changing orientation; rotate from the context menu doesn't work
+ - [Bug Fix] Fixed the issue with Perf Board, Vero Board and TriPad Board sometimes rendering an extra row with pads when there's no space for them
+
+
+ https://github.com/bancika/diy-layout-creator/releases/tag/v4.18.0
+
+
+
+
+ - [New Feature] Added 'Eurorack Stripboard' component, designed by David Haillant
+ - [New Feature] Allow multi-line text in label components
+ - [Improvement] Slightly fancier splash screen :)
+ - [Bug Fix] Fixed a major memory leak when using Undo functionality
+
+
+ https://github.com/bancika/diy-layout-creator/releases/tag/v4.17.0
+
diff --git a/diylc/diylc-swing/lib/diylc-core.jar b/diylc/diylc-swing/lib/diylc-core.jar
index 4cca113c..129672d8 100644
Binary files a/diylc/diylc-swing/lib/diylc-core.jar and b/diylc/diylc-swing/lib/diylc-core.jar differ
diff --git a/diylc/diylc-swing/lib/svgSalamander-1.1.2.4.jar b/diylc/diylc-swing/lib/svgSalamander-1.1.2.4.jar
new file mode 100644
index 00000000..e825b66b
Binary files /dev/null and b/diylc/diylc-swing/lib/svgSalamander-1.1.2.4.jar differ
diff --git a/diylc/diylc-swing/library/main.jar b/diylc/diylc-swing/library/main.jar
index 64b04c4b..2b122bf6 100644
Binary files a/diylc/diylc-swing/library/main.jar and b/diylc/diylc-swing/library/main.jar differ
diff --git a/diylc/diylc-swing/src/org/diylc/swing/gui/editor/FieldEditorFactory.java b/diylc/diylc-swing/src/org/diylc/swing/gui/editor/FieldEditorFactory.java
index bbe53a91..84b5ed27 100644
--- a/diylc/diylc-swing/src/org/diylc/swing/gui/editor/FieldEditorFactory.java
+++ b/diylc/diylc-swing/src/org/diylc/swing/gui/editor/FieldEditorFactory.java
@@ -30,6 +30,7 @@ import javax.swing.JLabel;
import org.apache.log4j.Logger;
import org.diylc.common.PropertyWrapper;
import org.diylc.components.misc.LoadlineEntity;
+import org.diylc.core.annotations.ByteArrayProperty;
import org.diylc.core.annotations.DynamicList;
import org.diylc.core.annotations.MultiLineText;
import org.diylc.core.measures.AbstractMeasure;
@@ -77,8 +78,17 @@ public class FieldEditorFactory {
MeasureArrayEditor editor = new MeasureArrayEditor(property);
return editor;
}
- if (byte[].class.isAssignableFrom(property.getType())) {
- ImageEditor editor = new ImageEditor(property);
+ if (byte[].class.isAssignableFrom(property.getType())) {
+ ByteArrayProperty annotation = null;
+ try {
+ property.getGetter().isAnnotationPresent(ByteArrayProperty.class);
+ annotation = property.getGetter().getAnnotation(ByteArrayProperty.class);
+ } catch (SecurityException e) {
+ LOG.error("Error while reading ByteArrayProperty annotation", e);
+ } catch (NoSuchMethodException e) {
+ LOG.error("Error while reading ByteArrayProperty annotation", e);
+ }
+ ImageEditor editor = new ImageEditor(property, annotation == null ? null : annotation.binaryType());
return editor;
}
if (property.getType().isEnum()) {
diff --git a/diylc/diylc-swing/src/org/diylc/swing/gui/editor/ImageEditor.java b/diylc/diylc-swing/src/org/diylc/swing/gui/editor/ImageEditor.java
index c22892d2..43c65316 100644
--- a/diylc/diylc-swing/src/org/diylc/swing/gui/editor/ImageEditor.java
+++ b/diylc/diylc-swing/src/org/diylc/swing/gui/editor/ImageEditor.java
@@ -27,6 +27,7 @@ import javax.swing.JButton;
import org.apache.log4j.Logger;
import org.apache.poi.util.IOUtils;
import org.diylc.common.PropertyWrapper;
+import org.diylc.core.annotations.BinaryType;
import org.diylc.swing.gui.DialogFactory;
import org.diylc.swing.plugins.file.FileFilterEnum;
@@ -38,16 +39,19 @@ public class ImageEditor extends JButton {
private static final String title = "Click to load image file";
- public ImageEditor(final PropertyWrapper property) {
+ private BinaryType binaryType;
+
+ public ImageEditor(final PropertyWrapper property, BinaryType binaryType) {
super(property.isUnique() ? title : ("(multi value) " + title));
+ this.binaryType = binaryType;
if (property.isReadOnly())
setEnabled(false);
addActionListener(new ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
- File file = DialogFactory.getInstance().showOpenDialog(FileFilterEnum.IMAGES.getFilter(),
- null, FileFilterEnum.IMAGES.getExtensions()[0], null);
+ File file = DialogFactory.getInstance().showOpenDialog(getFileFilterEnum().getFilter(),
+ null, getFileFilterEnum().getExtensions()[0], null);
if (file != null) {
property.setChanged(true);
FileInputStream fis;
@@ -63,6 +67,13 @@ public class ImageEditor extends JButton {
}
});
}
+
+ private FileFilterEnum getFileFilterEnum() {
+ if (binaryType == BinaryType.SVG) {
+ return FileFilterEnum.SVG;
+ }
+ return FileFilterEnum.IMAGES;
+ }
// @Override
// public void setBackground(Color bg) {
diff --git a/diylc/diylc-swing/src/org/diylc/swing/plugins/file/FileFilterEnum.java b/diylc/diylc-swing/src/org/diylc/swing/plugins/file/FileFilterEnum.java
index 0bd381a3..75de3023 100644
--- a/diylc/diylc-swing/src/org/diylc/swing/plugins/file/FileFilterEnum.java
+++ b/diylc/diylc-swing/src/org/diylc/swing/plugins/file/FileFilterEnum.java
@@ -30,7 +30,7 @@ public enum FileFilterEnum {
PNG("PNG Images (*.png)", "png"), PDF("PDF Files (*.pdf)", "pdf"), DIY("DIY Project Files (*.diy)", "diy"), EXCEL(
"Excel Workbooks (*.xls)", "xls"), CSV("Comma Separated Files (*.csv)", "csv"), HTML("HTML Files (*.html)",
"html"), IMAGES("Image Files (*.png, *.jpg, *.gif)", "png", "jpg", "gif"), XML("XML Files (*.xml)", "xml"),
- TEST("Test Files (*.tst)", "tst"), CRV("Curve Files (*.crv)", "crv");
+ TEST("Test Files (*.tst)", "tst"), CRV("Curve Files (*.crv)", "crv"), SVG("SVG Files (*.svg)", "svg");
FileFilter filter;
String[] extensions;