Added a setting to select the wide shapes by default.

This commit is contained in:
hneemann 2018-09-30 10:14:59 +02:00
parent e7c00fd465
commit b7a1dccc3d
5 changed files with 24 additions and 1 deletions

View File

@ -682,4 +682,11 @@ public final class Keys {
public static final Key<Boolean> WIDE_SHAPE
= new Key<>("wideShape", false).setSecondary().allowGroupEdit();
/**
* Selects the wide shapes as the default
*/
public static final Key<Boolean> SETTINGS_USE_WIDE_SHAPES
= new Key<>("wideShapeAsDefault", false).setSecondary();
}

View File

@ -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);
}

View File

@ -45,6 +45,7 @@ public final class Settings implements AttributeListener {
private Settings() {
List<Key> 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);

View File

@ -1196,7 +1196,8 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
</string>
<string name="key_wideShape">Breites Symbol</string>
<string name="key_wideShape_tt">Verwendet ein breiteres Symbol zur Darstellung des Gatters.</string>
<string name="key_wideShapeAsDefault">Standardmäßig breites Symbol verwenden.</string>
<string name="key_wideShapeAsDefault_tt">Werden neue Gatter eingefügt, wird standardmäßig die breite Variante gewählt.</string>
<string name="key_shapeType">Form</string>
<string name="key_shapeType_tt">Die Form, welche für die Repräsentation der Schaltung in einer einbettenden

View File

@ -1188,6 +1188,8 @@
</string>
<string name="key_wideShape">Wide Shape</string>
<string name="key_wideShape_tt">Uses a wider shape to visualize the gate.</string>
<string name="key_wideShapeAsDefault">Use wider shapes by default.</string>
<string name="key_wideShapeAsDefault_tt">If new gates are inserted, the wide variant is selected by default.</string>
<string name="key_shapeType">Shape</string>
<string name="key_shapeType_tt">The shape to be used for the representation of the circuit in an embedding circuit.