1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-06 17:13:49 +01:00

Remove calls to TrackPanel::FindTrackRect for finding control area

This commit is contained in:
Paul Licameli
2018-11-19 11:03:41 -05:00
parent 6f31a9f7dc
commit 15777834e0
5 changed files with 15 additions and 15 deletions

View File

@@ -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()

View File

@@ -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<TrackPanelNode> 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);

View File

@@ -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

View File

@@ -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__

View File

@@ -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