1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 22:12:58 +02:00

ProjectAudioManager doesn't use ProjectWindow, which doesn't use...

ControlToolBar, after we make a system to register functions that calculate
necessary minimum widths for status bar fields.

Also let Scrubbing.cpp register its own strings.

Also be sure to size the status field sufficiently for "Playing at Speed".
This commit is contained in:
Paul Licameli
2019-07-02 18:20:14 -04:00
parent 9f61b67965
commit 68999934e0
11 changed files with 171 additions and 90 deletions

View File

@@ -12,10 +12,13 @@ Paul Licameli
#define __AUDACITY_PROJECT_STATUS__
#endif
#include <utility>
#include <vector>
#include <wx/event.h> // to declare custom event type
#include "ClientData.h" // to inherit
class AudacityProject;
class wxString;
class wxWindow;
enum StatusBarField : int {
@@ -43,6 +46,24 @@ public:
ProjectStatus &operator= ( const ProjectStatus & ) = delete;
~ProjectStatus() override;
// Type of a function to report translated strings, and also report an extra
// margin, to request that the corresponding field of the status bar should
// be wide enough to contain any of those strings plus the margin.
using StatusWidthResult = std::pair< std::vector<wxString>, unsigned >;
using StatusWidthFunction = std::function<
StatusWidthResult( const AudacityProject &, StatusBarField )
>;
using StatusWidthFunctions = std::vector< StatusWidthFunction >;
// Typically a static instance of this struct is used.
struct RegisteredStatusWidthFunction
{
explicit
RegisteredStatusWidthFunction( const StatusWidthFunction &function );
};
static const StatusWidthFunctions &GetStatusWidthFunctions();
const wxString &Get( StatusBarField field = mainStatusBarField ) const;
void Set(const wxString &msg,
StatusBarField field = mainStatusBarField);