mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
Compare commits
39 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 14944a3e38 | |||
| 48fe5f496b | |||
| 57a7932675 | |||
| e0d2964e12 | |||
| c3f9208ab7 | |||
| 3a5e6f553d | |||
| 24c8afd620 | |||
| 4710d1b484 | |||
| 2ce7677672 | |||
| 04a22436d2 | |||
| 0ef3bc4adb | |||
| 887be7338f | |||
| 72f61b978a | |||
| 4c38075dc7 | |||
| 8211976044 | |||
| 22e9bbaa20 | |||
| 0fcf7e1fd4 | |||
| 04302866e9 | |||
| 9bcc56f228 | |||
| d7903bc3bb | |||
| 8178c72fbe | |||
| ab53f7e85f | |||
| 7a186d0d49 | |||
| d5d0ec56cf | |||
| b45ee77472 | |||
| 796c825f02 | |||
| 063cfde769 | |||
| b89a851513 | |||
| b6f3020072 | |||
| f4f4ba7458 | |||
| f181109ac7 | |||
| c7d5fe3cf4 | |||
| e9414613a4 | |||
| 54da44e0d0 | |||
| 92f9c0c89a | |||
| 16d718ffc5 | |||
| 03df6158e2 | |||
| 895de4e7f2 | |||
| 655f5253f6 |
@@ -2,6 +2,7 @@ Thank you for reporting issues and contributing ideas and features to DIYLC repo
|
||||
|
||||
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 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.
|
||||
|
||||
Binary file not shown.
@@ -31,7 +31,7 @@ public abstract class AbstractAngledComponent<T> extends AbstractTransparentComp
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Deprecated
|
||||
protected transient Orientation orientation;
|
||||
protected Orientation orientation;
|
||||
protected int angle;
|
||||
|
||||
transient protected Shape[] body;
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
@@ -88,7 +89,14 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue() == null ? "" : getValue().toString();
|
||||
if (getValue() == null)
|
||||
return "";
|
||||
|
||||
Object val = getValue();
|
||||
if (val.getClass().isArray()) {
|
||||
return String.join(" / ", Arrays.stream((Object[])val).map(x -> x == null ? "" : x.toString()).collect(Collectors.toList()));
|
||||
}
|
||||
return val.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -226,7 +226,7 @@ public abstract class NetlistAnalyzer {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.common.ComponentType;
|
||||
import org.diylc.core.ICommonNode;
|
||||
import org.diylc.core.IContinuity;
|
||||
@@ -50,11 +51,13 @@ public class NetlistBuilder {
|
||||
|
||||
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
|
||||
.translate("Maximum number of switching combinations exceeded. Allowed: %s, actual: %s");
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(NetlistBuilder.class);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<Netlist> extractNetlists(boolean includeSwitches, Project project,
|
||||
List<ContinuityArea> continuityAreas) throws NetlistException {
|
||||
@@ -131,7 +134,17 @@ public class NetlistBuilder {
|
||||
int totalSwitchCombinations =
|
||||
switches.stream().map(sw -> sw.getPositionCount()).reduce(1, (a, b) -> a * b);
|
||||
|
||||
if (totalSwitchCombinations > MAX_SWITCH_COMBINATIONS) {
|
||||
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 > maxSwitch) {
|
||||
throw new NetlistException(String.format(MAX_SWITCH_COMBINATIONS_ERROR,
|
||||
MAX_SWITCH_COMBINATIONS, totalSwitchCombinations));
|
||||
}
|
||||
|
||||
@@ -178,22 +178,13 @@ public class BuildingBlockManager {
|
||||
if (System.getProperty("org.diylc.WriteStaticBlocks", "false").equalsIgnoreCase("true")) {
|
||||
Map<String, List<IDIYComponent<?>>> defaultBlockMap =
|
||||
new HashMap<String, List<IDIYComponent<?>>>();
|
||||
// unify default and user-variants
|
||||
for (Map.Entry<String, List<IDIYComponent<?>>> entry : blocks.entrySet()) {
|
||||
if (defaultBlockMap.containsKey(entry.getKey())) {
|
||||
defaultBlockMap.get(entry.getKey()).addAll(entry.getValue());
|
||||
} else {
|
||||
defaultBlockMap.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
defaultBlockMap.put(blockName, blockComponents);
|
||||
try {
|
||||
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(BLOCKS_FILE_NAME));
|
||||
XStream xStream = new XStream(new DomDriver());
|
||||
xStream.addPermission(AnyTypePermission.ANY);
|
||||
xStream.toXML(defaultBlockMap, out);
|
||||
out.close();
|
||||
// no more user variants
|
||||
configManager.writeValue(IBlockProcessor.BLOCKS_KEY, null);
|
||||
LOG.info("Saved default blocks");
|
||||
} catch (IOException e) {
|
||||
LOG.error("Could not save default blocks", e);
|
||||
|
||||
@@ -285,8 +285,6 @@ public class InstantiationManager {
|
||||
}
|
||||
component.createdIn(currentProject);
|
||||
|
||||
component.setName(createUniqueName(componentType, currentProject.getComponents()));
|
||||
|
||||
// Translate them to the desired location.
|
||||
if (point != null) {
|
||||
for (int j = 0; j < component.getControlPointCount(); j++) {
|
||||
@@ -304,6 +302,11 @@ public class InstantiationManager {
|
||||
fillWithDefaultProperties(component, template);
|
||||
}
|
||||
|
||||
// preserve component from the template if RENUMBER_ON_PASTE_KEY is OFF
|
||||
if (template == null || ConfigurationManager.getInstance().readBoolean(IPlugInPort.RENUMBER_ON_PASTE_KEY, true)) {
|
||||
component.setName(createUniqueName(componentType, currentProject.getComponents()));
|
||||
}
|
||||
|
||||
// Write to recent components
|
||||
List<String> recentComponentTypes =
|
||||
(List<String>) ConfigurationManager.getInstance().readObject(IPlugInPort.RECENT_COMPONENTS_KEY,
|
||||
|
||||
@@ -1069,15 +1069,16 @@ public class Presenter implements IPlugInPort {
|
||||
@Override
|
||||
public void selectMatching(String criteria) {
|
||||
Set<IDIYComponent<?>> matching = new HashSet<IDIYComponent<?>>();
|
||||
String regex = ".*" + criteria.toLowerCase() + ".*";
|
||||
for (IDIYComponent<?> c : currentProject.getComponents()) {
|
||||
ComponentType type = ComponentProcessor.getInstance().extractComponentTypeFrom((Class<? extends IDIYComponent<?>>) c.getClass());
|
||||
if ((c.getName() != null && c.getName().toLowerCase().matches(criteria.toLowerCase())) ||
|
||||
(c.getValueForDisplay() != null && c.getValueForDisplay().toLowerCase().matches(criteria.toLowerCase())) ||
|
||||
(type != null && type.getName().toLowerCase().matches(criteria.toLowerCase())))
|
||||
if ((c.getName() != null && c.getName().toLowerCase().matches(regex)) ||
|
||||
(c.getValueForDisplay() != null && c.getValueForDisplay().toLowerCase().matches(regex)) ||
|
||||
(type != null && type.getName().toLowerCase().matches(regex)))
|
||||
matching.add(c);
|
||||
}
|
||||
updateSelection(matching);
|
||||
messageDispatcher.dispatchMessage(EventType.REPAINT);
|
||||
messageDispatcher.dispatchMessage(EventType.REPAINT, true);
|
||||
if (matching.size() > 0)
|
||||
messageDispatcher.dispatchMessage(EventType.SCROLL_TO, getSelectionBounds(true));
|
||||
}
|
||||
@@ -2563,9 +2564,9 @@ public class Presenter implements IPlugInPort {
|
||||
List<PropertyWrapper> properties = ComponentProcessor.getInstance().extractProperties(component.getClass());
|
||||
Map<String, Object> values = new HashMap<String, Object>();
|
||||
for (PropertyWrapper property : properties) {
|
||||
if (property.getName().equalsIgnoreCase("name")) {
|
||||
continue;
|
||||
}
|
||||
// if (property.getName().equalsIgnoreCase("name")) {
|
||||
// continue;
|
||||
// }
|
||||
try {
|
||||
property.readFrom(component);
|
||||
values.put(property.getName(), property.getValue());
|
||||
|
||||
@@ -133,4 +133,608 @@
|
||||
</diylc.semiconductors.TransistorTO92>
|
||||
</list>
|
||||
</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>
|
||||
@@ -4225,5 +4225,129 @@
|
||||
</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>35</minor>
|
||||
<build>0</build>
|
||||
</versionNumber>
|
||||
<releaseDate>2022-12-23 00:00:00.000 CET</releaseDate>
|
||||
<name></name>
|
||||
<changes>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added '1/8" Cliff Jack' component - stereo and mono</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added 'Solder Lug' component</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added 'PCB Terminal Block' component</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Show component values in the project explorer</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Double click in the project explorer to edit selected component</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Title Block added as one of factory building blocks</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>'Renumber On Paste' feature now applies to variants as well. When set to OFF, the app honors the name saved in the variant</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>New file icons for Mac OS</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Ability to use up/down arrow keys in the project explorer to select components</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Use scroll buttons in 'Tabbed Toolbar' instead of arranging tabs into multiple lines when the screen is not large enough to show them all</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Escape comma in BOM CSV files to avoid component names being split into separate columns</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Show jack type in the BOM and project explorer</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Show wire gauge in the BOM and project explorer</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Improved find tool usability, make the screen pan to the selected components</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Trace cut doesn't affect continuity of vero board traces</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>DIL IC pin labels incorrect in the netlist</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Diode symbol doesn't appear in the BOM</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>Upon starting or opening a project, the ruler is slightly miss-aligned with the project boundaries</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>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>
|
||||
</a>
|
||||
</java.util.Arrays_-ArrayList>
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.thoughtworks.xstream.converters.MarshallingContext;
|
||||
import com.thoughtworks.xstream.converters.UnmarshallingContext;
|
||||
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
|
||||
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.
|
||||
@@ -34,8 +35,8 @@ import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
|
||||
*/
|
||||
public class FontConverter extends com.thoughtworks.xstream.converters.extended.FontConverter {
|
||||
|
||||
public FontConverter() {
|
||||
super(null);
|
||||
public FontConverter(Mapper mapper) {
|
||||
super(mapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -116,7 +116,7 @@ public class ProjectFileManager {
|
||||
xStream.aliasPackage("diylc", "org.diylc.components");
|
||||
xStream.registerConverter(new PointConverter());
|
||||
xStream.registerConverter(new ColorConverter());
|
||||
xStream.registerConverter(new FontConverter());
|
||||
xStream.registerConverter(new FontConverter(xStream.getMapper()));
|
||||
xStream.registerConverter(new MeasureConverter());
|
||||
xStream.registerConverter(new AreaConverter());
|
||||
xStream.addImmutableType(Color.class, true);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -27,7 +27,7 @@ public enum AWG {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "#" + name().replace("_", "") + " (" + String.format("%1$,.2f", diameterIn() * 25.4) + "mm / " + String.format("%1$,.5f", diameterIn()) + "in)";
|
||||
return "#" + name().replace("_", "") + " / " + String.format("%1$,.2f", diameterIn() * 25.4) + "mm";
|
||||
}
|
||||
|
||||
public double diameterIn() {
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.diylc.utils.Constants;
|
||||
instanceNamePrefix = "W", description = "Flexible wire with two control points", zOrder = IDIYComponent.WIRING,
|
||||
flexibleZOrder = true, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||
transformer = SimpleComponentTransformer.class, enableCache = false)
|
||||
public class HookupWire extends AbstractCurvedComponent<Void> implements IContinuity {
|
||||
public class HookupWire extends AbstractCurvedComponent<AWG> implements IContinuity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -117,22 +117,14 @@ public class HookupWire extends AbstractCurvedComponent<Void> implements IContin
|
||||
}
|
||||
|
||||
@EditableProperty(name = "AWG")
|
||||
public AWG getGauge() {
|
||||
public AWG getValue() {
|
||||
return gauge;
|
||||
}
|
||||
|
||||
public void setGauge(AWG gauge) {
|
||||
public void setValue(AWG gauge) {
|
||||
this.gauge = gauge;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void getValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(Void value) {}
|
||||
|
||||
@EditableProperty(name = "Stripe")
|
||||
public boolean getStriped() {
|
||||
return striped;
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
/*
|
||||
*
|
||||
* 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.connectivity;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.components.connectivity.PCBTerminalBlock.PCBTerminalBlockCount;
|
||||
import org.diylc.components.transform.PCBTerminalBlockTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.Theme;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "PCB Terminal Block", category = "Connectivity",
|
||||
author = "Branislav Stojkovic", description = "Horizontal PCB terminal block with 5mm pitch",
|
||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "TB", autoEdit = false,
|
||||
enableCache = true, transformer = PCBTerminalBlockTransformer.class)
|
||||
public class PCBTerminalBlock extends AbstractTransparentComponent<PCBTerminalBlockCount> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static Size SPACING = new Size(5d, SizeUnit.mm);
|
||||
private static Size WIDTH = new Size(7.7d, SizeUnit.mm);
|
||||
private static Size CIRCLE_SIZE = new Size(3d, SizeUnit.mm);
|
||||
private static Size OFFSET = new Size(4.5d, SizeUnit.mm);
|
||||
|
||||
private static Color BODY_COLOR = Color.decode("#90AB66");
|
||||
private static Color BORDER_COLOR = BODY_COLOR.darker();
|
||||
private static Color CIRCLE_COLOR = LIGHT_METAL_COLOR;
|
||||
|
||||
protected Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0)};
|
||||
transient protected Shape[] body;
|
||||
protected PCBTerminalBlockCount count = PCBTerminalBlockCount._3;
|
||||
private Orientation orientation = Orientation.DEFAULT;
|
||||
|
||||
private Color bodyColor = BODY_COLOR;
|
||||
private Color borderColor = BORDER_COLOR;
|
||||
|
||||
public PCBTerminalBlock() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
}
|
||||
|
||||
private void updateControlPoints() {
|
||||
Point2D firstPoint = controlPoints[0];
|
||||
int spacing = (int) SPACING.convertToPixels();
|
||||
controlPoints = new Point2D[count.getCount()];
|
||||
controlPoints[0] = firstPoint;
|
||||
|
||||
for (int i = 1; i < controlPoints.length; i++) {
|
||||
controlPoints[i] = new Point2D.Double(firstPoint.getX(), firstPoint.getY() + spacing * i);
|
||||
}
|
||||
|
||||
if (orientation != Orientation.DEFAULT) {
|
||||
AffineTransform xform = AffineTransform.getRotateInstance(orientation.toRadians(),
|
||||
firstPoint.getX(), firstPoint.getY());
|
||||
for (int i = 1; i < controlPoints.length; i++) {
|
||||
xform.transform(controlPoints[i], controlPoints[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point2D getControlPoint(int index) {
|
||||
return controlPoints[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isControlPointSticky(int index) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||
return VisibilityPolicy.NEVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getControlPointCount() {
|
||||
return controlPoints.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setControlPoint(Point2D point, int index) {
|
||||
controlPoints[index].setLocation(point);
|
||||
// Reset body shape.
|
||||
body = null;
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Pins")
|
||||
@Override
|
||||
public PCBTerminalBlockCount getValue() {
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(PCBTerminalBlockCount value) {
|
||||
this.count = value;
|
||||
updateControlPoints();
|
||||
// Reset body shape.
|
||||
body = null;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Orientation getOrientation() {
|
||||
if (orientation == null) {
|
||||
orientation = Orientation.DEFAULT;
|
||||
}
|
||||
return orientation;
|
||||
}
|
||||
|
||||
public void setOrientation(Orientation orientation) {
|
||||
this.orientation = orientation;
|
||||
updateControlPoints();
|
||||
// Reset body shape.
|
||||
body = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
|
||||
Project project, IDrawingObserver drawingObserver) {
|
||||
if (checkPointsClipped(g2d.getClip())) {
|
||||
return;
|
||||
}
|
||||
Shape[] body = getBody();
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY,
|
||||
Constants.DEFAULT_THEME);
|
||||
// Draw body if available.
|
||||
if (body != null) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(
|
||||
AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : getBodyColor());
|
||||
g2d.fill(body[0]);
|
||||
g2d.setComposite(oldComposite);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
Color finalBorderColor;
|
||||
if (outlineMode) {
|
||||
finalBorderColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||
? SELECTION_COLOR
|
||||
: theme.getOutlineColor();
|
||||
} else {
|
||||
g2d.setColor(getBorderColor());
|
||||
g2d.draw(body[1]);
|
||||
finalBorderColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||
? SELECTION_COLOR
|
||||
: getBorderColor();
|
||||
}
|
||||
g2d.setColor(finalBorderColor);
|
||||
g2d.draw(body[0]);
|
||||
}
|
||||
// Do not track these changes because the whole switch has been tracked
|
||||
// so far.
|
||||
drawingObserver.stopTracking();
|
||||
// Draw lugs.
|
||||
int circleDiameter = getClosestOdd((int) CIRCLE_SIZE.convertToPixels());
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2f));
|
||||
for (Point2D p : controlPoints) {
|
||||
if (outlineMode) {
|
||||
// g2d.setColor(Constants.TRANSPARENT_COLOR);
|
||||
// drawingObserver.startTrackingContinuityArea(true);
|
||||
// g2d.fillRect((int)(p.getX() - lugWidth / 2), (int)(p.getY() - lugHeight / 2), lugWidth,
|
||||
// lugHeight);
|
||||
// drawingObserver.stopTrackingContinuityArea();
|
||||
|
||||
g2d.setColor(theme.getOutlineColor());
|
||||
} else {
|
||||
g2d.setColor(CIRCLE_COLOR);
|
||||
g2d.fillOval((int) (p.getX() - circleDiameter / 2), (int) (p.getY() - circleDiameter / 2),
|
||||
circleDiameter, circleDiameter);
|
||||
|
||||
g2d.setColor(CIRCLE_COLOR.darker());
|
||||
g2d.drawLine((int) (p.getX() + Math.cos(Math.PI / 4) * circleDiameter / 2),
|
||||
(int) (p.getY() + Math.sin(Math.PI / 4) * circleDiameter / 2),
|
||||
(int) (p.getX() + Math.cos(5 * Math.PI / 4) * circleDiameter / 2),
|
||||
(int) (p.getY() + Math.sin(5 * Math.PI / 4) * circleDiameter / 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Shape[] getBody() {
|
||||
if (body == null) {
|
||||
body = new Shape[2];
|
||||
Point2D firstPoint = controlPoints[0];
|
||||
int spacing = (int) SPACING.convertToPixels();
|
||||
int pointCount = count.getCount();
|
||||
int width = (int) WIDTH.convertToPixels();
|
||||
int offset = (int) OFFSET.convertToPixels();
|
||||
|
||||
body[0] = new Rectangle2D.Double(firstPoint.getX() - offset, firstPoint.getY() - spacing / 2,
|
||||
width, pointCount * spacing);
|
||||
body[1] = new Rectangle2D.Double(firstPoint.getX() - spacing / 2, firstPoint.getY() - spacing / 2,
|
||||
spacing, pointCount * spacing);
|
||||
|
||||
if (orientation != Orientation.DEFAULT) {
|
||||
AffineTransform xform = AffineTransform.getRotateInstance(orientation.toRadians(),
|
||||
firstPoint.getX(), firstPoint.getY());
|
||||
Area b = new Area(body[0]);
|
||||
b.transform(xform);
|
||||
body[0] = b;
|
||||
|
||||
b = new Area(body[1]);
|
||||
b.transform(xform);
|
||||
body[1] = b;
|
||||
}
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||
int circleSize = 6 * width / 32;
|
||||
g2d.setColor(BODY_COLOR);
|
||||
g2d.fillRect((int) (width / 4d - 2), 1, width / 2, height - 2);
|
||||
g2d.setColor(BORDER_COLOR);
|
||||
g2d.drawRect((int) (width / 4d - 2), 1, width / 2, height - 2);
|
||||
g2d.drawRect((int) (width / 3d), 1, (int) (width / 3d), height - 2);
|
||||
for (int i = 1; i <= 3; i++) {
|
||||
g2d.setColor(CIRCLE_COLOR);
|
||||
g2d.fillOval(width / 2 - circleSize / 2, (int) (i * height / 4d - circleSize / 2), circleSize, circleSize);
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
// we don't want the block to produce any nodes, it just makes connections
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPointMoveFreely(int pointIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle2D getCachingBounds() {
|
||||
int margin = 20;
|
||||
Rectangle2D bounds = getBody()[0].getBounds2D();
|
||||
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin,
|
||||
bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||
}
|
||||
|
||||
static enum PCBTerminalBlockCount {
|
||||
_2("Two"), _3("Three"), _4("Four"), _5("Five"), _6("Six"), _7("Seven"), _8("Eight"), _9(
|
||||
"Nine"), _10("Ten");
|
||||
|
||||
private String label;
|
||||
|
||||
PCBTerminalBlockCount(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return Integer.parseInt(name().substring(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
/*
|
||||
*
|
||||
* 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.connectivity;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.awt.TwoCircleTangent;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.components.AbstractMultiPartComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.Theme;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Solder Lug", category = "Connectivity", author = "Branislav Stojkovic",
|
||||
description = "Locking terminal lug commonly used for chassis ground connections",
|
||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "SL", enableCache = true)
|
||||
public class SolderLug extends AbstractMultiPartComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static Color BASE_COLOR = Color.lightGray;
|
||||
|
||||
private static Size BODY_LARGE_DIAMETER = new Size(7.92d, SizeUnit.mm);
|
||||
private static Size BODY_SMALL_DIAMETER = new Size(3.66d, SizeUnit.mm);
|
||||
private static Size LARGE_HOLE_DIAMETER = new Size(3.66d, SizeUnit.mm);
|
||||
private static Size CENTER_TO_HOLE1 = new Size(8.4d, SizeUnit.mm);
|
||||
private static Size CENTER_TO_HOLE2 = new Size(10.4d, SizeUnit.mm);
|
||||
private static Size HOLE_DIAMETER = new Size(1.5d, SizeUnit.mm);
|
||||
|
||||
private String value = "";
|
||||
private Point2D[] controlPoints =
|
||||
new Point2D[] {new Point2D.Double(0, 0), new Point2D.Double(0, 0), new Point2D.Double(0, 0)};
|
||||
transient Area[] body;
|
||||
private Orientation orientation = Orientation.DEFAULT;
|
||||
|
||||
public SolderLug() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
|
||||
Project project, IDrawingObserver drawingObserver) {
|
||||
Shape[] body = getBody();
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BASE_COLOR);
|
||||
g2d.fill(body[0]);
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
Color finalBorderColor;
|
||||
|
||||
if (outlineMode) {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY,
|
||||
Constants.DEFAULT_THEME);
|
||||
finalBorderColor = theme.getOutlineColor();
|
||||
} else {
|
||||
finalBorderColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||
? SELECTION_COLOR
|
||||
: BASE_COLOR.darker();
|
||||
}
|
||||
|
||||
g2d.setColor(finalBorderColor);
|
||||
g2d.draw(body[0]);
|
||||
|
||||
g2d.setColor(Constants.TRANSPARENT_COLOR);
|
||||
drawingObserver.startTrackingContinuityArea(true);
|
||||
g2d.fill(body[1]);
|
||||
drawingObserver.stopTrackingContinuityArea();
|
||||
}
|
||||
|
||||
public Area[] getBody() {
|
||||
if (body == null) {
|
||||
body = new Area[2];
|
||||
|
||||
int bodyLargeDiameter = getClosestOdd(BODY_LARGE_DIAMETER.convertToPixels());
|
||||
int bodySmallDiameter = getClosestOdd(BODY_SMALL_DIAMETER.convertToPixels());
|
||||
int largeHoleDiameter = getClosestOdd(LARGE_HOLE_DIAMETER.convertToPixels());
|
||||
int holeDiameter = getClosestOdd(HOLE_DIAMETER.convertToPixels());
|
||||
|
||||
Area area = new TwoCircleTangent(controlPoints[0], controlPoints[2], bodyLargeDiameter / 2,
|
||||
bodySmallDiameter / 2);
|
||||
|
||||
Area conductivityMask = new Area(area);
|
||||
|
||||
area.subtract(new Area(new Ellipse2D.Double(controlPoints[1].getX() - holeDiameter / 2, controlPoints[1].getY() - holeDiameter / 2,
|
||||
holeDiameter, holeDiameter)));
|
||||
area.subtract(new Area(new Ellipse2D.Double(controlPoints[2].getX() - holeDiameter / 2, controlPoints[2].getY() - holeDiameter / 2,
|
||||
holeDiameter, holeDiameter)));
|
||||
|
||||
area.subtract(new Area(new Ellipse2D.Double(controlPoints[0].getX() - largeHoleDiameter / 2,
|
||||
controlPoints[0].getY() - largeHoleDiameter / 2, largeHoleDiameter, largeHoleDiameter)));
|
||||
|
||||
body[0] = area;
|
||||
body[1] = conductivityMask;
|
||||
}
|
||||
|
||||
return body;
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
private void updateControlPoints() {
|
||||
double x = controlPoints[0].getX();
|
||||
double y = controlPoints[0].getY();
|
||||
|
||||
int centerToHole1 = (int) CENTER_TO_HOLE1.convertToPixels();
|
||||
int centerToHole2 = (int) CENTER_TO_HOLE2.convertToPixels();
|
||||
|
||||
double centerY1 = y + centerToHole1;
|
||||
double centerY2 = y + centerToHole2;
|
||||
|
||||
controlPoints[1].setLocation(x, centerY1);
|
||||
controlPoints[2].setLocation(x, centerY2);
|
||||
|
||||
// Rotate if needed
|
||||
if (orientation != Orientation.DEFAULT) {
|
||||
double theta = 0;
|
||||
switch (orientation) {
|
||||
case _90:
|
||||
theta = Math.PI / 2;
|
||||
break;
|
||||
case _180:
|
||||
theta = Math.PI;
|
||||
break;
|
||||
case _270:
|
||||
theta = Math.PI * 3 / 2;
|
||||
break;
|
||||
}
|
||||
|
||||
AffineTransform rotation = AffineTransform.getRotateInstance(theta, x, y);
|
||||
rotation.transform(controlPoints[1], controlPoints[1]);
|
||||
rotation.transform(controlPoints[2], controlPoints[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||
double x0 = width * 0.35;
|
||||
double y0 = height * 0.65;
|
||||
double x1 = width * 0.75;
|
||||
double y1 = height * 0.25;
|
||||
|
||||
TwoCircleTangent main = new TwoCircleTangent(new Point2D.Double(x0, y0),
|
||||
new Point2D.Double(x1, y1), width * 0.28, width * 0.12);
|
||||
|
||||
main.subtract(new Area(new Ellipse2D.Double(x0 - 3, y0 - 3, 7, 7)));
|
||||
main.subtract(new Area(new Ellipse2D.Double(x1 - 2, y1 - 1, 3, 3)));
|
||||
main.subtract(new Area(new Ellipse2D.Double(x1 - 6, y1 + 3, 3, 3)));
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
|
||||
g2d.setColor(BASE_COLOR);
|
||||
g2d.fill(main);
|
||||
g2d.setColor(BASE_COLOR.darker());
|
||||
g2d.draw(main);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getControlPointCount() {
|
||||
return controlPoints.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||
return VisibilityPolicy.NEVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isControlPointSticky(int index) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point2D getControlPoint(int index) {
|
||||
return controlPoints[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setControlPoint(Point2D point, int index) {
|
||||
this.controlPoints[index].setLocation(point);
|
||||
// Invalidate the body
|
||||
body = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Orientation getOrientation() {
|
||||
return orientation;
|
||||
}
|
||||
|
||||
public void setOrientation(Orientation orientation) {
|
||||
this.orientation = orientation;
|
||||
updateControlPoints();
|
||||
// Invalidate the body
|
||||
body = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
return getName() + (index == 0 ? "Tip" : "Sleeve");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPointMoveFreely(int pointIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle2D getCachingBounds() {
|
||||
int margin = 20;
|
||||
Rectangle2D bounds = getBody()[0].getBounds2D();
|
||||
return new Rectangle2D.Double(bounds.getX() - margin, bounds.getY() - margin,
|
||||
bounds.getWidth() + 2 * margin, bounds.getHeight() + 2 * margin);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Integer getFontSizeOverride() {
|
||||
return super.getFontSizeOverride();
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import org.diylc.components.transform.SimpleComponentTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
import org.diylc.core.ILayer;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.BomPolicy;
|
||||
@@ -47,7 +48,7 @@ import org.diylc.utils.Constants;
|
||||
description = "Designates the place where a trace on the vero board needs to be cut", instanceNamePrefix = "Cut",
|
||||
zOrder = IDIYComponent.BOARD + 1, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||
transformer = SimpleComponentTransformer.class, enableCache = true)
|
||||
public class TraceCut extends AbstractComponent<Void> {
|
||||
public class TraceCut extends AbstractComponent<Void> implements ILayer {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -253,4 +254,9 @@ public class TraceCut extends AbstractComponent<Void> {
|
||||
double size = getSize().convertToPixels();
|
||||
return new Rectangle2D.Double(point.getX() - size, point.getY() - size, size * 2, size * 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayerId() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Area;
|
||||
@@ -57,7 +58,7 @@ import org.diylc.utils.Constants;
|
||||
description = "Cliff-style closed panel mount 1/4\" phono jack",
|
||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", autoEdit = false, transformer = CliffJackTransformer.class,
|
||||
enableCache = true)
|
||||
public class CliffJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
public class CliffJack1_4 extends AbstractMultiPartComponent<JackType> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -76,7 +77,9 @@ public class CliffJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
private JackType type = JackType.MONO;
|
||||
private Orientation orientation = Orientation.DEFAULT;
|
||||
transient private Area[] body;
|
||||
private String value = "";
|
||||
@SuppressWarnings("unused")
|
||||
@Deprecated
|
||||
private transient String value = "";
|
||||
|
||||
public CliffJack1_4() {
|
||||
super();
|
||||
@@ -288,6 +291,16 @@ public class CliffJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
g2d.drawLine(pinX1, width * 5 / 8, pinX1, width * 6 / 8);
|
||||
g2d.drawLine(pinX2, width * 2 / 8, pinX2, width * 3 / 8);
|
||||
g2d.drawLine(pinX2, width * 5 / 8, pinX2, width * 6 / 8);
|
||||
|
||||
g2d.setColor(LABEL_COLOR);
|
||||
g2d.setFont(LABEL_FONT.deriveFont(width / 3.5f));
|
||||
|
||||
RenderingHints rh = new RenderingHints(
|
||||
RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||
g2d.setRenderingHints(rh);
|
||||
|
||||
StringUtils.drawCenteredText(g2d, "6.3", width / 2 - 1, height / 2, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -316,23 +329,12 @@ public class CliffJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
return VisibilityPolicy.NEVER;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public JackType getType() {
|
||||
@EditableProperty(name = "Type")
|
||||
public JackType getValue() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(JackType type) {
|
||||
public void setValue(JackType type) {
|
||||
this.type = type;
|
||||
updateControlPoints();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,379 @@
|
||||
/*
|
||||
*
|
||||
* 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.Color;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Area;
|
||||
import java.awt.geom.GeneralPath;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.awt.StringUtils;
|
||||
import org.diylc.common.HorizontalAlignment;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.common.VerticalAlignment;
|
||||
import org.diylc.components.AbstractMultiPartComponent;
|
||||
import org.diylc.components.transform.CliffJackTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
import org.diylc.core.Project;
|
||||
import org.diylc.core.Theme;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Cliff 1/8\" Jack", category = "Electro-Mechanical",
|
||||
author = "Branislav Stojkovic", description = "Cliff-style closed 1/8\" phono jack",
|
||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", autoEdit = false,
|
||||
transformer = CliffJackTransformer.class, enableCache = true)
|
||||
public class CliffJack1_8 extends AbstractMultiPartComponent<JackType> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static Size ROW_SPACING = new Size(9.4d, SizeUnit.mm);
|
||||
private static Size PIN_SPACING = new Size(3.8d, SizeUnit.mm);
|
||||
private static Size PIN_WIDTH = new Size(1d, SizeUnit.mm);
|
||||
private static Size PIN_THICKNESS = new Size(0.02d, SizeUnit.in);
|
||||
private static Color BODY_COLOR = Color.decode("#666666");
|
||||
private static Color BORDER_COLOR = Color.black;
|
||||
private static Color LABEL_COLOR = Color.white;
|
||||
private static Size BODY_WIDTH = new Size(10.8d, SizeUnit.mm);
|
||||
private static Size BODY_LENGTH_MONO = new Size(8.6d, SizeUnit.mm);
|
||||
private static Size BODY_LENGTH_STEREO = new Size(12.4d, SizeUnit.mm);
|
||||
private static Size SHAFT_LENGTH_W_NUT = new Size(5d, SizeUnit.mm);
|
||||
private static Size SHAFT_LENGTH_NO_NUT = new Size(2d, SizeUnit.mm);
|
||||
private static Size SHAFT_DIA_W_NUT = new Size(8d, SizeUnit.mm);
|
||||
private static Size SHAFT_DIA_NO_NUT = new Size(7d, SizeUnit.mm);
|
||||
|
||||
private Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0)};
|
||||
private JackType type = JackType.MONO;
|
||||
private Orientation orientation = Orientation.DEFAULT;
|
||||
transient private Shape[] body;
|
||||
private boolean nut = false;
|
||||
|
||||
public CliffJack1_8() {
|
||||
super();
|
||||
updateControlPoints();
|
||||
}
|
||||
|
||||
private void updateControlPoints() {
|
||||
// invalidate body shape
|
||||
body = null;
|
||||
double x = controlPoints[0].getX();
|
||||
double y = controlPoints[0].getY();
|
||||
int rowSpacing = (int) ROW_SPACING.convertToPixels();
|
||||
int pinSpacing = (int) PIN_SPACING.convertToPixels();
|
||||
controlPoints = new Point2D[type == JackType.STEREO ? 6 : 4];
|
||||
|
||||
controlPoints[0] = new Point2D.Double(x, y);
|
||||
controlPoints[1] = new Point2D.Double(x, y + rowSpacing);
|
||||
controlPoints[2] = new Point2D.Double(x + pinSpacing, y);
|
||||
controlPoints[3] = new Point2D.Double(x + pinSpacing, y + rowSpacing);
|
||||
if (type == JackType.STEREO) {
|
||||
controlPoints[4] = new Point2D.Double(x + 2 * pinSpacing, y);
|
||||
controlPoints[5] = new Point2D.Double(x + 2 * pinSpacing, y + rowSpacing);
|
||||
}
|
||||
|
||||
// Apply rotation if necessary
|
||||
double angle = getAngle();
|
||||
if (angle != 0) {
|
||||
AffineTransform rotation = AffineTransform.getRotateInstance(angle, x, y);
|
||||
for (int i = 1; i < controlPoints.length; i++) {
|
||||
rotation.transform(controlPoints[i], controlPoints[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private double getAngle() {
|
||||
// Apply rotation if necessary
|
||||
double angle;
|
||||
switch (orientation) {
|
||||
case _90:
|
||||
angle = Math.PI / 2;
|
||||
break;
|
||||
case _180:
|
||||
angle = Math.PI;
|
||||
break;
|
||||
case _270:
|
||||
angle = Math.PI * 3 / 2;
|
||||
break;
|
||||
default:
|
||||
angle = 0;
|
||||
}
|
||||
|
||||
return angle;
|
||||
}
|
||||
|
||||
public Shape[] getBody() {
|
||||
if (body == null) {
|
||||
body = new Shape[4];
|
||||
|
||||
// Create body.
|
||||
double bodyLength =
|
||||
(type == JackType.MONO ? BODY_LENGTH_MONO : BODY_LENGTH_STEREO).convertToPixels();
|
||||
double bodyWidth = BODY_WIDTH.convertToPixels();
|
||||
int shaftLength = (int) (nut ? SHAFT_LENGTH_W_NUT : SHAFT_LENGTH_NO_NUT).convertToPixels();
|
||||
int shaftWidth = (int) (nut ? SHAFT_DIA_W_NUT : SHAFT_DIA_NO_NUT).convertToPixels();
|
||||
double centerX =
|
||||
(controlPoints[0].getX() + controlPoints[controlPoints.length - 1].getX()) / 2;
|
||||
double centerY =
|
||||
(controlPoints[0].getY() + controlPoints[controlPoints.length - 1].getY()) / 2;
|
||||
|
||||
body[0] = new Area(new Rectangle2D.Double(centerX - bodyLength / 2, centerY - bodyWidth / 2,
|
||||
bodyLength, bodyWidth));
|
||||
|
||||
body[1] = new Area(new Rectangle2D.Double(centerX + bodyLength / 2, centerY - shaftWidth / 2,
|
||||
shaftLength, shaftWidth));
|
||||
|
||||
// Apply rotation if necessary
|
||||
AffineTransform rotation = null;
|
||||
double angle = getAngle();
|
||||
if (angle != 0) {
|
||||
rotation = AffineTransform.getRotateInstance(angle, centerX, centerY);
|
||||
for (int i = 0; i < body.length; i++) {
|
||||
if (body[i] != null) {
|
||||
Area area = new Area(body[i]);
|
||||
area.transform(rotation);
|
||||
body[i] = area;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GeneralPath path = new GeneralPath();
|
||||
int step = 4;
|
||||
for (double i = centerX + bodyLength / 2 + step; i <= centerX + bodyLength / 2
|
||||
+ shaftLength; i += step) {
|
||||
Point2D p = new Point2D.Double(i, centerY - shaftWidth / 2 + 1);
|
||||
if (rotation != null) {
|
||||
rotation.transform(p, p);
|
||||
}
|
||||
path.moveTo(p.getX(), p.getY());
|
||||
p = new Point2D.Double(i - step, centerY + shaftWidth / 2 - 1);
|
||||
if (rotation != null) {
|
||||
rotation.transform(p, p);
|
||||
}
|
||||
path.lineTo(p.getX(), p.getY());
|
||||
}
|
||||
body[2] = path;
|
||||
|
||||
// Create pins.
|
||||
Area pins = new Area();
|
||||
|
||||
int pinWidth = (int) PIN_WIDTH.convertToPixels();
|
||||
int pinThickness = (int) PIN_THICKNESS.convertToPixels();
|
||||
for (int i = 0; i < getControlPointCount(); i++) {
|
||||
Point2D point = getControlPoint(i);
|
||||
Rectangle2D pin;
|
||||
if (orientation == Orientation.DEFAULT || orientation == Orientation._180) {
|
||||
pin = new Rectangle2D.Double(point.getX() - pinWidth / 2, point.getY() - pinThickness / 2,
|
||||
pinWidth, pinThickness);
|
||||
} else {
|
||||
pin = new Rectangle2D.Double(point.getX() - pinThickness / 2, point.getY() - pinWidth / 2,
|
||||
pinThickness, pinWidth);
|
||||
}
|
||||
pins.add(new Area(pin));
|
||||
}
|
||||
|
||||
body[3] = pins;
|
||||
}
|
||||
return body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
|
||||
Project project, IDrawingObserver drawingObserver) {
|
||||
Shape[] body = getBody();
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
// if (componentState != ComponentState.DRAGGING) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BODY_COLOR);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
g2d.fill(body[i]);
|
||||
}
|
||||
g2d.setComposite(oldComposite);
|
||||
// }
|
||||
|
||||
if (nut) {
|
||||
g2d.setColor(BORDER_COLOR);
|
||||
g2d.draw(body[2]);
|
||||
}
|
||||
|
||||
Color finalBorderColor;
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY,
|
||||
Constants.DEFAULT_THEME);
|
||||
if (outlineMode) {
|
||||
finalBorderColor = theme.getOutlineColor();
|
||||
} else {
|
||||
finalBorderColor = BORDER_COLOR;
|
||||
}
|
||||
|
||||
drawingObserver.stopTracking();
|
||||
|
||||
g2d.setColor(finalBorderColor);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
g2d.draw(body[i]);
|
||||
}
|
||||
|
||||
// Pins are the last piece.
|
||||
Shape pins = body[body.length - 1];
|
||||
if (!outlineMode) {
|
||||
g2d.setColor(METAL_COLOR);
|
||||
g2d.fill(pins);
|
||||
}
|
||||
g2d.setColor(outlineMode ? theme.getOutlineColor() : METAL_COLOR.darker());
|
||||
g2d.draw(pins);
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
finalLabelColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||
? LABEL_COLOR_SELECTED
|
||||
: theme.getOutlineColor();
|
||||
} else {
|
||||
finalLabelColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||
? LABEL_COLOR_SELECTED
|
||||
: LABEL_COLOR;
|
||||
}
|
||||
g2d.setColor(finalLabelColor);
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
// Override font size
|
||||
if (getFontSizeOverride() != null)
|
||||
g2d.setFont(g2d.getFont().deriveFont(1f * getFontSizeOverride()));
|
||||
|
||||
double centerX = (controlPoints[0].getX() + controlPoints[controlPoints.length - 1].getX()) / 2;
|
||||
double centerY = (controlPoints[0].getY() + controlPoints[controlPoints.length - 1].getY()) / 2;
|
||||
StringUtils.drawCenteredText(g2d, name, centerX, centerY, HorizontalAlignment.CENTER,
|
||||
VerticalAlignment.CENTER);
|
||||
|
||||
drawSelectionOutline(g2d, componentState, outlineMode, project, drawingObserver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||
int bodyWidth = getClosestOdd(width * 3 / 5);
|
||||
int tailWidth = getClosestOdd(width * 3 / 9);
|
||||
|
||||
g2d.setColor(BODY_COLOR);
|
||||
g2d.fillRect((width - tailWidth) / 2, 2 * 32 / height, tailWidth, height / 2);
|
||||
g2d.setColor(BORDER_COLOR);
|
||||
g2d.drawRect((width - tailWidth) / 2, 2 * 32 / height, tailWidth, height / 2);
|
||||
|
||||
g2d.setColor(BODY_COLOR);
|
||||
g2d.fillRect((width - bodyWidth) / 2, height / 7 + 1, bodyWidth, height * 5 / 7);
|
||||
g2d.setColor(BORDER_COLOR);
|
||||
g2d.drawRect((width - bodyWidth) / 2, height / 7 + 1, bodyWidth, height * 5 / 7);
|
||||
|
||||
g2d.setColor(METAL_COLOR);
|
||||
int pinX1 = getClosestOdd((width - bodyWidth * 3 / 4) / 2);
|
||||
int pinX2 = getClosestOdd((width + bodyWidth * 3 / 4) / 2) - 1;
|
||||
g2d.drawLine(pinX1, width * 4 / 16, pinX1, width * 5 / 16);
|
||||
g2d.drawLine(pinX1, width * 11 / 16, pinX1, width * 12 / 16);
|
||||
g2d.drawLine(pinX2, width * 4 / 16, pinX2, width * 5 / 16);
|
||||
g2d.drawLine(pinX2, width * 11 / 16, pinX2, width * 12 / 16);
|
||||
|
||||
g2d.setColor(LABEL_COLOR);
|
||||
g2d.setFont(LABEL_FONT.deriveFont(width / 3.5f));
|
||||
|
||||
RenderingHints rh = new RenderingHints(
|
||||
RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||
g2d.setRenderingHints(rh);
|
||||
|
||||
StringUtils.drawCenteredText(g2d, "3.5", width / 2 - 1, height / 2, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getControlPointCount() {
|
||||
return controlPoints.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point2D getControlPoint(int index) {
|
||||
return controlPoints[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setControlPoint(Point2D point, int index) {
|
||||
controlPoints[index].setLocation(point);
|
||||
body = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isControlPointSticky(int index) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisibilityPolicy getControlPointVisibilityPolicy(int index) {
|
||||
return VisibilityPolicy.NEVER;
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Type")
|
||||
public JackType getValue() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setValue(JackType type) {
|
||||
this.type = type;
|
||||
updateControlPoints();
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public boolean getNut() {
|
||||
return nut;
|
||||
}
|
||||
|
||||
public void setNut(boolean nut) {
|
||||
this.nut = nut;
|
||||
this.body = null;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Orientation getOrientation() {
|
||||
return orientation;
|
||||
}
|
||||
|
||||
public void setOrientation(Orientation orientation) {
|
||||
this.orientation = orientation;
|
||||
updateControlPoints();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPointMoveFreely(int pointIndex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import java.awt.Color;
|
||||
import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Area;
|
||||
@@ -57,7 +58,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Closed 1/4\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||
description = "Enclosed panel mount 1/4\" phono jack", zOrder = IDIYComponent.COMPONENT,
|
||||
instanceNamePrefix = "J", autoEdit = false, transformer = ClosedJackTransformer.class, enableCache = true)
|
||||
public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
public class ClosedJack1_4 extends AbstractMultiPartComponent<JackType> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -78,7 +79,9 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
private JackType type = JackType.MONO;
|
||||
private Orientation orientation = Orientation.DEFAULT;
|
||||
transient private Shape[] body;
|
||||
private String value = "";
|
||||
@SuppressWarnings("unused")
|
||||
@Deprecated
|
||||
private transient String value = "";
|
||||
|
||||
public ClosedJack1_4() {
|
||||
super();
|
||||
@@ -299,6 +302,16 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
|
||||
g2d.fillRect(width * 7 / 16, height * 6 / 7 + 1, width / 8, height / 7 - 1);
|
||||
g2d.fillRect(width * 7 / 16, height / 7 + 2, width / 8, height / 7 - 1);
|
||||
|
||||
g2d.setColor(LABEL_COLOR);
|
||||
g2d.setFont(LABEL_FONT.deriveFont(width / 3.5f));
|
||||
|
||||
RenderingHints rh = new RenderingHints(
|
||||
RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||
g2d.setRenderingHints(rh);
|
||||
|
||||
StringUtils.drawCenteredText(g2d, "6.3", width / 2 - 1, height / 2, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -327,23 +340,12 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
return VisibilityPolicy.NEVER;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public JackType getType() {
|
||||
@EditableProperty(name = "Type")
|
||||
public JackType getValue() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(JackType type) {
|
||||
public void setValue(JackType type) {
|
||||
this.type = type;
|
||||
updateControlPoints();
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ import org.diylc.utils.Constants;
|
||||
description = "1/4\" mono/stereo phono jack based on Neutrik NMJx series, PCB or Panel-mount",
|
||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", autoEdit = false, transformer = NeutrikJack1_4Transformer.class,
|
||||
enableCache = true)
|
||||
public class NeutrikJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
public class NeutrikJack1_4 extends AbstractMultiPartComponent<JackType> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -81,7 +81,10 @@ public class NeutrikJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
private Mount mount = Mount.Panel;
|
||||
private Orientation orientation = Orientation.DEFAULT;
|
||||
transient private Area[] body;
|
||||
private String value = "";
|
||||
@SuppressWarnings("unused")
|
||||
@Deprecated
|
||||
private transient String value = "";
|
||||
|
||||
|
||||
public NeutrikJack1_4() {
|
||||
super();
|
||||
@@ -330,23 +333,12 @@ public class NeutrikJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
return VisibilityPolicy.NEVER;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public JackType getType() {
|
||||
@EditableProperty(name = "Type")
|
||||
public JackType getValue() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(JackType type) {
|
||||
public void setValue(JackType type) {
|
||||
this.type = type;
|
||||
updateControlPoints();
|
||||
}
|
||||
|
||||
@@ -51,11 +51,12 @@ import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
import org.diylc.components.electromechanical.OpenJack1_4.OpenJackType;
|
||||
|
||||
@ComponentDescriptor(name = "Open 1/4\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||
description = "Switchcraft-style open panel mount 1/4\" phono jack, stereo and mono",
|
||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", enableCache = true)
|
||||
public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
public class OpenJack1_4 extends AbstractMultiPartComponent<OpenJackType> {
|
||||
|
||||
private static final float FONT_SCALE = 0.8f;
|
||||
private static final double RING_THETA = Math.PI * 0.795;
|
||||
@@ -76,7 +77,9 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
private static Size HOLE_DIAMETER = new Size(0.05d, SizeUnit.in);
|
||||
private static Size HOLE_TO_EDGE = new Size(0.063d, SizeUnit.in);
|
||||
|
||||
private String value = "";
|
||||
@SuppressWarnings("unused")
|
||||
@Deprecated
|
||||
private transient String value = "";
|
||||
private Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0), new Point2D.Double(0, 0), new Point2D.Double(0, 0)};
|
||||
transient Area[] body;
|
||||
@Deprecated
|
||||
@@ -163,8 +166,8 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
int holeToEdge = (int) HOLE_TO_EDGE.convertToPixels();
|
||||
double centerY = controlPoints[0].getY() + springLength - holeToEdge;
|
||||
Point2D tipLabel = new Point2D.Double(controlPoints[0].getX(), (int) (controlPoints[0].getY() + holeToEdge * 1.25));
|
||||
AffineTransform ringTransform = AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, controlPoints[0].getX(), centerY);
|
||||
AffineTransform sleeveTransform = AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, controlPoints[0].getX(), centerY);
|
||||
AffineTransform ringTransform = AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, controlPoints[0].getX(), centerY);
|
||||
AffineTransform sleeveTransform = AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, controlPoints[0].getX(), centerY);
|
||||
Point2D ringOrSwitchLabel = new Point2D.Double(0, 0);
|
||||
Point2D sleeveLabel = new Point2D.Double(0, 0);
|
||||
ringTransform.transform(tipLabel, ringOrSwitchLabel);
|
||||
@@ -178,9 +181,9 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
}
|
||||
StringUtils.drawCenteredText(g2d, "T", tipLabel.getX(), tipLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
StringUtils.drawCenteredText(g2d, "S", sleeveLabel.getX(), sleeveLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
if (getType() == OpenJackType.STEREO)
|
||||
if (getValue() == OpenJackType.STEREO)
|
||||
StringUtils.drawCenteredText(g2d, "R", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
if (getType() == OpenJackType.SWITCHED)
|
||||
if (getValue() == OpenJackType.SWITCHED)
|
||||
StringUtils.drawCenteredText(g2d, "Sw", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
|
||||
@@ -225,7 +228,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
springWidth, springWidth));
|
||||
sleeve.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter,
|
||||
holeDiameter)));
|
||||
sleeve.transform(AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY));
|
||||
sleeve.transform(AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY));
|
||||
sleeve.add(new Area(new Ellipse2D.Double(x - ringDiameter / 2, centerY - ringDiameter / 2, ringDiameter,
|
||||
ringDiameter)));
|
||||
sleeve.subtract(new Area(new Ellipse2D.Double(x - innerDiameter / 2, centerY - innerDiameter / 2, innerDiameter,
|
||||
@@ -233,13 +236,13 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
|
||||
body[2] = sleeve;
|
||||
|
||||
if (getType() != OpenJackType.MONO) {
|
||||
if (getValue() != OpenJackType.MONO) {
|
||||
Area ringOrSwitch =
|
||||
new Area(new RoundRectangle2D.Double(x - springWidth / 2, y - holeToEdge, springWidth, springLength,
|
||||
springWidth, springWidth));
|
||||
ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter,
|
||||
holeDiameter)));
|
||||
ringOrSwitch.transform(AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY));
|
||||
ringOrSwitch.transform(AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY));
|
||||
ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - outerDiameter / 2, centerY - outerDiameter / 2, outerDiameter,
|
||||
outerDiameter)));
|
||||
|
||||
@@ -272,8 +275,8 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
|
||||
double centerY = y + springLength - holeToEdge;
|
||||
|
||||
AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY).transform(controlPoints[0], controlPoints[1]);
|
||||
AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY).transform(controlPoints[0], controlPoints[2]);
|
||||
AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY).transform(controlPoints[0], controlPoints[1]);
|
||||
AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY).transform(controlPoints[0], controlPoints[2]);
|
||||
|
||||
// Rotate if needed
|
||||
if (getTheta() != 0) {
|
||||
@@ -322,7 +325,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||
g2d.setRenderingHints(rh);
|
||||
|
||||
StringUtils.drawCenteredText(g2d, "1/4\"", width / 2, height / 2, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
StringUtils.drawCenteredText(g2d, "6.3", width / 2 - 1, height / 2, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -337,7 +340,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
|
||||
@Override
|
||||
public boolean isControlPointSticky(int index) {
|
||||
return index < 2 || (getType() == OpenJackType.STEREO || getType() == OpenJackType.SWITCHED);
|
||||
return index < 2 || (getValue() == OpenJackType.STEREO || getValue() == OpenJackType.SWITCHED);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -352,16 +355,6 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
body = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Integer getAngle() {
|
||||
if (angle == null || (orientation != null && orientation != Orientation.DEFAULT)) {
|
||||
@@ -384,12 +377,12 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
return Math.toRadians(getAngle());
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public OpenJackType getType() {
|
||||
@EditableProperty(name = "Type")
|
||||
public OpenJackType getValue() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(OpenJackType type) {
|
||||
public void setValue(OpenJackType type) {
|
||||
this.type = type;
|
||||
updateControlPoints();
|
||||
// Invalidate the body
|
||||
@@ -411,9 +404,9 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
return "Tip";
|
||||
if (index == 1)
|
||||
return "Sleeve";
|
||||
if (index == 2 && getType() == OpenJackType.STEREO)
|
||||
if (index == 2 && getValue() == OpenJackType.STEREO)
|
||||
return "Ring";
|
||||
if (index == 2 && getType() == OpenJackType.SWITCHED)
|
||||
if (index == 2 && getValue() == OpenJackType.SWITCHED)
|
||||
return "Shunt";
|
||||
return null;
|
||||
}
|
||||
@@ -423,7 +416,7 @@ public class OpenJack1_4 extends AbstractMultiPartComponent<String> {
|
||||
return false;
|
||||
}
|
||||
|
||||
public enum OpenJackType {
|
||||
public static enum OpenJackType {
|
||||
|
||||
MONO, STEREO, SWITCHED;
|
||||
|
||||
|
||||
@@ -51,11 +51,12 @@ import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
import org.diylc.components.electromechanical.OpenJack1_8.OpenJackType;
|
||||
|
||||
@ComponentDescriptor(name = "Open 1/8\" Jack", category = "Electro-Mechanical", author = "Branislav Stojkovic",
|
||||
description = "Switchcraft-style open panel mount 1/8\" phono jack, stereo and mono",
|
||||
zOrder = IDIYComponent.COMPONENT, instanceNamePrefix = "J", enableCache = true)
|
||||
public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
public class OpenJack1_8 extends AbstractMultiPartComponent<OpenJackType> {
|
||||
|
||||
private static final float FONT_SCALE = 0.6f;
|
||||
private static final double RING_THETA = Math.PI * 0.795;
|
||||
@@ -76,7 +77,9 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
private static Size HOLE_DIAMETER = new Size(0.025d, SizeUnit.in);
|
||||
private static Size HOLE_TO_EDGE = new Size(0.0315d, SizeUnit.in);
|
||||
|
||||
private String value = "";
|
||||
@SuppressWarnings("unused")
|
||||
@Deprecated
|
||||
private transient String value = "";
|
||||
private Point2D[] controlPoints = new Point2D[] {new Point2D.Double(0, 0), new Point2D.Double(0, 0), new Point2D.Double(0, 0)};
|
||||
transient Area[] body;
|
||||
@Deprecated
|
||||
@@ -163,8 +166,8 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
int holeToEdge = (int) HOLE_TO_EDGE.convertToPixels();
|
||||
double centerY = controlPoints[0].getY() + springLength - holeToEdge;
|
||||
Point2D tipLabel = new Point2D.Double(controlPoints[0].getX(), (int) (controlPoints[0].getY() + holeToEdge * 1.25));
|
||||
AffineTransform ringTransform = AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, controlPoints[0].getX(), centerY);
|
||||
AffineTransform sleeveTransform = AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, controlPoints[0].getX(), centerY);
|
||||
AffineTransform ringTransform = AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, controlPoints[0].getX(), centerY);
|
||||
AffineTransform sleeveTransform = AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, controlPoints[0].getX(), centerY);
|
||||
Point2D ringOrSwitchLabel = new Point2D.Double(0, 0);
|
||||
Point2D sleeveLabel = new Point2D.Double(0, 0);
|
||||
ringTransform.transform(tipLabel, ringOrSwitchLabel);
|
||||
@@ -178,9 +181,9 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
}
|
||||
StringUtils.drawCenteredText(g2d, "T", tipLabel.getX(), tipLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
StringUtils.drawCenteredText(g2d, "S", sleeveLabel.getX(), sleeveLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
if (getType() == OpenJackType.STEREO)
|
||||
if (getValue() == OpenJackType.STEREO)
|
||||
StringUtils.drawCenteredText(g2d, "R", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
if (getType() == OpenJackType.SWITCHED)
|
||||
if (getValue() == OpenJackType.SWITCHED)
|
||||
StringUtils.drawCenteredText(g2d, "Sw", ringOrSwitchLabel.getX(), ringOrSwitchLabel.getY(), HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
|
||||
@@ -225,7 +228,7 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
springWidth, springWidth));
|
||||
sleeve.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter,
|
||||
holeDiameter)));
|
||||
sleeve.transform(AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY));
|
||||
sleeve.transform(AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY));
|
||||
sleeve.add(new Area(new Ellipse2D.Double(x - ringDiameter / 2, centerY - ringDiameter / 2, ringDiameter,
|
||||
ringDiameter)));
|
||||
sleeve.subtract(new Area(new Ellipse2D.Double(x - innerDiameter / 2, centerY - innerDiameter / 2, innerDiameter,
|
||||
@@ -233,13 +236,13 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
|
||||
body[2] = sleeve;
|
||||
|
||||
if (getType() != OpenJackType.MONO) {
|
||||
if (getValue() != OpenJackType.MONO) {
|
||||
Area ringOrSwitch =
|
||||
new Area(new RoundRectangle2D.Double(x - springWidth / 2, y - holeToEdge, springWidth, springLength,
|
||||
springWidth, springWidth));
|
||||
ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - holeDiameter / 2, y - holeDiameter / 2, holeDiameter,
|
||||
holeDiameter)));
|
||||
ringOrSwitch.transform(AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY));
|
||||
ringOrSwitch.transform(AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY));
|
||||
ringOrSwitch.subtract(new Area(new Ellipse2D.Double(x - outerDiameter / 2, centerY - outerDiameter / 2, outerDiameter,
|
||||
outerDiameter)));
|
||||
|
||||
@@ -272,8 +275,8 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
|
||||
double centerY = y + springLength - holeToEdge;
|
||||
|
||||
AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY).transform(controlPoints[0], controlPoints[1]);
|
||||
AffineTransform.getRotateInstance(getType() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY).transform(controlPoints[0], controlPoints[2]);
|
||||
AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SLEEVE_SWITCHED_THETA : SLEEVE_THETA, x, centerY).transform(controlPoints[0], controlPoints[1]);
|
||||
AffineTransform.getRotateInstance(getValue() == OpenJackType.SWITCHED ? SWITCH_THETA : RING_THETA, x, centerY).transform(controlPoints[0], controlPoints[2]);
|
||||
|
||||
// Rotate if needed
|
||||
if (getTheta() != 0) {
|
||||
@@ -322,7 +325,7 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
|
||||
g2d.setRenderingHints(rh);
|
||||
|
||||
StringUtils.drawCenteredText(g2d, "1/8\"", width / 2 - 1, height / 2, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
StringUtils.drawCenteredText(g2d, "3.5", width / 2 - 1, height / 2, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -337,7 +340,7 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
|
||||
@Override
|
||||
public boolean isControlPointSticky(int index) {
|
||||
return index < 2 || (getType() == OpenJackType.STEREO || getType() == OpenJackType.SWITCHED);
|
||||
return index < 2 || (getValue() == OpenJackType.STEREO || getValue() == OpenJackType.SWITCHED);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -352,16 +355,6 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
body = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Integer getAngle() {
|
||||
if (angle == null || (orientation != null && orientation != Orientation.DEFAULT)) {
|
||||
@@ -384,12 +377,12 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
return Math.toRadians(getAngle());
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public OpenJackType getType() {
|
||||
@EditableProperty(name = "Type")
|
||||
public OpenJackType getValue() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(OpenJackType type) {
|
||||
public void setValue(OpenJackType type) {
|
||||
this.type = type;
|
||||
updateControlPoints();
|
||||
// Invalidate the body
|
||||
@@ -411,9 +404,9 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
return "Tip";
|
||||
if (index == 1)
|
||||
return "Sleeve";
|
||||
if (index == 2 && getType() == OpenJackType.STEREO)
|
||||
if (index == 2 && getValue() == OpenJackType.STEREO)
|
||||
return "Ring";
|
||||
if (index == 2 && getType() == OpenJackType.SWITCHED)
|
||||
if (index == 2 && getValue() == OpenJackType.SWITCHED)
|
||||
return "Shunt";
|
||||
return null;
|
||||
}
|
||||
@@ -423,7 +416,7 @@ public class OpenJack1_8 extends AbstractMultiPartComponent<String> {
|
||||
return false;
|
||||
}
|
||||
|
||||
public enum OpenJackType {
|
||||
static enum OpenJackType {
|
||||
|
||||
MONO, STEREO, SWITCHED;
|
||||
|
||||
|
||||
@@ -251,6 +251,11 @@ public class Label extends AbstractComponent<String> {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
this.text = value;
|
||||
|
||||
@@ -56,8 +56,8 @@ import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Audio Transformer", author = "Branislav Stojkovic", category = "Passive",
|
||||
instanceNamePrefix = "TR", description = "Small signal audio transformer with EI core",
|
||||
@ComponentDescriptor(name = "Mini Signal Transformer", author = "Branislav Stojkovic", category = "Passive",
|
||||
instanceNamePrefix = "TR", description = "Miniature PCB-mount signal transformer with EI core",
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = DIL_ICTransformer.class)
|
||||
public class AudioTransformer extends AbstractMultiPartComponent<String> {
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class FuseSymbol extends AbstractSchematicLeadedSymbol<Current> {
|
||||
|
||||
@Override
|
||||
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) {
|
||||
|
||||
@@ -76,7 +76,7 @@ public class RadialInductor extends AbstractRadialComponent<Inductance> {
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString();
|
||||
return getValue() == null ? null : getValue().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public abstract class AbstractDiodeSymbol extends AbstractSchematicLeadedSymbol<
|
||||
|
||||
public static Size DEFAULT_SIZE = new Size(0.1, SizeUnit.in);
|
||||
|
||||
private String value = null;
|
||||
private String value = "";
|
||||
|
||||
public AbstractDiodeSymbol() {
|
||||
super();
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
/*
|
||||
|
||||
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/>.
|
||||
|
||||
*/
|
||||
*
|
||||
* 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.semiconductors;
|
||||
|
||||
import java.awt.AlphaComposite;
|
||||
@@ -56,8 +53,8 @@ import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "DIP IC", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||
instanceNamePrefix = "IC", description = "Dual-in-line package IC",
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE, transformer = DIL_ICTransformer.class,
|
||||
enableCache = true)
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE,
|
||||
transformer = DIL_ICTransformer.class, enableCache = true)
|
||||
public class DIL_IC extends AbstractLabeledComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -237,8 +234,10 @@ public class DIL_IC extends AbstractLabeledComponent<String> {
|
||||
default:
|
||||
throw new RuntimeException("Unexpected orientation: " + orientation);
|
||||
}
|
||||
controlPoints[i] = new Point2D.Double((int) (firstPoint.getX() + dx1), (int) (firstPoint.getY() + dy1));
|
||||
controlPoints[i + pinCount.getValue() / 2] = new Point2D.Double((int) (firstPoint.getX() + dx2), (int) (firstPoint.getY() + dy2));
|
||||
controlPoints[i] =
|
||||
new Point2D.Double((int) (firstPoint.getX() + dx1), (int) (firstPoint.getY() + dy1));
|
||||
controlPoints[i + pinCount.getValue() / 2] =
|
||||
new Point2D.Double((int) (firstPoint.getX() + dx2), (int) (firstPoint.getY() + dy2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,41 +259,38 @@ public class DIL_IC extends AbstractLabeledComponent<String> {
|
||||
height = (pinCount.getValue() / 2) * pinSpacing;
|
||||
x += pinSize / 2;
|
||||
y -= pinSpacing / 2;
|
||||
indentation =
|
||||
new Area(new Ellipse2D.Double(x + width / 2 - indentationSize / 2, y - indentationSize / 2,
|
||||
indentationSize, indentationSize));
|
||||
indentation = new Area(new Ellipse2D.Double(x + width / 2 - indentationSize / 2,
|
||||
y - indentationSize / 2, indentationSize, indentationSize));
|
||||
break;
|
||||
case _90:
|
||||
width = (pinCount.getValue() / 2) * pinSpacing;
|
||||
height = rowSpacing - pinSize;
|
||||
x -= (pinSpacing / 2) + width - pinSpacing;
|
||||
y += pinSize / 2;
|
||||
indentation =
|
||||
new Area(new Ellipse2D.Double(x + width - indentationSize / 2, y + height / 2 - indentationSize / 2,
|
||||
indentationSize, indentationSize));
|
||||
indentation = new Area(new Ellipse2D.Double(x + width - indentationSize / 2,
|
||||
y + height / 2 - indentationSize / 2, indentationSize, indentationSize));
|
||||
break;
|
||||
case _180:
|
||||
width = rowSpacing - pinSize;
|
||||
height = (pinCount.getValue() / 2) * pinSpacing;
|
||||
x -= rowSpacing - pinSize / 2;
|
||||
y -= (pinSpacing / 2) + height - pinSpacing;
|
||||
indentation =
|
||||
new Area(new Ellipse2D.Double(x + width / 2 - indentationSize / 2, y + height - indentationSize / 2,
|
||||
indentationSize, indentationSize));
|
||||
indentation = new Area(new Ellipse2D.Double(x + width / 2 - indentationSize / 2,
|
||||
y + height - indentationSize / 2, indentationSize, indentationSize));
|
||||
break;
|
||||
case _270:
|
||||
width = (pinCount.getValue() / 2) * pinSpacing;
|
||||
height = rowSpacing - pinSize;
|
||||
x -= pinSpacing / 2;
|
||||
y += pinSize / 2 - rowSpacing;
|
||||
indentation =
|
||||
new Area(new Ellipse2D.Double(x - indentationSize / 2, y + height / 2 - indentationSize / 2,
|
||||
indentationSize, indentationSize));
|
||||
indentation = new Area(new Ellipse2D.Double(x - indentationSize / 2,
|
||||
y + height / 2 - indentationSize / 2, indentationSize, indentationSize));
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Unexpected orientation: " + orientation);
|
||||
}
|
||||
body[0] = new Area(new RoundRectangle2D.Double(x, y, width, height, EDGE_RADIUS, EDGE_RADIUS));
|
||||
body[0] =
|
||||
new Area(new RoundRectangle2D.Double(x, y, width, height, EDGE_RADIUS, EDGE_RADIUS));
|
||||
body[1] = indentation;
|
||||
if (indentation != null) {
|
||||
indentation.intersect(body[0]);
|
||||
@@ -304,8 +300,8 @@ public class DIL_IC extends AbstractLabeledComponent<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
|
||||
Project project, IDrawingObserver drawingObserver) {
|
||||
if (checkPointsClipped(g2d.getClip())) {
|
||||
return;
|
||||
}
|
||||
@@ -314,7 +310,8 @@ public class DIL_IC extends AbstractLabeledComponent<String> {
|
||||
if (!outlineMode) {
|
||||
int pinSize = (int) PIN_SIZE.convertToPixels() / 2 * 2;
|
||||
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,
|
||||
point.getY() - pinSize / 2, pinSize, pinSize);
|
||||
g2d.setColor(PIN_COLOR);
|
||||
g2d.fill(rect);
|
||||
g2d.setColor(PIN_BORDER_COLOR);
|
||||
@@ -331,14 +328,16 @@ public class DIL_IC extends AbstractLabeledComponent<String> {
|
||||
|
||||
Color finalBorderColor;
|
||||
if (outlineMode) {
|
||||
Theme theme =
|
||||
(Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY,
|
||||
Constants.DEFAULT_THEME);
|
||||
finalBorderColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||
? SELECTION_COLOR
|
||||
: theme.getOutlineColor();
|
||||
} else {
|
||||
finalBorderColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||
? SELECTION_COLOR
|
||||
: getBorderColor();
|
||||
}
|
||||
g2d.setColor(finalBorderColor);
|
||||
@@ -366,14 +365,16 @@ public class DIL_IC extends AbstractLabeledComponent<String> {
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
Theme theme =
|
||||
(Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(IPlugInPort.THEME_KEY,
|
||||
Constants.DEFAULT_THEME);
|
||||
finalLabelColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||
? LABEL_COLOR_SELECTED
|
||||
: theme.getOutlineColor();
|
||||
} else {
|
||||
finalLabelColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||
? LABEL_COLOR_SELECTED
|
||||
: getLabelColor();
|
||||
}
|
||||
g2d.setColor(finalLabelColor);
|
||||
@@ -415,72 +416,46 @@ public class DIL_IC extends AbstractLabeledComponent<String> {
|
||||
g2d.translate(0, textHeight / 2);
|
||||
}
|
||||
|
||||
g2d.drawString(l, (int)x, (int)y);
|
||||
g2d.drawString(l, (int) x, (int) y);
|
||||
|
||||
g2d.setTransform(oldTransform);
|
||||
}
|
||||
}
|
||||
|
||||
// draw pin numbers
|
||||
int pinNo = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
int pinSize = (int) PIN_SIZE.convertToPixels();
|
||||
for (Point2D point : controlPoints) {
|
||||
pinNo++;
|
||||
if (getDisplayNumbers() != DisplayNumbers.NO) {
|
||||
int pinSize = (int) PIN_SIZE.convertToPixels();
|
||||
|
||||
// determine points relative to rotation
|
||||
int textX1 = (int) (point.getX() - 2 * pinSize);
|
||||
int textY1 = (int) (point.getY() + pinSize / 2);
|
||||
int textX2 = (int) (point.getX() + pinSize);
|
||||
int textY2 = (int) (point.getY() + pinSize / 2);
|
||||
if (orientation == Orientation._90) {
|
||||
textX2 = textX2 - pinSize - pinSize / 2;
|
||||
textY2 = textY2 + pinSize;
|
||||
textX1 = textX1 + 2 * pinSize - pinSize / 2;
|
||||
textY1 = textY1 - pinSize;
|
||||
}
|
||||
if (orientation == Orientation._180) {
|
||||
textX1 = textX1 + 3 * pinSize;
|
||||
textX2 = textX2 - 3 * pinSize;
|
||||
}
|
||||
if (orientation == Orientation._270) {
|
||||
textX1 = textX1 + pinSize + pinSize / 2;
|
||||
textY1 = textY1 + pinSize;
|
||||
textX2 = textX2 - pinSize - pinSize / 2;
|
||||
textY2 = textY2 - pinSize;
|
||||
}
|
||||
for (int i = 0; i < controlPoints.length; i++) {
|
||||
Point2D point = controlPoints[i];
|
||||
|
||||
g2d.setFont(project.getFont().deriveFont((float) (project.getFont().getSize2D() * 0.66)));
|
||||
if (displayNumbers == DisplayNumbers.DIP) {
|
||||
if (pinNo > pinCount.getValue() / 2) {
|
||||
g2d.drawString(Integer.toString(pinCount.getValue() - j), textX1, textY1);
|
||||
j++;
|
||||
} else {
|
||||
g2d.drawString(Integer.toString(pinNo), textX2, textY2);
|
||||
// determine points relative to rotation
|
||||
int textX1 = (int) (point.getX() - 2 * pinSize);
|
||||
int textY1 = (int) (point.getY() + pinSize / 2);
|
||||
int textX2 = (int) (point.getX() + pinSize);
|
||||
int textY2 = (int) (point.getY() + pinSize / 2);
|
||||
if (orientation == Orientation._90) {
|
||||
textX2 = textX2 - pinSize - pinSize / 2;
|
||||
textY2 = textY2 + pinSize;
|
||||
textX1 = textX1 + 2 * pinSize - pinSize / 2;
|
||||
textY1 = textY1 - pinSize;
|
||||
}
|
||||
} else if (displayNumbers == DisplayNumbers.CONNECTOR) {
|
||||
if (pinNo > pinCount.getValue() / 2) {
|
||||
k++;
|
||||
g2d.drawString(Integer.toString(pinNo - (pinCount.getValue() / 2) + k), textX1, textY1);
|
||||
} else {
|
||||
g2d.drawString(Integer.toString(pinNo + j), textX2, textY2);
|
||||
j++;
|
||||
if (orientation == Orientation._180) {
|
||||
textX1 = textX1 + 3 * pinSize;
|
||||
textX2 = textX2 - 3 * pinSize;
|
||||
}
|
||||
} else if (displayNumbers == DisplayNumbers.DIP_MIRROR) {
|
||||
if (pinNo > pinCount.getValue() / 2) {
|
||||
g2d.drawString(Integer.toString(pinCount.getValue() - pinCount.getValue() + j + 1), textX1, textY1);
|
||||
j++;
|
||||
} else {
|
||||
g2d.drawString(Integer.toString(pinCount.getValue() - pinNo + 1), textX2, textY2);
|
||||
if (orientation == Orientation._270) {
|
||||
textX1 = textX1 + pinSize + pinSize / 2;
|
||||
textY1 = textY1 + pinSize;
|
||||
textX2 = textX2 - pinSize - pinSize / 2;
|
||||
textY2 = textY2 - pinSize;
|
||||
}
|
||||
} else if (displayNumbers == DisplayNumbers.CONNECTOR_MIRROR) {
|
||||
if (pinNo > pinCount.getValue() / 2) {
|
||||
k++;
|
||||
g2d.drawString(Integer.toString(pinNo - (pinCount.getValue() / 2) + k - 1), textX1, textY1);
|
||||
|
||||
g2d.setFont(project.getFont().deriveFont((float) (project.getFont().getSize2D() * 0.66)));
|
||||
if (i >= pinCount.getValue() / 2) {
|
||||
g2d.drawString(getControlPointNodeName(i), textX1, textY1);
|
||||
} else {
|
||||
g2d.drawString(Integer.toString(pinNo + j + 1), textX2, textY2);
|
||||
j++;
|
||||
g2d.drawString(getControlPointNodeName(i), textX2, textY2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -551,6 +526,9 @@ public class DIL_IC extends AbstractLabeledComponent<String> {
|
||||
|
||||
@EditableProperty(name = "Display Pin #s")
|
||||
public DisplayNumbers getDisplayNumbers() {
|
||||
if (displayNumbers == null) {
|
||||
displayNumbers = DisplayNumbers.NO;
|
||||
}
|
||||
return displayNumbers;
|
||||
}
|
||||
|
||||
@@ -582,7 +560,41 @@ public class DIL_IC extends AbstractLabeledComponent<String> {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getControlPointNodeName(int index) {
|
||||
index++;
|
||||
|
||||
if (displayNumbers == DisplayNumbers.DIP) {
|
||||
if (index > pinCount.getValue() / 2) {
|
||||
return Integer.toString(pinCount.getValue() * 3 / 2 - index + 1);
|
||||
} else {
|
||||
return Integer.toString(index);
|
||||
}
|
||||
} else if (displayNumbers == DisplayNumbers.CONNECTOR) {
|
||||
if (index > pinCount.getValue() / 2) {
|
||||
return Integer.toString(index - pinCount.getValue() + index);
|
||||
} else {
|
||||
return Integer.toString(index * 2 - 1);
|
||||
}
|
||||
} else if (displayNumbers == DisplayNumbers.DIP_MIRROR) {
|
||||
if (index > pinCount.getValue() / 2) {
|
||||
return Integer.toString((index - pinCount.getValue() / 2));
|
||||
} else {
|
||||
return Integer.toString(pinCount.getValue() - index + 1);
|
||||
}
|
||||
} else if (displayNumbers == DisplayNumbers.CONNECTOR_MIRROR) {
|
||||
if (index > pinCount.getValue() / 2) {
|
||||
return Integer.toString(index - pinCount.getValue() + index - 1);
|
||||
} else {
|
||||
return Integer.toString(2 * index);
|
||||
}
|
||||
}
|
||||
|
||||
return Integer.toString(index);
|
||||
}
|
||||
|
||||
public static enum PinCount {
|
||||
@@ -601,7 +613,8 @@ public class DIL_IC extends AbstractLabeledComponent<String> {
|
||||
|
||||
public enum DisplayNumbers {
|
||||
|
||||
NO("No"), DIP("DIP"), CONNECTOR("Connector"), DIP_MIRROR("DIP (Mirrored)"), CONNECTOR_MIRROR("Connector (Mirrored)");
|
||||
NO("No"), DIP("DIP"), CONNECTOR("Connector"), DIP_MIRROR("DIP (Mirrored)"), CONNECTOR_MIRROR(
|
||||
"Connector (Mirrored)");
|
||||
|
||||
private String label;
|
||||
|
||||
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
|
||||
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.transform;
|
||||
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Point2D;
|
||||
import org.diylc.common.IComponentTransformer;
|
||||
import org.diylc.common.Orientation;
|
||||
import org.diylc.components.connectivity.PCBTerminalBlock;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
|
||||
public class PCBTerminalBlockTransformer implements IComponentTransformer {
|
||||
|
||||
@Override
|
||||
public boolean canRotate(IDIYComponent<?> component) {
|
||||
return component.getClass().equals(PCBTerminalBlock.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMirror(IDIYComponent<?> component) {
|
||||
return component.getClass().equals(PCBTerminalBlock.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mirroringChangesCircuit() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotate(IDIYComponent<?> component, Point2D center, int direction) {
|
||||
AffineTransform rotate = AffineTransform.getRotateInstance(Math.PI / 2 * direction, center.getX(), center.getY());
|
||||
for (int index = 0; index < component.getControlPointCount(); index++) {
|
||||
Point2D p = new Point2D.Double();
|
||||
rotate.transform(component.getControlPoint(index), p);
|
||||
component.setControlPoint(p, index);
|
||||
}
|
||||
|
||||
PCBTerminalBlock block = (PCBTerminalBlock) component;
|
||||
Orientation o = block.getOrientation();
|
||||
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];
|
||||
block.setOrientation(o);
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
@Override
|
||||
public void mirror(IDIYComponent<?> component, Point2D center, int direction) {
|
||||
PCBTerminalBlock block = (PCBTerminalBlock) component;
|
||||
double dx = center.getX() - block.getControlPoint(0).getX();
|
||||
double dy = center.getY() - block.getControlPoint(0).getY();
|
||||
if (direction == IComponentTransformer.HORIZONTAL) {
|
||||
Orientation o = block.getOrientation();
|
||||
switch (o) {
|
||||
case _90:
|
||||
o = Orientation._270;
|
||||
break;
|
||||
case _270:
|
||||
o = Orientation._90;
|
||||
}
|
||||
|
||||
for (int i = 0; i < block.getControlPointCount(); i++) {
|
||||
Point2D p = block.getControlPoint(i);
|
||||
block.setControlPoint(new Point2D.Double(p.getX() + 2 * dx, p.getY()), i);
|
||||
}
|
||||
|
||||
block.setOrientation(o);
|
||||
} else {
|
||||
Orientation o = block.getOrientation();
|
||||
switch (o) {
|
||||
case DEFAULT:
|
||||
o = Orientation._180;
|
||||
break;
|
||||
case _180:
|
||||
o = Orientation.DEFAULT;
|
||||
}
|
||||
|
||||
for (int i = 0; i < block.getControlPointCount(); i++) {
|
||||
Point2D p = block.getControlPoint(i);
|
||||
block.setControlPoint(new Point2D.Double(p.getX(), p.getY() + 2 * dy), i);
|
||||
}
|
||||
|
||||
block.setOrientation(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class FlexibleLeadsEditor implements IProjectEditor {
|
||||
// create leads
|
||||
HookupWire w1 = new HookupWire();
|
||||
getInstantiationManager().fillWithDefaultProperties(w1, null);
|
||||
w1.setGauge(AWG._26);
|
||||
w1.setValue(AWG._26);
|
||||
w1.setLeadColor(leaded.getLeadColor());
|
||||
// w1.setPointCount(PointCount.THREE);
|
||||
w1.setControlPoint(p1, 0);
|
||||
@@ -93,7 +93,7 @@ public class FlexibleLeadsEditor implements IProjectEditor {
|
||||
|
||||
HookupWire w2 = new HookupWire();
|
||||
getInstantiationManager().fillWithDefaultProperties(w2, null);
|
||||
w2.setGauge(AWG._26);
|
||||
w2.setValue(AWG._26);
|
||||
w2.setLeadColor(leaded.getLeadColor());
|
||||
// w2.setPointCount(PointCount.THREE);
|
||||
w2.setControlPoint(p2, 0);
|
||||
@@ -134,9 +134,9 @@ public class FlexibleLeadsEditor implements IProjectEditor {
|
||||
getInstantiationManager().fillWithDefaultProperties(w, null);
|
||||
// make the leads thicker for TO220 and TO126
|
||||
if (c instanceof TransistorTO220 || c instanceof TransistorTO126)
|
||||
w.setGauge(AWG._24);
|
||||
w.setValue(AWG._24);
|
||||
else
|
||||
w.setGauge(AWG._26);
|
||||
w.setValue(AWG._26);
|
||||
w.setLeadColor(AbstractTransistorPackage.METAL_COLOR);
|
||||
w.setPointCount(PointCount.THREE);
|
||||
w.setControlPoint(p0, 0);
|
||||
@@ -244,7 +244,7 @@ public class FlexibleLeadsEditor implements IProjectEditor {
|
||||
tx = AffineTransform.getRotateInstance(c.getOrientation().toRadians(), p0.getX(), p0.getY());
|
||||
|
||||
HookupWire w = new HookupWire();
|
||||
w.setGauge(AWG._24);
|
||||
w.setValue(AWG._24);
|
||||
getInstantiationManager().fillWithDefaultProperties(w, null);
|
||||
for (int j = 0; j < w.getControlPointCount(); j++) {
|
||||
Point2D p = new Point2D.Double((int)(p0.getX() + dx * j), (int)(p0.getY() + dy * j));
|
||||
|
||||
@@ -439,29 +439,29 @@ public class V2FileParser implements IOldFileParser {
|
||||
}
|
||||
num = num * 2 + 8;
|
||||
if (num == 8)
|
||||
hw.setGauge(AWG._8);
|
||||
hw.setValue(AWG._8);
|
||||
else if (num == 10)
|
||||
hw.setGauge(AWG._10);
|
||||
hw.setValue(AWG._10);
|
||||
else if (num == 12)
|
||||
hw.setGauge(AWG._12);
|
||||
hw.setValue(AWG._12);
|
||||
else if (num == 14)
|
||||
hw.setGauge(AWG._14);
|
||||
hw.setValue(AWG._14);
|
||||
else if (num == 16)
|
||||
hw.setGauge(AWG._16);
|
||||
hw.setValue(AWG._16);
|
||||
else if (num == 18)
|
||||
hw.setGauge(AWG._18);
|
||||
hw.setValue(AWG._18);
|
||||
else if (num == 20)
|
||||
hw.setGauge(AWG._20);
|
||||
hw.setValue(AWG._20);
|
||||
else if (num == 22)
|
||||
hw.setGauge(AWG._22);
|
||||
hw.setValue(AWG._22);
|
||||
else if (num == 24)
|
||||
hw.setGauge(AWG._24);
|
||||
hw.setValue(AWG._24);
|
||||
else if (num == 26)
|
||||
hw.setGauge(AWG._26);
|
||||
hw.setValue(AWG._26);
|
||||
else if (num == 28)
|
||||
hw.setGauge(AWG._28);
|
||||
hw.setValue(AWG._28);
|
||||
else if (num == 30)
|
||||
hw.setGauge(AWG._30);
|
||||
hw.setValue(AWG._30);
|
||||
hw.setLeadColor(cl);
|
||||
hw.setControlPoint(tacke.get(0), 0);
|
||||
hw.setControlPoint(tacke.get(1), 1);
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.diylc.DIYLCStarter"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="diylc-swing"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="diylc-swing"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms512m -Xmx2048m -javaagent:lib/jar-loader.jar -Dorg.diylc.storeDict=true -Dorg.diylc.enableTests=true -Dorg.diylc.scriptRun=true -Ddorg.diylc.debugContinuityAreas=true -Ddorg.diylc.debugComponentAreas=true -Ddorg.diylc.WriteStaticVariants=true -Dorg.diylc.WriteStaticBlocks=true --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens java.desktop/java.awt.geom=ALL-UNNAMED"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms512m -Xmx2048m -javaagent:lib/jar-loader.jar -Dorg.diylc.storeDict=true -Dorg.diylc.enableTests=true -Dorg.diylc.scriptRun=true -Ddorg.diylc.debugContinuityAreas=true -Ddorg.diylc.debugComponentAreas=true -Ddorg.diylc.WriteStaticVariants=true -Ddorg.diylc.WriteStaticBlocks=true --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED --add-opens java.desktop/java.awt.geom=ALL-UNNAMED"/>
|
||||
</launchConfiguration>
|
||||
|
||||
@@ -0,0 +1,606 @@
|
||||
<map>
|
||||
<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>
|
||||
@@ -10,7 +10,7 @@
|
||||
<property name="jar.dir" value="${build.dir}/jar" />
|
||||
<property name="report.dir" value="${build.dir}/junitreport" />
|
||||
<property name="main.class" value="org.diylc.DIYLCStarter" />
|
||||
<property name="diylc.version" value="4.34.0" />
|
||||
<property name="diylc.version" value="4.36.0" />
|
||||
|
||||
<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\" />
|
||||
@@ -99,7 +99,7 @@
|
||||
<typedeclaration
|
||||
identifier="org.diylc.diy"
|
||||
description="DIYLC file type"
|
||||
icon="icons/diylc.icns"
|
||||
icon="icons/diylc_file.icns"
|
||||
conformsTo="public.xml,public.text"
|
||||
extensions="diy" />
|
||||
<runtime dir="${osx.jre8.path}" />
|
||||
@@ -146,7 +146,7 @@
|
||||
<typedeclaration
|
||||
identifier="org.diylc.diy"
|
||||
description="DIYLC file type"
|
||||
icon="icons/diylc.icns"
|
||||
icon="icons/diylc_file.icns"
|
||||
conformsTo="public.xml,public.text"
|
||||
extensions="diy" />
|
||||
<runtime dir="${osx.jre8m1.path}" />
|
||||
|
||||
+19
-16
@@ -1,18 +1,18 @@
|
||||
#10 (2.59mm / 0.10190in)
|
||||
#12 (2.05mm / 0.08081in)
|
||||
#14 (1.63mm / 0.06409in)
|
||||
#16 (1.29mm / 0.05082in)
|
||||
#18 (1.02mm / 0.04030in)
|
||||
#20 (0.81mm / 0.03196in)
|
||||
#22 (0.64mm / 0.02535in)
|
||||
#24 (0.51mm / 0.02010in)
|
||||
#26 (0.40mm / 0.01594in)
|
||||
#28 (0.32mm / 0.01264in)
|
||||
#30 (0.25mm / 0.01003in)
|
||||
#32 (0.20mm / 0.00795in)
|
||||
#34 (0.16mm / 0.00631in)
|
||||
#36 (0.13mm / 0.00500in)
|
||||
#8 (3.26mm / 0.12849in)
|
||||
#10 / 2.59mm
|
||||
#12 / 2.05mm
|
||||
#14 / 1.63mm
|
||||
#16 / 1.29mm
|
||||
#18 / 1.02mm
|
||||
#20 / 0.81mm
|
||||
#22 / 0.64mm
|
||||
#24 / 0.51mm
|
||||
#26 / 0.40mm
|
||||
#28 / 0.32mm
|
||||
#30 / 0.25mm
|
||||
#32 / 0.20mm
|
||||
#34 / 0.16mm
|
||||
#36 / 0.13mm
|
||||
#8 / 3.26mm
|
||||
1 throws / 2 positions
|
||||
10 throws / 10 positions
|
||||
11 throws / 11 positions
|
||||
@@ -55,7 +55,7 @@ Box
|
||||
C-B-E BJT
|
||||
Circle
|
||||
Coil(s)
|
||||
Component reordering is possible only when Project Explorer is sorted by z-index
|
||||
Component reordering is possible only when Project Explorer is sorted by z-index.
|
||||
Configuration
|
||||
Could not apply changes. Check the log for details.
|
||||
D-G-S JFET
|
||||
@@ -85,6 +85,7 @@ Double Rods
|
||||
Drop
|
||||
E+
|
||||
E-B-C BJT
|
||||
Eight
|
||||
English
|
||||
Español
|
||||
Filament Voltage
|
||||
@@ -107,6 +108,7 @@ Maximum number of switching combinations exceeded. Allowed: %s, actual: %s
|
||||
NPN
|
||||
Nand
|
||||
Nederlands
|
||||
Nine
|
||||
Non-shorting
|
||||
Nor
|
||||
Not
|
||||
@@ -145,6 +147,7 @@ Source Style
|
||||
Source Type
|
||||
Srpski
|
||||
Stroke
|
||||
Ten
|
||||
Terminal
|
||||
Timing
|
||||
Tubular Beveled
|
||||
|
||||
@@ -37,6 +37,45 @@
|
||||
<update_contact>nbenitezl_AT_gmail.com</update_contact>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<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">
|
||||
<description>
|
||||
<ul>
|
||||
<li>[New Feature] Added '1/8" Cliff Jack' component - stereo and mono</li>
|
||||
<li>[New Feature] Added 'Solder Lug' component</li>
|
||||
<li>[New Feature] Added 'PCB Terminal Block' component</li>
|
||||
<li>[New Feature] Show component values in the project explorer</li>
|
||||
<li>[New Feature] Double click in the project explorer to edit selected component</li>
|
||||
<li>[New Feature] Title Block added as one of factory building blocks</li>
|
||||
<li>[New Feature] 'Renumber On Paste' feature now applies to variants as well. When set to OFF, the app honors the name saved in the variant</li>
|
||||
<li>[New Feature] New file icons for Mac OS</li>
|
||||
<li>[Improvement] Ability to use up/down arrow keys in the project explorer to select components</li>
|
||||
<li>[Improvement] Use scroll buttons in 'Tabbed Toolbar' instead of arranging tabs into multiple lines when the screen is not large enough to show them all</li>
|
||||
<li>[Improvement] Escape comma in BOM CSV files to avoid component names being split into separate columns</li>
|
||||
<li>[Improvement] Show jack type in the BOM and project explorer</li>
|
||||
<li>[Improvement] Show wire gauge in the BOM and project explorer</li>
|
||||
<li>[Improvement] Improved find tool usability, make the screen pan to the selected components</li>
|
||||
<li>[Bug Fix] Trace cut doesn't affect continuity of vero board traces</li>
|
||||
<li>[Bug Fix] DIL IC pin labels incorrect in the netlist</li>
|
||||
<li>[Bug Fix] Diode symbol doesn't appear in the BOM</li>
|
||||
<li>[Bug Fix] Upon starting or opening a project, the ruler is slightly miss-aligned with the project boundaries</li>
|
||||
</ul>
|
||||
</description>
|
||||
<url>https://github.com/bancika/diy-layout-creator/releases/tag/v4.35.0</url>
|
||||
</release>
|
||||
<release version="4.34.0" date="2022-12-09">
|
||||
<description>
|
||||
<ul>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -230,9 +230,7 @@ public class DIYLCStarter {
|
||||
if (ConfigurationManager.getInstance().isFileWithErrors())
|
||||
mainFrame.showMessage("<html>"
|
||||
+ "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>"
|
||||
+ "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."
|
||||
+ "The backup file is created and placed in user directory under 'diylc' sub-directory with the current timestamp at the end.<br>"
|
||||
+ "</html>", "Warning", IView.WARNING_MESSAGE);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,10 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@@ -129,15 +128,11 @@ public class AutoSavePlugin implements IPlugIn {
|
||||
name = name.substring(0, name.length() - 4);
|
||||
|
||||
// append date and time
|
||||
Date date = new Date();
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
|
||||
file = new File(AUTO_SAVE_PATH + File.separator + name + "." + dateFormat.format(date) + ".diy");
|
||||
// make sure that it doesn't already exist
|
||||
int i = 2;
|
||||
while (file.exists()) {
|
||||
file = new File(AUTO_SAVE_PATH + File.separator + name + "." + dateFormat.format(date) + "-" + i + ".diy");
|
||||
i++;
|
||||
}
|
||||
String timestamp = LocalDateTime.now()
|
||||
.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
|
||||
.substring(0, 19)
|
||||
.replace(':', '-');
|
||||
file = new File(AUTO_SAVE_PATH + File.separator + name + "." + timestamp + ".diy");
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ public class CanvasPlugin implements IPlugIn{
|
||||
scroll.getHorizontalScrollBar().setValue((totalSize.width - visibleSize.width) / 2);
|
||||
scroll.getVerticalScrollBar().setValue((totalSize.height - visibleSize.height) / 2);
|
||||
getScrollPane().getViewport().setVisible(true);
|
||||
updateZeroLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -473,6 +474,8 @@ public class CanvasPlugin implements IPlugIn{
|
||||
|
||||
canvasPanel.scrollRectToVisible(visibleRect);
|
||||
canvasPanel.revalidate();
|
||||
|
||||
updateZeroLocation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -78,9 +78,9 @@ public class ExplorerPane extends JPanel {
|
||||
gbc.weighty = 0;
|
||||
gbc.gridwidth = 1;
|
||||
|
||||
// add(getTitleLabel(), gbc);
|
||||
//
|
||||
// gbc.gridy++;
|
||||
// add(getTitleLabel(), gbc);
|
||||
//
|
||||
// gbc.gridy++;
|
||||
|
||||
add(getSearchField(), gbc);
|
||||
|
||||
@@ -100,14 +100,14 @@ public class ExplorerPane extends JPanel {
|
||||
|
||||
add(getSortBox(), gbc);
|
||||
|
||||
setPreferredSize(new Dimension(180, 200));
|
||||
setPreferredSize(new Dimension(240, 200));
|
||||
}
|
||||
|
||||
public JLabel getTitleLabel() {
|
||||
if (titleLabel == null) {
|
||||
titleLabel = new JLabel(getName());
|
||||
titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
// titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD));
|
||||
// titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD));
|
||||
}
|
||||
return titleLabel;
|
||||
}
|
||||
@@ -180,9 +180,16 @@ public class ExplorerPane extends JPanel {
|
||||
|
||||
private MouseEvent pressedEvent;
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getClickCount() == 2) {
|
||||
plugInPort.editSelection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
ExplorerPane.this.requestFocus();
|
||||
componentList.requestFocus();
|
||||
pressedEvent = e;
|
||||
}
|
||||
|
||||
@@ -345,16 +352,16 @@ public class ExplorerPane extends JPanel {
|
||||
|
||||
private static class ComponentListCellRenderer implements ListCellRenderer<IDIYComponent<?>> {
|
||||
|
||||
// private static Color[] layerColors = new Color[] { Color.gray, Color.decode("#ff6363"), Color.decode("#293462"), Color.decode("#138588"),
|
||||
// Color.decode("#c0ca03"), Color.decode("#990000") };
|
||||
// private static Color[] layerColors = new Color[] { Color.gray, Color.decode("#ff6363"),
|
||||
// Color.decode("#293462"), Color.decode("#138588"),
|
||||
// Color.decode("#c0ca03"), Color.decode("#990000") };
|
||||
|
||||
protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
|
||||
|
||||
private Map<String, ComponentType> componentTypes;
|
||||
|
||||
public ComponentListCellRenderer(Map<String, List<ComponentType>> componentTypeMap) {
|
||||
this.componentTypes = componentTypeMap.values().stream()
|
||||
.flatMap(x -> x.stream())
|
||||
this.componentTypes = componentTypeMap.values().stream().flatMap(x -> x.stream())
|
||||
.collect(Collectors.toMap(x -> x.getInstanceClass().getCanonicalName(), x -> x));
|
||||
}
|
||||
|
||||
@@ -367,10 +374,26 @@ public class ExplorerPane extends JPanel {
|
||||
JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index,
|
||||
isSelected, cellHasFocus);
|
||||
|
||||
int layerId = (int)Math.round(componentType.getZOrder());
|
||||
int layerId = (int) Math.round(componentType.getZOrder());
|
||||
|
||||
|
||||
renderer.setText(String.format("<html><font color='#c0c0c0'>[L%s]</font> %s</html>", layerId, value.getName()));
|
||||
String valueForDisplay = value.getValueForDisplay();
|
||||
if (isSelected) {
|
||||
if (valueForDisplay == null || valueForDisplay.trim().isEmpty()) {
|
||||
renderer.setText(String.format("[L%s] %s", layerId, value.getName()));
|
||||
} else {
|
||||
renderer
|
||||
.setText(String.format("[L%s] %s (%s)", layerId, value.getName(), valueForDisplay));
|
||||
}
|
||||
} else {
|
||||
if (valueForDisplay == null || valueForDisplay.trim().isEmpty()) {
|
||||
renderer.setText(String.format("<html><font color='#c0c0c0'>[L%s]</font> %s</html>",
|
||||
layerId, value.getName()));
|
||||
} else {
|
||||
renderer.setText(String.format(
|
||||
"<html><font color='#c0c0c0'>[L%s]</font> %s (<font color='#666666'>%s</font>)</html>",
|
||||
layerId, value.getName(), valueForDisplay));
|
||||
}
|
||||
}
|
||||
|
||||
return renderer;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ class ComponentTabbedPane extends JTabbedPane {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
Reference in New Issue
Block a user