1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00
Commit Graph

1578 Commits

Author SHA1 Message Date
Matthijs Kooijman
2d367e757d Allow .cpp files named after the primary .ino file
This limitation was added a long time ago, when the build system did not
cope with this. The current build system handles this situation just
fine, so this limitation can be lifted.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
c5c3a771e5 Remove Base.handle*Replace()
These methods dealt with opening up a sketch inside an existing editor
window, but they were unused - all sketches open in a new window now.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
7d277b359c Remove Editor.stopHandler
This handler was only always assigned the DefaultStopHandler, which did
nothing. It was called in a few places, but since it never does
anything, better remove it. For properly supporting stopping of external
processes, some better architecture should be added instead.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
8e0d007ce2 Rename SketchCode to SketchFile
That name more accurately reflects its purpose: It represents a single
file within a sketch. This just updates the class name and variable
names referring to these objects and some comments, so no behaviour
should change.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
dfa60dacc1 Store a SketchCode instance in RunnerException
Previously, the index of the SketchCode instance in the list kept by
Sketch was kept, which isn't really robust.

With this change, Sketch.indexOfCode is no longer needed and is removed.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
a07a9ff895 Move SketchController.prepareDataFolder() to Sketch 2016-08-26 16:42:44 +02:00
Matthijs Kooijman
a4e2e80c1c Let importLibrary use Sketch.SKETCH_EXTENSIONS
For determining if the current file was a sketch file, it previously
(indirectly) used a hardcoded "ino" comparison. Now, it uses
`SKETCH_EXTENSIONS` so it also applies to .pde files and the hardcoded
"ino" (and the methods leading up to it) can be removed.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
5e68b66c5e Clean up SketchController.nameCode a bit
This lets it use FileUtils.splitFilename and reference Sketch.EXTENSIONS
and the new Sketch.DEFAULT_SKETCH_EXTENSION directly, allowing to remove
a few helper functions.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
b3ad637f8c Simplify SketchController.addFile using FileUtils.hasExtension 2016-08-26 16:42:44 +02:00
Matthijs Kooijman
d70900e5ad Let Sketch.getPrettyName() hide extension for .ino and .pde only
Before, `getPrettyName()` would return the extension-less name for all
files. There were a lot of places that checked for .ino and/or .pde
files and and called `getPrettyName()` for those, and `getFileName()`
for others. By moving this check into `getPrettyName()`, all those
callers become more simple, and more consistent (there were 5 different
checks to basically achieve the same thing).

There are small changes in behaviour, where .pde is now also hidden but
was not before. Also, the print header now shows extensions for other
files, which makes it more consistent with the tab names. For cases
where the old behaviour was still required, `Sketch.getBaseName()` was
added.

At the same time, the actual handling of the filenames is simplified by
using methods from FileUtils.

With this change `Sketch.getFileNameWithExtensionIfNotIno()` and
`SketchController.getHiddenExtensions()` are no longer needed and are
removed.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
5792ec212b Remove Editor.findTabIndex(String), which is now unused 2016-08-26 16:42:44 +02:00
Matthijs Kooijman
8afeb501cb In SketchController.nameCode, only switch tabs when adding file
When renaming a file, the current tab is already the correct
one, so no need to switch. This allows looking up the tab index based on
the SketchCode object, instead of doing a filename lookup.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
fa82fe4db1 Do not find a tab based on filename, when we have a SketchCode
Filename-based matching is a bit more fragile, so just do a lookup based
on the SketchCode object we already have instead.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
3d573a7e86 Use SketchCode.isPrimary() in more places
This should be more reliable than comparing filenames or assuming the
primary file is always at index 0.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
dd5c1787fd Move isModified() from SketchController to Sketch
Also, update any code that uses it, removing the dependency on
SketchController entirely if possible.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
629953e20d Rename Sketch and SketchData classes
Sketch is now called SketchController, since it didn't really represent
a sketch, but just handled the GUI-related stuff for a given sketch
(note that it is not strictly a controller in the MVC-sense, but it does
have a similar function). SketchData more accurately represented the
actual sketch, so it is now called Sketch. Below, the new names are
used.

Editor now keeps both a current Sketch and SketchController object, and
the Sketch object is created by Editor and passed to SketchController,
instead passing a File and letting SketchController create the Sketch.
Wherever possible, code now uses the Sketch directly (or indirectly,
through the new `SketchController.getSketch()`) and the accessors in
SketchController that merely forwarded to Sketch have been removed.
There are few things that now live in SketchController but should be
moved to Sketch (`isModified()`, `isUntitled()`), so some of the code
still has a dependency on SketchController that should be removed later.

This commit mostly renames classes, methods and variables, it should not
change the behaviour in any way.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
eba1098efb Delete Sketch.prepare()
The only remaining thing that the method did was call `ensureExistence()`.
However, a call the `prepare()` was always followed by a call to
`build()`, which already calls `ensureExistence()`, so `prepare()`
didn't have any remaining value.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
f3d8ba219f Remove support for a "code" folder in sketches
When adding a file to a sketch (using drag and drop, or the Sketch ->
Add file... menu item), .o, .a and .so files would be saved into a
"code" subdirectory of the sketch. This seems to be a remnant of
processing, where also .dll and .jar files could be added to a sketch to
be used. In the Arduino IDE, these code files serve no special purpose,
and are not treated specially, so it makes no sense to keep this code
around.

