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 1665 of file ProjectFileManager.cpp.

1667{
1668 if( window.IsIconized() )
1669 window.Restore();
1670 window.Raise(); // May help identifying the window on Mac
1671
1672 // Construct this project's name and number.
1673 sProjName = project.GetProjectName();
1674 if ( sProjName.empty() ) {
1675 sProjName = _("<untitled>");
1676 UnnamedCount = std::count_if(
1678 []( const AllProjects::value_type &ptr ){
1679 return ptr->GetProjectName().empty();
1680 }
1681 );
1682 if ( UnnamedCount > 1 ) {
1683 sProjNumber.Printf(
1684 _("[Project %02i] "), project.GetProjectNumber() + 1 );
1685 RefreshAllTitles( true );
1686 }
1687 }
1688 else
1689 UnnamedCount = 0;
1690}
#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 1692 of file ProjectFileManager.cpp.

1692 {
1693 if( UnnamedCount > 1 )
1694 RefreshAllTitles( false );
1695}

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: