1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-08 04:32:00 +01:00

ProjectWindow does not depend on ProjectFileIO

This commit is contained in:
Paul Licameli
2019-06-05 07:23:08 -04:00
parent 2f9322e7f7
commit 236b188d6b
5 changed files with 56 additions and 55 deletions

View File

@@ -16,7 +16,6 @@ Paul Licameli split from AudacityProject.cpp
#include "Menus.h"
#include "Project.h"
#include "ProjectAudioIO.h"
#include "ProjectFileIO.h"
#include "TrackPanel.h"
#include "ViewInfo.h"
#include "WaveClip.h"
@@ -39,48 +38,6 @@ Paul Licameli split from AudacityProject.cpp
#include "../images/AudacityLogoAlpha.xpm"
#endif
static void RefreshAllTitles(bool bShowProjectNumbers )
{
for ( auto pProject : AllProjects{} ) {
if ( !GetProjectFrame( *pProject ).IsIconized() ) {
ProjectFileIO::Get( *pProject ).SetProjectTitle(
bShowProjectNumbers ? pProject->GetProjectNumber() : -1 );
}
}
}
TitleRestorer::TitleRestorer(ProjectWindow * pWindow )
{
auto &window = *pWindow;
if( window.IsIconized() )
window.Restore();
window.Raise(); // May help identifying the window on Mac
// Construct this projects name and number.
auto p = &pWindow->GetProject();
sProjName = p->GetProjectName();
if (sProjName.empty()){
sProjName = _("<untitled>");
UnnamedCount = std::count_if(
AllProjects{}.begin(), AllProjects{}.end(),
[]( const AllProjects::value_type &ptr ){
return ptr->GetProjectName().empty();
}
);
if( UnnamedCount > 1 ){
sProjNumber.Printf( "[Project %02i] ", p->GetProjectNumber()+1 );
RefreshAllTitles( true );
}
} else {
UnnamedCount = 0;
}
}
TitleRestorer::~TitleRestorer() {
if( UnnamedCount > 1 )
RefreshAllTitles( false );
}
// Returns the screen containing a rectangle, or -1 if none does.
int ScreenContaining( wxRect & r ){
unsigned int n = wxDisplay::GetCount();