mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-02 00:29:41 +02:00
Allow NULL arguments in TrackPanel::GetTracksUsableArea()
This commit is contained in:
parent
e7c7bb84a9
commit
a9ab31dedb
@ -4952,8 +4952,8 @@ void AudacityProject::OnZoomFit()
|
||||
if (len <= 0.0)
|
||||
return;
|
||||
|
||||
int w, h;
|
||||
mTrackPanel->GetTracksUsableArea(&w, &h);
|
||||
int w;
|
||||
mTrackPanel->GetTracksUsableArea(&w, NULL);
|
||||
w -= 10;
|
||||
|
||||
Zoom(w / len);
|
||||
@ -4962,9 +4962,9 @@ void AudacityProject::OnZoomFit()
|
||||
|
||||
void AudacityProject::DoZoomFitV()
|
||||
{
|
||||
int width, height, count;
|
||||
int height, count;
|
||||
|
||||
mTrackPanel->GetTracksUsableArea(&width, &height);
|
||||
mTrackPanel->GetTracksUsableArea(NULL, &height);
|
||||
|
||||
height -= 28;
|
||||
|
||||
|
@ -1074,9 +1074,11 @@ void TrackPanel::SelectTrackLength(Track *t)
|
||||
void TrackPanel::GetTracksUsableArea(int *width, int *height) const
|
||||
{
|
||||
GetSize(width, height);
|
||||
*width -= GetLeftOffset();
|
||||
*width -= kRightMargin;
|
||||
*width = std::max(0, *width);
|
||||
if (width) {
|
||||
*width -= GetLeftOffset();
|
||||
*width -= kRightMargin;
|
||||
*width = std::max(0, *width);
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets the pointer to the AudacityProject that
|
||||
@ -4150,8 +4152,8 @@ void TrackPanel::DoSlide(wxMouseEvent & event)
|
||||
if (mouseTrack == NULL) {
|
||||
// Allow sliding if the pointer is not over any track, but only if x is
|
||||
// within the bounds of the tracks area.
|
||||
int width, height;
|
||||
GetTracksUsableArea(&width, &height);
|
||||
int width;
|
||||
GetTracksUsableArea(&width, NULL);
|
||||
if (event.m_x >= GetLeftOffset() && event.m_x < GetLeftOffset() + width)
|
||||
mouseTrack = mCapturedTrack;
|
||||
else
|
||||
@ -8254,8 +8256,8 @@ void TrackPanel::ScrollIntoView(double pos)
|
||||
{
|
||||
const int screenWidth = rint(mViewInfo->GetScreenWidth());
|
||||
|
||||
int w, h;
|
||||
GetTracksUsableArea( &w, &h );
|
||||
int w;
|
||||
GetTracksUsableArea( &w, NULL );
|
||||
// Or should we just set w = screenWidth ?
|
||||
|
||||
int pixel = mViewInfo->TimeToPosition(pos);
|
||||
|
@ -166,6 +166,7 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel {
|
||||
virtual int GetLeftOffset() const { return GetLabelWidth() + 1;}
|
||||
|
||||
// Width and height, relative to upper left corner at (GetLeftOffset(), 0)
|
||||
// Either argument may be NULL
|
||||
virtual void GetTracksUsableArea(int *width, int *height) const;
|
||||
|
||||
virtual void SelectNone();
|
||||
|
@ -1936,8 +1936,8 @@ void AdornedRulerPanel::OnMouseEvents(wxMouseEvent &evt)
|
||||
|
||||
// Keep Quick-Play within usable track area.
|
||||
TrackPanel *tp = mProject->GetTrackPanel();
|
||||
int mousePosX, width, height;
|
||||
tp->GetTracksUsableArea(&width, &height);
|
||||
int mousePosX, width;
|
||||
tp->GetTracksUsableArea(&width, NULL);
|
||||
mousePosX = std::max(evt.GetX(), tp->GetLeftOffset());
|
||||
mousePosX = std::min(mousePosX, tp->GetLeftOffset() + width - 1);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user