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

Constructor & Destructor Documentation

◆ TitleRestorer()

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

Definition at line 1736 of file ProjectFileManager.cpp.

1738{
1739 if( window.IsIconized() )
1740 window.Restore();
1741 window.Raise(); // May help identifying the window on Mac
1742
1743 // Construct this project's name and number.
1744 sProjName = project.GetProjectName();
1745 if ( sProjName.empty() ) {
1746 sProjName = _("<untitled>");
1747 UnnamedCount = std::count_if(
1749 []( const AllProjects::value_type &ptr ){
1750 return ptr->GetProjectName().empty();
1751 }
1752 );
1753 if ( UnnamedCount > 1 ) {
1754 sProjNumber.Printf(
1755 _("[Project %02i] "), project.GetProjectNumber() + 1 );
1756 RefreshAllTitles( true );
1757 }
1758 }
1759 else
1760 UnnamedCount = 0;
1761}
#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 1763 of file ProjectFileManager.cpp.

1763 {
1764 if( UnnamedCount > 1 )
1765 RefreshAllTitles( false );
1766}

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

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


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