Audacity  3.0.3
ProjectWindowBase.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 ProjectWindowBase.cpp
6 
7 Paul Licameli split from ProjectWindow.cpp
8 
9 **********************************************************************/
10 
11 #include "ProjectWindowBase.h"
12 
13 #include "Project.h"
14 #include "ProjectWindows.h"
15 
16 ProjectWindowBase::ProjectWindowBase(wxWindow * parent, wxWindowID id,
17  const wxPoint & pos,
18  const wxSize & size, AudacityProject &project)
19  : wxFrame(parent, id, _TS("Audacity"), pos, size)
20  , mProject{ project }
21 {
22  SetProjectFrame( project, *this );
23 
24  // Ensure a unique name of this window for journalling purposes
25  SetName(
26  wxString::Format( L"AudacityProject %d", project.GetProjectNumber() ) );
27 };
28 
30 {
31 }
32 
33 namespace {
34 
35 ProjectWindowBase *FindProjectWindow( wxWindow *pWindow )
36 {
37  while ( pWindow && pWindow->GetParent() )
38  pWindow = pWindow->GetParent();
39  return dynamic_cast< ProjectWindowBase* >( pWindow );
40 }
41 
42 }
43 
45 {
46  auto pProjectWindow = FindProjectWindow( pWindow );
47  return pProjectWindow ? &pProjectWindow->GetProject() : nullptr;
48 }
49 
50 const AudacityProject *FindProjectFromWindow( const wxWindow *pWindow )
51 {
52  return FindProjectFromWindow( const_cast< wxWindow* >( pWindow ) );
53 }
ProjectWindowBase::~ProjectWindowBase
~ProjectWindowBase() override
Definition: ProjectWindowBase.cpp:29
ProjectWindowBase.h
Project.h
ProjectWindowBase::ProjectWindowBase
ProjectWindowBase(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, AudacityProject &project)
Definition: ProjectWindowBase.cpp:16
FindProjectFromWindow
AudacityProject * FindProjectFromWindow(wxWindow *pWindow)
Definition: ProjectWindowBase.cpp:44
_TS
#define _TS(s)
Definition: Internat.h:27
ProjectWindowBase
A top-level window associated with a project.
Definition: ProjectWindowBase.h:20
ProjectWindows.h
accessors for certain important windows associated with each project
id
int id
Definition: WaveTrackControls.cpp:591
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
anonymous_namespace{ProjectWindowBase.cpp}::FindProjectWindow
ProjectWindowBase * FindProjectWindow(wxWindow *pWindow)
Definition: ProjectWindowBase.cpp:35
SetProjectFrame
void SetProjectFrame(AudacityProject &project, wxFrame &frame)
Definition: ProjectWindows.cpp:109