mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-19 01:44:44 -04:00
adds view favorites, closes #335
This commit is contained in:
parent
1a00e38a85
commit
27eee49eea
@ -121,6 +121,7 @@ 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;
|
||||||
@ -258,6 +259,8 @@ public class CircuitComponent extends JComponent implements ChangedListener, Lib
|
|||||||
addMouseMotionListener(dispatcher);
|
addMouseMotionListener(dispatcher);
|
||||||
addMouseListener(dispatcher);
|
addMouseListener(dispatcher);
|
||||||
|
|
||||||
|
enableFavoritPositions();
|
||||||
|
|
||||||
mouseNormal.activate();
|
mouseNormal.activate();
|
||||||
|
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
@ -273,6 +276,31 @@ public class CircuitComponent extends JComponent implements ChangedListener, Lib
|
|||||||
setToolTipText("");
|
setToolTipText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void enableFavoritPositions() {
|
||||||
|
for (int j = 0; j <= 9; j++) {
|
||||||
|
final int i = j;
|
||||||
|
new ToolTipAction("CTRL+" + i) {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
|
favorites[i] = transform;
|
||||||
|
}
|
||||||
|
}.setAcceleratorCTRLplus((char) ('0' + i)).enableAcceleratorIn(this);
|
||||||
|
new ToolTipAction("" + i) {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent actionEvent) {
|
||||||
|
if (favorites[i] != null) {
|
||||||
|
transform = favorites[i];
|
||||||
|
isManualScale = true;
|
||||||
|
graphicHasChanged();
|
||||||
|
if (circuitScrollPanel != null)
|
||||||
|
circuitScrollPanel.transformChanged(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}.setAccelerator(KeyStroke.getKeyStroke((char) ('0' + i), 0)).enableAcceleratorIn(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void createAdditionalShortcuts(ShapeFactory shapeFactory) {
|
private void createAdditionalShortcuts(ShapeFactory shapeFactory) {
|
||||||
new ToolTipAction("diagWire") {
|
new ToolTipAction("diagWire") {
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
<!-- Checks for Size Violations. -->
|
<!-- Checks for Size Violations. -->
|
||||||
<!-- See http://checkstyle.sf.net/config_sizes.html -->
|
<!-- See http://checkstyle.sf.net/config_sizes.html -->
|
||||||
<module name="FileLength">
|
<module name="FileLength">
|
||||||
<property name="max" value="2500"/>
|
<property name="max" value="3000"/>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
<!-- Checks for whitespace -->
|
<!-- Checks for whitespace -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user