From 3c2a6e7f6cec4be317c6f77b8ed16efa0fba6aaa Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Tue, 9 Feb 2021 12:50:27 -0500 Subject: [PATCH] ProjectWindowPlacement wraps project's frame, toolkit-neutrally --- src/Project.cpp | 12 +++++++++++- src/Project.h | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Project.cpp b/src/Project.cpp index cc3e478d8..b64522fce 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -14,7 +14,8 @@ #include "KeyboardCapture.h" #include "TempDirectory.h" -#include "./widgets/ErrorDialog.h" +#include "widgets/ErrorDialog.h" +#include "widgets/wxWidgetsBasicUI.h" #include #include @@ -199,6 +200,15 @@ AUDACITY_DLL_API const wxFrame &GetProjectFrame( const AudacityProject &project return *ptr; } +std::unique_ptr +ProjectFramePlacement( AudacityProject *project ) +{ + if (!project) + return std::make_unique(); + return std::make_unique( + &GetProjectFrame(*project)); +} + AUDACITY_DLL_API wxWindow &GetProjectPanel( AudacityProject &project ) { auto ptr = project.GetPanel(); diff --git a/src/Project.h b/src/Project.h index 7273d1461..f703c3459 100644 --- a/src/Project.h +++ b/src/Project.h @@ -22,6 +22,7 @@ class wxFrame; class wxWindow; +namespace BasicUI { class WindowPlacement; } class AudacityProject; @@ -176,6 +177,11 @@ inline const wxFrame *FindProjectFrame( const AudacityProject *project ) { return project ? &GetProjectFrame( *project ) : nullptr; } +//! Make a WindowPlacement object suitable for `project` (which may be null) +/*! @post return value is not null */ +AUDACITY_DLL_API std::unique_ptr +ProjectFramePlacement( AudacityProject *project ); + ///\brief Get the main sub-window of the project frame that displays track data // (as a wxWindow only, when you do not need to use the subclass TrackPanel) AUDACITY_DLL_API wxWindow &GetProjectPanel( AudacityProject &project );