One implication of this is that when "save as" is used, a "code"
subdirectory is no longer copied, which might affect people using this
"code" subdirectory for other purposes.

Similarly, there is support for a "data" subdirectory, in which all
other files (that are not sketch source files) are stored, and which is
also copied on "save as". Support for this folder is kept intact, since
this appears occasionally used (the ESP8266 project uses it to store and
upload additional data files, for example).

This change was discussed on the mailing list in the "Anyone using
"data" and "code" subdirectories in sketches?" thread:
https://groups.google.com/a/arduino.cc/forum/#!msg/developers/zPlraPq55ho/ejrLqITnAgAJ
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
76be212f23 Remove applet.html handling
This was a remnant of Processing, this file has no special meaning for
an Arduino sketch, so this code can just be removed.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
1d21378a5f Replace requestFocus() by requestFocusInWindow() where applicable
The former gives focus to the window in which a component is present,
while the latter only changes the focus within the current window (not
focusing the window itself if it is not focused yet). Java documentation
recommends changing `requestFocusInWindow()` where possible, due to some
platform-dependent behaviour in `requestFocus()`.

When focusing the serial monitor and plotter, `requestFocus()` is still
used, since then the focused window *should* change.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
f57b90c1c8 Remove code that preserves caret position during auto format
`EditorTab.setText()` now already preserves the caret position. The code
used during auto-format tried a bit harder to preserve the position
correctly, and probably worked better in a few specific cases, but for
most cases they would both end up approximating the caret position
anyway. To make the code simpler, better just stick to the simpler
approach.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
6558c0654e Remove all highlights in EditorTab.setText()
When completely replacing all text, all highlights will end up at the
start of the file. Since keeping them at the right place is tricky (even
impossible in some circumstances), just remove them now.

This already happened in the autoformat code, so that part can be
removed.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
c08fd76cad Remove UndoManager stuff from AStyle
The only change that happens is a single `setText()` call, which already
results in a single undo action.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
31284feb9b Merge SketchData.sortCodes() into addCode()
By now, all calls to `addCode()` were followed by a call to
`sortCodes()`, and it seems like a task for SketchData to keep its list
sorted. Previously, this separation made some sense, since `addCode()`
was also used while loading a sketch, and you would only want to sort
once. Now, sketch loading uses a SortedSet, so this is no longer a
requirement.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
8725bb1ec4 Clean up sketch loading
Previously, the Sketch constructor called its `load()` function, which
called the `SketchData.load()` function to load files and then
`Editor.sketchLoaded()` to initialize the GUI with the loaded files.
When external editing was enabled, `Sketch.load()` was called again
when activating the Arduino app, to reload the entire sketch.

With this commit, the `Sketch.load()` function is removed, and
`SketchData.load()` is called from the SketchData constructor. Instead
of Sketch calling `Editor.sketchLoaded()`, that method is renamed
to `createTabs()` and called by `Editor.HandleOpenInternal()` directly
after creating the Sketch object.

Handling of external editor mode has also changed. When the Arduino
application is activated, instead of fully reloading the sketch (through
the now-absent `Sketch.load()` method), the new `SketchData.reload()`
method is called to reload the list of files in the sketch. If it
changed, all tabs are re-created. If not, only the current tab is
reloaded. When the user switches from one tab to another, that tab is
also reloaded. This ensures that the visible  tab is always up-to-date,
without needlessly reloading all tabs all the time. When external
editing mode is enabled or disabled, all tabs are reloaded too, to make
sure they are up-to-date.

When re-creating all tabs, no attempt is made to preserve the currently
selected tab. Since adding or removing files happens rarely, this should
not be a problem. When files are changed, the currently selected tab is
implicitly preserved (because the tab is reloaded, not recreated). The
caret (and thus scroll) position is preserved by temporarily changing
the caret update policy, so the caret does not move while the text is
swapped out. This happens in `EditorTab.setText()` now, so other callers
can also profit from it.

To support checking for a changed list of files in
`SketchData.reload()`, a `SketchCode.equals()` method is added, that
just checks if the filenames are equal. Additionally, the loading of the
file list for a sketch has now moved from `SketchData.load()` to
`SketchData.listSketchFiles()`, so `reload()` can also use it. At the
same time, this loading is greatly simplified by using a sorted Set and
`FileUtils.listFiles()`.

In external editor mode, to ensure that during compilation the version
from disk is always used instead of the in-memory version, EditorTab
detaches itself from its SketchCode, so SketchCode has no access to the
(possibly outdated) in-memory contents of the file.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
283ccc150d Print errors while reloading externally edited files
These exceptions were silently dropped, which is pretty much never a
good idea.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
6715f41c0e Let SketchCode track if it is the primary file
This makes checking for the primary file easier, without having to know
the index of a file in the list of tabs, or relying on the fact that the
primary file is always first (it still is, though).

This changes some places in Sketch to use the new
`SketchCode.isPrimary()` method, but there probably are a lot more
places in the code that could be start to use it as well.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
6c2a94ecc5 Remove SketchCodeDocument
This class served no purpose anymore, so it can be removed. The
`SketchCode.getMetadata()` and `setMetaData()` methods only served to
keep track of a SketchCodeDocument instance (and were no longer used),
so these are removed too, just like some SketchCode constructors dealing
with this metadata object.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
d2bac8659e Remove tab switching logic from Sketch
This lets all code directly call `Editor.selectTab()`, or the newly
introduced `Editor.selectNextTab()` or `Editor.selectPrevTab()`. This
also adds a new `Editor.findTabIndex(String)` to look up a tab based on
the filename (what `Sketch.setCurrentCode(String)` used to do). At some
point, this method might need to be removed, but for now it allows other
code to keep working with minimal changes.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
0764eb7b19 Remove current and currentIndex variables from Sketch
Instead of letting Sketch (also) keep track of the currently selected
tab, this moves the responsibility to Editor instead. When Sketch need
to know the current tab and file, it now asks Editor.

Switching between tabs is still handled through Sketch methods, but that
will be cleaned up later.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
6b31cffaec Add getTabs() and getCurrentTabIndex() to Editor and use them
Previously, some of the GUI code would use Editor.getSketch() to get the
current sketch, and Sketch.getCurrentCode() to find out the currently
selected tab. Since this code is really concerned with the currently
open tab in the GUI, it makes more sense to query the Editor tabs list
directly.

This removes all references the current sketch code, as tracked by
Sketch, external to Sketch itself. This prepares for removing the
current tab tracking from Sketch later.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
ca573351bb Do not store file contents in SketchCode
Now that each file in the sketch has its own text area in the GUI, it is
no longer needed to store the (possibly modified) contents of each file
inside SketchCode. Keeping the contents in the text area is sufficient.
Doing so allows removing the code that dealt with copying contents from
the text area into the SketchCode instance at the right time, which was
fragile and messy.

However, when compiling a sketch, the current (modified) file contents
still should be used. To allow this, the TextStorage interface is
introduced. This is a simple interface implemented by EditorTab, that
allows the SketchCode class to query the GUI for the current contents.
By using an interface, there is no direct dependency on the GUI code. If
no TextStorage instance is attached to a SketchCode, it will just assume
that the contents are always unmodified and the contents from the file
will be used during compilation.

When not using the GUI (e.g. just compiling something from the
commandline), there is no need to load the file contents from disk at
all, the filenames just have to be passed to arduino-builder and the
compiler. So, the SketchCode constructor no longer calls its `load()`
function, leaving this to the GUI code to call when appropriate. This
also modifies the `SketchCode.load()` function to return the loaded
text, instead of storing it internally.

To still support adding new files to a sketch (whose file does not
exist on disk yet), the EditorTab constructor now allows an initial
contents to be passed in, to be used instead of loading from disk. Only
the empty string is passed for new files now, but this could also be
used for the bare minimum contents of a new sketch later (which is now
down by creating a .ino file in a temporary directory).

Another side effect of this change is that all changes to the contents
now happen through the text area, which keeps track of modifications
already. This allows removing all manual calls to `Sketch.setModified()`
(even more, the entire function is removed, making `Sketch.isModified()`
always check the modification status of the contained files).
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
422c111d81 Let EditorTab listen for changes to the text area
Previously, EditorTab set the Document on the SketchCodeDocument, and
the latter would listen for changes, only forwarding the modified status
to SketchCode. This commit cuts out a step and lets EditorTab call
SketchCode::setModified directly.

Additionally, the DocumentTextChangedListener helper class is added,
which wraps a simple (lambda) function to be called whenever anything
about the document text is modified. This hides the verbosity of having
to handle both insertion and deletion, and instead suffices with just
having a single lambda function instead.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
982d4f3fbf Use a separate RSyntaxTextArea for each editor tab
RSyntaxTextArea appears to support using a single instance and replacing
the underlying text and document when switching between tabs, but in
practice this support is not complete and even though the
RSyntaxTextArea developers did some work to improve the situation, they
recommend to just use a seperate instance for each tab.

This commit implements exactly that. A new class EditorTab is introduce
to wrap the RSyntaxTextArea and containing scroll pane, and to
encapsulate the code related to handling the text area itself. Doing so
removes some quirks and prepares for some later additions. In
particular, error highlights are now no longer shared between all tabs,
which was previously the case.

This commit mostly moves code from Editor into EditorTab, and updates
the callers to use getCurrentTab() and call methods on the result
instead of calling them on Editor. Some code is added to take care of
creating multiple EditorTab objects and switching between them. Some
small changes have been made to make the flow of opening files work,
though these are mostly a bit hacky.

While moving code, changes to the rest of the code were kept minimal,
retaining existing interfaces as much as possible. This sometimes result
in less than ideal code, which should be cleaned up in subsequent
commits.

The SketchCodeDocument class has been pretty much emptied out, since
it was mostly used to store things for tabs in the background, which are
now just stored in each RSyntaxTextArea separately. The last remaining
bits of this class can probably be moved or implemented differently
later, so it can be removed.

The entire flow of working with sketches and files needs to be cleaned
up next, so no thorough attempt at testing this commit was done. It is
likely that there are plenty of corner cases and race conditions, which
will be fixed once the reset of the code is cleaned up.

Fixes #3441
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
c945b6c30a Let EditorToolbar use the global KeyboardFocusManager
For some toolbar buttons, when it is clicked while shift is pressed, its
function changes. When handling the click event, this information is
directly taken from KeyEvent.isShiftDown(). However, to also show the
proper tooltip *before* clicking, EditorToolbar listened to key events
on the main text area, to know when shift is (not) pressed.

This approach means that pressing shift while the text area is not
focused will not change the tooltip, and creates some unwanted coupling
between the toolbar and the text area.

This commit changes this approach to instead use the global
KeyboardFocusManager. Any key presses pass through there before being
dispatched to the currently focused component, so this makes sure that
any shift presses are caught, as well as making EditorToolbar a bit more
self-contained.
2016-08-26 16:42:44 +02:00
Cristian Maglie
d6db1deef0 Update revision log 2016-08-17 17:24:04 +02:00
Cristian Maglie
59e7c9ef60 Revert "Improve Examples menu"
This reverts commit 7235f9dc15.
2016-08-17 17:08:21 +02:00
Cristian Maglie
b583697e0b Revert "Only sort ideLibs if it's not empty"
This reverts commit 9b324bc9cc.
2016-08-17 17:08:14 +02:00
Cristian Maglie
4c6d2f4a82 Added new languages ach, kk and te 2016-08-16 13:16:38 +02:00
Cristian Maglie
aea77c889d Fixed some simple warnings 2016-08-16 12:52:24 +02:00
Cristian Maglie
49b98959c5 Correctly handle "-snapshot" and "+build" in semantic versioning
This fix a regression introduced in:

048a8a61 (VersionHelper now correctly strip snapshot info)

actually neither 048a8a61 nor the version before are correct becuase:

048a8a61 - strips all the extra `-snapshot` and `+build`
previous - doesn't handle the case `x.y-snapshot`

Now both are handled correctly and a test has been added to verify this.

To be completely semver compliant we should deny versions in the
format `x.y`, but this will break all legacy version that have been
published until now, so this changed should be postponed for the next
major release of the IDE.

Fix #5251
2016-08-16 11:00:35 +02:00
Cristian Maglie
eee54f1b3a Merge branch 'examplesmenu' of git://github.com/PaulStoffregen/Arduino into HEAD 2016-08-12 17:21:24 +02:00
Cristian Maglie
7008f6c57c ContributionsIndexer now has bundled hardware path as a field 2016-08-11 10:57:05 +02:00
PaulStoffregen
9b324bc9cc Only sort ideLibs if it's not empty 2016-08-02 02:43:04 -07:00
PaulStoffregen
7235f9dc15 Improve Examples menu 2016-07-28 16:58:28 -07:00
Sandeep Mistry
1a6be715ab Merge pull request #4794 from facchinm/upload_fail_handling
Handling gracefully upload failure
2016-07-20 10:18:57 -04:00
Sandeep Mistry
afe204f97f Merge pull request #4828 from facchinm/issue_4762
Filter examples based on contributed libraries by architecture
2016-07-19 10:00:18 -04:00
Cristian Maglie
8f20f4d98b "Include library" now checks for includes property
A new property "includes" has been added to library.properties.
This property contains a comma-separated list of the files to be included when
the user selects the "Include library" command on the Arduino IDE.

If the property is missing the old behaviour is used.
2016-06-23 13:04:56 +02:00
Martino Facchin
93578cef42 Fix ssh authentication on newer ssh clients
For Console monitor on network ports
2016-04-15 10:00:41 +02:00
Cristian Maglie
60b169fbe9 Merge branch 'ctrlDeleteBehavior' of https://github.com/avargas-nearsoft/Arduino 2016-04-07 11:32:46 +02:00
Martino Facchin
f6880fe617 Merge pull request #4792 from facchinm/solve_serial_windows
Rework serial ports handling
2016-04-06 18:03:45 +02:00
Arturo Vargas
a70bab3ea0 Add suport for OSX (ALT+DELETE) 2016-04-06 08:25:39 -07:00
Martino Facchin
c28c854936 Filter examples based on contributed libraries by architecture
Solves #4762
2016-04-06 14:41:12 +02:00
Cristian Maglie
f74afc4ad9 Remove incorrect Ctrl+K / Ctrl+W bindings
for a better explanation see @nopdotcom comment here:
https://github.com/arduino/Arduino/pull/4743#issuecomment-201447876
2016-04-06 12:18:45 +02:00
Jay Carlson
02914d79b9 Add more of OS X's native Emacs keybindings
OS X supports many simple Emacs keybindings in native text fields. (It
can do this because the system UI uses Cmd instead of Ctrl as its main
modifier key.) Add bindings to functions which already exist in
DefaultEditorKit.

I have a Ctrl-k (cut to end of line) implementation, but it is an
additional static RecordableTextAction class. I have not included it.
2016-04-06 12:17:58 +02:00
Cristian Maglie
050e8ba304 Merge branch 'cut/copyEnabled' of https://github.com/avargas-nearsoft/Arduino 2016-04-06 12:09:04 +02:00
Arturo Vargas
3efcc9ec48 Change the CTRL+DELETE behavior to restore the next word 2016-04-04 14:42:40 -07:00
Ivan Esparza
9c583829de Fixes issue 4440 2016-04-04 16:53:46 +02:00
Cristian Maglie
0c453355f4 Merge branch 'fix-annoying-popup' 2016-04-04 13:34:14 +02:00
Cristian Maglie
8d7ee63c70 Autoclose notification popup after 10 seconds. 2016-04-04 13:30:42 +02:00
Martino Facchin
84fdb0c0c3 Remove stray debug print 2016-04-01 17:05:54 +02:00
Martino Facchin
84ebc68af7 Handle case with empty error message 2016-04-01 12:06:32 +02:00
Martino Facchin
63de1cccfb Avoid generating an exception if upload fails
The current method of reporting upload errors is based on an exoteric combination of exceptions which makes return error code useless
The Uploader.java message() implementation is too avrdude-dependant to allow easy portability since the upload tools are becoming a lot and very different

