Skip to content

Commit 1ddf8fd

Browse files
Separate the boards menu per platform
Previously, the Tools->Boards menu was one long list, divided into different platforms by (unselectable) headers. When more than one or two platforms were installed, this quickly results in a very long list of boards that is hard to navigate. This commit changes the board menu to have a submenu for each platform, where each submenu contains just the boards for that platform. This fixes part of arduino#8858.
1 parent 6116a8e commit 1ddf8fd

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

app/src/processing/app/Base.java

+7-12
Original file line numberDiff line numberDiff line change
@@ -1469,23 +1469,18 @@ public void actionPerformed(ActionEvent actionevent) {
14691469
Map<String, ButtonGroup> buttonGroupsMap = new HashMap<>();
14701470

14711471
// Cycle through all packages
1472-
boolean first = true;
14731472
for (TargetPackage targetPackage : BaseNoGui.packages.values()) {
14741473
// For every package cycle through all platform
14751474
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
14761475

1477-
// Add a separator from the previous platform
1478-
if (!first)
1479-
boardMenu.add(new JSeparator());
1480-
first = false;
1481-
14821476
// Add a title for each platform
14831477
String platformLabel = targetPlatform.getPreferences().get("name");
1484-
if (platformLabel != null && !targetPlatform.getBoards().isEmpty()) {
1485-
JMenuItem menuLabel = new JMenuItem(tr(platformLabel));
1486-
menuLabel.setEnabled(false);
1487-
boardMenu.add(menuLabel);
1488-
}
1478+
if (platformLabel == null)
1479+
platformLabel = targetPackage.getId() + "-" + targetPlatform.getId();
1480+
1481+
JMenu platformBoardsMenu = new JMenu(tr(platformLabel));
1482+
MenuScroller.setScrollerFor(platformBoardsMenu);
1483+
boardMenu.add(platformBoardsMenu);
14891484

14901485
// Cycle through all boards of this platform
14911486
for (TargetBoard board : targetPlatform.getBoards().values()) {
@@ -1494,7 +1489,7 @@ public void actionPerformed(ActionEvent actionevent) {
14941489
JMenuItem item = createBoardMenusAndCustomMenus(boardsCustomMenus, menuItemsToClickAfterStartup,
14951490
buttonGroupsMap,
14961491
board, targetPlatform, targetPackage);
1497-
boardMenu.add(item);
1492+
platformBoardsMenu.add(item);
14981493
boardsButtonGroup.add(item);
14991494
}
15001495
}

0 commit comments

Comments
 (0)