diff --git a/src/LabelTrack.cpp b/src/LabelTrack.cpp index bc7a5a5dd..7cae84948 100644 --- a/src/LabelTrack.cpp +++ b/src/LabelTrack.cpp @@ -3079,7 +3079,8 @@ int LabelTrack::DialogForLabelName( auto trackPanel = project.GetTrackPanel(); auto &viewInfo = project.GetViewInfo(); - wxPoint position = trackPanel->FindTrackRect(trackPanel->GetFocusedTrack(), false).GetBottomLeft(); + wxPoint position = + trackPanel->FindTrackRect(trackPanel->GetFocusedTrack()).GetBottomLeft(); // The start of the text in the text box will be roughly in line with the label's position // if it's a point label, or the start of its region if it's a region label. position.x += trackPanel->GetLabelWidth() diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 905d6703c..5d7ae3ba3 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -275,7 +275,8 @@ TrackPanel::~TrackPanel() LWSlider *TrackPanel::GainSlider( const WaveTrack *wt ) { - auto rect = FindTrackRect( wt, true ); + auto pControls = wt->GetTrackControl(); + auto rect = FindRect( *pControls ); wxRect sliderRect; TrackInfo::GetGainRect( rect.GetTopLeft(), sliderRect ); return TrackInfo::GainSlider(sliderRect, wt, false, this); @@ -283,7 +284,8 @@ LWSlider *TrackPanel::GainSlider( const WaveTrack *wt ) LWSlider *TrackPanel::PanSlider( const WaveTrack *wt ) { - auto rect = FindTrackRect( wt, true ); + auto pControls = wt->GetTrackControl(); + auto rect = FindRect( *pControls ); wxRect sliderRect; TrackInfo::GetPanRect( rect.GetTopLeft(), sliderRect ); return TrackInfo::PanSlider(sliderRect, wt, false, this); @@ -292,7 +294,8 @@ LWSlider *TrackPanel::PanSlider( const WaveTrack *wt ) #ifdef EXPERIMENTAL_MIDI_OUT LWSlider *TrackPanel::VelocitySlider( const NoteTrack *nt ) { - auto rect = FindTrackRect( nt, true ); + auto pControls = nt->GetTrackControl(); + auto rect = FindRect( *pControls ); wxRect sliderRect; TrackInfo::GetVelocityRect( rect.GetTopLeft(), sliderRect ); return TrackInfo::VelocitySlider(sliderRect, nt, false, this); @@ -2166,7 +2169,7 @@ std::shared_ptr TrackPanel::Root() // This finds the rectangle of a given track (including all channels), // either that of the label 'adornment' or the track itself // The given track is assumed to be the first channel -wxRect TrackPanel::FindTrackRect( const Track * target, bool label ) +wxRect TrackPanel::FindTrackRect( const Track * target ) { if (!target) { return { 0, 0, 0, 0 }; @@ -2197,10 +2200,7 @@ wxRect TrackPanel::FindTrackRect( const Track * target, bool label ) rect.x += kLeftMargin; - if (label) - rect.width = GetVRulerOffset() - kLeftMargin; - else - rect.width -= (kLeftMargin + kRightMargin); + rect.width -= (kLeftMargin + kRightMargin); rect.y += kTopMargin; rect.height -= (kTopMargin + kBottomMargin); diff --git a/src/TrackPanel.h b/src/TrackPanel.h index ce2db1a10..8f55fa0de 100644 --- a/src/TrackPanel.h +++ b/src/TrackPanel.h @@ -341,10 +341,9 @@ public: void MakeParentRedrawScrollbars(); - // If label, rectangle includes track control panel only. - // If !label, rectangle includes all of that, and the vertical ruler, and - // the proper track area. - wxRect FindTrackRect( const Track * target, bool label ); + // Rectangle includes track control panel, and the vertical ruler, and + // the proper track area of all channels, and the separators between them. + wxRect FindTrackRect( const Track * target ); protected: void MakeParentModifyState(bool bWantsAutoSave); // if true, writes auto-save file. Should set only if you really want the state change restored after diff --git a/src/TrackPanelAx.cpp b/src/TrackPanelAx.cpp index 14bb44456..44d91f4d8 100644 --- a/src/TrackPanelAx.cpp +++ b/src/TrackPanelAx.cpp @@ -306,7 +306,7 @@ wxAccStatus TrackPanelAx::GetLocation( wxRect& rect, int elementId ) return wxACC_FAIL; } - rect = mTrackPanel->FindTrackRect( t.get(), false ); + rect = mTrackPanel->FindTrackRect( t.get() ); // Inflate the screen reader's rectangle so it overpaints Audacity's own // yellow focus rectangle. #ifdef __WXMAC__ diff --git a/src/commands/ScreenshotCommand.cpp b/src/commands/ScreenshotCommand.cpp index cbb5578ab..0b1a64bac 100644 --- a/src/commands/ScreenshotCommand.cpp +++ b/src/commands/ScreenshotCommand.cpp @@ -746,7 +746,7 @@ wxRect ScreenshotCommand::GetTrackRect( AudacityProject * pProj, TrackPanel * pa // This rectangle omits the focus ring about the track, and // also within that, a narrow black border with a "shadow" below and // to the right - wxRect rect = panel.FindTrackRect( &t, false ); + wxRect rect = panel.FindTrackRect( &t ); // Enlarge horizontally. // PRL: perhaps it's one pixel too much each side, including some gray