20#include "../../../ui/EnvelopeHandle.h"
21#include "../../../ui/TimeShiftHandle.h"
24#include "../../../../EnvelopeEditor.h"
25#include "../../../../ProjectSettings.h"
28#include "../../../../TrackArt.h"
29#include "../../../../TrackArtist.h"
30#include "../../../../TrackPanelDrawingContext.h"
31#include "../../../../TrackPanelMouseEvent.h"
35#include "../../../../WaveTrackLocation.h"
36#include "../../../../prefs/WaveformSettings.h"
40#include <wx/graphics.h>
45 {
wxT(
"Waveform"),
XXO(
"Wa&veform") }
58 std::static_pointer_cast< WaveTrack >( view.FindTrack() );
61 st, pProject, currentTool, bMultiTool, pTrack);
62 auto &results = pair.second;
75 results.push_back(result);
77 view.mTimeShiftHandle, st.
state, st.
rect, pTrack )))
80 results.push_back(result);
84 results.push_back(result);
87 switch ( currentTool ) {
93 viewInfo.PositionToTime(st.
state.m_x, st.
rect.GetX());
94 auto envelope = pTrack->GetEnvelopeAtTime(time);
96 view.mEnvelopeHandle, envelope,
false);
101 view.mSampleHandle, st.
state, pTrack );
108 results.push_back(result);
112 return std::move( results );
119#ifdef EXPERIMENTAL_HALF_WAVE
121 gPrefs->Read(
wxT(
"/GUI/CollapseToHalfWave"), &bHalfWave,
false);
127 cache.SetDisplayBounds( -0.01f, 1.0f );
130 cache.SetDisplayBounds( -1.0f, 1.0f );
144 return std::make_shared<WaveformVRulerControls>( shared_from_this() );
151 int leftOffset,
const wxRect &rect,
153 float zoomMin,
float zoomMax,
154 int zeroLevelYCoordinate,
155 bool dB,
float dBRange,
156 double t0,
double t1,
157 bool bIsSyncLockSelected,
158 bool highlightEnvelope)
160 auto &dc = context.
dc;
162 const auto &zoomInfo = *artist->pZoomInfo;
174 int halfHeight = wxMax(h / 2, 1);
175 int maxtop, lmaxtop = 0;
176 int mintop, lmintop = 0;
177 int maxbot, lmaxbot = 0;
178 int minbot, lminbot = 0;
179 bool sel, lsel =
false;
183 const auto &blankBrush = artist->blankBrush;
184 const auto &selectedBrush = artist->selectedBrush;
185 const auto &unselectedBrush = artist->unselectedBrush;
187 dc.SetPen(*wxTRANSPARENT_PEN);
188 dc.SetBrush(blankBrush);
189 dc.DrawRectangle(rect);
192 int selectedX = zoomInfo.TimeToPosition(t0, -leftOffset);
194 double time = zoomInfo.PositionToTime(0, -leftOffset), nextTime;
195 for (xx = 0; xx < rect.width; ++xx, time = nextTime) {
196 nextTime = zoomInfo.PositionToTime(xx + 1, -leftOffset);
202 h, dB,
true, dBRange,
true);
204 h, dB,
false, dBRange,
true);
207 h, dB,
false, dBRange,
true);
209 h, dB,
true, dBRange,
true);
215 const auto drawEnvelope = artist->drawEnvelope;
216 if (!drawEnvelope || maxbot > mintop) {
221 sel = (t0 <= time && nextTime < t1);
222 sel = sel || (xx == selectedX);
224 sel = sel && !bIsSyncLockSelected;
226 if (lmaxtop == maxtop &&
234 dc.SetBrush(lsel ? selectedBrush : unselectedBrush);
238 if (lmaxbot < lmintop - 1) {
239 dc.DrawRectangle(l, rect.y + lmaxtop, w, lmaxbot - lmaxtop);
240 dc.DrawRectangle(l, rect.y + lmintop, w, lminbot - lmintop);
243 dc.DrawRectangle(l, rect.y + lmaxtop, w, lminbot - lmaxtop);
246 if (highlightEnvelope && lmaxbot < lmintop - 1) {
248 dc.DrawRectangle(l, rect.y + lmaxbot, w, lmintop - lmaxbot);
259 dc.SetBrush(lsel ? selectedBrush : unselectedBrush);
262 if (lmaxbot < lmintop - 1) {
263 dc.DrawRectangle(l, rect.y + lmaxtop, w, lmaxbot - lmaxtop);
264 dc.DrawRectangle(l, rect.y + lmintop, w, lminbot - lmintop);
267 dc.DrawRectangle(l, rect.y + lmaxtop, w, lminbot - lmaxtop);
269 if (highlightEnvelope && lmaxbot < lmintop - 1) {
271 dc.DrawRectangle(l, rect.y + lmaxbot, w, lmintop - lmaxbot);
275 if (bIsSyncLockSelected && t0 < t1) {
276 const int begin = std::max(0,
std::min(rect.width, (
int)(zoomInfo.TimeToPosition(t0, -leftOffset))));
277 const int end = std::max(0,
std::min(rect.width, (
int)(zoomInfo.TimeToPosition(t1, -leftOffset))));
284 if (zeroLevelYCoordinate >= rect.GetTop() &&
285 zeroLevelYCoordinate <= rect.GetBottom()) {
286 dc.SetPen(*wxBLACK_PEN);
288 rect.x + rect.width - 1, zeroLevelYCoordinate);
297 : rect(x, y, w, h), averageZoom(zoom), inFisheye(i)
302 (std::vector<WavePortion> &portions,
const wxRect &rect,
const ZoomInfo &zoomInfo,
312 ZoomInfo::Intervals::const_iterator it = intervals.begin(),
end = intervals.end(), prev;
313 wxASSERT(it !=
end && it->position == rect.x);
314 const int rightmost = rect.x + rect.width;
315 for (
int left = rect.x; left < rightmost;) {
316 while (it !=
end && it->position <= left)
320 const int right = std::max(left, (
int)(it->position));
321 const int width = right - left;
325 prev->averageZoom, prev->inFisheye)
333 float zoomMin,
float zoomMax,
334 bool dB,
float dBRange,
335 const float *
min,
const float *max,
const float *rms,
const int *bl,
338 auto &dc = context.
dc;
342 int lasth1 = std::numeric_limits<int>::max();
352 const auto bShowClipping = artist->mShowClipping;
354 clipped.
reinit(
size_t(rect.width) );
357 long pixAnimOffset = (long)fabs((
double)(wxDateTime::Now().GetTicks() * -10)) +
358 wxDateTime::Now().GetMillisecond() / 100;
360 const auto ms = wxDateTime::Now().GetMillisecond();
361 const auto ticks = (long)fabs((
double)(wxDateTime::Now().GetTicks() * -10));
363 bool drawStripes =
true;
364 bool drawWaveform =
true;
366 const auto &muteSamplePen = artist->muteSamplePen;
367 const auto &samplePen = artist->samplePen;
369 dc.SetPen(muted ? muteSamplePen : samplePen);
370 for (
int x0 = 0; x0 < rect.width; ++x0) {
371 int xx = rect.x + x0;
373 v =
min[x0] * env[x0];
374 if (clipped && bShowClipping && (v <= -
MAX_AUDIO))
376 if (clipcnt == 0 || clipped[clipcnt - 1] != xx) {
377 clipped[clipcnt++] = xx;
381 rect.height, dB,
true, dBRange,
true);
383 v = max[x0] * env[x0];
384 if (clipped && bShowClipping && (v >=
MAX_AUDIO))
386 if (clipcnt == 0 || clipped[clipcnt - 1] != xx) {
387 clipped[clipcnt++] = xx;
391 rect.height, dB,
true, dBRange,
true);
406 r1[x0] =
GetWaveYPos(-rms[x0] * env[x0], zoomMin, zoomMax,
407 rect.height, dB,
true, dBRange,
true);
408 r2[x0] =
GetWaveYPos(rms[x0] * env[x0], zoomMin, zoomMax,
409 rect.height, dB,
true, dBRange,
true);
411 if (r1[x0] > h1 - 1) {
414 if (r2[x0] < h2 + 1) {
417 if (r2[x0] > r1[x0]) {
424 dc.SetPen((bl[x0] % 2) ? muteSamplePen : samplePen);
425 for (
int yy = 0; yy < rect.height / 25 + 1; ++yy) {
429 rect.y + 25 * yy + (x0 ) % 25,
431 rect.y + 25 * yy + (x0 ) % 25 + 6);
439 dc.SetPen(samplePen);
440 triX = fabs((
double)((x0 + pixAnimOffset) % (2 * rect.height)) - rect.height) + rect.height;
441 for (
int yy = 0; yy < rect.height; ++yy) {
442 if ((yy + triX) % rect.height == 0) {
443 dc.DrawPoint(xx, rect.y + yy);
449 dc.SetPen(muted ? muteSamplePen : samplePen);
457 const auto &muteRmsPen = artist->muteRmsPen;
458 const auto &rmsPen = artist->rmsPen;
460 dc.SetPen(muted ? muteRmsPen : rmsPen);
461 for (
int x0 = 0; x0 < rect.width; ++x0) {
462 int xx = rect.x + x0;
465 else if (r1[x0] != r2[x0]) {
466 AColor::Line(dc, xx, rect.y + r2[x0], xx, rect.y + r1[x0]);
472 const auto &muteClippedPen = artist->muteClippedPen;
473 const auto &clippedPen = artist->clippedPen;
475 dc.SetPen(muted ? muteClippedPen : clippedPen);
476 while (--clipcnt >= 0) {
477 int xx = clipped[clipcnt];
484 int leftOffset,
const wxRect &rect,
485 float zoomMin,
float zoomMax,
486 bool dB,
float dBRange,
488 bool showPoints,
bool muted,
491 auto &dc = context.
dc;
493 const auto &zoomInfo = *artist->pZoomInfo;
497 const double t0 = std::max(0.0, zoomInfo.PositionToTime(0, -leftOffset) - toffset);
503 const double t1 = zoomInfo.PositionToTime(rect.width - 1, -leftOffset) - toffset;
508 auto slen =
std::min(snSamples - s0, s1 - s0 + 1).as_size_t();
513 Floats buffer{ size_t(slen) };
523 const auto bShowClipping = artist->mShowClipping;
525 clipped.
reinit(
size_t(slen) );
527 const auto &muteSamplePen = artist->muteSamplePen;
528 const auto &samplePen = artist->samplePen;
529 auto &pen = highlight ?
AColor::uglyPen : muted ? muteSamplePen : samplePen;
532 for (
decltype(slen) s = 0; s < slen; s++) {
533 const double time = toffset + (s + s0).as_double() / rate;
536 (
int)(zoomInfo.TimeToPosition(time, -leftOffset))));
542 const double tt = buffer[s] * value;
545 clipped[clipcnt++] = xx;
550 rect.height, dB,
true, dBRange,
false)));
556 const auto bigPoints = artist->bigPoints;
557 const int tickSize = bigPoints ? 4 : 3;
560 pr.height = tickSize;
562 const auto &dragsampleBrush = artist->dragsampleBrush;
563 const auto &sampleBrush = artist->sampleBrush;
564 auto &brush = highlight
566 : bigPoints ? dragsampleBrush : sampleBrush;
567 dc.SetBrush( brush );
568 for (
decltype(slen) s = 0; s < slen; s++) {
569 if (ypos[s] >= 0 && ypos[s] < rect.height) {
570 pr.x = rect.x + xpos[s] - tickSize/2;
571 pr.y = rect.y + ypos[s] - tickSize/2;
577 const auto sampleDisplay = artist->mSampleDisplay;
580 int yZero =
GetWaveYPos(0.0, zoomMin, zoomMax, rect.height, dB,
true, dBRange,
false);
581 yZero = rect.y + std::max(-1,
std::min(rect.height, yZero));
582 for (
decltype(slen) s = 0; s < slen; s++) {
584 rect.x + xpos[s], rect.y + ypos[s],
585 rect.x + xpos[s], yZero);
590 for (
decltype(slen) s = 0; s < slen - 1; s++) {
592 rect.x + xpos[s], rect.y + ypos[s],
593 rect.x + xpos[s + 1], rect.y + ypos[s + 1]);
599 const auto &muteClippedPen = artist->muteClippedPen;
600 const auto &clippedPen = artist->clippedPen;
601 dc.SetPen(muted ? muteClippedPen : clippedPen);
602 while (--clipcnt >= 0) {
603 auto s = clipped[clipcnt];
604 AColor::Line(dc, rect.x + s, rect.y, rect.x + s, rect.y + rect.height);
611 const wxRect &rect,
int x0,
int y0,
int cy,
bool top )
613 auto &dc = context.
dc;
615 int xx = rect.x + x0;
616 int yy = rect.y + cy;
623 else if (y0 > rect.height) {
639 const wxRect &rect,
const double env[],
640 float zoomMin,
float zoomMax,
641 bool dB,
float dBRange,
bool highlight)
643 auto &dc = context.
dc;
650 for (
int x0 = 0; x0 < rect.width; ++x0) {
651 int cenvTop =
GetWaveYPos(env[x0], zoomMin, zoomMax,
652 h, dB,
true, dBRange,
true);
654 int cenvBot =
GetWaveYPos(-env[x0], zoomMin, zoomMax,
655 h, dB,
true, dBRange,
true);
657 int envTop =
GetWaveYPos(env[x0], zoomMin, zoomMax,
658 h, dB,
true, dBRange,
false);
660 int envBot =
GetWaveYPos(-env[x0], zoomMin, zoomMax,
661 h, dB,
true, dBRange,
false);
664 if (cenvBot - cenvTop < 9) {
665 int value = (int)((zoomMax / (zoomMax - zoomMin)) * h);
670 DrawEnvLine( context, rect, x0, envTop, cenvTop,
true );
671 DrawEnvLine( context, rect, x0, envBot, cenvBot,
false );
686 auto &dc = context.
dc;
688 const auto &selectedRegion = *artist->pSelectedRegion;
689 const auto &zoomInfo = *artist->pZoomInfo;
693 bool highlightEnvelope =
false;
694#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
709 false, track, clip, rect, selectedRegion, zoomInfo };
710 const wxRect &hiddenMid =
params.hiddenMid;
713 if (hiddenMid.width <= 0) {
717 const double &t0 =
params.t0;
718 const double &tOffset =
params.tOffset;
719 const double &h =
params.h;
720 const double &tpre =
params.tpre;
721 const double &tpost =
params.tpost;
722 const double &t1 =
params.t1;
723 const double &averagePixelsPerSample =
params.averagePixelsPerSample;
724 const double &rate =
params.rate;
725 double leftOffset =
params.leftOffset;
726 const wxRect &mid =
params.mid;
729 const float dBRange =
settings.dBRange;
731 dc.SetPen(*wxTRANSPARENT_PEN);
733 artist->SetColours( iColorIndex );
737 float zoomMin, zoomMax;
739 cache.GetDisplayBounds(zoomMin, zoomMax);
741 std::vector<double> vEnv(mid.width);
742 double *
const env = &vEnv[0];
750 env, mid.width, leftOffset, zoomInfo );
766 cache.ZeroLevelYCoordinate(mid),
775 averagePixelsPerSample * rate;
779 std::vector<WavePortion> portions;
781 const unsigned nPortions = portions.size();
784 const double threshold1 = 0.5 * rate;
786 const double threshold2 = 3 * rate;
791 bool showIndividualSamples =
false;
792 for (
unsigned ii = 0; !showIndividualSamples && ii < nPortions; ++ii) {
794 showIndividualSamples =
798 if (!showIndividualSamples) {
809 if (!clipCache.GetWaveDisplay( *clip, display,
817 for (
unsigned ii = 0; ii < nPortions; ++ii) {
819 const bool showIndividualSamples = portion.
averageZoom > threshold1;
820 const bool showPoints = portion.
averageZoom > threshold2;
821 wxRect& rectPortion = portion.
rect;
822 rectPortion.Intersect(mid);
823 wxASSERT(rectPortion.width >= 0);
825 float *useMin = 0, *useMax = 0, *useRms = 0;
828 int skipped = 0, skippedLeft = 0, skippedRight = 0;
830 if (!showIndividualSamples) {
835 for (; jj < rectPortion.width; ++jj) {
837 zoomInfo.PositionToTime(jj, -leftOffset) - tOffset;
838 const auto sample = (
sampleCount)floor(time * rate + 0.5);
844 if (sample >= numSamples)
846 fisheyeDisplay.
where[jj - skippedLeft] = sample;
849 skippedRight = rectPortion.width - jj;
850 skipped = skippedRight + skippedLeft;
851 rectPortion.width -= skipped;
855 fisheyeDisplay.
where[jj - skippedLeft] =
856 1 + fisheyeDisplay.
where[jj - skippedLeft - 1];
857 fisheyeDisplay.
width -= skipped;
859 if (rectPortion.width > 0)
860 if (!clipCache.GetWaveDisplay( *clip,
861 fisheyeDisplay, t0, -1.0))
863 useMin = fisheyeDisplay.
min;
864 useMax = fisheyeDisplay.
max;
865 useRms = fisheyeDisplay.
rms;
866 useBl = fisheyeDisplay.
bl;
870 const int pos = leftOffset -
params.hiddenLeftOffset;
871 useMin = display.
min + pos;
872 useMax = display.
max + pos;
873 useRms = display.
rms + pos;
874 useBl = display.
bl + pos;
877 leftOffset += skippedLeft;
879 if (rectPortion.width > 0) {
880 if (!showIndividualSamples) {
881 std::vector<double> vEnv2(rectPortion.width);
882 double *
const env2 = &vEnv2[0];
890 env2, rectPortion.width, leftOffset, zoomInfo );
895 useMin, useMax, useRms, useBl, muted );
898 bool highlight =
false;
899#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
901 highlight = target && target->
GetTrack().get() == track;
904 context, leftOffset, rectPortion, zoomMin, zoomMax,
907 showPoints, muted, highlight );
911 leftOffset += rectPortion.width + skippedRight;
914 const auto drawEnvelope = artist->drawEnvelope;
917 context, mid, env, zoomMin, zoomMax, dB, dBRange, highlightEnvelope );
919 context, mid, dB, dBRange, zoomMin, zoomMax,
true, rect.x - mid.x );
924 if (h == 0.0 && tOffset < 0.0) {
935 bool rightwards,
bool highlight )
937 auto &dc = context.
dc;
939 const int border = 3;
942 const int barSpacing = 4;
943 const int barWidth = 3;
947 if (rect.height <= ((taper+border + barSpacing) * 2)) {
950 if (rect.width <= (width * 2 + border * 3)) {
955 int leftTaper = rightwards ? 0 : 6;
956 int rightTaper = rightwards ? 6 : 0;
958 int xLeft = rightwards ? (rect.x + border - 2)
959 : (rect.x + rect.width + 1 - (border + width));
960 int yTop = rect.y + border;
961 int yBot = rect.y + rect.height - border - 1;
964 AColor::Line(dc, xLeft, yBot - leftTaper, xLeft, yTop + leftTaper);
965 AColor::Line(dc, xLeft, yTop + leftTaper, xLeft + xFlat, yTop);
966 AColor::Line(dc, xLeft + xFlat, yTop, xLeft + width, yTop + rightTaper);
969 AColor::Line(dc, xLeft + width, yTop + rightTaper, xLeft + width, yBot - rightTaper);
970 AColor::Line(dc, xLeft + width, yBot - rightTaper, xLeft + width-xFlat, yBot);
971 AColor::Line(dc, xLeft + width - xFlat, yBot, xLeft, yBot - leftTaper);
973 int firstBar = yTop + taper + taper / 2;
974 int nBars = (yBot - yTop - taper * 3) / barSpacing + 1;
975 xLeft += (width - barWidth + 1) / 2;
980 for (i = 0;i < nBars; i++) {
981 yy = firstBar + barSpacing * i;
985 for(i = 0;i < nBars; i++){
986 yy = firstBar + barSpacing * i + 1;
1001 auto &dc = context.
dc;
1004 bool highlight =
false;
1005 bool gripHit =
false;
1006#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
1008 gripHit = target && target->
IsGripHit();
1009 highlight = target && target->GetTrack().get() == track;
1014 const auto &blankSelectedBrush = artist->blankSelectedBrush;
1015 const auto &blankBrush = artist->blankBrush;
1017 context, rect, track, blankSelectedBrush, blankBrush );
1019 for (
const auto& clip : track->
GetClips())
1022 dB, muted, clip.get() == selectedClip);
1026 const auto drawSliders = artist->drawSliders;
1037 auto &dc = context.
dc;
1046 locationsCache.Update( *channel );
1049 const auto wt = std::static_pointer_cast<const WaveTrack>(
1050 FindTrack()->SubstitutePendingChangedTrack());
1053 const auto hasSolo = artist->hasSolo;
1054 bool muted = (hasSolo || wt->GetMute()) &&
1057#if defined(__WXMAC__)
1058 wxAntialiasMode aamode = dc.GetGraphicsContext()->GetAntialiasMode();
1059 dc.GetGraphicsContext()->SetAntialiasMode(wxANTIALIAS_NONE);
1063 wxASSERT(waveTrackView.use_count());
1065 auto selectedClip = waveTrackView->GetSelectedClip().lock();
1066 DoDraw(context, wt.get(), selectedClip.get(), rect, muted);
1068#if defined(__WXMAC__)
1069 dc.GetGraphicsContext()->SetAntialiasMode(aamode);
1077 return std::make_shared< WaveformView >( view );
1087#include "../../../../widgets/PopupMenuTable.h"
1090#include "../../../../RefreshCode.h"
1127 return XXO(
"Instrument %i").Format( colorIndex+1 );
1135 const auto &track = *
static_cast<WaveTrack*
>(pData->pTrack);
1136 auto &project = pData->project;
1139 menu.Check(
id,
id == me.IdOfWaveColor( track.GetWaveColorIndex() ) );
1140 menu.Enable(
id, !unsafe );
1144 std::call_once(
flag, [
this]{
1146 OnInstrument1ID = hostTable.ReserveId();
1147 OnInstrument2ID = hostTable.ReserveId();
1148 OnInstrument3ID = hostTable.ReserveId();
1149 OnInstrument4ID = hostTable.ReserveId();
1165{
return OnInstrument1ID + WaveColor;}
1171 int id =
event.GetId();
1180 channel->SetWaveColorIndex(newWaveColor);
1185 XO(
"WaveColor Change"));
1194 {
"SubViews/Extra" },
1195 std::make_unique<PopupMenuSection>(
"WaveColor",
1197 PopupMenuTable::Computed< WaveTrackPopupMenuTable >(
1201 const auto displays = view.GetDisplays();
1202 bool hasWaveform = (displays.end() != std::find(
1203 displays.begin(), displays.end(),
std::shared_ptr< UIHandle > UIHandlePtr
EffectDistortionSettings params
XXO("&Cut/Copy/Paste Toolbar")
int GetWaveYPos(float value, float min, float max, int height, bool dB, bool outer, float dBr, bool clip)
static Settings & settings()
WaveTrackPopupMenuTable & GetWaveTrackMenuTable()
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
static void Light(wxDC *dc, bool selected, bool highlight=false)
static void Dark(wxDC *dc, bool selected, bool highlight=false)
void reinit(Integral count, bool initialize=false)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrie...
std::shared_ptr< Track > FindTrack()
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.
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 WaveTrackHitTest(std::weak_ptr< EnvelopeHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< WaveTrack > &wt)
static UIHandlePtr HitAnywhere(std::weak_ptr< EnvelopeHandle > &holder, Envelope *envelope, bool timeTrack)
Envelope * GetEnvelope() const
double GetValue(double t, double sampleDur=0) const
Get envelope value at time t.
@ WaveformView
Time required to draw a single clip.
static Stopwatch CreateStopwatch(SectionID section) noexcept
Create a Stopwatch for the section specified.
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
static UIHandlePtr HitAnywhere(std::weak_ptr< SampleHandle > &holder, const wxMouseState &state, const std::shared_ptr< WaveTrack > &pTrack)
static UIHandlePtr HitTest(std::weak_ptr< SampleHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< WaveTrack > &pTrack)
std::shared_ptr< WaveTrack > GetTrack() const
double LongSamplesToTime(sampleCount pos) const
Convert correctly between a number of samples and an (absolute) time in seconds.
sampleCount TimeToLongSamples(double t0) const
Convert correctly between an (absolute) time in seconds and a number of samples.
static bool IsSelectedOrSyncLockSelected(const Track *pTrack)
static UIHandlePtr HitTest(std::weak_ptr< TimeShiftHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< Track > &pTrack)
static TrackArtist * Get(TrackPanelDrawingContext &)
bool GetSelected() const
Selectedness is always the same for all channels of a group.
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
virtual void DoSetMinimized(bool isMinimized)
Holds a msgid for the translation catalog; may also bind format arguments.
static ViewInfo & Get(AudacityProject &project)
This allows multiple clips to be a part of one WaveTrack.
double GetPlayStartTime() const noexcept
bool GetSamples(samplePtr buffer, sampleFormat format, sampleCount start, size_t len, bool mayThrow=true) const
sampleCount GetPlaySamplesCount() const
int GetColourIndex() const
A Track that contains audio waveform data.
WaveClipHolders & GetClips()
const std::vector< Location > & Get() const
static void DrawBoldBoundaries(TrackPanelDrawingContext &context, const WaveTrack *track, const wxRect &rect)
std::pair< bool, std::vector< UIHandlePtr > > DoDetailedHitTest(const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool, const std::shared_ptr< WaveTrack > &wt)
std::weak_ptr< WaveTrackView > GetWaveTrackView() const
static WaveTrackView & Get(WaveTrack &track)
static bool ClipDetailsVisible(const WaveClip &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)
void FindIntervals(double rate, Intervals &results, int64 width, int64 origin=0) const
std::vector< Interval > Intervals
Positions or offsets within audio files need a wide type.
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Namespace containing an enum 'what to do on a refresh?'.
std::unique_ptr< BaseItem > BaseItemPtr
std::unique_ptr< IndirectItem > Indirect(const BaseItemSharedPtr &ptr)
A convenience function.
AUDACITY_DLL_API void DrawSyncLockTiles(TrackPanelDrawingContext &context, const wxRect &rect)
AUDACITY_DLL_API void DrawClipFolded(wxDC &dc, const wxRect &rect)
AUDACITY_DLL_API void DrawClipEdges(wxDC &dc, const wxRect &clipRect, bool selected=false)
AUDACITY_DLL_API void DrawBackgroundWithSelection(TrackPanelDrawingContext &context, const wxRect &rect, const Track *track, const wxBrush &selBrush, const wxBrush &unselBrush, bool useSelection=true)
AUDACITY_DLL_API void DrawNegativeOffsetTrackArrows(TrackPanelDrawingContext &context, const wxRect &rect)
AuthorizationHandler handler
static wxRect GetClipRect(const WaveClip &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect, bool *outShowSamples=nullptr)