1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 00:20:06 +02:00

136 Commits

Author SHA1 Message Date
James Crook
71a2683c5f Add a TODO comment. 2019-04-04 12:51:29 +01:00
Paul Licameli
3760db9dff Remove wx/wxchar.h from headers 2019-03-29 15:56:54 -04:00
Paul Licameli
c698d85cc8 more comments for including Audacity.h 2019-03-23 14:16:05 -04:00
Paul Licameli
173a300427 Include nothing before Audacity.h, as comments say we should...
... and remove some duplicated inclusions
2019-03-17 21:41:39 -04:00
Paul Licameli
1bcb7c20a5 Remove some nested #include from Project.h 2019-03-16 13:09:54 -04:00
Paul Licameli
a30000cf74 Use type aliases FilePath, FilePaths...
... for wxString and wxArrayStringEx, holding file paths (absolute or relative,
directory or plain file); to be replaced later with different types

(not yet using std::vector, becase of some uses of wxArrayString::Index with
two arguments)
2019-03-15 15:18:11 -04:00
Paul Licameli
b8c0125143 Replace comparisons against wxEmptyString with empty() 2019-03-14 16:20:18 -04:00
Paul Licameli
50074f2cfe Replace comparisons against "" with empty() 2019-03-14 13:23:41 -04:00
Paul Licameli
795b6a2e42 More std:: style for wxString and wxArrayString...
... Replacing:

Insert => insert
RemoveAt => erase
Remove => erase
IsSameAs => operator == or operator !=
   (but only when second argument was true or default)
2019-03-10 14:45:12 -04:00
Paul Licameli
dd8eb9e3d9 Less use of wxArrayString::Index() ...
... instead use the utility make_iterator_range and its index() or contains()
method.  This generic utility works with any container defining begin() and
end().

This further lessens dependency on wxWidgets container idioms.
2019-03-10 14:45:06 -04:00
Paul Licameli
2db49dc1f0 Use standard library style members of wxArrayString (and wxString) ...
... which will make it easier to change the types of those containers to
std::vectors of other string-like classes

for wxString,

IsEmpty => empty
Clear => clear
Alloc => reserve

for wxArrayString,

Count => size
GetCount => size
IsEmpty => empty
Add => push_back
Clear => clear
Empty => clear
Sort => std::sort (only with default comparator)
SetCount => resize
Last => back
Item => operator []
Alloc => reserve
2019-03-10 14:43:57 -04:00
Paul Licameli
e832b6895e Case insensitive comparison for file extensions in two places...
... consistent with handling of file extensions elsewhere
2019-03-10 12:55:53 -04:00
Paul Licameli
9d18263be6 Bug2059: Save empty,record,save-as shouldn't delete old _data folder 2019-02-09 17:04:45 -05:00
Paul Licameli
529e1e2afb Bug1979 partial: Faster first-time save, if possible, on Mac and Linux 2018-10-13 13:56:05 -04:00
Paul Licameli
ec506ab52b Define DirManager::ProjectSetter so that commit steps can be deferred 2018-10-13 12:55:29 -04:00
Paul Licameli
0db0c6e0d5 Reorganize some commit logic in DirManager::SetProject 2018-10-13 12:55:29 -04:00
James Crook
5fd95dd131 Fix C4456 Warnings.
"C4456 declaration hides previous local declaration."
These arise from repeated declarations of the same name.
2018-10-10 17:28:50 +01:00
Paul Licameli
968d63d5fd Rewrite many iterations over tracks and channels in various places 2018-10-01 13:35:51 -04:00
Paul Licameli
8e0cffb7f2 Simplify GuardedCall and default its return type to void 2018-01-13 01:32:41 -05:00
Paul Licameli
7fd78183d2 Remove needless uses of wxString::c_str() in wxString::Format...
... and similar wx "variadics," which all treat wxString smartly enough that
you don't need this.

Don't need c_str either to convert wxString to const wxChar * because
wxString has a conversion operator that does the same.
2018-01-01 20:34:33 -05:00
Paul Licameli
ccb4bbac33 Translate "Message" as default title of message box...
... This required a sweeping change of all calls to wxMessageBox!  But it seems
safe to me, despite the great number of touched files.
2018-01-01 17:50:02 -05:00
Paul Licameli
6463e12576 Move MyCopyFile into class FileNames 2017-12-31 16:18:55 -05:00
Paul Licameli
e06a6fd797 Fix blank filenames in .aup saved then saved-as twice to same path...
Bug was introduced at commit c1d1bee6b1914faba750dd4c488e99ced32edad4
2017-12-30 18:00:18 -05:00
James Crook
f463eda36c Clean up some dead code and MSVC warnings.
- Dead code from experiments in SelectionBar removed.
- Many warnings about unused parameters fixed with WXUNUSED()
- Many warnings about signed / unsigned comparisons cleaned up.
- Several 'local variable declared but not used' warnings fixed.
2017-12-08 15:20:39 +00:00
Paul Licameli
0532f9be37 More sanity checking in file save ...
... against corruption as seen in:

http://forum.audacityteam.org/viewtopic.php?f=47&t=97787