With this commit we try to avoid exceptions and only use the external uploader's exit code to decide the status bar message.
The message can be:
- the last line containing "error" string (any case) or
- the usual avrdude message parsing (to keep compatibility with translations)

Needs testing with all platform and all supported upload tools
2016-04-01 12:06:21 +02:00
Martino Facchin
52ef55380d avoid NPE if serial monitor is waiting too long for opening 2016-04-01 11:38:53 +02:00
Martino Facchin
821c665460 Change message if requiring infos from Network port 2016-04-01 11:38:53 +02:00
Martino Facchin
243fc68763 Rework Serial ports handling and add Board info menu
This commit introduces the concept of stateful board list (vs. original stateless) and board serial number.

The board is now an "entity" composed by the triplet port/vid/pid. These informations come from libListSerial "light" function. When the board list changes, it triggers a request for the additional infos to libListSerial. These information contains the serial number of the boards.

These brings a lighter and faster scanning process. Some logic has been introduced to handle a board with the S/N only exposed in the bootloader (like 32u4).
In this case the disappearing port acquires the bootloader's S/N

A menu (under Ports menu) shows the currently connected port info and can be used for bugreporting
2016-04-01 11:38:53 +02:00
Martino Facchin
6d5597b070 Avoid multiple concurrent compile/upload operations
Disable Compile/Run buttons as they get press, and reenable only on function exit.
The launched upload process has now a 2minutes timeout before being terminated forcefully.
10 second after pressing "Upload" the button comes pressable again, but this time the previous upload command gets killed explicitely
2016-04-01 11:38:52 +02:00
Martino Facchin
b99ab40ba2 Enable links to directly open Lib/Board manager
If a sketch contains a link to http://librarymanager/${dropdown}#${filter} or http://boardmanager/${dropdown}#${filter} (for example http://librarymanager/All#OneWire) Library or Board manager will be opened applying the secified filters
2016-04-01 10:55:35 +02:00
Martino Facchin
a329731525 use hi-res icons for serial monitor and plotter
fixes #4701
2016-04-01 10:55:04 +02:00
Arturo Vargas
baa8a6e8a3 Disable cut and copy if there is not selected text 2016-03-31 15:11:20 -07:00
Cristian Maglie
1a7eaaf8b2 Fix always-on-top notification popup 2016-03-31 18:49:44 +02:00
Ivan Esparza
bbf909fd4f Changed color of version text in About box 2016-03-22 12:28:33 -07:00
agdl
057bf6391d This fixes #4572 2016-02-29 09:26:40 +01:00
Cristian Maglie
b02ce54387 Removed leftover stub for testing NotificationPopup dialog 2016-02-01 10:18:41 +01:00
Cristian Maglie
8e4ce4cfd1 Serial monitor font is scaled too 2016-02-01 10:14:19 +01:00
Cristian Maglie
5642c291d7 Fixed default initial editor size 2016-01-26 17:11:53 +01:00
Cristian Maglie
639d991dad Some small cosmetics 2016-01-26 17:11:53 +01:00
Cristian Maglie
57c6d096f6 Notification pop-up is now correctly scaled 2016-01-26 16:48:14 +01:00
Cristian Maglie
4659c6f985 Auto-scale editor and console fonts as well 2016-01-26 16:48:14 +01:00
Cristian Maglie
59ec660c9b Fixed minimum size for a bunch of GUI elements 2016-01-26 12:10:12 +01:00
Cristian Maglie
f23577499f Split pane is now sized correctly 2016-01-26 12:10:12 +01:00
Cristian Maglie
9215c06676 Installers windows are now correctly scaled. 2016-01-26 12:10:12 +01:00
Cristian Maglie
2f0b0db5ba Set maximum scale to 400% 2016-01-26 12:09:57 +01:00
Cristian Maglie
409f3161c8 Added GUI scaling in preference panel. 2016-01-26 12:09:57 +01:00
Cristian Maglie
08ad60032f Fix for some font rendering problems on linux 2016-01-26 12:09:57 +01:00
Cristian Maglie
3928b6a04f Fixed a small mess in EditorHeader 2016-01-26 12:09:57 +01:00
Cristian Maglie
d920c06699 Now the IDE use vectorial images whenever possible
The caller of Theme.getThemeImage(...) now pass only the name of
the needed resource and the theme folder is searche in the following
order:

  - name.svg
  - name.png (if svg is not available)
  - name@2x.png (if none of the above are available or if 1x png is
    too low resolution for the current scaling factor)
2016-01-26 12:09:57 +01:00
Cristian Maglie
b1964bc7e7 Added Batik 1.8 java library 2016-01-26 12:09:56 +01:00
Cristian Maglie
e2fec88f5f Added some missing Theme.scale(..)
Now toolbar and header are correctly rendered
2016-01-26 12:09:56 +01:00
Cristian Maglie
967153fe87 Factored out scaling formula into an helper method
Also use a default value of 100 in case "gui.scalePercent" is not set.
2016-01-26 12:09:56 +01:00
Cristian Maglie
f239f5b5ab Moving getLibImage and getThemeImage into Theme class 2016-01-26 12:09:56 +01:00
Cristian Maglie
f1fc862575 Added hi-res toolbar images
Hi-resolution images are saved with the "@2x.png" suffix, the image
loader will select the best image available based on the user selected
scaling.

