mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
Cleaner XML format for .DIY files with less cross-references
pinout update
This commit is contained in:
@@ -294,7 +294,7 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSectionName(int pointIndex) {
|
||||
public String[] getSectionNames(int pointIndex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,9 +132,10 @@ public interface IDIYComponent<T> extends Serializable {
|
||||
|
||||
/**
|
||||
* @param pointIndex name of the internal section containing the specified point, or null if the component does not have internal sections.
|
||||
* One point can be shared between multiple sections, in which case, the result may contain more than one element.
|
||||
* @return
|
||||
*/
|
||||
String getSectionName(int pointIndex);
|
||||
String[] getSectionNames(int pointIndex);
|
||||
|
||||
/**
|
||||
* Draws the component onto the {@link Graphics2D}.
|
||||
|
||||
@@ -48,8 +48,8 @@ public class Node implements Comparable<Node> {
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
String section = component.getSectionName(pointIndex);
|
||||
return (section == null ? "" : section + ".") + component.getControlPointNodeName(pointIndex);
|
||||
String[] section = component.getSectionNames(pointIndex);
|
||||
return (section == null || section.length > 1 ? "" : section[0] + ".") + component.getControlPointNodeName(pointIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
package org.diylc.presenter;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -93,6 +94,15 @@ public class ProjectFileManager {
|
||||
};
|
||||
xStream.autodetectAnnotations(true);
|
||||
xStream.registerConverter(new PointConverter());
|
||||
xStream.addImmutableType(Color.class);
|
||||
xStream.addImmutableType(java.awt.Point.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Voltage.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Resistance.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Capacitance.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Current.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Power.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Inductance.class);
|
||||
xStream.addImmutableType(org.diylc.core.measures.Size.class);
|
||||
this.xStreamOld = new XStream(new DomDriver());
|
||||
xStreamOld.autodetectAnnotations(true);
|
||||
this.messageDispatcher = messageDispatcher;
|
||||
|
||||
Binary file not shown.
+5
@@ -87,6 +87,11 @@ public abstract class AbstractTransistorPackage extends AbstractTransparentCompo
|
||||
return index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComment() {
|
||||
return getPinout() == null ? null : (getPinout().toString() + " pinout");
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public String getValue() {
|
||||
return value;
|
||||
|
||||
@@ -6,6 +6,14 @@ public enum TransistorPinout {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name().replace("_", " ");
|
||||
String[] parts = name().split("_");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < parts[1].length(); i++) {
|
||||
if (i > 0)
|
||||
sb.append("-");
|
||||
sb.append(parts[1].charAt(i));
|
||||
}
|
||||
sb.append(" ").append(parts[0]);
|
||||
return sb.toString();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,8 +1,34 @@
|
||||
/*
|
||||
|
||||
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.netlist;
|
||||
|
||||
/**
|
||||
* Maps DIYLC component control points to spice-compatible node indices.
|
||||
*
|
||||
* @author Branislav Stojkovic
|
||||
*/
|
||||
public interface ISpiceMapper {
|
||||
|
||||
int mapToSpiceNode(int Index);
|
||||
int mapToSpiceNode(int pontIndex);
|
||||
|
||||
String getSectionName(int pointIndex);
|
||||
String getComment();
|
||||
}
|
||||
|
||||
@@ -110,6 +110,12 @@ public class SpiceAnalyzer extends NetlistAnalyzer implements INetlistAnalyzer {
|
||||
}
|
||||
|
||||
sb.append(c.getValue());
|
||||
|
||||
if (c instanceof ISpiceMapper) {
|
||||
String comment = ((ISpiceMapper)c).getComment();
|
||||
if (comment != null)
|
||||
sb.append(" ; ").append(comment);
|
||||
}
|
||||
sb.append("<br>");
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -2586,10 +2586,18 @@
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Generate SPICE-compatible netlist (still in beta stage)</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Added pinout property to all transistor components</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>When in "Highlight Connected Area" mode, the status bar shows useful information making it harder to forget what the mode does</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Cleaner XML format for .DIY files with less cross-references</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>BUG_FIX</changeType>
|
||||
<description>"Highlight Connected Areas" doesn't follow multiple chained wires and jumpers</description>
|
||||
|
||||
Reference in New Issue
Block a user