Commit Graph

43 Commits

Author SHA1 Message Date
Paul Licameli 4209c8150a Bug2764: Open Project... in Scriptables shouldn't corrupt project...
... Now new project windows are opened when .aup3 files are opened; but
behavior chages only in that case.

Wherever opening of other files invoked import code, we still do or do
not make a new project in exactly the same cases as before; such as, when
opening multiple files with File > Open, be sure each imported file still opens
in its own separate window.

This means the decision whether to open a new project must be lowered into
ProjectFileManager, where the type of the file is discovered, and we pass it a
function object so it avoids a dependency cycle with ProjectManager.

It also means the checking for errors and closing of new projects in case of
failure must be replicated at all places where ProjectFileManager::OpenProject
is called directly.

The class ProjectManager::ProjectChooser simplifies this.

Recently introduced calls to SafeToOpenProjectInto(), before
ProjectManager::OpenProject(), are now lowered into that class, delaying the
safety check so it might also be called where ProjectFileManager is used
directly.
2021-05-24 20:04:58 -04:00
Paul Licameli c96d5f12bc Comments; range-for; fix unchecked dereferences of pointer-to-pointer 2021-05-24 20:04:57 -04:00
Paul Licameli c5ebc396eb Audacity.h has shrunk to nothing, now remove it! 2021-05-10 00:05:23 -05:00
Leland Lucius 7b8a977f15 Add ClearLog macro command and parameters to tracing 2020-08-11 09:06:15 -05:00
Leland Lucius b6eaf5623e Add "tracing" of macro commands
At this time it's really just a debugging aid for us. It should
make it easier for us to better understand timing of various
commands.

Tracing is enabled by setting the "/EnableMacroTracing" preference
to 1 and disabled by setting it to 0.

Since the tracing is written to the log, this also adds a "SaveLog"
command that takes a filename. It can be used from within the macro
being traced to preserve the log in case the script intended to
exit Audacity.
2020-08-11 00:14:56 -05:00
Leland Lucius 1777afa596 AUP3: UP-23 - Macro commands 2020-07-05 14:32:20 -05:00
Leland Lucius 015ba548c2 AUP3: Add SaveCopy macro command
To go along with new menu item.

And adjust prompting for filenames in Save dialogs to return
to Save dialog if file can't be overwritten.
2020-07-03 17:12:26 -05:00
Leland Lucius d39590cf41 AUP3: First round of updates
!!! THERE WILL NO DOUBT BE BUGS !!!

This is a big one and there's still several things to
complete. Just want to get this in the wild to start
receiving feedback.

One big thing right now is that it will NOT load pre-aup3
files.  An importer is on the way for that.
2020-07-01 02:30:18 -05:00
Paul Licameli 4d09705a73 Change XO to XXO in many more places, with no effects at all...
... because the two macros have the same expansion, and are both checked for
in the --keyword arguments passed to msgfmt by locale/update_po_files.sh.

This commit makes ONLY such changes, and comments in Internat.h.  It is big
but quite harmless.

The intention is to introduce a type distinction in a later release, by defining
XXO differently.  XXO is used where & characters in strings (for hotkeys of menu
items or control prompts) are permitted, XO where not.
2020-05-22 13:07:50 -04:00
James Crook 301c511422 Remove unwanted ':' on names of scripting checkboxes.
The name comes after the checkbox, and looks better without the ':'.
Made an exception for "Resize:" in  SetProjectCommand.
It controls 4 subordinate settings, and those settings do come after the name.
2020-03-05 19:53:16 +00:00
Paul Licameli 2522459637 Each command class registers itself 2020-01-19 19:21:12 -05:00
Paul Licameli 0ca5775234 Eliminate one of the ## macro hacks in LoadCommands 2020-01-19 19:21:12 -05:00
Paul Licameli 747c35645a TranslatableString for checkbox captions 2019-12-23 19:15:34 -05:00
Paul Licameli 5168d62e3d TranslatableString for captions of text entry boxes 2019-12-23 18:53:00 -05:00
Paul Licameli 8b70203e45 Lower functions from ProjectManager to ProjectFileManager...
... not improving the dependency graph, but it's a more sensible division of
duties, keeping related functions together.
2019-06-09 12:10:51 -04:00
Paul Licameli 27eeb1035c New files for ProjectFileManager 2019-06-09 12:10:51 -04:00
Paul Licameli 4bf3365af4 Split class ProjectFileManager from ProjectFileIO...
... The former will handle File menu items, and the choosing of file paths to
write; the latter will handle the XML contents and do auto-save.  Auto-save is
a lower-level thing that must be done in many places whenever undo history
is pushed or modified.
2019-06-09 12:10:50 -04:00
Paul Licameli 3fc961f74a New files for ProjectFileIO 2019-06-03 01:24:01 -04:00
Paul Licameli 7b8bfd1d02 New attached structure ProjectFileIO handles load and save 2019-06-03 01:21:15 -04:00
Paul Licameli fee5582826 New files for ProjectManager 2019-06-03 01:21:12 -04:00
Paul Licameli 4274d44ab7 New attached structure ProjectManager handles project lifetime...
... that is, a factory function, open, close, import, undo/redo/rollback.

