mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-28 07:28:20 -04:00
added a flip shortcut
This commit is contained in:
parent
72849cddab
commit
34564f49af
@ -8,6 +8,9 @@ Planned as v0.12
|
|||||||
Up to now only a view 74xx circuits are available.
|
Up to now only a view 74xx circuits are available.
|
||||||
- Add some functions to make it easier to create 74xx circuits.
|
- Add some functions to make it easier to create 74xx circuits.
|
||||||
- Added undo/redo functions
|
- Added undo/redo functions
|
||||||
|
- New wire drawing mode: If a wire is added it is rectangular by default.
|
||||||
|
Pressing ESC switches to diagonal mode, pressing ESC again aborts the wire operation.
|
||||||
|
In rectangular mode the key "F" flips the wire.
|
||||||
|
|
||||||
v0.11.1, released on 02. May 2017
|
v0.11.1, released on 02. May 2017
|
||||||
- Added the possibility to open a circuit from the command line.
|
- Added the possibility to open a circuit from the command line.
|
||||||
|
@ -148,6 +148,14 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
}
|
}
|
||||||
}.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)).enableAcceleratorIn(this);
|
}.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)).enableAcceleratorIn(this);
|
||||||
|
|
||||||
|
new ToolTipAction("flipWire") {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (activeMouseController instanceof MouseControllerWireRect)
|
||||||
|
((MouseControllerWireRect) activeMouseController).flipWire();
|
||||||
|
}
|
||||||
|
}.setAccelerator(KeyStroke.getKeyStroke("F")).enableAcceleratorIn(this);
|
||||||
|
|
||||||
new ToolTipAction(Lang.get("menu_programDiode")) {
|
new ToolTipAction(Lang.get("menu_programDiode")) {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -1200,8 +1208,9 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
private Wire wire1;
|
private Wire wire1;
|
||||||
private Wire wire2;
|
private Wire wire2;
|
||||||
private boolean selectionMade;
|
private boolean selectionMade;
|
||||||
private boolean firstHori;
|
private boolean firstHorizontal;
|
||||||
private Vector initialPos;
|
private Vector initialPos;
|
||||||
|
private Vector lastPosition;
|
||||||
|
|
||||||
private MouseControllerWireRect(Cursor cursor) {
|
private MouseControllerWireRect(Cursor cursor) {
|
||||||
super(cursor);
|
super(cursor);
|
||||||
@ -1217,25 +1226,28 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void moved(MouseEvent e) {
|
void moved(MouseEvent e) {
|
||||||
Vector p = raster(getPosVector(e));
|
lastPosition = raster(getPosVector(e));
|
||||||
if (!selectionMade) {
|
if (!selectionMade) {
|
||||||
Vector delta = p.sub(initialPos);
|
Vector delta = lastPosition.sub(initialPos);
|
||||||
boolean dx = Math.abs(delta.x) > DRAG_DISTANCE;
|
boolean dx = Math.abs(delta.x) > DRAG_DISTANCE;
|
||||||
boolean dy = Math.abs(delta.y) > DRAG_DISTANCE;
|
boolean dy = Math.abs(delta.y) > DRAG_DISTANCE;
|
||||||
if (dx || dy) {
|
if (dx || dy) {
|
||||||
firstHori = dx;
|
firstHorizontal = dx;
|
||||||
selectionMade = true;
|
selectionMade = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setWires();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setWires() {
|
||||||
Vector pm;
|
Vector pm;
|
||||||
if (firstHori)
|
if (firstHorizontal)
|
||||||
pm = new Vector(p.x, wire1.p1.y);
|
pm = new Vector(lastPosition.x, wire1.p1.y);
|
||||||
else
|
else
|
||||||
pm = new Vector(wire1.p1.x, p.y);
|
pm = new Vector(wire1.p1.x, lastPosition.y);
|
||||||
wire1.setP2(pm);
|
wire1.setP2(pm);
|
||||||
wire2.setP1(pm);
|
wire2.setP1(pm);
|
||||||
wire2.setP2(p);
|
wire2.setP2(lastPosition);
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1270,6 +1282,12 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|
|||||||
mouseWireDiag.activate(initialPos, wire2.p2);
|
mouseWireDiag.activate(initialPos, wire2.p2);
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void flipWire() {
|
||||||
|
selectionMade = true;
|
||||||
|
firstHorizontal = !firstHorizontal;
|
||||||
|
setWires();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user