mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 01:02:08 +10:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 243b13c37c | |||
| 4660467df5 | |||
| 73a12bc107 | |||
| ece6015a7f | |||
| 1cbdf505fe | |||
| f0c1970784 | |||
| 14944a3e38 | |||
| 48fe5f496b | |||
| 57a7932675 | |||
| e0d2964e12 | |||
| c3f9208ab7 | |||
| 3a5e6f553d | |||
| 24c8afd620 | |||
| 4710d1b484 | |||
| 2ce7677672 | |||
| 04a22436d2 | |||
| 0ef3bc4adb |
@@ -2,6 +2,7 @@ Thank you for reporting issues and contributing ideas and features to DIYLC repo
|
|||||||
|
|
||||||
Before you proceed, please read the following:
|
Before you proceed, please read the following:
|
||||||
|
|
||||||
|
* One request or bug report per issue, please. No bundling.
|
||||||
* If you are reporting a bug, please attach the latest application log file together with description of steps that lead to the issue. They can be found in the user directory under `.diylc/logs` directory. On Windows 7 and later, it's located in `c:/Users/<your username>/.diylc/logs`. On Linux and MacOS, it's typically in `/Users/<your username>/.diylc/logs`.
|
* If you are reporting a bug, please attach the latest application log file together with description of steps that lead to the issue. They can be found in the user directory under `.diylc/logs` directory. On Windows 7 and later, it's located in `c:/Users/<your username>/.diylc/logs`. On Linux and MacOS, it's typically in `/Users/<your username>/.diylc/logs`.
|
||||||
* If you are having issues starting the application under MacOS, make sure that 3rd party apps are allowed on your Mac. This document covers how to do it - https://support.apple.com/en-us/HT202491.
|
* If you are having issues starting the application under MacOS, make sure that 3rd party apps are allowed on your Mac. This document covers how to do it - https://support.apple.com/en-us/HT202491.
|
||||||
* Try to look for similar unresolved issues that are already reported to avoid duplicates.
|
* Try to look for similar unresolved issues that are already reported to avoid duplicates.
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,116 @@
|
|||||||
|
package org.diylc.common;
|
||||||
|
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.awt.geom.Point2D;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.diylc.core.Angle;
|
||||||
|
import org.diylc.core.IDIYComponent;
|
||||||
|
import org.diylc.presenter.ComponentProcessor;
|
||||||
|
|
||||||
|
public class DefaultComponentTransformer implements IComponentTransformer {
|
||||||
|
|
||||||
|
private static final Logger LOG = Logger.getLogger(DefaultComponentTransformer.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canRotate(IDIYComponent<?> component) {
|
||||||
|
List<PropertyWrapper> properties =
|
||||||
|
ComponentProcessor.getInstance().extractProperties(component.getClass());
|
||||||
|
|
||||||
|
for (PropertyWrapper property : properties) {
|
||||||
|
if (property.getType().isAssignableFrom(Orientation.class)
|
||||||
|
|| property.getType().isAssignableFrom(OrientationHV.class)
|
||||||
|
|| property.getType().isAssignableFrom(Angle.class))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canMirror(IDIYComponent<?> component) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mirroringChangesCircuit() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rotate(IDIYComponent<?> component, Point2D center, int direction) {
|
||||||
|
boolean canRotate = false;
|
||||||
|
List<PropertyWrapper> properties =
|
||||||
|
ComponentProcessor.getInstance().extractProperties(component.getClass());
|
||||||
|
|
||||||
|
for (PropertyWrapper property : properties) {
|
||||||
|
try {
|
||||||
|
property.readFrom(component);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException
|
||||||
|
| SecurityException | NoSuchMethodException e) {
|
||||||
|
LOG.warn("Error while rotating component " + component.getName(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (property.getType().isAssignableFrom(Orientation.class)) {
|
||||||
|
canRotate = true;
|
||||||
|
|
||||||
|
Orientation o = (Orientation) property.getValue();
|
||||||
|
int oValue = o.ordinal();
|
||||||
|
oValue += direction;
|
||||||
|
if (oValue < 0)
|
||||||
|
oValue = Orientation.values().length - 1;
|
||||||
|
if (oValue >= Orientation.values().length)
|
||||||
|
oValue = 0;
|
||||||
|
o = Orientation.values()[oValue];
|
||||||
|
property.setValue(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property.getType().isAssignableFrom(OrientationHV.class)) {
|
||||||
|
canRotate = true;
|
||||||
|
|
||||||
|
OrientationHV o = (OrientationHV) property.getValue();
|
||||||
|
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];
|
||||||
|
property.setValue(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property.getType().isAssignableFrom(Angle.class)) {
|
||||||
|
canRotate = true;
|
||||||
|
|
||||||
|
Angle angle = (Angle) property.getValue();
|
||||||
|
Angle newAngle = angle.rotate(direction);
|
||||||
|
property.setValue(newAngle);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.warn("Error while rotating component " + component.getName(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canRotate) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
property.writeTo(component);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException
|
||||||
|
| SecurityException | NoSuchMethodException e) {
|
||||||
|
LOG.warn("Error while rotating component " + component.getName(), e);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mirror(IDIYComponent<?> component, Point2D center, int direction) {}
|
||||||
|
}
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
*/
|
|
||||||
package org.diylc.common;
|
|
||||||
|
|
||||||
import java.awt.geom.Point2D;
|
|
||||||
import org.diylc.core.IDIYComponent;
|
|
||||||
|
|
||||||
public class DefaultTransformer implements IComponentTransformer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canRotate(IDIYComponent<?> component) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canMirror(IDIYComponent<?> component) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean mirroringChangesCircuit() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void rotate(IDIYComponent<?> component, Point2D center, int direction) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mirror(IDIYComponent<?> component, Point2D center, int direction) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -31,7 +31,7 @@ public abstract class AbstractAngledComponent<T> extends AbstractTransparentComp
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected transient Orientation orientation;
|
protected Orientation orientation;
|
||||||
protected int angle;
|
protected int angle;
|
||||||
|
|
||||||
transient protected Shape[] body;
|
transient protected Shape[] body;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ package org.diylc.core.annotations;
|
|||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import org.diylc.common.DefaultTransformer;
|
import org.diylc.common.DefaultComponentTransformer;
|
||||||
import org.diylc.common.IComponentTransformer;
|
import org.diylc.common.IComponentTransformer;
|
||||||
import org.diylc.core.CreationMethod;
|
import org.diylc.core.CreationMethod;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
@@ -94,7 +94,7 @@ public @interface ComponentDescriptor {
|
|||||||
/**
|
/**
|
||||||
* @return if the component can be rotated and/or mirrored, returns a class of the transformer that can do it
|
* @return if the component can be rotated and/or mirrored, returns a class of the transformer that can do it
|
||||||
*/
|
*/
|
||||||
Class<? extends IComponentTransformer> transformer() default DefaultTransformer.class;
|
Class<? extends IComponentTransformer> transformer() default DefaultComponentTransformer.class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines if and how a component should appear in auto-generated project keywords. See
|
* Defines if and how a component should appear in auto-generated project keywords. See
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ public abstract class NetlistAnalyzer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected String extractName(IDIYComponent<?> c) {
|
protected String extractName(IDIYComponent<?> c) {
|
||||||
return c.getName() + " " + c.getValueForDisplay();
|
return c.getName() + " " + (c.getValueForDisplay() == null ? "" : c.getValueForDisplay());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Set<IDIYComponent<?>>> extractComponentGroups(List<Netlist> netlists) {
|
public static List<Set<IDIYComponent<?>>> extractComponentGroups(List<Netlist> netlists) {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import org.diylc.common.ComponentType;
|
import org.diylc.common.ComponentType;
|
||||||
import org.diylc.core.ICommonNode;
|
import org.diylc.core.ICommonNode;
|
||||||
import org.diylc.core.IContinuity;
|
import org.diylc.core.IContinuity;
|
||||||
@@ -50,10 +51,12 @@ public class NetlistBuilder {
|
|||||||
|
|
||||||
public static final float eps = 4; // consider any nodes closer than this as connected
|
public static final float eps = 4; // consider any nodes closer than this as connected
|
||||||
|
|
||||||
private static final int MAX_SWITCH_COMBINATIONS = 64;
|
public static int MAX_SWITCH_COMBINATIONS = 64;
|
||||||
|
|
||||||
private static final String MAX_SWITCH_COMBINATIONS_ERROR = LangUtil
|
private static final String MAX_SWITCH_COMBINATIONS_ERROR = LangUtil
|
||||||
.translate("Maximum number of switching combinations exceeded. Allowed: %s, actual: %s");
|
.translate("Maximum number of switching combinations exceeded. Allowed: %s, actual: %s");
|
||||||
|
|
||||||
|
private static final Logger LOG = Logger.getLogger(NetlistBuilder.class);
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static List<Netlist> extractNetlists(boolean includeSwitches, Project project,
|
public static List<Netlist> extractNetlists(boolean includeSwitches, Project project,
|
||||||
@@ -130,8 +133,18 @@ public class NetlistBuilder {
|
|||||||
|
|
||||||
int totalSwitchCombinations =
|
int totalSwitchCombinations =
|
||||||
switches.stream().map(sw -> sw.getPositionCount()).reduce(1, (a, b) -> a * b);
|
switches.stream().map(sw -> sw.getPositionCount()).reduce(1, (a, b) -> a * b);
|
||||||
|
|
||||||
|
int maxSwitch = MAX_SWITCH_COMBINATIONS;
|
||||||
|
String maxSwitchStr = System.getProperty("org.diylc.maxSwitchCombinations");
|
||||||
|
if (maxSwitchStr != null) {
|
||||||
|
try {
|
||||||
|
maxSwitch = Integer.parseInt(maxSwitchStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Could not apply property org.diylc.maxSwitchCombinations", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (totalSwitchCombinations > MAX_SWITCH_COMBINATIONS) {
|
if (totalSwitchCombinations > maxSwitch) {
|
||||||
throw new NetlistException(String.format(MAX_SWITCH_COMBINATIONS_ERROR,
|
throw new NetlistException(String.format(MAX_SWITCH_COMBINATIONS_ERROR,
|
||||||
MAX_SWITCH_COMBINATIONS, totalSwitchCombinations));
|
MAX_SWITCH_COMBINATIONS, totalSwitchCombinations));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,4 +133,608 @@
|
|||||||
</diylc.semiconductors.TransistorTO92>
|
</diylc.semiconductors.TransistorTO92>
|
||||||
</list>
|
</list>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry>
|
||||||
|
<string>Title Block</string>
|
||||||
|
<list>
|
||||||
|
<org.diylc.components.shapes.Rectangle>
|
||||||
|
<name>RECT1</name>
|
||||||
|
<alpha>127</alpha>
|
||||||
|
<value></value>
|
||||||
|
<controlPoints>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>0.0</x>
|
||||||
|
<y>0.0</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>393.7007874015748</x>
|
||||||
|
<y>149.60629921259843</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
</controlPoints>
|
||||||
|
<firstPoint>
|
||||||
|
<x>0.0</x>
|
||||||
|
<y>0.0</y>
|
||||||
|
</firstPoint>
|
||||||
|
<secondPoint>
|
||||||
|
<x>393.7007874015748</x>
|
||||||
|
<y>149.60629921259843</y>
|
||||||
|
</secondPoint>
|
||||||
|
<color>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<borderColor>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</borderColor>
|
||||||
|
<borderThickness>
|
||||||
|
<value>0.5</value>
|
||||||
|
<unit class="org.diylc.core.measures.SizeUnit">mm</unit>
|
||||||
|
</borderThickness>
|
||||||
|
<edgeRadius>
|
||||||
|
<value>0.0</value>
|
||||||
|
<unit class="org.diylc.core.measures.SizeUnit">mm</unit>
|
||||||
|
</edgeRadius>
|
||||||
|
</org.diylc.components.shapes.Rectangle>
|
||||||
|
<org.diylc.components.connectivity.Line>
|
||||||
|
<name>LN1</name>
|
||||||
|
<alpha>127</alpha>
|
||||||
|
<points>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>188.9763779527559</x>
|
||||||
|
<y>149.60629921259843</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>188.9763779527559</x>
|
||||||
|
<y>118.11023622047246</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>0.0</x>
|
||||||
|
<y>0.0</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
</points>
|
||||||
|
<bodyColor>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</bodyColor>
|
||||||
|
<borderColor>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</borderColor>
|
||||||
|
<labelColor>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</labelColor>
|
||||||
|
<leadColor>
|
||||||
|
<red>204</red>
|
||||||
|
<green>204</green>
|
||||||
|
<blue>204</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</leadColor>
|
||||||
|
<display>NAME</display>
|
||||||
|
<flipStanding>false</flipStanding>
|
||||||
|
<labelOriantation>Directional</labelOriantation>
|
||||||
|
<moveLabel>false</moveLabel>
|
||||||
|
<hideShortLeads>false</hideShortLeads>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<style>SOLID</style>
|
||||||
|
<thickness>
|
||||||
|
<value>0.2</value>
|
||||||
|
<unit class="org.diylc.core.measures.SizeUnit">mm</unit>
|
||||||
|
</thickness>
|
||||||
|
<arrowSize>
|
||||||
|
<value>5.0</value>
|
||||||
|
<unit class="org.diylc.core.measures.SizeUnit">px</unit>
|
||||||
|
</arrowSize>
|
||||||
|
<arrowTx serialization="custom">
|
||||||
|
<java.awt.geom.AffineTransform>
|
||||||
|
<default>
|
||||||
|
<m00>1.0</m00>
|
||||||
|
<m01>0.0</m01>
|
||||||
|
<m02>0.0</m02>
|
||||||
|
<m10>0.0</m10>
|
||||||
|
<m11>1.0</m11>
|
||||||
|
<m12>0.0</m12>
|
||||||
|
</default>
|
||||||
|
</java.awt.geom.AffineTransform>
|
||||||
|
</arrowTx>
|
||||||
|
<arrowStart>false</arrowStart>
|
||||||
|
<arrowEnd>false</arrowEnd>
|
||||||
|
</org.diylc.components.connectivity.Line>
|
||||||
|
<org.diylc.components.connectivity.Line>
|
||||||
|
<name>LN2</name>
|
||||||
|
<alpha>127</alpha>
|
||||||
|
<points>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>0.0</x>
|
||||||
|
<y>118.11023622047246</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>393.70078740157487</x>
|
||||||
|
<y>118.11023622047246</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>0.0</x>
|
||||||
|
<y>0.0</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
</points>
|
||||||
|
<bodyColor>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</bodyColor>
|
||||||
|
<borderColor>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</borderColor>
|
||||||
|
<labelColor>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</labelColor>
|
||||||
|
<leadColor>
|
||||||
|
<red>204</red>
|
||||||
|
<green>204</green>
|
||||||
|
<blue>204</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</leadColor>
|
||||||
|
<display>NAME</display>
|
||||||
|
<flipStanding>false</flipStanding>
|
||||||
|
<labelOriantation>Directional</labelOriantation>
|
||||||
|
<moveLabel>false</moveLabel>
|
||||||
|
<hideShortLeads>false</hideShortLeads>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<style>SOLID</style>
|
||||||
|
<thickness>
|
||||||
|
<value>0.2</value>
|
||||||
|
<unit class="org.diylc.core.measures.SizeUnit">mm</unit>
|
||||||
|
</thickness>
|
||||||
|
<arrowSize>
|
||||||
|
<value>5.0</value>
|
||||||
|
<unit class="org.diylc.core.measures.SizeUnit">px</unit>
|
||||||
|
</arrowSize>
|
||||||
|
<arrowTx serialization="custom">
|
||||||
|
<java.awt.geom.AffineTransform>
|
||||||
|
<default>
|
||||||
|
<m00>1.0</m00>
|
||||||
|
<m01>0.0</m01>
|
||||||
|
<m02>0.0</m02>
|
||||||
|
<m10>0.0</m10>
|
||||||
|
<m11>1.0</m11>
|
||||||
|
<m12>0.0</m12>
|
||||||
|
</default>
|
||||||
|
</java.awt.geom.AffineTransform>
|
||||||
|
</arrowTx>
|
||||||
|
<arrowStart>false</arrowStart>
|
||||||
|
<arrowEnd>false</arrowEnd>
|
||||||
|
</org.diylc.components.connectivity.Line>
|
||||||
|
<org.diylc.components.connectivity.Line>
|
||||||
|
<name>LN3</name>
|
||||||
|
<alpha>127</alpha>
|
||||||
|
<points>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>0.0</x>
|
||||||
|
<y>55.118110236220474</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>393.7007874015748</x>
|
||||||
|
<y>55.118110236220474</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>0.0</x>
|
||||||
|
<y>0.0</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
</points>
|
||||||
|
<bodyColor>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</bodyColor>
|
||||||
|
<borderColor>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</borderColor>
|
||||||
|
<labelColor>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</labelColor>
|
||||||
|
<leadColor>
|
||||||
|
<red>204</red>
|
||||||
|
<green>204</green>
|
||||||
|
<blue>204</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</leadColor>
|
||||||
|
<display>NAME</display>
|
||||||
|
<flipStanding>false</flipStanding>
|
||||||
|
<labelOriantation>Directional</labelOriantation>
|
||||||
|
<moveLabel>false</moveLabel>
|
||||||
|
<hideShortLeads>false</hideShortLeads>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<style>SOLID</style>
|
||||||
|
<thickness>
|
||||||
|
<value>0.2</value>
|
||||||
|
<unit class="org.diylc.core.measures.SizeUnit">mm</unit>
|
||||||
|
</thickness>
|
||||||
|
<arrowSize>
|
||||||
|
<value>5.0</value>
|
||||||
|
<unit class="org.diylc.core.measures.SizeUnit">px</unit>
|
||||||
|
</arrowSize>
|
||||||
|
<arrowTx serialization="custom">
|
||||||
|
<java.awt.geom.AffineTransform>
|
||||||
|
<default>
|
||||||
|
<m00>1.0</m00>
|
||||||
|
<m01>0.0</m01>
|
||||||
|
<m02>0.0</m02>
|
||||||
|
<m10>0.0</m10>
|
||||||
|
<m11>1.0</m11>
|
||||||
|
<m12>0.0</m12>
|
||||||
|
</default>
|
||||||
|
</java.awt.geom.AffineTransform>
|
||||||
|
</arrowTx>
|
||||||
|
<arrowStart>false</arrowStart>
|
||||||
|
<arrowEnd>false</arrowEnd>
|
||||||
|
</org.diylc.components.connectivity.Line>
|
||||||
|
<org.diylc.components.connectivity.Line>
|
||||||
|
<name>LN4</name>
|
||||||
|
<alpha>127</alpha>
|
||||||
|
<points>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>0.0</x>
|
||||||
|
<y>86.61417322834646</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>393.70078740157476</x>
|
||||||
|
<y>86.61417322834646</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
<java.awt.geom.Point2D_-Double>
|
||||||
|
<x>0.0</x>
|
||||||
|
<y>0.0</y>
|
||||||
|
</java.awt.geom.Point2D_-Double>
|
||||||
|
</points>
|
||||||
|
<bodyColor>
|
||||||
|
<red>255</red>
|
||||||
|
<green>255</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</bodyColor>
|
||||||
|
<borderColor>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</borderColor>
|
||||||
|
<labelColor>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</labelColor>
|
||||||
|
<leadColor>
|
||||||
|
<red>204</red>
|
||||||
|
<green>204</green>
|
||||||
|
<blue>204</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</leadColor>
|
||||||
|
<display>NAME</display>
|
||||||
|
<flipStanding>false</flipStanding>
|
||||||
|
<labelOriantation>Directional</labelOriantation>
|
||||||
|
<moveLabel>false</moveLabel>
|
||||||
|
<hideShortLeads>false</hideShortLeads>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<style>SOLID</style>
|
||||||
|
<thickness>
|
||||||
|
<value>0.2</value>
|
||||||
|
<unit class="org.diylc.core.measures.SizeUnit">mm</unit>
|
||||||
|
</thickness>
|
||||||
|
<arrowSize>
|
||||||
|
<value>5.0</value>
|
||||||
|
<unit class="org.diylc.core.measures.SizeUnit">px</unit>
|
||||||
|
</arrowSize>
|
||||||
|
<arrowTx serialization="custom">
|
||||||
|
<java.awt.geom.AffineTransform>
|
||||||
|
<default>
|
||||||
|
<m00>1.0</m00>
|
||||||
|
<m01>0.0</m01>
|
||||||
|
<m02>0.0</m02>
|
||||||
|
<m10>0.0</m10>
|
||||||
|
<m11>1.0</m11>
|
||||||
|
<m12>0.0</m12>
|
||||||
|
</default>
|
||||||
|
</java.awt.geom.AffineTransform>
|
||||||
|
</arrowTx>
|
||||||
|
<arrowStart>false</arrowStart>
|
||||||
|
<arrowEnd>false</arrowEnd>
|
||||||
|
</org.diylc.components.connectivity.Line>
|
||||||
|
<org.diylc.components.misc.Label>
|
||||||
|
<name>LAB1</name>
|
||||||
|
<point>
|
||||||
|
<x>204.7244094488189</x>
|
||||||
|
<y>133.85826771653544</y>
|
||||||
|
</point>
|
||||||
|
<text>revision</text>
|
||||||
|
<font>
|
||||||
|
<size class="float">14.0</size>
|
||||||
|
<weight class="null"/>
|
||||||
|
<width class="null"/>
|
||||||
|
<superscript class="null"/>
|
||||||
|
<posture class="null"/>
|
||||||
|
<transform class="null"/>
|
||||||
|
<family class="string">Square721 BT Roman</family>
|
||||||
|
<tracking class="null"/>
|
||||||
|
</font>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<horizontalAlignment>LEFT</horizontalAlignment>
|
||||||
|
<verticalAlignment>CENTER</verticalAlignment>
|
||||||
|
<orientation>DEFAULT</orientation>
|
||||||
|
</org.diylc.components.misc.Label>
|
||||||
|
<org.diylc.components.misc.Label>
|
||||||
|
<name>LAB2</name>
|
||||||
|
<point>
|
||||||
|
<x>291.3385826771654</x>
|
||||||
|
<y>133.85826771653544</y>
|
||||||
|
</point>
|
||||||
|
<text>1.0.0</text>
|
||||||
|
<font>
|
||||||
|
<size class="float">14.0</size>
|
||||||
|
<weight class="float">2.0</weight>
|
||||||
|
<width class="null"/>
|
||||||
|
<superscript class="null"/>
|
||||||
|
<posture class="null"/>
|
||||||
|
<transform class="null"/>
|
||||||
|
<family class="string">Square721 BT Bold</family>
|
||||||
|
<tracking class="null"/>
|
||||||
|
</font>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<horizontalAlignment>LEFT</horizontalAlignment>
|
||||||
|
<verticalAlignment>CENTER</verticalAlignment>
|
||||||
|
<orientation>DEFAULT</orientation>
|
||||||
|
</org.diylc.components.misc.Label>
|
||||||
|
<org.diylc.components.misc.Label>
|
||||||
|
<name>LAB3</name>
|
||||||
|
<point>
|
||||||
|
<x>15.748031496062993</x>
|
||||||
|
<y>133.85826771653544</y>
|
||||||
|
</point>
|
||||||
|
<text>updated</text>
|
||||||
|
<font>
|
||||||
|
<size class="float">14.0</size>
|
||||||
|
<weight class="null"/>
|
||||||
|
<width class="null"/>
|
||||||
|
<superscript class="null"/>
|
||||||
|
<posture class="null"/>
|
||||||
|
<transform class="null"/>
|
||||||
|
<family class="string">Square721 BT Roman</family>
|
||||||
|
<tracking class="null"/>
|
||||||
|
</font>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<horizontalAlignment>LEFT</horizontalAlignment>
|
||||||
|
<verticalAlignment>CENTER</verticalAlignment>
|
||||||
|
<orientation>DEFAULT</orientation>
|
||||||
|
</org.diylc.components.misc.Label>
|
||||||
|
<org.diylc.components.misc.Label>
|
||||||
|
<name>LAB4</name>
|
||||||
|
<point>
|
||||||
|
<x>86.61417322834646</x>
|
||||||
|
<y>133.85826771653544</y>
|
||||||
|
</point>
|
||||||
|
<text>1/1/2020</text>
|
||||||
|
<font>
|
||||||
|
<size class="float">14.0</size>
|
||||||
|
<weight class="float">2.0</weight>
|
||||||
|
<width class="null"/>
|
||||||
|
<superscript class="null"/>
|
||||||
|
<posture class="null"/>
|
||||||
|
<transform class="null"/>
|
||||||
|
<family class="string">Square721 BT Bold</family>
|
||||||
|
<tracking class="null"/>
|
||||||
|
</font>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<horizontalAlignment>LEFT</horizontalAlignment>
|
||||||
|
<verticalAlignment>CENTER</verticalAlignment>
|
||||||
|
<orientation>DEFAULT</orientation>
|
||||||
|
</org.diylc.components.misc.Label>
|
||||||
|
<org.diylc.components.misc.Label>
|
||||||
|
<name>LAB5</name>
|
||||||
|
<point>
|
||||||
|
<x>47.24409448818898</x>
|
||||||
|
<y>70.86614173228347</y>
|
||||||
|
</point>
|
||||||
|
<text>drawn by</text>
|
||||||
|
<font reference="../../org.diylc.components.misc.Label/font"/>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<horizontalAlignment>CENTER</horizontalAlignment>
|
||||||
|
<verticalAlignment>CENTER</verticalAlignment>
|
||||||
|
<orientation>DEFAULT</orientation>
|
||||||
|
</org.diylc.components.misc.Label>
|
||||||
|
<org.diylc.components.misc.Label>
|
||||||
|
<name>LAB6</name>
|
||||||
|
<point>
|
||||||
|
<x>31.496062992125985</x>
|
||||||
|
<y>15.748031496062993</y>
|
||||||
|
</point>
|
||||||
|
<text>title</text>
|
||||||
|
<font reference="../../org.diylc.components.misc.Label/font"/>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<horizontalAlignment>CENTER</horizontalAlignment>
|
||||||
|
<verticalAlignment>CENTER</verticalAlignment>
|
||||||
|
<orientation>DEFAULT</orientation>
|
||||||
|
</org.diylc.components.misc.Label>
|
||||||
|
<org.diylc.components.misc.Label>
|
||||||
|
<name>LAB7</name>
|
||||||
|
<point>
|
||||||
|
<x>188.9763779527559</x>
|
||||||
|
<y>70.86614173228347</y>
|
||||||
|
</point>
|
||||||
|
<text>Author Name</text>
|
||||||
|
<font>
|
||||||
|
<size class="float">14.0</size>
|
||||||
|
<weight class="float">2.0</weight>
|
||||||
|
<width class="null"/>
|
||||||
|
<superscript class="null"/>
|
||||||
|
<posture class="null"/>
|
||||||
|
<transform class="null"/>
|
||||||
|
<family class="string">Square721 BT Bold</family>
|
||||||
|
<tracking class="null"/>
|
||||||
|
</font>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<horizontalAlignment>CENTER</horizontalAlignment>
|
||||||
|
<verticalAlignment>CENTER</verticalAlignment>
|
||||||
|
<orientation>DEFAULT</orientation>
|
||||||
|
</org.diylc.components.misc.Label>
|
||||||
|
<org.diylc.components.misc.Label>
|
||||||
|
<name>LAB8</name>
|
||||||
|
<point>
|
||||||
|
<x>188.9763779527559</x>
|
||||||
|
<y>31.496062992125985</y>
|
||||||
|
</point>
|
||||||
|
<text>My Cool Project</text>
|
||||||
|
<font>
|
||||||
|
<size class="float">20.0</size>
|
||||||
|
<weight class="float">2.0</weight>
|
||||||
|
<width class="null"/>
|
||||||
|
<superscript class="null"/>
|
||||||
|
<posture class="null"/>
|
||||||
|
<transform class="null"/>
|
||||||
|
<family class="string">Square721 BT Bold</family>
|
||||||
|
<tracking class="null"/>
|
||||||
|
</font>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>255</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<horizontalAlignment>CENTER</horizontalAlignment>
|
||||||
|
<verticalAlignment>CENTER</verticalAlignment>
|
||||||
|
<orientation>DEFAULT</orientation>
|
||||||
|
</org.diylc.components.misc.Label>
|
||||||
|
<org.diylc.components.misc.Label>
|
||||||
|
<name>LAB9</name>
|
||||||
|
<point>
|
||||||
|
<x>15.748031496062993</x>
|
||||||
|
<y>102.36220472440945</y>
|
||||||
|
</point>
|
||||||
|
<text>website</text>
|
||||||
|
<font>
|
||||||
|
<size class="float">14.0</size>
|
||||||
|
<weight class="null"/>
|
||||||
|
<width class="null"/>
|
||||||
|
<superscript class="null"/>
|
||||||
|
<posture class="null"/>
|
||||||
|
<transform class="null"/>
|
||||||
|
<family class="string">Square721 BT Roman</family>
|
||||||
|
<tracking class="null"/>
|
||||||
|
</font>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<horizontalAlignment>LEFT</horizontalAlignment>
|
||||||
|
<verticalAlignment>CENTER</verticalAlignment>
|
||||||
|
<orientation>DEFAULT</orientation>
|
||||||
|
</org.diylc.components.misc.Label>
|
||||||
|
<org.diylc.components.misc.Label>
|
||||||
|
<name>LAB10</name>
|
||||||
|
<point>
|
||||||
|
<x>188.9763779527559</x>
|
||||||
|
<y>102.36220472440945</y>
|
||||||
|
</point>
|
||||||
|
<text>www.mysite.com/myproject</text>
|
||||||
|
<font>
|
||||||
|
<size class="float">14.0</size>
|
||||||
|
<weight class="float">2.0</weight>
|
||||||
|
<width class="null"/>
|
||||||
|
<superscript class="null"/>
|
||||||
|
<posture class="null"/>
|
||||||
|
<transform class="null"/>
|
||||||
|
<family class="string">Square721 BT Bold</family>
|
||||||
|
<tracking class="null"/>
|
||||||
|
</font>
|
||||||
|
<color>
|
||||||
|
<red>0</red>
|
||||||
|
<green>0</green>
|
||||||
|
<blue>0</blue>
|
||||||
|
<alpha>255</alpha>
|
||||||
|
</color>
|
||||||
|
<horizontalAlignment>CENTER</horizontalAlignment>
|
||||||
|
<verticalAlignment>CENTER</verticalAlignment>
|
||||||
|
<orientation>DEFAULT</orientation>
|
||||||
|
</org.diylc.components.misc.Label>
|
||||||
|
</list>
|
||||||
|
</entry>
|
||||||
</map>
|
</map>
|
||||||
@@ -4309,5 +4309,65 @@
|
|||||||
</changes>
|
</changes>
|
||||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
</org.diylc.appframework.update.Version>
|
</org.diylc.appframework.update.Version>
|
||||||
|
<org.diylc.appframework.update.Version>
|
||||||
|
<versionNumber>
|
||||||
|
<major>4</major>
|
||||||
|
<minor>36</minor>
|
||||||
|
<build>0</build>
|
||||||
|
</versionNumber>
|
||||||
|
<releaseDate>2023-03-30 00:00:00.000 CET</releaseDate>
|
||||||
|
<name></name>
|
||||||
|
<changes>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Title Block added as one of factory building blocks (was missing in 4.35 by mistake)</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Configurable max switch combination count for circuit analysis (using org.diylc.maxSwitchCombinations argument)</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Added resilience to the code that saves the configuration file to avoid it getting corrupted</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>When backing up the configuration file, append the current timestamp at the end instead of a '~'</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Improve the format of timestamp in file backups</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>General application slowness when Inductor or Fuse Symbol components are added to the drawing</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Lever switch orientation not loaded correctly from files created prior to version 4.35</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
</changes>
|
||||||
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
|
</org.diylc.appframework.update.Version>
|
||||||
|
<org.diylc.appframework.update.Version>
|
||||||
|
<versionNumber>
|
||||||
|
<major>4</major>
|
||||||
|
<minor>37</minor>
|
||||||
|
<build>0</build>
|
||||||
|
</versionNumber>
|
||||||
|
<releaseDate>2023-04-27 00:00:00.000 CET</releaseDate>
|
||||||
|
<name></name>
|
||||||
|
<changes>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>'Proto Board 780 Holes' added with two variations (sponsored by Pete Olivier)</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Ability to rotate (almost) all components using keyboard shortcuts and 'Transform Selection' menu</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
|
</changes>
|
||||||
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
|
</org.diylc.appframework.update.Version>
|
||||||
</a>
|
</a>
|
||||||
</java.util.Arrays_-ArrayList>
|
</java.util.Arrays_-ArrayList>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import com.thoughtworks.xstream.converters.MarshallingContext;
|
|||||||
import com.thoughtworks.xstream.converters.UnmarshallingContext;
|
import com.thoughtworks.xstream.converters.UnmarshallingContext;
|
||||||
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
|
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
|
||||||
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
|
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
|
||||||
|
import com.thoughtworks.xstream.mapper.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializes {@link Font} objects in a more compact fashion. Backwards compatible when unmarshalling.
|
* Serializes {@link Font} objects in a more compact fashion. Backwards compatible when unmarshalling.
|
||||||
@@ -34,8 +35,8 @@ import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
|
|||||||
*/
|
*/
|
||||||
public class FontConverter extends com.thoughtworks.xstream.converters.extended.FontConverter {
|
public class FontConverter extends com.thoughtworks.xstream.converters.extended.FontConverter {
|
||||||
|
|
||||||
public FontConverter() {
|
public FontConverter(Mapper mapper) {
|
||||||
super(null);
|
super(mapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -50,7 +51,7 @@ public class FontConverter extends com.thoughtworks.xstream.converters.extended.
|
|||||||
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
|
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
|
||||||
if (reader.getAttribute("name") != null) {
|
if (reader.getAttribute("name") != null) {
|
||||||
return new Font(reader.getAttribute("name"), Integer.parseInt(reader.getAttribute("style")), Integer.parseInt(reader.getAttribute("size")));
|
return new Font(reader.getAttribute("name"), Integer.parseInt(reader.getAttribute("style")), Integer.parseInt(reader.getAttribute("size")));
|
||||||
}
|
}
|
||||||
return super.unmarshal(reader, context);
|
return super.unmarshal(reader, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,9 +116,9 @@ public class ProjectFileManager {
|
|||||||
xStream.aliasPackage("diylc", "org.diylc.components");
|
xStream.aliasPackage("diylc", "org.diylc.components");
|
||||||
xStream.registerConverter(new PointConverter());
|
xStream.registerConverter(new PointConverter());
|
||||||
xStream.registerConverter(new ColorConverter());
|
xStream.registerConverter(new ColorConverter());
|
||||||
xStream.registerConverter(new FontConverter());
|
xStream.registerConverter(new FontConverter(xStream.getMapper()));
|
||||||
xStream.registerConverter(new MeasureConverter());
|
xStream.registerConverter(new MeasureConverter());
|
||||||
xStream.registerConverter(new AreaConverter());
|
xStream.registerConverter(new AreaConverter());
|
||||||
xStream.addImmutableType(Color.class, true);
|
xStream.addImmutableType(Color.class, true);
|
||||||
xStream.addImmutableType(java.awt.geom.Point2D.class, true);
|
xStream.addImmutableType(java.awt.geom.Point2D.class, true);
|
||||||
xStream.addImmutableType(java.awt.geom.Point2D.Double.class, true);
|
xStream.addImmutableType(java.awt.geom.Point2D.Double.class, true);
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,515 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.diylc.components.boards;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Shape;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.awt.geom.Point2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import org.diylc.awt.StringUtils;
|
||||||
|
import org.diylc.common.HorizontalAlignment;
|
||||||
|
import org.diylc.common.ObjectCache;
|
||||||
|
import org.diylc.common.VerticalAlignment;
|
||||||
|
import org.diylc.components.transform.ProtoBoardTransformer;
|
||||||
|
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.BomPolicy;
|
||||||
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
import org.diylc.core.annotations.KeywordPolicy;
|
||||||
|
import org.diylc.core.measures.Size;
|
||||||
|
import org.diylc.core.measures.SizeUnit;
|
||||||
|
|
||||||
|
@ComponentDescriptor(name = "Proto Board 780 Holes", category = "Boards",
|
||||||
|
author = "Branislav Stojkovic",
|
||||||
|
description = "Prototyping board similar to Radio Shack 276-168B or MPJA 33304",
|
||||||
|
instanceNamePrefix = "BB", zOrder = IDIYComponent.BOARD,
|
||||||
|
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false,
|
||||||
|
keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME, enableCache = true,
|
||||||
|
transformer = ProtoBoardTransformer.class)
|
||||||
|
public class ProtoBoard780 extends AbstractProtoBoard {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public static Color FILL_COLOR = Color.decode("#6B9B6B");
|
||||||
|
public static Size SPACING = new Size(0.1d, SizeUnit.in);
|
||||||
|
public static Color SELECTION_COLOR = Color.red;
|
||||||
|
public static Color PAD_COLOR = COPPER_COLOR;
|
||||||
|
public static Color TRACE_COLOR = PAD_COLOR.brighter();
|
||||||
|
|
||||||
|
public static Color HOLE_COLOR = Color.white;
|
||||||
|
|
||||||
|
public static float COORDINATE_FONT_SIZE = 9f;
|
||||||
|
public static Color COORDINATE_COLOR = Color.decode("#DDDDDD");
|
||||||
|
|
||||||
|
public static Size PAD_SIZE = new Size(2d, SizeUnit.mm);
|
||||||
|
|
||||||
|
public static Size WIDTH_SIZE = new Size(72d, SizeUnit.mm);
|
||||||
|
public static Size LENGTH_SIZE = new Size(95d, SizeUnit.mm);
|
||||||
|
|
||||||
|
protected Point2D point = new Point2D.Double(0, 0);
|
||||||
|
|
||||||
|
protected Color boardColor = FILL_COLOR;
|
||||||
|
protected Color padColor = PAD_COLOR;
|
||||||
|
protected Color traceColor = TRACE_COLOR;
|
||||||
|
protected Color textColor = COORDINATE_COLOR;
|
||||||
|
|
||||||
|
public static Size MOUNTING_HORIZONTAL_SPACING_MPJA = new Size(60d, SizeUnit.mm);
|
||||||
|
public static Size MOUNTING_HORIZONTAL_SPACING_RS = new Size(56d, SizeUnit.mm);
|
||||||
|
public static Size MOUNTING_HOLE_SIZE = new Size(3d, SizeUnit.mm);
|
||||||
|
|
||||||
|
protected ProtoBoard780Type type = ProtoBoard780Type.MPJA;
|
||||||
|
|
||||||
|
@SuppressWarnings("incomplete-switch")
|
||||||
|
@Override
|
||||||
|
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
|
||||||
|
Project project, IDrawingObserver drawingObserver) {
|
||||||
|
if (checkPointsClipped(g2d.getClip())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// adjust the angle
|
||||||
|
double theta = 0;
|
||||||
|
switch (getOrientation()) {
|
||||||
|
case _90:
|
||||||
|
theta = Math.PI / 2;
|
||||||
|
break;
|
||||||
|
case _180:
|
||||||
|
theta = Math.PI;
|
||||||
|
break;
|
||||||
|
case _270:
|
||||||
|
theta = Math.PI * 3 / 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (theta != 0) {
|
||||||
|
g2d.rotate(theta, point.getX(), point.getY());
|
||||||
|
}
|
||||||
|
|
||||||
|
double spacing = SPACING.convertToPixels();
|
||||||
|
|
||||||
|
// draw body
|
||||||
|
g2d.setColor(boardColor);
|
||||||
|
int width = (int) WIDTH_SIZE.convertToPixels();
|
||||||
|
int length = (int) LENGTH_SIZE.convertToPixels();
|
||||||
|
|
||||||
|
int mountingHoleSize = (int) MOUNTING_HOLE_SIZE.convertToPixels();
|
||||||
|
|
||||||
|
Shape rect = new Rectangle2D.Double(point.getX(), point.getY(), width, length);
|
||||||
|
g2d.fill(rect);
|
||||||
|
Color finalBorderColor =
|
||||||
|
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||||
|
? SELECTION_COLOR
|
||||||
|
: boardColor.darker();
|
||||||
|
g2d.setColor(finalBorderColor);
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
|
|
||||||
|
drawingObserver.stopTracking();
|
||||||
|
|
||||||
|
g2d.draw(rect);
|
||||||
|
|
||||||
|
int padSize = getClosestOdd(PAD_SIZE.convertToPixels());
|
||||||
|
int holeSize = getClosestOdd(padSize / 3);
|
||||||
|
|
||||||
|
g2d.setFont(LABEL_FONT.deriveFont(COORDINATE_FONT_SIZE));
|
||||||
|
|
||||||
|
double offsetY = spacing * 0.5;
|
||||||
|
|
||||||
|
// top section
|
||||||
|
for (int i = 0; i < 15; i++) {
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize - 2f));
|
||||||
|
|
||||||
|
g2d.setColor(traceColor);
|
||||||
|
int padX = (int) (point.getX() + width / 2 - 7 * spacing + i * spacing);
|
||||||
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
|
g2d.drawLine(padX, (int) (point.getY() + offsetY), padX,
|
||||||
|
(int) (point.getY() + spacing + offsetY));
|
||||||
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
|
|
||||||
|
for (int j = 0; j < 2; j++) {
|
||||||
|
int padY = (int) (point.getY() + spacing * j + offsetY);
|
||||||
|
|
||||||
|
g2d.setColor(padColor);
|
||||||
|
|
||||||
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
|
|
||||||
|
g2d.fillOval(padX - padSize / 2, padY - padSize / 2, padSize, padSize);
|
||||||
|
|
||||||
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
|
|
||||||
|
g2d.setColor(padColor.darker());
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
|
||||||
|
|
||||||
|
g2d.drawOval(padX - padSize / 2, padY - padSize / 2, padSize, padSize);
|
||||||
|
|
||||||
|
g2d.setColor(HOLE_COLOR);
|
||||||
|
g2d.fillOval(padX - holeSize / 2, padY - holeSize / 2, holeSize, holeSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// top section labels
|
||||||
|
g2d.setColor(textColor);
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
int x = i == 0 ? 1 : i * 5;
|
||||||
|
int padX = (int) (point.getX() + width / 2 - 8 * spacing + x * spacing);
|
||||||
|
int padY = (int) (point.getY() + spacing * 2);
|
||||||
|
|
||||||
|
// // flip the coordinates for MPJA
|
||||||
|
// if (type == ProtoBoard780Type.MPJA) {
|
||||||
|
// x = i == 3 ? 1 : (3 - i) * 5;
|
||||||
|
// }
|
||||||
|
|
||||||
|
StringUtils.drawCenteredText(g2d, Integer.toString(x), padX, padY, HorizontalAlignment.CENTER,
|
||||||
|
VerticalAlignment.BOTTOM);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
offsetY = spacing * 5.5;
|
||||||
|
|
||||||
|
// draw 3-pad traces and vertical traces
|
||||||
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
|
g2d.setColor(traceColor);
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize - 2f));
|
||||||
|
|
||||||
|
// the outer bus
|
||||||
|
g2d.drawLine((int) (point.getX() + width / 2 - 13 * spacing),
|
||||||
|
(int) (point.getY() - 2 * spacing + offsetY),
|
||||||
|
(int) (point.getX() + width / 2 + 13 * spacing),
|
||||||
|
(int) (point.getY() - 2 * spacing + offsetY));
|
||||||
|
g2d.drawLine((int) (point.getX() + width / 2 - 13 * spacing),
|
||||||
|
(int) (point.getY() - 2 * spacing + offsetY),
|
||||||
|
(int) (point.getX() + width / 2 - 13 * spacing),
|
||||||
|
(int) (point.getY() + (29 + (type == ProtoBoard780Type.RS ? 2 : 0)) * spacing + offsetY));
|
||||||
|
g2d.drawLine((int) (point.getX() + width / 2 + 13 * spacing),
|
||||||
|
(int) (point.getY() - 2 * spacing + offsetY),
|
||||||
|
(int) (point.getX() + width / 2 + 13 * spacing),
|
||||||
|
(int) (point.getY() + (29 + (type == ProtoBoard780Type.RS ? 2 : 0)) * spacing + offsetY));
|
||||||
|
|
||||||
|
// horizontal long traces
|
||||||
|
g2d.drawLine((int) (point.getX() + width / 2 - 12 * spacing), (int) (point.getY() + offsetY),
|
||||||
|
(int) (point.getX() + width / 2 + 12 * spacing), (int) (point.getY() + offsetY));
|
||||||
|
g2d.drawLine((int) (point.getX() + width / 2 - 12 * spacing),
|
||||||
|
(int) (point.getY() + spacing * 29 + offsetY),
|
||||||
|
(int) (point.getX() + width / 2 + 12 * spacing),
|
||||||
|
(int) (point.getY() + spacing * 29 + offsetY));
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
int padX = (int) (point.getX() + width / 2 - 12 * spacing + (i * 5 + 1) * spacing);
|
||||||
|
|
||||||
|
// vertical traces
|
||||||
|
g2d.drawLine((int) (padX - spacing), (int) (point.getY() + offsetY), (int) (padX - spacing),
|
||||||
|
(int) (point.getY() + spacing * 28 + offsetY));
|
||||||
|
g2d.drawLine((int) (padX + 3 * spacing), (int) (point.getY() + spacing + offsetY),
|
||||||
|
(int) (padX + 3 * spacing), (int) (point.getY() + spacing * 29 + offsetY));
|
||||||
|
|
||||||
|
for (int j = 1; j < 29; j++) {
|
||||||
|
int padY = (int) (point.getY() + spacing * j + offsetY);
|
||||||
|
|
||||||
|
// 3-pad traces
|
||||||
|
g2d.drawLine(padX, padY, (int) (padX + 2 * spacing), padY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
|
|
||||||
|
// draw main pads
|
||||||
|
for (int i = 0; i < 25; i++) {
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(padSize - 2f));
|
||||||
|
|
||||||
|
g2d.setColor(padColor);
|
||||||
|
int padX = (int) (point.getX() + width / 2 - 12 * spacing + i * spacing);
|
||||||
|
// drawingObserver.startTrackingContinuityArea(true);
|
||||||
|
// g2d.drawLine(padX, (int)(point.getY() + offsetY), padX, (int)(point.getY() + spacing +
|
||||||
|
// offsetY));
|
||||||
|
// drawingObserver.stopTrackingContinuityArea();
|
||||||
|
|
||||||
|
for (int j = 0; j < 30; j++) {
|
||||||
|
int padY = (int) (point.getY() + spacing * j + offsetY);
|
||||||
|
|
||||||
|
g2d.setColor(padColor);
|
||||||
|
|
||||||
|
drawingObserver.startTrackingContinuityArea(true);
|
||||||
|
|
||||||
|
g2d.fillOval(padX - padSize / 2, padY - padSize / 2, padSize, padSize);
|
||||||
|
|
||||||
|
drawingObserver.stopTrackingContinuityArea();
|
||||||
|
|
||||||
|
g2d.setColor(padColor.darker());
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
|
||||||
|
|
||||||
|
g2d.drawOval(padX - padSize / 2, padY - padSize / 2, padSize, padSize);
|
||||||
|
|
||||||
|
g2d.setColor(HOLE_COLOR);
|
||||||
|
g2d.fillOval(padX - holeSize / 2, padY - holeSize / 2, holeSize, holeSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g2d.setColor(textColor);
|
||||||
|
|
||||||
|
// horizontal coordinates
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
int x = i == 0 ? 1 : i * 5;
|
||||||
|
int padX = (int) (point.getX() + width / 2 - 13 * spacing + x * spacing);
|
||||||
|
int padY = (int) (point.getY() - spacing + offsetY);
|
||||||
|
|
||||||
|
String label = String.valueOf((char) ('A' + i));
|
||||||
|
|
||||||
|
StringUtils.drawCenteredText(g2d, label, padX, padY, HorizontalAlignment.CENTER,
|
||||||
|
VerticalAlignment.BOTTOM);
|
||||||
|
// StringUtils.drawCenteredText(g2d, label, padX, padY + spacing * 31,
|
||||||
|
// HorizontalAlignment.CENTER,
|
||||||
|
// VerticalAlignment.TOP);
|
||||||
|
}
|
||||||
|
|
||||||
|
// vertical coordinates
|
||||||
|
for (int i = 0; i < 7; i++) {
|
||||||
|
int y = i == 0 ? 1 : i * 5;
|
||||||
|
|
||||||
|
int padX = (int) (point.getX() + width / 2 - 14 * spacing);
|
||||||
|
int padY = (int) (point.getY() + spacing * (y - 1) + offsetY);
|
||||||
|
|
||||||
|
StringUtils.drawCenteredText(g2d, Integer.toString(y), padX, padY, HorizontalAlignment.LEFT,
|
||||||
|
VerticalAlignment.BOTTOM);
|
||||||
|
}
|
||||||
|
|
||||||
|
// model name
|
||||||
|
g2d.setFont(LABEL_FONT.deriveFont(COORDINATE_FONT_SIZE * 1.8f));
|
||||||
|
int x = (int) (point.getX() + width / 2);
|
||||||
|
int y = (int) (point.getY() + length - spacing * 1.5);
|
||||||
|
StringUtils.drawCenteredText(g2d,
|
||||||
|
type == ProtoBoard780Type.RS ? "Radio Shack 276-168B" : "MPJA.COM 33304 PB", x, y,
|
||||||
|
HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||||
|
|
||||||
|
// mounting holes
|
||||||
|
int dx = (int) (type == ProtoBoard780Type.RS ? 11 * spacing : 12 * spacing);
|
||||||
|
int holeY = (int) (point.getY() + spacing * (type == ProtoBoard780Type.RS ? 1 : 1.5));
|
||||||
|
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
|
g2d.setColor(HOLE_COLOR);
|
||||||
|
|
||||||
|
g2d.fillOval((int) (point.getX() + width / 2) - dx - mountingHoleSize / 2,
|
||||||
|
holeY - mountingHoleSize / 2, mountingHoleSize, mountingHoleSize);
|
||||||
|
g2d.fillOval((int) (point.getX() + width / 2) + dx - mountingHoleSize / 2,
|
||||||
|
holeY - mountingHoleSize / 2, mountingHoleSize, mountingHoleSize);
|
||||||
|
|
||||||
|
g2d.setColor(finalBorderColor);
|
||||||
|
|
||||||
|
g2d.drawOval((int) (point.getX() + width / 2) - dx - mountingHoleSize / 2,
|
||||||
|
holeY - mountingHoleSize / 2, mountingHoleSize, mountingHoleSize);
|
||||||
|
g2d.drawOval((int) (point.getX() + width / 2) + dx - mountingHoleSize / 2,
|
||||||
|
holeY - mountingHoleSize / 2, mountingHoleSize, mountingHoleSize);
|
||||||
|
|
||||||
|
holeY = (int) (point.getY() + length - spacing);
|
||||||
|
|
||||||
|
g2d.setColor(HOLE_COLOR);
|
||||||
|
|
||||||
|
g2d.fillOval((int) (point.getX() + width / 2) - dx - mountingHoleSize / 2,
|
||||||
|
holeY - mountingHoleSize / 2, mountingHoleSize, mountingHoleSize);
|
||||||
|
g2d.fillOval((int) (point.getX() + width / 2) + dx - mountingHoleSize / 2,
|
||||||
|
holeY - mountingHoleSize / 2, mountingHoleSize, mountingHoleSize);
|
||||||
|
|
||||||
|
g2d.setColor(finalBorderColor);
|
||||||
|
|
||||||
|
g2d.drawOval((int) (point.getX() + width / 2) - dx - mountingHoleSize / 2,
|
||||||
|
holeY - mountingHoleSize / 2, mountingHoleSize, mountingHoleSize);
|
||||||
|
g2d.drawOval((int) (point.getX() + width / 2) + dx - mountingHoleSize / 2,
|
||||||
|
holeY - mountingHoleSize / 2, mountingHoleSize, mountingHoleSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
|
int factor = 32 / width;
|
||||||
|
g2d.setColor(FILL_COLOR);
|
||||||
|
g2d.fillRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
||||||
|
g2d.setColor(FILL_COLOR.darker());
|
||||||
|
g2d.drawRect(2 / factor, 2 / factor, width - 4 / factor, height - 4 / factor);
|
||||||
|
|
||||||
|
g2d.setColor(PAD_COLOR.brighter());
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2 / factor));
|
||||||
|
|
||||||
|
int size = (int) (8.0 / factor);
|
||||||
|
|
||||||
|
g2d.drawLine(width / 3 - 2 / factor + size / 2, 6 / factor + size / 2, width,
|
||||||
|
6 / factor + size / 2);
|
||||||
|
g2d.drawLine(width / 3 - 2 / factor + size / 2, 2 * width / 3 - 2 / factor + size / 2, width,
|
||||||
|
2 * width / 3 - 2 / factor + size / 2);
|
||||||
|
|
||||||
|
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
|
|
||||||
|
g2d.setColor(PAD_COLOR);
|
||||||
|
g2d.fillRect(width / 3 - 2 / factor, 6 / factor, size, size);
|
||||||
|
g2d.setColor(PAD_COLOR.darker());
|
||||||
|
g2d.drawRect(width / 3 - 2 / factor, 6 / factor, size, size);
|
||||||
|
|
||||||
|
g2d.setColor(PAD_COLOR);
|
||||||
|
g2d.fillOval(2 * width / 3 - 2 / factor, 6 / factor, size, size);
|
||||||
|
g2d.setColor(PAD_COLOR.darker());
|
||||||
|
g2d.drawOval(2 * width / 3 - 2 / factor, 6 / factor, size, size);
|
||||||
|
|
||||||
|
g2d.setColor(PAD_COLOR);
|
||||||
|
g2d.fillRect(width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, size, size);
|
||||||
|
g2d.setColor(PAD_COLOR.darker());
|
||||||
|
g2d.drawRect(width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, size, size);
|
||||||
|
|
||||||
|
g2d.setColor(PAD_COLOR);
|
||||||
|
g2d.fillOval(2 * width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, size, size);
|
||||||
|
g2d.setColor(PAD_COLOR.darker());
|
||||||
|
g2d.drawOval(2 * width / 3 - 2 / factor, 2 * width / 3 - 2 / factor, size, size);
|
||||||
|
|
||||||
|
g2d.setColor(HOLE_COLOR);
|
||||||
|
g2d.fillOval(width / 3 - 2 / factor + size / 2 - 1, 6 / factor + size / 2 - 1, 3, 3);
|
||||||
|
g2d.fillOval(width / 3 - 2 / factor + size / 2 - 1, 2 * width / 3 - 2 / factor + size / 2 - 1,
|
||||||
|
3, 3);
|
||||||
|
g2d.fillOval(2 * width / 3 - 2 / factor + size / 2 - 1, 6 / factor + size / 2 - 1, 3, 3);
|
||||||
|
g2d.fillOval(2 * width / 3 - 2 / factor + size / 2 - 1,
|
||||||
|
2 * width / 3 - 2 / factor + size / 2 - 1, 3, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Board Color")
|
||||||
|
public Color getBoardColor() {
|
||||||
|
return boardColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBoardColor(Color boardColor) {
|
||||||
|
this.boardColor = boardColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Pad Color")
|
||||||
|
public Color getPadColor() {
|
||||||
|
return padColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPadColor(Color padColor) {
|
||||||
|
this.padColor = padColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Trace Color")
|
||||||
|
public Color getTraceColor() {
|
||||||
|
return traceColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTraceColor(Color traceColor) {
|
||||||
|
this.traceColor = traceColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Text Color")
|
||||||
|
public Color getTextColor() {
|
||||||
|
return textColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextColor(Color textColor) {
|
||||||
|
this.textColor = textColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public ProtoBoard780Type getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(ProtoBoard780Type type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getControlPointCount() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("incomplete-switch")
|
||||||
|
@Override
|
||||||
|
public Point2D getControlPoint(int index) {
|
||||||
|
if (index == 0)
|
||||||
|
return point;
|
||||||
|
|
||||||
|
// create a synthetic second control point for clipping check and to make sure that we cannot
|
||||||
|
// drag the right side of the board off the screen
|
||||||
|
|
||||||
|
// adjust the angle
|
||||||
|
double theta = 0;
|
||||||
|
switch (getOrientation()) {
|
||||||
|
case _90:
|
||||||
|
theta = Math.PI / 2;
|
||||||
|
break;
|
||||||
|
case _180:
|
||||||
|
theta = Math.PI;
|
||||||
|
break;
|
||||||
|
case _270:
|
||||||
|
theta = Math.PI * 3 / 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int width = (int) WIDTH_SIZE.convertToPixels();
|
||||||
|
int length = (int) LENGTH_SIZE.convertToPixels();
|
||||||
|
Point2D secondPoint = new Point2D.Double(point.getX() + width, point.getY() + length);
|
||||||
|
if (theta != 0) {
|
||||||
|
AffineTransform tx = AffineTransform.getRotateInstance(theta, point.getX(), point.getY());
|
||||||
|
tx.transform(secondPoint, secondPoint);
|
||||||
|
}
|
||||||
|
return secondPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isControlPointSticky(int index) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||||
|
return VisibilityPolicy.NEVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setControlPoint(Point2D point, int index) {
|
||||||
|
if (index == 0)
|
||||||
|
this.point.setLocation(point);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Void getValue() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValue(Void value) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getControlPointNodeName(int index) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle2D getCachingBounds() {
|
||||||
|
Point2D finalSecondPoint = getControlPoint(1);
|
||||||
|
return new Rectangle2D.Double(Math.min(point.getX(), finalSecondPoint.getX()),
|
||||||
|
Math.min(point.getY(), finalSecondPoint.getY()),
|
||||||
|
Math.abs(finalSecondPoint.getX() - point.getX()) + 2,
|
||||||
|
Math.abs(finalSecondPoint.getY() - point.getY()) + 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static enum ProtoBoard780Type {
|
||||||
|
RS, MPJA
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
+330
-325
@@ -1,26 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.diylc.components.electromechanical;
|
||||||
|
|
||||||
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 <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
*/
|
|
||||||
package org.diylc.components.electromechanical;
|
|
||||||
|
|
||||||
import java.awt.AlphaComposite;
|
import java.awt.AlphaComposite;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
@@ -50,343 +47,350 @@ import org.diylc.core.annotations.KeywordPolicy;
|
|||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
import org.diylc.core.measures.SizeUnit;
|
||||||
import org.diylc.utils.Constants;
|
import org.diylc.utils.Constants;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "Tactile Micro-Switch", author = "Branislav Stojkovic", category = "Electro-Mechanical",
|
@ComponentDescriptor(name = "Tactile Micro-Switch", author = "Branislav Stojkovic",
|
||||||
instanceNamePrefix = "SW", description = "4-pin tactile momentary switch",
|
category = "Electro-Mechanical", instanceNamePrefix = "SW",
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = DIL_ICTransformer.class,
|
description = "4-pin tactile momentary switch", zOrder = IDIYComponent.COMPONENT,
|
||||||
enableCache = true)
|
keywordPolicy = KeywordPolicy.SHOW_VALUE, enableCache = true)
|
||||||
public class TactileMicroSwitch extends AbstractLabeledComponent<String> {
|
public class TactileMicroSwitch extends AbstractLabeledComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public static Color BODY_COLOR = Color.lightGray;
|
public static Color BODY_COLOR = Color.lightGray;
|
||||||
public static Color BORDER_COLOR = Color.gray.darker();
|
public static Color BORDER_COLOR = Color.gray.darker();
|
||||||
public static Color PIN_COLOR = METAL_COLOR;
|
public static Color PIN_COLOR = METAL_COLOR;
|
||||||
public static Color PIN_BORDER_COLOR = PIN_COLOR.darker();
|
public static Color PIN_BORDER_COLOR = PIN_COLOR.darker();
|
||||||
public static Color INDENT_COLOR = Color.gray.darker();
|
public static Color INDENT_COLOR = Color.gray.darker();
|
||||||
public static Color LABEL_COLOR = Color.white;
|
public static Color LABEL_COLOR = Color.white;
|
||||||
public static Size PIN_SIZE = new Size(0.04d, SizeUnit.in);
|
public static Size PIN_SIZE = new Size(0.04d, SizeUnit.in);
|
||||||
public static int PIN_COUNT = 4;
|
public static int PIN_COUNT = 4;
|
||||||
public static Size CASE_SIZE = new Size(6d, SizeUnit.mm);
|
public static Size CASE_SIZE = new Size(6d, SizeUnit.mm);
|
||||||
public static Size INDENT_SIZE = new Size(3d, SizeUnit.mm);
|
public static Size INDENT_SIZE = new Size(3d, SizeUnit.mm);
|
||||||
private static Size PIN_SPACING = new Size(4.5d, SizeUnit.mm);
|
private static Size PIN_SPACING = new Size(4.5d, SizeUnit.mm);
|
||||||
private static Size ROW_SPACING = new Size(6.5d, SizeUnit.mm);
|
private static Size ROW_SPACING = new Size(6.5d, SizeUnit.mm);
|
||||||
|
|
||||||
private String value = "";
|
private String value = "";
|
||||||
private Orientation orientation = Orientation.DEFAULT;
|
private Orientation orientation = Orientation.DEFAULT;
|
||||||
|
|
||||||
private Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0)};
|
private Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0)};
|
||||||
protected Display display = Display.BOTH;
|
protected Display display = Display.BOTH;
|
||||||
private Color bodyColor = BODY_COLOR;
|
private Color bodyColor = BODY_COLOR;
|
||||||
private Color borderColor = BORDER_COLOR;
|
private Color borderColor = BORDER_COLOR;
|
||||||
private Color labelColor = LABEL_COLOR;
|
private Color labelColor = LABEL_COLOR;
|
||||||
transient private Area[] body;
|
transient private Area[] body;
|
||||||
|
|
||||||
public TactileMicroSwitch() {
|
public TactileMicroSwitch() {
|
||||||
super();
|
super();
|
||||||
updateControlPoints();
|
updateControlPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(String value) {
|
public void setValue(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
public Orientation getOrientation() {
|
public Orientation getOrientation() {
|
||||||
return orientation;
|
return orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrientation(Orientation orientation) {
|
public void setOrientation(Orientation orientation) {
|
||||||
this.orientation = orientation;
|
this.orientation = orientation;
|
||||||
updateControlPoints();
|
updateControlPoints();
|
||||||
// Reset body shape.
|
// Reset body shape.
|
||||||
body = null;
|
body = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
public Display getDisplay() {
|
public Display getDisplay() {
|
||||||
if (display == null) {
|
if (display == null) {
|
||||||
display = Display.VALUE;
|
display = Display.VALUE;
|
||||||
}
|
}
|
||||||
return display;
|
return display;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDisplay(Display display) {
|
public void setDisplay(Display display) {
|
||||||
this.display = display;
|
this.display = display;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getControlPointCount() {
|
public int getControlPointCount() {
|
||||||
return controlPoints.length;
|
return controlPoints.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Point2D getControlPoint(int index) {
|
public Point2D getControlPoint(int index) {
|
||||||
return controlPoints[index];
|
return controlPoints[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isControlPointSticky(int index) {
|
public boolean isControlPointSticky(int index) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||||
return VisibilityPolicy.NEVER;
|
return VisibilityPolicy.NEVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setControlPoint(Point2D point, int index) {
|
public void setControlPoint(Point2D point, int index) {
|
||||||
controlPoints[index].setLocation(point);
|
controlPoints[index].setLocation(point);
|
||||||
body = null;
|
body = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateControlPoints() {
|
private void updateControlPoints() {
|
||||||
Point2D firstPoint = controlPoints[0];
|
Point2D firstPoint = controlPoints[0];
|
||||||
controlPoints = new Point2D[PIN_COUNT];
|
controlPoints = new Point2D[PIN_COUNT];
|
||||||
controlPoints[0] = firstPoint;
|
controlPoints[0] = firstPoint;
|
||||||
double pinSpacing = PIN_SPACING.convertToPixels();
|
double pinSpacing = PIN_SPACING.convertToPixels();
|
||||||
double rowSpacing = ROW_SPACING.convertToPixels();
|
double rowSpacing = ROW_SPACING.convertToPixels();
|
||||||
// Update control points.
|
// Update control points.
|
||||||
double dx1;
|
double dx1;
|
||||||
double dy1;
|
double dy1;
|
||||||
double dx2;
|
double dx2;
|
||||||
double dy2;
|
double dy2;
|
||||||
for (int i = 0; i < PIN_COUNT / 2; i++) {
|
for (int i = 0; i < PIN_COUNT / 2; i++) {
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
case DEFAULT:
|
case DEFAULT:
|
||||||
dx1 = 0;
|
dx1 = 0;
|
||||||
dy1 = i * pinSpacing;
|
dy1 = i * pinSpacing;
|
||||||
dx2 = rowSpacing;
|
dx2 = rowSpacing;
|
||||||
dy2 = i * pinSpacing;
|
dy2 = i * pinSpacing;
|
||||||
break;
|
break;
|
||||||
case _90:
|
case _90:
|
||||||
dx1 = -i * pinSpacing;
|
dx1 = -i * pinSpacing;
|
||||||
dy1 = 0;
|
dy1 = 0;
|
||||||
dx2 = -i * pinSpacing;
|
dx2 = -i * pinSpacing;
|
||||||
dy2 = rowSpacing;
|
dy2 = rowSpacing;
|
||||||
break;
|
break;
|
||||||
case _180:
|
case _180:
|
||||||
dx1 = 0;
|
dx1 = 0;
|
||||||
dy1 = -i * pinSpacing;
|
dy1 = -i * pinSpacing;
|
||||||
dx2 = -rowSpacing;
|
dx2 = -rowSpacing;
|
||||||
dy2 = -i * pinSpacing;
|
dy2 = -i * pinSpacing;
|
||||||
break;
|
break;
|
||||||
case _270:
|
case _270:
|
||||||
dx1 = i * pinSpacing;
|
dx1 = i * pinSpacing;
|
||||||
dy1 = 0;
|
dy1 = 0;
|
||||||
dx2 = i * pinSpacing;
|
dx2 = i * pinSpacing;
|
||||||
dy2 = -rowSpacing;
|
dy2 = -rowSpacing;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unexpected orientation: " + orientation);
|
throw new RuntimeException("Unexpected orientation: " + orientation);
|
||||||
}
|
}
|
||||||
controlPoints[i] = new Point2D.Double((int) (firstPoint.getX() + dx1), (int) (firstPoint.getY() + dy1));
|
controlPoints[i] =
|
||||||
controlPoints[i + PIN_COUNT / 2] = new Point2D.Double((int) (firstPoint.getX() + dx2), (int) (firstPoint.getY() + dy2));
|
new Point2D.Double((int) (firstPoint.getX() + dx1), (int) (firstPoint.getY() + dy1));
|
||||||
}
|
controlPoints[i + PIN_COUNT / 2] =
|
||||||
}
|
new Point2D.Double((int) (firstPoint.getX() + dx2), (int) (firstPoint.getY() + dy2));
|
||||||
|
}
|
||||||
public Area[] getBody() {
|
}
|
||||||
if (body == null) {
|
|
||||||
body = new Area[2];
|
public Area[] getBody() {
|
||||||
double x = controlPoints[0].getX();
|
if (body == null) {
|
||||||
double y = controlPoints[0].getY();
|
body = new Area[2];
|
||||||
double width;
|
double x = controlPoints[0].getX();
|
||||||
double height;
|
double y = controlPoints[0].getY();
|
||||||
|
double width;
|
||||||
|
double height;
|
||||||
double caseSize = CASE_SIZE.convertToPixels();
|
double caseSize = CASE_SIZE.convertToPixels();
|
||||||
double indentSize = INDENT_SIZE.convertToPixels();
|
double indentSize = INDENT_SIZE.convertToPixels();
|
||||||
|
|
||||||
width = height = caseSize;
|
width = height = caseSize;
|
||||||
x = (controlPoints[0].getX() + controlPoints[3].getX() - width) / 2;
|
|
||||||
y = (controlPoints[0].getY() + controlPoints[3].getY() - height) / 2;
|
|
||||||
|
|
||||||
body[0] = new Area(new Rectangle2D.Double(x, y, width, height));
|
|
||||||
|
|
||||||
width = height = indentSize;
|
|
||||||
x = (controlPoints[0].getX() + controlPoints[3].getX() - width) / 2;
|
x = (controlPoints[0].getX() + controlPoints[3].getX() - width) / 2;
|
||||||
y = (controlPoints[0].getY() + controlPoints[3].getY() - height) / 2;
|
y = (controlPoints[0].getY() + controlPoints[3].getY() - height) / 2;
|
||||||
|
|
||||||
body[1] = new Area(new Ellipse2D.Double(x, y, width, height));
|
body[0] = new Area(new Rectangle2D.Double(x, y, width, height));
|
||||||
}
|
|
||||||
return body;
|
width = height = indentSize;
|
||||||
}
|
x = (controlPoints[0].getX() + controlPoints[3].getX() - width) / 2;
|
||||||
|
y = (controlPoints[0].getY() + controlPoints[3].getY() - height) / 2;
|
||||||
@Override
|
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
body[1] = new Area(new Ellipse2D.Double(x, y, width, height));
|
||||||
IDrawingObserver drawingObserver) {
|
|
||||||
if (checkPointsClipped(g2d.getClip())) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
Area[] body = getBody();
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
|
||||||
|
Project project, IDrawingObserver drawingObserver) {
|
||||||
|
if (checkPointsClipped(g2d.getClip())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Area[] body = getBody();
|
||||||
Area mainArea = body[0];
|
Area mainArea = body[0];
|
||||||
Area indentArea = body[1];
|
Area indentArea = body[1];
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
|
||||||
if (!outlineMode) {
|
if (!outlineMode) {
|
||||||
int pinSize = (int) PIN_SIZE.convertToPixels() / 2 * 2;
|
int pinSize = (int) PIN_SIZE.convertToPixels() / 2 * 2;
|
||||||
for (Point2D point : controlPoints) {
|
for (Point2D point : controlPoints) {
|
||||||
Rectangle2D rect = new Rectangle2D.Double(point.getX() - pinSize / 2, point.getY() - pinSize / 2, pinSize, pinSize);
|
Rectangle2D rect = new Rectangle2D.Double(point.getX() - pinSize / 2,
|
||||||
g2d.setColor(PIN_COLOR);
|
point.getY() - pinSize / 2, pinSize, pinSize);
|
||||||
g2d.fill(rect);
|
g2d.setColor(PIN_COLOR);
|
||||||
g2d.setColor(PIN_BORDER_COLOR);
|
g2d.fill(rect);
|
||||||
g2d.draw(rect);
|
g2d.setColor(PIN_BORDER_COLOR);
|
||||||
}
|
g2d.draw(rect);
|
||||||
}
|
}
|
||||||
Composite oldComposite = g2d.getComposite();
|
}
|
||||||
if (alpha < MAX_ALPHA) {
|
Composite oldComposite = g2d.getComposite();
|
||||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
if (alpha < MAX_ALPHA) {
|
||||||
}
|
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
}
|
||||||
|
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||||
g2d.fill(mainArea);
|
g2d.fill(mainArea);
|
||||||
|
|
||||||
g2d.setColor(INDENT_COLOR);
|
g2d.setColor(INDENT_COLOR);
|
||||||
g2d.fill(indentArea);
|
g2d.fill(indentArea);
|
||||||
g2d.setColor(INDENT_COLOR.darker());
|
g2d.setColor(INDENT_COLOR.darker());
|
||||||
g2d.draw(indentArea);
|
g2d.draw(indentArea);
|
||||||
|
|
||||||
g2d.setComposite(oldComposite);
|
g2d.setComposite(oldComposite);
|
||||||
|
|
||||||
Color finalBorderColor;
|
Color finalBorderColor;
|
||||||
if (outlineMode) {
|
if (outlineMode) {
|
||||||
Theme theme =
|
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY,
|
||||||
(Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
Constants.DEFAULT_THEME);
|
||||||
finalBorderColor =
|
finalBorderColor =
|
||||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||||
: theme.getOutlineColor();
|
? SELECTION_COLOR
|
||||||
} else {
|
: theme.getOutlineColor();
|
||||||
finalBorderColor =
|
} else {
|
||||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
finalBorderColor =
|
||||||
: getBorderColor();
|
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||||
}
|
? SELECTION_COLOR
|
||||||
g2d.setColor(finalBorderColor);
|
: getBorderColor();
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
}
|
||||||
|
g2d.setColor(finalBorderColor);
|
||||||
g2d.draw(mainArea);
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
|
|
||||||
drawingObserver.stopTracking();
|
g2d.draw(mainArea);
|
||||||
|
|
||||||
// Draw label.
|
drawingObserver.stopTracking();
|
||||||
|
|
||||||
|
// Draw label.
|
||||||
g2d.setFont(project.getFont());
|
g2d.setFont(project.getFont());
|
||||||
|
|
||||||
// Override font size
|
// Override font size
|
||||||
if (getFontSizeOverride() != null)
|
if (getFontSizeOverride() != null)
|
||||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||||
|
|
||||||
Color finalLabelColor;
|
Color finalLabelColor;
|
||||||
if (outlineMode) {
|
if (outlineMode) {
|
||||||
Theme theme =
|
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY,
|
||||||
(Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
Constants.DEFAULT_THEME);
|
||||||
finalLabelColor =
|
finalLabelColor =
|
||||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||||
: theme.getOutlineColor();
|
? LABEL_COLOR_SELECTED
|
||||||
} else {
|
: theme.getOutlineColor();
|
||||||
finalLabelColor =
|
} else {
|
||||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
finalLabelColor =
|
||||||
: getLabelColor();
|
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||||
}
|
? LABEL_COLOR_SELECTED
|
||||||
g2d.setColor(finalLabelColor);
|
: getLabelColor();
|
||||||
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
}
|
||||||
String[] label = null;
|
g2d.setColor(finalLabelColor);
|
||||||
|
FontMetrics fontMetrics = g2d.getFontMetrics(g2d.getFont());
|
||||||
if (getDisplay() == Display.NAME) {
|
String[] label = null;
|
||||||
label = new String[] {getName()};
|
|
||||||
} else if (getDisplay() == Display.VALUE) {
|
if (getDisplay() == Display.NAME) {
|
||||||
label = new String[] {getValue().toString()};
|
label = new String[] {getName()};
|
||||||
} else if (getDisplay() == Display.BOTH) {
|
} else if (getDisplay() == Display.VALUE) {
|
||||||
String value = getValue().toString();
|
label = new String[] {getValue().toString()};
|
||||||
label = value.isEmpty() ? new String[] {getName()} : new String[] {getName(), value};
|
} else if (getDisplay() == Display.BOTH) {
|
||||||
}
|
String value = getValue().toString();
|
||||||
|
label = value.isEmpty() ? new String[] {getName()} : new String[] {getName(), value};
|
||||||
if (label != null) {
|
}
|
||||||
for (int i = 0; i < label.length; i++) {
|
|
||||||
String l = label[i];
|
if (label != null) {
|
||||||
Rectangle2D rect = fontMetrics.getStringBounds(l, g2d);
|
for (int i = 0; i < label.length; i++) {
|
||||||
int textHeight = (int) (rect.getHeight());
|
String l = label[i];
|
||||||
int textWidth = (int) (rect.getWidth());
|
Rectangle2D rect = fontMetrics.getStringBounds(l, g2d);
|
||||||
// Center text horizontally and vertically
|
int textHeight = (int) (rect.getHeight());
|
||||||
Rectangle bounds = mainArea.getBounds();
|
int textWidth = (int) (rect.getWidth());
|
||||||
double x = bounds.getX() + (bounds.width - textWidth) / 2;
|
// Center text horizontally and vertically
|
||||||
double y = bounds.getY() + (bounds.height - textHeight) / 2 + fontMetrics.getAscent();
|
Rectangle bounds = mainArea.getBounds();
|
||||||
|
double x = bounds.getX() + (bounds.width - textWidth) / 2;
|
||||||
if (label.length == 2) {
|
double y = bounds.getY() + (bounds.height - textHeight) / 2 + fontMetrics.getAscent();
|
||||||
if (i == 0)
|
|
||||||
g2d.translate(0, -textHeight / 2);
|
if (label.length == 2) {
|
||||||
else if (i == 1)
|
if (i == 0)
|
||||||
g2d.translate(0, textHeight / 2);
|
g2d.translate(0, -textHeight / 2);
|
||||||
}
|
else if (i == 1)
|
||||||
|
g2d.translate(0, textHeight / 2);
|
||||||
g2d.drawString(l, (int)x, (int)y);
|
}
|
||||||
}
|
|
||||||
}
|
g2d.drawString(l, (int) x, (int) y);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
int pinSize = 4 * width / 32;
|
int pinSize = 4 * width / 32;
|
||||||
g2d.setColor(PIN_COLOR);
|
g2d.setColor(PIN_COLOR);
|
||||||
|
|
||||||
g2d.fillRect(width / 6 - pinSize + 1, height / 6 + 1, pinSize, pinSize);
|
g2d.fillRect(width / 6 - pinSize + 1, height / 6 + 1, pinSize, pinSize);
|
||||||
g2d.fillRect(5 * width / 6, height / 6 + 1, pinSize, pinSize);
|
g2d.fillRect(5 * width / 6, height / 6 + 1, pinSize, pinSize);
|
||||||
|
|
||||||
g2d.fillRect(width / 6 - pinSize + 1, 5 * height / 6 - pinSize - 1, pinSize, pinSize);
|
g2d.fillRect(width / 6 - pinSize + 1, 5 * height / 6 - pinSize - 1, pinSize, pinSize);
|
||||||
g2d.fillRect(5 * width / 6, 5 * height / 6 - pinSize - 1, pinSize, pinSize);
|
g2d.fillRect(5 * width / 6, 5 * height / 6 - pinSize - 1, pinSize, pinSize);
|
||||||
|
|
||||||
g2d.setColor(BODY_COLOR);
|
|
||||||
g2d.fillRect(width / 6, width / 6, 4 * width / 6, 4 * width / 6);
|
|
||||||
g2d.setColor(BORDER_COLOR);
|
|
||||||
g2d.drawRect(width / 6, width / 6, 4 * width / 6, 4 * width / 6);
|
|
||||||
|
|
||||||
|
g2d.setColor(BODY_COLOR);
|
||||||
|
g2d.fillRect(width / 6, width / 6, 4 * width / 6, 4 * width / 6);
|
||||||
|
g2d.setColor(BORDER_COLOR);
|
||||||
|
g2d.drawRect(width / 6, width / 6, 4 * width / 6, 4 * width / 6);
|
||||||
|
|
||||||
|
|
||||||
g2d.setColor(INDENT_COLOR);
|
g2d.setColor(INDENT_COLOR);
|
||||||
int indentSize = 9 * width / 32;
|
int indentSize = 9 * width / 32;
|
||||||
g2d.fillOval(width / 2 - indentSize / 2, height / 2 - indentSize / 2, indentSize, indentSize);
|
g2d.fillOval(width / 2 - indentSize / 2, height / 2 - indentSize / 2, indentSize, indentSize);
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Body")
|
|
||||||
public Color getBodyColor() {
|
|
||||||
if (bodyColor == null) {
|
|
||||||
bodyColor = BODY_COLOR;
|
|
||||||
}
|
|
||||||
return bodyColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBodyColor(Color bodyColor) {
|
|
||||||
this.bodyColor = bodyColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Border")
|
|
||||||
public Color getBorderColor() {
|
|
||||||
if (borderColor == null) {
|
|
||||||
borderColor = BORDER_COLOR;
|
|
||||||
}
|
|
||||||
return borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBorderColor(Color borderColor) {
|
|
||||||
this.borderColor = borderColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty(name = "Label")
|
|
||||||
public Color getLabelColor() {
|
|
||||||
if (labelColor == null) {
|
|
||||||
labelColor = LABEL_COLOR;
|
|
||||||
}
|
|
||||||
return labelColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabelColor(Color labelColor) {
|
|
||||||
this.labelColor = labelColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Body")
|
||||||
|
public Color getBodyColor() {
|
||||||
|
if (bodyColor == null) {
|
||||||
|
bodyColor = BODY_COLOR;
|
||||||
|
}
|
||||||
|
return bodyColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBodyColor(Color bodyColor) {
|
||||||
|
this.bodyColor = bodyColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Border")
|
||||||
|
public Color getBorderColor() {
|
||||||
|
if (borderColor == null) {
|
||||||
|
borderColor = BORDER_COLOR;
|
||||||
|
}
|
||||||
|
return borderColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBorderColor(Color borderColor) {
|
||||||
|
this.borderColor = borderColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Label")
|
||||||
|
public Color getLabelColor() {
|
||||||
|
if (labelColor == null) {
|
||||||
|
labelColor = LABEL_COLOR;
|
||||||
|
}
|
||||||
|
return labelColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabelColor(Color labelColor) {
|
||||||
|
this.labelColor = labelColor;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPointMoveFreely(int pointIndex) {
|
public boolean canPointMoveFreely(int pointIndex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Rectangle2D getCachingBounds() {
|
public Rectangle2D getCachingBounds() {
|
||||||
double minX = Integer.MAX_VALUE;
|
double minX = Integer.MAX_VALUE;
|
||||||
@@ -405,7 +409,8 @@ public class TactileMicroSwitch extends AbstractLabeledComponent<String> {
|
|||||||
if (p.getY() > maxY)
|
if (p.getY() > maxY)
|
||||||
maxY = p.getY();
|
maxY = p.getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Rectangle2D.Double(minX - margin, minY - margin, maxX - minX + 2 * margin, maxY - minY + 2 * margin);
|
return new Rectangle2D.Double(minX - margin, minY - margin, maxX - minX + 2 * margin,
|
||||||
}
|
maxY - minY + 2 * margin);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ import org.diylc.utils.Constants;
|
|||||||
|
|
||||||
@ComponentDescriptor(name = "Mini Signal Transformer", author = "Branislav Stojkovic", category = "Passive",
|
@ComponentDescriptor(name = "Mini Signal Transformer", author = "Branislav Stojkovic", category = "Passive",
|
||||||
instanceNamePrefix = "TR", description = "Miniature PCB-mount signal transformer with EI core",
|
instanceNamePrefix = "TR", description = "Miniature PCB-mount signal transformer with EI core",
|
||||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = DIL_ICTransformer.class)
|
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
||||||
public class AudioTransformer extends AbstractMultiPartComponent<String> {
|
public class AudioTransformer extends AbstractMultiPartComponent<String> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class FuseSymbol extends AbstractSchematicLeadedSymbol<Current> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValueForDisplay() {
|
public String getValueForDisplay() {
|
||||||
return getValue().toString();// + (getPowerNew() == null ? "" : " " + getPowerNew().toString());
|
return getValue() == null ? null : getValue().toString();// + (getPowerNew() == null ? "" : " " + getPowerNew().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class RadialInductor extends AbstractRadialComponent<Inductance> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValueForDisplay() {
|
public String getValueForDisplay() {
|
||||||
return getValue().toString();
|
return getValue() == null ? null : getValue().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+422
-406
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@
|
|||||||
<property name="jar.dir" value="${build.dir}/jar" />
|
<property name="jar.dir" value="${build.dir}/jar" />
|
||||||
<property name="report.dir" value="${build.dir}/junitreport" />
|
<property name="report.dir" value="${build.dir}/junitreport" />
|
||||||
<property name="main.class" value="org.diylc.DIYLCStarter" />
|
<property name="main.class" value="org.diylc.DIYLCStarter" />
|
||||||
<property name="diylc.version" value="4.35.0" />
|
<property name="diylc.version" value="4.37.0" />
|
||||||
|
|
||||||
<property name="osx.jre8.path" value="tools\jre\osx\jre8u321\Contents\Home\" />
|
<property name="osx.jre8.path" value="tools\jre\osx\jre8u321\Contents\Home\" />
|
||||||
<property name="osx.jre8m1.path" value="tools\jre\osx\zulu-8.jre\Contents\Home\" />
|
<property name="osx.jre8m1.path" value="tools\jre\osx\zulu-8.jre\Contents\Home\" />
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ AWG
|
|||||||
Alternate
|
Alternate
|
||||||
And
|
And
|
||||||
Angle Offset
|
Angle Offset
|
||||||
|
Apply Model
|
||||||
B-C-E BJT
|
B-C-E BJT
|
||||||
Background
|
Background
|
||||||
Box
|
Box
|
||||||
@@ -103,6 +104,7 @@ I-G-O REGULATOR
|
|||||||
Italiano
|
Italiano
|
||||||
Lin
|
Lin
|
||||||
Log
|
Log
|
||||||
|
MPJA
|
||||||
Markers
|
Markers
|
||||||
Maximum number of switching combinations exceeded. Allowed: %s, actual: %s
|
Maximum number of switching combinations exceeded. Allowed: %s, actual: %s
|
||||||
NPN
|
NPN
|
||||||
@@ -126,6 +128,8 @@ PCB
|
|||||||
PNP
|
PNP
|
||||||
Poles
|
Poles
|
||||||
Português
|
Português
|
||||||
|
RS
|
||||||
|
RY1
|
||||||
Rectangle
|
Rectangle
|
||||||
Rev log
|
Rev log
|
||||||
S-G-D JFET
|
S-G-D JFET
|
||||||
|
|||||||
@@ -37,6 +37,29 @@
|
|||||||
<update_contact>nbenitezl_AT_gmail.com</update_contact>
|
<update_contact>nbenitezl_AT_gmail.com</update_contact>
|
||||||
<content_rating type="oars-1.1"/>
|
<content_rating type="oars-1.1"/>
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="4.37.0" date="2023-04-27">
|
||||||
|
<description>
|
||||||
|
<ul>
|
||||||
|
<li>[New Feature] 'Proto Board 780 Holes' added with two variations (sponsored by Pete Olivier)</li>
|
||||||
|
<li>[Improvement] Ability to rotate (almost) all components using keyboard shortcuts and 'Transform Selection' menu</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
<url>https://github.com/bancika/diy-layout-creator/releases/tag/v4.37.0</url>
|
||||||
|
</release>
|
||||||
|
<release version="4.36.0" date="2023-03-30">
|
||||||
|
<description>
|
||||||
|
<ul>
|
||||||
|
<li>[New Feature] Title Block added as one of factory building blocks (was missing in 4.35 by mistake)</li>
|
||||||
|
<li>[New Feature] Configurable max switch combination count for circuit analysis (using org.diylc.maxSwitchCombinations argument)</li>
|
||||||
|
<li>[Improvement] Added resilience to the code that saves the configuration file to avoid it getting corrupted</li>
|
||||||
|
<li>[Improvement] When backing up the configuration file, append the current timestamp at the end instead of a '~'</li>
|
||||||
|
<li>[Improvement] Improve the format of timestamp in file backups</li>
|
||||||
|
<li>[Bug Fix] General application slowness when Inductor component is added to the drawing</li>
|
||||||
|
<li>[Bug Fix] Lever switch orientation not loaded correctly from files created prior to version 4.35</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
<url>https://github.com/bancika/diy-layout-creator/releases/tag/v4.36.0</url>
|
||||||
|
</release>
|
||||||
<release version="4.35.0" date="2022-12-23">
|
<release version="4.35.0" date="2022-12-23">
|
||||||
<description>
|
<description>
|
||||||
<ul>
|
<ul>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -230,9 +230,7 @@ public class DIYLCStarter {
|
|||||||
if (ConfigurationManager.getInstance().isFileWithErrors())
|
if (ConfigurationManager.getInstance().isFileWithErrors())
|
||||||
mainFrame.showMessage("<html>"
|
mainFrame.showMessage("<html>"
|
||||||
+ "There was an error reading the configuration file and it was replaced by a default configuration.<br>"
|
+ "There was an error reading the configuration file and it was replaced by a default configuration.<br>"
|
||||||
+ "The backup file is created and placed in user directory under '.diylc' sub-directory with '~' at the end.<br>"
|
+ "The backup file is created and placed in user directory under 'diylc' sub-directory with the current timestamp at the end.<br>"
|
||||||
+ "This can happen when running two versions of DIYLC on the same machine at the same time.<br>"
|
|
||||||
+ "Replace the main 'config.xml' file with the backup when running the latest version of DIYLC."
|
|
||||||
+ "</html>", "Warning", IView.WARNING_MESSAGE);
|
+ "</html>", "Warning", IView.WARNING_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,10 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.text.DateFormat;
|
import java.time.LocalDateTime;
|
||||||
import java.text.SimpleDateFormat;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
@@ -129,15 +128,11 @@ public class AutoSavePlugin implements IPlugIn {
|
|||||||
name = name.substring(0, name.length() - 4);
|
name = name.substring(0, name.length() - 4);
|
||||||
|
|
||||||
// append date and time
|
// append date and time
|
||||||
Date date = new Date();
|
String timestamp = LocalDateTime.now()
|
||||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
|
.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
|
||||||
file = new File(AUTO_SAVE_PATH + File.separator + name + "." + dateFormat.format(date) + ".diy");
|
.substring(0, 19)
|
||||||
// make sure that it doesn't already exist
|
.replace(':', '-');
|
||||||
int i = 2;
|
file = new File(AUTO_SAVE_PATH + File.separator + name + "." + timestamp + ".diy");
|
||||||
while (file.exists()) {
|
|
||||||
file = new File(AUTO_SAVE_PATH + File.separator + name + "." + dateFormat.format(date) + "-" + i + ".diy");
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return file.getAbsolutePath();
|
return file.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user