`if ((screen.width != screenW) || (screen.height != screenH))` was making sure to reset every preference in case the display geometry changed.
Unfortunately, on Windows 10, `Toolkit.getDefaultToolkit().getScreenSize()` reports only the primary monitor either if external display is connected or not.
Fixes#9781
Previously, the programmers menu always showed *all* programmers of
*all* platforms. This made it hard to find the programmer you need.
When selecting a programmer from another platform, it would typically
not work, since the tool definitions rely on specific variables to be
defined by the board, or files available in the variant directory, which
are typically platform-dependent. Also, some programmers might be
defined in multiple platforms, but there is currently no way to tell
which one is for the current platform an will work, and which is for
another platform and will break.
This commit changes the programmer menu to only show programmers from
the platforms that define the board and the core used. The latter is
only used when boar definition refers a core in another platform, in
which case the core and variant already have a strong coupling (the
variant must offer the right variables for the core to work), so that
would also apply to the programmer, so programmers from the referenced
core's platform can be expected to work.
When a board is selected, the menu of available programmers is
refreshed, but the currently selected programmer preference is
untouched. This might mean that a programmer is selected that is invalid
for the current board and will not actually work. This could be fixed by
clearing the current programmer when it becomes invalid, but that would
mean that changing to another platform and back would always require
reselecting the programmer to use, which seems counter-productive. An
alternative fix would be to check the programmer against the board and
throw an error, but that would require duplicating some code, which did
not seem worthwile (ideally, all this code will be moved to arduino-cli
anyway in the future).
This fixes#9373.
In commit 93581b03d (Set foreground color in library/board manager), the
foreground color was set in addition to the background color, to make
sure that the library and board manager would remain readable even with
a non-standard color scheme (e.g. a dark theme).
When that commit was created, this worked properly. However, between
creating that commit and merging it as part of #9272, the title
rendering was changed from being part of the description (which had its
color set up properly) to being part of the title border (which used
default colors) in #9262.
This commit fixes this again by applying the foreground color also to
the TitledBorder component.
In ContributedPlatformTableCellJPanel this also moves the creation of
the TitledBorder into the constructor, and for
ContributedLibraryTableCellJPanel upwards in the constructor (where it
is run unconditionally), so the property can be final.
When the serial device disconnects, the serial monitor and plotter are
disabled. Previously, the window would be completely disabled. Now, the
configuration controls (autoscroll, add timestamp, baudrate, line
endings) can still be changed while the window is disconnected. These
settings will not take effect immediately, but will be used when the
port is next opened.
Also, the clear output button can now also be used when the port is
disconnected, which makes it easy to get a clean start when reconnecting
the serial port.
There was an error in the following constants:
PREF_PROXY_AUTO_USERNAME = "proxy.manual.username"
PREF_PROXY_AUTO_PASSWORD = "proxy.manual.password"
they should be set to "auto" and not "manual":
PREF_PROXY_AUTO_USERNAME = "proxy.auto.username"
PREF_PROXY_AUTO_PASSWORD = "proxy.auto.password"
Changing the constants to the correct value now will fix the problem for
future installations of the IDE but will produce an annoying side-effect
for users upgrading from previous version of the IDE: they will lose
their saved user and pass (because it was saved as "proxy.manual.*")
and the IDE will suddenly stop working without any clear reason.
To avoid this I've left the value to "proxy.manual.*" and removed
the distinction from AUTO and MANUAL, so now we have only:
PREF_PROXY_USERNAME = "proxy.manual.username"
PREF_PROXY_PASSWORD = "proxy.manual.password"
The corresponding textbox in the preference dialog will be filled based on
the PROXY_TYPE selection.
Improve Codacy PR quality requirements:
Fields should be declared at the top of the class, before any method
declarations, constructors, initializers or inner classes.
Previously it could lead to contract violations for example consider
this:
A = Library{ Name:"A", Types: ["Sensors"] }
B = Library{ Name:"B", Types: null }
C = Library{ Name:"C", Types: ["Arduino"] }
it results in:
A<B (because B has Types==null and compare("A","B")<0)
B<C (because B has Types==null and compare("B","C")<0)
C<A (becuase C has Types=="Arduino" and the comparator returns -1)
This commit fix this behavior
For some reason the combination of the AdoptJDKJre 8 and Microsoft store
do not like JFileChooser.
This commit replace JFileChooser with a FileDialog that seems to work
without issues.
The GitHub-hosted runner is a virtual machine hosted by GitHub.
Xvfb on that setup defaults to a virtual screen size of 640x480
(XVFBARGS='-screen 0 640x480x16') which in turn makes the Arduino user
interface tests fail with exceptions like this:
[junit] org.fest.swing.exception.ActionFailedException: The component to click is out of the boundaries of the screen
[junit] at org.fest.swing.exception.ActionFailedException.actionFailure(ActionFailedException.java:33)
[junit] at org.fest.swing.core.RobotEventGenerator.pressMouse(RobotEventGenerator.java:74)
Setting the xvfb screen size to 1024x768 solves this error.
When transforming compiler errors (to make filenames more friendly), it
would match "fatal error" or "error" but then always reconstruct as
"error", modifying the compiler error in a way that is not intended.
This commit fixes that, as well as the previous hardcoding of the
"error: " prefix when rebuilding the error message, by capturing this
entire prefix and simply reproducing it in the resulting error message.
Error messages are detected and parsed using a regex. Part of this regex
matches the optional column number.
The code that handled this assumed that a missing column would result in
less elements in the matches array, but a regex always results in one
element per set of parenthesis in the regex, which will be null if no
capture was made for that element.
In practice, this meant that if no column was present in the error
message, a NullPointerException would be raised. Furthermore, gcc 9
seems to have started outputting omitting column numbers (instead of
printing 0) for some errors (such as unterminated #ifdef), which exposed
this problem.
This commit fixes this by simply using the fixed match numbers to take
apart the regex match, and by checking for a null column number (all
other captures are non-optional, so no need to check there).
This commit fixes instances when setText is called on editorTab and the rectangle that highlights the bracket match becomes incorrect.
This is because text is inserted to the document without notifying the textarea.
Calling setLineWrap internally fires an event that recalculates the bracket match rectangle and thus solves the problem.