Missing hi-res images can be added later together with lo-res images.
2016-01-26 12:09:56 +01:00
Cristian Maglie
5637130818 Converted toolbar icons to png 2016-01-26 12:09:55 +01:00
Cristian Maglie
08d35106c2 Add scaling for themed fonts and graphics (hires displays) (Paul Stoffregen) 2016-01-26 12:09:55 +01:00
Cristian Maglie
c3d2bbdb86 Merge branch 'save-on-close' 2016-01-25 17:57:21 +01:00
Cristian Maglie
0bceb93b7c When closing the last sketch, the window position is saved as default
This allows the use-case with users editing one sketch at a time, that
seems to be the most common scenario:

 1. User position the editor as desired
 2. User close the IDE
 3. User opens the IDE by double clicking on another .ino file
 4. The IDE is opened again at the same position

See #4432
2016-01-22 18:08:49 +01:00
Cristian Maglie
61f11f60e1 Factored out logic to retrieve editor placement
The check for "resolution-changed" is performed when an editor
location is retrieved from preferences. This commit rationalize
access to PreferencesData and prepares for the next improvement.
2016-01-22 18:06:09 +01:00
Cristian Maglie
f5f478ced6 Factored out method to save sketch location 2016-01-22 18:06:08 +01:00
Cristian Maglie
c98c18089d Save window position when closing app from "x" button or Alt+F4
Fix #4404
Fix #4218
2016-01-22 18:06:08 +01:00
Cristian Maglie
2c089044c8 Small cosmetics 2016-01-22 18:06:08 +01:00
Matthijs Kooijman
3d47995915 Remove unused imports
This silences some java warnings.
2016-01-21 17:18:55 +01:00
Cristian Maglie
9e5dc5ce3b Merge branch 'renaming' of https://github.com/matthijskooijman/Arduino 2016-01-19 13:53:50 +01:00
Hasso Tepper
d05b375810 Fix some incorrect I18n.format()/tr() usage 2016-01-18 09:47:05 +02:00
Cristian Maglie
870171a69e Fix bug in serial plotter for negative values
Fix #4365
Fix #4292
2016-01-08 12:16:09 +01:00
Cristian Maglie
232f434ca8 Updated translations for translators 2016-01-05 12:54:17 +01:00
Cristian Maglie
d1455a070d Added Thai language 2016-01-05 12:25:18 +01:00
Hasso Tepper
d2277fc1c7 Convert message to single string to ease a translation 2016-01-04 20:08:03 +02:00
Hasso Tepper
531248a474 Make editor statusline text translatable 2016-01-03 23:41:40 +02:00
Cristian Maglie
16c4701802 Rename Contributed*TableCell to Contributed*TableCellJPanel 2015-12-29 16:01:34 +01:00
Cristian Maglie
a7e22e1958 Some minor cosmetics 2015-12-29 16:01:34 +01:00
Cristian Maglie
2b9483b6e6 Extract ContributionIndexTableModel as outer class 2015-12-29 16:01:34 +01:00
Cristian Maglie
d598f0cfa7 Removed unused LibraryManagerUI.getContribModel() method 2015-12-29 16:01:34 +01:00
Cristian Maglie
91f18dff24 Factored out ContributedLibraryTableCell.update(...) method 2015-12-29 16:01:34 +01:00
Cristian Maglie
71eb3c3ab2 Removed useless DESCRIPTION_COL constant 2015-12-29 16:01:34 +01:00
Cristian Maglie
47fcf318b1 Removed unused parameters in *TableCell.update(..) method 2015-12-29 16:01:33 +01:00
Cristian Maglie
76068c92b4 *TableCellEditor now extends JPanel 2015-12-29 16:01:33 +01:00
Cristian Maglie
015f658d1e Factored out TableCell setEnable() code 2015-12-29 16:01:33 +01:00
Cristian Maglie
c1387ed316 Removed weird hack for refreshing table cells 2015-12-29 16:01:33 +01:00
Cristian Maglie
4725584a49 ContributedPlatformCell* now follows swing cell model abstraction
This commit completes the refactoring
2015-12-29 16:01:33 +01:00
Cristian Maglie
6370a74632 Split TableCellRenderes from TableCellEditors
This rationalization helps to better follow the swing abstractions
of table models and increase separation of concerns.

(WIP: ContributedPlatforms needs a similar refactoring that will be
done in the next commits)
2015-12-29 16:01:33 +01:00
Cristian Maglie
fd04767269 Renamed ContributedLibraryTableCell to ContributedLibraryTableCellRenderer
This is in preparation for the next refactoring.
2015-12-29 16:01:33 +01:00
Cristian Maglie
ed30cd7b58 Removed ContributedLibraryTableCell.Cell dependency from upper editorValue field 2015-12-29 16:01:33 +01:00
Cristian Maglie
268ae81759 Removed useless parentTable field in ContributedLibraryTableCell 2015-12-29 16:01:33 +01:00
Cristian Maglie
926a8c9101 Correct implementation of ContributedLibraryTableCell
getTableCellRendererComponent() interface requires to return independent
Component objects used for "stamping" the table element.
2015-12-29 16:01:33 +01:00
Matthijs Kooijman
7949e7e81f Randomize temporary sketch copy directory name
When a sketch has unsaved changes, a temporary copy of the sketch is
made with those changes applied. This copy is then passed to
arduino-builder.

