1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Update OnResetConfig

Now it resets the toolbars, and fixes three common 'stuck-in-a-mode' issues.

Paul wrote: "I would move that function [OnResetToolBars(context)] into ToolManager.cpp so it can be called from ToolBarMenus.cpp and HelpMenus.cpp, with neither of those two dependent on the other."
This commit is contained in:
James Crook
2020-05-31 12:22:08 +01:00
parent b5e056575b
commit bc621158b8
4 changed files with 39 additions and 10 deletions

View File

@@ -28,6 +28,7 @@
#include "ToolManager.h"
#include "../Experimental.h"
#include "../commands/CommandContext.h"
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
@@ -547,6 +548,17 @@ static struct DefaultConfigEntry {
{ SpectralSelectionBarID, NoBarID, NoBarID },
};
// Static member function.
void ToolManager::OnResetToolBars(const CommandContext &context)
{
auto &project = context.project;
auto &toolManager = ToolManager::Get( project );
toolManager.Reset();
MenuManager::Get(project).ModifyToolbarMenus(project);
}
void ToolManager::Reset()
{
// Disconnect all docked bars

View File

@@ -23,6 +23,10 @@
#include "../ClientData.h"
#include "ToolDock.h"
#include "../commands/CommandFunctors.h"
#include "../commands/CommandManager.h"
class wxCommandEvent;
class wxFrame;
class wxMouseEvent;
@@ -80,6 +84,8 @@ class ToolManager final
const ToolDock *GetBotDock() const;
void Reset();
static void OnResetToolBars(const CommandContext &context);
void Destroy();
void RegenerateTooltips();
@@ -210,8 +216,6 @@ public:
};
#include "../commands/CommandFunctors.h"
#include "../commands/CommandManager.h"
// Construct a static instance of this class to add a menu item that shows and
// hides a toolbar