Audacity  3.0.3
Classes | Typedefs | Functions
Project.h File Reference
#include "Identifier.h"
#include "ClientData.h"
#include <memory>
#include <mutex>
#include <wx/weakref.h>
#include <wx/window.h>
Include dependency graph for Project.h:

Go to the source code of this file.

Classes

class  AllProjects
 an object of class AllProjects acts like a standard library container, but refers to a global array of open projects. So you can iterate easily over shared pointers to them with range-for : for (auto pProject : AllProjects{}) { ... } The pointers are never null. More...
 
class  AudacityProject
 The top-level handle to an Audacity project. It serves as a source of events that other objects can bind to, and a container of associated sub-objects that it treats opaquely. It stores a filename and a status message and a few other things. There is very little in this class, most of the intelligence residing in the cooperating attached objects. More...
 

Typedefs

using AttachedProjectObjects = ClientData::Site< AudacityProject, ClientData::Base, ClientData::SkipCopying, std::shared_ptr >
 
using AttachedProjectWindows = ClientData::Site< AudacityProject, wxWindow, ClientData::SkipCopying, ClientData::BarePtr >
 

Functions

AUDACITY_DLL_API AudacityProjectGetActiveProject ()
 
AUDACITY_DLL_API void SetActiveProject (AudacityProject *project)
 
 wxDECLARE_EXPORTED_EVENT (AUDACITY_DLL_API, EVT_TRACK_PANEL_TIMER, wxCommandEvent)
 
 wxDECLARE_EXPORTED_EVENT (AUDACITY_DLL_API, EVT_PROJECT_ACTIVATION, wxCommandEvent)
 
AUDACITY_DLL_API wxFrame & GetProjectFrame (AudacityProject &project)
 Get the top-level window associated with the project (as a wxFrame only, when you do not need to use the subclass ProjectWindow) More...
 
AUDACITY_DLL_API const wxFrame & GetProjectFrame (const AudacityProject &project)
 
wxFrame * FindProjectFrame (AudacityProject *project)
 Get a pointer to the window associated with a project, or null if the given pointer is null. More...
 
const wxFrame * FindProjectFrame (const AudacityProject *project)
 
AUDACITY_DLL_API wxWindow & GetProjectPanel (AudacityProject &project)
 Get the main sub-window of the project frame that displays track data. More...
 
AUDACITY_DLL_API const wxWindow & GetProjectPanel (const AudacityProject &project)
 

Typedef Documentation

◆ AttachedProjectObjects

Definition at line 84 of file Project.h.

◆ AttachedProjectWindows

Definition at line 89 of file Project.h.

Function Documentation

◆ FindProjectFrame() [1/2]

wxFrame* FindProjectFrame ( AudacityProject project)
inline

Get a pointer to the window associated with a project, or null if the given pointer is null.

Definition at line 172 of file Project.h.

172  {
173  return project ? &GetProjectFrame( *project ) : nullptr;
174 }

References GetProjectFrame().

Referenced by Exporter::DisplayOptions(), ToolManager::FilterEvent(), CommandManager::FilterKeyEvent(), anonymous_namespace{WaveTrackControls.cpp}::GainSliderDrawFunction(), AudacityApp::InitPart2(), NotMinimizedFlag(), Exporter::OnHelp(), MeterPanel::OnPreferences(), anonymous_namespace{WaveTrackControls.cpp}::PanSliderDrawFunction(), SetActiveProject(), ShowDependencyDialogIfNeeded(), and AudioIO::StartMonitoring().

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

◆ FindProjectFrame() [2/2]

const wxFrame* FindProjectFrame ( const AudacityProject project)
inline

Definition at line 175 of file Project.h.

175  {
176  return project ? &GetProjectFrame( *project ) : nullptr;
177 }

References GetProjectFrame().

Here is the call graph for this function:

◆ GetActiveProject()

AUDACITY_DLL_API AudacityProject* GetActiveProject ( )

Definition at line 107 of file Project.cpp.

108 {
109  return gActiveProject;
110 }

References gActiveProject.