Maybe this early check would have alerted the user sooner and prevented
trouble.
2017-11-22 22:41:35 -05:00
Paul Licameli
b94b49265a Don't make orphans in original after save-as 2017-11-08 03:52:40 -05:00
Paul Licameli
7eeb88384d Compensate for bug in wxCopyFile, which can return incorrect success 2017-10-25 15:06:34 -04:00
Paul Licameli
f370df6520 Sense empty .au at opening, treat as missing, give recovery options 2017-10-21 13:02:34 -04:00
Paul Licameli
e050516702 Correct other failure paths in DirManager::SetProject 2017-10-21 13:02:34 -04:00
Paul Licameli
15a1fa14e9 a comment about the new saving procedure 2017-10-21 13:02:34 -04:00
Paul Licameli
c1d1bee6b1 Better error handling when moving a project to another directory...
... Do NOT remove original files, or change the stored path names, until after
successful creation of ALL new copies; then, it is a no-throw commit operation.

In case of failure of some copies, cleanup code already existed to fix
partial results.
2017-10-21 12:59:36 -04:00
Paul Licameli
39a5669cb9 Allow user cancellation of save 2017-10-20 23:56:23 -04:00
Paul Licameli
8a762f95b6 In case save of new project fails, clean up the _data directory 2017-10-16 21:22:19 -04:00
Paul Licameli
55439247ad All the catches are in place for BlockFile and other errors, now throw. 2017-04-03 23:32:40 -04:00
Paul Licameli
ed6f2ea80f Exception safety in: locking of BlockFile for read 2017-03-21 14:11:27 -04:00
Paul Licameli
d11027c2a7 Allow exceptions from BlockFile::Recover, handle them in ProjectFSCK 2017-03-17 17:53:02 -04:00
Paul Licameli
38236a807c More new -> NEW, delete -> DELETE in comments 2017-03-17 17:52:41 -04:00
James Crook
4576ccb1ad HasFiles and HasSubDirs require a successfully opened directory.
Issue found by David Bailes.
2017-03-02 13:08:19 +00:00
James Crook
95861bf7f2 Bug 1567 - Amelioration. Delete EMPTY temp dirs on close in multiproject
This fix adds flags to RecursivelyRemove to be more specific about what to remove.  With the kCleanDirsOnlyIfEmpty option it is now safe to call CleanDir on closing a second unsaved project.  In particular, if some of the wave has been copied to the clipboard, that part of the wave does not get deleted on close, and is available to paste into the other project which is still open.  In CleanDir the folders containing those block files are not deleted.  They will get deleted later when the second project is closed too.

CleanDir is now called with that option when closing a project that is not the last one being closed.  .DS_Store files, if present, will be deleted, and any empty directories for that project.  I have also tested that clipboard contents are preserved.
2017-03-01 15:57:01 +00:00
James Crook
1ffe7367a3 Comment about missing/broken ERR_HANDLING. 2017-02-24 17:21:17 +00:00
James Crook
89c44f9cd6 Add fileSpec to CleanDir, so can be selective about files to delete.
Note that CleanDir may be used on a temp directory, deleting entire projects, and in that case
we delete all files too, but do not want to delete files that are at the top level, only ones inside
projects.
2017-02-20 12:58:11 +00:00
James Crook
0a518b65d1 Don't follow symlinks in RecursivelyEnumerate
Projects will only have symlinks in them if they have been tampered with, and then
following the links, especially when doing CleanDir(), would be dangerous.  So don't.

Improved comments, otherwise it isn't clear that CleanDir is needed on Windows
and Linux, not just Mac.  It is deleting whole subdirs, not just .DS_Store files.
2017-02-20 12:17:16 +00:00
Paul Licameli
5b10c386e9 Bug1594, 1567: Don't destroy source project when saving-as! 2017-02-19 12:55:01 -05:00
Paul Licameli
856dfef30f More accurate comments, after foregoing bug1567 fixes. 2017-01-31 14:25:35 -05:00
Paul Licameli
5392feefd4 Bug1521 residual: Save new project, still must remove project* folder 2017-01-31 12:41:54 -05:00
Paul Licameli
6b65375ee5 Bug1521, bug1567 Mac: wipe .DS_Store in temp folder when saving too 2017-01-28 17:23:15 -05:00
Paul Licameli
dd836f4841 Bug1567 Residual - Use wxDIR_HIDDEN in recursive delete.
Added for consistency with log of remaining files.  This change should clear up .DS_Store on Mac, and so help with 1567 residual issue when files are not deleted on exit.
2017-01-28 11:33:55 +00:00
Paul Licameli
04c3a7c13d wxRmDir() diagnostics
Logs files remaining, if wxRmDir() failed in our function, RecursivelyRemove.
2017-01-27 19:46:55 +00:00
Paul Licameli
62cfeea4a6 Unless on Windows, don't remove directories like files...
... avoiding spurious log messages.
2017-01-27 19:40:26 +00:00
Paul Licameli
ad04187a41 Change sampleCount arguments, variables, return values to size_t...
... whenever they really describe the size of a buffer that fits in memory, or
of a block file (which is never now more than a megabyte and so could be fit in
memory all at once), or a part thereof.
2016-09-15 21:03:17 -04:00