allows the user to specify ghdl options, see #421

This commit is contained in:
hneemann 2020-03-22 11:30:21 +01:00
parent a814f678b4
commit e33e9a1488
18 changed files with 443 additions and 151 deletions

View File

@ -23,6 +23,7 @@ public class Key<VALUE> {
private CheckEnabled checkEnabled;
private boolean isSecondary;
private boolean requiresRestart = false;
private String panelId;
// Both values are always null in digital.
// Both are only used within a custom implemented component.
@ -234,6 +235,24 @@ public class Key<VALUE> {
return requiresRestart;
}
/**
* Moves this key to the panel with the given id
*
* @param panelId the panel id
* @return this for chained calls
*/
public Key<VALUE> setPanelId(String panelId) {
this.panelId = panelId;
return this;
}
/**
* @return the panel id, null if no panel is set
*/
public String getPanelId() {
return panelId;
}
/**
* A integer attribute.
* Stores additional combo box values

View File

@ -706,7 +706,22 @@ public final class Keys {
* Path to ghdl
*/
public static final Key<File> SETTINGS_GHDL_PATH
= new Key.KeyFile("ghdlPath", new File("ghdl")).setSecondary();
= new Key.KeyFile("ghdlPath", new File("ghdl")).setPanelId("ghdl");
/**
* The ghdl analysis options
*/
public static final Key<String> SETTINGS_GHDL_OPT_ANALYSYS
= new Key<>("ghdlOptAnalysis", "-a --std=08 --ieee=synopsys").setPanelId("ghdl");
/**
* The ghdl elaboration options
*/
public static final Key<String> SETTINGS_GHDL_OPT_ELABORATION
= new Key<>("ghdlOptElaboration", "-e --std=08 --ieee=synopsys stdIOInterface").setPanelId("ghdl");
/**
* The ghdl run options
*/
public static final Key<String> SETTINGS_GHDL_OPT_RUN
= new Key<>("ghdlOptRun", "-r --std=08 --ieee=synopsys stdIOInterface --unbuffered").setPanelId("ghdl");
/**
* Path to iverilog installation directory

View File

@ -28,9 +28,9 @@ public class ApplicationGHDL extends ApplicationVHDLStdIO {
String ghdl = getGhdlPath().getPath();
file = createVHDLFile(label, code, inputs, outputs);
ProcessStarter.start(file.getParentFile(), ghdl, "-a", "--std=08", "--ieee=synopsys", file.getName());
ProcessStarter.start(file.getParentFile(), ghdl, "-e", "--std=08", "--ieee=synopsys", "stdIOInterface");
ProcessBuilder pb = new ProcessBuilder(ghdl, "-r", "--std=08", "--ieee=synopsys", "stdIOInterface", "--unbuffered").redirectErrorStream(true).directory(file.getParentFile());
ProcessStarter.start(file.getParentFile(), new Options().add(ghdl).addSettings(Keys.SETTINGS_GHDL_OPT_ANALYSYS).add(file.getName()).getArray());
ProcessStarter.start(file.getParentFile(), new Options().add(ghdl).addSettings(Keys.SETTINGS_GHDL_OPT_ELABORATION).getArray());
ProcessBuilder pb = new ProcessBuilder(new Options().add(ghdl).addSettings(Keys.SETTINGS_GHDL_OPT_RUN).getList()).redirectErrorStream(true).directory(file.getParentFile());
return new GHDLProcessInterface(pb.start(), file.getParentFile());
} catch (IOException e) {
if (file != null)
@ -63,8 +63,8 @@ public class ApplicationGHDL extends ApplicationVHDLStdIO {
String ghdl = getGhdlPath().getPath();
file = createVHDLFile(label, code, inputs, outputs);
String m1 = ProcessStarter.start(file.getParentFile(), ghdl, "-a", "--ieee=synopsys", file.getName());
String m2 = ProcessStarter.start(file.getParentFile(), ghdl, "-e", "--ieee=synopsys", "stdIOInterface");
String m1 = ProcessStarter.start(file.getParentFile(), new Options().add(ghdl).addSettings(Keys.SETTINGS_GHDL_OPT_ANALYSYS).add(file.getName()).getArray());
String m2 = ProcessStarter.start(file.getParentFile(), new Options().add(ghdl).addSettings(Keys.SETTINGS_GHDL_OPT_ELABORATION).getArray());
return ProcessStarter.joinStrings(m1, m2);
} catch (IOException e) {
if (ghdlNotFound(e))

View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 2020 Helmut Neemann.
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
package de.neemann.digital.core.extern;
import de.neemann.digital.core.element.Key;
import de.neemann.digital.gui.Settings;
import java.util.ArrayList;
/**
* Used to split option strings to a option list
*/
public class Options {
private final ArrayList<String> list;
/**
* Creates a new instance
*/
public Options() {
list = new ArrayList<>();
}
/**
* Adds a string from the settings
*
* @param key the key to use
* @return this for chained calls
*/
public Options addSettings(Key<String> key) {
return addString(Settings.getInstance().get(key));
}
/**
* Adds a string containing many options
*
* @param options the string containing the options
* @return this for chained calls
*/
public Options addString(String options) {
StringBuilder opt = new StringBuilder();
boolean inQuote = false;
for (int i = 0; i < options.length(); i++) {
char c = options.charAt(i);
if (c == '"')
inQuote = !inQuote;
if (Character.isWhitespace(c) && !inQuote) {
if (opt.length() > 0)
list.add(opt.toString());
opt.setLength(0);
} else {
opt.append(c);
}
}
if (opt.length() > 0)
list.add(opt.toString());
return this;
}
/**
* Adds a single raw option
*
* @param option the options to add
* @return this for chained calls
*/
public Options add(String option) {
list.add(option);
return this;
}
/**
* @return the options as a list
*/
public ArrayList<String> getList() {
return list;
}
/**
* @return the options as an array
*/
public String[] getArray() {
return list.toArray(new String[0]);
}
}

View File

@ -52,6 +52,9 @@ public final class Settings extends SettingsBase {
intList.add(Keys.SETTINGS_ATF1502_FITTER);
intList.add(Keys.SETTINGS_ATMISP);
intList.add(Keys.SETTINGS_GHDL_PATH);
intList.add(Keys.SETTINGS_GHDL_OPT_ANALYSYS);
intList.add(Keys.SETTINGS_GHDL_OPT_ELABORATION);
intList.add(Keys.SETTINGS_GHDL_OPT_RUN);
intList.add(Keys.SETTINGS_IVERILOG_PATH);
intList.add(Keys.SETTINGS_TOOLCHAIN_CONFIG);
intList.add(Keys.SETTINGS_FONT_SCALING);

View File

@ -35,14 +35,13 @@ import java.util.List;
*/
public class AttributeDialog extends JDialog {
private final java.util.List<EditorHolder> editors;
private final JPanel panel;
private final Window parent;
private final Point pos;
private final ElementAttributes originalAttributes;
private final ElementAttributes modifiedAttributes;
private final JPanel buttonPanel;
private final ConstraintsBuilder constraints;
private final AbstractAction okAction;
private final EditorPanel primaryPanel;
private HashMap<Key, JCheckBox> checkBoxes;
private JComponent topMostTextComponent;
private VisualElement visualElement;
@ -100,32 +99,32 @@ public class AttributeDialog extends JDialog {
this.originalAttributes = elementAttributes;
this.modifiedAttributes = new ElementAttributes(elementAttributes);
panel = new JPanel(new GridBagLayout());
ArrayList<EditorPanel> panels = new ArrayList<EditorPanel>();
primaryPanel = new EditorPanel(EditorPanel.PRIMARY);
panels.add(primaryPanel);
editors = new ArrayList<>();
topMostTextComponent = null;
constraints = new ConstraintsBuilder().inset(3).fill();
JPanel secondaryPanel = null;
ConstraintsBuilder secondaryConstraints = null;
boolean enableTwoTabs = !addCheckBoxes && enableTwoTabs(list);
if (enableTwoTabs) {
secondaryPanel = new JPanel(new GridBagLayout());
secondaryConstraints = new ConstraintsBuilder().inset(3).fill();
EditorPanel secondaryPanel = null;
if (!addCheckBoxes && enableTwoTabs(list)) {
secondaryPanel = new EditorPanel(EditorPanel.SECONDARY);
panels.add(secondaryPanel);
}
boolean isSecondary = false;
for (Key key : list) {
Editor e = EditorFactory.INSTANCE.create(key, modifiedAttributes.get(key));
editors.add(new EditorHolder(e, key));
if (key.isSecondary() && enableTwoTabs) {
e.addToPanel(secondaryPanel, key, modifiedAttributes, this, secondaryConstraints);
isSecondary = true;
} else
e.addToPanel(panel, key, modifiedAttributes, this, constraints);
EditorPanel panelToUse = primaryPanel;
if (key.isSecondary() && secondaryPanel != null)
panelToUse = secondaryPanel;
if (key.getPanelId() != null)
panelToUse = findPanel(panels, key.getPanelId());
e.addToPanel(panelToUse, key, modifiedAttributes, this);
if (addCheckBoxes) {
if (checkBoxes == null)
@ -134,14 +133,11 @@ public class AttributeDialog extends JDialog {
checkBox.setSelected(true);
checkBox.setToolTipText(Lang.get("msg_modifyThisAttribute"));
checkBoxes.put(key, checkBox);
panel.add(checkBox, constraints.x(2));
panelToUse.add(checkBox, cb -> cb.x(2));
checkBox.addChangeListener(event -> e.setEnabled(checkBox.isSelected()));
}
if (key.isSecondary() && enableTwoTabs)
secondaryConstraints.nextRow();
else
constraints.nextRow();
panelToUse.nextRow();
if (topMostTextComponent == null && e instanceof EditorFactory.StringEditor)
topMostTextComponent = ((EditorFactory.StringEditor) e).getTextComponent();
@ -157,14 +153,14 @@ public class AttributeDialog extends JDialog {
}
if (isSecondary) {
if (panels.size() == 1) {
getContentPane().add(primaryPanel.getScrollPane());
} else {
JTabbedPane tp = new JTabbedPane(JTabbedPane.TOP);
tp.addTab(Lang.get("attr_primary"), new JScrollPane(panel));
tp.addTab(Lang.get("attr_secondary"), new JScrollPane(secondaryPanel));
for (EditorPanel ep : panels)
tp.addTab(Lang.get(ep.getLangKey()), ep.getScrollPane());
getContentPane().add(tp);
} else
getContentPane().add(new JScrollPane(panel));
}
okAction = new AbstractAction(Lang.get("ok")) {
@Override
@ -221,6 +217,16 @@ public class AttributeDialog extends JDialog {
JComponent.WHEN_IN_FOCUSED_WINDOW);
}
private EditorPanel findPanel(ArrayList<EditorPanel> panels, String panelId) {
for (EditorPanel p : panels)
if (panelId.equals(p.getPanelId()))
return p;
EditorPanel p = new EditorPanel(panelId);
panels.add(p);
return p;
}
/**
* Sets the dialogs title
*
@ -277,9 +283,7 @@ public class AttributeDialog extends JDialog {
* @return this for chained calls
*/
AttributeDialog addButton(String label, ToolTipAction action) {
panel.add(new JLabel(label), constraints);
panel.add(action.createJButton(), constraints.x(1));
constraints.nextRow();
primaryPanel.addButton(label, action);
return this;
}

View File

@ -36,9 +36,8 @@ public interface Editor<T> {
* @param key the key which is to edit
* @param elementAttributes the attributes
* @param dialog the containing dialog
* @param constraints the constraints used to place the components in the panel
*/
void addToPanel(JPanel panel, Key key, ElementAttributes elementAttributes, AttributeDialog dialog, ConstraintsBuilder constraints);
void addToPanel(EditorPanel panel, Key key, ElementAttributes elementAttributes, AttributeDialog dialog);
/**
* Used to enable/disable the component.

View File

@ -122,7 +122,7 @@ public final class EditorFactory {
private JLabel label;
@Override
public void addToPanel(JPanel panel, Key key, ElementAttributes elementAttributes, AttributeDialog attributeDialog, ConstraintsBuilder constraints) {
public void addToPanel(EditorPanel panel, Key key, ElementAttributes elementAttributes, AttributeDialog attributeDialog) {
this.attributeDialog = attributeDialog;
label = new JLabel(key.getName() + ": ");
final String description = new LineBreaker().toHTML().breakLines(key.getDescription());
@ -130,12 +130,12 @@ public final class EditorFactory {
component = getComponent(elementAttributes);
component.setToolTipText(description);
if (labelAtTop) {
panel.add(label, constraints.width(2));
constraints.nextRow();
panel.add(component, constraints.width(2).dynamicHeight());
panel.add(label, cb -> cb.width(2));
panel.nextRow();
panel.add(component, cb -> cb.width(2).dynamicHeight());
} else {
panel.add(label, constraints);
panel.add(component, constraints.x(1).dynamicWidth());
panel.add(label);
panel.add(component, cb -> cb.x(1).dynamicWidth());
}
}
@ -466,8 +466,8 @@ public final class EditorFactory {
}
@Override
public void addToPanel(JPanel panel, Key key, ElementAttributes elementAttributes, AttributeDialog attributeDialog, ConstraintsBuilder constraints) {
panel.add(bool, constraints.width(2));
public void addToPanel(EditorPanel panel, Key key, ElementAttributes elementAttributes, AttributeDialog attributeDialog) {
panel.add(bool, cb -> cb.width(2));
}
@Override

View File

@ -0,0 +1,113 @@
/*
* Copyright (c) 2020 Helmut Neemann.
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
package de.neemann.digital.gui.components;
import de.neemann.gui.ToolTipAction;
import javax.swing.*;
import java.awt.*;
/**
* Panel used in the editor
*/
public class EditorPanel {
/**
* The Id for the primary panel
*/
public static final String PRIMARY = "primary";
/**
* The Id for the secondary panel
*/
public static final String SECONDARY = "secondary";
private final JPanel panel;
private final ConstraintsBuilder constraints;
private final String id;
/**
* Creates a new instance
*
* @param id the panels id, used to identify the panel and as part of the language key
*/
public EditorPanel(String id) {
this.id = id;
panel = new JPanel(new GridBagLayout());
constraints = new ConstraintsBuilder().inset(3).fill();
}
/**
* Moves to the next row
*/
public void nextRow() {
constraints.nextRow();
}
/**
* @return this panel wrapped with a scroll pane
*/
public Component getScrollPane() {
return new JScrollPane(panel);
}
/**
* @return the language key
*/
public String getLangKey() {
return "attr_panel_" + id;
}
/**
* Adds a component using the default constrains
*
* @param component the components to add
*/
public void add(JComponent component) {
panel.add(component, constraints);
}
/**
* Adds a component
*
* @param component the components to add
* @param c allows to modify the constraints
*/
public void add(JComponent component, Constraints c) {
panel.add(component, c.create(constraints));
}
/**
* Adds a button
*
* @param label the label to use
* @param action the action to use
*/
public void addButton(String label, ToolTipAction action) {
panel.add(new JLabel(label), constraints);
panel.add(action.createJButton(), constraints.x(1));
constraints.nextRow();
}
/**
* @return the panels id
*/
public String getPanelId() {
return id;
}
/**
* The interface used to modify the constraints
*/
interface Constraints {
/**
* Allows to modify the constraints
*
* @param cb the default constraints
* @return the modified constraints
*/
ConstraintsBuilder create(ConstraintsBuilder cb);
}
}

View File

@ -19,8 +19,8 @@
<string name="attr_dialogHighz">HighZ</string>
<string name="attr_dialogOctal">Oktal</string>
<string name="attr_dialogBinary">Binär</string>
<string name="attr_primary">Standard</string>
<string name="attr_secondary">Erweitert</string>
<string name="attr_panel_primary">Standard</string>
<string name="attr_panel_secondary">Erweitert</string>
<string name="btn_discard">Verwerfen</string>
<string name="btn_edit">Bearbeiten</string>
<string name="btn_editFurther">Weiter bearbeiten</string>
@ -1313,18 +1313,31 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
Die Eingänge eines 8-Bit Addierers könnten also mit "a:8,b:8,c_in" beschrieben werden.</string>
<string name="key_externalOutputs">Ausgänge</string>
<string name="key_externalOutputs_tt">Die Ausgänge des externen Prozesses. Es handelt sich um eine kommaseparierte
Liste mit Signalnamen. Bei jedem Signalnamen kann, mit einem Doppelpunkt getrennt, eine Bitanzahl angegeben werden.
Die Ausgänge eines 8-Bit Addierers könnten also mit "s:8,c_out" beschrieben werden.</string>
Liste mit Signalnamen. Bei jedem Signalnamen kann, mit einem Doppelpunkt getrennt, eine Bitanzahl angegeben
werden.
Die Ausgänge eines 8-Bit Addierers könnten also mit "s:8,c_out" beschrieben werden.
</string>
<string name="key_Code">Programmcode</string>
<string name="key_Code_tt">Der Programmcode welcher ausgeführt werden soll.</string>
<string name="attr_panel_ghdl">GHDL</string>
<string name="key_ghdlPath">GHDL</string>
<string name="key_ghdlPath_tt">Pfad der ausführbaren ghdl-Datei. Nur wichtig, wenn ghdl zur Interpretation von
VHDL-Code verwendet werden soll.</string>
VHDL-Code verwendet werden soll.
</string>
<string name="key_ghdlOptAnalysis">Analyse</string>
<string name="key_ghdlOptAnalysis_tt">Optionen, die für die Analyse durch GHDL verwendet werden.</string>
<string name="key_ghdlOptElaboration">Elaboration</string>
<string name="key_ghdlOptElaboration_tt">Optionen, die für die Elaboration durch GHDL verwendet werden.</string>
<string name="key_ghdlOptRun">Start</string>
<string name="key_ghdlOptRun_tt">Optionen, die für den Start durch GHDL verwendet werden.</string>
<string name="key_iverilogPath">IVerilog</string>
<string name="key_iverilogPath_tt">Pfad zum Icarus-Verilog-Installationsordner. Nur notwendig, wenn Sie iverilog
verwenden möchten, um mit Verilog definierte Komponenten zu simulieren.</string>
verwenden möchten, um mit Verilog definierte Komponenten zu simulieren.
</string>
<string name="key_maxValue">Maximalwert</string>
<string name="key_maxValue_tt">Wird hier eine Null eingetragen, wird der maximal mögliche Wert verwendet (Alle Bits sind Eins).</string>
<string name="key_maxValue_tt">Wird hier eine Null eingetragen, wird der maximal mögliche Wert verwendet (Alle Bits
sind Eins).
</string>
<string name="key_dipDefault">Ausgabe ist High</string>
<string name="key_dipDefault_tt">Der Vorgabewert des DIP-Schalters, wenn die Simulation gestartet wird.</string>

View File

@ -19,8 +19,8 @@
<string name="attr_dialogHighz">HighZ</string>
<string name="attr_dialogOctal">Octal</string>
<string name="attr_dialogBinary">Binary</string>
<string name="attr_primary">Basic</string>
<string name="attr_secondary">Advanced</string>
<string name="attr_panel_primary">Basic</string>
<string name="attr_panel_secondary">Advanced</string>
<string name="btn_discard">Discard Changes</string>
<string name="btn_edit">Edit</string>
<string name="btn_editFurther">Continue editing</string>
@ -1289,15 +1289,27 @@
<string name="key_externalOutputs">Outputs</string>
<string name="key_externalOutputs_tt">The outputs of the external process.
It is a comma-separated list of signal names. For each signal name, with a colon separated, a number of bits
can be specified. The outputs of an 8-bit adder could thus be described as "s:8,c_out".</string>
can be specified. The outputs of an 8-bit adder could thus be described as "s:8,c_out".
</string>
<string name="key_Code">Programcode</string>
<string name="key_Code_tt">The programm code to be executed by the external application.</string>
<string name="attr_panel_ghdl">GHDL</string>
<string name="key_ghdlPath">GHDL</string>
<string name="key_ghdlPath_tt">Path to the executable ghdl file. Only necessary if you want to use ghdl to simulate
components defined with vhdl.</string>
components defined with vhdl.
</string>
<string name="key_ghdlOptAnalysis">Analysis</string>
<string name="key_ghdlOptAnalysis_tt">Options used for the GHDL analysis.</string>
<string name="key_ghdlOptElaboration">Elaboration</string>
<string name="key_ghdlOptElaboration_tt">Options used for the GHDL elaboration.</string>
<string name="key_ghdlOptRun">Run</string>
<string name="key_ghdlOptRun_tt">Options used for the start of GHDL.</string>
<string name="key_iverilogPath">IVerilog</string>
<string name="key_iverilogPath_tt">Path to the Icarus verilog installation folder. Only necessary if you want to use iverilog to simulate
components defined with verilog.</string>
<string name="key_iverilogPath_tt">Path to the Icarus verilog installation folder. Only necessary if you want to use
iverilog to simulate
components defined with verilog.
</string>
<string name="key_maxValue">Maximum Value</string>
<string name="key_maxValue_tt">If a zero is entered, the maximum possible value is used (all bits are one).</string>

View File

@ -9,28 +9,28 @@
<string name="maxValue">máximo</string>
<string name="attr_dialogTitle">Propiedades</string>
<string name="attr_openCircuit">Abrir circuito</string>
<string name="attr_openCircuitLabel">Incluir circuito:</string>
<string name="attr_openCircuit_tt">Abre el circuito en una ventana nueva</string>
<string name="attr_help">Ayuda</string>
<string name="attr_help_tt">Muestra una pequeña descripción de este elemento</string>
<string name="attr_dialogHex">HEX</string>
<string name="attr_dialogDecimal">Decimal</string>
<string name="attr_dialogAscii">ASCII</string>
<string name="attr_dialogHighz">Alta impedancia</string>
<string name="attr_dialogOctal">Octal</string>
<string name="attr_dialogBinary">Binario</string>
<string name="attr_primary">Básico</string>
<string name="attr_secondary">Avanzado</string>
<string name="btn_discard">Descartar cambios</string>
<string name="btn_edit">Editar</string>
<string name="btn_editFurther">Seguir editando</string>
<string name="btn_load">Cargar</string>
<string name="btn_reload">Recargar</string>
<string name="btn_reload_tt">Recargar último archivo HEX</string>
<string name="btn_save">Guardar</string>
<string name="btn_saveAsHex_tt">Guardar como archivo HEX</string>
<string name="btn_create">Crear</string>
<string name="btn_create_tt">Crear un circuito en otra ventana</string>
<string name="attr_openCircuitLabel">Incluir circuito:</string>
<string name="attr_openCircuit_tt">Abre el circuito en una ventana nueva</string>
<string name="attr_help">Ayuda</string>
<string name="attr_help_tt">Muestra una pequeña descripción de este elemento</string>
<string name="attr_dialogHex">HEX</string>
<string name="attr_dialogDecimal">Decimal</string>
<string name="attr_dialogAscii">ASCII</string>
<string name="attr_dialogHighz">Alta impedancia</string>
<string name="attr_dialogOctal">Octal</string>
<string name="attr_dialogBinary">Binario</string>
<string name="attr_panel_primary">Básico</string>
<string name="attr_panel_secondary">Avanzado</string>
<string name="btn_discard">Descartar cambios</string>
<string name="btn_edit">Editar</string>
<string name="btn_editFurther">Seguir editando</string>
<string name="btn_load">Cargar</string>
<string name="btn_reload">Recargar</string>
<string name="btn_reload_tt">Recargar último archivo HEX</string>
<string name="btn_save">Guardar</string>
<string name="btn_saveAsHex_tt">Guardar como archivo HEX</string>
<string name="btn_create">Crear</string>
<string name="btn_create_tt">Crear un circuito en otra ventana</string>
<string name="btn_editDetached">Editar por separado</string>
<string name="btn_editDetached_tt">Abre el diálogo como no modal</string>
<string name="btn_openInBrowser">Navegador</string>

View File

@ -9,28 +9,28 @@
<string name="maxValue">maximum</string>
<string name="attr_dialogTitle">Attributes</string>
<string name="attr_openCircuit">Open Circuit</string>
<string name="attr_openCircuitLabel">Included circuit:</string>
<string name="attr_openCircuit_tt">Opens the circuit in a new window.</string>
<string name="attr_help">Help</string>
<string name="attr_help_tt">Shows a short description of this element.</string>
<string name="attr_dialogHex">Hex</string>
<string name="attr_dialogDecimal">Decimal</string>
<string name="attr_dialogAscii">Ascii</string>
<string name="attr_dialogHighz">HighZ</string>
<string name="attr_dialogOctal">Octal</string>
<string name="attr_dialogBinary">Binary</string>
<string name="attr_primary">Basic</string>
<string name="attr_secondary">Advanced</string>
<string name="btn_discard">Discard Changes</string>
<string name="btn_edit">Edit</string>
<string name="btn_editFurther">Continue editing</string>
<string name="btn_load">Load</string>
<string name="btn_reload">Reload</string>
<string name="btn_reload_tt">Reload last hex file</string>
<string name="btn_save">Save</string>
<string name="btn_saveAsHex_tt">Save as HEX file.</string>
<string name="btn_create">Create</string>
<string name="btn_create_tt">Create a circuit in a separate window</string>
<string name="attr_openCircuitLabel">Included circuit:</string>
<string name="attr_openCircuit_tt">Opens the circuit in a new window.</string>
<string name="attr_help">Help</string>
<string name="attr_help_tt">Shows a short description of this element.</string>
<string name="attr_dialogHex">Hex</string>
<string name="attr_dialogDecimal">Decimal</string>
<string name="attr_dialogAscii">Ascii</string>
<string name="attr_dialogHighz">HighZ</string>
<string name="attr_dialogOctal">Octal</string>
<string name="attr_dialogBinary">Binary</string>
<string name="attr_panel_primary">Basic</string>
<string name="attr_panel_secondary">Advanced</string>
<string name="btn_discard">Discard Changes</string>
<string name="btn_edit">Edit</string>
<string name="btn_editFurther">Continue editing</string>
<string name="btn_load">Load</string>
<string name="btn_reload">Reload</string>
<string name="btn_reload_tt">Reload last hex file</string>
<string name="btn_save">Save</string>
<string name="btn_saveAsHex_tt">Save as HEX file.</string>
<string name="btn_create">Create</string>
<string name="btn_create_tt">Create a circuit in a separate window</string>
<string name="btn_editDetached">Edit detached</string>
<string name="btn_editDetached_tt">Opens the dialog as a non modal dialog</string>
<string name="btn_openInBrowser">Browser</string>

View File

@ -9,28 +9,28 @@
<string name="settings">A seguir descrevem-se as configurações disponíveis no simulador.</string>
<string name="attr_dialogTitle">Atributos</string>
<string name="attr_openCircuit">Abrir circuito</string>
<string name="attr_openCircuitLabel">Incluir circuito:</string>
<string name="attr_openCircuit_tt">Abrir circuito em um nova janela.</string>
<string name="attr_help">Ajuda</string>
<string name="attr_help_tt">Mostrar uma breve descrição desse elemento.</string>
<string name="attr_dialogHex">Hexadecimal</string>
<string name="attr_dialogDecimal">Decimal</string>
<string name="attr_dialogAscii">ASCII</string>
<string name="attr_dialogHighz">Alta impedância</string>
<string name="attr_dialogOctal">Octal</string>
<string name="attr_dialogBinary">Binário</string>
<string name="attr_primary">Básico</string>
<string name="attr_secondary">Avançado</string>
<string name="btn_discard">Descartar alterações</string>
<string name="btn_edit">Editar</string>
<string name="btn_editFurther">Continuar edição</string>
<string name="btn_load">Carregar</string>
<string name="btn_reload">Recarregar</string>
<string name="btn_reload_tt">Recarregar último arquivo em hexadecimal</string>
<string name="btn_save">Salvar</string>
<string name="btn_saveAsHex_tt">Salvar como arquivo HEX.</string>
<string name="btn_create">Criar</string>
<string name="btn_create_tt">Criar circuito em janela separada</string>
<string name="attr_openCircuitLabel">Incluir circuito:</string>
<string name="attr_openCircuit_tt">Abrir circuito em um nova janela.</string>
<string name="attr_help">Ajuda</string>
<string name="attr_help_tt">Mostrar uma breve descrição desse elemento.</string>
<string name="attr_dialogHex">Hexadecimal</string>
<string name="attr_dialogDecimal">Decimal</string>
<string name="attr_dialogAscii">ASCII</string>
<string name="attr_dialogHighz">Alta impedância</string>
<string name="attr_dialogOctal">Octal</string>
<string name="attr_dialogBinary">Binário</string>
<string name="attr_panel_primary">Básico</string>
<string name="attr_panel_secondary">Avançado</string>
<string name="btn_discard">Descartar alterações</string>
<string name="btn_edit">Editar</string>
<string name="btn_editFurther">Continuar edição</string>
<string name="btn_load">Carregar</string>
<string name="btn_reload">Recarregar</string>
<string name="btn_reload_tt">Recarregar último arquivo em hexadecimal</string>
<string name="btn_save">Salvar</string>
<string name="btn_saveAsHex_tt">Salvar como arquivo HEX.</string>
<string name="btn_create">Criar</string>
<string name="btn_create_tt">Criar circuito em janela separada</string>
<string name="btn_editDetached">Editar em separado</string>
<string name="btn_editDetached_tt">Abrir diálogo como não modal</string>
<string name="btn_openInBrowser">Navegador</string>

View File

@ -10,28 +10,28 @@
<string name="settings">The following describes the available settings of the simulator.</string>
<string name="attr_dialogTitle">Attributes</string>
<string name="attr_openCircuit">Open Circuit</string>
<string name="attr_openCircuitLabel">Included circuit:</string>
<string name="attr_openCircuit_tt">Opens the circuit in a new window.</string>
<string name="attr_help">Help</string>
<string name="attr_help_tt">Shows a short description of this element.</string>
<string name="attr_dialogHex">Hex</string>
<string name="attr_dialogDecimal">Decimal</string>
<string name="attr_dialogAscii">Ascii</string>
<string name="attr_dialogHighz">HighZ</string>
<string name="attr_dialogOctal">Octal</string>
<string name="attr_dialogBinary">Binary</string>
<string name="attr_primary">Basic</string>
<string name="attr_secondary">Advanced</string>
<string name="btn_discard">Discard Changes</string>
<string name="btn_edit">Edit</string>
<string name="btn_editFurther">Continue editing</string>
<string name="btn_load">Load</string>
<string name="btn_reload">Reload</string>
<string name="btn_reload_tt">Reload last hex file</string>
<string name="btn_save">Save</string>
<string name="btn_saveAsHex_tt">Save as HEX file.</string>
<string name="btn_create">Create</string>
<string name="btn_create_tt">Create a circuit in a separate window</string>
<string name="attr_openCircuitLabel">Included circuit:</string>
<string name="attr_openCircuit_tt">Opens the circuit in a new window.</string>
<string name="attr_help">Help</string>
<string name="attr_help_tt">Shows a short description of this element.</string>
<string name="attr_dialogHex">Hex</string>
<string name="attr_dialogDecimal">Decimal</string>
<string name="attr_dialogAscii">Ascii</string>
<string name="attr_dialogHighz">HighZ</string>
<string name="attr_dialogOctal">Octal</string>
<string name="attr_dialogBinary">Binary</string>
<string name="attr_panel_primary">Basic</string>
<string name="attr_panel_secondary">Advanced</string>
<string name="btn_discard">Discard Changes</string>
<string name="btn_edit">Edit</string>
<string name="btn_editFurther">Continue editing</string>
<string name="btn_load">Load</string>
<string name="btn_reload">Reload</string>
<string name="btn_reload_tt">Reload last hex file</string>
<string name="btn_save">Save</string>
<string name="btn_saveAsHex_tt">Save as HEX file.</string>
<string name="btn_create">Create</string>
<string name="btn_create_tt">Create a circuit in a separate window</string>
<string name="btn_editDetached">Edit detached</string>
<string name="btn_editDetached_tt">Opens the dialog as a non modal dialog</string>
<string name="btn_openInBrowser">Browser</string>

View File

@ -0,0 +1,26 @@
/*
* Copyright (c) 2020 Helmut Neemann.
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
package de.neemann.digital.core.extern;
import junit.framework.TestCase;
import java.util.ArrayList;
public class OptionsTest extends TestCase {
public void testSimple() {
check(new Options().addString("-a -e -u=zzz"), "-a", "-e", "-u=zzz");
check(new Options().addString("-a -e -u=\"Hello World\""), "-a", "-e", "-u=\"Hello World\"");
check(new Options().addString("-a -u=\"Hello World\" -e"), "-a", "-u=\"Hello World\"", "-e");
}
private void check(Options options, String... opt) {
ArrayList<String> l = options.getList();
assertEquals(opt.length, l.size());
for (int i = 0; i < opt.length; i++)
assertEquals(opt[i], l.get(i));
}
}

View File

@ -68,7 +68,7 @@ public class TestLang extends TestCase {
StringBuilder sb = new StringBuilder();
for (String key : map.keySet()) {
if (!keys.contains(key)) {
if (!(key.startsWith("key_") || key.startsWith("elem_") || key.startsWith("tutorial"))) {
if (!(key.startsWith("key_") || key.startsWith("elem_") || key.startsWith("attr_panel_") || key.startsWith("tutorial"))) {
if (sb.length() > 0)
sb.append(", ");
sb.append('"').append(key).append('"');

View File

@ -894,7 +894,7 @@
</wire>
<wire>
<p1 x="760" y="980"/>
<p2 x="780" y="980"/>
<p2 x="820" y="980"/>
</wire>
<wire>
<p1 x="280" y="980"/>