diff --git a/src/main/java/de/neemann/digital/core/element/Keys.java b/src/main/java/de/neemann/digital/core/element/Keys.java index 34d723451..44f8d967b 100644 --- a/src/main/java/de/neemann/digital/core/element/Keys.java +++ b/src/main/java/de/neemann/digital/core/element/Keys.java @@ -682,4 +682,11 @@ public final class Keys { public static final Key WIDE_SHAPE = new Key<>("wideShape", false).setSecondary().allowGroupEdit(); + /** + * Selects the wide shapes as the default + */ + public static final Key SETTINGS_USE_WIDE_SHAPES + = new Key<>("wideShapeAsDefault", false).setSecondary(); + + } diff --git a/src/main/java/de/neemann/digital/gui/InsertAction.java b/src/main/java/de/neemann/digital/gui/InsertAction.java index c9ba75b43..f4deba2fd 100644 --- a/src/main/java/de/neemann/digital/gui/InsertAction.java +++ b/src/main/java/de/neemann/digital/gui/InsertAction.java @@ -5,6 +5,7 @@ */ package de.neemann.digital.gui; +import de.neemann.digital.core.element.Keys; import de.neemann.digital.draw.elements.VisualElement; import de.neemann.digital.draw.graphics.Vector; import de.neemann.digital.draw.library.LibraryNode; @@ -57,8 +58,19 @@ public final class InsertAction extends ToolTipAction { SwingUtilities.invokeLater(new ErrorMessage(Lang.get("msg_errorImportingModel_N0", node.getName())).addCause(ex)); } } + + // set the wide shape option to the new element + try { + if (Settings.getInstance().get(Keys.SETTINGS_USE_WIDE_SHAPES) + && node.getDescription().hasAttribute(Keys.WIDE_SHAPE)) + visualElement.setAttribute(Keys.WIDE_SHAPE, true); + } catch (IOException e1) { + // do nothing on error + } + if (visualElement.getShape() instanceof MissingShape) return; + circuitComponent.setPartToInsert(visualElement); insertHistory.add(this); } diff --git a/src/main/java/de/neemann/digital/gui/Settings.java b/src/main/java/de/neemann/digital/gui/Settings.java index f8afc8bf5..adc40bcb0 100644 --- a/src/main/java/de/neemann/digital/gui/Settings.java +++ b/src/main/java/de/neemann/digital/gui/Settings.java @@ -45,6 +45,7 @@ public final class Settings implements AttributeListener { private Settings() { List intList = new ArrayList<>(); intList.add(Keys.SETTINGS_IEEE_SHAPES); + intList.add(Keys.SETTINGS_USE_WIDE_SHAPES); intList.add(Keys.SETTINGS_LANGUAGE); intList.add(Keys.SETTINGS_EXPRESSION_FORMAT); intList.add(Keys.SETTINGS_DEFAULT_TREESELECT); diff --git a/src/main/resources/lang/lang_de.xml b/src/main/resources/lang/lang_de.xml index bfa89d8af..7e79f5ad8 100644 --- a/src/main/resources/lang/lang_de.xml +++ b/src/main/resources/lang/lang_de.xml @@ -1196,7 +1196,8 @@ Sind evtl. die Namen der Variablen nicht eindeutig? Breites Symbol Verwendet ein breiteres Symbol zur Darstellung des Gatters. - + Standardmäßig breites Symbol verwenden. + Werden neue Gatter eingefügt, wird standardmäßig die breite Variante gewählt. Form Die Form, welche für die Repräsentation der Schaltung in einer einbettenden diff --git a/src/main/resources/lang/lang_en.xml b/src/main/resources/lang/lang_en.xml index 93b853b27..a5c6b9180 100644 --- a/src/main/resources/lang/lang_en.xml +++ b/src/main/resources/lang/lang_en.xml @@ -1188,6 +1188,8 @@ Wide Shape Uses a wider shape to visualize the gate. + Use wider shapes by default. + If new gates are inserted, the wide variant is selected by default. Shape The shape to be used for the representation of the circuit in an embedding circuit.