Referenced by TimeTrack::Clear(), EVT_MENU_RANGE(), ExecCommand(), AudacityApp::InitPart2(), InstallHandlers::InstallHandlers(), ProjectManager::OnCloseWindow(), AudacityApp::OnExceptionInMainLoop(), NyqBench::OnGo(), AudacityApp::OnKeyDown(), CommandHandler::OnReceiveCommand(), NyqBench::OnRunUpdate(), AudacityApp::OnTimer(), TimeTrack::Paste(), and ZoomInfo::SetZoom().

Here is the caller graph for this function:

◆ GetProjectFrame() [1/2]

AUDACITY_DLL_API wxFrame& GetProjectFrame ( AudacityProject project)

Get the top-level window associated with the project (as a wxFrame only, when you do not need to use the subclass ProjectWindow)

Definition at line 186 of file Project.cpp.

187 {
188  auto ptr = project.GetFrame();
189  if ( !ptr )
191  return *ptr;
192 }

References AudacityProject::GetFrame(), and THROW_INCONSISTENCY_EXCEPTION.

Referenced by DragCommand::Apply(), SetProjectCommand::Apply(), AllProjects::Close(), MenuCreator::CreateMenusAndCommands(), ToolManager::CreateWindows(), LabelTrackView::DialogForLabelName(), Exporter::DoEditMetadata(), SplashDialog::DoHelpWelcome(), DoImportMIDIProject(), SelectUtilities::DoListSelection(), anonymous_namespace{PluginMenus.cpp}::DoManagePluginsMenu(), ToolManager::DoneDragging(), ProjectAudioManager::DoRecord(), DoReloadPreferences(), ProjectFileManager::DoSave(), anonymous_namespace{ExtraMenus.cpp}::ExtraMiscItems(), FindProjectFrame(), GetNextWindowPlacement(), MenuManager::GetUpdateFlags(), AUPImportFileHandle::HandleNoteTrack(), AUPImportFileHandle::HandleProject(), AUPImportFileHandle::HandleTimeTrack(), ProjectFileIO::HandleXMLTag(), ProjectFileManager::Import(), AUPImportFileHandle::Import(), InstallHandlers::InstallHandlers(), HelpActions::Handler::OnAbout(), ProjectAudioManager::OnAudioIOStopRecording(), PluginActions::Handler::OnBenchmark(), FileActions::Handler::OnExportLabels(), FileActions::Handler::OnExportMIDI(), ExtraActions::Handler::OnFullScreen(), ToolManager::OnGrabber(), ProjectWindow::OnIconize(), TrackPanel::OnIdle(), FileActions::Handler::OnImportMIDI(), HelpActions::Handler::OnManual(), ToolManager::OnMouse(), NavigationActions::Handler::OnNextWindow(), ProjectManager::OnOpenAudioFile(), FileActions::Handler::OnPageSetup(), EditActions::Handler::OnPreferences(), NavigationActions::Handler::OnPrevWindow(), FileActions::Handler::OnPrint(), HelpActions::Handler::OnQuickFix(), HelpActions::Handler::OnQuickHelp(), SelectActions::Handler::OnSetLeftSelection(), TrackMenuTable::OnSetName(), SelectActions::Handler::OnSetRightSelection(), TransportActions::Handler::OnSoundActivated(), AudacityApp::OnTimer(), AUPImportFileHandle::Open(), ProjectAudioManager::PlayPlayRegion(), ScreenshotBigDialog::PopulateOrExchange(), ProjectFileManager::ReadProjectFile(), MenuCreator::RebuildAllMenuBars(), MenuCreator::RebuildMenuBar(), RefreshAllTitles(), ProjectFileIO::RenameOrWarn(), ProjectFileManager::SaveAs(), ProjectFileManager::SaveCopy(), GetInfoCommand::SendBoxes(), GetInfoCommand::SendMenus(), GetInfoCommand::SendPreferences(), LabelTrackView::ShowContextMenu(), anonymous_namespace{HelpMenus.cpp}::ShowDiagnostics(), ScreenshotBigDialog::SizeMainWindow(), ToolManager::Updated(), and ProjectManager::ProjectChooser::~ProjectChooser().