Previously, the name of this directory contained a hash of the main
sketch filename, so the same directory would be used between builds. Now
that this directory is deleted after every build, it can just use a
randomized directory name, which is what this commit does.

Addtionally, the prefix used for generating the name is changed from
"arduino_" to "arduino_modified_sketch_" to make it slightly clearer
what the directory is for (just in case it somehow survives the build,
or a user sees it during the build).
2015-12-28 15:28:58 +01:00
Matthijs Kooijman
1029e0b78d Delete temporary sketch copy after build
When a sketch has unsaved changes, a temporary copy of the sketch is
made with those changes applied. This copy is then passed to
arduino-builder.

Previously, this temporary copy was kept around and only deleted when
the IDE was closed. However, all files were written to it again on every
build, so keeping the old files around did not serve any real purpose.

When a file was renamed in the IDE, the original name would still be
present in the temporary copy, and could cause linker errors because
both were compiled.

This commit makes sure the temporary copy is deleted after every build,
instead of at IDE exit, which fixes this problem with renames.

When a file is deleted from the sketch, the file would also be deleted
from the temporary copy, presumably to fix this same problem for
deletes (but renames were forgotten). With this commit, this special
handling for deleting files is no longer needed, so it is removed.

This fixes #4335
2015-12-28 15:19:55 +01:00
Cristian Maglie
480f2fa0d3 Merge branch 'issue3502-indent' of https://github.com/damellis/Arduino
Fix #3502
2015-12-23 12:14:28 +01:00
David A. Mellis
07903b8585 Use new IncreaseIndentAction for Edit > Increase Indent.
This simplifies the code a bit and fixes a small bug that would cause the cursor to fail to move with the text being indented.
2015-12-21 16:42:40 -08:00
David A. Mellis
05be1480d4 Fix issue #3502: behavior of Cmd+[ and Cmd+] on Mac OS X. 2015-12-21 16:41:12 -08:00
Cristian Maglie
2b4883f755 Merge branch 'keys' of https://github.com/matthijskooijman/Arduino into matthijskooijman-keys 2015-12-21 18:58:21 +01:00
Cristian Maglie
fa4876b7b1 Fixed unit-test UploaderFactoryTest
It was broken after merging #4107
2015-12-21 15:19:22 +01:00
Martino Facchin
767867bacb Revert "Moved -Dawt.useSystemAAFontSettings=on out of java code, where, apparently,"
Fonts on Windows became ugly, reverting whole the commit since it brings no visible changes to Linux and OSX

This reverts commit 6c5e584454.
2015-12-16 10:02:37 +01:00
Federico Fissore
6c5e584454 Moved -Dawt.useSystemAAFontSettings=on out of java code, where, apparently,
has no effect
2015-12-14 10:03:16 +01:00
Matthijs Kooijman
7eea624dfa Remove EditorListener class
It did not contain any actual code anymore, so it can be removed, along
with the infrastructure for setting it up.
2015-12-11 19:31:16 +01:00
Matthijs Kooijman
ac66a9c64a Change workaround for ctrl-slash handling in RSyntaxTextArea
Previously, there was a handler on the text area that consumed most
KEY_TYPED events with control pressed. This was added a long time ago to
fix a problem with ctrl-slash doing both the toggle comment action and
inserting a /. Further investigation shows that with RSyntaxTextArea
this problem is still present, but is caused by a weird binding on the
slash key that Arduino is not even using. Removing that binding is a
cleaner workaround for this problem, so this commit switches to that
workaround.

Ideally this would be fixed in RSyntaxTextArea, see
https://github.com/bobbylight/RSyntaxTextArea/issues/157
2015-12-11 19:31:16 +01:00
Matthijs Kooijman
f06820713e Make ctrl-tab and ctrl-shift-tab work again
In the previous commit, these bindings were moved to EditorTab and
registered in a cleaner way, but this move also allows more components
to hijack these keystrokes and prevent them from reaching EditorTab.

This commit makes the keybindings work again, by preventing other
components from handling the keys. In particular:
 - JSplitPane had a binding to switch between its two panes, which is
   now removed after creating the JSplitPane.
 - The default focus traversal manager in Swing uses these keys to
   traverse focus (in addition to the the normal tab and shift-tab
   keys). By removing these keys from the set of "focus traversal keys"
   defined for the window, this should be prevented when the focus is on
   any component inside the window.
 - JTextPane didn't respond to the previous modification of the
   window-default focus traversal keys, since it defines its own set (to
   only contain ctrl-tab and ctrl-shift-tab, but not tab and shift-tab,
   for undocumented reasons). To fix this, focus traversal is simply
   disabled on the JTextPane, since this wasn't really being used
   anyway.

There was some code in SketchTextArea that tried to modify the focus
traversal keys for just the text area, which is now removed. This code
wasn't really useful, since focus traversal is disabled for the text
area already. Also, the code contained a bug where it would not actually
set the new set of keys for the backward focus traversal.

Closes #195
2015-12-11 19:31:16 +01:00
Matthijs Kooijman
fc4b2028fa Move ctrl-tab and ctrl-shift-tab handling into EditorHeader
Previously, EditorListener handled these keys, by registering a handler
in the text area. This meant that they would only work while the text
area was focused. By registering the keys as WHEN_IN_FOCUSED_WINDOW
bindings, they can always be handled, and EditorHeader seems like a more
appropriate place.

Note that this does not currently work (so this commit breaks these
keys), since these keys are also handled in a few different places as
well, preventing these newly added keybindings to take effect. This will
be fixed in the next commit.

One additional change is that previously, these keybindings did not work
when the text area was readonly. This was probably a remnant from when
EditorListener took care of a lot of other editing keybindings, but
this does not make much sense anymore now.

Finally, with the old bindings, ctrl-shift-tab did not (seem to) work.
What happened is that the binding for ctrl-tab did not check the shift
state, so both bindings would fire on ctrl-shift-tab, switching forward
and back again, making it seem the keys did not work. The Swing
keybinding mechanism that is now used for these bindings checks the
complete keystroke, including all modifier keys, so this problem is
fixed by this change.

References #195
2015-12-11 19:31:16 +01:00
Matthijs Kooijman
e98285f900 Remove duplicate ctrl+alt+left/right handling
These key combinations were registered as accelerator keystrokes in the
tab bar popup menu, but also handled by EditorListener. This was
probably added in an attempt to work around the broken accelerator keys
on the tab bar popup menus, but in practice this only meant that the
shortcut would sometimes (and now that the accelerator keys are fixed,
always) switch tabs *twice*. Removing the handling from EditorListener
helps to fix this.

References: #4228
2015-12-11 19:31:16 +01:00
Matthijs Kooijman
a3ba935a57 Slightly simplify EditorHeader tab selection menu items
Previously, this would use a single ActionListener object, and pass the
filename of the file to switch to in the action command. This means that
whenever switching the filename needs to be looked up. This commit
instead uses a lambda to capture the index of the tab to switch to for
every tab (so it uses a different ActionListener for each tab).
2015-12-11 19:31:16 +01:00
Matthijs Kooijman
2f5375d523 Fix accelerator keybindings for the tab menu
Some items in this menu had accelerator keys (shortcuts) defined.
Normally, this automatically takes care of registering such keybindings
when the menu item is added to a menu. However, this requires adding the
item (indirectly) to a menubar, which is again added to a window. Since
the tab menu is just a separate popup menu, this did not work.

It seems an attempt was made to fix this by adding the popup menu to the
EditorHeader JComponent, which indeed made the keybindings work.
However, this is a hack at best, and as soon as the popup menu was
opened, it would be moved to another container and again detached when
the menu was closed, breaking the keyboard shortcuts again (re-adding
the popup menu turned out not to work either, then the menu would
actually be drawn on top of the tab bar).

To properly fix this, keybindings for the menu items are added to the
EditorHeader itself. By looking at the existing accelerator keystroke
property of the actions, there is no need to duplicate the keystrokes
themselves, and the displayed value will always match the actually bound
value. To simplify this, some methods are added to the Keys helper
class, which will likely come in handy in other places as well.
2015-12-11 19:31:15 +01:00
Matthijs Kooijman
957331299b Use Actions to simplify the EditorHeader popup menu building
Instead of defining JMenuItems, setting accelerator keys, and attaching
an ActionListener inline, this first defines a list of actions (with a
name, optional accelerator key and using a lambda as the action
listener). Then menu items are added, that simply refer to the
previously defined actions.

The actions are defined in a inner class named Actions, of which one
instance is created. This allows grouping the actions together inside
the `actions` attribute, and allows external access to the actions (in
case the same action is present in multiple menus, or otherwise
performed from other places). This might not be the best way to expose
these actions, and perhaps they should be moved elsewhere, but for now
this seems like a good start.

This adds new helper classes SimpleAction, to allow more consisely
defining Action instances, and a new class Keys, to allow consisely
defining keyboard shortcuts.
2015-12-11 19:31:15 +01:00
Matthijs Kooijman
8c176e7429 Remove some old, commented out code 2015-12-11 16:16:01 +01:00
Matthijs Kooijman
f9e1dbd484 Remove unused method 2015-12-11 16:16:01 +01:00
Federico Fissore
98d5ff79eb Upgrading arduino-builder to 1.3.7, which changes the way messages are sent
back to the IDE. Instead of having just stdour and stderr, stdout only is
used, but each message has a log level: info, warn, debug, error
Plain stdout/stderr are still used by child processes
2015-12-11 14:25:13 +01:00
Federico Fissore
66117a5cc0 Burn Bootloader was run in the UI thread, avoiding intermediate messages to be printed to IDE console 2015-12-03 11:09:50 +01:00
Federico Fissore
321f589b0f Reduced "scroll down" timer of ConsoleOutputStream back to 100ms 2015-12-02 16:41:15 +01:00
Federico Fissore
f9c80816aa Halved "scroll down" timer of ConsoleOutputStream 2015-12-01 16:39:17 +01:00
Federico Fissore
e224698ecf Files weren't deleted from temp unsaved sketch folder. Fixes #4233 2015-11-30 10:17:29 +01:00
Federico Fissore
aaebb0a4d6 Stored some regexps in static finals, given names to threads, and slightly
optimized ConsoleOutputStream
2015-11-27 15:07:44 +01:00
Federico Fissore
6855e91883 Fixed various Board/Library managers glitches, in particular when removing/upgrading 2015-11-24 16:14:16 +01:00