Audacity  3.0.3
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
ProjectStatus Class Referencefinal

#include <ProjectStatus.h>

Inheritance diagram for ProjectStatus:
[legend]
Collaboration diagram for ProjectStatus:
[legend]

Classes

struct  RegisteredStatusWidthFunction
 

Public Types

using StatusWidthResult = std::pair< std::vector< TranslatableString >, unsigned >
 
using StatusWidthFunction = std::function< StatusWidthResult(const AudacityProject &, StatusBarField) >
 
using StatusWidthFunctions = std::vector< StatusWidthFunction >
 

Public Member Functions

 ProjectStatus (AudacityProject &project)
 
 ProjectStatus (const ProjectStatus &)=delete
 
ProjectStatusoperator= (const ProjectStatus &)=delete
 
 ~ProjectStatus () override
 
const TranslatableStringGet (StatusBarField field=mainStatusBarField) const
 
void Set (const TranslatableString &msg, StatusBarField field=mainStatusBarField)
 
void UpdatePrefs () override
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 
- Public Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 

Static Public Member Functions

static ProjectStatusGet (AudacityProject &project)
 
static const ProjectStatusGet (const AudacityProject &project)
 
static const StatusWidthFunctionsGetStatusWidthFunctions ()
 
- Static Public Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Private Attributes

AudacityProjectmProject
 
TranslatableString mLastStatusMessages [nStatusBarFields]
 

Additional Inherited Members

- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 

Detailed Description

Definition at line 43 of file ProjectStatus.h.

Member Typedef Documentation

◆ StatusWidthFunction

Definition at line 60 of file ProjectStatus.h.

◆ StatusWidthFunctions

Definition at line 63 of file ProjectStatus.h.

◆ StatusWidthResult

using ProjectStatus::StatusWidthResult = std::pair< std::vector<TranslatableString>, unsigned >

Definition at line 59 of file ProjectStatus.h.

Constructor & Destructor Documentation

◆ ProjectStatus() [1/2]

ProjectStatus::ProjectStatus ( AudacityProject project)
explicit

Definition at line 45 of file ProjectStatus.cpp.

46  : mProject{ project }
47 {
48 }

◆ ProjectStatus() [2/2]

ProjectStatus::ProjectStatus ( const ProjectStatus )
delete

◆ ~ProjectStatus()

ProjectStatus::~ProjectStatus ( )
overridedefault

Member Function Documentation

◆ Get() [1/3]

ProjectStatus & ProjectStatus::Get ( AudacityProject project)
static

Definition at line 35 of file ProjectStatus.cpp.

36 {
37  return project.AttachedObjects::Get< ProjectStatus >( key );
38 }

References key.

Referenced by ProjectFileManager::DoSave(), Get(), ProjectAudioManager::OnAudioIORate(), MeterPanel::OnMouse(), AButton::OnMouseEvent(), LWSlider::OnMouseEvent(), ProjectManager::OnStatusChange(), TrackActions::Handler::OnTrackClose(), LWSlider::SendUpdate(), AButton::UpdateStatus(), ControlToolBar::UpdateStatusBar(), AdornedRulerPanel::UpdateStatusMessage(), TrackPanel::UpdateStatusMessage(), and TrackPanel::UpdateViewIfNoTracks().

Here is the caller graph for this function:

◆ Get() [2/3]

const ProjectStatus & ProjectStatus::Get ( const AudacityProject project)
static

Definition at line 40 of file ProjectStatus.cpp.

41 {
42  return Get( const_cast< AudacityProject & >( project ) );
43 }

References Get().

Here is the call graph for this function:

◆ Get() [3/3]

const TranslatableString & ProjectStatus::Get ( StatusBarField  field = mainStatusBarField) const

Definition at line 72 of file ProjectStatus.cpp.

73 {
74  return mLastStatusMessages[ field - 1 ];
75 }

References field, and mLastStatusMessages.

◆ GetStatusWidthFunctions()

auto ProjectStatus::GetStatusWidthFunctions ( )
static

Definition at line 67 of file ProjectStatus.cpp.

68 {
69  return statusWidthFunctions();
70 }

References anonymous_namespace{ProjectStatus.cpp}::statusWidthFunctions().

Referenced by ProjectWindow::UpdateStatusWidths().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

ProjectStatus& ProjectStatus::operator= ( const ProjectStatus )
delete

◆ Set()

void ProjectStatus::Set ( const TranslatableString msg,
StatusBarField  field = mainStatusBarField 
)

Definition at line 77 of file ProjectStatus.cpp.

78 {
79  auto &project = mProject;
80  auto &lastMessage = mLastStatusMessages[ field - 1 ];
81  // compare full translations not msgids!
82  if ( msg.Translation() != lastMessage.Translation() ) {
83  lastMessage = msg;
85  project.ProcessEvent( evt );
86  }
87 }

References field, mLastStatusMessages, mProject, and TranslatableString::Translation().

Referenced by ProjectFileManager::DoSave(), ProjectAudioManager::OnAudioIORate(), MeterPanel::OnMouse(), AButton::OnMouseEvent(), LWSlider::OnMouseEvent(), TrackActions::Handler::OnTrackClose(), LWSlider::SendUpdate(), AButton::UpdateStatus(), ControlToolBar::UpdateStatusBar(), AdornedRulerPanel::UpdateStatusMessage(), TrackPanel::UpdateStatusMessage(), and TrackPanel::UpdateViewIfNoTracks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdatePrefs()

void ProjectStatus::UpdatePrefs ( )
overridevirtual

Implements PrefsListener.

Definition at line 89 of file ProjectStatus.cpp.

90 {
91  auto &project = mProject;
92  for (auto field = 1; field <= nStatusBarFields; field++) {
94  project.ProcessEvent( evt );
95  }
96 }

References field, mProject, and nStatusBarFields.

Member Data Documentation

◆ mLastStatusMessages

TranslatableString ProjectStatus::mLastStatusMessages[nStatusBarFields]
private

Definition at line 83 of file ProjectStatus.h.

Referenced by Get(), and Set().

◆ mProject

AudacityProject& ProjectStatus::mProject
private

Definition at line 82 of file ProjectStatus.h.

Referenced by Set(), and UpdatePrefs().


The documentation for this class was generated from the following files:
field
#define field(n, t)
Definition: ImportAUP.cpp:167
ProjectStatus::mProject
AudacityProject & mProject
Definition: ProjectStatus.h:82
ProjectStatusEvent
Definition: ProjectStatus.h:32
StatusBarField
StatusBarField
Definition: ProjectStatus.h:24
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition: ProjectStatus.cpp:29
ProjectStatus::mLastStatusMessages
TranslatableString mLastStatusMessages[nStatusBarFields]
Definition: ProjectStatus.h:83
anonymous_namespace{ProjectStatus.cpp}::statusWidthFunctions
ProjectStatus::StatusWidthFunctions & statusWidthFunctions()
Definition: ProjectStatus.cpp:54
ProjectStatus
Definition: ProjectStatus.h:46
ProjectStatus::Get
static ProjectStatus & Get(AudacityProject &project)
Definition: ProjectStatus.cpp:35
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
TranslatableString::Translation
wxString Translation() const
Definition: TranslatableString.h:79
nStatusBarFields
@ nStatusBarFields
Definition: ProjectStatus.h:29