20#include "../../../EnvelopeEditor.h"
21#include "../../../HitTestResult.h"
23#include "../../../TrackArtist.h"
24#include "../../../TrackPanelDrawingContext.h"
25#include "../../../TrackPanelMouseEvent.h"
27#include "../../../widgets/Ruler.h"
28#include "../../../widgets/LinearUpdater.h"
29#include "../../../widgets/TimeFormat.h"
31#include "../../ui/EnvelopeHandle.h"
50 std::vector<UIHandlePtr> results;
53 std::static_pointer_cast< TimeTrack >(
FindTrack() ) );
55 results.push_back(result);
62 return std::make_shared<TimeTrackView>(track.
SharedPointer());
69 std::make_shared<TimeTrackVRulerControls>(shared_from_this());
77 auto &dc = context.
dc;
79 const auto &zoomInfo = *artist->pZoomInfo;
81 bool highlight =
false;
82#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
87 double min = zoomInfo.PositionToTime(0);
88 double max = zoomInfo.PositionToTime(r.width);
109 Doubles envValues{ size_t(mid.width) };
111 0, 0, envValues.get(), mid.width, 0, zoomInfo);
117 double logLower = log(std::max(1.0e-7, rangeLower)),
118 logUpper = log(std::max(1.0e-7, rangeUpper));
120 for (
int x = 0; x < mid.width; x++)
124 y = (double)mid.height * (logUpper - log(envValues[x])) / (logUpper - logLower);
126 y = (double)mid.height * (rangeUpper - envValues[x]) / (rangeUpper - rangeLower);
127 int thisy = r.y + (int)y;
128 AColor::Line(dc, mid.x + x, thisy - 1, mid.x + x, thisy+2);
140 wxRect envRect = rect;
144 const auto dbRange = artist->mdBrange;
147 lower =
LINEAR_TO_DB(std::max(1.0e-7, lower)) / dbRange + 1.0;
148 upper =
LINEAR_TO_DB(std::max(1.0e-7, upper)) / dbRange + 1.0;
158 const wxRect &rect,
unsigned iPass )
162 const auto pList = pTrack->GetOwner();
166 const auto pProject = pList->GetOwner();
185 const auto tt = std::static_pointer_cast<const TimeTrack>(
186 pTrack->SubstitutePendingChangedTrack());
DEFINE_ATTACHED_VIRTUAL_OVERRIDE(DoGetTimeTrackView)
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
static void UseThemeColour(wxDC *dc, int iBrush, int iPen=-1, int alpha=255)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Implements some hit-testing shared by many ChannelView subtypes.
static void GetEnvelopeValues(const Envelope &env, double aligned_time, double sampleDur, double *buffer, int bufferLen, int leftOffset, const ZoomInfo &zoomInfo)
Get many envelope points for pixel columns at once, but don't assume uniform time per pixel.
std::shared_ptr< Track > FindTrack()
void SetData(RulerUpdater::Labels majorLabels, RulerUpdater::Labels minorLabels, RulerUpdater::Labels minorMinorLabels)
static void DrawPoints(const Envelope &env, TrackPanelDrawingContext &context, const wxRect &r, bool dB, double dBRange, float zoomMin, float zoomMax, bool mirrored, int origin=0)
static UIHandlePtr TimeTrackHitTest(std::weak_ptr< EnvelopeHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< TimeTrack > &tt)
Envelope * GetEnvelope() const
void SetTickColour(const wxColour &colour)
void Draw(wxDC &dc) const
void SetLabelEdges(bool labelEdges)
void SetBounds(int left, int top, int right, int bottom)
void SetRange(double min, double max)
wxColour & Colour(int iIndex)
A kind of Track used to 'warp time'.
BoundedEnvelope * GetEnvelope()
bool GetDisplayLog() const
double GetRangeLower() const
double GetRangeUpper() const
~TimeTrackView() override
std::weak_ptr< EnvelopeHandle > mEnvelopeHandle
std::vector< UIHandlePtr > DetailedHitTest(const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool) override
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
std::shared_ptr< ChannelVRulerControls > DoGetVRulerControls() override
TimeTrackView(const TimeTrackView &)=delete
static TrackArtist * Get(TrackPanelDrawingContext &)
std::shared_ptr< Subclass > SharedPointer()
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
static ViewInfo & Get(AudacityProject &project)
void DrawTimeTrack(TrackPanelDrawingContext &context, const TimeTrack &track, Ruler &ruler, const wxRect &rect)
void DrawHorzRulerAndCurve(TrackPanelDrawingContext &context, const wxRect &r, const TimeTrack &track, Ruler &ruler)
For defining overrides of the method.