mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-01 16:19:43 +02:00
Remove two call-through functions to TrackPanel from AudacityProject
This commit is contained in:
parent
7e53282164
commit
8f55d55869
@ -420,7 +420,7 @@ void MixerTrackCluster::HandleSliderGain(const bool bWantPushState /*= false*/)
|
||||
GetRight()->SetGain(fValue);
|
||||
|
||||
// Update the TrackPanel correspondingly.
|
||||
mProject->RefreshTPTrack(mTrack.get());
|
||||
mProject->GetTrackPanel()->RefreshTrack(mTrack.get());
|
||||
if (bWantPushState)
|
||||
mProject->PushState(_("Moved gain slider"), _("Gain"), UndoPush::CONSOLIDATE );
|
||||
}
|
||||
@ -433,7 +433,7 @@ void MixerTrackCluster::HandleSliderVelocity(const bool bWantPushState /*= false
|
||||
GetNote()->SetVelocity(fValue);
|
||||
|
||||
// Update the TrackPanel correspondingly.
|
||||
mProject->RefreshTPTrack(mTrack.get());
|
||||
mProject->GetTrackPanel()->RefreshTrack(mTrack.get());
|
||||
if (bWantPushState)
|
||||
mProject->PushState(_("Moved velocity slider"), _("Velocity"), UndoPush::CONSOLIDATE);
|
||||
}
|
||||
@ -448,7 +448,7 @@ void MixerTrackCluster::HandleSliderPan(const bool bWantPushState /*= false*/)
|
||||
GetRight()->SetPan(fValue);
|
||||
|
||||
// Update the TrackPanel correspondingly.
|
||||
mProject->RefreshTPTrack(mTrack.get());
|
||||
mProject->GetTrackPanel()->RefreshTrack(mTrack.get());
|
||||
|
||||
if (bWantPushState)
|
||||
mProject->PushState(_("Moved pan slider"), _("Pan"), UndoPush::CONSOLIDATE );
|
||||
@ -765,7 +765,7 @@ void MixerTrackCluster::OnButton_Mute(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
else
|
||||
// Update only the changed track.
|
||||
mProject->RefreshTPTrack(mTrack.get());
|
||||
mProject->GetTrackPanel()->RefreshTrack(mTrack.get());
|
||||
}
|
||||
|
||||
void MixerTrackCluster::OnButton_Solo(wxCommandEvent& WXUNUSED(event))
|
||||
|
@ -5011,21 +5011,6 @@ void AudacityProject::TP_DisplaySelection()
|
||||
}
|
||||
|
||||
|
||||
// TrackPanel access
|
||||
|
||||
wxSize AudacityProject::GetTPTracksUsableArea()
|
||||
{
|
||||
wxSize s;
|
||||
mTrackPanel->GetTracksUsableArea(&s.x, &s.y);
|
||||
return s;
|
||||
}
|
||||
|
||||
void AudacityProject::RefreshTPTrack(Track* pTrk, bool refreshbacking /*= true*/)
|
||||
{
|
||||
mTrackPanel->RefreshTrack(pTrk, refreshbacking);
|
||||
}
|
||||
|
||||
|
||||
// TrackPanel callback method
|
||||
void AudacityProject::TP_ScrollLeft()
|
||||
{
|
||||
|
@ -441,11 +441,6 @@ public:
|
||||
double PixelWidthBeforeTime(double scrollto) const;
|
||||
void SetHorizontalThumb(double scrollto);
|
||||
|
||||
// PRL: old and incorrect comment below, these functions are used elsewhere than TrackPanel
|
||||
// TrackPanel access
|
||||
wxSize GetTPTracksUsableArea() /* not override */;
|
||||
void RefreshTPTrack(Track* pTrk, bool refreshbacking = true) /* not override */;
|
||||
|
||||
// TrackPanel callback methods, overrides of TrackPanelListener
|
||||
void TP_DisplaySelection() override;
|
||||
void TP_DisplayStatusMessage(const wxString &msg) override;
|
||||
|
@ -337,14 +337,22 @@ void TrackPanel::ApplyUpdatedTheme()
|
||||
}
|
||||
|
||||
|
||||
wxSize TrackPanel::GetTracksUsableArea() const
|
||||
{
|
||||
auto size = GetSize();
|
||||
return {
|
||||
std::max( 0, size.GetWidth() - ( GetLeftOffset() + kRightMargin ) ),
|
||||
size.GetHeight()
|
||||
};
|
||||
}
|
||||
|
||||
void TrackPanel::GetTracksUsableArea(int *width, int *height) const
|
||||
{
|
||||
GetSize(width, height);
|
||||
if (width) {
|
||||
*width -= GetLeftOffset();
|
||||
*width -= kRightMargin;
|
||||
*width = std::max(0, *width);
|
||||
}
|
||||
auto size = GetTracksUsableArea();
|
||||
if (width)
|
||||
*width = size.GetWidth();
|
||||
if (height)
|
||||
*height = size.GetHeight();
|
||||
}
|
||||
|
||||
/// Gets the pointer to the AudacityProject that
|
||||
@ -2862,7 +2870,7 @@ unsigned TrackPanelCell::Char(wxKeyEvent &event, ViewInfo &, wxWindow *)
|
||||
IsVisibleTrack::IsVisibleTrack(AudacityProject *project)
|
||||
: mPanelRect {
|
||||
wxPoint{ 0, project->mViewInfo.vpos },
|
||||
project->GetTPTracksUsableArea()
|
||||
project->GetTrackPanel()->GetTracksUsableArea()
|
||||
}
|
||||
{}
|
||||
|
||||
|
@ -284,6 +284,8 @@ class AUDACITY_DLL_API TrackPanel final
|
||||
|
||||
int GetLeftOffset() const { return GetLabelWidth() + 1;}
|
||||
|
||||
wxSize GetTracksUsableArea() const;
|
||||
|
||||
// Width and height, relative to upper left corner at (GetLeftOffset(), 0)
|
||||
// Either argument may be NULL
|
||||
void GetTracksUsableArea(int *width, int *height) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user