Pass TrackPanelDrawingContext into TrackPanelDrawable::DrawingArea()

This commit is contained in:
Paul Licameli 2019-12-28 12:25:01 -05:00
parent 996d60de81
commit 7c70d78430
21 changed files with 26 additions and 2 deletions

View File

@ -1125,7 +1125,8 @@ void CellularPanel::Draw( TrackPanelDrawingContext &context, unsigned nPasses )
VisitPostorder( [&]( const wxRect &rect, TrackPanelNode &node ) {
// Draw the node
const auto newRect = node.DrawingArea( rect, panelRect, iPass );
const auto newRect = node.DrawingArea(
context, rect, panelRect, iPass );
if ( newRect.Intersects( panelRect ) )
node.Draw( context, newRect, iPass );
@ -1134,7 +1135,7 @@ void CellularPanel::Draw( TrackPanelDrawingContext &context, unsigned nPasses )
auto target = Target();
if ( target ) {
const auto targetRect =
target->DrawingArea( rect, panelRect, iPass );
target->DrawingArea( context, rect, panelRect, iPass );
if ( targetRect.Intersects( panelRect ) )
target->Draw( context, targetRect, iPass );
}

View File

@ -1240,6 +1240,7 @@ struct LabeledChannelGroup final : TrackPanelGroup {
}
wxRect DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &, unsigned iPass ) override
{
if ( iPass == TrackArtist::PassBorders )
@ -1393,6 +1394,7 @@ void TrackPanelDrawable::Draw(
}
wxRect TrackPanelDrawable::DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &, unsigned )
{
return rect;

View File

@ -33,7 +33,10 @@ public:
// hit-test purposes, spilling over into other parts of the partition of the
// panel area.
// Default implementation returns rect unchanged.
// TrackPanelContext is passed in because sometimes a drawing context is
// needed for text extent calculations.
virtual wxRect DrawingArea(
TrackPanelDrawingContext &context,
const wxRect &rect, const wxRect &panelRect, unsigned iPass );
// Utilities for implementing DrawingArea:

View File

@ -372,6 +372,7 @@ void NoteTrackVZoomHandle::Draw(
}
wxRect NoteTrackVZoomHandle::DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass )
{
if ( iPass == TrackArtist::PassZooming )

View File

@ -61,6 +61,7 @@ private:
const wxRect &rect, unsigned iPass ) override;
wxRect DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
std::weak_ptr<NoteTrack> mpTrack;

View File

@ -90,6 +90,7 @@ void SpectrumVZoomHandle::Draw(
}
wxRect SpectrumVZoomHandle::DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass )
{
return WaveTrackVZoomHandle::DoDrawingArea( rect, panelRect, iPass );

View File

@ -62,6 +62,7 @@ private:
const wxRect &rect, unsigned iPass ) override;
wxRect DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
std::weak_ptr<WaveTrack> mpTrack;

View File

@ -89,6 +89,7 @@ void WaveformVZoomHandle::Draw(
}
wxRect WaveformVZoomHandle::DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass )
{
return WaveTrackVZoomHandle::DoDrawingArea( rect, panelRect, iPass );

View File

@ -62,6 +62,7 @@ private:
const wxRect &rect, unsigned iPass ) override;
wxRect DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
std::weak_ptr<WaveTrack> mpTrack;

View File

@ -134,6 +134,7 @@ void BackgroundCell::Draw(
}
wxRect BackgroundCell::DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &, unsigned iPass )
{
if ( iPass == TrackArtist::PassBackground )

View File

@ -51,6 +51,7 @@ private:
const wxRect &rect, unsigned iPass ) override;
wxRect DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
AudacityProject *mpProject;

View File

@ -401,6 +401,7 @@ void CommonTrackControls::Draw(
}
wxRect CommonTrackControls::DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &, unsigned iPass )
{
if ( iPass == TrackArtist::PassControls )

View File

@ -62,6 +62,7 @@ protected:
const wxRect &rect, unsigned iPass ) override;
wxRect DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
std::weak_ptr<CloseButtonHandle> mCloseHandle;

View File

@ -1050,6 +1050,7 @@ void SelectHandle::Draw(
}
wxRect SelectHandle::DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass )
{
if ( iPass == TrackArtist::PassSnapping )

View File

@ -121,6 +121,7 @@ private:
const wxRect &rect, unsigned iPass ) override;
wxRect DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
//void ResetFreqSelectionPin

View File

@ -863,6 +863,7 @@ void TimeShiftHandle::Draw(
}
wxRect TimeShiftHandle::DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass )
{
if ( iPass == TrackArtist::PassSnapping )

View File

@ -111,6 +111,7 @@ private:
const wxRect &rect, unsigned iPass ) override;
wxRect DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
std::shared_ptr<Track> mCapturedTrack;

View File

@ -121,6 +121,7 @@ void TrackVRulerControls::Draw(
}
wxRect TrackVRulerControls::DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &, unsigned iPass )
{
// Common area change for all subclasses when drawing the controls

View File

@ -55,6 +55,7 @@ protected:
const wxRect &rect, unsigned iPass ) override;
wxRect DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
Track *GetTrack() const;

View File

@ -208,6 +208,7 @@ void ZoomHandle::Draw(
}
wxRect ZoomHandle::DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass )
{
if ( iPass == TrackArtist::PassZooming )

View File

@ -58,6 +58,7 @@ private:
const wxRect &rect, unsigned iPass ) override;
wxRect DrawingArea(
TrackPanelDrawingContext &,
const wxRect &rect, const wxRect &panelRect, unsigned iPass ) override;
bool IsDragZooming() const;