Skip to content

Commit 2a8a47e

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 #8858.
1 parent 8f02375 commit 2a8a47e

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

Diff for: app/src/processing/app/Base.java

+6-12
Original file line numberDiff line numberDiff line change
@@ -1469,23 +1469,17 @@ 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+
boardMenu.add(platformBoardsMenu);
14891483

14901484
// Cycle through all boards of this platform
14911485
for (TargetBoard board : targetPlatform.getBoards().values()) {
@@ -1494,7 +1488,7 @@ public void actionPerformed(ActionEvent actionevent) {
14941488
JMenuItem item = createBoardMenusAndCustomMenus(boardsCustomMenus, menuItemsToClickAfterStartup,
14951489
buttonGroupsMap,
14961490
board, targetPlatform, targetPackage);
1497-
boardMenu.add(item);
1491+
platformBoardsMenu.add(item);
14981492
boardsButtonGroup.add(item);
14991493
}
15001494
}

0 commit comments

Comments
 (0)