1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-20 14:47:49 +02:00

Remove AudacityProject::GetScreenEndTime

This commit is contained in:
Paul Licameli 2019-03-27 04:29:27 -04:00
parent ca5bb78abe
commit 69962f62d3
7 changed files with 24 additions and 22 deletions

View File

@ -1983,7 +1983,8 @@ void AudacityProject::FixScrollbars()
LastTime =
std::max(LastTime, mViewInfo.selectedRegion.t1());
const double screen = GetScreenEndTime() - mViewInfo.h;
const double screen =
GetTrackPanel()->GetScreenEndTime() - mViewInfo.h;
const double halfScreen = screen / 2.0;
// If we can scroll beyond zero,
@ -2029,7 +2030,8 @@ void AudacityProject::FixScrollbars()
bool oldhstate;
bool oldvstate;
bool newhstate = (GetScreenEndTime() - mViewInfo.h) < mViewInfo.total;
bool newhstate =
(GetTrackPanel()->GetScreenEndTime() - mViewInfo.h) < mViewInfo.total;
bool newvstate = panelHeight < totalHeight;
#ifdef __WXGTK__
@ -2088,7 +2090,7 @@ void AudacityProject::FixScrollbars()
panelHeight / mViewInfo.scrollStep, TRUE);
if (refresh || (rescroll &&
(GetScreenEndTime() - mViewInfo.h) < mViewInfo.total)) {
(GetTrackPanel()->GetScreenEndTime() - mViewInfo.h) < mViewInfo.total)) {
mTrackPanel->Refresh(false);
}
@ -4745,7 +4747,7 @@ void AudacityProject::Zoom(double level)
// tOnLeft is the amount of time we would need before the selection left edge to center it.
float t0 = mViewInfo.selectedRegion.t0();
float t1 = mViewInfo.selectedRegion.t1();
float tAvailable = GetScreenEndTime() - mViewInfo.h;
float tAvailable = GetTrackPanel()->GetScreenEndTime() - mViewInfo.h;
float tOnLeft = (tAvailable - t0 + t1)/2.0;
// Bug 1292 (Enh) is effectively a request to do this scrolling of the selection into view.
// If tOnLeft is positive, then we have room for the selection, so scroll to it.
@ -5605,11 +5607,6 @@ ContrastDialog *AudacityProject::GetContrastDialog(bool create)
return mContrastDialog.get();
}
double AudacityProject::GetScreenEndTime() const
{
return mTrackPanel->GetScreenEndTime();
}
void AudacityProject::SelectNone()
{
for (auto t : GetTracks()->Any())
@ -5634,7 +5631,7 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
// when there's a selection that's currently at least
// partially on-screen
const double endTime = GetScreenEndTime();
const double endTime = GetTrackPanel()->GetScreenEndTime();
const double duration = endTime - mViewInfo.h;
bool selectionIsOnscreen =
@ -5661,7 +5658,8 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
// Zoom in
ZoomBy(ZoomFactor);
const double newDuration = GetScreenEndTime() - mViewInfo.h;
const double newDuration =
GetTrackPanel()->GetScreenEndTime() - mViewInfo.h;
// Recenter on selCenter
TP_ScrollWindow(selCenter - newDuration / 2);
@ -5673,7 +5671,8 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
double origWidth = duration;
ZoomBy(ZoomFactor);
const double newDuration = GetScreenEndTime() - mViewInfo.h;
const double newDuration =
GetTrackPanel()->GetScreenEndTime() - mViewInfo.h;
double newh = origLeft + (origWidth - newDuration) / 2;
// MM: Commented this out because it was confusing users
@ -5696,10 +5695,10 @@ void AudacityProject::ZoomOutByFactor( double ZoomFactor )
{
//Zoom() may change these, so record original values:
const double origLeft = mViewInfo.h;
const double origWidth = GetScreenEndTime() - origLeft;
const double origWidth = GetTrackPanel()->GetScreenEndTime() - origLeft;
ZoomBy(ZoomFactor);
const double newWidth = GetScreenEndTime() - mViewInfo.h;
const double newWidth = GetTrackPanel()->GetScreenEndTime() - mViewInfo.h;
const double newh = origLeft + (origWidth - newWidth) / 2;
// newh = (newh > 0) ? newh : 0;

View File

@ -393,7 +393,6 @@ public:
void HandleResize();
void UpdateLayout();
double GetScreenEndTime() const;
void ZoomInByFactor( double ZoomFactor );
void ZoomOutByFactor( double ZoomFactor );

View File

@ -290,12 +290,13 @@ void OnGoSelStart(const CommandContext &context)
auto &project = context.project;
auto &viewInfo = project.GetViewInfo();
auto &selectedRegion = viewInfo.selectedRegion;
auto &trackPanel = *project.GetTrackPanel();
if (selectedRegion.isPoint())
return;
project.TP_ScrollWindow(
selectedRegion.t0() - ((project.GetScreenEndTime() - viewInfo.h) / 2));
selectedRegion.t0() - ((trackPanel.GetScreenEndTime() - viewInfo.h) / 2));
}
void OnGoSelEnd(const CommandContext &context)
@ -303,12 +304,13 @@ void OnGoSelEnd(const CommandContext &context)
auto &project = context.project;
auto &viewInfo = project.GetViewInfo();
auto &selectedRegion = viewInfo.selectedRegion;
auto &trackPanel = *project.GetTrackPanel();
if (selectedRegion.isPoint())
return;
project.TP_ScrollWindow(
selectedRegion.t1() - ((project.GetScreenEndTime() - viewInfo.h) / 2));
selectedRegion.t1() - ((trackPanel.GetScreenEndTime() - viewInfo.h) / 2));
}
void OnHistory(const CommandContext &context)

