1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

Add font size shortcuts (menu and keyboard)

This commit is contained in:
Michael G 2017-06-18 19:10:06 +10:00 committed by Martino Facchin
parent cd798abd1b
commit 04a7e7ff15
2 changed files with 29 additions and 0 deletions

View File

@ -1839,6 +1839,17 @@ public class Base {
dialog.setVisible(true);
}
/**
* Adjust font size
*/
public void handleFontSizeChange(int change) {
String pieces[] = PApplet.split(PreferencesData.get("editor.font"), ',');
int newSize = Integer.parseInt(pieces[2]) + change;
pieces[2] = String.valueOf(newSize);
PreferencesData.set("editor.font", PApplet.join(pieces, ','));
this.getEditors().forEach(processing.app.Editor::applyPreferences);
}
// XXX: Remove this method and make librariesIndexer non-static
static public LibraryList getLibraries() {
return BaseNoGui.librariesIndexer.getInstalledLibraries();

View File

@ -1374,6 +1374,24 @@ public class Editor extends JFrame implements RunnerListener {
menu.addSeparator();
JMenuItem increaseFontSizeItem = newJMenuItem(tr("Increase Font Size"), '=');
increaseFontSizeItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
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);
}
});
menu.add(decreaseFontSizeItem);
menu.addSeparator();
JMenuItem findItem = newJMenuItem(tr("Find..."), 'F');
findItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {