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

Bug1119: Windows menu on Mac should list all project names...

... Reimplemented without making dependency cycles.

Project and ProjectFileManager publish events for change of active project or
change of a project title.

WindowMenus.cpp can listen for those events, so that it can update the menu
appropriately.  So it's all done nonintrusively in the rest of the code.
This commit is contained in:
Paul Licameli
2020-04-21 12:26:37 -04:00
parent 3348e2fecd
commit c3d0d0370b
5 changed files with 112 additions and 2 deletions

View File

@@ -24,6 +24,8 @@ Paul Licameli split from AudacityProject.cpp
#include "widgets/AudacityMessageBox.h"
#include "widgets/NumericTextCtrl.h"
wxDEFINE_EVENT(EVT_PROJECT_TITLE_CHANGE, wxCommandEvent);
static void RefreshAllTitles(bool bShowProjectNumbers )
{
for ( auto pProject : AllProjects{} ) {
@@ -130,8 +132,13 @@ void ProjectFileIO::SetProjectTitle( int number)
name += _("(Recovered)");
}
window.SetTitle( name );
window.SetName(name); // to make the nvda screen reader read the correct title
if ( name != window.GetTitle() ) {
window.SetTitle( name );
window.SetName(name); // to make the nvda screen reader read the correct title
project.QueueEvent(
safenew wxCommandEvent{ EVT_PROJECT_TITLE_CHANGE } );
}
}
// Most of this string was duplicated 3 places. Made the warning consistent in this global.