Restore commit c1d129ec98
This commit is contained in:
parent
229e2673c7
commit
4d43967add
|
@ -67,11 +67,13 @@ the mouse around.
|
|||
|
||||
#include "ShuttleGui.h"
|
||||
#include "AColor.h"
|
||||
#include "CommonCommandFlags.h"
|
||||
#include "FFT.h"
|
||||
#include "PitchName.h"
|
||||
#include "prefs/GUISettings.h"
|
||||
#include "Prefs.h"
|
||||
#include "Project.h"
|
||||
#include "ProjectWindow.h"
|
||||
#include "WaveClip.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "AllThemeResources.h"
|
||||
|
@ -1137,3 +1139,55 @@ void FreqPlot::OnMouseEvent(wxMouseEvent & 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 "Clipboard.h"
|
||||
#include "CommonCommandFlags.h"
|
||||
#include "../images/Arrow.xpm"
|
||||
#include "../images/Empty9x16.xpm"
|
||||
#include "UndoManager.h"
|
||||
|
@ -316,3 +317,85 @@ void HistoryDialog::OnSize(wxSizeEvent & WXUNUSED(event))
|
|||
if (mList->GetItemCount() > 0)
|
||||
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 "Lyrics.h"
|
||||
#include "AudioIOBase.h"
|
||||
#include "CommonCommandFlags.h"
|
||||
#include "Prefs.h" // for RTL_WORKAROUND
|
||||
#include "Project.h"
|
||||
#include "ProjectAudioIO.h"
|
||||
|
@ -167,3 +168,46 @@ void LyricsWindow::OnTimer(wxCommandEvent &event)
|
|||
// Let other listeners get the notification
|
||||
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/ErrorDialog.h"
|
||||
|
||||
#include <mutex>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <wx/menu.h>
|
||||
|
@ -943,29 +944,6 @@ void Visit( Visitor &visitor, BaseItem *pTopItem, GroupItem *pRegistry )
|
|||
/// changes in configured preferences - for example changes in key-bindings
|
||||
/// 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 {
|
||||
static Registry::GroupItem &sRegistry()
|
||||
{
|
||||
|
@ -980,26 +958,49 @@ MenuTable::AttachedItem::AttachedItem(
|
|||
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 {
|
||||
|
||||
// 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;
|
||||
|
||||
struct MenuItemVisitor : MenuVisitor
|
||||
{
|
||||
MenuItemVisitor( AudacityProject &proj, CommandManager &man )
|
||||
|
@ -1101,6 +1102,9 @@ struct MenuItemVisitor : MenuVisitor
|
|||
|
||||
void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
|
||||
{
|
||||
static std::once_flag flag;
|
||||
std::call_once( flag, InitializeMenuOrdering );
|
||||
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
// The list of defaults to exclude depends on
|
||||
|
@ -1124,6 +1128,7 @@ void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
|
|||
|
||||
void MenuManager::Visit( MenuVisitor &visitor )
|
||||
{
|
||||
static const auto menuTree = MenuTable::Items( MenuPathStart );
|
||||
Registry::Visit( visitor, menuTree.get(), &sRegistry() );
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "NoteTrack.h"
|
||||
#endif
|
||||
|
||||
#include "CommonCommandFlags.h"
|
||||
#include "KeyboardCapture.h"
|
||||
#include "Prefs.h" // for RTL_WORKAROUND
|
||||
#include "Project.h"
|
||||
|
@ -1484,5 +1485,46 @@ void MixerBoardFrame::Recreate( AudacityProject *pProject )
|
|||
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 "Contrast.h"
|
||||
|
||||
#include "../CommonCommandFlags.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../Project.h"
|
||||
#include "../ProjectSettings.h"
|
||||
#include "../ProjectWindowBase.h"
|
||||
#include "../ProjectWindow.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../FileNames.h"
|
||||
#include "../ViewInfo.h"
|
||||
|
@ -648,3 +649,56 @@ void ContrastDialog::OnReset(wxCommandEvent & /*event*/)
|
|||
mPassFailText->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)
|
||||
|
||||
// Under /MenuBar/Select
|
||||
MenuTable::BaseItemSharedPtr ClipSelectMenu()
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
|
||||
// Register menu items
|
||||
|
||||
BaseItemSharedPtr ClipSelectMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr menu {
|
||||
|
@ -850,10 +853,13 @@ MenuTable::BaseItemSharedPtr ClipSelectMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Transport/Cursor
|
||||
MenuTable::BaseItemSharedPtr ClipCursorItems()
|
||||
AttachedItem sAttachment1{
|
||||
wxT("Select/Basic"),
|
||||
Shared( ClipSelectMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ClipCursorItems()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr items{
|
||||
|
@ -871,11 +877,14 @@ MenuTable::BaseItemSharedPtr ClipCursorItems()
|
|||
return items;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra/Cursor
|
||||
MenuTable::BaseItemSharedPtr ExtraClipCursorItems()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
AttachedItem sAttachment2{
|
||||
{ wxT("Transport/Basic/Cursor"),
|
||||
{ OrderingHint::Before, wxT("CursProjectStart") } },
|
||||
Shared( ClipCursorItems() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ExtraClipCursorItems()
|
||||
{
|
||||
static BaseItemSharedPtr items{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Items( wxT("Clip"),
|
||||
|
@ -887,4 +896,11 @@ MenuTable::BaseItemSharedPtr ExtraClipCursorItems()
|
|||
return items;
|
||||
}
|
||||
|
||||
AttachedItem sAttachment3{
|
||||
{ wxT("Optional/Extra/Part2/Cursor"), { OrderingHint::End, {} } },
|
||||
Shared( ExtraClipCursorItems() )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
|
|
@ -997,8 +997,6 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
|||
|
||||
#define FN(X) (& EditActions::Handler :: X)
|
||||
|
||||
MenuTable::BaseItemSharedPtr LabelEditMenus();
|
||||
|
||||
static const ReservedCommandFlag
|
||||
&CutCopyAvailableFlag() { static ReservedCommandFlag flag{
|
||||
[](const AudacityProject &project){
|
||||
|
@ -1024,10 +1022,10 @@ static const ReservedCommandFlag
|
|||
cutCopyOptions()
|
||||
}; return flag; }
|
||||
|
||||
// Under /MenuBar
|
||||
MenuTable::BaseItemSharedPtr EditMenu()
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
BaseItemSharedPtr EditMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static const auto NotBusyTimeAndTracksFlags =
|
||||
|
@ -1141,8 +1139,6 @@ MenuTable::BaseItemSharedPtr EditMenu()
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LabelEditMenus(),
|
||||
|
||||
Command( wxT("EditMetaData"), XXO("&Metadata..."), FN(OnEditMetadata),
|
||||
AudioIONotBusyFlag() )
|
||||
|
||||
|
@ -1164,10 +1160,13 @@ MenuTable::BaseItemSharedPtr EditMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraEditMenu()
|
||||
AttachedItem sAttachment1{
|
||||
wxT(""),
|
||||
Shared( EditMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ExtraEditMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
static const auto flags =
|
||||
AudioIONotBusyFlag() | TracksSelectedFlag() | TimeSelectedFlag();
|
||||
|
@ -1222,4 +1221,10 @@ RegisteredMenuItemEnabler selectWaveTracks2{{
|
|||
selectAll
|
||||
}};
|
||||
|
||||
AttachedItem sAttachment2{
|
||||
wxT("Optional/Extra/Part1"),
|
||||
Shared( ExtraEditMenu() )
|
||||
};
|
||||
|
||||
}
|
||||
#undef FN
|
||||
|
|
|
@ -136,55 +136,23 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
|||
|
||||
#define FN(X) (& ExtraActions::Handler :: X)
|
||||
|
||||
// Imported menu item definitions
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
|
||||
MenuTable::BaseItemSharedPtr ExtraEditMenu();
|
||||
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 ExtraMixerMenu();
|
||||
BaseItemSharedPtr ExtraDeviceMenu();
|
||||
|
||||
MenuTable::BaseItemSharedPtr ExtraMenu()
|
||||
BaseItemSharedPtr ExtraMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
|
||||
// Table of menu factories.
|
||||
// TODO: devise a registration system instead.
|
||||
static BaseItemSharedPtr extraItems{ Items( wxEmptyString,
|
||||
Section( "Part1",
|
||||
ExtraTransportMenu()
|
||||
, ExtraToolsMenu()
|
||||
, ExtraMixerMenu()
|
||||
, ExtraEditMenu()
|
||||
, ExtraPlayAtSpeedMenu()
|
||||
, ExtraSeekMenu()
|
||||
ExtraMixerMenu()
|
||||
, ExtraDeviceMenu()
|
||||
, ExtraSelectionMenu()
|
||||
),
|
||||
|
||||
Section( "Part2",
|
||||
ExtraGlobalCommands()
|
||||
, ExtraFocusMenu()
|
||||
, ExtraCursorMenu()
|
||||
, ExtraTrackMenu()
|
||||
, ExtraScriptablesIMenu()
|
||||
, ExtraScriptablesIIMenu()
|
||||
|
||||
// Delayed evaluation:
|
||||
, ExtraMiscItems
|
||||
)
|
||||
Section( "Part2" )
|
||||
) };
|
||||
|
||||
static const auto pred =
|
||||
|
@ -196,10 +164,14 @@ MenuTable::BaseItemSharedPtr ExtraMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraMixerMenu()
|
||||
AttachedItem sAttachment1{
|
||||
wxT(""),
|
||||
Shared( ExtraMenu() )
|
||||
};
|
||||
|
||||
// Under /MenuBar/Optional/Extra/Part1
|
||||
BaseItemSharedPtr ExtraMixerMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Mixer"), XO("Mi&xer"),
|
||||
|
@ -219,10 +191,9 @@ MenuTable::BaseItemSharedPtr ExtraMixerMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraDeviceMenu()
|
||||
// Under /MenuBar/Optional/Extra/Part1
|
||||
BaseItemSharedPtr ExtraDeviceMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Device"), XO("De&vice"),
|
||||
|
@ -241,10 +212,9 @@ MenuTable::BaseItemSharedPtr ExtraDeviceMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemPtr ExtraMiscItems( AudacityProject &project )
|
||||
// Under /MenuBar/Optional/Extra/Part2
|
||||
BaseItemPtr ExtraMiscItems()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
constexpr auto key =
|
||||
|
@ -258,15 +228,24 @@ MenuTable::BaseItemPtr ExtraMiscItems( AudacityProject &project )
|
|||
// Not a menu.
|
||||
return ( FinderScope{ findCommandHandler },
|
||||
Items( wxT("Misc"),
|
||||
// Accel key is not bindable.
|
||||
Command( wxT("FullScreenOnOff"), XXO("&Full Screen (on/off)"),
|
||||
FN(OnFullScreen),
|
||||
AlwaysEnabledFlag,
|
||||
Options{ key }.CheckState(
|
||||
GetProjectFrame( project ).wxTopLevelWindow::IsFullScreen() ) ),
|
||||
|
||||
ExtraWindowItems()
|
||||
// Delayed evaluation
|
||||
[]( AudacityProject &project ) {
|
||||
return
|
||||
// Accel key is not bindable.
|
||||
Command( wxT("FullScreenOnOff"), XXO("&Full Screen (on/off)"),
|
||||
FN(OnFullScreen),
|
||||
AlwaysEnabledFlag,
|
||||
Options{ key }.CheckState(
|
||||
GetProjectFrame( project ).wxTopLevelWindow::IsFullScreen() ) );
|
||||
}
|
||||
) );
|
||||
}
|
||||
|
||||
AttachedItem sAttachment2{
|
||||
Placement{ wxT("Optional/Extra/Part2"), { OrderingHint::End } },
|
||||
Shared( ExtraMiscItems() )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
|
|
@ -551,10 +551,11 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
|||
|
||||
#define FN(X) (& FileActions::Handler :: X)
|
||||
|
||||
// under /MenuBar
|
||||
MenuTable::BaseItemSharedPtr FileMenu()
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
|
||||
BaseItemSharedPtr FileMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
|
@ -705,4 +706,10 @@ MenuTable::BaseItemSharedPtr FileMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
AttachedItem sAttachment1{
|
||||
wxT(""),
|
||||
Shared( FileMenu() )
|
||||
};
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
|
|
@ -523,10 +523,10 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
|||
|
||||
#define FN(X) (& HelpActions::Handler :: X)
|
||||
|
||||
// Under /MenuBar
|
||||
MenuTable::BaseItemSharedPtr HelpMenu()
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
BaseItemSharedPtr HelpMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Help"), XO("&Help"),
|
||||
|
@ -602,4 +602,11 @@ MenuTable::BaseItemSharedPtr HelpMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
AttachedItem sAttachment1{
|
||||
wxT(""),
|
||||
Shared( HelpMenu() )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
|
|
@ -585,8 +585,9 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
|||
|
||||
#define FN(X) (& LabelEditActions::Handler :: X)
|
||||
|
||||
// Under /MenuBar/Edit
|
||||
MenuTable::BaseItemSharedPtr LabelEditMenus()
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
BaseItemSharedPtr LabelEditMenus()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
@ -601,7 +602,7 @@ MenuTable::BaseItemSharedPtr LabelEditMenus()
|
|||
|
||||
static BaseItemSharedPtr menus{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Items( wxEmptyString,
|
||||
Items( wxT("LabelEditMenus"),
|
||||
|
||||
Menu( wxT("Labels"), XO("&Labels"),
|
||||
Section( "",
|
||||
|
@ -687,4 +688,12 @@ MenuTable::BaseItemSharedPtr LabelEditMenus()
|
|||
return menus;
|
||||
}
|
||||
|
||||
AttachedItem sAttachment1{
|
||||
{ wxT("Edit/Other"),
|
||||
{ OrderingHint::Before, wxT("EditMetaData") } },
|
||||
Shared( LabelEditMenus() )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
|
|
@ -555,11 +555,11 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &project) {
|
|||
|
||||
#define FN(X) (& NavigationActions::Handler :: X)
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraGlobalCommands()
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
BaseItemSharedPtr ExtraGlobalCommands()
|
||||
{
|
||||
// Ceci n'est pas un menu
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr items{
|
||||
|
@ -575,10 +575,13 @@ MenuTable::BaseItemSharedPtr ExtraGlobalCommands()
|
|||
return items;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraFocusMenu()
|
||||
AttachedItem sAttachment2{
|
||||
wxT("Optional/Extra/Part2"),
|
||||
Shared( ExtraGlobalCommands() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ExtraFocusMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static const auto FocusedTracksFlags = TracksExistFlag() | TrackPanelHasFocus();
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
|
@ -610,4 +613,11 @@ MenuTable::BaseItemSharedPtr ExtraFocusMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
AttachedItem sAttachment3{
|
||||
wxT("Optional/Extra/Part2"),
|
||||
Shared( ExtraFocusMenu() )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "../BatchProcessDialog.h"
|
||||
#include "../Benchmark.h"
|
||||
#include "../CommonCommandFlags.h"
|
||||
#include "../FreqWindow.h"
|
||||
#include "../Menus.h"
|
||||
#include "../PluginManager.h"
|
||||
#include "../Prefs.h"
|
||||
|
@ -16,7 +15,6 @@
|
|||
#include "../commands/CommandContext.h"
|
||||
#include "../commands/CommandManager.h"
|
||||
#include "../commands/ScreenshotCommand.h"
|
||||
#include "../effects/Contrast.h"
|
||||
#include "../effects/EffectManager.h"
|
||||
#include "../effects/EffectUI.h"
|
||||
#include "../effects/RealtimeEffectManager.h"
|
||||
|
@ -25,26 +23,6 @@
|
|||
// private helper classes and functions
|
||||
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 &parent ) -> wxWeakRef< wxWindow > {
|
||||
auto &window = ProjectWindow::Get( parent );
|
||||
|
@ -456,31 +434,6 @@ void OnManageAnalyzers(const CommandContext &context)
|
|||
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 )
|
||||
{
|
||||
auto &project = context.project;
|
||||
|
@ -748,9 +701,10 @@ MenuTable::BaseItemPtrs PopulateMacrosMenu( CommandFlag flags )
|
|||
// Menu definitions
|
||||
|
||||
// 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
|
||||
// the plugin manager...sorry! :-(
|
||||
|
||||
|
@ -784,10 +738,13 @@ static const ReservedCommandFlag
|
|||
}
|
||||
}; return flag; } //lll
|
||||
|
||||
// Under /MenuBar
|
||||
MenuTable::BaseItemSharedPtr EffectMenu()
|
||||
AttachedItem sAttachment1{
|
||||
wxT(""),
|
||||
Shared( GenerateMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr EffectMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
// All of this is a bit hacky until we can get more things connected into
|
||||
// the plugin manager...sorry! :-(
|
||||
|
||||
|
@ -834,10 +791,13 @@ MenuTable::BaseItemSharedPtr EffectMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar
|
||||
MenuTable::BaseItemSharedPtr AnalyzeMenu()
|
||||
AttachedItem sAttachment2{
|
||||
wxT(""),
|
||||
Shared( EffectMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr AnalyzeMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
// All of this is a bit hacky until we can get more things connected into
|
||||
// the plugin manager...sorry! :-(
|
||||
|
||||
|
@ -852,11 +812,7 @@ MenuTable::BaseItemSharedPtr AnalyzeMenu()
|
|||
#endif
|
||||
|
||||
Section( "Analyzers",
|
||||
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() ),
|
||||
Items( "Windows" ),
|
||||
|
||||
// Delayed evaluation:
|
||||
[](AudacityProject&)
|
||||
|
@ -870,10 +826,13 @@ MenuTable::BaseItemSharedPtr AnalyzeMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar
|
||||
MenuTable::BaseItemSharedPtr ToolsMenu()
|
||||
AttachedItem sAttachment3{
|
||||
wxT(""),
|
||||
Shared( AnalyzeMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ToolsMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
|
@ -954,11 +913,13 @@ MenuTable::BaseItemSharedPtr ToolsMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraScriptablesIMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
AttachedItem sAttachment4{
|
||||
wxT(""),
|
||||
Shared( ToolsMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ExtraScriptablesIMenu()
|
||||
{
|
||||
// These are the more useful to VI user Scriptables.
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
|
@ -1004,11 +965,13 @@ MenuTable::BaseItemSharedPtr ExtraScriptablesIMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraScriptablesIIMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
AttachedItem sAttachment5{
|
||||
wxT("Optional/Extra/Part2"),
|
||||
Shared( ExtraScriptablesIMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ExtraScriptablesIIMenu()
|
||||
{
|
||||
// Less useful to VI users.
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
|
@ -1046,4 +1009,11 @@ MenuTable::BaseItemSharedPtr ExtraScriptablesIIMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
AttachedItem sAttachment6{
|
||||
wxT("Optional/Extra/Part2"),
|
||||
Shared( ExtraScriptablesIIMenu() )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
|
|
@ -1028,12 +1028,10 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &project) {
|
|||
|
||||
#define FN(X) (& SelectActions::Handler :: X)
|
||||
|
||||
MenuTable::BaseItemSharedPtr ClipSelectMenu();
|
||||
|
||||
// Under /MenuBar
|
||||
MenuTable::BaseItemSharedPtr SelectMenu()
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
BaseItemSharedPtr SelectMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
|
@ -1112,14 +1110,8 @@ MenuTable::BaseItemSharedPtr SelectMenu()
|
|||
Command( wxT("NextLowerPeakFrequency"),
|
||||
XXO("Next &Lower Peak Frequency"), FN(OnNextLowerPeakFrequency),
|
||||
TracksExistFlag() )
|
||||
),
|
||||
)
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ClipSelectMenu()
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
),
|
||||
|
||||
Section( "",
|
||||
|
@ -1144,10 +1136,13 @@ MenuTable::BaseItemSharedPtr SelectMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraSelectionMenu()
|
||||
AttachedItem sAttachment1{
|
||||
wxT(""),
|
||||
Shared( SelectMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ExtraSelectionMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Select"), XO("&Selection"),
|
||||
|
@ -1187,12 +1182,15 @@ MenuTable::BaseItemSharedPtr ExtraSelectionMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
MenuTable::BaseItemSharedPtr ClipCursorItems();
|
||||
AttachedItem sAttachment2{
|
||||
wxT("Optional/Extra/Part1"),
|
||||
Shared( ExtraSelectionMenu() )
|
||||
};
|
||||
}
|
||||
|
||||
// Under /MenuBar/Transport
|
||||
MenuTable::BaseItemSharedPtr CursorMenu()
|
||||
namespace {
|
||||
BaseItemSharedPtr CursorMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
static const auto CanStopFlags = AudioIONotBusyFlag() | CanStopAudioStreamFlag();
|
||||
|
||||
|
@ -1222,8 +1220,6 @@ MenuTable::BaseItemSharedPtr CursorMenu()
|
|||
TracksSelectedFlag(),
|
||||
Options{ wxT("K"), XO("Cursor to Track End") } ),
|
||||
|
||||
ClipCursorItems(),
|
||||
|
||||
Command( wxT("CursProjectStart"), XXO("&Project Start"),
|
||||
FN(OnSkipStart),
|
||||
CanStopFlags,
|
||||
|
@ -1235,13 +1231,13 @@ MenuTable::BaseItemSharedPtr CursorMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
MenuTable::BaseItemSharedPtr ExtraClipCursorItems();
|
||||
AttachedItem sAttachment0{
|
||||
wxT("Transport/Basic"),
|
||||
Shared( CursorMenu() )
|
||||
};
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraCursorMenu()
|
||||
BaseItemSharedPtr ExtraCursorMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Cursor"), XO("&Cursor"),
|
||||
|
@ -1262,17 +1258,18 @@ MenuTable::BaseItemSharedPtr ExtraCursorMenu()
|
|||
TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+,") ),
|
||||
Command( wxT("CursorLongJumpRight"), XXO("Cursor Long Ju&mp Right"),
|
||||
FN(OnCursorLongJumpRight),
|
||||
TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+.") ),
|
||||
|
||||
ExtraClipCursorItems()
|
||||
TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+.") )
|
||||
) ) };
|
||||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraSeekMenu()
|
||||
AttachedItem sAttachment4{
|
||||
wxT("Optional/Extra/Part2"),
|
||||
Shared( ExtraCursorMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ExtraSeekMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Seek"), XO("See&k"),
|
||||
|
@ -1289,4 +1286,11 @@ MenuTable::BaseItemSharedPtr ExtraSeekMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
AttachedItem sAttachment5{
|
||||
wxT("Optional/Extra/Part1"),
|
||||
Shared( ExtraSeekMenu() )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
|
|
@ -253,95 +253,100 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
|||
|
||||
#define FN(X) (& ToolbarActions::Handler :: X)
|
||||
|
||||
// Under /MenuBar/View
|
||||
MenuTable::BaseItemSharedPtr ToolbarsMenu()
|
||||
namespace{
|
||||
using namespace MenuTable;
|
||||
BaseItemSharedPtr ToolbarsMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static const auto checkOff = Options{}.CheckState( false );
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Toolbars"), XO("&Toolbars"),
|
||||
Section( "Reset",
|
||||
/* i18n-hint: (verb)*/
|
||||
Command( wxT("ResetToolbars"), XXO("Reset Toolb&ars"),
|
||||
FN(OnResetToolBars), AlwaysEnabledFlag )
|
||||
),
|
||||
Section( wxT("Toolbars"),
|
||||
Menu( wxT("Toolbars"), XO("&Toolbars"),
|
||||
Section( "Reset",
|
||||
/* i18n-hint: (verb)*/
|
||||
Command( wxT("ResetToolbars"), XXO("Reset Toolb&ars"),
|
||||
FN(OnResetToolBars), AlwaysEnabledFlag )
|
||||
),
|
||||
|
||||
Section( "Other",
|
||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||
with the big buttons on it (play record etc)*/
|
||||
Command( wxT("ShowTransportTB"), XXO("&Transport Toolbar"),
|
||||
FN(OnShowTransportToolBar), AlwaysEnabledFlag, checkOff ),
|
||||
/* i18n-hint: Clicking this menu item shows a toolbar
|
||||
that has some tools in it*/
|
||||
Command( wxT("ShowToolsTB"), XXO("T&ools Toolbar"),
|
||||
FN(OnShowToolsToolBar), AlwaysEnabledFlag, checkOff ),
|
||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||
with the recording level meters*/
|
||||
Command( wxT("ShowRecordMeterTB"), XXO("&Recording Meter Toolbar"),
|
||||
FN(OnShowRecordMeterToolBar), AlwaysEnabledFlag, checkOff ),
|
||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||
with the playback level meter*/
|
||||
Command( wxT("ShowPlayMeterTB"), XXO("&Playback Meter Toolbar"),
|
||||
FN(OnShowPlayMeterToolBar), AlwaysEnabledFlag, checkOff )
|
||||
Section( "Other",
|
||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||
with the big buttons on it (play record etc)*/
|
||||
Command( wxT("ShowTransportTB"), XXO("&Transport Toolbar"),
|
||||
FN(OnShowTransportToolBar), AlwaysEnabledFlag, checkOff ),
|
||||
/* i18n-hint: Clicking this menu item shows a toolbar
|
||||
that has some tools in it*/
|
||||
Command( wxT("ShowToolsTB"), XXO("T&ools Toolbar"),
|
||||
FN(OnShowToolsToolBar), AlwaysEnabledFlag, checkOff ),
|
||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||
with the recording level meters*/
|
||||
Command( wxT("ShowRecordMeterTB"), XXO("&Recording Meter Toolbar"),
|
||||
FN(OnShowRecordMeterToolBar), AlwaysEnabledFlag, checkOff ),
|
||||
/* i18n-hint: Clicking this menu item shows the toolbar
|
||||
with the playback level meter*/
|
||||
Command( wxT("ShowPlayMeterTB"), XXO("&Playback Meter Toolbar"),
|
||||
FN(OnShowPlayMeterToolBar), AlwaysEnabledFlag, checkOff )
|
||||
|
||||
/* --i18nhint: Clicking this menu item shows the toolbar
|
||||
which has sound level meters*/
|
||||
//Command( wxT("ShowMeterTB"), XXO("Co&mbined Meter Toolbar"),
|
||||
// FN(OnShowMeterToolBar), AlwaysEnabledFlag, checkOff ),
|
||||
/* --i18nhint: Clicking this menu item shows the toolbar
|
||||
which has sound level meters*/
|
||||
//Command( wxT("ShowMeterTB"), XXO("Co&mbined Meter Toolbar"),
|
||||
// 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
|
||||
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*/
|
||||
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
|
||||
/* 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;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraToolsMenu()
|
||||
AttachedItem sAttachment1{
|
||||
Placement{ wxT("View/Other"), { OrderingHint::Begin } },
|
||||
Shared( ToolbarsMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ExtraToolsMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Tools"), XO("T&ools"),
|
||||
|
@ -365,4 +370,10 @@ MenuTable::BaseItemSharedPtr ExtraToolsMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
AttachedItem sAttachment2{
|
||||
wxT("Optional/Extra/Part1"),
|
||||
Shared( ExtraToolsMenu() )
|
||||
};
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
|
|
@ -1278,10 +1278,11 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
|||
#define FN(X) (& TrackActions::Handler :: X)
|
||||
|
||||
// Under /MenuBar
|
||||
MenuTable::BaseItemSharedPtr TracksMenu()
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
BaseItemSharedPtr TracksMenu()
|
||||
{
|
||||
// Tracks Menu (formerly Project Menu)
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
|
@ -1437,10 +1438,13 @@ MenuTable::BaseItemSharedPtr TracksMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraTrackMenu()
|
||||
AttachedItem sAttachment1{
|
||||
wxT(""),
|
||||
Shared( TracksMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ExtraTrackMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Track"), XO("&Track"),
|
||||
|
@ -1491,4 +1495,11 @@ MenuTable::BaseItemSharedPtr ExtraTrackMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
AttachedItem sAttachment2{
|
||||
wxT("Optional/Extra/Part2"),
|
||||
Shared( ExtraTrackMenu() )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "../commands/CommandManager.h"
|
||||
#include "../toolbars/ControlToolBar.h"
|
||||
#include "../toolbars/TranscriptionToolBar.h"
|
||||
#include "../tracks/ui/Scrubbing.h"
|
||||
#include "../widgets/AudacityMessageBox.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
|
||||
|
@ -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)
|
||||
{
|
||||
auto &project = context.project;
|
||||
|
@ -968,12 +890,11 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
|||
|
||||
#define FN(X) (& TransportActions::Handler :: X)
|
||||
|
||||
MenuTable::BaseItemSharedPtr CursorMenu();
|
||||
|
||||
// Under /MenuBar
|
||||
MenuTable::BaseItemSharedPtr TransportMenu()
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
BaseItemSharedPtr TransportMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static const auto checkOff = Options{}.CheckState( false );
|
||||
|
@ -1036,12 +957,7 @@ MenuTable::BaseItemSharedPtr TransportMenu()
|
|||
// PRL: caution, this is a duplicated command name!
|
||||
Command( wxT("Pause"), XXO("&Pause"), FN(OnPause),
|
||||
CanStopAudioStreamFlag(), wxT("P") )
|
||||
),
|
||||
|
||||
// Scrubbing sub-menu
|
||||
Scrubber::Menu(),
|
||||
|
||||
CursorMenu()
|
||||
)
|
||||
),
|
||||
|
||||
Section( "Other",
|
||||
|
@ -1098,10 +1014,13 @@ MenuTable::BaseItemSharedPtr TransportMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraTransportMenu()
|
||||
AttachedItem sAttachment1{
|
||||
wxT(""),
|
||||
Shared( TransportMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ExtraTransportMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Transport"), XO("T&ransport"),
|
||||
|
@ -1139,21 +1058,18 @@ MenuTable::BaseItemSharedPtr ExtraTransportMenu()
|
|||
wxT("Ctrl+Shift+F7") ),
|
||||
Command( wxT("PlayCutPreview"), XXO("Play C&ut Preview"),
|
||||
FN(OnPlayCutPreview),
|
||||
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"))
|
||||
CaptureNotBusyFlag(), wxT("C") )
|
||||
) ) };
|
||||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra
|
||||
MenuTable::BaseItemSharedPtr ExtraPlayAtSpeedMenu()
|
||||
AttachedItem sAttachment2{
|
||||
wxT("Optional/Extra/Part1"),
|
||||
Shared( ExtraTransportMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ExtraPlayAtSpeedMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("PlayAtSpeed"), XO("&Play-at-Speed"),
|
||||
|
@ -1184,4 +1100,11 @@ MenuTable::BaseItemSharedPtr ExtraPlayAtSpeedMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
AttachedItem sAttachment3{
|
||||
wxT("Optional/Extra/Part1"),
|
||||
Shared( ExtraPlayAtSpeedMenu() )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
|
|
@ -2,10 +2,7 @@
|
|||
#include "../Experimental.h"
|
||||
|
||||
#include "../CommonCommandFlags.h"
|
||||
#include "../HistoryWindow.h"
|
||||
#include "../LyricsWindow.h"
|
||||
#include "../Menus.h"
|
||||
#include "../MixerBoard.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../Project.h"
|
||||
#include "../ProjectHistory.h"
|
||||
|
@ -31,25 +28,6 @@
|
|||
// private helper classes and functions
|
||||
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 )
|
||||
{
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
@ -325,34 +303,6 @@ void OnGoSelEnd(const CommandContext &context)
|
|||
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)
|
||||
{
|
||||
auto &project = context.project;
|
||||
|
@ -432,12 +382,11 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &project) {
|
|||
|
||||
#define FN(X) (& ViewActions::Handler :: X)
|
||||
|
||||
MenuTable::BaseItemSharedPtr ToolbarsMenu();
|
||||
|
||||
// Under /MenuBar
|
||||
MenuTable::BaseItemSharedPtr ViewMenu()
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
BaseItemSharedPtr ViewMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static const auto checkOff = Options{}.CheckState( false );
|
||||
|
@ -487,59 +436,7 @@ MenuTable::BaseItemSharedPtr ViewMenu()
|
|||
)
|
||||
),
|
||||
|
||||
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( "Windows" ),
|
||||
|
||||
Section( "Other",
|
||||
Command( wxT("ShowExtraMenus"), XXO("&Extra Menus (on/off)"),
|
||||
|
@ -559,4 +456,10 @@ MenuTable::BaseItemSharedPtr ViewMenu()
|
|||
|
||||
}
|
||||
|
||||
AttachedItem sAttachment1{
|
||||
wxT(""),
|
||||
Shared( ViewMenu() )
|
||||
};
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
|
|
@ -118,13 +118,13 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
|||
|
||||
#define FN(X) (& WindowActions::Handler :: X)
|
||||
|
||||
// Under /MenuBar
|
||||
MenuTable::BaseItemSharedPtr WindowMenu()
|
||||
namespace {
|
||||
using namespace MenuTable;
|
||||
BaseItemSharedPtr WindowMenu()
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// poor imitation of the Mac Windows Menu
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Window"), XO("&Window"),
|
||||
|
@ -149,10 +149,13 @@ MenuTable::BaseItemSharedPtr WindowMenu()
|
|||
return menu;
|
||||
}
|
||||
|
||||
// Under /MenuBar/Optional/Extra/Misc
|
||||
MenuTable::BaseItemSharedPtr ExtraWindowItems()
|
||||
AttachedItem sAttachment1{
|
||||
wxT(""),
|
||||
Shared( WindowMenu() )
|
||||
};
|
||||
|
||||
BaseItemSharedPtr ExtraWindowItems()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr items{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Items( wxT("MacWindows"),
|
||||
|
@ -165,19 +168,17 @@ MenuTable::BaseItemSharedPtr ExtraWindowItems()
|
|||
return items;
|
||||
}
|
||||
|
||||
AttachedItem sAttachment2{
|
||||
Placement{ wxT("Optional/Extra/Part2/Misc"), OrderingHint::End },
|
||||
Shared( ExtraWindowItems() )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
||||
#else
|
||||
|
||||
// Not WXMAC. Stub functions.
|
||||
MenuTable::BaseItemSharedPtr WindowMenu()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MenuTable::BaseItemSharedPtr ExtraWindowItems()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
// Not WXMAC.
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../Project.h"
|
||||
#include "../../ProjectAudioIO.h"
|
||||
#include "../../ProjectAudioManager.h"
|
||||
#include "../../ProjectHistory.h"
|
||||
#include "../../ProjectSettings.h"
|
||||
#include "../../ProjectStatus.h"
|
||||
#include "../../Track.h"
|
||||
|
@ -1127,21 +1128,99 @@ bool Scrubber::CanScrub() const
|
|||
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;
|
||||
|
||||
static BaseItemSharedPtr menu { (
|
||||
FinderScope{
|
||||
[](AudacityProject &project) -> CommandHandlerObject&
|
||||
{ return Scrubber::Get( project ); } },
|
||||
MenuTable::Menu( wxT("Scrubbing"),
|
||||
FinderScope{ finder },
|
||||
Menu( wxT("Scrubbing"),
|
||||
XO("Scru&bbing"),
|
||||
[]{
|
||||
BaseItemPtrs ptrs;
|
||||
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.flags,
|
||||
item.StatusTest
|
||||
|
@ -1160,6 +1239,35 @@ MenuTable::BaseItemSharedPtr Scrubber::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)
|
||||
{
|
||||
int id = CMD_ID;
|
||||
|
|
|
@ -117,8 +117,6 @@ public:
|
|||
// This returns the same as the enabled state of the menu items:
|
||||
bool CanScrub() const;
|
||||
|
||||
// For the toolbar
|
||||
static MenuTable::BaseItemSharedPtr Menu();
|
||||
// For popup
|
||||
void PopulatePopupMenu(wxMenu &menu);
|
||||
|
||||
|
@ -127,6 +125,10 @@ public:
|
|||
void OnSeek(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
|
||||
template<void (Scrubber::*pfn)(const CommandContext&)>
|
||||
void Thunk(wxCommandEvent &)
|
||||
|
|
Loading…
Reference in New Issue