1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-20 14:54:31 +01:00

Added alternative key binding for "Increase Font Size"

This commits adds the "CTRL SHIFT =" as key to increase font size.
The old shortcut "CTRL +" is still active, but it's not always
possible to produce it if the keyboard layout doesn't have the + key
on the base layer.

This add the possibility to compose "CTRL +" when the keyboard has
the "+" available as "SHIFT =", that seems to be very common in
many layouts.

Fix #6806
This commit is contained in:
Cristian Maglie 2018-08-15 00:27:03 +02:00
parent 1a576dd468
commit 2988136f97

View File

@ -1397,12 +1397,15 @@ public class Editor extends JFrame implements RunnerListener {
JMenuItem increaseFontSizeItem = newJMenuItem(tr("Increase Font Size"), KeyEvent.VK_PLUS);
increaseFontSizeItem.addActionListener(event -> base.handleFontSizeChange(1));
menu.add(increaseFontSizeItem);
JMenuItem decreaseFontSizeItem = newJMenuItem(tr("Decrease Font Size"), '-');
decreaseFontSizeItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
base.handleFontSizeChange(-1);
}
// Add alternative shortcut "CTRL SHIFT =" for keyboards that haven't the "+" key
// in the base layer. This workaround covers all the keyboards that have the "+"
// key available as "SHIFT =" that seems to be very common.
KeyStroke ctrlShiftEq = KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, SHORTCUT_KEY_MASK | ActionEvent.SHIFT_MASK);
menu.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(ctrlShiftEq, "IncreaseFontSize");
menu.getActionMap().put("IncreaseFontSize", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
base.handleFontSizeChange(1);
}
});
menu.add(decreaseFontSizeItem);