mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-27 23:18:02 -04:00
added 74xx special functions to undo event sourcing
This commit is contained in:
parent
1292f4e116
commit
d9080e91b8
@ -25,6 +25,8 @@ import de.neemann.digital.draw.shapes.ShapeFactory;
|
|||||||
import de.neemann.digital.gui.components.*;
|
import de.neemann.digital.gui.components.*;
|
||||||
import de.neemann.digital.gui.components.data.DataSetDialog;
|
import de.neemann.digital.gui.components.data.DataSetDialog;
|
||||||
import de.neemann.digital.gui.components.expression.ExpressionDialog;
|
import de.neemann.digital.gui.components.expression.ExpressionDialog;
|
||||||
|
import de.neemann.digital.gui.components.modification.Modifications;
|
||||||
|
import de.neemann.digital.gui.components.modification.ModifyAttribute;
|
||||||
import de.neemann.digital.gui.components.table.TableDialog;
|
import de.neemann.digital.gui.components.table.TableDialog;
|
||||||
import de.neemann.digital.gui.components.testing.TestResultDialog;
|
import de.neemann.digital.gui.components.testing.TestResultDialog;
|
||||||
import de.neemann.digital.gui.components.tree.LibraryTreeModel;
|
import de.neemann.digital.gui.components.tree.LibraryTreeModel;
|
||||||
@ -629,20 +631,18 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
if (!circuitComponent.isLocked()) {
|
if (!circuitComponent.isLocked()) {
|
||||||
String prefix = showInputDialog(Lang.get("menu_addPrefix"));
|
String prefix = showInputDialog(Lang.get("menu_addPrefix"));
|
||||||
if (prefix != null && prefix.length() > 0) {
|
if (prefix != null && prefix.length() > 0) {
|
||||||
boolean modified = false;
|
Modifications.Builder builder = new Modifications.Builder();
|
||||||
for (Drawable d : circuitComponent.getHighLighted()) {
|
for (Drawable d : circuitComponent.getHighLighted()) {
|
||||||
if (d instanceof VisualElement) {
|
if (d instanceof VisualElement) {
|
||||||
VisualElement v = (VisualElement) d;
|
VisualElement v = (VisualElement) d;
|
||||||
if (v.equalsDescription(In.DESCRIPTION) || v.equalsDescription(Out.DESCRIPTION)) {
|
if (v.equalsDescription(In.DESCRIPTION) || v.equalsDescription(Out.DESCRIPTION)) {
|
||||||
ElementAttributes attr = v.getElementAttributes();
|
ElementAttributes attr = v.getElementAttributes();
|
||||||
String l = prefix + attr.getLabel();
|
String l = prefix + attr.getLabel();
|
||||||
attr.set(Keys.LABEL, l);
|
builder.add(new ModifyAttribute<>(v, Keys.LABEL, l));
|
||||||
modified = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (modified)
|
circuitComponent.modify(builder.build());
|
||||||
circuitComponent.repaintNeeded();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -651,22 +651,19 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
if (!circuitComponent.isLocked()) {
|
if (!circuitComponent.isLocked()) {
|
||||||
boolean modified = false;
|
Modifications.Builder builder = new Modifications.Builder();
|
||||||
for (Drawable d : circuitComponent.getHighLighted()) {
|
for (Drawable d : circuitComponent.getHighLighted()) {
|
||||||
if (d instanceof VisualElement) {
|
if (d instanceof VisualElement) {
|
||||||
VisualElement v = (VisualElement) d;
|
VisualElement v = (VisualElement) d;
|
||||||
if (v.equalsDescription(In.DESCRIPTION) || v.equalsDescription(Out.DESCRIPTION)) {
|
if (v.equalsDescription(In.DESCRIPTION) || v.equalsDescription(Out.DESCRIPTION)) {
|
||||||
ElementAttributes attr = v.getElementAttributes();
|
ElementAttributes attr = v.getElementAttributes();
|
||||||
String l = attr.getLabel();
|
String l = attr.getLabel();
|
||||||
if (l.length() > 1) {
|
if (l.length() > 1)
|
||||||
attr.set(Keys.LABEL, l.substring(1));
|
builder.add(new ModifyAttribute<>(v, Keys.LABEL, l.substring(1)));
|
||||||
modified = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
circuitComponent.modify(builder.build());
|
||||||
if (modified)
|
|
||||||
circuitComponent.repaintNeeded();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.setToolTip(Lang.get("menu_removePrefix_tt")).createJMenuItem());
|
}.setToolTip(Lang.get("menu_removePrefix_tt")).createJMenuItem());
|
||||||
@ -681,21 +678,18 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
if (!circuitComponent.isLocked()) {
|
if (!circuitComponent.isLocked()) {
|
||||||
boolean modified = false;
|
Modifications.Builder builder = new Modifications.Builder();
|
||||||
for (VisualElement v : circuitComponent.getCircuit().getElements()) {
|
for (VisualElement v : circuitComponent.getCircuit().getElements()) {
|
||||||
if (v.equalsDescription(In.DESCRIPTION)
|
if (v.equalsDescription(In.DESCRIPTION)
|
||||||
|| v.equalsDescription(Clock.DESCRIPTION)
|
|| v.equalsDescription(Clock.DESCRIPTION)
|
||||||
|| v.equalsDescription(Out.DESCRIPTION)) {
|
|| v.equalsDescription(Out.DESCRIPTION)) {
|
||||||
ElementAttributes attr = v.getElementAttributes();
|
ElementAttributes attr = v.getElementAttributes();
|
||||||
int p = attr.get(Keys.PINNUMBER);
|
int p = attr.get(Keys.PINNUMBER);
|
||||||
if (p > 0) {
|
if (p > 0)
|
||||||
attr.set(Keys.PINNUMBER, 0);
|
builder.add(new ModifyAttribute<>(v, Keys.PINNUMBER, 0));
|
||||||
modified = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
circuitComponent.modify(builder.build());
|
||||||
if (modified)
|
|
||||||
circuitComponent.repaintNeeded();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.setToolTip(Lang.get("menu_removePinNumbers_tt")).createJMenuItem());
|
}.setToolTip(Lang.get("menu_removePinNumbers_tt")).createJMenuItem());
|
||||||
|
@ -1346,6 +1346,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void activate(Vector startPos) {
|
private void activate(Vector startPos) {
|
||||||
|
startPos=raster(startPos);
|
||||||
activate(startPos, startPos);
|
activate(startPos, startPos);
|
||||||
selectionMade = false;
|
selectionMade = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user