Here is the call graph for this function:

◆ GetProjectFrame() [2/2]

AUDACITY_DLL_API const wxFrame& GetProjectFrame ( const AudacityProject project)

Definition at line 194 of file Project.cpp.

195 {
196  auto ptr = project.GetFrame();
197  if ( !ptr )
199  return *ptr;
200 }

References AudacityProject::GetFrame(), and THROW_INCONSISTENCY_EXCEPTION.

Here is the call graph for this function:

◆ GetProjectPanel() [1/2]

AUDACITY_DLL_API wxWindow& GetProjectPanel ( AudacityProject project)

Get the main sub-window of the project frame that displays track data.

Definition at line 202 of file Project.cpp.

203 {
204  auto ptr = project.GetPanel();
205  if ( !ptr )
207  return *ptr;
208 }

References AudacityProject::GetPanel(), and THROW_INCONSISTENCY_EXCEPTION.

Referenced by AdornedRulerPanel::CreateOverlays(), ProjectWindow::DoScroll(), AdornedRulerPanel::DrawBothOverlays(), ProjectWindow::FixScrollbars(), ProjectWindow::OnActivate(), ProjectWindow::PlaybackScroller::OnTimer(), ScrubbingOverlay::OnTimer(), ProjectWindow::RedrawProject(), ProjectWindow::ScrollIntoView(), ProjectWindow::UpdateLayout(), and ProjectWindow::ZoomAfterImport().

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

◆ GetProjectPanel() [2/2]

AUDACITY_DLL_API const wxWindow& GetProjectPanel ( const AudacityProject project)

Definition at line 210 of file Project.cpp.

212 {
213  auto ptr = project.GetPanel();
214  if ( !ptr )
216  return *ptr;
217 }

References AudacityProject::GetPanel(), and THROW_INCONSISTENCY_EXCEPTION.

Here is the call graph for this function:

◆ SetActiveProject()

AUDACITY_DLL_API void SetActiveProject ( AudacityProject project)

Definition at line 112 of file Project.cpp.

113 {
114  if ( gActiveProject != project ) {
115  gActiveProject = project;
116  KeyboardCapture::Capture( nullptr );
117  wxTheApp->QueueEvent( safenew wxCommandEvent{ EVT_PROJECT_ACTIVATION } );
118  }
119  wxTheApp->SetTopWindow( FindProjectFrame( project ) );
120 }

References KeyboardCapture::Capture(), FindProjectFrame(), gActiveProject, and safenew.

Referenced by ProjectManager::New(), ProjectWindow::OnActivate(), ProjectManager::OnCloseWindow(), and ProjectWindow::OnMouseEvent().

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

◆ wxDECLARE_EXPORTED_EVENT() [1/2]

wxDECLARE_EXPORTED_EVENT ( AUDACITY_DLL_API  ,
EVT_PROJECT_ACTIVATION  ,
wxCommandEvent   
)

◆ wxDECLARE_EXPORTED_EVENT() [2/2]

wxDECLARE_EXPORTED_EVENT ( AUDACITY_DLL_API  ,
EVT_TRACK_PANEL_TIMER  ,
wxCommandEvent   
)
AudacityProject::GetPanel
wxWindow * GetPanel()
Definition: Project.h:124
gActiveProject
static AudacityProject * gActiveProject
Definition: Project.cpp:103
AudacityProject::GetFrame
wxFrame * GetFrame()
Definition: Project.h:120
FindProjectFrame
wxFrame * FindProjectFrame(AudacityProject *project)
Get a pointer to the window associated with a project, or null if the given pointer is null.
Definition: Project.h:172
KeyboardCapture::Capture
void Capture(wxWindow *handler)
Definition: KeyboardCapture.cpp:69
THROW_INCONSISTENCY_EXCEPTION
#define THROW_INCONSISTENCY_EXCEPTION
Throw InconsistencyException, using C++ preprocessor to identify the source code location.
Definition: InconsistencyException.h:79
GetProjectFrame
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
Definition: Project.cpp:186
safenew
#define safenew
Definition: MemoryX.h:10