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

1525 Commits

Author SHA1 Message Date
Cristian Maglie
d63162b5a1 Added Platform.getSystemDPI() API 2016-11-04 10:23:48 +02:00
Cristian Maglie
b00185e63d juint tests now use the correct jna lib again 2016-11-03 15:01:36 +02:00
Cristian Maglie
21ff728c59 Merge remote-tracking branch 'cmaglie/fix-win-paths' 2016-11-03 12:10:24 +01:00
Cristian Maglie
2856600463 Windows: Use Shell32 utility to determine known paths 2016-10-19 16:28:21 +02:00
Cristian Maglie
7d9ec39ca9 Update jna.jar to 4.2.2 2016-10-19 16:28:20 +02:00
Cristian Maglie
3d6abacee4 Merge branch 'master' of git://github.com/duff2013/Arduino 2016-10-18 16:39:30 +02:00
duff2013
9a3881ecce set grid color through theme.txt now 2016-10-18 00:04:43 -07:00
Cristian Maglie
a8525c6bb0 Parse libraries index after updating it (when launche from CLI)
Fix #5424
2016-10-04 14:06:32 +02:00
duff2013
db8526c27c upgrade Serial Plotter 2016-10-03 19:34:57 -07:00
xloem
8b5a900ae1 Message parsing logic fix
comparison was invalid if some parts were not parsable numbers
2016-09-30 17:04:01 -04:00
xloem
be01c39c3a Empty graph hack fixes #4722 and fixes #5316 2016-09-30 16:56:57 -04:00
Cristian Maglie
bd7e76533a Removed redundant type specifiers for generics 2016-09-29 20:15:56 +02:00
Cristian Maglie
fca863f325 Removed unused variable 2016-09-29 20:15:55 +02:00
Cristian Maglie
3cc9446f04 Removed unused import 2016-09-29 20:15:55 +02:00
Cristian Maglie
0def10443f Fixed another error in string comparison 2016-09-29 20:15:55 +02:00
Cristian Maglie
635807105a Merge remote-tracking branch 'cmaglie/examples-menu-take2' 2016-09-21 09:53:50 +02:00
Cristian Maglie
c58e2e68d1 Fix regression: ignore case in file extensions
Fix #5389
2016-09-20 17:34:03 +02:00
Cristian Maglie
646c9f798f Fix regression: after "save as..." window title is updated
Fix #5388
2016-09-20 16:36:41 +02:00
Cristian Maglie
1efa07f010 Enable visibility of selection on find
Fix #5380
2016-09-20 15:31:17 +02:00
Cristian Maglie
c5a6a44b55 Simplify FindReplace.find() logic (part 2)
The snippet:

    boolean wrapNeeded = false;
    if (wrap && nextIndex == -1) {
      // if wrapping, a second chance is ok, start from the end
      wrapNeeded = true;
    }

Can be moved inside the `if (nextIndex == -1)` that follows, this way:

    if (nextIndex == -1) {
      boolean wrapNeeded = false;
      if (wrap) {
        // if wrapping, a second chance is ok, start from the end
        wrapNeeded = true;
      }

      [...CUT...]

      if (wrapNeeded) {
        nextIndex = backwards ? text.lastIndexOf(search) : text.indexOf(search, 0);
      }
    }

but since `wrapNeeded` is used only at the very end of the `if` statement
we can move it forward:

    if (nextIndex == -1) {
      [...CUT...]

      boolean wrapNeeded = false;
      if (wrap) {
        // if wrapping, a second chance is ok, start from the end
        wrapNeeded = true;
      }
      if (wrapNeeded) {
        nextIndex = backwards ? text.lastIndexOf(search) : text.indexOf(search, 0);
      }
    }

and finally simplify it by removing `wrapNeeded` altogether:

    if (nextIndex == -1) {
      [...CUT...]

      if (wrap) {
        nextIndex = backwards ? text.lastIndexOf(search) : text.indexOf(search, 0);
      }
    }
2016-09-20 13:58:36 +02:00
Cristian Maglie
47fcff77d5 Simplify FindReplace.find() logic (part 1)
The snippet:

    boolean wrapNeeded = false;
    if (wrap && nextIndex == -1) {
      // if wrapping, a second chance is ok, start from the end
      wrapNeeded = true;
    }

is present on both sides of the `if` statement so it can be factored out.
2016-09-20 13:52:24 +02:00
Cristian Maglie
9723726387 Call ensureOffsetNotInClosedFold only when a match is found 2016-09-20 13:45:11 +02:00
Cristian Maglie
096e545257 Examples of arch-independent libs from Arduino goes into Examples for any board
The other cases remain unchanged
2016-09-19 16:30:18 +02:00
Cristian Maglie
821ee53d40 Replaced some example menu labels
From: `Examples from Built-in Libraries`
To:   `Examples for any board`

