Audacity  3.0.3
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 315 of file ProjectFileIO.h.

Constructor & Destructor Documentation

◆ TitleRestorer()

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

Definition at line 229 of file ProjectFileIO.cpp.

231 {
232  if( window.IsIconized() )
233  window.Restore();
234  window.Raise(); // May help identifying the window on Mac
235 
236  // Construct this project's name and number.
237  sProjName = project.GetProjectName();
238  if ( sProjName.empty() ) {
239  sProjName = _("<untitled>");
240  UnnamedCount = std::count_if(
241  AllProjects{}.begin(), AllProjects{}.end(),
242  []( const AllProjects::value_type &ptr ){
243  return ptr->GetProjectName().empty();
244  }
245  );
246  if ( UnnamedCount > 1 ) {
247  sProjNumber.Printf(
248  _("[Project %02i] "), project.GetProjectNumber() + 1 );
249  RefreshAllTitles( true );
250  }
251  }
252  else
253  UnnamedCount = 0;
254 }

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 256 of file ProjectFileIO.cpp.

256  {
257  if( UnnamedCount > 1 )
258  RefreshAllTitles( false );
259 }

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 321 of file ProjectFileIO.h.

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


The documentation for this class was generated from the following files:
AllProjects::begin
const_iterator begin() const
Definition: Project.cpp:31
AllProjects::end
const_iterator end() const
Definition: Project.cpp:36
AudacityProject::GetProjectNumber
int GetProjectNumber()
Definition: Project.h:128
RefreshAllTitles
static void RefreshAllTitles(bool bShowProjectNumbers)
Definition: ProjectFileIO.cpp:219
TitleRestorer::sProjNumber
wxString sProjNumber
Definition: ProjectFileIO.h:319
TitleRestorer::UnnamedCount
size_t UnnamedCount
Definition: ProjectFileIO.h:321
_
#define _(s)
Definition: Internat.h:75
AllProjects
an object of class AllProjects acts like a standard library container, but refers to a global array o...
Definition: Project.h:38
AudacityProject::GetProjectName
const wxString & GetProjectName() const
Definition: Project.cpp:163
AllProjects::value_type
Container::value_type value_type
Definition: Project.h:58
TitleRestorer::sProjName
wxString sProjName
Definition: ProjectFileIO.h:320