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:
parent
cd798abd1b
commit
04a7e7ff15
@ -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();
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user