1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +02:00

201 Commits

Author SHA1 Message Date
Paul Licameli
9a4c18255e Eliminate type alias CommandMask 2019-06-14 10:12:45 -04:00
Paul Licameli
e5a786c420 4th arg of ReportIfActionNotAllowed always == 3rd; eliminate it 2019-06-14 10:12:45 -04:00
Paul Licameli
ca5259712c HandleCommandEntry's 3rd parameter was two-valued, make it bool...
... false when it was NoFlagsSpecified, true when it was AlwaysEnabledFlag
2019-06-14 10:12:45 -04:00
Paul Licameli
0f2278d394 Eliminate the confusing mask from CommandManager entries...
... In fact it was only ever different from flags when flags had the special
NoAutoSelect and mask did not.  Now put that bit in the mask too, and make
the special NoAutoSelect always true in MenuManager::GetUpdateFlags().  This
still preserves the intended effects of NoAutoSelect.
2019-06-14 10:12:45 -04:00
Paul Licameli
64650b9a55 Third argument of EnableUsingFlags was always all-ones; eliminate it 2019-06-14 10:12:45 -04:00
Paul Licameli
a34f1cbba5 Reimplement the rejection of select-all-on-none for certain commands...
... Specify it in the menu descriptions.  Don't put special ad hoc logic
in Menus.cpp.
2019-06-14 10:12:44 -04:00
Paul Licameli
36e3a03c7f Redo CommandFlags as std::bitset, allow registration of values 2019-06-14 00:31:15 -04:00
Paul Licameli
ef8c100cee MenuManager holds a back-reference to project; simplifies calls 2019-06-12 11:08:50 -04:00
Paul Licameli
7b09225bf7 Use a hook to implement the shift-click shortcut to keyboard prefs...
This frees EIGHTEEN files from the big strongly connected component!!

They are:

Dependencies
Export
ExportCL
ExportFFmpeg
ExportFFmpegDialogs
ExportFLAC
EportMP2
ExportMP3
ExportOGG
ExportPCM
ExtImportPrefs
Import
ImportRaw
KeyConfigPrefs
KeyView
LibraryPrefs
PrefsDialog
SpectrumPrefs

... and that includes all of the remaining *Prefs files.

It does still leave the nine Export* files in a smaller s.c.c, which could be
broken with a registration system, as was done for import at commit e2cf1d9
2019-06-10 21:56:46 -04:00
Paul Licameli
f951fe0522 CommandManager.cpp compilable without AudacityHeaders.h 2019-06-03 09:54:58 -04:00
Paul Licameli
327845b0ee Remove unneeded things from Project.h 2019-06-02 14:41:47 -04:00
Paul Licameli
82663892dc Accessors to get the project window...
... as a preparation for splitting up class AudacityProject.

Use ProjectWindow as an alias for AudacityProject, and fetch it from the
project with a static member function, where certain of its services are used;
pretending they are not the same class.

Use global accessor functions to get wxFrame from the project where only
wxFrame's member functions are needed, so there will be less dependency on
ProjectWindow when it becomes a distinct class.
2019-05-28 23:18:13 -04:00
Paul Licameli
0923bc19a9 static MenuManager::Get()...
... not member functions of AudacityProject
2019-05-23 16:34:47 -04:00
Paul Licameli
4ba4d0978b static CommandManager::Get()...
... not member functions of AudacityProject
2019-05-23 13:17:29 -04:00
Paul Licameli
8de7528e27 CommandManager.cpp does not depend on AudacityHeaders.h 2019-05-22 09:59:56 -04:00
Paul Licameli
f86403378b Move AudacityMessageBox to its own files...
... breaking cycles among low-level files introduced by 273ba9f
2019-05-20 14:48:36 -04:00
Paul Licameli
db8c4c5e5a Global keyboard capture handling into new files, better comments...
... and break its compile dependency on CommandManager.h by letting it install
callbacks.

This also removes Objective-C mixed code from CommmandManager.

This also eliminates four inclusions of Project.h!

Capture handler state is also global, not per project, though the
CommandManager's callbacks still do depend on the active project.
2019-05-18 15:14:18 -04:00
Paul Licameli
6c57948d8f Remove unnecessary #include-s from .cpp files...
... Unnecessary because transitively included.

But each .cpp file still includes its own .h file near the top to ensure
that it compiles indenendently, even if it is reincluded transitively later.
2019-05-16 17:21:00 -04:00
Paul Licameli
9bf29f5582 CommandManager keys by CommandId, not plain wxString 2019-05-16 12:30:29 -04:00
Paul Licameli
19bf094893 Change CommandManager terminology: "Numeric id" not just "Id" ...
... because I will use CommandId for string identifiers instead, and those
are the really persistent identification
2019-05-16 12:30:29 -04:00
Paul Licameli
11c8377460 NormalizedKeyString redefined as TaggedIdentifier 2019-05-16 12:30:29 -04:00
Paul Licameli
bf005c0dec PrefsPanel::Factory is a specialization of std::function...
... We don't need to define a class for it
2019-05-16 12:14:51 -04:00
James Crook
691666bf79 Bug 2051 - Shortcut for Edit>Clip>Boundaries>Split (Ctrl+i) should be in the Standard shortcut set 2019-04-06 14:34:04 +01:00
Paul Licameli
911d468700 Add #include in CommandManager.cpp 2019-04-04 12:34:40 -04:00
David Bailes
d994ad430a Bug 1762: Importing keystrokes not in standard set
Problem:
1. Use either no prior config files, or set the default shortcuts to standard.
2. If a set of keyboard shortcuts is imported, then any shortcut for a command which only has a default shortcut in the full set is not set, unless it differs from the default shortcut.

