Audacity  3.0.3
Functions | Variables
ActiveProject.cpp File Reference
#include "ActiveProject.h"
#include "KeyboardCapture.h"
#include "Project.h"
#include "ProjectWindows.h"
#include <wx/app.h>
#include <wx/frame.h>
Include dependency graph for ActiveProject.cpp:

Go to the source code of this file.

Functions

 wxDEFINE_EVENT (EVT_PROJECT_ACTIVATION, wxCommandEvent)
 
AUDACITY_DLL_API std::weak_ptr< AudacityProjectGetActiveProject ()
 
void SetActiveProject (AudacityProject *project)
 

Variables

static std::weak_ptr< AudacityProjectgActiveProject
 

Detailed Description


Audacity: A Digital Audio Editor

Paul Licameli split from Project.cpp

Definition in file ActiveProject.cpp.

Function Documentation

◆ GetActiveProject()

AUDACITY_DLL_API std::weak_ptr<AudacityProject> GetActiveProject ( )

Definition at line 24 of file ActiveProject.cpp.

25 {
26  return gActiveProject;
27 }

References gActiveProject.

Referenced by EVT_MENU_RANGE(), ExecCommand(), anonymous_namespace{TimeTrack.cpp}::GetRate(), AudacityApp::InitPart2(), InstallHandlers::InstallHandlers(), ProjectManager::OnCloseWindow(), AudacityApp::OnExceptionInMainLoop(), NyqBench::OnGo(), AudacityApp::OnKeyDown(), CommandHandler::OnReceiveCommand(), NyqBench::OnRunUpdate(), AudacityApp::OnTimer(), and ZoomInfo::SetZoom().

Here is the caller graph for this function:

◆ SetActiveProject()

void SetActiveProject ( AudacityProject project)

Definition at line 29 of file ActiveProject.cpp.

30 {
31  auto pProject = project ? project->shared_from_this() : nullptr;
32  if ( gActiveProject.lock() != pProject ) {
33  gActiveProject = pProject;
34  KeyboardCapture::Capture( nullptr );
35  wxTheApp->QueueEvent( safenew wxCommandEvent{ EVT_PROJECT_ACTIVATION } );
36  }
37  wxTheApp->SetTopWindow( FindProjectFrame( project ) );
38 }

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:

◆ wxDEFINE_EVENT()

wxDEFINE_EVENT ( EVT_PROJECT_ACTIVATION  ,
wxCommandEvent   
)

Variable Documentation

◆ gActiveProject

std::weak_ptr<AudacityProject> gActiveProject
static

Definition at line 22 of file ActiveProject.cpp.

Referenced by GetActiveProject(), and SetActiveProject().

gActiveProject
static std::weak_ptr< AudacityProject > gActiveProject
Definition: ActiveProject.cpp:22
KeyboardCapture::Capture
void Capture(wxWindow *handler)
Definition: KeyboardCapture.cpp:70
FindProjectFrame
wxFrame * FindProjectFrame(AudacityProject *project)
Get a pointer to the window associated with a project, or null if the given pointer is null,...
Definition: ProjectWindows.cpp:88
safenew
#define safenew
Definition: MemoryX.h:10