mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-13 06:49:36 -04:00
long names are shown below the GenericShape
This commit is contained in:
parent
05e6956d2b
commit
6e947da74f
@ -111,7 +111,7 @@ public class LibrarySelector implements ElementNotFoundNotification {
|
||||
public Element create(ElementAttributes attributes) {
|
||||
return new CustomElement(circuit, library);
|
||||
}
|
||||
}, circuit.getInputNames(library));
|
||||
}, circuit.getInputNames(library)).setShortName(createShortName(file));
|
||||
library.addDescription(description);
|
||||
customMenu.add(new InsertAction(description.getName(), insertHistory, circuitComponent));
|
||||
return description;
|
||||
@ -121,4 +121,10 @@ public class LibrarySelector implements ElementNotFoundNotification {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String createShortName(File file) {
|
||||
String name = file.getName();
|
||||
if (name.endsWith(".dig")) name = name.substring(0, name.length() - 4);
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -120,8 +120,13 @@ public class GenericShape implements Shape {
|
||||
graphic.drawText(p.getPos().add(-2, 0), p.getPos().add(5, 0), p.getName(), Orientation.RIGHTCENTER, Style.SHAPE_PIN);
|
||||
}
|
||||
}
|
||||
Vector pos = new Vector(SIZE2 * width, -SIZE2 + 2);
|
||||
graphic.drawText(pos, pos.add(1, 0), name, Orientation.CENTERTOP, Style.NORMAL);
|
||||
if (name.length() <= 3) {
|
||||
Vector pos = new Vector(SIZE2 * width, -SIZE2 + 2);
|
||||
graphic.drawText(pos, pos.add(1, 0), name, Orientation.CENTERTOP, Style.NORMAL);
|
||||
} else {
|
||||
Vector pos = new Vector(SIZE2 * width, height + 2);
|
||||
graphic.drawText(pos, pos.add(1, 0), name, Orientation.CENTERTOP, Style.SHAPE_PIN);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user