Audacity 3.2.0
ProjectWindowBase.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5ProjectWindowBase.cpp
6
7Paul Licameli split from ProjectWindow.cpp
8
9**********************************************************************/
10
11#include "ProjectWindowBase.h"
12
13#include "Project.h"
14#include "ProjectWindows.h"
15
16ProjectWindowBase::ProjectWindowBase(wxWindow * parent, wxWindowID id,
17 const wxPoint & pos,
18 const wxSize & size, AudacityProject &project)
19 : wxFrame(parent, id, _TS("Audacity"), pos, size)
20 , mwProject{ project.weak_from_this() }
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
33namespace {
34
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->FindProject().get() : nullptr;
48}
49
50const AudacityProject *FindProjectFromWindow( const wxWindow *pWindow )
51{
52 return FindProjectFromWindow( const_cast< wxWindow* >( pWindow ) );
53}
#define _TS(s)
Definition: Internat.h:27
AudacityProject * FindProjectFromWindow(wxWindow *pWindow)
void SetProjectFrame(AudacityProject &project, wxFrame &frame)
accessors for certain important windows associated with each project
const auto project
int id
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
A top-level window associated with a project.
ProjectWindowBase(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, AudacityProject &project)
~ProjectWindowBase() override
ProjectWindowBase * FindProjectWindow(wxWindow *pWindow)