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

#include <ProjectFileManager.h>

Public Member Functions

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

Public Attributes

wxString sProjNumber
 
wxString sProjName
 
size_t UnnamedCount
 

Detailed Description

TitleRestorer restores project window titles to what they were, in its destructor.

Definition at line 157 of file ProjectFileManager.h.

Constructor & Destructor Documentation

◆ TitleRestorer()

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

Definition at line 1716 of file ProjectFileManager.cpp.

1718{
1719 if( window.IsIconized() )
1720 window.Restore();
1721 window.Raise(); // May help identifying the window on Mac
1722
1723 // Construct this project's name and number.
1724 sProjName = project.GetProjectName();
1725 if ( sProjName.empty() ) {
1726 sProjName = _("<untitled>");
1727 UnnamedCount = std::count_if(
1729 []( const AllProjects::value_type &ptr ){
1730 return ptr->GetProjectName().empty();
1731 }
1732 );
1733 if ( UnnamedCount > 1 ) {
1734 sProjNumber.Printf(
1735 _("[Project %02i] "), project.GetProjectNumber() + 1 );
1736 RefreshAllTitles( true );
1737 }
1738 }
1739 else
1740 UnnamedCount = 0;
1741}
#define _(s)
Definition: Internat.h:73
static void RefreshAllTitles(bool bShowProjectNumbers)
const auto project
const_iterator end() const
Definition: Project.cpp:27
Container::value_type value_type
Definition: Project.h:57
const_iterator begin() const
Definition: Project.cpp:22

References _, AllProjects::begin(), AllProjects::end(), project, RefreshAllTitles(), sProjName, sProjNumber, and UnnamedCount.

Here is the call graph for this function:

◆ ~TitleRestorer()

TitleRestorer::~TitleRestorer ( )

Definition at line 1743 of file ProjectFileManager.cpp.

1743 {
1744 if( UnnamedCount > 1 )
1745 RefreshAllTitles( false );
1746}

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 163 of file ProjectFileManager.h.

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


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