From: `Examples from Arduino AVR Boards Libraries` (selected platform)
To:   `Examples for Arduino/Genuino Micro` (selected board)

From: `Examples from Arduino AVR Boards Libraries` (referenced platform)
To:   `Examples for Arduino AVR Boards` (referenced platform)
2016-09-19 16:27:47 +02:00
PaulStoffregen
afc7c596fc Only sort ideLibs if it's not empty 2016-09-19 14:25:25 +02:00
PaulStoffregen
d49401bdbf Improve Examples menu 2016-09-19 14:25:13 +02:00
Matthijs Kooijman
c927237912 Fix tab order in FindReplace
When searching through all tabs, the order was accidentally reversed.
This was broken by commit d2bac86 (Remove tab switching logic from
Sketch).

This also fixes a problem where "replace all" would only work on the
first and last tab (since it would search backwards from the first tab
to the last tab and then conclude it was done).

This fixes a part of #5380.
2016-09-19 12:05:11 +02:00
Cristian Maglie
9abf25d222 Fix indentation and license 2016-08-31 19:10:01 +02:00
Martino Facchin
b5223cc576 Ensure that the selected code is not folded during "Search and Replace"
Fixes #4845
2016-08-26 16:42:44 +02:00
Martino Facchin
300b1d7290 Fix rebase errors 2016-08-26 16:42:44 +02:00
Martino Facchin
29e79c8157 update API to v1 2016-08-26 16:42:44 +02:00
Martino Facchin
efc07a1c0e Add Cloud API integration
This method discovers if a connected board needs an additional core and helps the user downloading it via BoardManager
2016-08-26 16:42:44 +02:00
Martino Facchin
f96f1d321a add overloaded method to NotificationPopup to tune autoclose 2016-08-26 16:42:44 +02:00
Matthijs Kooijman
a78a3ed6b5 Update comment
This comment still talked about Processing related stuff which doesn't
really apply anymore.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
94754d7841 In Base.handleOpen(), compare Files rather than Strings
Comparing a File object automatically takes care of filesystem case
sensitivity, whereas strings do not, so this makes the comparison
slightly more reliable.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
4f0af2af57 Store the build path used in Sketch
Previously, everywhere where it was needed, the path was requested from
BaseNoGui. Because the path is based on a hash of the sketch filename,
every caller would get the same path for the same sketch.

However, it makes more sense to store the path used for a given sketch
inside the Sketch object. This prevents having to pass around or
regenerate the build path everywhere, and no longer requires the build
path to be deterministic (though it still is in this commit).

This allows removing some methods and constructors of which two versions
were available - one with a build path argument and one without.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
1d15c434dc Let SketchFile.delete() call Sketch.removeFile()
Previously, callers of `SketchFile.delete()` would also call
`Sketch.removeFile()`, but letting SketchFile handle this is more
robust.

This is possible now that SketchFile keeps a reference to Sketch and
makes updating the Sketch file list less fragile.

Eventually this might be further decoupled by letting SketchFile
broadcast a "deleted" event instead.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
aae0bc4c47 Rename SketchFile.deleteFile() to delete()
The extra "File" in the name was a bit redundant, and this is more
consistent with `Sketch.delete()`.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
ccec28ea45 Move sketch deletion from SketchController into Sketch
This isn't much code, but it makes deletion more consistent with
renaming and saving with the SketchController handling the UI part and
Sketch actually doing the delete.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
85d48394a4 Merge Sketch.renameFileTo() into SketchFile.renameTo()
Now that SketchFile keeps a reference to its Sketch,
`SketchFile.renameTo()` can call `Sketch.checkNewFilename()`, so there
is no need for the renaming itself to go through Sketch.

This changes the parameter for `SketchFile.renameTo()` from File to
String, to enforce that only the filename is changed, not the directory
name.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
b28f1a479d Remove unused Base.listFiles() methods 2016-08-26 16:42:44 +02:00
Matthijs Kooijman
c0f41cae5d Remove Base.removeDir() and Base.removeDescendants()
These methods shouldn't really be in Base (or BaseNoGui, which did the
actual work), especially since there is already a
`FileUtils.recursiveDelete()` which just does the same thing. This
commit removes the code from Base and BaseNoGui and instead uses the
method from FileUtils.

