mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-17 17:04:42 -04:00
a circuit can have a name different from the file name of the circuit
This commit is contained in:
parent
823b77e117
commit
22a57d19be
@ -583,7 +583,7 @@ public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer>
|
||||
}
|
||||
|
||||
ElementTypeDescriptionCustom description = createCustomDescription(file, circuit, this);
|
||||
description.setShortName(createShortName(file));
|
||||
description.setShortName(createShortName(file.getName(), circuit.getAttributes().getLabel()));
|
||||
|
||||
String descriptionText = Lang.evalMultilingualContent(circuit.getAttributes().get(Keys.DESCRIPTION));
|
||||
if (descriptionText != null && descriptionText.length() > 0) {
|
||||
@ -595,11 +595,8 @@ public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer>
|
||||
}
|
||||
}
|
||||
|
||||
private String createShortName(File file) {
|
||||
return createShortName(file.getName());
|
||||
}
|
||||
|
||||
private String createShortName(String name) {
|
||||
private String createShortName(String name, String userDefined) {
|
||||
if (userDefined.isEmpty()) {
|
||||
if (name.endsWith(".dig")) return "\\" + name.substring(0, name.length() - 4);
|
||||
|
||||
String transName = Lang.getNull("elem_" + name);
|
||||
@ -607,6 +604,9 @@ public class ElementLibrary implements Iterable<ElementLibrary.ElementContainer>
|
||||
return name;
|
||||
else
|
||||
return transName;
|
||||
} else {
|
||||
return userDefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,6 +62,7 @@ public class CircuitComponent extends JComponent implements ChangedListener, Lib
|
||||
private static final ArrayList<Key> ATTR_LIST = new ArrayList<>();
|
||||
|
||||
static {
|
||||
ATTR_LIST.add(Keys.LABEL);
|
||||
ATTR_LIST.add(Keys.WIDTH);
|
||||
ATTR_LIST.add(Keys.SHAPE_TYPE);
|
||||
ATTR_LIST.add(Keys.CUSTOM_SHAPE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user