View File

@ -87,7 +87,8 @@ unsigned CommonTrackPanelCell::HandleWheelRotation
// Scrubbing? Expand or contract about the center, ignoring mouse position
if (scrubber.IsScrollScrubbing())
center_h = viewInfo.h + (pProject->GetScreenEndTime() - viewInfo.h) / 2.0;
center_h = viewInfo.h +
(pProject->GetTrackPanel()->GetScreenEndTime() - viewInfo.h) / 2.0;
// Zooming out? Focus on mouse.
else if( steps <= 0 )
center_h = mouse_h;

View File

@ -80,7 +80,7 @@ void EditCursorOverlay::Draw(OverlayPanel &panel, wxDC &dc)
const bool
onScreen = between_incexc(viewInfo.h,
mCursorTime,
mProject->GetScreenEndTime());
mProject->GetTrackPanel()->GetScreenEndTime());
if (!onScreen)
return;

View File

@ -161,7 +161,7 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
bool onScreen = playPos >= 0.0 &&
between_incexc(viewInfo.h - tolerance,
playPos,
mProject->GetScreenEndTime() + tolerance);
mProject->GetTrackPanel()->GetScreenEndTime() + tolerance);
// This displays the audio time, too...
mProject->TP_DisplaySelection();
@ -190,7 +190,7 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
onScreen = playPos >= 0.0 &&
between_incexc(viewInfo.h,
playPos,
mProject->GetScreenEndTime());
mProject->GetTrackPanel()->GetScreenEndTime());
}
}

View File

@ -792,7 +792,8 @@ bool Scrubber::ShouldDrawScrubSpeed()
double Scrubber::FindScrubSpeed(bool seeking, double time) const
{
ViewInfo &viewInfo = mProject->GetViewInfo();
const double screen = mProject->GetScreenEndTime() - viewInfo.h;
const double screen =
mProject->GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
return (seeking ? FindSeekSpeed : FindScrubbingSpeed)
(viewInfo, mMaxSpeed, screen, time);
}