There is one difference between these methods: the Base methods did not
delete files if the "compiler.save_build_files" preference was set.
However, the Base methods were only used when deleting a sketch, or
deleting an existing folder before overwriting it on save as, so this
preference didn't actually do what it was supposed to anyway, so
dropping it shouldn't be a problem.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
72f815bcf9 Refactor file adding and renaming, and save as handling
This commits replaces a significant part of the code handling these
features. A lot of responsibilities are moved from SketchController to
Sketch, though the code involved is rewritten mostly.

Most of the handling now happens inside Sketch, including various checks
against the new filename. Basically SketchController processes the user
input to decide what needs to be done, and Sketch checks if it can be
done and does it.

If problems occur, an IOException is thrown, using a translated error
message that is shown by SketchController as-is. This might not be the
best way to transfer error messages (regular IOExceptions might contain
less-friendly messages), so this might need further improvement later.

In addition to moving around code and responsibilities, this code also
changes behaviour in some places:
 - Because Sketch and SketchFile are now in control of renames and
   saves, they can update their internal state after a rename. This
   removes the need for reloading the entire sketch after a rename or
   save as and allows `Editor.handleOpenUnchecked()` to be removed.
 - When renaming the entire sketch, all files used to be saved before
   renaming, since the sketch would be re-opened after renaming. Since
   the re-opening no longer happens, there is no longer a need to save
   the sketch, so any unsaved changes remain unsaved in the editor after
   renaming the sketch.
 - When renaming or adding new files, duplicate filenames are detected.
   Initially, this happened case sensitively, but it was later changed to
   use case insensitive matching to prevent problems on Windows (where
   filenames cannot differ in just case). To prevent complexity, this
   did not distinguish between systems. In commit 5fbf9621f6 (Sketch
   rename: allowig a case change rename if NOT on windows), the
   intention was to only do case insensitive checking on Windows, but it
   effectively disabled all checking on other systems, making the check
   not catch duplicate filenames at all.

   With this commit, all these checks are done using `File.equals()`
   instead of comparing strings, which is already aware of the case
   sensitivity of the platform and should act accordingly.
 - Some error messages were changed.
 - When adding a file, an empty file is not created directly, but only a
   SketchFile and EditorTab is added. When the sketch is saved, the file
   is created.
 - When importing a file that already exists (thus overwriting it),
   instead of replacing the SketchFile instance, this just lets the
   EditorTab reload its contents. This was broken since the introduction
   of EditorTab. The file would be replaced, but not this was not
   reflected in the editor, which is now fixed. This change allows
   `Sketch.replaceFile()` to be removed.
 - When importing a file that does not exist yet (thus adding it), a tab
   is now also added for it (in addition to a SketchFile). This was
   broken since the introduction of EditorTab, and would result in the
   file being added, but not shown in the editor.

This commit adds a `Sketch.renameFileTo()` method, to rename a single
file within the sketch. It would be better to integrate its contents
into `Sketch.renameTo()`, but that does not have access to the `Sketch`
instance it is contained in. This will be changed in a future commit.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
57a237752d Clean up pde to ino renaming
This makes a few related changes:
 - `FileUtils.replaceExtension()` is introduced to handle replacing the
   .pde extension with .ino.
 - Instead of iterating .pde files on disk, this iterates SketchFiles in
   memory, saving another lookup from filename -> SketchFile later.
 - `SketchController.renameCodeToInoExtension()` is removed. Now it no
   longer needs to look up the SketchFile and FileUtils handles the
   extension replacement, this method did not have any reason to exist
   anymore.
 - Instead of hardcoding the .pde extension, a new
   Sketch.OLD_SKETCH_EXTENSIONS constant is introduced.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
98c0e0f841 Remove Base.copyDir()
There was already a nearly identical `FileUtils.copy()` that copies
directories recursively.

The only difference is that now hidden files *are* copied, but version
control files (according the list in FileUtils) are not. Since this only
affects the copying of the "data" directory during save as, this
should not be much of a problem.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
7a73d0b3db Change Compiler.pathToSketch from String to File
Keeping filenames as File objects for as long as possible is generally a
good idea and this removes a dependency on `Sketch.getMainFilePath()`,
so it can be removed later.
2016-08-26 16:42:44 +02:00
Matthijs Kooijman
959fba7865 Let Sketch.getPrimaryFile return a SketchFile
Previously, it returned a File object, which the Sketch separately
stored from the primary SketchFile. By letting it just return the
SketchFile, and let callers query that for the filename, Sketch does not
need to store the File object itself and there is less chance of info
getting out of sync.
2016-08-26 16:42:44 +02:00
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