Use menu item registration system to sever many link dependencies...
... Many of these dependencies were hidden ones, not reflected in the diagrams generated by scripts/graph.pl, because they relied on extern declarations and so not indicated in header files.
This commit is contained in:
commit
c1d129ec98
|
@ -67,11 +67,13 @@ the mouse around.
|
||||||
|
|
||||||
#include "ShuttleGui.h"
|
#include "ShuttleGui.h"
|
||||||
#include "AColor.h"
|
#include "AColor.h"
|
||||||
|
#include "CommonCommandFlags.h"
|
||||||
#include "FFT.h"
|
#include "FFT.h"
|
||||||
#include "PitchName.h"
|
#include "PitchName.h"
|
||||||
#include "prefs/GUISettings.h"
|
#include "prefs/GUISettings.h"
|
||||||
#include "Prefs.h"
|
#include "Prefs.h"
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
|
#include "ProjectWindow.h"
|
||||||
#include "WaveClip.h"
|
#include "WaveClip.h"
|
||||||
#include "ViewInfo.h"
|
#include "ViewInfo.h"
|
||||||
#include "AllThemeResources.h"
|
#include "AllThemeResources.h"
|
||||||
|
@ -1137,3 +1139,55 @@ void FreqPlot::OnMouseEvent(wxMouseEvent & event)
|
||||||
freqWindow->PlotMouseEvent(event);
|
freqWindow->PlotMouseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remaining code hooks this add-on into the application
|
||||||
|
#include "commands/CommandContext.h"
|
||||||
|
#include "commands/CommandManager.h"
|
||||||
|
#include "commands/ScreenshotCommand.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
AudacityProject::AttachedWindows::RegisteredFactory sFrequencyWindowKey{
|
||||||
|
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||||
|
auto &window = ProjectWindow::Get( parent );
|
||||||
|
return safenew FrequencyPlotDialog(
|
||||||
|
&window, -1, parent, XO("Frequency Analysis"),
|
||||||
|
wxPoint{ 150, 150 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define our extra menu item that invokes that factory
|
||||||
|
struct Handler : CommandHandlerObject {
|
||||||
|
void OnPlotSpectrum(const CommandContext &context)
|
||||||
|
{
|
||||||
|
auto &project = context.project;
|
||||||
|
auto freqWindow =
|
||||||
|
&project.AttachedWindows::Get< FrequencyPlotDialog >( sFrequencyWindowKey );
|
||||||
|
|
||||||
|
if( ScreenshotCommand::MayCapture( freqWindow ) )
|
||||||
|
return;
|
||||||
|
freqWindow->Show(true);
|
||||||
|
freqWindow->Raise();
|
||||||
|
freqWindow->SetFocus();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
// Handler is not stateful. Doesn't need a factory registered with
|
||||||
|
// AudacityProject.
|
||||||
|
static Handler instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register that menu item
|
||||||
|
|
||||||
|
using namespace MenuTable;
|
||||||
|
AttachedItem sAttachment{ wxT("Analyze/Analyzers/Windows"),
|
||||||
|
( FinderScope{ findCommandHandler },
|
||||||
|
Command( wxT("PlotSpectrum"), XXO("Plot Spectrum..."),
|
||||||
|
&Handler::OnPlotSpectrum,
|
||||||
|
AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag() ) )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ undo memory so as to free up space.
|
||||||
|
|
||||||
#include "AudioIO.h"
|
#include "AudioIO.h"
|
||||||
#include "Clipboard.h"
|
#include "Clipboard.h"
|
||||||
|
#include "CommonCommandFlags.h"
|
||||||
#include "../images/Arrow.xpm"
|
#include "../images/Arrow.xpm"
|
||||||
#include "../images/Empty9x16.xpm"
|
#include "../images/Empty9x16.xpm"
|
||||||
#include "UndoManager.h"
|
#include "UndoManager.h"
|
||||||
|
@ -316,3 +317,85 @@ void HistoryDialog::OnSize(wxSizeEvent & WXUNUSED(event))
|
||||||
if (mList->GetItemCount() > 0)
|
if (mList->GetItemCount() > 0)
|
||||||
mList->EnsureVisible(mSelected);
|
mList->EnsureVisible(mSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remaining code hooks this add-on into the application
|
||||||
|
#include "commands/CommandContext.h"
|
||||||
|
#include "commands/CommandManager.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// History window attached to each project is built on demand by:
|
||||||
|
AudacityProject::AttachedWindows::RegisteredFactory sHistoryWindowKey{
|
||||||
|
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||||
|
auto &undoManager = UndoManager::Get( parent );
|
||||||
|
return safenew HistoryDialog( &parent, &undoManager );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define our extra menu item that invokes that factory
|
||||||
|
struct Handler : CommandHandlerObject {
|
||||||
|
void OnHistory(const CommandContext &context)
|
||||||
|
{
|
||||||
|
auto &project = context.project;
|
||||||
|
|
||||||
|
auto historyWindow = &project.AttachedWindows::Get( sHistoryWindowKey );
|
||||||
|
historyWindow->Show();
|
||||||
|
historyWindow->Raise();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
// Handler is not stateful. Doesn't need a factory registered with
|
||||||
|
// AudacityProject.
|
||||||
|
static Handler instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register that menu item
|
||||||
|
|
||||||
|
using namespace MenuTable;
|
||||||
|
AttachedItem sAttachment{ wxT("View/Windows"),
|
||||||
|
// History window should be available either for UndoAvailableFlag
|
||||||
|
// or RedoAvailableFlag,
|
||||||
|
// but we can't make the AddItem flags and mask have both,
|
||||||
|
// because they'd both have to be true for the
|
||||||
|
// command to be enabled.
|
||||||
|
// If user has Undone the entire stack, RedoAvailableFlag is on
|
||||||
|
// but UndoAvailableFlag is off.
|
||||||
|
// If user has done things but not Undone anything,
|
||||||
|
// RedoAvailableFlag is off but UndoAvailableFlag is on.
|
||||||
|
// So in either of those cases,
|
||||||
|
// (AudioIONotBusyFlag | UndoAvailableFlag | RedoAvailableFlag) mask
|
||||||
|
// would fail.
|
||||||
|
// The only way to fix this in the current architecture
|
||||||
|
// is to hack in special cases for RedoAvailableFlag
|
||||||
|
// in AudacityProject::UpdateMenus() (ugly)
|
||||||
|
// and CommandManager::HandleCommandEntry() (*really* ugly --
|
||||||
|
// shouldn't know about particular command names and flags).
|
||||||
|
// Here's the hack that would be necessary in
|
||||||
|
// AudacityProject::UpdateMenus(), if somebody decides to do it:
|
||||||
|
// // Because EnableUsingFlags requires all the flag bits match the
|
||||||
|
// // corresponding mask bits,
|
||||||
|
// // "UndoHistory" specifies only
|
||||||
|
// // AudioIONotBusyFlag | UndoAvailableFlag, because that
|
||||||
|
// // covers the majority of cases where it should be enabled.
|
||||||
|
// // If history is not empty but we've Undone the whole stack,
|
||||||
|
// // we also want to enable,
|
||||||
|
// // to show the Redo's on stack.
|
||||||
|
// // "UndoHistory" might already be enabled,
|
||||||
|
// // but add this check for RedoAvailableFlag.
|
||||||
|
// if (flags & RedoAvailableFlag)
|
||||||
|
// GetCommandManager()->Enable(wxT("UndoHistory"), true);
|
||||||
|
// So for now, enable the command regardless of stack.
|
||||||
|
// It will just show empty sometimes.
|
||||||
|
// FOR REDESIGN,
|
||||||
|
// clearly there are some limitations with the flags/mask bitmaps.
|
||||||
|
|
||||||
|
/* i18n-hint: Clicking this menu item shows the various editing steps
|
||||||
|
that have been taken.*/
|
||||||
|
( FinderScope{ findCommandHandler },
|
||||||
|
Command( wxT("UndoHistory"), XXO("&History..."), &Handler::OnHistory,
|
||||||
|
AudioIONotBusyFlag() ) )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "LyricsWindow.h"
|
#include "LyricsWindow.h"
|
||||||
#include "Lyrics.h"
|
#include "Lyrics.h"
|
||||||
#include "AudioIOBase.h"
|
#include "AudioIOBase.h"
|
||||||
|
#include "CommonCommandFlags.h"
|
||||||
#include "Prefs.h" // for RTL_WORKAROUND
|
#include "Prefs.h" // for RTL_WORKAROUND
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
#include "ProjectAudioIO.h"
|
#include "ProjectAudioIO.h"
|
||||||
|
@ -167,3 +168,46 @@ void LyricsWindow::OnTimer(wxCommandEvent &event)
|
||||||
// Let other listeners get the notification
|
// Let other listeners get the notification
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remaining code hooks this add-on into the application
|
||||||
|
#include "commands/CommandContext.h"
|
||||||
|
#include "commands/CommandManager.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// Lyrics window attached to each project is built on demand by:
|
||||||
|
AudacityProject::AttachedWindows::RegisteredFactory sLyricsWindowKey{
|
||||||
|
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||||
|
return safenew LyricsWindow( &parent );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define our extra menu item that invokes that factory
|
||||||
|
struct Handler : CommandHandlerObject {
|
||||||
|
void OnKaraoke(const CommandContext &context)
|
||||||
|
{
|
||||||
|
auto &project = context.project;
|
||||||
|
|
||||||
|
auto lyricsWindow = &project.AttachedWindows::Get( sLyricsWindowKey );
|
||||||
|
lyricsWindow->Show();
|
||||||
|
lyricsWindow->Raise();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
// Handler is not stateful. Doesn't need a factory registered with
|
||||||
|
// AudacityProject.
|
||||||
|
static Handler instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register that menu item
|
||||||
|
|
||||||
|
using namespace MenuTable;
|
||||||
|
AttachedItem sAttachment{ wxT("View/Windows"),
|
||||||
|
( FinderScope{ findCommandHandler },
|
||||||
|
Command( wxT("Karaoke"), XXO("&Karaoke..."), &Handler::OnKaraoke,
|
||||||
|
LabelTracksExistFlag() ) )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "widgets/AudacityMessageBox.h"
|
#include "widgets/AudacityMessageBox.h"
|
||||||
#include "widgets/ErrorDialog.h"
|
#include "widgets/ErrorDialog.h"
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
#include <wx/menu.h>
|
#include <wx/menu.h>
|
||||||
|
@ -944,29 +945,6 @@ void Visit( Visitor &visitor, BaseItem *pTopItem, GroupItem *pRegistry )
|
||||||
/// changes in configured preferences - for example changes in key-bindings
|
/// changes in configured preferences - for example changes in key-bindings
|
||||||
/// affect the short-cut key legend that appears beside each command,
|
/// affect the short-cut key legend that appears beside each command,
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr FileMenu();
|
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr EditMenu();
|
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr SelectMenu();
|
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr ViewMenu();
|
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr TransportMenu();
|
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr TracksMenu();
|
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr GenerateMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr EffectMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr AnalyzeMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr ToolsMenu();
|
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr WindowMenu();
|
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraMenu();
|
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr HelpMenu();
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
static Registry::GroupItem &sRegistry()
|
static Registry::GroupItem &sRegistry()
|
||||||
{
|
{
|
||||||
|
@ -981,26 +959,49 @@ MenuTable::AttachedItem::AttachedItem(
|
||||||
Registry::RegisterItem( sRegistry(), placement, std::move( pItem ) );
|
Registry::RegisterItem( sRegistry(), placement, std::move( pItem ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table of menu factories.
|
|
||||||
// TODO: devise a registration system instead.
|
|
||||||
static const auto menuTree = MenuTable::Items( MenuPathStart
|
|
||||||
, FileMenu()
|
|
||||||
, EditMenu()
|
|
||||||
, SelectMenu()
|
|
||||||
, ViewMenu()
|
|
||||||
, TransportMenu()
|
|
||||||
, TracksMenu()
|
|
||||||
, GenerateMenu()
|
|
||||||
, EffectMenu()
|
|
||||||
, AnalyzeMenu()
|
|
||||||
, ToolsMenu()
|
|
||||||
, WindowMenu()
|
|
||||||
, ExtraMenu()
|
|
||||||
, HelpMenu()
|
|
||||||
);
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
// Once only, cause initial population of preferences for the ordering
|
||||||
|
// of some menu items that used to be given in tables but are now separately
|
||||||
|
// registered in several .cpp files; the sequence of registration depends
|
||||||
|
// on unspecified accidents of static initialization order across
|
||||||
|
// compilation units, so we need something specific here to preserve old
|
||||||
|
// default appearance of menus.
|
||||||
|
// But this needs only to mention some strings -- there is no compilation or
|
||||||
|
// link dependency of this source file on those other implementation files.
|
||||||
|
void InitializeMenuOrdering()
|
||||||
|
{
|
||||||
|
using Pair = std::pair<const wxChar *, const wxChar *>;
|
||||||
|
static const Pair pairs [] = {
|
||||||
|
{wxT(""), wxT(
|
||||||
|
"File,Edit,Select,View,Transport,Tracks,Generate,Effect,Analyze,Tools,Window,Optional,Help"
|
||||||
|
)},
|
||||||
|
{wxT("/Optional/Extra/Part1"), wxT(
|
||||||
|
"Transport,Tools,Mixer,Edit,PlayAtSpeed,Seek,Device,Select"
|
||||||
|
)},
|
||||||
|
{wxT("/Optional/Extra/Part2"), wxT(
|
||||||
|
"Navigation,Focus,Cursor,Track,Scriptables1,Scriptables2"
|
||||||
|
)},
|
||||||
|
{wxT("/View/Windows"), wxT("UndoHistory,Karaoke,MixerBoard")},
|
||||||
|
{wxT("/Analyze/Analyzers/Windows"), wxT("ContrastAnalyser,PlotSpectrum")},
|
||||||
|
{wxT("/Transport/Basic"),wxT("Play,Record,Scrubbing,Cursor")},
|
||||||
|
};
|
||||||
|
|
||||||
|
bool doFlush = false;
|
||||||
|
for (auto pair : pairs) {
|
||||||
|
const auto key = wxString{'/'} + MenuPathStart + pair.first;
|
||||||
|
if ( gPrefs->Read(key).empty() ) {
|
||||||
|
gPrefs->Write( key, pair.second );
|
||||||
|
doFlush = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doFlush)
|
||||||
|
gPrefs->Flush();
|
||||||
|
}
|
||||||
|
|
||||||
using namespace MenuTable;
|
using namespace MenuTable;
|
||||||
|
|
||||||
struct MenuItemVisitor : MenuVisitor
|
struct MenuItemVisitor : MenuVisitor
|
||||||
{
|
{
|
||||||
MenuItemVisitor( AudacityProject &proj, CommandManager &man )
|
MenuItemVisitor( AudacityProject &proj, CommandManager &man )
|
||||||
|
@ -1102,6 +1103,9 @@ struct MenuItemVisitor : MenuVisitor
|
||||||
|
|
||||||
void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
|
void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
|
||||||
{
|
{
|
||||||
|
static std::once_flag flag;
|
||||||
|
std::call_once( flag, InitializeMenuOrdering );
|
||||||
|
|
||||||
auto &commandManager = CommandManager::Get( project );
|
auto &commandManager = CommandManager::Get( project );
|
||||||
|
|
||||||
// The list of defaults to exclude depends on
|
// The list of defaults to exclude depends on
|
||||||
|
@ -1125,6 +1129,7 @@ void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
|
||||||
|
|
||||||
void MenuManager::Visit( MenuVisitor &visitor )
|
void MenuManager::Visit( MenuVisitor &visitor )
|
||||||
{
|
{
|
||||||
|
static const auto menuTree = MenuTable::Items( MenuPathStart );
|
||||||
Registry::Visit( visitor, menuTree.get(), &sRegistry() );
|
Registry::Visit( visitor, menuTree.get(), &sRegistry() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "NoteTrack.h"
|
#include "NoteTrack.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "CommonCommandFlags.h"
|
||||||
#include "KeyboardCapture.h"
|
#include "KeyboardCapture.h"
|
||||||
#include "Prefs.h" // for RTL_WORKAROUND
|
#include "Prefs.h" // for RTL_WORKAROUND
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
|
@ -1484,5 +1485,46 @@ void MixerBoardFrame::Recreate( AudacityProject *pProject )
|
||||||
this->SetSize( siz2 );
|
this->SetSize( siz2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remaining code hooks this add-on into the application
|
||||||
|
#include "commands/CommandContext.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// Mixer board window attached to each project is built on demand by:
|
||||||
|
AudacityProject::AttachedWindows::RegisteredFactory sMixerBoardKey{
|
||||||
|
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||||
|
return safenew MixerBoardFrame( &parent );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define our extra menu item that invokes that factory
|
||||||
|
struct Handler : CommandHandlerObject {
|
||||||
|
void OnMixerBoard(const CommandContext &context)
|
||||||
|
{
|
||||||
|
auto &project = context.project;
|
||||||
|
|
||||||
|
auto mixerBoardFrame = &project.AttachedWindows::Get( sMixerBoardKey );
|
||||||
|
mixerBoardFrame->Show();
|
||||||
|
mixerBoardFrame->Raise();
|
||||||
|
mixerBoardFrame->SetFocus();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
// Handler is not stateful. Doesn't need a factory registered with
|
||||||
|
// AudacityProject.
|
||||||
|
static Handler instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register that menu item
|
||||||
|
|
||||||
|
using namespace MenuTable;
|
||||||
|
AttachedItem sAttachment{ wxT("View/Windows"),
|
||||||
|
( FinderScope{ findCommandHandler },
|
||||||
|
Command( wxT("MixerBoard"), XXO("&Mixer Board..."), &Handler::OnMixerBoard,
|
||||||
|
PlayableTracksExistFlag()) )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,12 @@
|
||||||
#include "../Audacity.h"
|
#include "../Audacity.h"
|
||||||
#include "Contrast.h"
|
#include "Contrast.h"
|
||||||
|
|
||||||
|
#include "../CommonCommandFlags.h"
|
||||||
#include "../WaveTrack.h"
|
#include "../WaveTrack.h"
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
#include "../ProjectSettings.h"
|
#include "../ProjectSettings.h"
|
||||||
#include "../ProjectWindowBase.h"
|
#include "../ProjectWindow.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../FileNames.h"
|
#include "../FileNames.h"
|
||||||
#include "../ViewInfo.h"
|
#include "../ViewInfo.h"
|
||||||
|
@ -648,3 +649,56 @@ void ContrastDialog::OnReset(wxCommandEvent & /*event*/)
|
||||||
mPassFailText->ChangeValue(wxT(""));
|
mPassFailText->ChangeValue(wxT(""));
|
||||||
mDiffText->ChangeValue(wxT(""));
|
mDiffText->ChangeValue(wxT(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remaining code hooks this add-on into the application
|
||||||
|
#include "commands/CommandContext.h"
|
||||||
|
#include "commands/CommandManager.h"
|
||||||
|
#include "../commands/ScreenshotCommand.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// Contrast window attached to each project is built on demand by:
|
||||||
|
AudacityProject::AttachedWindows::RegisteredFactory sContrastDialogKey{
|
||||||
|
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||||
|
auto &window = ProjectWindow::Get( parent );
|
||||||
|
return safenew ContrastDialog(
|
||||||
|
&window, -1, XO("Contrast Analysis (WCAG 2 compliance)"),
|
||||||
|
wxPoint{ 150, 150 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define our extra menu item that invokes that factory
|
||||||
|
struct Handler : CommandHandlerObject {
|
||||||
|
void OnContrast(const CommandContext &context)
|
||||||
|
{
|
||||||
|
auto &project = context.project;
|
||||||
|
auto contrastDialog =
|
||||||
|
&project.AttachedWindows::Get< ContrastDialog >( sContrastDialogKey );
|
||||||
|
|
||||||
|
contrastDialog->CentreOnParent();
|
||||||
|
if( ScreenshotCommand::MayCapture( contrastDialog ) )
|
||||||
|
return;
|
||||||
|
contrastDialog->Show();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
// Handler is not stateful. Doesn't need a factory registered with
|
||||||
|
// AudacityProject.
|
||||||
|
static Handler instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register that menu item
|
||||||
|
|
||||||
|
using namespace MenuTable;
|
||||||
|
AttachedItem sAttachment{ wxT("Analyze/Analyzers/Windows"),
|
||||||
|
( FinderScope{ findCommandHandler },
|
||||||
|
Command( wxT("ContrastAnalyser"), XXO("Contrast..."),
|
||||||
|
&Handler::OnContrast,
|
||||||
|
AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag(),
|
||||||
|
wxT("Ctrl+Shift+T") ) )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -823,10 +823,13 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& ClipActions::Handler :: X)
|
#define FN(X) (& ClipActions::Handler :: X)
|
||||||
|
|
||||||
// Under /MenuBar/Select
|
namespace {
|
||||||
MenuTable::BaseItemSharedPtr ClipSelectMenu()
|
using namespace MenuTable;
|
||||||
|
|
||||||
|
// Register menu items
|
||||||
|
|
||||||
|
BaseItemSharedPtr ClipSelectMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static BaseItemSharedPtr menu {
|
static BaseItemSharedPtr menu {
|
||||||
|
@ -850,10 +853,13 @@ MenuTable::BaseItemSharedPtr ClipSelectMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Transport/Cursor
|
AttachedItem sAttachment1{
|
||||||
MenuTable::BaseItemSharedPtr ClipCursorItems()
|
wxT("Select/Basic"),
|
||||||
|
Shared( ClipSelectMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ClipCursorItems()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static BaseItemSharedPtr items{
|
static BaseItemSharedPtr items{
|
||||||
|
@ -871,11 +877,14 @@ MenuTable::BaseItemSharedPtr ClipCursorItems()
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra/Cursor
|
AttachedItem sAttachment2{
|
||||||
MenuTable::BaseItemSharedPtr ExtraClipCursorItems()
|
{ wxT("Transport/Basic/Cursor"),
|
||||||
{
|
{ OrderingHint::Before, wxT("CursProjectStart") } },
|
||||||
using namespace MenuTable;
|
Shared( ClipCursorItems() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ExtraClipCursorItems()
|
||||||
|
{
|
||||||
static BaseItemSharedPtr items{
|
static BaseItemSharedPtr items{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Items( wxT("Clip"),
|
Items( wxT("Clip"),
|
||||||
|
@ -887,4 +896,11 @@ MenuTable::BaseItemSharedPtr ExtraClipCursorItems()
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment3{
|
||||||
|
{ wxT("Optional/Extra/Part2/Cursor"), { OrderingHint::End, {} } },
|
||||||
|
Shared( ExtraClipCursorItems() )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -997,8 +997,6 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& EditActions::Handler :: X)
|
#define FN(X) (& EditActions::Handler :: X)
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr LabelEditMenus();
|
|
||||||
|
|
||||||
static const ReservedCommandFlag
|
static const ReservedCommandFlag
|
||||||
&CutCopyAvailableFlag() { static ReservedCommandFlag flag{
|
&CutCopyAvailableFlag() { static ReservedCommandFlag flag{
|
||||||
[](const AudacityProject &project){
|
[](const AudacityProject &project){
|
||||||
|
@ -1024,10 +1022,10 @@ static const ReservedCommandFlag
|
||||||
cutCopyOptions()
|
cutCopyOptions()
|
||||||
}; return flag; }
|
}; return flag; }
|
||||||
|
|
||||||
// Under /MenuBar
|
namespace {
|
||||||
MenuTable::BaseItemSharedPtr EditMenu()
|
using namespace MenuTable;
|
||||||
|
BaseItemSharedPtr EditMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static const auto NotBusyTimeAndTracksFlags =
|
static const auto NotBusyTimeAndTracksFlags =
|
||||||
|
@ -1141,8 +1139,6 @@ MenuTable::BaseItemSharedPtr EditMenu()
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
LabelEditMenus(),
|
|
||||||
|
|
||||||
Command( wxT("EditMetaData"), XXO("&Metadata..."), FN(OnEditMetadata),
|
Command( wxT("EditMetaData"), XXO("&Metadata..."), FN(OnEditMetadata),
|
||||||
AudioIONotBusyFlag() )
|
AudioIONotBusyFlag() )
|
||||||
|
|
||||||
|
@ -1164,10 +1160,13 @@ MenuTable::BaseItemSharedPtr EditMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
AttachedItem sAttachment1{
|
||||||
MenuTable::BaseItemSharedPtr ExtraEditMenu()
|
wxT(""),
|
||||||
|
Shared( EditMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ExtraEditMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
static const auto flags =
|
static const auto flags =
|
||||||
AudioIONotBusyFlag() | TracksSelectedFlag() | TimeSelectedFlag();
|
AudioIONotBusyFlag() | TracksSelectedFlag() | TimeSelectedFlag();
|
||||||
|
@ -1222,4 +1221,10 @@ RegisteredMenuItemEnabler selectWaveTracks2{{
|
||||||
selectAll
|
selectAll
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
AttachedItem sAttachment2{
|
||||||
|
wxT("Optional/Extra/Part1"),
|
||||||
|
Shared( ExtraEditMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -136,55 +136,23 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& ExtraActions::Handler :: X)
|
#define FN(X) (& ExtraActions::Handler :: X)
|
||||||
|
|
||||||
// Imported menu item definitions
|
namespace {
|
||||||
|
using namespace MenuTable;
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraEditMenu();
|
BaseItemSharedPtr ExtraMixerMenu();
|
||||||
MenuTable::BaseItemSharedPtr ExtraSelectionMenu();
|
BaseItemSharedPtr ExtraDeviceMenu();
|
||||||
MenuTable::BaseItemSharedPtr ExtraCursorMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraSeekMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraToolsMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraTransportMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraPlayAtSpeedMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraTrackMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraScriptablesIMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraScriptablesIIMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraWindowItems();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraGlobalCommands();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraFocusMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraMixerMenu();
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraDeviceMenu();
|
|
||||||
MenuTable::BaseItemPtr ExtraMiscItems( AudacityProject & );
|
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraMenu()
|
BaseItemSharedPtr ExtraMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
|
|
||||||
// Table of menu factories.
|
// Table of menu factories.
|
||||||
// TODO: devise a registration system instead.
|
// TODO: devise a registration system instead.
|
||||||
static BaseItemSharedPtr extraItems{ Items( wxEmptyString,
|
static BaseItemSharedPtr extraItems{ Items( wxEmptyString,
|
||||||
Section( "Part1",
|
Section( "Part1",
|
||||||
ExtraTransportMenu()
|
ExtraMixerMenu()
|
||||||
, ExtraToolsMenu()
|
|
||||||
, ExtraMixerMenu()
|
|
||||||
, ExtraEditMenu()
|
|
||||||
, ExtraPlayAtSpeedMenu()
|
|
||||||
, ExtraSeekMenu()
|
|
||||||
, ExtraDeviceMenu()
|
, ExtraDeviceMenu()
|
||||||
, ExtraSelectionMenu()
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Section( "Part2",
|
Section( "Part2" )
|
||||||
ExtraGlobalCommands()
|
|
||||||
, ExtraFocusMenu()
|
|
||||||
, ExtraCursorMenu()
|
|
||||||
, ExtraTrackMenu()
|
|
||||||
, ExtraScriptablesIMenu()
|
|
||||||
, ExtraScriptablesIIMenu()
|
|
||||||
|
|
||||||
// Delayed evaluation:
|
|
||||||
, ExtraMiscItems
|
|
||||||
)
|
|
||||||
) };
|
) };
|
||||||
|
|
||||||
static const auto pred =
|
static const auto pred =
|
||||||
|
@ -196,10 +164,14 @@ MenuTable::BaseItemSharedPtr ExtraMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
AttachedItem sAttachment1{
|
||||||
MenuTable::BaseItemSharedPtr ExtraMixerMenu()
|
wxT(""),
|
||||||
|
Shared( ExtraMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
// Under /MenuBar/Optional/Extra/Part1
|
||||||
|
BaseItemSharedPtr ExtraMixerMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Menu( wxT("Mixer"), XO("Mi&xer"),
|
Menu( wxT("Mixer"), XO("Mi&xer"),
|
||||||
|
@ -219,10 +191,9 @@ MenuTable::BaseItemSharedPtr ExtraMixerMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
// Under /MenuBar/Optional/Extra/Part1
|
||||||
MenuTable::BaseItemSharedPtr ExtraDeviceMenu()
|
BaseItemSharedPtr ExtraDeviceMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Menu( wxT("Device"), XO("De&vice"),
|
Menu( wxT("Device"), XO("De&vice"),
|
||||||
|
@ -241,10 +212,9 @@ MenuTable::BaseItemSharedPtr ExtraDeviceMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
// Under /MenuBar/Optional/Extra/Part2
|
||||||
MenuTable::BaseItemPtr ExtraMiscItems( AudacityProject &project )
|
BaseItemPtr ExtraMiscItems()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
constexpr auto key =
|
constexpr auto key =
|
||||||
|
@ -258,15 +228,24 @@ MenuTable::BaseItemPtr ExtraMiscItems( AudacityProject &project )
|
||||||
// Not a menu.
|
// Not a menu.
|
||||||
return ( FinderScope{ findCommandHandler },
|
return ( FinderScope{ findCommandHandler },
|
||||||
Items( wxT("Misc"),
|
Items( wxT("Misc"),
|
||||||
// Accel key is not bindable.
|
// Delayed evaluation
|
||||||
Command( wxT("FullScreenOnOff"), XXO("&Full Screen (on/off)"),
|
[]( AudacityProject &project ) {
|
||||||
FN(OnFullScreen),
|
return
|
||||||
AlwaysEnabledFlag,
|
// Accel key is not bindable.
|
||||||
Options{ key }.CheckState(
|
Command( wxT("FullScreenOnOff"), XXO("&Full Screen (on/off)"),
|
||||||
GetProjectFrame( project ).wxTopLevelWindow::IsFullScreen() ) ),
|
FN(OnFullScreen),
|
||||||
|
AlwaysEnabledFlag,
|
||||||
ExtraWindowItems()
|
Options{ key }.CheckState(
|
||||||
|
GetProjectFrame( project ).wxTopLevelWindow::IsFullScreen() ) );
|
||||||
|
}
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment2{
|
||||||
|
Placement{ wxT("Optional/Extra/Part2"), { OrderingHint::End } },
|
||||||
|
Shared( ExtraMiscItems() )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -551,10 +551,11 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& FileActions::Handler :: X)
|
#define FN(X) (& FileActions::Handler :: X)
|
||||||
|
|
||||||
// under /MenuBar
|
namespace {
|
||||||
MenuTable::BaseItemSharedPtr FileMenu()
|
using namespace MenuTable;
|
||||||
|
|
||||||
|
BaseItemSharedPtr FileMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
|
@ -705,4 +706,10 @@ MenuTable::BaseItemSharedPtr FileMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment1{
|
||||||
|
wxT(""),
|
||||||
|
Shared( FileMenu() )
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -523,10 +523,10 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& HelpActions::Handler :: X)
|
#define FN(X) (& HelpActions::Handler :: X)
|
||||||
|
|
||||||
// Under /MenuBar
|
namespace {
|
||||||
MenuTable::BaseItemSharedPtr HelpMenu()
|
using namespace MenuTable;
|
||||||
|
BaseItemSharedPtr HelpMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Menu( wxT("Help"), XO("&Help"),
|
Menu( wxT("Help"), XO("&Help"),
|
||||||
|
@ -602,4 +602,11 @@ MenuTable::BaseItemSharedPtr HelpMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment1{
|
||||||
|
wxT(""),
|
||||||
|
Shared( HelpMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -585,8 +585,9 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& LabelEditActions::Handler :: X)
|
#define FN(X) (& LabelEditActions::Handler :: X)
|
||||||
|
|
||||||
// Under /MenuBar/Edit
|
namespace {
|
||||||
MenuTable::BaseItemSharedPtr LabelEditMenus()
|
using namespace MenuTable;
|
||||||
|
BaseItemSharedPtr LabelEditMenus()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
using namespace MenuTable;
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
@ -601,7 +602,7 @@ MenuTable::BaseItemSharedPtr LabelEditMenus()
|
||||||
|
|
||||||
static BaseItemSharedPtr menus{
|
static BaseItemSharedPtr menus{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Items( wxEmptyString,
|
Items( wxT("LabelEditMenus"),
|
||||||
|
|
||||||
Menu( wxT("Labels"), XO("&Labels"),
|
Menu( wxT("Labels"), XO("&Labels"),
|
||||||
Section( "",
|
Section( "",
|
||||||
|
@ -687,4 +688,12 @@ MenuTable::BaseItemSharedPtr LabelEditMenus()
|
||||||
return menus;
|
return menus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment1{
|
||||||
|
{ wxT("Edit/Other"),
|
||||||
|
{ OrderingHint::Before, wxT("EditMetaData") } },
|
||||||
|
Shared( LabelEditMenus() )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -555,11 +555,11 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &project) {
|
||||||
|
|
||||||
#define FN(X) (& NavigationActions::Handler :: X)
|
#define FN(X) (& NavigationActions::Handler :: X)
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
namespace {
|
||||||
MenuTable::BaseItemSharedPtr ExtraGlobalCommands()
|
using namespace MenuTable;
|
||||||
|
BaseItemSharedPtr ExtraGlobalCommands()
|
||||||
{
|
{
|
||||||
// Ceci n'est pas un menu
|
// Ceci n'est pas un menu
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static BaseItemSharedPtr items{
|
static BaseItemSharedPtr items{
|
||||||
|
@ -575,10 +575,13 @@ MenuTable::BaseItemSharedPtr ExtraGlobalCommands()
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
AttachedItem sAttachment2{
|
||||||
MenuTable::BaseItemSharedPtr ExtraFocusMenu()
|
wxT("Optional/Extra/Part2"),
|
||||||
|
Shared( ExtraGlobalCommands() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ExtraFocusMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
static const auto FocusedTracksFlags = TracksExistFlag() | TrackPanelHasFocus();
|
static const auto FocusedTracksFlags = TracksExistFlag() | TrackPanelHasFocus();
|
||||||
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
|
@ -610,4 +613,11 @@ MenuTable::BaseItemSharedPtr ExtraFocusMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment3{
|
||||||
|
wxT("Optional/Extra/Part2"),
|
||||||
|
Shared( ExtraFocusMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include "../BatchProcessDialog.h"
|
#include "../BatchProcessDialog.h"
|
||||||
#include "../Benchmark.h"
|
#include "../Benchmark.h"
|
||||||
#include "../CommonCommandFlags.h"
|
#include "../CommonCommandFlags.h"
|
||||||
#include "../FreqWindow.h"
|
|
||||||
#include "../Menus.h"
|
#include "../Menus.h"
|
||||||
#include "../PluginManager.h"
|
#include "../PluginManager.h"
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
|
@ -16,7 +15,6 @@
|
||||||
#include "../commands/CommandContext.h"
|
#include "../commands/CommandContext.h"
|
||||||
#include "../commands/CommandManager.h"
|
#include "../commands/CommandManager.h"
|
||||||
#include "../commands/ScreenshotCommand.h"
|
#include "../commands/ScreenshotCommand.h"
|
||||||
#include "../effects/Contrast.h"
|
|
||||||
#include "../effects/EffectManager.h"
|
#include "../effects/EffectManager.h"
|
||||||
#include "../effects/EffectUI.h"
|
#include "../effects/EffectUI.h"
|
||||||
#include "../effects/RealtimeEffectManager.h"
|
#include "../effects/RealtimeEffectManager.h"
|
||||||
|
@ -25,26 +23,6 @@
|
||||||
// private helper classes and functions
|
// private helper classes and functions
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
AudacityProject::AttachedWindows::RegisteredFactory sContrastDialogKey{
|
|
||||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
|
||||||
auto &window = ProjectWindow::Get( parent );
|
|
||||||
return safenew ContrastDialog(
|
|
||||||
&window, -1, XO("Contrast Analysis (WCAG 2 compliance)"),
|
|
||||||
wxPoint{ 150, 150 }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AudacityProject::AttachedWindows::RegisteredFactory sFrequencyWindowKey{
|
|
||||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
|
||||||
auto &window = ProjectWindow::Get( parent );
|
|
||||||
return safenew FrequencyPlotDialog(
|
|
||||||
&window, -1, parent, XO("Frequency Analysis"),
|
|
||||||
wxPoint{ 150, 150 }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AudacityProject::AttachedWindows::RegisteredFactory sMacrosWindowKey{
|
AudacityProject::AttachedWindows::RegisteredFactory sMacrosWindowKey{
|
||||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||||
auto &window = ProjectWindow::Get( parent );
|
auto &window = ProjectWindow::Get( parent );
|
||||||
|
@ -456,31 +434,6 @@ void OnManageAnalyzers(const CommandContext &context)
|
||||||
DoManagePluginsMenu(project, EffectTypeAnalyze);
|
DoManagePluginsMenu(project, EffectTypeAnalyze);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnContrast(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
auto contrastDialog =
|
|
||||||
&project.AttachedWindows::Get< ContrastDialog >( sContrastDialogKey );
|
|
||||||
|
|
||||||
contrastDialog->CentreOnParent();
|
|
||||||
if( ScreenshotCommand::MayCapture( contrastDialog ) )
|
|
||||||
return;
|
|
||||||
contrastDialog->Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnPlotSpectrum(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
auto freqWindow =
|
|
||||||
&project.AttachedWindows::Get< FrequencyPlotDialog >( sFrequencyWindowKey );
|
|
||||||
|
|
||||||
if( ScreenshotCommand::MayCapture( freqWindow ) )
|
|
||||||
return;
|
|
||||||
freqWindow->Show(true);
|
|
||||||
freqWindow->Raise();
|
|
||||||
freqWindow->SetFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnManageTools(const CommandContext &context )
|
void OnManageTools(const CommandContext &context )
|
||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
|
@ -748,9 +701,10 @@ MenuTable::BaseItemPtrs PopulateMacrosMenu( CommandFlag flags )
|
||||||
// Menu definitions
|
// Menu definitions
|
||||||
|
|
||||||
// Under /MenuBar
|
// Under /MenuBar
|
||||||
MenuTable::BaseItemSharedPtr GenerateMenu()
|
namespace {
|
||||||
|
using namespace MenuTable;
|
||||||
|
BaseItemSharedPtr GenerateMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
// All of this is a bit hacky until we can get more things connected into
|
// All of this is a bit hacky until we can get more things connected into
|
||||||
// the plugin manager...sorry! :-(
|
// the plugin manager...sorry! :-(
|
||||||
|
|
||||||
|
@ -784,10 +738,13 @@ static const ReservedCommandFlag
|
||||||
}
|
}
|
||||||
}; return flag; } //lll
|
}; return flag; } //lll
|
||||||
|
|
||||||
// Under /MenuBar
|
AttachedItem sAttachment1{
|
||||||
MenuTable::BaseItemSharedPtr EffectMenu()
|
wxT(""),
|
||||||
|
Shared( GenerateMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr EffectMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
// All of this is a bit hacky until we can get more things connected into
|
// All of this is a bit hacky until we can get more things connected into
|
||||||
// the plugin manager...sorry! :-(
|
// the plugin manager...sorry! :-(
|
||||||
|
|
||||||
|
@ -834,10 +791,13 @@ MenuTable::BaseItemSharedPtr EffectMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar
|
AttachedItem sAttachment2{
|
||||||
MenuTable::BaseItemSharedPtr AnalyzeMenu()
|
wxT(""),
|
||||||
|
Shared( EffectMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr AnalyzeMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
// All of this is a bit hacky until we can get more things connected into
|
// All of this is a bit hacky until we can get more things connected into
|
||||||
// the plugin manager...sorry! :-(
|
// the plugin manager...sorry! :-(
|
||||||
|
|
||||||
|
@ -852,11 +812,7 @@ MenuTable::BaseItemSharedPtr AnalyzeMenu()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Section( "Analyzers",
|
Section( "Analyzers",
|
||||||
Command( wxT("ContrastAnalyser"), XXO("Contrast..."), FN(OnContrast),
|
Items( "Windows" ),
|
||||||
AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag(),
|
|
||||||
wxT("Ctrl+Shift+T") ),
|
|
||||||
Command( wxT("PlotSpectrum"), XXO("Plot Spectrum..."), FN(OnPlotSpectrum),
|
|
||||||
AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag() ),
|
|
||||||
|
|
||||||
// Delayed evaluation:
|
// Delayed evaluation:
|
||||||
[](AudacityProject&)
|
[](AudacityProject&)
|
||||||
|
@ -870,10 +826,13 @@ MenuTable::BaseItemSharedPtr AnalyzeMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar
|
AttachedItem sAttachment3{
|
||||||
MenuTable::BaseItemSharedPtr ToolsMenu()
|
wxT(""),
|
||||||
|
Shared( AnalyzeMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ToolsMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
|
@ -954,11 +913,13 @@ MenuTable::BaseItemSharedPtr ToolsMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
AttachedItem sAttachment4{
|
||||||
MenuTable::BaseItemSharedPtr ExtraScriptablesIMenu()
|
wxT(""),
|
||||||
{
|
Shared( ToolsMenu() )
|
||||||
using namespace MenuTable;
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ExtraScriptablesIMenu()
|
||||||
|
{
|
||||||
// These are the more useful to VI user Scriptables.
|
// These are the more useful to VI user Scriptables.
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
|
@ -1004,11 +965,13 @@ MenuTable::BaseItemSharedPtr ExtraScriptablesIMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
AttachedItem sAttachment5{
|
||||||
MenuTable::BaseItemSharedPtr ExtraScriptablesIIMenu()
|
wxT("Optional/Extra/Part2"),
|
||||||
{
|
Shared( ExtraScriptablesIMenu() )
|
||||||
using namespace MenuTable;
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ExtraScriptablesIIMenu()
|
||||||
|
{
|
||||||
// Less useful to VI users.
|
// Less useful to VI users.
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
|
@ -1046,4 +1009,11 @@ MenuTable::BaseItemSharedPtr ExtraScriptablesIIMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment6{
|
||||||
|
wxT("Optional/Extra/Part2"),
|
||||||
|
Shared( ExtraScriptablesIIMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -1028,12 +1028,10 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &project) {
|
||||||
|
|
||||||
#define FN(X) (& SelectActions::Handler :: X)
|
#define FN(X) (& SelectActions::Handler :: X)
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr ClipSelectMenu();
|
namespace {
|
||||||
|
using namespace MenuTable;
|
||||||
// Under /MenuBar
|
BaseItemSharedPtr SelectMenu()
|
||||||
MenuTable::BaseItemSharedPtr SelectMenu()
|
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
|
@ -1112,14 +1110,8 @@ MenuTable::BaseItemSharedPtr SelectMenu()
|
||||||
Command( wxT("NextLowerPeakFrequency"),
|
Command( wxT("NextLowerPeakFrequency"),
|
||||||
XXO("Next &Lower Peak Frequency"), FN(OnNextLowerPeakFrequency),
|
XXO("Next &Lower Peak Frequency"), FN(OnNextLowerPeakFrequency),
|
||||||
TracksExistFlag() )
|
TracksExistFlag() )
|
||||||
),
|
)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
ClipSelectMenu()
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Section( "",
|
Section( "",
|
||||||
|
@ -1144,10 +1136,13 @@ MenuTable::BaseItemSharedPtr SelectMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
AttachedItem sAttachment1{
|
||||||
MenuTable::BaseItemSharedPtr ExtraSelectionMenu()
|
wxT(""),
|
||||||
|
Shared( SelectMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ExtraSelectionMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Menu( wxT("Select"), XO("&Selection"),
|
Menu( wxT("Select"), XO("&Selection"),
|
||||||
|
@ -1187,12 +1182,15 @@ MenuTable::BaseItemSharedPtr ExtraSelectionMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr ClipCursorItems();
|
AttachedItem sAttachment2{
|
||||||
|
wxT("Optional/Extra/Part1"),
|
||||||
|
Shared( ExtraSelectionMenu() )
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Transport
|
namespace {
|
||||||
MenuTable::BaseItemSharedPtr CursorMenu()
|
BaseItemSharedPtr CursorMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
static const auto CanStopFlags = AudioIONotBusyFlag() | CanStopAudioStreamFlag();
|
static const auto CanStopFlags = AudioIONotBusyFlag() | CanStopAudioStreamFlag();
|
||||||
|
|
||||||
|
@ -1222,8 +1220,6 @@ MenuTable::BaseItemSharedPtr CursorMenu()
|
||||||
TracksSelectedFlag(),
|
TracksSelectedFlag(),
|
||||||
Options{ wxT("K"), XO("Cursor to Track End") } ),
|
Options{ wxT("K"), XO("Cursor to Track End") } ),
|
||||||
|
|
||||||
ClipCursorItems(),
|
|
||||||
|
|
||||||
Command( wxT("CursProjectStart"), XXO("&Project Start"),
|
Command( wxT("CursProjectStart"), XXO("&Project Start"),
|
||||||
FN(OnSkipStart),
|
FN(OnSkipStart),
|
||||||
CanStopFlags,
|
CanStopFlags,
|
||||||
|
@ -1235,13 +1231,13 @@ MenuTable::BaseItemSharedPtr CursorMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraClipCursorItems();
|
AttachedItem sAttachment0{
|
||||||
|
wxT("Transport/Basic"),
|
||||||
|
Shared( CursorMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
BaseItemSharedPtr ExtraCursorMenu()
|
||||||
MenuTable::BaseItemSharedPtr ExtraCursorMenu()
|
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Menu( wxT("Cursor"), XO("&Cursor"),
|
Menu( wxT("Cursor"), XO("&Cursor"),
|
||||||
|
@ -1262,17 +1258,18 @@ MenuTable::BaseItemSharedPtr ExtraCursorMenu()
|
||||||
TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+,") ),
|
TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+,") ),
|
||||||
Command( wxT("CursorLongJumpRight"), XXO("Cursor Long Ju&mp Right"),
|
Command( wxT("CursorLongJumpRight"), XXO("Cursor Long Ju&mp Right"),
|
||||||
FN(OnCursorLongJumpRight),
|
FN(OnCursorLongJumpRight),
|
||||||
TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+.") ),
|
TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+.") )
|
||||||
|
|
||||||
ExtraClipCursorItems()
|
|
||||||
) ) };
|
) ) };
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
AttachedItem sAttachment4{
|
||||||
MenuTable::BaseItemSharedPtr ExtraSeekMenu()
|
wxT("Optional/Extra/Part2"),
|
||||||
|
Shared( ExtraCursorMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ExtraSeekMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Menu( wxT("Seek"), XO("See&k"),
|
Menu( wxT("Seek"), XO("See&k"),
|
||||||
|
@ -1289,4 +1286,11 @@ MenuTable::BaseItemSharedPtr ExtraSeekMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment5{
|
||||||
|
wxT("Optional/Extra/Part1"),
|
||||||
|
Shared( ExtraSeekMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -253,95 +253,100 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& ToolbarActions::Handler :: X)
|
#define FN(X) (& ToolbarActions::Handler :: X)
|
||||||
|
|
||||||
// Under /MenuBar/View
|
namespace{
|
||||||
MenuTable::BaseItemSharedPtr ToolbarsMenu()
|
using namespace MenuTable;
|
||||||
|
BaseItemSharedPtr ToolbarsMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static const auto checkOff = Options{}.CheckState( false );
|
static const auto checkOff = Options{}.CheckState( false );
|
||||||
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Menu( wxT("Toolbars"), XO("&Toolbars"),
|
Section( wxT("Toolbars"),
|
||||||
Section( "Reset",
|
Menu( wxT("Toolbars"), XO("&Toolbars"),
|
||||||
/* i18n-hint: (verb)*/
|
Section( "Reset",
|
||||||
Command( wxT("ResetToolbars"), XXO("Reset Toolb&ars"),
|
/* i18n-hint: (verb)*/
|
||||||
FN(OnResetToolBars), AlwaysEnabledFlag )
|
Command( wxT("ResetToolbars"), XXO("Reset Toolb&ars"),
|
||||||
),
|
FN(OnResetToolBars), AlwaysEnabledFlag )
|
||||||
|
),
|
||||||
|
|
||||||
Section( "Other",
|
Section( "Other",
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||||
with the big buttons on it (play record etc)*/
|
with the big buttons on it (play record etc)*/
|
||||||
Command( wxT("ShowTransportTB"), XXO("&Transport Toolbar"),
|
Command( wxT("ShowTransportTB"), XXO("&Transport Toolbar"),
|
||||||
FN(OnShowTransportToolBar), AlwaysEnabledFlag, checkOff ),
|
FN(OnShowTransportToolBar), AlwaysEnabledFlag, checkOff ),
|
||||||
/* i18n-hint: Clicking this menu item shows a toolbar
|
/* i18n-hint: Clicking this menu item shows a toolbar
|
||||||
that has some tools in it*/
|
that has some tools in it*/
|
||||||
Command( wxT("ShowToolsTB"), XXO("T&ools Toolbar"),
|
Command( wxT("ShowToolsTB"), XXO("T&ools Toolbar"),
|
||||||
FN(OnShowToolsToolBar), AlwaysEnabledFlag, checkOff ),
|
FN(OnShowToolsToolBar), AlwaysEnabledFlag, checkOff ),
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||||
with the recording level meters*/
|
with the recording level meters*/
|
||||||
Command( wxT("ShowRecordMeterTB"), XXO("&Recording Meter Toolbar"),
|
Command( wxT("ShowRecordMeterTB"), XXO("&Recording Meter Toolbar"),
|
||||||
FN(OnShowRecordMeterToolBar), AlwaysEnabledFlag, checkOff ),
|
FN(OnShowRecordMeterToolBar), AlwaysEnabledFlag, checkOff ),
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||||
with the playback level meter*/
|
with the playback level meter*/
|
||||||
Command( wxT("ShowPlayMeterTB"), XXO("&Playback Meter Toolbar"),
|
Command( wxT("ShowPlayMeterTB"), XXO("&Playback Meter Toolbar"),
|
||||||
FN(OnShowPlayMeterToolBar), AlwaysEnabledFlag, checkOff )
|
FN(OnShowPlayMeterToolBar), AlwaysEnabledFlag, checkOff )
|
||||||
|
|
||||||
/* --i18nhint: Clicking this menu item shows the toolbar
|
/* --i18nhint: Clicking this menu item shows the toolbar
|
||||||
which has sound level meters*/
|
which has sound level meters*/
|
||||||
//Command( wxT("ShowMeterTB"), XXO("Co&mbined Meter Toolbar"),
|
//Command( wxT("ShowMeterTB"), XXO("Co&mbined Meter Toolbar"),
|
||||||
// FN(OnShowMeterToolBar), AlwaysEnabledFlag, checkOff ),
|
// FN(OnShowMeterToolBar), AlwaysEnabledFlag, checkOff ),
|
||||||
|
|
||||||
|
,
|
||||||
|
|
||||||
|
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||||
|
with the mixer*/
|
||||||
|
Command( wxT("ShowMixerTB"), XXO("Mi&xer Toolbar"),
|
||||||
|
FN(OnShowMixerToolBar), AlwaysEnabledFlag, checkOff ),
|
||||||
|
/* i18n-hint: Clicking this menu item shows the toolbar for editing*/
|
||||||
|
Command( wxT("ShowEditTB"), XXO("&Edit Toolbar"),
|
||||||
|
FN(OnShowEditToolBar), AlwaysEnabledFlag, checkOff ),
|
||||||
|
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||||
|
for transcription (currently just vary play speed)*/
|
||||||
|
Command( wxT("ShowTranscriptionTB"), XXO("Pla&y-at-Speed Toolbar"),
|
||||||
|
FN(OnShowTranscriptionToolBar), AlwaysEnabledFlag, checkOff ),
|
||||||
|
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||||
|
that enables Scrub or Seek playback and Scrub Ruler*/
|
||||||
|
Command( wxT("ShowScrubbingTB"), XXO("Scru&b Toolbar"),
|
||||||
|
FN(OnShowScrubbingToolBar), AlwaysEnabledFlag, checkOff ),
|
||||||
|
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||||
|
that manages devices*/
|
||||||
|
Command( wxT("ShowDeviceTB"), XXO("&Device Toolbar"),
|
||||||
|
FN(OnShowDeviceToolBar), AlwaysEnabledFlag, checkOff ),
|
||||||
|
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||||
|
for selecting a time range of audio*/
|
||||||
|
Command( wxT("ShowSelectionTB"), XXO("&Selection Toolbar"),
|
||||||
|
FN(OnShowSelectionToolBar), AlwaysEnabledFlag, checkOff )
|
||||||
|
#ifdef EXPERIMENTAL_TIMER_TOOLBAR
|
||||||
,
|
,
|
||||||
|
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
for viewing actual time of the cursor*/
|
||||||
with the mixer*/
|
Command( wxT("ShowTimerToolBarTB"), XXO("&Timer Toolbar"),
|
||||||
Command( wxT("ShowMixerTB"), XXO("Mi&xer Toolbar"),
|
FN(OnShowTimerToolBar), AlwaysEnabledFlag, checkOff )
|
||||||
FN(OnShowMixerToolBar), AlwaysEnabledFlag, checkOff ),
|
#endif
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar for editing*/
|
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||||
Command( wxT("ShowEditTB"), XXO("&Edit Toolbar"),
|
,
|
||||||
FN(OnShowEditToolBar), AlwaysEnabledFlag, checkOff ),
|
Command( wxT("ShowSpectralSelectionTB"),
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||||
for transcription (currently just vary play speed)*/
|
for selecting a frequency range of audio*/
|
||||||
Command( wxT("ShowTranscriptionTB"), XXO("Pla&y-at-Speed Toolbar"),
|
XXO("Spe&ctral Selection Toolbar"),
|
||||||
FN(OnShowTranscriptionToolBar), AlwaysEnabledFlag, checkOff ),
|
FN(OnShowSpectralSelectionToolBar), AlwaysEnabledFlag, checkOff )
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
#endif
|
||||||
that enables Scrub or Seek playback and Scrub Ruler*/
|
)
|
||||||
Command( wxT("ShowScrubbingTB"), XXO("Scru&b Toolbar"),
|
|
||||||
FN(OnShowScrubbingToolBar), AlwaysEnabledFlag, checkOff ),
|
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
|
||||||
that manages devices*/
|
|
||||||
Command( wxT("ShowDeviceTB"), XXO("&Device Toolbar"),
|
|
||||||
FN(OnShowDeviceToolBar), AlwaysEnabledFlag, checkOff ),
|
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
|
||||||
for selecting a time range of audio*/
|
|
||||||
Command( wxT("ShowSelectionTB"), XXO("&Selection Toolbar"),
|
|
||||||
FN(OnShowSelectionToolBar), AlwaysEnabledFlag, checkOff )
|
|
||||||
#ifdef EXPERIMENTAL_TIMER_TOOLBAR
|
|
||||||
,
|
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
|
||||||
for viewing actual time of the cursor*/
|
|
||||||
Command( wxT("ShowTimerToolBarTB"), XXO("&Timer Toolbar"),
|
|
||||||
FN(OnShowTimerToolBar), AlwaysEnabledFlag, checkOff )
|
|
||||||
#endif
|
|
||||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
|
||||||
,
|
|
||||||
Command( wxT("ShowSpectralSelectionTB"),
|
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
|
||||||
for selecting a frequency range of audio*/
|
|
||||||
XXO("Spe&ctral Selection Toolbar"),
|
|
||||||
FN(OnShowSpectralSelectionToolBar), AlwaysEnabledFlag, checkOff )
|
|
||||||
#endif
|
|
||||||
)
|
)
|
||||||
) ) };
|
) ) };
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
AttachedItem sAttachment1{
|
||||||
MenuTable::BaseItemSharedPtr ExtraToolsMenu()
|
Placement{ wxT("View/Other"), { OrderingHint::Begin } },
|
||||||
|
Shared( ToolbarsMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ExtraToolsMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Menu( wxT("Tools"), XO("T&ools"),
|
Menu( wxT("Tools"), XO("T&ools"),
|
||||||
|
@ -365,4 +370,10 @@ MenuTable::BaseItemSharedPtr ExtraToolsMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment2{
|
||||||
|
wxT("Optional/Extra/Part1"),
|
||||||
|
Shared( ExtraToolsMenu() )
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -1278,10 +1278,11 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
#define FN(X) (& TrackActions::Handler :: X)
|
#define FN(X) (& TrackActions::Handler :: X)
|
||||||
|
|
||||||
// Under /MenuBar
|
// Under /MenuBar
|
||||||
MenuTable::BaseItemSharedPtr TracksMenu()
|
namespace {
|
||||||
|
using namespace MenuTable;
|
||||||
|
BaseItemSharedPtr TracksMenu()
|
||||||
{
|
{
|
||||||
// Tracks Menu (formerly Project Menu)
|
// Tracks Menu (formerly Project Menu)
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
|
@ -1437,10 +1438,13 @@ MenuTable::BaseItemSharedPtr TracksMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
AttachedItem sAttachment1{
|
||||||
MenuTable::BaseItemSharedPtr ExtraTrackMenu()
|
wxT(""),
|
||||||
|
Shared( TracksMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ExtraTrackMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Menu( wxT("Track"), XO("&Track"),
|
Menu( wxT("Track"), XO("&Track"),
|
||||||
|
@ -1491,4 +1495,11 @@ MenuTable::BaseItemSharedPtr ExtraTrackMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment2{
|
||||||
|
wxT("Optional/Extra/Part2"),
|
||||||
|
Shared( ExtraTrackMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include "../commands/CommandManager.h"
|
#include "../commands/CommandManager.h"
|
||||||
#include "../toolbars/ControlToolBar.h"
|
#include "../toolbars/ControlToolBar.h"
|
||||||
#include "../toolbars/TranscriptionToolBar.h"
|
#include "../toolbars/TranscriptionToolBar.h"
|
||||||
#include "../tracks/ui/Scrubbing.h"
|
|
||||||
#include "../widgets/AudacityMessageBox.h"
|
#include "../widgets/AudacityMessageBox.h"
|
||||||
#include "../widgets/ErrorDialog.h"
|
#include "../widgets/ErrorDialog.h"
|
||||||
|
|
||||||
|
@ -190,57 +189,6 @@ void DoMoveToLabel(AudacityProject &project, bool next)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DoKeyboardScrub(AudacityProject& project, bool backwards, bool keyUp)
|
|
||||||
{
|
|
||||||
static double initT0 = 0;
|
|
||||||
static double initT1 = 0;
|
|
||||||
|
|
||||||
if (keyUp) {
|
|
||||||
auto &scrubber = Scrubber::Get(project);
|
|
||||||
if (scrubber.IsKeyboardScrubbing() && scrubber.IsBackwards() == backwards) {
|
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
|
||||||
auto time = gAudioIO->GetStreamTime();
|
|
||||||
auto &viewInfo = ViewInfo::Get(project);
|
|
||||||
auto &selection = viewInfo.selectedRegion;
|
|
||||||
|
|
||||||
// If the time selection has not changed during scrubbing
|
|
||||||
// set the cursor position
|
|
||||||
if (selection.t0() == initT0 && selection.t1() == initT1) {
|
|
||||||
double endTime = TrackList::Get(project).GetEndTime();
|
|
||||||
time = std::min(time, endTime);
|
|
||||||
time = std::max(time, 0.0);
|
|
||||||
selection.setTimes(time, time);
|
|
||||||
ProjectHistory::Get(project).ModifyState(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
scrubber.Cancel();
|
|
||||||
ProjectAudioManager::Get(project).Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { // KeyDown
|
|
||||||
auto gAudioIO = AudioIOBase::Get();
|
|
||||||
auto &scrubber = Scrubber::Get(project);
|
|
||||||
if (scrubber.IsKeyboardScrubbing() && scrubber.IsBackwards() != backwards) {
|
|
||||||
// change direction
|
|
||||||
scrubber.SetBackwards(backwards);
|
|
||||||
}
|
|
||||||
else if (!gAudioIO->IsBusy() && !scrubber.HasMark()) {
|
|
||||||
auto &viewInfo = ViewInfo::Get(project);
|
|
||||||
auto &selection = viewInfo.selectedRegion;
|
|
||||||
double endTime = TrackList::Get(project).GetEndTime();
|
|
||||||
double t0 = selection.t0();
|
|
||||||
|
|
||||||
if ((!backwards && t0 >= 0 && t0 < endTime) ||
|
|
||||||
(backwards && t0 > 0 && t0 <= endTime)) {
|
|
||||||
initT0 = t0;
|
|
||||||
initT1 = selection.t1();
|
|
||||||
scrubber.StartKeyboardScrubbing(t0, backwards);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Menu handler functions
|
// Menu handler functions
|
||||||
|
@ -837,32 +785,6 @@ void OnPlayCutPreview(const CommandContext &context)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnKeyboardScrubBackwards(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
auto evt = context.pEvt;
|
|
||||||
if (evt)
|
|
||||||
DoKeyboardScrub(project, true, evt->GetEventType() == wxEVT_KEY_UP);
|
|
||||||
else { // called from menu, so simulate keydown and keyup
|
|
||||||
DoKeyboardScrub(project, true, false);
|
|
||||||
DoKeyboardScrub(project, true, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void OnKeyboardScrubForwards(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
auto evt = context.pEvt;
|
|
||||||
if (evt)
|
|
||||||
DoKeyboardScrub(project, false, evt->GetEventType() == wxEVT_KEY_UP);
|
|
||||||
else { // called from menu, so simulate keydown and keyup
|
|
||||||
DoKeyboardScrub(project, false, false);
|
|
||||||
DoKeyboardScrub(project, false, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void OnPlayAtSpeed(const CommandContext &context)
|
void OnPlayAtSpeed(const CommandContext &context)
|
||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
|
@ -968,12 +890,11 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& TransportActions::Handler :: X)
|
#define FN(X) (& TransportActions::Handler :: X)
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr CursorMenu();
|
|
||||||
|
|
||||||
// Under /MenuBar
|
// Under /MenuBar
|
||||||
MenuTable::BaseItemSharedPtr TransportMenu()
|
namespace {
|
||||||
|
using namespace MenuTable;
|
||||||
|
BaseItemSharedPtr TransportMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static const auto checkOff = Options{}.CheckState( false );
|
static const auto checkOff = Options{}.CheckState( false );
|
||||||
|
@ -1036,12 +957,7 @@ MenuTable::BaseItemSharedPtr TransportMenu()
|
||||||
// PRL: caution, this is a duplicated command name!
|
// PRL: caution, this is a duplicated command name!
|
||||||
Command( wxT("Pause"), XXO("&Pause"), FN(OnPause),
|
Command( wxT("Pause"), XXO("&Pause"), FN(OnPause),
|
||||||
CanStopAudioStreamFlag(), wxT("P") )
|
CanStopAudioStreamFlag(), wxT("P") )
|
||||||
),
|
)
|
||||||
|
|
||||||
// Scrubbing sub-menu
|
|
||||||
Scrubber::Menu(),
|
|
||||||
|
|
||||||
CursorMenu()
|
|
||||||
),
|
),
|
||||||
|
|
||||||
Section( "Other",
|
Section( "Other",
|
||||||
|
@ -1098,10 +1014,13 @@ MenuTable::BaseItemSharedPtr TransportMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
AttachedItem sAttachment1{
|
||||||
MenuTable::BaseItemSharedPtr ExtraTransportMenu()
|
wxT(""),
|
||||||
|
Shared( TransportMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ExtraTransportMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Menu( wxT("Transport"), XO("T&ransport"),
|
Menu( wxT("Transport"), XO("T&ransport"),
|
||||||
|
@ -1139,21 +1058,18 @@ MenuTable::BaseItemSharedPtr ExtraTransportMenu()
|
||||||
wxT("Ctrl+Shift+F7") ),
|
wxT("Ctrl+Shift+F7") ),
|
||||||
Command( wxT("PlayCutPreview"), XXO("Play C&ut Preview"),
|
Command( wxT("PlayCutPreview"), XXO("Play C&ut Preview"),
|
||||||
FN(OnPlayCutPreview),
|
FN(OnPlayCutPreview),
|
||||||
CaptureNotBusyFlag(), wxT("C") ),
|
CaptureNotBusyFlag(), wxT("C") )
|
||||||
Command(wxT("KeyboardScrubBackwards"), XXO("Scrub Bac&kwards"),
|
|
||||||
FN(OnKeyboardScrubBackwards),
|
|
||||||
CaptureNotBusyFlag() | CanStopAudioStreamFlag(), wxT("U\twantKeyup")),
|
|
||||||
Command(wxT("KeyboardScrubForwards"), XXO("Scrub For&wards"),
|
|
||||||
FN(OnKeyboardScrubForwards),
|
|
||||||
CaptureNotBusyFlag() | CanStopAudioStreamFlag(), wxT("I\twantKeyup"))
|
|
||||||
) ) };
|
) ) };
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra
|
AttachedItem sAttachment2{
|
||||||
MenuTable::BaseItemSharedPtr ExtraPlayAtSpeedMenu()
|
wxT("Optional/Extra/Part1"),
|
||||||
|
Shared( ExtraTransportMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ExtraPlayAtSpeedMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Menu( wxT("PlayAtSpeed"), XO("&Play-at-Speed"),
|
Menu( wxT("PlayAtSpeed"), XO("&Play-at-Speed"),
|
||||||
|
@ -1184,4 +1100,11 @@ MenuTable::BaseItemSharedPtr ExtraPlayAtSpeedMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment3{
|
||||||
|
wxT("Optional/Extra/Part1"),
|
||||||
|
Shared( ExtraPlayAtSpeedMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -2,10 +2,7 @@
|
||||||
#include "../Experimental.h"
|
#include "../Experimental.h"
|
||||||
|
|
||||||
#include "../CommonCommandFlags.h"
|
#include "../CommonCommandFlags.h"
|
||||||
#include "../HistoryWindow.h"
|
|
||||||
#include "../LyricsWindow.h"
|
|
||||||
#include "../Menus.h"
|
#include "../Menus.h"
|
||||||
#include "../MixerBoard.h"
|
|
||||||
#include "../Prefs.h"
|
#include "../Prefs.h"
|
||||||
#include "../Project.h"
|
#include "../Project.h"
|
||||||
#include "../ProjectHistory.h"
|
#include "../ProjectHistory.h"
|
||||||
|
@ -31,25 +28,6 @@
|
||||||
// private helper classes and functions
|
// private helper classes and functions
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
AudacityProject::AttachedWindows::RegisteredFactory sMixerBoardKey{
|
|
||||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
|
||||||
return safenew MixerBoardFrame( &parent );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AudacityProject::AttachedWindows::RegisteredFactory sHistoryWindowKey{
|
|
||||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
|
||||||
auto &undoManager = UndoManager::Get( parent );
|
|
||||||
return safenew HistoryDialog( &parent, &undoManager );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AudacityProject::AttachedWindows::RegisteredFactory sLyricsWindowKey{
|
|
||||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
|
||||||
return safenew LyricsWindow( &parent );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
double GetZoomOfSelection( const AudacityProject &project )
|
double GetZoomOfSelection( const AudacityProject &project )
|
||||||
{
|
{
|
||||||
auto &viewInfo = ViewInfo::Get( project );
|
auto &viewInfo = ViewInfo::Get( project );
|
||||||
|
@ -325,34 +303,6 @@ void OnGoSelEnd(const CommandContext &context)
|
||||||
selectedRegion.t1() - ((viewInfo.GetScreenEndTime() - viewInfo.h) / 2));
|
selectedRegion.t1() - ((viewInfo.GetScreenEndTime() - viewInfo.h) / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnHistory(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
|
|
||||||
auto historyWindow = &project.AttachedWindows::Get( sHistoryWindowKey );
|
|
||||||
historyWindow->Show();
|
|
||||||
historyWindow->Raise();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnKaraoke(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
|
|
||||||
auto lyricsWindow = &project.AttachedWindows::Get( sLyricsWindowKey );
|
|
||||||
lyricsWindow->Show();
|
|
||||||
lyricsWindow->Raise();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnMixerBoard(const CommandContext &context)
|
|
||||||
{
|
|
||||||
auto &project = context.project;
|
|
||||||
|
|
||||||
auto mixerBoardFrame = &project.AttachedWindows::Get( sMixerBoardKey );
|
|
||||||
mixerBoardFrame->Show();
|
|
||||||
mixerBoardFrame->Raise();
|
|
||||||
mixerBoardFrame->SetFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnShowExtraMenus(const CommandContext &context)
|
void OnShowExtraMenus(const CommandContext &context)
|
||||||
{
|
{
|
||||||
auto &project = context.project;
|
auto &project = context.project;
|
||||||
|
@ -432,12 +382,11 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &project) {
|
||||||
|
|
||||||
#define FN(X) (& ViewActions::Handler :: X)
|
#define FN(X) (& ViewActions::Handler :: X)
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr ToolbarsMenu();
|
|
||||||
|
|
||||||
// Under /MenuBar
|
// Under /MenuBar
|
||||||
MenuTable::BaseItemSharedPtr ViewMenu()
|
namespace {
|
||||||
|
using namespace MenuTable;
|
||||||
|
BaseItemSharedPtr ViewMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static const auto checkOff = Options{}.CheckState( false );
|
static const auto checkOff = Options{}.CheckState( false );
|
||||||
|
@ -487,59 +436,7 @@ MenuTable::BaseItemSharedPtr ViewMenu()
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
Section( "Windows",
|
Section( "Windows" ),
|
||||||
// History window should be available either for UndoAvailableFlag
|
|
||||||
// or RedoAvailableFlag,
|
|
||||||
// but we can't make the AddItem flags and mask have both,
|
|
||||||
// because they'd both have to be true for the
|
|
||||||
// command to be enabled.
|
|
||||||
// If user has Undone the entire stack, RedoAvailableFlag is on
|
|
||||||
// but UndoAvailableFlag is off.
|
|
||||||
// If user has done things but not Undone anything,
|
|
||||||
// RedoAvailableFlag is off but UndoAvailableFlag is on.
|
|
||||||
// So in either of those cases,
|
|
||||||
// (AudioIONotBusyFlag | UndoAvailableFlag | RedoAvailableFlag) mask
|
|
||||||
// would fail.
|
|
||||||
// The only way to fix this in the current architecture
|
|
||||||
// is to hack in special cases for RedoAvailableFlag
|
|
||||||
// in AudacityProject::UpdateMenus() (ugly)
|
|
||||||
// and CommandManager::HandleCommandEntry() (*really* ugly --
|
|
||||||
// shouldn't know about particular command names and flags).
|
|
||||||
// Here's the hack that would be necessary in
|
|
||||||
// AudacityProject::UpdateMenus(), if somebody decides to do it:
|
|
||||||
// // Because EnableUsingFlags requires all the flag bits match the
|
|
||||||
// // corresponding mask bits,
|
|
||||||
// // "UndoHistory" specifies only
|
|
||||||
// // AudioIONotBusyFlag | UndoAvailableFlag, because that
|
|
||||||
// // covers the majority of cases where it should be enabled.
|
|
||||||
// // If history is not empty but we've Undone the whole stack,
|
|
||||||
// // we also want to enable,
|
|
||||||
// // to show the Redo's on stack.
|
|
||||||
// // "UndoHistory" might already be enabled,
|
|
||||||
// // but add this check for RedoAvailableFlag.
|
|
||||||
// if (flags & RedoAvailableFlag)
|
|
||||||
// GetCommandManager()->Enable(wxT("UndoHistory"), true);
|
|
||||||
// So for now, enable the command regardless of stack.
|
|
||||||
// It will just show empty sometimes.
|
|
||||||
// FOR REDESIGN,
|
|
||||||
// clearly there are some limitations with the flags/mask bitmaps.
|
|
||||||
|
|
||||||
/* i18n-hint: Clicking this menu item shows the various editing steps
|
|
||||||
that have been taken.*/
|
|
||||||
Command( wxT("UndoHistory"), XXO("&History..."), FN(OnHistory),
|
|
||||||
AudioIONotBusyFlag() ),
|
|
||||||
|
|
||||||
Command( wxT("Karaoke"), XXO("&Karaoke..."), FN(OnKaraoke),
|
|
||||||
LabelTracksExistFlag() ),
|
|
||||||
Command( wxT("MixerBoard"), XXO("&Mixer Board..."), FN(OnMixerBoard),
|
|
||||||
PlayableTracksExistFlag() )
|
|
||||||
),
|
|
||||||
|
|
||||||
Section( "",
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
ToolbarsMenu()
|
|
||||||
),
|
|
||||||
|
|
||||||
Section( "Other",
|
Section( "Other",
|
||||||
Command( wxT("ShowExtraMenus"), XXO("&Extra Menus (on/off)"),
|
Command( wxT("ShowExtraMenus"), XXO("&Extra Menus (on/off)"),
|
||||||
|
@ -559,4 +456,10 @@ MenuTable::BaseItemSharedPtr ViewMenu()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment1{
|
||||||
|
wxT(""),
|
||||||
|
Shared( ViewMenu() )
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -118,13 +118,13 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& WindowActions::Handler :: X)
|
#define FN(X) (& WindowActions::Handler :: X)
|
||||||
|
|
||||||
// Under /MenuBar
|
namespace {
|
||||||
MenuTable::BaseItemSharedPtr WindowMenu()
|
using namespace MenuTable;
|
||||||
|
BaseItemSharedPtr WindowMenu()
|
||||||
{
|
{
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// poor imitation of the Mac Windows Menu
|
// poor imitation of the Mac Windows Menu
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
using namespace MenuTable;
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Menu( wxT("Window"), XO("&Window"),
|
Menu( wxT("Window"), XO("&Window"),
|
||||||
|
@ -149,10 +149,13 @@ MenuTable::BaseItemSharedPtr WindowMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra/Misc
|
AttachedItem sAttachment1{
|
||||||
MenuTable::BaseItemSharedPtr ExtraWindowItems()
|
wxT(""),
|
||||||
|
Shared( WindowMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr ExtraWindowItems()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
static BaseItemSharedPtr items{
|
static BaseItemSharedPtr items{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Items( wxT("MacWindows"),
|
Items( wxT("MacWindows"),
|
||||||
|
@ -165,19 +168,17 @@ MenuTable::BaseItemSharedPtr ExtraWindowItems()
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment2{
|
||||||
|
Placement{ wxT("Optional/Extra/Part2/Misc"), OrderingHint::End },
|
||||||
|
Shared( ExtraWindowItems() )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Not WXMAC. Stub functions.
|
// Not WXMAC.
|
||||||
MenuTable::BaseItemSharedPtr WindowMenu()
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr ExtraWindowItems()
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,6 +21,7 @@ Paul Licameli split from TrackPanel.cpp
|
||||||
#include "../../Project.h"
|
#include "../../Project.h"
|
||||||
#include "../../ProjectAudioIO.h"
|
#include "../../ProjectAudioIO.h"
|
||||||
#include "../../ProjectAudioManager.h"
|
#include "../../ProjectAudioManager.h"
|
||||||
|
#include "../../ProjectHistory.h"
|
||||||
#include "../../ProjectSettings.h"
|
#include "../../ProjectSettings.h"
|
||||||
#include "../../ProjectStatus.h"
|
#include "../../ProjectStatus.h"
|
||||||
#include "../../Track.h"
|
#include "../../Track.h"
|
||||||
|
@ -1127,21 +1128,99 @@ bool Scrubber::CanScrub() const
|
||||||
HasWaveDataPred( *mProject );
|
HasWaveDataPred( *mProject );
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuTable::BaseItemSharedPtr Scrubber::Menu()
|
void Scrubber::DoKeyboardScrub(bool backwards, bool keyUp)
|
||||||
|
{
|
||||||
|
auto &project = *mProject;
|
||||||
|
|
||||||
|
static double initT0 = 0;
|
||||||
|
static double initT1 = 0;
|
||||||
|
|
||||||
|
if (keyUp) {
|
||||||
|
auto &scrubber = Scrubber::Get(project);
|
||||||
|
if (scrubber.IsKeyboardScrubbing() && scrubber.IsBackwards() == backwards) {
|
||||||
|
auto gAudioIO = AudioIOBase::Get();
|
||||||
|
auto time = gAudioIO->GetStreamTime();
|
||||||
|
auto &viewInfo = ViewInfo::Get(project);
|
||||||
|
auto &selection = viewInfo.selectedRegion;
|
||||||
|
|
||||||
|
// If the time selection has not changed during scrubbing
|
||||||
|
// set the cursor position
|
||||||
|
if (selection.t0() == initT0 && selection.t1() == initT1) {
|
||||||
|
double endTime = TrackList::Get(project).GetEndTime();
|
||||||
|
time = std::min(time, endTime);
|
||||||
|
time = std::max(time, 0.0);
|
||||||
|
selection.setTimes(time, time);
|
||||||
|
ProjectHistory::Get(project).ModifyState(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
scrubber.Cancel();
|
||||||
|
ProjectAudioManager::Get(project).Stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // KeyDown
|
||||||
|
auto gAudioIO = AudioIOBase::Get();
|
||||||
|
auto &scrubber = Scrubber::Get(project);
|
||||||
|
if (scrubber.IsKeyboardScrubbing() && scrubber.IsBackwards() != backwards) {
|
||||||
|
// change direction
|
||||||
|
scrubber.SetBackwards(backwards);
|
||||||
|
}
|
||||||
|
else if (!gAudioIO->IsBusy() && !scrubber.HasMark()) {
|
||||||
|
auto &viewInfo = ViewInfo::Get(project);
|
||||||
|
auto &selection = viewInfo.selectedRegion;
|
||||||
|
double endTime = TrackList::Get(project).GetEndTime();
|
||||||
|
double t0 = selection.t0();
|
||||||
|
|
||||||
|
if ((!backwards && t0 >= 0 && t0 < endTime) ||
|
||||||
|
(backwards && t0 > 0 && t0 <= endTime)) {
|
||||||
|
initT0 = t0;
|
||||||
|
initT1 = selection.t1();
|
||||||
|
scrubber.StartKeyboardScrubbing(t0, backwards);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scrubber::OnKeyboardScrubBackwards(const CommandContext &context)
|
||||||
|
{
|
||||||
|
auto evt = context.pEvt;
|
||||||
|
if (evt)
|
||||||
|
DoKeyboardScrub(true, evt->GetEventType() == wxEVT_KEY_UP);
|
||||||
|
else { // called from menu, so simulate keydown and keyup
|
||||||
|
DoKeyboardScrub(true, false);
|
||||||
|
DoKeyboardScrub(true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Scrubber::OnKeyboardScrubForwards(const CommandContext &context)
|
||||||
|
{
|
||||||
|
auto evt = context.pEvt;
|
||||||
|
if (evt)
|
||||||
|
DoKeyboardScrub(false, evt->GetEventType() == wxEVT_KEY_UP);
|
||||||
|
else { // called from menu, so simulate keydown and keyup
|
||||||
|
DoKeyboardScrub(false, false);
|
||||||
|
DoKeyboardScrub(false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
static const auto finder =
|
||||||
|
[](AudacityProject &project) -> CommandHandlerObject&
|
||||||
|
{ return Scrubber::Get( project ); };
|
||||||
|
|
||||||
|
using namespace MenuTable;
|
||||||
|
BaseItemSharedPtr ToolbarMenu()
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static BaseItemSharedPtr menu { (
|
static BaseItemSharedPtr menu { (
|
||||||
FinderScope{
|
FinderScope{ finder },
|
||||||
[](AudacityProject &project) -> CommandHandlerObject&
|
Menu( wxT("Scrubbing"),
|
||||||
{ return Scrubber::Get( project ); } },
|
|
||||||
MenuTable::Menu( wxT("Scrubbing"),
|
|
||||||
XO("Scru&bbing"),
|
XO("Scru&bbing"),
|
||||||
[]{
|
[]{
|
||||||
BaseItemPtrs ptrs;
|
BaseItemPtrs ptrs;
|
||||||
for (const auto &item : menuItems()) {
|
for (const auto &item : menuItems()) {
|
||||||
ptrs.push_back( MenuTable::Command( item.name, item.label,
|
ptrs.push_back( Command( item.name, item.label,
|
||||||
item.memFn,
|
item.memFn,
|
||||||
item.flags,
|
item.flags,
|
||||||
item.StatusTest
|
item.StatusTest
|
||||||
|
@ -1160,6 +1239,35 @@ MenuTable::BaseItemSharedPtr Scrubber::Menu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment{
|
||||||
|
wxT("Transport/Basic"),
|
||||||
|
Shared( ToolbarMenu() )
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseItemSharedPtr KeyboardScrubbingItems()
|
||||||
|
{
|
||||||
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
|
static BaseItemSharedPtr items{
|
||||||
|
( FinderScope{ finder },
|
||||||
|
Items( wxT("KeyboardScrubbing"),
|
||||||
|
Command(wxT("KeyboardScrubBackwards"), XXO("Scrub Bac&kwards"),
|
||||||
|
&Scrubber::OnKeyboardScrubBackwards,
|
||||||
|
CaptureNotBusyFlag() | CanStopAudioStreamFlag(), wxT("U\twantKeyup")),
|
||||||
|
Command(wxT("KeyboardScrubForwards"), XXO("Scrub For&wards"),
|
||||||
|
&Scrubber::OnKeyboardScrubForwards,
|
||||||
|
CaptureNotBusyFlag() | CanStopAudioStreamFlag(), wxT("I\twantKeyup"))
|
||||||
|
) ) };
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
AttachedItem sAttachment2{
|
||||||
|
wxT("Optional/Extra/Part1/Transport"),
|
||||||
|
Shared( KeyboardScrubbingItems() )
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Scrubber::PopulatePopupMenu(wxMenu &menu)
|
void Scrubber::PopulatePopupMenu(wxMenu &menu)
|
||||||
{
|
{
|
||||||
int id = CMD_ID;
|
int id = CMD_ID;
|
||||||
|
|
|
@ -117,8 +117,6 @@ public:
|
||||||
// This returns the same as the enabled state of the menu items:
|
// This returns the same as the enabled state of the menu items:
|
||||||
bool CanScrub() const;
|
bool CanScrub() const;
|
||||||
|
|
||||||
// For the toolbar
|
|
||||||
static MenuTable::BaseItemSharedPtr Menu();
|
|
||||||
// For popup
|
// For popup
|
||||||
void PopulatePopupMenu(wxMenu &menu);
|
void PopulatePopupMenu(wxMenu &menu);
|
||||||
|
|
||||||
|
@ -127,6 +125,10 @@ public:
|
||||||
void OnSeek(const CommandContext&);
|
void OnSeek(const CommandContext&);
|
||||||
void OnToggleScrubRuler(const CommandContext&);
|
void OnToggleScrubRuler(const CommandContext&);
|
||||||
|
|
||||||
|
void OnKeyboardScrubBackwards(const CommandContext&);
|
||||||
|
void OnKeyboardScrubForwards(const CommandContext&);
|
||||||
|
void DoKeyboardScrub(bool backwards, bool keyUp);
|
||||||
|
|
||||||
// Convenience wrapper for the above
|
// Convenience wrapper for the above
|
||||||
template<void (Scrubber::*pfn)(const CommandContext&)>
|
template<void (Scrubber::*pfn)(const CommandContext&)>
|
||||||
void Thunk(wxCommandEvent &)
|
void Thunk(wxCommandEvent &)
|
||||||
|
|
Loading…
Reference in New Issue