mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-19 01:44:44 -04:00
fixed some mac command key issues, see #324
This commit is contained in:
parent
e01e100ae6
commit
1c0d178924
@ -348,7 +348,7 @@ public class FSMFrame extends JFrame implements ClosingWindowListener.ConfirmSav
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fsmComponent.scaleCircuit(1 / 0.9);
|
||||
}
|
||||
}.setAccelerator("control PLUS");
|
||||
}.setAcceleratorCTRLplus("PLUS");
|
||||
// enable [+] which is SHIFT+[=] on english keyboard layout
|
||||
fsmComponent.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, KeyEvent.CTRL_DOWN_MASK, false), zoomIn);
|
||||
fsmComponent.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.CTRL_DOWN_MASK, false), zoomIn);
|
||||
@ -359,7 +359,7 @@ public class FSMFrame extends JFrame implements ClosingWindowListener.ConfirmSav
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
fsmComponent.scaleCircuit(0.9);
|
||||
}
|
||||
}.setAccelerator("control MINUS");
|
||||
}.setAcceleratorCTRLplus("MINUS");
|
||||
// enable [+] which is SHIFT+[=] on english keyboard layout
|
||||
fsmComponent.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, KeyEvent.CTRL_DOWN_MASK, false), zoomOut);
|
||||
fsmComponent.getActionMap().put(zoomOut, zoomOut);
|
||||
|
@ -352,7 +352,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
circuitComponent.scaleCircuit(1 / 0.9);
|
||||
}
|
||||
}.setAccelerator("control PLUS");
|
||||
}.setAcceleratorCTRLplus("PLUS");
|
||||
// enable [+] which is SHIFT+[=] on english keyboard layout
|
||||
circuitComponent.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, KeyEvent.CTRL_DOWN_MASK, false), zoomIn);
|
||||
circuitComponent.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.CTRL_DOWN_MASK, false), zoomIn);
|
||||
@ -363,7 +363,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
circuitComponent.scaleCircuit(0.9);
|
||||
}
|
||||
}.setAccelerator("control MINUS");
|
||||
}.setAcceleratorCTRLplus("MINUS");
|
||||
// enable [+] which is SHIFT+[=] on english keyboard layout
|
||||
circuitComponent.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, KeyEvent.CTRL_DOWN_MASK, false), zoomOut);
|
||||
circuitComponent.getActionMap().put(zoomOut, zoomOut);
|
||||
|
@ -129,13 +129,13 @@ public class GraphDialog extends JDialog implements Observer {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
graphComponent.scale(1.25f, getWidth() / 2);
|
||||
}
|
||||
}.setAccelerator("control PLUS");
|
||||
}.setAcceleratorCTRLplus("PLUS");
|
||||
ToolTipAction zoomOut = new ToolTipAction(Lang.get("menu_zoomOut"), ICON_ZOOM_OUT) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
graphComponent.scale(0.8f, getWidth() / 2);
|
||||
}
|
||||
}.setAccelerator("control MINUS");
|
||||
}.setAcceleratorCTRLplus("MINUS");
|
||||
|
||||
showTable = new ToolTipAction(Lang.get("menu_showDataAsTable")) {
|
||||
@Override
|
||||
|
@ -100,6 +100,20 @@ public abstract class ToolTipAction extends AbstractAction {
|
||||
return setAccelerator(KeyStroke.getKeyStroke(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an accelerator to the action
|
||||
*
|
||||
* @param key the accelerator key
|
||||
* @return this for call chaining
|
||||
*/
|
||||
public ToolTipAction setAcceleratorCTRLplus(String key) {
|
||||
int mask = KeyEvent.CTRL_DOWN_MASK;
|
||||
if (Screen.isMac())
|
||||
mask= KeyEvent.META_DOWN_MASK;
|
||||
int keyCode = KeyStroke.getKeyStroke(key).getKeyCode();
|
||||
return setAccelerator(KeyStroke.getKeyStroke(keyCode, mask));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an accelerator to the action
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user