This occurs because in CommandManager::HandleXMLTag(), the imported shortcut is only used if it's different from the default shortcut. But for all commands, even those commands which only have a default shortcut in the full set, GetDefaultKeyFromName() returns the default shortcut.

Fix:
Use the imported shortcut, regardless of whether it is different from the default shortcut. (I've left the function GetDefaultKeyFromName(), even though it is not longer used.)

Note:
This results in a change of behaviour:
 Before: if you'd customized the shortcut for a command, then if you imported a set of shortcuts, that customized shortcut would only have been changed if the imported shortcut was also customized.
 Now: If you import a set of shortcuts, then these become your shortcuts, regardless of any customizations present before the import.
 I think the new behaviour is what a user would expect.
2019-04-02 14:24:42 +01:00
Paul Licameli
0dd0a5cb5a Remove <wx/menu.h> from CommandManager.h, moving inline functions out 2019-03-23 10:56:43 -04:00
Paul Licameli
5e7d41ec07 Each .cpp/.mm file includes corresponding header before any other...
... except Audacity.h

This forces us to make each header contain all forward declarations or nested
headers that it requires, rather than depend on context.
2019-03-17 22:54:52 -04:00
Paul Licameli
906e55f047 Experimental.h in all .h or .cpp files that directly use EXPERIMENTALs...
... except Audacity.h; and in no others.

Do so even if Experimental.h gets multiply included, as in both the .h and
.cpp files.

This makes it easier to do a text scan to be sure there are no unintended quiet
changes of meaning because of omission of Experimental.h when the flag is
an enabled one.

Also move inclusions of Experimental.h earlier.

Also don't require Experimental.h to be preceded by Audacity.h to define
EXPERIMENTAL_MIDI_OUT correctly.
2019-03-17 22:54:00 -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
3dba70120c CommandManager, MenuManager don't use Lyrics.h, MixerBoard.h ...
... instead define new base classes in src/commands that those other
windows can inherit.  The classes have nothing but a virtual destructor.  This
lets CommandManager use dynamic_cast to detect the special windows.

See commits cbfde23 and 68e4bf6 which added the #include directives
2019-03-16 13:10:59 -04:00
Paul Licameli
5fd6965925 Use type aliases CommandID, CommandIDs...
... for identifiers of menu commands and macros, and for vectors thereof
2019-03-15 15:18:11 -04:00
Paul Licameli
06b3b42794 Remove unnecessary initializers for empty wxString 2019-03-15 15:18:11 -04:00
Paul Licameli
50074f2cfe Replace comparisons against "" with empty() 2019-03-14 13:23:41 -04:00
Paul Licameli
2991928437 Remove stripping of / and & and space from align command ids ...
... this has been unnecessary since commit 9780c14
2019-03-13 01:09:52 -04:00
Paul Licameli
2a1bf3a77f More std:: style for wxString...
... Remove all uses of the three-valued Cmp comparison member function, which
returns 0 for equality, except in one place.  Use operators == and != instead.

(C++20's spaceship operator hasn't landed here yet!)
2019-03-10 14:45:20 -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
c68e336247 More use of std:: style members of wxString...
... replacing:

Length => length
Len => length
2019-03-10 14:44:54 -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
466e9c179e Create ComponentInterface
It combines the old IdentInterface with the ParamsInterface, providing an identifier and parameters (if needed).
The main purpose of the change is to make the class hierarchy (as viewed via doxygen) much easier to follow.
2018-11-02 17:04:43 +00:00
Paul Licameli
e048a4aacd Move a static function and an enumeration out of MenuCommandHandler 2018-10-24 12:16:46 -04:00
Paul Licameli
9759c6bd4f Plugin Menus 2018-10-24 12:16:44 -04:00
Paul Licameli
5277584bb0 Hide details of managing occult command items 2018-10-20 14:19:58 -04:00
Paul Licameli
01875db4bd Don't hold a dangling pointer to a menu bar in CommandManager 2018-10-20 12:53:03 -04:00
Paul Licameli
fefc3bf35d Don't call CommandManger::AddGlobalCommand, use an option instead 2018-10-20 11:59:39 -04:00
Paul Licameli
c9d9871f6c Remove a comment 2018-10-20 11:58:02 -04:00
Paul Licameli
7f5e6d12b1 Only one public CommandManager fn to begin a menu and one to end...
... It knows the nesting, so it decides for itself whether to manage the menu
as main or sub-.
2018-10-20 09:40:03 -04:00
Paul Licameli
27aa59ed50 AddItemList takes IdentInterfaceSymbol (untranslated) ...
... so that we can use a static constant table of names, which can't use
macro _ in initializers.
2018-10-20 09:21:22 -04:00
Paul Licameli
fc1bc7994e Remove CommandManager::SetDefaultFlags and related 2018-10-17 23:14:55 -04:00
Paul Licameli
a1bd9062ae Remove dead code; so that all remaining calls to NewIdentifier...
...are followed by a setting of flags and mask
2018-10-17 23:13:56 -04:00
Paul Licameli
63f20f3405 CommandManager::AddItemList requires flags 2018-10-17 23:13:56 -04:00