mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 07:40:23 +02:00
static CommandManager::Get()...
... not member functions of AudacityProject
This commit is contained in:
parent
805af452a4
commit
4ba4d0978b
@ -154,7 +154,7 @@ int ModuleDispatch(ModuleDispatchTypes type)
|
||||
|
||||
wxMenuBar * pBar = p->GetMenuBar();
|
||||
wxMenu * pMenu = pBar->GetMenu( 8 ); // Menu 8 is the Analyze Menu.
|
||||
CommandManager * c = p->GetCommandManager();
|
||||
CommandManager * c = &CommandManager::Get( *p );
|
||||
|
||||
c->SetCurrentMenu( pMenu );
|
||||
c->AddSeparator();
|
||||
|
@ -184,7 +184,7 @@ extern "C"
|
||||
case MenusRebuilt: {
|
||||
AudacityProject *p = GetActiveProject();
|
||||
wxASSERT(p != NULL);
|
||||
CommandManager *c = p->GetCommandManager();
|
||||
CommandManager *c = &CommandManager::Get( *p );
|
||||
wxASSERT(c != NULL);
|
||||
|
||||
wxMenuBar * pBar = p->GetMenuBar();
|
||||
|
@ -314,14 +314,14 @@ MacroCommandsCatalog::MacroCommandsCatalog( const AudacityProject *project )
|
||||
}
|
||||
}
|
||||
|
||||
auto mManager = project->GetCommandManager();
|
||||
auto &manager = CommandManager::Get( *project );
|
||||
wxArrayString mLabels;
|
||||
CommandIDs mNames;
|
||||
std::vector<bool> vHasDialog;
|
||||
mLabels.clear();
|
||||
mNames.clear();
|
||||
mManager->GetAllCommandLabels(mLabels, vHasDialog, true);
|
||||
mManager->GetAllCommandNames(mNames, true);
|
||||
manager.GetAllCommandLabels(mLabels, vHasDialog, true);
|
||||
manager.GetAllCommandNames(mNames, true);
|
||||
|
||||
const bool english = wxGetLocale()->GetCanonicalName().StartsWith(wxT("en"));
|
||||
|
||||
@ -774,9 +774,9 @@ bool MacroCommands::ApplyCommand( const wxString &friendlyCommand,
|
||||
}
|
||||
|
||||
AudacityProject *project = GetActiveProject();
|
||||
CommandManager * pManager = project->GetCommandManager();
|
||||
auto &manager = CommandManager::Get( *project );
|
||||
if( pContext ){
|
||||
if( pManager->HandleTextualCommand( command, *pContext, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
|
||||
if( manager.HandleTextualCommand( command, *pContext, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
|
||||
return true;
|
||||
pContext->Status( wxString::Format(
|
||||
_("Your batch command of %s was not recognized."), friendlyCommand ));
|
||||
@ -785,7 +785,7 @@ bool MacroCommands::ApplyCommand( const wxString &friendlyCommand,
|
||||
else
|
||||
{
|
||||
const CommandContext context( *GetActiveProject() );
|
||||
if( pManager->HandleTextualCommand( command, context, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
|
||||
if( manager.HandleTextualCommand( command, context, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -528,7 +528,8 @@ void LyricsPanel::OnShow(wxShowEvent &e)
|
||||
void LyricsPanel::OnKeyEvent(wxKeyEvent & event)
|
||||
{
|
||||
AudacityProject *project = GetActiveProject();
|
||||
project->GetCommandManager()->FilterKeyEvent(project, event, true);
|
||||
auto &commandManager = CommandManager::Get( *project );
|
||||
commandManager.FilterKeyEvent(project, event, true);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ void VisitItem( AudacityProject &project, MenuTable::BaseItem *pItem )
|
||||
if (!pItem)
|
||||
return;
|
||||
|
||||
auto &manager = *project.GetCommandManager();
|
||||
auto &manager = CommandManager::Get( project );
|
||||
|
||||
using namespace MenuTable;
|
||||
if (const auto pComputed =
|
||||
@ -279,13 +279,13 @@ static const auto menuTree = MenuTable::Items(
|
||||
|
||||
void MenuCreator::CreateMenusAndCommands(AudacityProject &project)
|
||||
{
|
||||
CommandManager *c = project.GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
// The list of defaults to exclude depends on
|
||||
// preference wxT("/GUI/Shortcuts/FullDefaults"), which may have changed.
|
||||
c->SetMaxList();
|
||||
commandManager.SetMaxList();
|
||||
|
||||
auto menubar = c->AddMenuBar(wxT("appmenu"));
|
||||
auto menubar = commandManager.AddMenuBar(wxT("appmenu"));
|
||||
wxASSERT(menubar);
|
||||
|
||||
VisitItem( project, menuTree.get() );
|
||||
@ -304,7 +304,7 @@ void MenuManager::ModifyUndoMenuItems(AudacityProject &project)
|
||||
{
|
||||
wxString desc;
|
||||
auto &undoManager = UndoManager::Get( project );
|
||||
auto &commandManager = *project.GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
int cur = undoManager.GetCurrentState();
|
||||
|
||||
if (undoManager.UndoAvailable()) {
|
||||
@ -354,7 +354,7 @@ void MenuCreator::RebuildMenuBar(AudacityProject &project)
|
||||
// menuBar gets deleted here
|
||||
}
|
||||
|
||||
project.GetCommandManager()->PurgeData();
|
||||
CommandManager::Get( project ).PurgeData();
|
||||
|
||||
CreateMenusAndCommands(project);
|
||||
|
||||
@ -576,7 +576,7 @@ void MenuManager::ModifyToolbarMenus(AudacityProject &project)
|
||||
return;
|
||||
}
|
||||
|
||||
auto &commandManager = *project.GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
commandManager.Check(wxT("ShowScrubbingTB"),
|
||||
toolManager->IsVisible(ScrubbingBarID));
|
||||
@ -683,7 +683,7 @@ void MenuManager::UpdateMenus(AudacityProject &project, bool checkActive)
|
||||
return;
|
||||
mLastFlags = flags;
|
||||
|
||||
auto &commandManager = *project.GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
commandManager.EnableUsingFlags(flags2 , NoFlagsSpecified);
|
||||
|
||||
@ -752,9 +752,8 @@ bool MenuManager::ReportIfActionNotAllowed
|
||||
bool bAllowed = TryToMakeActionAllowed( project, flags, flagsRqd, mask );
|
||||
if( bAllowed )
|
||||
return true;
|
||||
CommandManager* cm = project.GetCommandManager();
|
||||
if (!cm) return false;
|
||||
cm->TellUserWhyDisallowed( Name, flags & mask, flagsRqd & mask);
|
||||
auto &cm = CommandManager::Get( project );
|
||||
cm.TellUserWhyDisallowed( Name, flags & mask, flagsRqd & mask);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1457,7 +1457,8 @@ void MixerBoardFrame::OnSize(wxSizeEvent & WXUNUSED(event))
|
||||
void MixerBoardFrame::OnKeyEvent(wxKeyEvent & event)
|
||||
{
|
||||
AudacityProject *project = GetActiveProject();
|
||||
project->GetCommandManager()->FilterKeyEvent(project, event, true);
|
||||
auto &commandManager = CommandManager::Get( *project );
|
||||
commandManager.FilterKeyEvent(project, event, true);
|
||||
}
|
||||
|
||||
void MixerBoardFrame::Recreate( AudacityProject *pProject )
|
||||
|
@ -1060,7 +1060,6 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
||||
mBandwidthSelectionFormatName( NumericTextCtrl::LookupFormat(
|
||||
NumericConverter::BANDWIDTH,
|
||||
gPrefs->Read(wxT("/BandwidthSelectionFormatName"), wxT("")) ) )
|
||||
, mCommandManager( std::make_unique<CommandManager>() )
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &window = project;
|
||||
@ -2373,7 +2372,9 @@ void AudacityProject::OnMenu(wxCommandEvent & event)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
bool handled = GetCommandManager()->HandleMenuID(
|
||||
auto &project = *this;
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
bool handled = commandManager.HandleMenuID(
|
||||
event.GetId(), GetMenuManager(*this).GetUpdateFlags(*this),
|
||||
NoFlagsSpecified);
|
||||
|
||||
|
@ -161,7 +161,6 @@ private:
|
||||
|
||||
class EffectPlugs;
|
||||
class CommandContext;
|
||||
class CommandManager;
|
||||
class Track;
|
||||
class TrackHolder;
|
||||
class TrackList;
|
||||
@ -333,11 +332,6 @@ public:
|
||||
// Converts number of minutes to human readable format
|
||||
wxString GetHoursMinsString(int iMinutes);
|
||||
|
||||
CommandManager *GetCommandManager()
|
||||
{ return mCommandManager.get(); }
|
||||
const CommandManager *GetCommandManager() const
|
||||
{ return mCommandManager.get(); }
|
||||
|
||||
void MayStartMonitoring();
|
||||
|
||||
|
||||
@ -563,10 +557,6 @@ public:
|
||||
private:
|
||||
bool mDirty{ false };
|
||||
|
||||
// Commands
|
||||
|
||||
std::unique_ptr<CommandManager> mCommandManager;
|
||||
|
||||
// Window elements
|
||||
|
||||
wxString mLastMainStatusMessage;
|
||||
|
@ -151,6 +151,23 @@ SubMenuListEntry::~SubMenuListEntry()
|
||||
{
|
||||
}
|
||||
|
||||
///
|
||||
static const AudacityProject::AttachedObjects::RegisteredFactory key{
|
||||
[](AudacityProject&) {
|
||||
return std::make_unique<CommandManager>();
|
||||
}
|
||||
};
|
||||
|
||||
CommandManager &CommandManager::Get( AudacityProject &project )
|
||||
{
|
||||
return project.AttachedObjects::Get< CommandManager >( key );
|
||||
}
|
||||
|
||||
const CommandManager &CommandManager::Get( const AudacityProject &project )
|
||||
{
|
||||
return Get( const_cast< AudacityProject & >( project ) );
|
||||
}
|
||||
|
||||
///
|
||||
/// Standard Constructor
|
||||
///
|
||||
@ -1642,8 +1659,8 @@ static struct InstallHandlers
|
||||
KeyboardCapture::SetPostFilter( []( wxKeyEvent &key ) {
|
||||
// Capture handler window didn't want it, so ask the CommandManager.
|
||||
AudacityProject *project = GetActiveProject();
|
||||
CommandManager *manager = project->GetCommandManager();
|
||||
return manager && manager->FilterKeyEvent(project, key);
|
||||
auto &manager = CommandManager::Get( *project );
|
||||
return manager.FilterKeyEvent(project, key);
|
||||
} );
|
||||
}
|
||||
} installHandlers;
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "audacity/Types.h"
|
||||
|
||||
#include "../ClientData.h"
|
||||
#include "CommandFunctors.h"
|
||||
#include "CommandFlag.h"
|
||||
|
||||
@ -99,9 +100,13 @@ using CommandNumericIDHash = std::unordered_map<int, CommandListEntry*>;
|
||||
class AudacityProject;
|
||||
class CommandContext;
|
||||
|
||||
class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
|
||||
class AUDACITY_DLL_API CommandManager final
|
||||
: public XMLTagHandler
|
||||
, public ClientData::Base
|
||||
{
|
||||
public:
|
||||
static CommandManager &Get( AudacityProject &project );
|
||||
static const CommandManager &Get( const AudacityProject &project );
|
||||
|
||||
//
|
||||
// Constructor / Destructor
|
||||
|
@ -640,7 +640,7 @@ void GetInfoCommand::ExploreMenu( const CommandContext &context, wxMenu * pMenu,
|
||||
if( !pMenu )
|
||||
return;
|
||||
|
||||
CommandManager * pMan = context.project.GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( context.project );
|
||||
|
||||
wxMenuItemList list = pMenu->GetMenuItems();
|
||||
size_t lcnt = list.size();
|
||||
@ -652,7 +652,7 @@ void GetInfoCommand::ExploreMenu( const CommandContext &context, wxMenu * pMenu,
|
||||
for (size_t lndx = 0; lndx < lcnt; lndx++) {
|
||||
item = list.Item(lndx)->GetData();
|
||||
Label = item->GetItemLabelText();
|
||||
Name = pMan->GetNameFromNumericID( item->GetId() );
|
||||
Name = commandManager.GetNameFromNumericID( item->GetId() );
|
||||
Accel = item->GetItemLabel();
|
||||
if( Accel.Contains("\t") )
|
||||
Accel = Accel.AfterLast('\t');
|
||||
|
@ -433,7 +433,7 @@ void ScreenshotCommand::CapturePreferences(
|
||||
AudacityProject * pProject, const wxString &FileName ){
|
||||
(void)&FileName;//compiler food.
|
||||
(void)&context;
|
||||
CommandManager * pMan = pProject->GetCommandManager();
|
||||
CommandManager &commandManager = CommandManager::Get( *pProject );
|
||||
|
||||
// Yucky static variables. Is there a better way? The problem is that we need the
|
||||
// idle callback to know more about what to do.
|
||||
@ -452,7 +452,7 @@ void ScreenshotCommand::CapturePreferences(
|
||||
gPrefs->Flush();
|
||||
CommandID Command{ wxT("Preferences") };
|
||||
const CommandContext projectContext( *pProject );
|
||||
if( !pMan->HandleTextualCommand( Command, projectContext, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
|
||||
if( !commandManager.HandleTextualCommand( Command, projectContext, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
|
||||
{
|
||||
// using GET in a log message for devs' eyes only
|
||||
wxLogDebug("Command %s not found", Command.GET() );
|
||||
@ -596,7 +596,7 @@ void ScreenshotCommand::CaptureScriptables(
|
||||
void ScreenshotCommand::CaptureCommands(
|
||||
const CommandContext & context, const wxArrayStringEx & Commands ){
|
||||
AudacityProject * pProject = &context.project;
|
||||
CommandManager * pMan = pProject->GetCommandManager();
|
||||
CommandManager &manager = CommandManager::Get( *pProject );
|
||||
wxString Str;
|
||||
// Yucky static variables. Is there a better way? The problem is that we need the
|
||||
// idle callback to know more about what to do.
|
||||
@ -612,7 +612,7 @@ void ScreenshotCommand::CaptureCommands(
|
||||
SetIdleHandler( IdleHandler );
|
||||
Str = Commands[i];
|
||||
const CommandContext projectContext( *pProject );
|
||||
if( !pMan->HandleTextualCommand( Str, projectContext, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
|
||||
if( !manager.HandleTextualCommand( Str, projectContext, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
|
||||
{
|
||||
wxLogDebug("Command %s not found", Str);
|
||||
}
|
||||
|
@ -122,11 +122,11 @@ void OnAudioHost(const CommandContext &context)
|
||||
void OnFullScreen(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto commandManager = project.GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
bool bChecked = !project.wxTopLevelWindow::IsFullScreen();
|
||||
project.wxTopLevelWindow::ShowFullScreen(bChecked);
|
||||
commandManager->Check(wxT("FullScreenOnOff"), bChecked);
|
||||
commandManager.Check(wxT("FullScreenOnOff"), bChecked);
|
||||
}
|
||||
|
||||
}; // struct Handler
|
||||
|
@ -399,7 +399,7 @@ bool DoEffect(
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto rate = project.GetRate();
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto commandManager = project.GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
|
||||
if (!plug)
|
||||
@ -475,7 +475,7 @@ bool DoEffect(
|
||||
/* i18n-hint: %s will be the name of the effect which will be
|
||||
* repeated if this menu item is chosen */
|
||||
lastEffectDesc.Printf(_("Repeat %s"), shortDesc);
|
||||
commandManager->Modify(wxT("RepeatLastEffect"), lastEffectDesc);
|
||||
commandManager.Modify(wxT("RepeatLastEffect"), lastEffectDesc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -645,20 +645,20 @@ void OnBenchmark(const CommandContext &context)
|
||||
void OnSimulateRecordingErrors(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto commandManager = project.GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
bool &setting = gAudioIO->mSimulateRecordingErrors;
|
||||
commandManager->Check(wxT("SimulateRecordingErrors"), !setting);
|
||||
commandManager.Check(wxT("SimulateRecordingErrors"), !setting);
|
||||
setting = !setting;
|
||||
}
|
||||
|
||||
void OnDetectUpstreamDropouts(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto commandManager = project.GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
bool &setting = gAudioIO->mDetectUpstreamDropouts;
|
||||
commandManager->Check(wxT("DetectUpstreamDropouts"), !setting);
|
||||
commandManager.Check(wxT("DetectUpstreamDropouts"), !setting);
|
||||
setting = !setting;
|
||||
}
|
||||
|
||||
|
@ -258,12 +258,12 @@ void OnZoomFitV(const CommandContext &context)
|
||||
void OnAdvancedVZoom(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto commandManager = project.GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
bool checked = !gPrefs->Read(wxT("/GUI/VerticalZooming"), 0L);
|
||||
gPrefs->Write(wxT("/GUI/VerticalZooming"), checked);
|
||||
gPrefs->Flush();
|
||||
commandManager->Check(wxT("AdvancedVZoom"), checked);
|
||||
commandManager.Check(wxT("AdvancedVZoom"), checked);
|
||||
MenuCreator::RebuildAllMenuBars();
|
||||
}
|
||||
|
||||
@ -350,25 +350,25 @@ void OnMixerBoard(const CommandContext &context)
|
||||
void OnShowExtraMenus(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto commandManager = project.GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
|
||||
bool checked = !gPrefs->Read(wxT("/GUI/ShowExtraMenus"), 0L);
|
||||
gPrefs->Write(wxT("/GUI/ShowExtraMenus"), checked);
|
||||
gPrefs->Flush();
|
||||
commandManager->Check(wxT("ShowExtraMenus"), checked);
|
||||
commandManager.Check(wxT("ShowExtraMenus"), checked);
|
||||
MenuCreator::RebuildAllMenuBars();
|
||||
}
|
||||
|
||||
void OnShowClipping(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto commandManager = project.GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
bool checked = !gPrefs->Read(wxT("/GUI/ShowClipping"), 0L);
|
||||
gPrefs->Write(wxT("/GUI/ShowClipping"), checked);
|
||||
gPrefs->Flush();
|
||||
commandManager->Check(wxT("ShowClipping"), checked);
|
||||
commandManager.Check(wxT("ShowClipping"), checked);
|
||||
|
||||
wxTheApp->AddPendingEvent(wxCommandEvent{
|
||||
EVT_PREFS_UPDATE, ShowClippingPrefsID() });
|
||||
|
@ -136,7 +136,7 @@ void KeyConfigPrefs::Populate()
|
||||
|
||||
mCommandSelected = wxNOT_FOUND;
|
||||
|
||||
mManager = project->GetCommandManager();
|
||||
mManager = &CommandManager::Get( *project );
|
||||
|
||||
// For speed, don't sort here. We're just creating.
|
||||
// Instead sort when we do SetView later in this function.
|
||||
|
@ -262,8 +262,7 @@ void EditToolBar::ForAllButtons(int Action)
|
||||
if( Action & ETBActEnableDisable ){
|
||||
p = GetActiveProject();
|
||||
if (!p) return;
|
||||
cm = p->GetCommandManager();
|
||||
if (!cm) return;
|
||||
cm = &CommandManager::Get( *p );
|
||||
#ifdef OPTION_SYNC_LOCK_BUTTON
|
||||
bool bSyncLockTracks;
|
||||
gPrefs->Read(wxT("/GUI/SyncLockTracks"), &bSyncLockTracks, false);
|
||||
@ -298,12 +297,11 @@ void EditToolBar::OnButton(wxCommandEvent &event)
|
||||
|
||||
AudacityProject *p = GetActiveProject();
|
||||
if (!p) return;
|
||||
CommandManager* cm = p->GetCommandManager();
|
||||
if (!cm) return;
|
||||
auto &cm = CommandManager::Get( *p );
|
||||
|
||||
auto flags = GetMenuManager(*p).GetUpdateFlags(*p);
|
||||
const CommandContext context( *GetActiveProject() );
|
||||
cm->HandleTextualCommand(EditToolbarButtonList[id].commandName, context, flags, NoFlagsSpecified);
|
||||
cm.HandleTextualCommand(EditToolbarButtonList[id].commandName, context, flags, NoFlagsSpecified);
|
||||
}
|
||||
|
||||
|
||||
|
@ -847,7 +847,7 @@ void ToolBar::SetButtonToolTip
|
||||
wxString result;
|
||||
const auto project = GetActiveProject();
|
||||
const auto commandManager =
|
||||
project ? project->GetCommandManager() : nullptr;
|
||||
project ? &CommandManager::Get( *project ) : nullptr;
|
||||
if (commandManager)
|
||||
result =
|
||||
commandManager->DescribeCommandsAndShortcuts(commands, nCommands);
|
||||
|
@ -47,9 +47,9 @@ wxString MuteButtonHandle::Tip(const wxMouseState &) const
|
||||
if (!focused)
|
||||
return name;
|
||||
|
||||
auto commandManager = project->GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( *project );
|
||||
TranslatedInternalString command{ wxT("TrackMute"), name };
|
||||
return commandManager->DescribeCommandsAndShortcuts(&command, 1u);
|
||||
return commandManager.DescribeCommandsAndShortcuts(&command, 1u);
|
||||
}
|
||||
|
||||
UIHandlePtr MuteButtonHandle::HitTest
|
||||
@ -103,9 +103,9 @@ wxString SoloButtonHandle::Tip(const wxMouseState &) const
|
||||
if (!focused)
|
||||
return name;
|
||||
|
||||
auto commandManager = project->GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( *project );
|
||||
TranslatedInternalString command{ wxT("TrackSolo"), name };
|
||||
return commandManager->DescribeCommandsAndShortcuts( &command, 1u );
|
||||
return commandManager.DescribeCommandsAndShortcuts( &command, 1u );
|
||||
}
|
||||
|
||||
UIHandlePtr SoloButtonHandle::HitTest
|
||||
|
@ -1145,8 +1145,8 @@ std::vector<wxString> Scrubber::GetAllUntranslatedStatusStrings()
|
||||
bool Scrubber::CanScrub() const
|
||||
{
|
||||
// Return the enabled state for the menu item that really launches the scrub or seek.
|
||||
auto cm = mProject->GetCommandManager();
|
||||
return cm->GetEnabled(menuItems[ 0 ].name);
|
||||
auto &cm = CommandManager::Get( *mProject );
|
||||
return cm.GetEnabled(menuItems[ 0 ].name);
|
||||
}
|
||||
|
||||
// To supply the "finder" argument
|
||||
@ -1178,9 +1178,9 @@ MenuTable::BaseItemPtr Scrubber::Menu()
|
||||
void Scrubber::PopulatePopupMenu(wxMenu &menu)
|
||||
{
|
||||
int id = CMD_ID;
|
||||
auto cm = mProject->GetCommandManager();
|
||||
auto &cm = CommandManager::Get( *mProject );
|
||||
for (const auto &item : menuItems) {
|
||||
if (cm->GetEnabled(item.name)) {
|
||||
if (cm.GetEnabled(item.name)) {
|
||||
auto test = item.StatusTest;
|
||||
menu.Append(id, wxGetTranslation(item.label), wxString{},
|
||||
test ? wxITEM_CHECK : wxITEM_NORMAL);
|
||||
@ -1193,11 +1193,11 @@ void Scrubber::PopulatePopupMenu(wxMenu &menu)
|
||||
|
||||
void Scrubber::CheckMenuItems()
|
||||
{
|
||||
auto cm = mProject->GetCommandManager();
|
||||
auto &cm = CommandManager::Get( *mProject );
|
||||
for (const auto &item : menuItems) {
|
||||
auto test = item.StatusTest;
|
||||
if (test)
|
||||
cm->Check(item.name, (this->*test)());
|
||||
cm.Check(item.name, (this->*test)());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -906,7 +906,7 @@ HitTestPreview SelectHandle::Preview
|
||||
// Look up the current key binding for Preferences.
|
||||
// (Don't assume it's the default!)
|
||||
auto keyStr =
|
||||
pProject->GetCommandManager()->GetKeyFromName(wxT("Preferences"))
|
||||
CommandManager::Get( *pProject ).GetKeyFromName(wxT("Preferences"))
|
||||
.Display( true );
|
||||
if (keyStr.empty())
|
||||
// No keyboard preference defined for opening Preferences dialog
|
||||
|
@ -169,9 +169,9 @@ wxString CloseButtonHandle::Tip(const wxMouseState &) const
|
||||
if (!focused)
|
||||
return name;
|
||||
|
||||
auto commandManager = project->GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( *project );
|
||||
TranslatedInternalString command{ wxT("TrackClose"), name };
|
||||
return commandManager->DescribeCommandsAndShortcuts( &command, 1u );
|
||||
return commandManager.DescribeCommandsAndShortcuts( &command, 1u );
|
||||
}
|
||||
|
||||
UIHandlePtr CloseButtonHandle::HitTest
|
||||
@ -228,9 +228,9 @@ wxString MenuButtonHandle::Tip(const wxMouseState &) const
|
||||
if (!focused)
|
||||
return name;
|
||||
|
||||
auto commandManager = project->GetCommandManager();
|
||||
auto &commandManager = CommandManager::Get( *project );
|
||||
TranslatedInternalString command{ wxT("TrackMenu"), name };
|
||||
return commandManager->DescribeCommandsAndShortcuts( &command, 1u );
|
||||
return commandManager.DescribeCommandsAndShortcuts( &command, 1u );
|
||||
}
|
||||
|
||||
UIHandlePtr MenuButtonHandle::HitTest
|
||||
|
@ -139,28 +139,28 @@ BEGIN_POPUP_MENU(TrackMenuTable)
|
||||
// functions.
|
||||
OnMoveUpID,
|
||||
_("Move Track &Up") + wxT("\t") +
|
||||
(GetActiveProject()->GetCommandManager()->
|
||||
(CommandManager::Get( *GetActiveProject() ).
|
||||
// using GET to compose menu item name for wxWidgets
|
||||
GetKeyFromName(wxT("TrackMoveUp")).GET()),
|
||||
OnMoveTrack)
|
||||
POPUP_MENU_ITEM(
|
||||
OnMoveDownID,
|
||||
_("Move Track &Down") + wxT("\t") +
|
||||
(GetActiveProject()->GetCommandManager()->
|
||||
(CommandManager::Get( *GetActiveProject() ).
|
||||
// using GET to compose menu item name for wxWidgets
|
||||
GetKeyFromName(wxT("TrackMoveDown")).GET()),
|
||||
OnMoveTrack)
|
||||
POPUP_MENU_ITEM(
|
||||
OnMoveTopID,
|
||||
_("Move Track to &Top") + wxT("\t") +
|
||||
(GetActiveProject()->GetCommandManager()->
|
||||
(CommandManager::Get( *GetActiveProject() ).
|
||||
// using GET to compose menu item name for wxWidgets
|
||||
GetKeyFromName(wxT("TrackMoveTop")).GET()),
|
||||
OnMoveTrack)
|
||||
POPUP_MENU_ITEM(
|
||||
OnMoveBottomID,
|
||||
_("Move Track to &Bottom") + wxT("\t") +
|
||||
(GetActiveProject()->GetCommandManager()->
|
||||
(CommandManager::Get( *GetActiveProject() ).
|
||||
// using GET to compose menu item name for wxWidgets
|
||||
GetKeyFromName(wxT("TrackMoveBottom")).GET()),
|
||||
OnMoveTrack)
|
||||
|
Loading…
x
Reference in New Issue
Block a user