Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0a08cf2

Browse files
committed
Add mnemonics to Boards menu: a-z,A-Z,0-9
1 parent 43b0818 commit 0a08cf2

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

‎app/src/processing/app/Base.java‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,15 +1424,31 @@ protected void onIndexesUpdated() throws Exception {
14241424
onBoardOrPortChange();
14251425
}
14261426

1427+
public void setMenuItemIncrementalMnemonic(JMenuItem item, int i) {
1428+
char c;
1429+
if (i>=0 && i<26) {
1430+
c = (char)(i+'a');
1431+
} else if (i>=26 && i<26*2) {
1432+
c = (char)(i-26+'A');
1433+
} else if (i>=26*2 && i<26*2 + 10) {
1434+
c = (char)(i-26*2+'0');
1435+
} else {
1436+
return;
1437+
}
1438+
item.setText(c + ". " + item.getText());
1439+
item.setMnemonic(c);
1440+
}
1441+
14271442
public void rebuildBoardsMenu() throws Exception {
14281443
boardsCustomMenus = new LinkedList<>();
14291444

14301445
// The first custom menu is the "Board" selection submenu
14311446
JMenu boardMenu = new JMenu(tr("Board"));
1447+
boardMenu.setMnemonic('B');
14321448
boardMenu.putClientProperty("removeOnWindowDeactivation", true);
14331449
MenuScroller.setScrollerFor(boardMenu).setTopFixedCount(1);
14341450

1435-
boardMenu.add(new JMenuItem(new AbstractAction(tr("Boards Manager...")) {
1451+
JMenuItemmenuItem = new JMenuItem(new AbstractAction(tr("Boards Manager...")) {
14361452
public void actionPerformed(ActionEvent actionevent) {
14371453
String filterText = "";
14381454
String dropdownItem = "";
@@ -1448,7 +1464,9 @@ public void actionPerformed(ActionEvent actionevent) {
14481464
e.printStackTrace();
14491465
}
14501466
}
1451-
}));
1467+
});
1468+
menuItem.setMnemonic('M');
1469+
boardMenu.add(menuItem);
14521470
boardsCustomMenus.add(boardMenu);
14531471

14541472
// If there are no platforms installed we are done
@@ -1522,9 +1540,14 @@ public void actionPerformed(ActionEvent actionevent) {
15221540
}
15231541
} else {
15241542
// For multiple platforms, use submenus
1543+
// int i=0;
1544+
String keys="";
1545+
int i=0;
15251546
for (JMenu platformMenu : platformMenus) {
15261547
if (firstBoardItem == null && platformMenu.getItemCount() > 0)
15271548
firstBoardItem = platformMenu.getItem(0);
1549+
setMenuItemIncrementalMnemonic(platformMenu, i);
1550+
i++;
15281551
boardMenu.add(platformMenu);
15291552
}
15301553
}

‎app/src/processing/app/Editor.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ private JMenu buildToolsMenu() {
741741

742742
if (portMenu == null)
743743
portMenu = new JMenu(tr("Port"));
744+
portMenu.setMnemonic('P');
744745
populatePortMenu();
745746
toolsMenu.add(portMenu);
746747
MenuScroller.setScrollerFor(portMenu);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /