mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 08:29:27 +02:00
Revert fix for bug 1119, which made bad dependency cycles
This reverts commit 4475dee373b8c9376153684b8b2a246c53d5b7ed. This reverts commit 18cbc2e574007a48ee0eb1bd384b3e0f012b0894.
This commit is contained in:
parent
20ba353038
commit
3348e2fecd
@ -109,10 +109,6 @@ It handles initialization and termination by subclassing wxApp.
|
||||
#include "tracks/ui/Scrubbing.h"
|
||||
#include "widgets/FileHistory.h"
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
#include "menus/WindowMenus.h"
|
||||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL_EASY_CHANGE_KEY_BINDINGS
|
||||
#include "prefs/KeyConfigPrefs.h"
|
||||
#endif
|
||||
@ -889,11 +885,6 @@ BEGIN_EVENT_TABLE(AudacityApp, wxApp)
|
||||
EVT_MENU_RANGE(FileHistory::ID_RECENT_FIRST, FileHistory::ID_RECENT_LAST,
|
||||
AudacityApp::OnMRUFile)
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
// Window menu event handlers.
|
||||
EVT_MENU_RANGE(WindowActions::ID_BASE, WindowActions::ID_LAST, AudacityApp::OnWindow)
|
||||
#endif
|
||||
|
||||
// Handle AppCommandEvents (usually from a script)
|
||||
EVT_APP_COMMAND(wxID_ANY, AudacityApp::OnReceiveCommand)
|
||||
|
||||
@ -987,35 +978,6 @@ void AudacityApp::OnMRUFile(wxCommandEvent& event) {
|
||||
history.RemoveFileFromHistory(n);
|
||||
}
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
// Handles switching projects when an item in the Window menu is selected
|
||||
void AudacityApp::OnWindow(wxCommandEvent& event)
|
||||
{
|
||||
// Get the project's number
|
||||
int projectNumber = event.GetId() - WindowActions::ID_BASE;
|
||||
|
||||
// Search for it
|
||||
for (auto project : AllProjects{})
|
||||
{
|
||||
if (project->GetProjectNumber() == projectNumber)
|
||||
{
|
||||
// Make it the active project
|
||||
SetActiveProject(project.get());
|
||||
|
||||
// And ensure it's visible
|
||||
wxFrame *frame = project->GetFrame();
|
||||
if (frame->IsIconized())
|
||||
{
|
||||
frame->Restore();
|
||||
}
|
||||
frame->Raise();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void AudacityApp::OnTimer(wxTimerEvent& WXUNUSED(event))
|
||||
{
|
||||
// Filenames are queued when Audacity receives a few of the
|
||||
|
@ -69,10 +69,6 @@ class AudacityApp final : public wxApp {
|
||||
// A wrapper of the above that does not throw
|
||||
bool SafeMRUOpen(const wxString &fileName);
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
void OnWindow(wxCommandEvent &event);
|
||||
#endif
|
||||
|
||||
void OnReceiveCommand(AppCommandEvent &event);
|
||||
|
||||
void OnKeyDown(wxKeyEvent &event);
|
||||
|
@ -15,10 +15,6 @@
|
||||
#include "KeyboardCapture.h"
|
||||
#include "ondemand/ODTaskThread.h"
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
#include "menus/WindowMenus.h"
|
||||
#endif
|
||||
|
||||
#include <wx/display.h>
|
||||
#include <wx/frame.h>
|
||||
|
||||
@ -117,11 +113,6 @@ void SetActiveProject(AudacityProject * project)
|
||||
KeyboardCapture::Capture( nullptr );
|
||||
}
|
||||
wxTheApp->SetTopWindow( FindProjectFrame( project ) );
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
// Refresh the Window menu
|
||||
WindowActions::Refresh();
|
||||
#endif
|
||||
}
|
||||
|
||||
AudacityProject::AudacityProject()
|
||||
|
@ -24,10 +24,6 @@ Paul Licameli split from AudacityProject.cpp
|
||||
#include "widgets/AudacityMessageBox.h"
|
||||
#include "widgets/NumericTextCtrl.h"
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
#include "menus/WindowMenus.h"
|
||||
#endif
|
||||
|
||||
static void RefreshAllTitles(bool bShowProjectNumbers )
|
||||
{
|
||||
for ( auto pProject : AllProjects{} ) {
|
||||
@ -136,11 +132,6 @@ void ProjectFileIO::SetProjectTitle( int number)
|
||||
|
||||
window.SetTitle( name );
|
||||
window.SetName(name); // to make the nvda screen reader read the correct title
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
// Refresh the Window menu
|
||||
WindowActions::Refresh();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Most of this string was duplicated 3 places. Made the warning consistent in this global.
|
||||
|
@ -7,16 +7,12 @@
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
||||
#include "WindowMenus.h"
|
||||
|
||||
#include "../CommonCommandFlags.h"
|
||||
#include "../Menus.h"
|
||||
#include "../Project.h"
|
||||
#include "../commands/CommandContext.h"
|
||||
|
||||
#include <wx/frame.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/menuitem.h>
|
||||
|
||||
#undef USE_COCOA
|
||||
|
||||
@ -61,68 +57,7 @@ void DoMacMinimize(AudacityProject *project)
|
||||
namespace WindowActions {
|
||||
|
||||
// exported helper functions
|
||||
|
||||
// Refreshes the Window menu in all projects
|
||||
void Refresh()
|
||||
{
|
||||
// Must do it in all projects
|
||||
for (auto thisProject : AllProjects{})
|
||||
{
|
||||
// Need the projects frame, but this should always be successful
|
||||
wxFrame *frame = thisProject->GetFrame();
|
||||
wxASSERT(frame != NULL);
|
||||
if (!frame)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// This can happen if we are called before the menubar is set in the frame
|
||||
wxMenuBar *bar = frame->GetMenuBar();
|
||||
if (!bar)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Should always find the Window menu
|
||||
int pos = bar->FindMenu(wxT("Window"));
|
||||
wxASSERT(pos != wxNOT_FOUND);
|
||||
if (pos == wxNOT_FOUND)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// We can not get the menu proper
|
||||
wxMenu *menu = bar->GetMenu(pos);
|
||||
|
||||
// Remove all existing window items
|
||||
for (auto item : menu->GetMenuItems())
|
||||
{
|
||||
if (item->GetId() >= WindowActions::ID_BASE)
|
||||
{
|
||||
menu->Destroy(item);
|
||||
}
|
||||
}
|
||||
|
||||
// Add all projects to this project's Window menu
|
||||
for (auto project : AllProjects{})
|
||||
{
|
||||
int itemId = WindowActions::ID_BASE + project->GetProjectNumber();
|
||||
wxString itemName = project->GetFrame()->GetTitle();
|
||||
bool isActive = (GetActiveProject() == project.get());
|
||||
|
||||
// This should never really happen, but a menu item must have a name
|
||||
if (itemName.empty())
|
||||
{
|
||||
itemName = _("<untitled>");
|
||||
}
|
||||
|
||||
// Add it to the menu and check it if it's the active project
|
||||
wxMenuItem *item = menu->Append(itemId, itemName);
|
||||
item->SetCheckable(true);
|
||||
item->Check(isActive);
|
||||
}
|
||||
}
|
||||
}
|
||||
// none
|
||||
|
||||
// Menu handler functions
|
||||
|
||||
@ -187,9 +122,9 @@ namespace {
|
||||
using namespace MenuTable;
|
||||
BaseItemSharedPtr WindowMenu()
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// poor imitation of the Mac Windows Menu
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// poor imitation of the Mac Windows Menu
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static BaseItemSharedPtr menu{
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Window"), XO("&Window"),
|
||||
@ -209,16 +144,7 @@ BaseItemSharedPtr WindowMenu()
|
||||
* windows un-hidden */
|
||||
Command( wxT("MacBringAllToFront"), XXO("&Bring All to Front"),
|
||||
FN(OnMacBringAllToFront), AlwaysEnabledFlag )
|
||||
),
|
||||
|
||||
Section( "",
|
||||
Special( wxT("PopulateWindowsStep"),
|
||||
[](AudacityProject &, wxMenu &theMenu)
|
||||
{
|
||||
// Should something be done here???
|
||||
} )
|
||||
)
|
||||
|
||||
) ) };
|
||||
return menu;
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
#include "../Audacity.h"
|
||||
|
||||
#include "../commands/CommandManager.h"
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
||||
/// Namespace for functions for window management (mac only?)
|
||||
namespace WindowActions {
|
||||
|
||||
// Range of assigned menu IDs
|
||||
static const wxWindowID ID_BASE = 30000;
|
||||
static const wxWindowID ID_LAST = 30999;
|
||||
|
||||
// Exported helper functions
|
||||
void Refresh();
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
// Not WXMAC.
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user