1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-28 09:24:14 +01:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Nick Poole
679e80f0ca
Merge 2acc1f790c into 3278173ef8 2024-11-28 04:19:06 +01:00
Varshini Shree
3278173ef8
Add note re: Arduino IDE 2.x repo to readme, format readme 2024-10-18 09:32:19 -07:00
Nick Poole
2acc1f790c Suggested Changes from PR 10816
- Make number of recent boards adjustable in the preferences.txt file at "recent.num_boards"
- Disable feature by entering value '0' for num_boards
- Change Recent board menu items to radio buttons
- Add "All Installed Boards" header to Boards menu
-Remove unnecessary LinkedList creation at line 1599
- Broaden checks to anticipate alterations to preferences
2020-10-23 04:22:23 -04:00
Nick Poole
b7152b27e1 Implement "Recently Used Boards" Menu 2020-09-29 14:48:02 -04:00
2 changed files with 122 additions and 65 deletions

View File

@ -2,49 +2,34 @@
<img src="http://content.arduino.cc/brand/arduino-color.svg" width="50%" />
</p>
Arduino is an open-source physical computing platform based on a simple I/O
board and a development environment that implements the Processing/Wiring
language. Arduino can be used to develop stand-alone interactive objects or
can be connected to software on your computer (e.g. Flash, Processing and MaxMSP).
The boards can be assembled by hand or purchased preassembled; the open-source
IDE can be downloaded for free at [https://arduino.cc](https://www.arduino.cc/en/Main/Software)
**Important Notice**: This repository contains the legacy Arduino IDE 1.x, which is no longer in active development. For the latest features and updates, please visit the [Arduino IDE 2.x](https://github.com/arduino/arduino-ide) repository. If you encounter issues related to the newer IDE, please report them there.
Arduino is an open-source physical computing platform based on a simple I/O board and a development environment that implements the Processing/Wiring language. Arduino can be used to develop stand-alone interactive objects or can be connected to software on your computer (e.g. Flash, Processing and MaxMSP). The boards can be assembled by hand or purchased preassembled; the open-source IDE can be downloaded for free at [https://arduino.cc](https://www.arduino.cc/en/Main/Software).
![Github](https://img.shields.io/github/v/release/arduino/Arduino)
## More info at
- [Our website](https://www.arduino.cc/)
- [The forums](https://forum.arduino.cc/)
- Follow us on [Twitter](https://twitter.com/arduino)
- And like us at [Facebook](https://www.facebook.com/official.arduino)
## Bug reports and technical discussions
- To report a *bug* in the software or to request *a simple enhancement* go to [Github Issues](https://github.com/arduino/Arduino/issues)
- More complex requests and technical discussion should go on the [Arduino Developers
mailing list](https://groups.google.com/a/arduino.cc/forum/#!forum/developers)
- If you're interested in modifying or extending the Arduino software, we strongly
suggest discussing your ideas on the
[Developers mailing list](https://groups.google.com/a/arduino.cc/forum/#!forum/developers)
*before* starting to work on them.
That way you can coordinate with the Arduino Team and others,
giving your work a higher chance of being integrated into the official release
- To report a *bug* in the software or to request *a simple enhancement*, go to [Github Issues](https://github.com/arduino/Arduino/issues).
- More complex requests and technical discussions should go on the [Arduino Developers mailing list](https://groups.google.com/a/arduino.cc/forum/#!forum/developers).
- If you're interested in modifying or extending the Arduino software, we strongly suggest discussing your ideas on the [Developers mailing list](https://groups.google.com/a/arduino.cc/forum/#!forum/developers) *before* starting to work on them. That way you can coordinate with the Arduino Team and others, giving your work a higher chance of being integrated into the official release.
### Security
If you think you found a vulnerability or other security-related bug in this project, please read our
[security policy](https://github.com/arduino/Arduino/security/policy) and report the bug to our Security Team 🛡️
Thank you!
If you think you found a vulnerability or other security-related bug in this project, please read our [security policy](https://github.com/arduino/Arduino/security/policy) and report the bug to our Security Team 🛡️. Thank you!
e-mail contact: security@arduino.cc
## Installation
Detailed instructions for installation in popular operating systems can be found at:
Detailed instructions for installation on popular operating systems can be found at:
- [Linux](https://www.arduino.cc/en/Guide/Linux) (see also the [Arduino playground](https://playground.arduino.cc/Learning/Linux))
- [macOS](https://www.arduino.cc/en/Guide/macOS)
@ -52,46 +37,23 @@ Detailed instructions for installation in popular operating systems can be found
## Contents of this repository
This repository contains just the code for the Arduino IDE itself.
Originally, it also contained the AVR and SAM Arduino core and libraries
(i.e. the code that is compiled as part of a sketch and runs on the
actual Arduino device), but those have been moved into their own
repositories. They are still automatically downloaded as part of the
build process and included in built releases, though.
This repository contains just the code for the Arduino IDE itself. Originally, it also contained the AVR and SAM Arduino core and libraries (i.e. the code that is compiled as part of a sketch and runs on the actual Arduino device), but those have been moved into their own repositories. They are still automatically downloaded as part of the build process and included in built releases, though.
The repositories for these extra parts can be found here:
- Non-core specific Libraries are listed under: <https://github.com/arduino-libraries/>
(and also a few other places, see `build/build.xml`).
- The AVR core can be found at: <https://github.com/arduino/ArduinoCore-avr>
- Other cores are not included by default but installed through the
board manager. Their repositories can also be found under
<https://github.com/arduino/>.
- Non-core specific Libraries are listed under: [Arduino Libraries](https://github.com/arduino-libraries/) (and also a few other places, see `build/build.xml`).
- The AVR core can be found at: [ArduinoCore-avr](https://github.com/arduino/ArduinoCore-avr).
- Other cores are not included by default but can be installed through the board manager. Their repositories can also be found under [Arduino GitHub organization](https://github.com/arduino/).
## Building and testing
Instructions for building the IDE and running unit tests can be found on
the wiki:
- <https://github.com/arduino/Arduino/wiki/Building-Arduino>
- <https://github.com/arduino/Arduino/wiki/Testing-Arduino>
Instructions for building the IDE and running unit tests can be found on the wiki:
- [Building Arduino](https://github.com/arduino/Arduino/wiki/Building-Arduino)
- [Testing Arduino](https://github.com/arduino/Arduino/wiki/Testing-Arduino)
## Credits
Arduino is an open source project, supported by many.
Arduino is an open-source project, supported by many. The Arduino team is composed of Massimo Banzi, David Cuartielles, Tom Igoe, and David A. Mellis.
The Arduino team is composed of Massimo Banzi, David Cuartielles, Tom Igoe
and David A. Mellis.
Arduino uses
[GNU avr-gcc toolchain](https://gcc.gnu.org/wiki/avr-gcc),
[GCC ARM Embedded toolchain](https://launchpad.net/gcc-arm-embedded),
[avr-libc](https://www.nongnu.org/avr-libc/),
[avrdude](https://www.nongnu.org/avrdude/),
[bossac](http://www.shumatech.com/web/products/bossa),
[openOCD](http://openocd.org/)
and code from [Processing](https://www.processing.org)
and [Wiring](http://wiring.org.co).
Icon and about image designed by [ToDo](https://www.todo.to.it/)
Arduino uses [GNU avr-gcc toolchain](https://gcc.gnu.org/wiki/avr-gcc), [GCC ARM Embedded toolchain](https://launchpad.net/gcc-arm-embedded), [avr-libc](https://www.nongnu.org/avr-libc/), [avrdude](https://www.nongnu.org/avrdude/), [bossac](http://www.shumatech.com/web/products/bossa), [openOCD](http://openocd.org/), and code from [Processing](https://www.processing.org) and [Wiring](http://wiring.org.co).
Icon and about image designed by [ToDo](https://www.todo.to.it/).

View File

@ -122,6 +122,13 @@ public class Base {
private List<JMenu> boardsCustomMenus;
private List<JMenuItem> programmerMenus;
// these variables help rebuild the "recently used boards"
// menu on board selection
private HashMap<String, JRadioButtonMenuItem> recentBoardItems;
private List<JRadioButtonMenuItem> recentBoardsToClear = new LinkedList<>();;
private JMenu boardMenu;
private int recentBoardsJMenuIndex;
private PdeKeywords pdeKeywords;
private final List<JMenuItem> recentSketchesMenuItems = new LinkedList<>();
@ -1353,6 +1360,39 @@ public class Base {
}
}
// Update recent boards list in preferences
List<String> newRecentBoardIds = new ArrayList<String>();
String currentBoard = PreferencesData.get("board");
for (String recentBoard : PreferencesData.getCollection("recent.boards")){
if (!recentBoard.equals(currentBoard)) {
newRecentBoardIds.add(recentBoard);
}
}
newRecentBoardIds.add(0, currentBoard);
int numBoards = 0;
if (PreferencesData.has("recent.num_boards")) {
numBoards = PreferencesData.getInteger("recent.num_boards");
}
while (newRecentBoardIds.size() > numBoards) {
newRecentBoardIds.remove(newRecentBoardIds.size() - 1);
}
PreferencesData.setCollection("recent.boards", newRecentBoardIds);
// If recent.num_boards is 0, interpret this as the feature
// being turned off. There's no need to rebuild the menu
// because it will be hidden
if (numBoards > 0) {
try {
rebuildRecentBoardsList();
} catch (Exception e) {
//TODO show error
e.printStackTrace();
}
}
// Update editors status bar
for (Editor editor : editors) {
editor.onBoardOrPortChange();
@ -1426,9 +1466,10 @@ public class Base {
public void rebuildBoardsMenu() throws Exception {
boardsCustomMenus = new LinkedList<>();
recentBoardItems = new HashMap<String, JRadioButtonMenuItem>();
// The first custom menu is the "Board" selection submenu
JMenu boardMenu = new JMenu(tr("Board"));
boardMenu = new JMenu(tr("Board"));
boardMenu.putClientProperty("removeOnWindowDeactivation", true);
MenuScroller.setScrollerFor(boardMenu).setTopFixedCount(1);
@ -1451,12 +1492,30 @@ public class Base {
}));
boardsCustomMenus.add(boardMenu);
// Insert recently used boards menu and remember index for insertion later
// Check if the field exists, in case preferences got lost
if (!PreferencesData.has("recent.num_boards")){
// (default to 5)
PreferencesData.setInteger("recent.num_boards", 5);
}
if (PreferencesData.getInteger("recent.num_boards") > 0) {
// Insert menu label
boardMenu.add(new JSeparator());
JMenuItem label = new JMenuItem(tr("Recently Used Boards"));
label.setEnabled(false);
boardMenu.add(label);
recentBoardsJMenuIndex = boardMenu.getItemCount();
}
// If there are no platforms installed we are done
if (BaseNoGui.packages.size() == 0)
return;
// Separate "Install boards..." command from installed boards
boardMenu.add(new JSeparator());
JMenuItem label = new JMenuItem(tr("All Installed Boards"));
label.setEnabled(false);
boardMenu.add(label);
// Generate custom menus for all platforms
for (TargetPackage targetPackage : BaseNoGui.packages.values()) {
@ -1549,6 +1608,25 @@ public class Base {
return platform.getId() + "_" + platform.getFolder();
}
// clear the previous menu items from the "recently used boards"
// menu and repopulate with updated items
private void rebuildRecentBoardsList() throws Exception {
Collection<String> recentBoardIds = PreferencesData.getCollection("recent.boards");
String currentBoard = PreferencesData.get("board");
int idxAdv = 0;
for (JRadioButtonMenuItem itemToClear : recentBoardsToClear) {
boardMenu.remove(itemToClear);
}
recentBoardsToClear.clear();
for (String boardId : recentBoardIds) {
JRadioButtonMenuItem addItem = recentBoardItems.get(boardId);
boardMenu.add(addItem, recentBoardsJMenuIndex+idxAdv);
recentBoardsToClear.add(addItem);
addItem.setSelected(boardId.equals(currentBoard));
idxAdv++;
}
}
private JRadioButtonMenuItem createBoardMenusAndCustomMenus(
final List<JMenu> boardsCustomMenus, List<JMenuItem> menuItemsToClickAfterStartup,
Map<String, ButtonGroup> buttonGroupsMap,
@ -1579,6 +1657,23 @@ public class Base {
JRadioButtonMenuItem item = new JRadioButtonMenuItem(action);
// create an action for the "recent boards" copy of this menu item
// which clicks the original menu item
Action actionClone = new AbstractAction(board.getName()) {
public void actionPerformed(ActionEvent actionevent) {
item.setSelected(true);
item.getAction().actionPerformed(new ActionEvent(this, -1, ""));
}
};
// No need to hog memory if recent boards feature is turned off
if (PreferencesData.getInteger("recent.num_boards") > 0) {
// create a menu item for the "recent boards" menu
JRadioButtonMenuItem itemClone = new JRadioButtonMenuItem(actionClone);
// populate list of menuitem copies
recentBoardItems.put(boardId, itemClone);
}
if (selBoard.equals(boardId) && selPackage.equals(packageName)
&& selPlatform.equals(platformName)) {
menuItemsToClickAfterStartup.add(item);