Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
TitleRestorer Class Reference

#include <ProjectFileIO.h>

Public Member Functions

 TitleRestorer (wxTopLevelWindow &window, AudacityProject &project)
 
 ~TitleRestorer ()
 

Public Attributes

wxString sProjNumber
 
wxString sProjName
 
size_t UnnamedCount
 

Detailed Description

Definition at line 318 of file ProjectFileIO.h.

Constructor & Destructor Documentation

◆ TitleRestorer()

TitleRestorer::TitleRestorer ( wxTopLevelWindow &  window,
AudacityProject project 
)

Definition at line 442 of file ProjectFileIO.cpp.

444{
445 if( window.IsIconized() )
446 window.Restore();
447 window.Raise(); // May help identifying the window on Mac
448
449 // Construct this project's name and number.
450 sProjName = project.GetProjectName();
451 if ( sProjName.empty() ) {
452 sProjName = _("<untitled>");
453 UnnamedCount = std::count_if(
455 []( const AllProjects::value_type &ptr ){
456 return ptr->GetProjectName().empty();
457 }
458 );
459 if ( UnnamedCount > 1 ) {
460 sProjNumber.Printf(
461 _("[Project %02i] "), project.GetProjectNumber() + 1 );
462 RefreshAllTitles( true );
463 }
464 }
465 else
466 UnnamedCount = 0;
467}
#define _(s)
Definition: Internat.h:75
static void RefreshAllTitles(bool bShowProjectNumbers)
const_iterator end() const
Definition: Project.cpp:27
Container::value_type value_type
Definition: Project.h:56
const_iterator begin() const
Definition: Project.cpp:22
int GetProjectNumber()
Definition: Project.h:96
const wxString & GetProjectName() const
Definition: Project.cpp:90
size_t UnnamedCount
wxString sProjName
wxString sProjNumber

References _, AllProjects::begin(), AllProjects::end(), AudacityProject::GetProjectName(), AudacityProject::GetProjectNumber(), RefreshAllTitles(), sProjName, sProjNumber, and UnnamedCount.

Here is the call graph for this function:

◆ ~TitleRestorer()

TitleRestorer::~TitleRestorer ( )

Definition at line 469 of file ProjectFileIO.cpp.

469 {
470 if( UnnamedCount > 1 )
471 RefreshAllTitles( false );
472}

References RefreshAllTitles(), and UnnamedCount.

Here is the call graph for this function:

Member Data Documentation

◆ sProjName

wxString TitleRestorer::sProjName

◆ sProjNumber

wxString TitleRestorer::sProjNumber

◆ UnnamedCount

size_t TitleRestorer::UnnamedCount

Definition at line 324 of file ProjectFileIO.h.

Referenced by TitleRestorer(), and ~TitleRestorer().


The documentation for this class was generated from the following files: