Revert to a465ce0046
This commit is contained in:
parent
c1d129ec98
commit
2c25a37994
|
@ -67,13 +67,11 @@ 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"
|
||||||
|
@ -1139,55 +1137,3 @@ 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,7 +35,6 @@ 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"
|
||||||
|
@ -317,85 +316,3 @@ 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,7 +12,6 @@
|
||||||
#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"
|
||||||
|
@ -168,46 +167,3 @@ 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,7 +42,6 @@
|
||||||
#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>
|
||||||
|
@ -945,6 +944,29 @@ 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()
|
||||||
{
|
{
|
||||||
|
@ -959,49 +981,26 @@ 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 )
|
||||||
|
@ -1103,9 +1102,6 @@ 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
|
||||||
|
@ -1129,7 +1125,6 @@ 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,7 +33,6 @@
|
||||||
#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"
|
||||||
|
@ -1485,46 +1484,5 @@ 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,12 +12,11 @@
|
||||||
#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 "../ProjectWindow.h"
|
#include "../ProjectWindowBase.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
#include "../FileNames.h"
|
#include "../FileNames.h"
|
||||||
#include "../ViewInfo.h"
|
#include "../ViewInfo.h"
|
||||||
|
@ -649,56 +648,3 @@ 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,13 +823,10 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& ClipActions::Handler :: X)
|
#define FN(X) (& ClipActions::Handler :: X)
|
||||||
|
|
||||||
namespace {
|
// Under /MenuBar/Select
|
||||||
using namespace MenuTable;
|
MenuTable::BaseItemSharedPtr ClipSelectMenu()
|
||||||
|
|
||||||
// Register menu items
|
|
||||||
|
|
||||||
BaseItemSharedPtr ClipSelectMenu()
|
|
||||||
{
|
{
|
||||||
|
using namespace MenuTable;
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static BaseItemSharedPtr menu {
|
static BaseItemSharedPtr menu {
|
||||||
|
@ -853,13 +850,10 @@ BaseItemSharedPtr ClipSelectMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment1{
|
// Under /MenuBar/Transport/Cursor
|
||||||
wxT("Select/Basic"),
|
MenuTable::BaseItemSharedPtr ClipCursorItems()
|
||||||
Shared( ClipSelectMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
BaseItemSharedPtr ClipCursorItems()
|
|
||||||
{
|
{
|
||||||
|
using namespace MenuTable;
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static BaseItemSharedPtr items{
|
static BaseItemSharedPtr items{
|
||||||
|
@ -877,14 +871,11 @@ BaseItemSharedPtr ClipCursorItems()
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment2{
|
// Under /MenuBar/Optional/Extra/Cursor
|
||||||
{ wxT("Transport/Basic/Cursor"),
|
MenuTable::BaseItemSharedPtr ExtraClipCursorItems()
|
||||||
{ OrderingHint::Before, wxT("CursProjectStart") } },
|
|
||||||
Shared( ClipCursorItems() )
|
|
||||||
};
|
|
||||||
|
|
||||||
BaseItemSharedPtr ExtraClipCursorItems()
|
|
||||||
{
|
{
|
||||||
|
using namespace MenuTable;
|
||||||
|
|
||||||
static BaseItemSharedPtr items{
|
static BaseItemSharedPtr items{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Items( wxT("Clip"),
|
Items( wxT("Clip"),
|
||||||
|
@ -896,11 +887,4 @@ BaseItemSharedPtr ExtraClipCursorItems()
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment3{
|
|
||||||
{ wxT("Optional/Extra/Part2/Cursor"), { OrderingHint::End, {} } },
|
|
||||||
Shared( ExtraClipCursorItems() )
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -997,6 +997,8 @@ 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){
|
||||||
|
@ -1022,10 +1024,10 @@ static const ReservedCommandFlag
|
||||||
cutCopyOptions()
|
cutCopyOptions()
|
||||||
}; return flag; }
|
}; return flag; }
|
||||||
|
|
||||||
namespace {
|
// Under /MenuBar
|
||||||
using namespace MenuTable;
|
MenuTable::BaseItemSharedPtr EditMenu()
|
||||||
BaseItemSharedPtr EditMenu()
|
|
||||||
{
|
{
|
||||||
|
using namespace MenuTable;
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static const auto NotBusyTimeAndTracksFlags =
|
static const auto NotBusyTimeAndTracksFlags =
|
||||||
|
@ -1139,6 +1141,8 @@ BaseItemSharedPtr EditMenu()
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
LabelEditMenus(),
|
||||||
|
|
||||||
Command( wxT("EditMetaData"), XXO("&Metadata..."), FN(OnEditMetadata),
|
Command( wxT("EditMetaData"), XXO("&Metadata..."), FN(OnEditMetadata),
|
||||||
AudioIONotBusyFlag() )
|
AudioIONotBusyFlag() )
|
||||||
|
|
||||||
|
@ -1160,13 +1164,10 @@ BaseItemSharedPtr EditMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment1{
|
// Under /MenuBar/Optional/Extra
|
||||||
wxT(""),
|
MenuTable::BaseItemSharedPtr ExtraEditMenu()
|
||||||
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();
|
||||||
|
@ -1221,10 +1222,4 @@ RegisteredMenuItemEnabler selectWaveTracks2{{
|
||||||
selectAll
|
selectAll
|
||||||
}};
|
}};
|
||||||
|
|
||||||
AttachedItem sAttachment2{
|
|
||||||
wxT("Optional/Extra/Part1"),
|
|
||||||
Shared( ExtraEditMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -136,23 +136,55 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& ExtraActions::Handler :: X)
|
#define FN(X) (& ExtraActions::Handler :: X)
|
||||||
|
|
||||||
namespace {
|
// Imported menu item definitions
|
||||||
using namespace MenuTable;
|
|
||||||
|
|
||||||
BaseItemSharedPtr ExtraMixerMenu();
|
MenuTable::BaseItemSharedPtr ExtraEditMenu();
|
||||||
BaseItemSharedPtr ExtraDeviceMenu();
|
MenuTable::BaseItemSharedPtr ExtraSelectionMenu();
|
||||||
|
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 & );
|
||||||
|
|
||||||
BaseItemSharedPtr ExtraMenu()
|
MenuTable::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",
|
||||||
ExtraMixerMenu()
|
ExtraTransportMenu()
|
||||||
|
, 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 =
|
||||||
|
@ -164,14 +196,10 @@ BaseItemSharedPtr ExtraMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment1{
|
// Under /MenuBar/Optional/Extra
|
||||||
wxT(""),
|
MenuTable::BaseItemSharedPtr ExtraMixerMenu()
|
||||||
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"),
|
||||||
|
@ -191,9 +219,10 @@ BaseItemSharedPtr ExtraMixerMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra/Part1
|
// Under /MenuBar/Optional/Extra
|
||||||
BaseItemSharedPtr ExtraDeviceMenu()
|
MenuTable::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"),
|
||||||
|
@ -212,9 +241,10 @@ BaseItemSharedPtr ExtraDeviceMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under /MenuBar/Optional/Extra/Part2
|
// Under /MenuBar/Optional/Extra
|
||||||
BaseItemPtr ExtraMiscItems()
|
MenuTable::BaseItemPtr ExtraMiscItems( AudacityProject &project )
|
||||||
{
|
{
|
||||||
|
using namespace MenuTable;
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
constexpr auto key =
|
constexpr auto key =
|
||||||
|
@ -228,24 +258,15 @@ BaseItemPtr ExtraMiscItems()
|
||||||
// Not a menu.
|
// Not a menu.
|
||||||
return ( FinderScope{ findCommandHandler },
|
return ( FinderScope{ findCommandHandler },
|
||||||
Items( wxT("Misc"),
|
Items( wxT("Misc"),
|
||||||
// Delayed evaluation
|
// Accel key is not bindable.
|
||||||
[]( AudacityProject &project ) {
|
Command( wxT("FullScreenOnOff"), XXO("&Full Screen (on/off)"),
|
||||||
return
|
FN(OnFullScreen),
|
||||||
// Accel key is not bindable.
|
AlwaysEnabledFlag,
|
||||||
Command( wxT("FullScreenOnOff"), XXO("&Full Screen (on/off)"),
|
Options{ key }.CheckState(
|
||||||
FN(OnFullScreen),
|
GetProjectFrame( project ).wxTopLevelWindow::IsFullScreen() ) ),
|
||||||
AlwaysEnabledFlag,
|
|
||||||
Options{ key }.CheckState(
|
ExtraWindowItems()
|
||||||
GetProjectFrame( project ).wxTopLevelWindow::IsFullScreen() ) );
|
|
||||||
}
|
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment2{
|
|
||||||
Placement{ wxT("Optional/Extra/Part2"), { OrderingHint::End } },
|
|
||||||
Shared( ExtraMiscItems() )
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -551,11 +551,10 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& FileActions::Handler :: X)
|
#define FN(X) (& FileActions::Handler :: X)
|
||||||
|
|
||||||
namespace {
|
// under /MenuBar
|
||||||
using namespace MenuTable;
|
MenuTable::BaseItemSharedPtr FileMenu()
|
||||||
|
|
||||||
BaseItemSharedPtr FileMenu()
|
|
||||||
{
|
{
|
||||||
|
using namespace MenuTable;
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
|
@ -706,10 +705,4 @@ 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)
|
||||||
|
|
||||||
namespace {
|
// Under /MenuBar
|
||||||
using namespace MenuTable;
|
MenuTable::BaseItemSharedPtr HelpMenu()
|
||||||
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,11 +602,4 @@ BaseItemSharedPtr HelpMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment1{
|
|
||||||
wxT(""),
|
|
||||||
Shared( HelpMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -585,9 +585,8 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& LabelEditActions::Handler :: X)
|
#define FN(X) (& LabelEditActions::Handler :: X)
|
||||||
|
|
||||||
namespace {
|
// Under /MenuBar/Edit
|
||||||
using namespace MenuTable;
|
MenuTable::BaseItemSharedPtr LabelEditMenus()
|
||||||
BaseItemSharedPtr LabelEditMenus()
|
|
||||||
{
|
{
|
||||||
using namespace MenuTable;
|
using namespace MenuTable;
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
@ -602,7 +601,7 @@ BaseItemSharedPtr LabelEditMenus()
|
||||||
|
|
||||||
static BaseItemSharedPtr menus{
|
static BaseItemSharedPtr menus{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Items( wxT("LabelEditMenus"),
|
Items( wxEmptyString,
|
||||||
|
|
||||||
Menu( wxT("Labels"), XO("&Labels"),
|
Menu( wxT("Labels"), XO("&Labels"),
|
||||||
Section( "",
|
Section( "",
|
||||||
|
@ -688,12 +687,4 @@ 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)
|
||||||
|
|
||||||
namespace {
|
// Under /MenuBar/Optional/Extra
|
||||||
using namespace MenuTable;
|
MenuTable::BaseItemSharedPtr ExtraGlobalCommands()
|
||||||
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,13 +575,10 @@ BaseItemSharedPtr ExtraGlobalCommands()
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment2{
|
// Under /MenuBar/Optional/Extra
|
||||||
wxT("Optional/Extra/Part2"),
|
MenuTable::BaseItemSharedPtr ExtraFocusMenu()
|
||||||
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{
|
||||||
|
@ -613,11 +610,4 @@ BaseItemSharedPtr ExtraFocusMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment3{
|
|
||||||
wxT("Optional/Extra/Part2"),
|
|
||||||
Shared( ExtraFocusMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#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"
|
||||||
|
@ -15,6 +16,7 @@
|
||||||
#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"
|
||||||
|
@ -23,6 +25,26 @@
|
||||||
// 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 );
|
||||||
|
@ -434,6 +456,31 @@ 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;
|
||||||
|
@ -701,10 +748,9 @@ MenuTable::BaseItemPtrs PopulateMacrosMenu( CommandFlag flags )
|
||||||
// Menu definitions
|
// Menu definitions
|
||||||
|
|
||||||
// Under /MenuBar
|
// Under /MenuBar
|
||||||
namespace {
|
MenuTable::BaseItemSharedPtr GenerateMenu()
|
||||||
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! :-(
|
||||||
|
|
||||||
|
@ -738,13 +784,10 @@ static const ReservedCommandFlag
|
||||||
}
|
}
|
||||||
}; return flag; } //lll
|
}; return flag; } //lll
|
||||||
|
|
||||||
AttachedItem sAttachment1{
|
// Under /MenuBar
|
||||||
wxT(""),
|
MenuTable::BaseItemSharedPtr EffectMenu()
|
||||||
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! :-(
|
||||||
|
|
||||||
|
@ -791,13 +834,10 @@ BaseItemSharedPtr EffectMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment2{
|
// Under /MenuBar
|
||||||
wxT(""),
|
MenuTable::BaseItemSharedPtr AnalyzeMenu()
|
||||||
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! :-(
|
||||||
|
|
||||||
|
@ -812,7 +852,11 @@ BaseItemSharedPtr AnalyzeMenu()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Section( "Analyzers",
|
Section( "Analyzers",
|
||||||
Items( "Windows" ),
|
Command( wxT("ContrastAnalyser"), XXO("Contrast..."), FN(OnContrast),
|
||||||
|
AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag(),
|
||||||
|
wxT("Ctrl+Shift+T") ),
|
||||||
|
Command( wxT("PlotSpectrum"), XXO("Plot Spectrum..."), FN(OnPlotSpectrum),
|
||||||
|
AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag() ),
|
||||||
|
|
||||||
// Delayed evaluation:
|
// Delayed evaluation:
|
||||||
[](AudacityProject&)
|
[](AudacityProject&)
|
||||||
|
@ -826,13 +870,10 @@ BaseItemSharedPtr AnalyzeMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment3{
|
// Under /MenuBar
|
||||||
wxT(""),
|
MenuTable::BaseItemSharedPtr ToolsMenu()
|
||||||
Shared( AnalyzeMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
BaseItemSharedPtr ToolsMenu()
|
|
||||||
{
|
{
|
||||||
|
using namespace MenuTable;
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
|
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
|
@ -913,13 +954,11 @@ BaseItemSharedPtr ToolsMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment4{
|
// Under /MenuBar/Optional/Extra
|
||||||
wxT(""),
|
MenuTable::BaseItemSharedPtr ExtraScriptablesIMenu()
|
||||||
Shared( ToolsMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
BaseItemSharedPtr ExtraScriptablesIMenu()
|
|
||||||
{
|
{
|
||||||
|
using namespace MenuTable;
|
||||||
|
|
||||||
// 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 },
|
||||||
|
@ -965,13 +1004,11 @@ BaseItemSharedPtr ExtraScriptablesIMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment5{
|
// Under /MenuBar/Optional/Extra
|
||||||
wxT("Optional/Extra/Part2"),
|
MenuTable::BaseItemSharedPtr ExtraScriptablesIIMenu()
|
||||||
Shared( ExtraScriptablesIMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
BaseItemSharedPtr ExtraScriptablesIIMenu()
|
|
||||||
{
|
{
|
||||||
|
using namespace MenuTable;
|
||||||
|
|
||||||
// Less useful to VI users.
|
// Less useful to VI users.
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
|
@ -1009,11 +1046,4 @@ BaseItemSharedPtr ExtraScriptablesIIMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment6{
|
|
||||||
wxT("Optional/Extra/Part2"),
|
|
||||||
Shared( ExtraScriptablesIIMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -1028,10 +1028,12 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &project) {
|
||||||
|
|
||||||
#define FN(X) (& SelectActions::Handler :: X)
|
#define FN(X) (& SelectActions::Handler :: X)
|
||||||
|
|
||||||
namespace {
|
MenuTable::BaseItemSharedPtr ClipSelectMenu();
|
||||||
using namespace MenuTable;
|
|
||||||
BaseItemSharedPtr SelectMenu()
|
// Under /MenuBar
|
||||||
|
MenuTable::BaseItemSharedPtr SelectMenu()
|
||||||
{
|
{
|
||||||
|
using namespace MenuTable;
|
||||||
using Options = CommandManager::Options;
|
using Options = CommandManager::Options;
|
||||||
static BaseItemSharedPtr menu{
|
static BaseItemSharedPtr menu{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
|
@ -1110,8 +1112,14 @@ 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( "",
|
||||||
|
@ -1136,13 +1144,10 @@ BaseItemSharedPtr SelectMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment1{
|
// Under /MenuBar/Optional/Extra
|
||||||
wxT(""),
|
MenuTable::BaseItemSharedPtr ExtraSelectionMenu()
|
||||||
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"),
|
||||||
|
@ -1182,15 +1187,12 @@ BaseItemSharedPtr ExtraSelectionMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment2{
|
MenuTable::BaseItemSharedPtr ClipCursorItems();
|
||||||
wxT("Optional/Extra/Part1"),
|
|
||||||
Shared( ExtraSelectionMenu() )
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
// Under /MenuBar/Transport
|
||||||
BaseItemSharedPtr CursorMenu()
|
MenuTable::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();
|
||||||
|
|
||||||
|
@ -1220,6 +1222,8 @@ 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,
|
||||||
|
@ -1231,13 +1235,13 @@ BaseItemSharedPtr CursorMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment0{
|
MenuTable::BaseItemSharedPtr ExtraClipCursorItems();
|
||||||
wxT("Transport/Basic"),
|
|
||||||
Shared( CursorMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
BaseItemSharedPtr ExtraCursorMenu()
|
// Under /MenuBar/Optional/Extra
|
||||||
|
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"),
|
||||||
|
@ -1258,18 +1262,17 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment4{
|
// Under /MenuBar/Optional/Extra
|
||||||
wxT("Optional/Extra/Part2"),
|
MenuTable::BaseItemSharedPtr ExtraSeekMenu()
|
||||||
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"),
|
||||||
|
@ -1286,11 +1289,4 @@ BaseItemSharedPtr ExtraSeekMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment5{
|
|
||||||
wxT("Optional/Extra/Part1"),
|
|
||||||
Shared( ExtraSeekMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -253,100 +253,95 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& ToolbarActions::Handler :: X)
|
#define FN(X) (& ToolbarActions::Handler :: X)
|
||||||
|
|
||||||
namespace{
|
// Under /MenuBar/View
|
||||||
using namespace MenuTable;
|
MenuTable::BaseItemSharedPtr ToolbarsMenu()
|
||||||
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 },
|
||||||
Section( wxT("Toolbars"),
|
Menu( wxT("Toolbars"), XO("&Toolbars"),
|
||||||
Menu( wxT("Toolbars"), XO("&Toolbars"),
|
Section( "Reset",
|
||||||
Section( "Reset",
|
/* i18n-hint: (verb)*/
|
||||||
/* i18n-hint: (verb)*/
|
Command( wxT("ResetToolbars"), XXO("Reset Toolb&ars"),
|
||||||
Command( wxT("ResetToolbars"), XXO("Reset Toolb&ars"),
|
FN(OnResetToolBars), AlwaysEnabledFlag )
|
||||||
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
|
|
||||||
for viewing actual time of the cursor*/
|
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||||
Command( wxT("ShowTimerToolBarTB"), XXO("&Timer Toolbar"),
|
with the mixer*/
|
||||||
FN(OnShowTimerToolBar), AlwaysEnabledFlag, checkOff )
|
Command( wxT("ShowMixerTB"), XXO("Mi&xer Toolbar"),
|
||||||
#endif
|
FN(OnShowMixerToolBar), AlwaysEnabledFlag, checkOff ),
|
||||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
/* i18n-hint: Clicking this menu item shows the toolbar for editing*/
|
||||||
,
|
Command( wxT("ShowEditTB"), XXO("&Edit Toolbar"),
|
||||||
Command( wxT("ShowSpectralSelectionTB"),
|
FN(OnShowEditToolBar), AlwaysEnabledFlag, checkOff ),
|
||||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||||
for selecting a frequency range of audio*/
|
for transcription (currently just vary play speed)*/
|
||||||
XXO("Spe&ctral Selection Toolbar"),
|
Command( wxT("ShowTranscriptionTB"), XXO("Pla&y-at-Speed Toolbar"),
|
||||||
FN(OnShowSpectralSelectionToolBar), AlwaysEnabledFlag, checkOff )
|
FN(OnShowTranscriptionToolBar), AlwaysEnabledFlag, checkOff ),
|
||||||
#endif
|
/* 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
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment1{
|
// Under /MenuBar/Optional/Extra
|
||||||
Placement{ wxT("View/Other"), { OrderingHint::Begin } },
|
MenuTable::BaseItemSharedPtr ExtraToolsMenu()
|
||||||
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"),
|
||||||
|
@ -370,10 +365,4 @@ BaseItemSharedPtr ExtraToolsMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment2{
|
|
||||||
wxT("Optional/Extra/Part1"),
|
|
||||||
Shared( ExtraToolsMenu() )
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -1278,11 +1278,10 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
#define FN(X) (& TrackActions::Handler :: X)
|
#define FN(X) (& TrackActions::Handler :: X)
|
||||||
|
|
||||||
// Under /MenuBar
|
// Under /MenuBar
|
||||||
namespace {
|
MenuTable::BaseItemSharedPtr TracksMenu()
|
||||||
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{
|
||||||
|
@ -1438,13 +1437,10 @@ BaseItemSharedPtr TracksMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment1{
|
// Under /MenuBar/Optional/Extra
|
||||||
wxT(""),
|
MenuTable::BaseItemSharedPtr ExtraTrackMenu()
|
||||||
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"),
|
||||||
|
@ -1495,11 +1491,4 @@ BaseItemSharedPtr ExtraTrackMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment2{
|
|
||||||
wxT("Optional/Extra/Part2"),
|
|
||||||
Shared( ExtraTrackMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#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"
|
||||||
|
|
||||||
|
@ -189,6 +190,57 @@ 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
|
||||||
|
@ -785,6 +837,32 @@ 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;
|
||||||
|
@ -890,11 +968,12 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||||
|
|
||||||
#define FN(X) (& TransportActions::Handler :: X)
|
#define FN(X) (& TransportActions::Handler :: X)
|
||||||
|
|
||||||
|
MenuTable::BaseItemSharedPtr CursorMenu();
|
||||||
|
|
||||||
// Under /MenuBar
|
// Under /MenuBar
|
||||||
namespace {
|
MenuTable::BaseItemSharedPtr TransportMenu()
|
||||||
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 );
|
||||||
|
@ -957,7 +1036,12 @@ 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",
|
||||||
|
@ -1014,13 +1098,10 @@ BaseItemSharedPtr TransportMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment1{
|
// Under /MenuBar/Optional/Extra
|
||||||
wxT(""),
|
MenuTable::BaseItemSharedPtr ExtraTransportMenu()
|
||||||
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"),
|
||||||
|
@ -1058,18 +1139,21 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment2{
|
// Under /MenuBar/Optional/Extra
|
||||||
wxT("Optional/Extra/Part1"),
|
MenuTable::BaseItemSharedPtr ExtraPlayAtSpeedMenu()
|
||||||
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"),
|
||||||
|
@ -1100,11 +1184,4 @@ BaseItemSharedPtr ExtraPlayAtSpeedMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment3{
|
|
||||||
wxT("Optional/Extra/Part1"),
|
|
||||||
Shared( ExtraPlayAtSpeedMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef FN
|
#undef FN
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
#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"
|
||||||
|
@ -28,6 +31,25 @@
|
||||||
// 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 );
|
||||||
|
@ -303,6 +325,34 @@ 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;
|
||||||
|
@ -382,11 +432,12 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &project) {
|
||||||
|
|
||||||
#define FN(X) (& ViewActions::Handler :: X)
|
#define FN(X) (& ViewActions::Handler :: X)
|
||||||
|
|
||||||
|
MenuTable::BaseItemSharedPtr ToolbarsMenu();
|
||||||
|
|
||||||
// Under /MenuBar
|
// Under /MenuBar
|
||||||
namespace {
|
MenuTable::BaseItemSharedPtr ViewMenu()
|
||||||
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 );
|
||||||
|
@ -436,7 +487,59 @@ 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)"),
|
||||||
|
@ -456,10 +559,4 @@ 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)
|
||||||
|
|
||||||
namespace {
|
// Under /MenuBar
|
||||||
using namespace MenuTable;
|
MenuTable::BaseItemSharedPtr WindowMenu()
|
||||||
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,13 +149,10 @@ BaseItemSharedPtr WindowMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedItem sAttachment1{
|
// Under /MenuBar/Optional/Extra/Misc
|
||||||
wxT(""),
|
MenuTable::BaseItemSharedPtr ExtraWindowItems()
|
||||||
Shared( WindowMenu() )
|
|
||||||
};
|
|
||||||
|
|
||||||
BaseItemSharedPtr ExtraWindowItems()
|
|
||||||
{
|
{
|
||||||
|
using namespace MenuTable;
|
||||||
static BaseItemSharedPtr items{
|
static BaseItemSharedPtr items{
|
||||||
( FinderScope{ findCommandHandler },
|
( FinderScope{ findCommandHandler },
|
||||||
Items( wxT("MacWindows"),
|
Items( wxT("MacWindows"),
|
||||||
|
@ -168,17 +165,19 @@ 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.
|
// Not WXMAC. Stub functions.
|
||||||
|
MenuTable::BaseItemSharedPtr WindowMenu()
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuTable::BaseItemSharedPtr ExtraWindowItems()
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,7 +21,6 @@ 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"
|
||||||
|
@ -1128,99 +1127,21 @@ bool Scrubber::CanScrub() const
|
||||||
HasWaveDataPred( *mProject );
|
HasWaveDataPred( *mProject );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scrubber::DoKeyboardScrub(bool backwards, bool keyUp)
|
MenuTable::BaseItemSharedPtr Scrubber::Menu()
|
||||||
{
|
|
||||||
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{ finder },
|
FinderScope{
|
||||||
Menu( wxT("Scrubbing"),
|
[](AudacityProject &project) -> CommandHandlerObject&
|
||||||
|
{ 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( Command( item.name, item.label,
|
ptrs.push_back( MenuTable::Command( item.name, item.label,
|
||||||
item.memFn,
|
item.memFn,
|
||||||
item.flags,
|
item.flags,
|
||||||
item.StatusTest
|
item.StatusTest
|
||||||
|
@ -1239,35 +1160,6 @@ BaseItemSharedPtr ToolbarMenu()
|
||||||
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,6 +117,8 @@ 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);
|
||||||
|
|
||||||
|
@ -125,10 +127,6 @@ 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