1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-09 05:01:57 +01: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

@@ -27,7 +27,6 @@ Paul Licameli split from AudacityProject.cpp
#include "WaveTrack.h"
#include "prefs/ThemePrefs.h"
#include "prefs/TracksPrefs.h"
#include "toolbars/ControlToolBar.h"
#include "toolbars/ToolManager.h"
#include "tracks/ui/Scrubbing.h"
#include "tracks/ui/TrackView.h"
@@ -815,13 +814,7 @@ void ProjectWindow::Init()
#endif
mIconized = false;
int widths[] = {
0,
ControlToolBar::Get( project ).WidthForStatusBar(statusBar),
-1,
150
};
statusBar->SetStatusWidths(4, widths);
UpdateStatusWidths();
wxString msg = wxString::Format(_("Welcome to Audacity version %s"),
AUDACITY_VERSION_STRING);
statusBar->SetStatusText(msg, mainStatusBarField);
@@ -1341,6 +1334,33 @@ bool ProjectWindow::IsIconized() const
return mIconized;
}
void ProjectWindow::UpdateStatusWidths()
{
enum { nWidths = nStatusBarFields + 1 };
int widths[ nWidths ]{ 0 };
widths[ rateStatusBarField ] = 150;
const auto statusBar = GetStatusBar();
const auto &functions = ProjectStatus::GetStatusWidthFunctions();
// Start from 1 not 0
// Specifying a first column always of width 0 was needed for reasons
// I forget now
for ( int ii = 1; ii <= nStatusBarFields; ++ii ) {
int &width = widths[ ii ];
for ( const auto &function : functions ) {
auto results =
function( mProject, static_cast< StatusBarField >( ii ) );
for ( const auto &string : results.first ) {
int w;
statusBar->GetTextExtent(string, &w, nullptr);
width = std::max<int>( width, w + results.second );
}
}
}
// The main status field is not fixed width
widths[ mainStatusBarField ] = -1;
statusBar->SetStatusWidths( nWidths, widths );
}
void ProjectWindow::OnIconize(wxIconizeEvent &event)
{
//JKC: On Iconizing we get called twice. Don't know