mirror of
https://github.com/hneemann/Digital.git
synced 2025-08-04 02:08:00 -04:00
Added function to use the actual input values as new default values.
This commit is contained in:
parent
7ab79b47e1
commit
f30a6e7b16
@ -20,7 +20,7 @@
|
||||
<boolean>true</boolean>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="740" y="200"/>
|
||||
<pos x="800" y="200"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Comparator</elementName>
|
||||
@ -30,7 +30,7 @@
|
||||
<int>4</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="560" y="140"/>
|
||||
<pos x="620" y="140"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Const</elementName>
|
||||
@ -44,7 +44,7 @@
|
||||
<int>4</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="540" y="160"/>
|
||||
<pos x="600" y="160"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Comparator</elementName>
|
||||
@ -54,7 +54,7 @@
|
||||
<int>4</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="560" y="240"/>
|
||||
<pos x="620" y="240"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Const</elementName>
|
||||
@ -68,12 +68,12 @@
|
||||
<int>4</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="540" y="260"/>
|
||||
<pos x="600" y="260"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Or</elementName>
|
||||
<elementAttributes/>
|
||||
<pos x="660" y="220"/>
|
||||
<pos x="720" y="220"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>BitCount</elementName>
|
||||
@ -83,7 +83,7 @@
|
||||
<int>8</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="400" y="180"/>
|
||||
<pos x="480" y="180"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>D_FF</elementName>
|
||||
@ -112,7 +112,7 @@
|
||||
<int>8</int>
|
||||
</entry>
|
||||
</elementAttributes>
|
||||
<pos x="380" y="180"/>
|
||||
<pos x="460" y="180"/>
|
||||
</visualElement>
|
||||
<visualElement>
|
||||
<elementName>Multiplexer</elementName>
|
||||
@ -177,48 +177,48 @@
|
||||
<p2 x="940" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="500" y="240"/>
|
||||
<p2 x="560" y="240"/>
|
||||
<p1 x="560" y="240"/>
|
||||
<p2 x="620" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="720" y="240"/>
|
||||
<p2 x="740" y="240"/>
|
||||
<p1 x="780" y="240"/>
|
||||
<p2 x="800" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="1020" y="240"/>
|
||||
<p2 x="1040" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="620" y="160"/>
|
||||
<p2 x="640" y="160"/>
|
||||
<p1 x="680" y="160"/>
|
||||
<p2 x="700" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="540" y="160"/>
|
||||
<p2 x="560" y="160"/>
|
||||
<p1 x="600" y="160"/>
|
||||
<p2 x="620" y="160"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="760" y="180"/>
|
||||
<p1 x="820" y="180"/>
|
||||
<p2 x="1020" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="460" y="180"/>
|
||||
<p2 x="500" y="180"/>
|
||||
<p1 x="540" y="180"/>
|
||||
<p2 x="560" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="380" y="180"/>
|
||||
<p2 x="400" y="180"/>
|
||||
<p1 x="460" y="180"/>
|
||||
<p2 x="480" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="920" y="260"/>
|
||||
<p2 x="940" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="620" y="260"/>
|
||||
<p2 x="660" y="260"/>
|
||||
<p1 x="680" y="260"/>
|
||||
<p2 x="720" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="540" y="260"/>
|
||||
<p2 x="560" y="260"/>
|
||||
<p1 x="600" y="260"/>
|
||||
<p2 x="620" y="260"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="840" y="260"/>
|
||||
@ -229,8 +229,8 @@
|
||||
<p2 x="880" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="640" y="200"/>
|
||||
<p2 x="740" y="200"/>
|
||||
<p1 x="700" y="200"/>
|
||||
<p2 x="800" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="900" y="380"/>
|
||||
@ -241,49 +241,49 @@
|
||||
<p2 x="840" y="300"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="640" y="220"/>
|
||||
<p2 x="660" y="220"/>
|
||||
<p1 x="700" y="220"/>
|
||||
<p2 x="720" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="780" y="220"/>
|
||||
<p1 x="840" y="220"/>
|
||||
<p2 x="860" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="500" y="140"/>
|
||||
<p2 x="560" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="640" y="160"/>
|
||||
<p2 x="640" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="640" y="200"/>
|
||||
<p2 x="640" y="220"/>
|
||||
<p1 x="560" y="140"/>
|
||||
<p2 x="620" y="140"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="880" y="260"/>
|
||||
<p2 x="880" y="340"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="500" y="140"/>
|
||||
<p2 x="500" y="180"/>
|
||||
<p1 x="560" y="140"/>
|
||||
<p2 x="560" y="180"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="500" y="180"/>
|
||||
<p2 x="500" y="240"/>
|
||||
<p1 x="560" y="180"/>
|
||||
<p2 x="560" y="240"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="820" y="180"/>
|
||||
<p2 x="820" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="840" y="260"/>
|
||||
<p2 x="840" y="300"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="760" y="180"/>
|
||||
<p2 x="760" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="920" y="260"/>
|
||||
<p2 x="920" y="380"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="700" y="160"/>
|
||||
<p2 x="700" y="200"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="700" y="200"/>
|
||||
<p2 x="700" y="220"/>
|
||||
</wire>
|
||||
<wire>
|
||||
<p1 x="1020" y="180"/>
|
||||
<p2 x="1020" y="240"/>
|
||||
|
@ -17,6 +17,7 @@ import de.neemann.digital.draw.graphics.Polygon;
|
||||
import de.neemann.digital.draw.graphics.Style;
|
||||
import de.neemann.digital.draw.graphics.Vector;
|
||||
import de.neemann.digital.draw.shapes.Drawable;
|
||||
import de.neemann.digital.draw.shapes.InputShape;
|
||||
import de.neemann.digital.draw.shapes.ShapeFactory;
|
||||
import de.neemann.digital.gui.components.AttributeDialog;
|
||||
import de.neemann.digital.gui.components.test.TestData;
|
||||
@ -574,6 +575,20 @@ public class Circuit {
|
||||
this.measurementOrdering = measurementOrdering;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes actual input values to the default value
|
||||
*/
|
||||
public void actualToDefault() {
|
||||
for (VisualElement ve : visualElements)
|
||||
if (ve.equalsDescription(In.DESCRIPTION)) {
|
||||
ObservableValue ov = ((InputShape) ve.getShape()).getObservableValue();
|
||||
if (ov != null) {
|
||||
ve.getElementAttributes().set(Keys.DEFAULT, (int) ov.getValue());
|
||||
modified=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a rectangle to the circuit.
|
||||
* Only used to debug the {@link de.neemann.digital.builder.circuit.CircuitBuilder}.
|
||||
|
@ -72,6 +72,16 @@ public class InputShape implements Shape {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the output connected to this shape
|
||||
*/
|
||||
public ObservableValue getObservableValue() {
|
||||
if (ioState == null)
|
||||
return null;
|
||||
else
|
||||
return ioState.getOutput(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTo(Graphic graphic, boolean heighLight) {
|
||||
Style style = Style.NORMAL;
|
||||
|
@ -411,7 +411,17 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
||||
}
|
||||
}.setToolTip(Lang.get("menu_editSettings_tt"));
|
||||
|
||||
|
||||
ToolTipAction actualToDefault = new ToolTipAction(Lang.get("menu_actualToDefault")) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
circuitComponent.getCircuit().actualToDefault();
|
||||
elementState.enter();
|
||||
}
|
||||
}.setToolTip(Lang.get("menu_actualToDefault_tt"));
|
||||
|
||||
edit.add(editAttributes.createJMenuItem());
|
||||
edit.add(actualToDefault.createJMenuItem());
|
||||
edit.addSeparator();
|
||||
edit.add(elementStateAction.createJMenuItem());
|
||||
edit.add(orderInputs.createJMenuItem());
|
||||
|
@ -352,6 +352,8 @@ Zur Analyse können Sie die Schaltung im Gatterschrittmodus ausführen.</string>
|
||||
<string name="menu_expression_tt">Erzeugt eine Schaltung aus einem Ausdruck.</string>
|
||||
<string name="menu_runTests">Tests ausführen</string>
|
||||
<string name="menu_runTests_tt">Führt alle Tests in der Schaltung aus!</string>
|
||||
<string name="menu_actualToDefault">Eingänge übernehmen</string>
|
||||
<string name="menu_actualToDefault_tt">Aktuelle Eingangswerte als neue Vorgabewerte übernehmen.</string>
|
||||
<string name="message">Digital
|
||||
|
||||
Ein einfacher Simulator für digitale Schaltkreise.
|
||||
|
@ -352,6 +352,8 @@ To analyse you can run the circuit in single gate step mode.</string>
|
||||
<string name="menu_expression_tt">Create a circuit from an expression.</string>
|
||||
<string name="menu_runTests">Run Tests</string>
|
||||
<string name="menu_runTests_tt">Runs all test cases in the circuit</string>
|
||||
<string name="menu_actualToDefault">Set Inputs</string>
|
||||
<string name="menu_actualToDefault_tt">Use actual input values as new default values.</string>
|
||||
|
||||
<string name="message">Digital
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user