20#include "../../../EnvelopeEditor.h"
21#include "../../../HitTestResult.h"
24#include "../../../TrackArtist.h"
25#include "../../../TrackPanelDrawingContext.h"
26#include "../../../TrackPanelMouseEvent.h"
28#include "../../../widgets/Ruler.h"
29#include "../../../widgets/LinearUpdater.h"
30#include "../../../widgets/TimeFormat.h"
32#include "../../ui/EnvelopeHandle.h"
51 std::vector<UIHandlePtr> results;
54 FindChannel<TimeTrack>());
56 results.push_back(result);
70 std::make_shared<TimeTrackVRulerControls>(shared_from_this());
78 auto &dc = context.
dc;
80 const auto &zoomInfo = *artist->pZoomInfo;
82 bool highlight =
false;
83#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
88 double min = zoomInfo.PositionToTime(0);
89 double max = zoomInfo.PositionToTime(r.width);
110 Doubles envValues{ size_t(mid.width) };
112 0, 0, envValues.get(), mid.width, 0, zoomInfo);
118 double logLower = log(std::max(1.0e-7, rangeLower)),
119 logUpper = log(std::max(1.0e-7, rangeUpper));
121 for (
int x = 0; x < mid.width; x++)
125 y = (double)mid.height * (logUpper - log(envValues[x])) / (logUpper - logLower);
127 y = (double)mid.height * (rangeUpper - envValues[x]) / (rangeUpper - rangeLower);
128 int thisy = r.y + (int)y;
129 AColor::Line(dc, mid.x + x, thisy - 1, mid.x + x, thisy+2);
141 wxRect envRect = rect;
145 const auto dbRange = artist->mdBrange;
148 lower =
LINEAR_TO_DB(std::max(1.0e-7, lower)) / dbRange + 1.0;
149 upper =
LINEAR_TO_DB(std::max(1.0e-7, upper)) / dbRange + 1.0;
159 const wxRect &rect,
unsigned iPass )
163 const auto &pendingTracks = *artist->pPendingTracks;
168 static_cast<const TimeTrack*
>(pChannel.get())->GetOwner();
172 const auto pProject = pList->
GetOwner();
191 const auto &tt =
static_cast<const TimeTrack&
>(
192 pendingTracks.SubstitutePendingChangedChannel(*pChannel));
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...
auto FindChannel() -> std::shared_ptr< Subtype >
May return null.
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.
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< TrackList > GetOwner() const
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.