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

Constructor & Destructor Documentation

◆ TitleRestorer()

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

Definition at line 226 of file ProjectFileIO.cpp.

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

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

253  {
254  if( UnnamedCount > 1 )
255  RefreshAllTitles( false );
256 }

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 323 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:24
AllProjects::end
const_iterator end() const
Definition: Project.cpp:29
AudacityProject::GetProjectNumber
int GetProjectNumber()
Definition: Project.h:99
RefreshAllTitles
static void RefreshAllTitles(bool bShowProjectNumbers)
Definition: ProjectFileIO.cpp:216
TitleRestorer::sProjNumber
wxString sProjNumber
Definition: ProjectFileIO.h:321
TitleRestorer::UnnamedCount
size_t UnnamedCount
Definition: ProjectFileIO.h:323
_
#define _(s)
Definition: Internat.h:75
AllProjects
Definition: Project.h:35
AudacityProject::GetProjectName
const wxString & GetProjectName() const
Definition: Project.cpp:92
AllProjects::value_type
Container::value_type value_type
Definition: Project.h:56
TitleRestorer::sProjName
wxString sProjName
Definition: ProjectFileIO.h:322