mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-13 06:49:36 -04:00
stores view favorites in the *.dig file, see #335
This commit is contained in:
parent
27eee49eea
commit
266cd1db03
@ -121,7 +121,6 @@ public class CircuitComponent extends JComponent implements ChangedListener, Lib
|
|||||||
|
|
||||||
private MouseController activeMouseController;
|
private MouseController activeMouseController;
|
||||||
private AffineTransform transform = new AffineTransform();
|
private AffineTransform transform = new AffineTransform();
|
||||||
private AffineTransform[] favorites = new AffineTransform[10];
|
|
||||||
private Observer manualChangeObserver;
|
private Observer manualChangeObserver;
|
||||||
private Vector lastMousePos;
|
private Vector lastMousePos;
|
||||||
private SyncAccess modelSync = SyncAccess.NOSYNC;
|
private SyncAccess modelSync = SyncAccess.NOSYNC;
|
||||||
@ -279,23 +278,26 @@ public class CircuitComponent extends JComponent implements ChangedListener, Lib
|
|||||||
private void enableFavoritPositions() {
|
private void enableFavoritPositions() {
|
||||||
for (int j = 0; j <= 9; j++) {
|
for (int j = 0; j <= 9; j++) {
|
||||||
final int i = j;
|
final int i = j;
|
||||||
|
final Key<AffineTransform> key = new Key<>("view" + i, AffineTransform::new);
|
||||||
new ToolTipAction("CTRL+" + i) {
|
new ToolTipAction("CTRL+" + i) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
favorites[i] = transform;
|
ElementAttributes attr = new ElementAttributes(getCircuit().getAttributes());
|
||||||
|
attr.set(key, transform);
|
||||||
|
modify(new ModifyCircuitAttributes(attr));
|
||||||
}
|
}
|
||||||
}.setAcceleratorCTRLplus((char) ('0' + i)).enableAcceleratorIn(this);
|
}.setAcceleratorCTRLplus((char) ('0' + i)).enableAcceleratorIn(this);
|
||||||
new ToolTipAction("" + i) {
|
new ToolTipAction("" + i) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
if (favorites[i] != null) {
|
AffineTransform tr = getCircuit().getAttributes().get(key);
|
||||||
transform = favorites[i];
|
if (!tr.isIdentity()) {
|
||||||
|
transform = tr;
|
||||||
isManualScale = true;
|
isManualScale = true;
|
||||||
graphicHasChanged();
|
graphicHasChanged();
|
||||||
if (circuitScrollPanel != null)
|
if (circuitScrollPanel != null)
|
||||||
circuitScrollPanel.transformChanged(transform);
|
circuitScrollPanel.transformChanged(transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}.setAccelerator(KeyStroke.getKeyStroke((char) ('0' + i), 0)).enableAcceleratorIn(this);
|
}.setAccelerator(KeyStroke.getKeyStroke((char) ('0' + i), 0)).enableAcceleratorIn(this);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user