Detect when a file is created with a newer version of DIYLC and show a

warning

Force correct prefix for transistors in spice
This commit is contained in:
Branislav Stojkovic
2019-03-10 09:03:22 +01:00
parent a83cda9ecd
commit b279510e5c
9 changed files with 74 additions and 6 deletions
@@ -89,7 +89,14 @@ public abstract class AbstractTransistorPackage extends AbstractTransparentCompo
@Override
public String getComment() {
return getPinout() == null ? null : (getPinout().toString() + " pinout");
return getPinout() == null ? "Pinout not configured, validate this line" : (getPinout().toString() + " pinout");
}
@Override
public String getPrefix() {
if (getPinout() == null)
return null;
return getPinout().name().substring(0, 1);
}
@EditableProperty
@@ -31,4 +31,6 @@ public interface ISpiceMapper {
int mapToSpiceNode(int pontIndex);
String getComment();
String getPrefix();
}
@@ -80,8 +80,16 @@ public class SpiceAnalyzer extends NetlistAnalyzer implements INetlistAnalyzer {
maxLen = c.getName().length();
}
for (IDIYComponent<?> c : allComponents) {
sb.append(fill(c.getName(), (int) (Math.ceil(maxLen / 5.0) * 5)));
for (IDIYComponent<?> c : allComponents) {
// change the prefix to match spice convention if needed
String name = c.getName();
String prefix = null;
if (c instanceof ISpiceMapper)
prefix = ((ISpiceMapper)c).getPrefix();
if (prefix != null && !name.toLowerCase().startsWith(prefix.toLowerCase()))
name = prefix + name;
sb.append(fill(name, (int) (Math.ceil(maxLen / 5.0) * 5)));
sb.append(" ");
int[] nodeIndices = new int[c.getControlPointCount()];