Also the callbacks from AudioIO, which need to invoke undo history push when
recording stops.

It is meant as a high-level class using several of the other things attached
to the project, while AudacityProject will be a low level class acting mostly
as just the container of the attached structures.
2019-06-03 01:18:12 -04:00
Paul Licameli 9eb9104859 Remove CommandContext::GetProject() ...
... which called ::GetActiveProject(), but one purpose of the CommandContext
class was to eliminate many uses of that global function, because a
CommandContext must always be constructed from a reference to a project
(which was always in fact the active one), then passed around to where it is
needed!

Also, just use the project member directly -- because CommandContext was
intended as just a P.O.D (plain-old-data) structure.

This also eliminates a dependency of CommandContext.cpp on Project.cpp.

This is not enough by itself to break any dependency cycles.
2019-05-18 20:31:17 -04:00
Paul Licameli f6adeed47b Remove some unnecessary #include directives 2019-05-15 14:14:18 -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 3ff61f3e10 Remove Shuttle.h from other headers 2019-03-17 15:03:05 -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 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
James Crook 465148cb3e Bug 2039 - Macros: Reload parameter not remembered.
This arose from the conversion from optional parameters to required parameters.
The same problem was found in Screenshot command and in open/save command.
2018-11-27 13:23:32 +00:00
Paul Licameli d1e2ec3b0f Remove some uses of MenuCommandHandler outside Menus.cpp...
... where the functions were simple call-throughs to something else
2018-10-24 11:02:32 -04:00
Paul Licameli ce9f2e2538 Include Menus.h directly, only where needed, not via Project.h 2018-10-16 16:45:26 -04:00
Paul Licameli 9481587fa8 Move menu handling functions out of class AudacityProject 2018-09-29 12:10:27 -04:00
James Crook e3ef968d57 Add DragCommand. Default Y/N on optional fields. Open/Save project items.
- More Y/N in Optional, making it easier to omit parameters.
- AT removed from Envelope, since T already gives it.
2018-02-24 14:20:29 -05:00
James Crook e9e9ee2998 Can choose by Channel or by Track in Set commands. 2018-02-24 14:20:28 -05:00
James Crook 1c988b4e3a Automation: AudacityCommand
This is a squash of 50 commits.

This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class.  AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.

- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
   - Tested with Zoom Toggle.

- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.

We abuse EffectsManager.  It handles both Effects and
AudacityCommands now.  In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.

- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.

This way we can search for related types at the same time.

- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason.  They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.

- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
  which are now better handled by other commands.

- JSONify "GetInfo: Commands" output, i.e. commas in the right places.

- General work on better Doxygen.
    - Lyrics -> LyricsPanel
    - Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
  previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
2018-02-24 14:20:22 -05:00
Paul Licameli a3be011bf6 inclusions of Audacity.h 2018-02-21 19:20:53 -05:00
Paul Licameli ab6de1181d No more functor objects; all command handler functions take same args 2018-01-05 09:27:29 -05:00
Paul Licameli c3e53ea26e Remove some naked new amd delete in: overrides of CommandType::BuildSignature 2016-08-08 07:53:29 -04:00
Paul Licameli 185d5e132d Avoid some wxString copies 2016-04-17 13:58:21 -04:00
Paul Licameli e8ad90b3c9 Manage Commands and CommandOutputTarget objects with smart pointers 2016-04-06 16:05:28 -04:00
Paul Licameli f4441d7476 Command validator cloners return smart pointers, and...
... defined DefaultValidator so Validator can be abstract, as the comment for
Clone() stongly implies it should be.

But this is virtual is unused except in comments.
2016-04-06 16:05:21 -04:00
Leland Lucius cbcc78b183 Fix for bug #887
A little overkill, but low risk since the majority of the source
changed isn't actually used.
2015-05-16 17:57:01 -05:00
james.k.crook@gmail.com 6fc830c0b6 Added Steve Parry's patch that adds the Open and SaveAs commands to scripting. 2014-01-13 22:12:20 +00:00