1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-09 06:06:24 +01:00

Vary status string (leftmost in the status bar) for the four kinds of scrub.

This commit is contained in:
Paul Licameli
2016-04-24 15:13:03 -04:00
parent 0d5a409e9a
commit 6147705199
4 changed files with 69 additions and 32 deletions

View File

@@ -107,7 +107,6 @@ ControlToolBar::ControlToolBar()
/* i18n-hint: These are strings for the status bar, and indicate whether Audacity
is playing or recording or stopped, and whether it is paused. */
mStatePlay = XO("Playing");
mStateScrub = XO("Scrubbing");
mStateStop = XO("Stopped");
mStateRecord = XO("Recording");
mStatePause = XO("Paused");
@@ -1175,28 +1174,24 @@ void ControlToolBar::ClearCutPreviewTracks()
int ControlToolBar::WidthForStatusBar(wxStatusBar* const sb)
{
int xMax = 0;
int x, y;
const auto pauseString = wxT(" ") + wxGetTranslation(mStatePause);
sb->GetTextExtent(wxString(wxGetTranslation(mStatePlay)) + wxT(" ") +
wxString(wxGetTranslation(mStatePause)) + wxT("."), &x, &y);
if (x > xMax)
xMax = x;
auto update = [&] (const wxString &state, bool pauseToo) {
int x, y;
sb->GetTextExtent(
wxGetTranslation(state) + ( pauseToo ? pauseString : wxString{} ) + wxT("."),
&x, &y
);
xMax = std::max(x, xMax);
};
sb->GetTextExtent(wxString(wxGetTranslation(mStateStop)) + wxT(" ") +
wxString(wxGetTranslation(mStatePause)) + wxT("."), &x, &y);
if (x > xMax)
xMax = x;
sb->GetTextExtent(wxString(wxGetTranslation(mStateRecord)) + wxT(" ") +
wxString(wxGetTranslation(mStatePause)) + wxT("."), &x, &y);
if (x > xMax)
xMax = x;
update(mStatePlay, true);
update(mStateStop, true);
update(mStateRecord, true);
// Note that Scrubbing + Paused is not allowed.
sb->GetTextExtent(wxString(wxGetTranslation(mStateScrub)) +
wxT("."), &x, &y);
if (x > xMax)
xMax = x;
for(const auto &state : Scrubber::GetAllUntranslatedStatusStrings())
update(state, false);
return xMax + 30; // added constant needed because xMax isn't large enough for some reason, plus some space.
}
@@ -1206,8 +1201,10 @@ wxString ControlToolBar::StateForStatusBar()
wxString state;
auto pProject = GetActiveProject();
if (pProject && pProject->GetScrubber().HasStartedScrubbing())
state = wxGetTranslation(mStateScrub);
auto scrubState =
pProject ? pProject->GetScrubber().GetUntranslatedStateString() : wxString();
if (!scrubState.IsEmpty())
state = wxGetTranslation(scrubState);
else if (mPlay->IsDown())
state = wxGetTranslation(mStatePlay);
else if (mRecord->IsDown())

View File

@@ -158,7 +158,6 @@ class ControlToolBar final : public ToolBar {
// strings for status bar
wxString mStatePlay;
wxString mStateScrub;
wxString mStateStop;
wxString mStateRecord;
wxString mStatePause;