13#include <unordered_set>
19#include <wx/graphics.h>
25#include "../../../../../images/Cursors.h"
28#include "../../../../commands/CommandContext.h"
29#include "../../../../HitTestResult.h"
31#include "../../../../RefreshCode.h"
33#include "../../../../TrackArtist.h"
34#include "../../../../TrackPanel.h"
35#include "../../../../TrackPanelAx.h"
36#include "../../../../TrackPanelDrawingContext.h"
37#include "../../../../TrackPanelMouseEvent.h"
38#include "../../../../TrackPanelResizeHandle.h"
40#include "../../../../prefs/TracksPrefs.h"
42#include "../../../ui/TimeShiftHandle.h"
43#include "../../../ui/ButtonHandle.h"
44#include "../../../../TrackInfo.h"
46#include "../WaveTrackUtils.h"
61 std::unique_ptr<Cloneable<>>
Clone()
const {
62 return std::make_unique<PlacementArray>(*
this); }
64 bool mMultiView{
false };
68key { [](
auto &) {
return std::make_unique<PlacementArray>(); } };
73 return track.
GetGroupData().Track::ChannelGroupAttachments
79 return Get(
const_cast<Track &
>(track));
85 auto &waveTrack = *std::dynamic_pointer_cast<WaveTrack>(
FindTrack());
96 auto &waveTrack = *std::dynamic_pointer_cast<WaveTrack>(
FindTrack());
129 return placement.index < 0 || placement.fraction <= 0;
131 const auto comp = [
this](
size_t ii,
size_t jj ){
133 bool iInvisible = invisible( pi );
136 bool jInvisible = invisible( pj );
139 if ( iInvisible != jInvisible )
141 else if ( !iInvisible )
142 return pi.index < pj.index;
149 auto first = std::find_if(
begin,
end, [
this](
size_t ii){
160 bool rotated =
false;
180 std::rotate( pBegin, pBegin + 1, pEnd );
185 for (
auto pIter = pBegin; pIter != pFirst; ++pIter ) {
187 placement.index = -1;
188 placement.fraction = 0;
191 for (
auto pIter = pFirst; pIter != pEnd; ++pIter )
199 auto iter = std::find_if(
begin,
end, [&](
size_t ii){
200 return mSubViews[ ii ].get() == &subView;
205 std::pair< size_t, bool >
207 wxCoord yy, wxCoord top, wxCoord height )
211 if ( index < (
int)
size ) {
213 if ( yy >= 0 && yy < HotZoneSize && index > 0 )
214 return { index,
true };
219 return { index,
false };
221 return {
size,
false };
230 total += std::max( 0.f, placement.fraction );
233 wxCoord lastCoord = 0;
234 std::vector<wxCoord> result;
237 auto fraction = std::max( 0.f, placement.fraction );
238 wxCoord coord = ( (partial + fraction ) / total ) * totalHeight;
239 auto height = coord - lastCoord;
240 result.emplace_back( height );
250 auto pView =
mwView.lock();
252 auto pTrack =
static_cast< WaveTrack*
>( pView->FindTrack().get() );
281 auto hit = adjuster.
HitTest( subView,
282 state.
state.GetY(), state.
rect.GetTop(), state.
rect.GetHeight() );
283 auto index = hit.first;
285 if ( index < adjuster.mPermutation.size() ) {
286 auto result = std::make_shared< SubViewAdjustHandle >(
287 std::move( adjuster ), index, view.
GetLastHeight(), hit.second
298 wxCoord viewHeight,
bool top )
313 const auto size = permutation.size();
317 if (event.
event.LeftDClick()) {
319 if ( placement.index >= 0 )
320 placement.fraction = 1.0f;
322 placement.fraction = 0.0f;
331 const auto &rect =
event.rect;
332 const auto height = rect.GetHeight();
341 for (; index !=
end; ++index)
349 mYMax = rect.GetBottom();
353 mOrigY = rect.GetBottom();
354 mYMin = rect.GetTop();
370 const auto delta = newY -
mOrigY;
371 wxCoord newHeight =
mTop
375 wxASSERT( newHeight >= 0 && newHeight <=
mTotalHeight );
383 myPlacement.fraction = newHeight;
387 const auto adjustHeight = [&](
size_t ii) {
395 auto &fraction = placement.fraction;
397 if (excess > oldFraction) {
398 excess -= oldFraction, fraction = 0;
402 auto newFraction = oldFraction - excess;
405 myPlacement.fraction += newFraction;
409 fraction = newFraction;
416 if ( adjustHeight( ii ) )
424 if ( adjustHeight( ii ) )
437 static auto resizeCursor =
438 ::MakeCursor(wxCURSOR_ARROW, SubViewsCursorXpm, 16, 16);
441"Click and drag to adjust sizes of sub-views, double-click to split evenly"),
448 wxWindow *pParent)
override
492 if ( adjuster.NVisible() < 2 )
495 auto relX = state.
state.GetX() - state.
rect.GetLeft();
499 auto index = adjuster.FindIndex( subView );
506 auto relY = state.
state.GetY() - state.
rect.GetTop();
507 auto height = state.
rect.GetHeight();
509 ( ( 3 * relY < height ) && index > 0 )
511 ( ( 3 * relY > 2 * height ) &&
512 index < adjuster.mPermutation.size() - 1 )
517 auto result = std::make_shared< SubViewRearrangeHandle >(
518 std::move( adjuster ),
539 const auto size = permutation.size();
546 wxCoord heightAbove = 0;
550 mTopY =
event.rect.GetTop() - heightAbove;
563 auto yy =
event.event.GetY();
569 for (
auto nn =
mHeights.size(); ii < nn; ++ii ) {
630 static auto hoverCursor =
631 ::MakeCursor(wxCURSOR_HAND, RearrangeCursorXpm, 16, 16);
632 static auto clickedCursor =
633 ::MakeCursor(wxCURSOR_HAND, RearrangingCursorXpm, 16, 16);
635 XO(
"Click and drag to rearrange sub-views"),
636 Clicked() ? &*clickedCursor : &*hoverCursor,
637 XO(
"Rearrange sub-views")
643 wxWindow *pParent)
override
685 if ( adjuster.NVisible() < 2 )
689 if ( !rect.Contains( state.
state.GetPosition() ) )
691 auto index = adjuster.FindIndex( subView );
692 auto result = std::make_shared<SubViewCloseHandle>(
693 std::move( adjuster ), index, view.
FindTrack(), rect );
700 const std::shared_ptr<Track> &pTrack,
const wxRect &rect )
708 const wxMouseEvent &event,
AudacityProject *pProject, wxWindow *pParent)
714 myPlacement.fraction = 0;
722 return XO(
"Close sub-view");
743 std::vector<UIHandlePtr>
747 const std::shared_ptr<WaveTrack> &wt)
750 state, pProject, currentTool, bMultiTool, wt, *
this );
755 if ( pWaveTrackView && !state.
state.HasModifiers() ) {
758 *pWaveTrackView, *
this, state ) )
759 results.second.push_back( pHandle );
762 if(channels.size() > 1) {
765 auto subviews = pWaveTrackView->GetSubViews();
766 auto currentSubview = std::find_if(subviews.begin(), subviews.end(),
767 [self = shared_from_this()](
const auto& p){
768 return self == p.second;
770 if (currentSubview != subviews.end())
772 auto currentSubviewIndex = std::distance(subviews.begin(), currentSubview);
774 const auto py = state.
state.GetY();
775 const auto topBorderHit = std::abs(py - state.
rect.GetTop())
777 const auto bottomBorderHit = std::abs(py - state.
rect.GetBottom())
780 auto currentChannel = channels.find(wt.get());
781 auto currentChannelIndex = std::distance(channels.begin(), currentChannel);
784 ((currentChannelIndex != channels.size() - 1)
785 && (currentSubviewIndex ==
static_cast<int>(subviews.size()) - 1)
789 ((currentChannelIndex != 0) && currentSubviewIndex == 0 && topBorderHit))
793 auto it = bottomBorderHit ? currentChannel : currentChannel.advance(-1);
794 auto result = std::make_shared<TrackPanelResizeHandle>((*it)->shared_from_this(), py);
796 results.second.push_back(result);
803 *pWaveTrackView, *
this, state ) )
804 results.second.push_back( pHandle );
807 *pWaveTrackView, *
this, state ) )
808 results.second.push_back( pHandle );
811 *pWaveTrackView, pProject, state))
812 results.second.push_back(pHandle);
818 results.second.push_back(result);
828 auto &dc = context.
dc;
831 const auto &zoomInfo = *artist->pZoomInfo;
833#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
837 bool highlightLoc =
false;
838#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
840 target2 && target2->
GetTrack().get() == track &&
841 target2->GetLocation() == loc;
843 const int xx = zoomInfo.TimeToPosition(loc.pos);
844 if (xx >= 0 && xx < rect.width) {
846 AColor::Line(dc, (
int) (rect.x + xx - 1), rect.y, (
int) (rect.x + xx - 1), rect.y + rect.height);
851#ifdef EXPERIMENTAL_DA
858 AColor::Line(dc, (
int) (rect.x + xx), rect.y, (
int) (rect.x + xx), rect.y + rect.height);
860 AColor::Line(dc, (
int) (rect.x + xx + 1), rect.y, (
int) (rect.x + xx + 1), rect.y + rect.height);
871 const wxRect &rect,
const wxPoint *pPosition,
AudacityProject *pProject )
872 -> std::vector<MenuItem>
877 if ( pTrack && pPosition ) {
879 time = viewInfo.PositionToTime( pPosition->x, rect.x );
880 pClip = pTrack->GetClipAtTime( time );
885 { L
"Cut",
XO(
"Cut") },
886 { L
"Copy",
XO(
"Copy") },
887 { L
"Paste",
XO(
"Paste") },
889 { L
"Split",
XO(
"Split Clip") },
890 { L
"TrackMute",
XO(
"Mute/Unmute Track") },
892 { L
"RenameClip",
XO(
"Rename Clip...") },
896 { L
"Paste",
XO(
"Paste") },
898 { L
"TrackMute",
XO(
"Mute/Unmute Track") },
931 waveTrackView.shared_from_this() );
947 if (
const auto pOther =
dynamic_cast< WaveTrackView*
>( &other ) ) {
954 wxASSERT(srcSubViewsPtrs.size() == destSubViewsPtrs.size());
956 for(
auto i = 0; i != srcSubViewsPtrs.size(); i++){
957 srcSubViewsPtrs[i]->CopyToSubView(destSubViewsPtrs[i].get());
971std::pair< bool, std::vector<UIHandlePtr> >
975 const std::shared_ptr<WaveTrack> &pTrack,
986 std::vector<UIHandlePtr> results;
990 for (
auto& clip : pTrack->GetClips())
998 waveTrackView.mAffordanceHandle,
999 std::make_shared<WaveTrackAffordanceHandle>(pTrack, clip)
1005 if (bMultiTool && st.
state.CmdDown()) {
1012 results.push_back(result);
1013 return {
true, results };
1016 return {
false, results };
1025 using Pair = std::pair< int, WaveTrackSubView::Type >;
1026 std::vector< Pair > pairs;
1030 auto &placement = placements[ii];
1031 if ( placement.fraction > 0 )
1032 pairs.emplace_back( placement.index, subView.
SubViewType() );
1035 std::sort( pairs.begin(), pairs.end() );
1036 std::vector< WaveTrackSubView::Type > results;
1037 for (
const auto &pair : pairs )
1038 results.push_back( pair.second );
1061 auto &foundPlacement = placements[found];
1062 if ( foundPlacement.fraction > 0.0 ) {
1069 auto index = foundPlacement.index;
1070 foundPlacement = { -1, 0.0 };
1072 for (
auto &placement : placements ) {
1073 if ( placement.index > index )
1085 for (
const auto &placement : placements ) {
1086 if ( placement.fraction > 0.0 && placement.index >= 0 ) {
1087 total += placement.fraction;
1088 greatest = std::max( greatest, placement.index );
1094 foundPlacement = { greatest + 1, total / nn };
1113 std::vector< std::pair< WaveTrackViewConstants::Display, size_t > > pairs;
1115 pairs.push_back( { subView.
SubViewType().
id, ii++ } );
1117 std::sort( pairs.begin(), pairs.end() );
1121 for (
const auto &pair : pairs ) {
1122 auto &placement = placements[ pair.second ];
1123 if (pair.first == display) {
1125 placement = { 0, 1.0 };
1127 else if( exclusive )
1129 placement = { -1, 0.0 };
1135 placement = { jj++, 1.0 };
1140 template<
typename Iter,
typename Comp>
1145 it = std::find_if(
begin,
end, comp);
1158 auto waveTrack = std::dynamic_pointer_cast<WaveTrack>(
FindTrack());
1161 auto clips = waveTrack->SortedClipArray();
1169 return other->GetPlayStartTime() >= viewInfo.selectedRegion.t1();
1175 return other->GetPlayStartTime() <= viewInfo.selectedRegion.t0();
1183 auto it = std::find(clips.begin(), clips.end(), clip);
1184 auto index = std::distance(clips.begin(), it);
1191 "%s, %d of %d clip",
1192 "%s, %d of %d clips",
1196 static_cast<int>(index + 1),
1197 static_cast<int>(clips.size())
1206 return GetSubViews(&rect);
1215 int index;
float fraction; std::shared_ptr< TrackView > pView;
1217 std::vector< Item > items;
1220 const auto &placements = DoGetPlacements();
1222 auto& placement = placements[ii];
1223 auto index = placement.index;
1224 auto fraction = placement.fraction;
1225 if (index >= 0 && fraction > 0.0)
1227 items.push_back({ index, fraction, subView.shared_from_this() });
1230 std::sort(items.begin(), items.end(), [](
const Item& a,
const Item& b) {
1231 return a.index < b.index;
1235 auto begin = items.begin(),
end = items.end(),
1236 newEnd = std::remove_if(
begin,
end,
1237 [](
const Item& item) {
return !item.pView; });
1238 items.erase(newEnd,
end);
1242 if (rect !=
nullptr)
1246 results.reserve(items.size());
1247 const auto top = rect->GetTop();
1248 const auto height = rect->GetHeight();
1250 wxCoord lastCoord = 0;
1251 for (
const auto& item : items) {
1252 wxCoord newCoord = top + (partial / total) * height;
1253 results.emplace_back(newCoord, item.pView);
1254 partial += item.fraction;
1258 mLastHeight = height;
1262 std::transform(items.begin(), items.end(), std::back_inserter(results), [](
const auto& item) {
1263 return std::make_pair(0, item.pView);
1286 for (
auto &subView : waveTrackView.GetSubViews()) {
1288 wxASSERT(!event.GetSkipped());
1289 result |= subView.second->CaptureKey(event, viewInfo, pParent, project);
1290 if (!event.GetSkipped()) {
1299 if (
auto affordance = waveTrackView.GetAffordanceControls()) {
1300 result |= affordance->CaptureKey(event, viewInfo, pParent, project);
1301 if (!event.GetSkipped()) {
1309 switch (event.GetKeyCode())
1315 event, viewInfo, pParent, project);
1318 if (!event.GetSkipped()) {
1329 if (
auto pWaveTrackView =
dynamic_cast<WaveTrackView*
>(delegate.get()))
1331 if (event.GetKeyCode() == WXK_TAB)
1333 SelectNextClip(viewInfo, project, event.GetModifiers() != wxMOD_SHIFT);
1337 result |= pWaveTrackView->CommonTrackView::KeyDown(
1338 event, viewInfo, pParent, project);
1341 result |= delegate->KeyDown(event, viewInfo, pParent, project);
1353 if (
auto pWaveTrackView =
dynamic_cast<WaveTrackView*
>(delegate.get()))
1354 result |= pWaveTrackView->CommonTrackView::Char(
1355 event, viewInfo, pParent, project);
1357 result |= delegate->Char(event, viewInfo, pParent, project);
1369 if (
auto waveTrackView =
dynamic_cast<WaveTrackView*
>(delegate.get()))
1370 result = waveTrackView->CommonTrackView::LoseFocus(project);
1372 result = delegate->LoseFocus(project);
1384 = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(view.GetAffordanceControls()))
1386 if (affordance->OnTextCut(project))
1399 = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(view.GetAffordanceControls()))
1401 if (affordance->OnTextCopy(project))
1413 bool showSamples{
false };
1420 bool showSamples{
false };
1425 return clipRect.Inflate(2, 0);
1439 = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(view.GetAffordanceControls()))
1441 if (affordance->OnTextPaste(project))
1454 = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(view.GetAffordanceControls()))
1456 if (affordance->OnTextSelect(project))
1463std::vector< std::shared_ptr< WaveTrackSubView > >
1468 std::vector< std::shared_ptr< WaveTrackSubView > > results;
1470 results.push_back( std::static_pointer_cast<WaveTrackSubView>(
1471 subView.shared_from_this() ) );
1479 if (!track->IsAlignedWithLeader())
1507 return std::make_shared<WaveTrackView>( track.SharedPointer() );
1524 const wxRect& viewRect,
1527 double& outAveragePPS,
1529 bool& outShowSamples)
1531 static constexpr double pixelsOffset{ 2 };
1538 outAveragePPS = viewRect.width / (rate * (h1 - h));
1539 outShowSamples = outAveragePPS > 0.5;
1544 return pixelsOffset / (outAveragePPS * rate);
1563 double sel0 = selectedRegion.
t0();
1564 double sel1 = selectedRegion.
t1();
1580 const double sps = 1. /
rate;
1641 const int hiddenRightOffset = (time64 < rect.width) ? (
int)time64 : rect.width;
1658 leftOffset = (time64 < rect.width) ? (
int)time64 : rect.width;
1672 const int distortedRightOffset = (time64 < rect.width) ? (
int)time64 : rect.width;
1680 auto srs = 1. /
static_cast<double>(clip.
GetRate());
1683 auto clipEndingAdjustemt
1685 if (outShowSamples !=
nullptr)
1688 constexpr auto edgeRight =
static_cast<ZoomInfo::int64>(std::numeric_limits<int>::max());
1689 auto left = std::clamp(
1692 ), edgeLeft, edgeRight
1694 auto right = std::clamp(
1696 clip.
GetPlayEndTime() - .99 * srs + clipEndingAdjustemt, viewRect.x,
true
1697 ), edgeLeft, edgeRight
1704 static_cast<int>(left),
1706 std::max(1,
static_cast<int>(right - left)),
1726 if (
auto affordance = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(
GetAffordanceControls()))
1728 return affordance->GetSelectedClip();
1744 auto &placements = pThis->DoGetPlacements();
1745 if (placements.empty()) {
1748 auto pTrack = pThis->FindTrack();
1752 pThis->SetMultiView(
true );
1756 pThis->DoSetDisplay( display, !multi );
1763 const wxRect &rect,
unsigned iPass )
std::shared_ptr< UIHandle > UIHandlePtr
#define XP(sing, plur, n)
@ Grouped
Can be part of a group.
std::unique_ptr< wxCursor > MakeCursor(int WXUNUSED(CursorId), const char *const pXpm[36], int HotX, int HotY)
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
DEFINE_ATTACHED_VIRTUAL_OVERRIDE(DoGetWaveTrackView)
std::vector< std::shared_ptr< WaveTrackSubView > > WaveTrackSubViewPtrs
constexpr int kClipDetailedViewMinimumWidth
std::vector< WaveTrackSubViewPlacement > WaveTrackSubViewPlacements
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
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...
size_t size() const
How many attachment pointers are in the Site.
ClientData * FindIf(const Function &function)
Return pointer to first attachment in this that is not null and satisfies a predicate,...
void ForEach(const Function &function)
Invoke function on each ClientData object that has been created in this.
void BuildAll()
For each RegisteredFactory, if the corresponding attachment is absent in this, build and store it.
void Reparent(const std::shared_ptr< Track > &parent) override
Object may be shared among tracks but hold a special back-pointer to one of them; reassign it.
std::shared_ptr< Track > FindTrack()
std::weak_ptr< TimeShiftHandle > mTimeShiftHandle
std::shared_ptr< WaveTrack > GetTrack()
static UIHandlePtr HitTest(std::weak_ptr< CutlineHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< WaveTrack > &pTrack)
bool setTimes(double t0, double t1)
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
sampleCount TimeToLongSamples(double t0) const
Convert correctly between an (absolute) time in seconds and a number of samples.
Defines a selected portion of a project.
SubViewAdjuster mAdjuster
static UIHandlePtr HitTest(std::weak_ptr< SubViewAdjustHandle > &holder, WaveTrackView &view, WaveTrackSubView &subView, const TrackPanelMouseState &state)
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *) override
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *) override
SubViewAdjustHandle(SubViewAdjuster &&adjuster, size_t subViewIndex, wxCoord viewHeight, bool top)
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
std::vector< wxCoord > mOrigHeights
Result Cancel(AudacityProject *) override
SubViewAdjuster mAdjuster
TranslatableString Tip(const wxMouseState &state, AudacityProject &project) const override
static UIHandlePtr HitTest(std::weak_ptr< SubViewCloseHandle > &holder, WaveTrackView &view, WaveTrackSubView &subView, const TrackPanelMouseState &state)
static wxRect GetButtonRect(const wxRect &rect)
SubViewCloseHandle(SubViewAdjuster &&adjuster, size_t index, const std::shared_ptr< Track > &pTrack, const wxRect &rect)
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
SubViewRearrangeHandle(SubViewAdjuster &&adjuster, size_t subViewIndex, wxCoord viewHeight)
DragChoice_t DragChoice(const TrackPanelMouseEvent &event) const
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *) override
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
static UIHandlePtr HitTest(std::weak_ptr< SubViewRearrangeHandle > &holder, WaveTrackView &view, WaveTrackSubView &subView, const TrackPanelMouseState &state)
std::vector< wxCoord > mHeights
SubViewAdjuster mAdjuster
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *) override
Result Cancel(AudacityProject *) override
static bool IsSyncLockSelected(const Track *pTrack)
static UIHandlePtr HitAnywhere(std::weak_ptr< TimeShiftHandle > &holder, const std::shared_ptr< Track > &pTrack, bool gripHit)
static TrackArtist * Get(TrackPanelDrawingContext &)
Abstract base class for an object holding data associated with points on a time axis.
bool GetSelected() const
Selectedness is always the same for all channels of a group.
ChannelGroupData & GetGroupData()
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
virtual unsigned CaptureKey(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
virtual void DoSetMinimized(bool isMinimized)
bool GetMinimized() const
static TrackView * Find(Track *)
void CopyTo(Track &track) const override
Copy state, for undo/redo purposes.
static TrackView & Get(Track &)
std::vector< std::pair< wxCoord, std::shared_ptr< TrackView > > > Refinement
static WaveTrackViewConstants::Display ViewModeChoice()
Holds a msgid for the translation catalog; may also bind format arguments.
Short-lived drawing and event-handling object associated with a TrackPanelCell.
NotifyingSelectedRegion selectedRegion
static ViewInfo & Get(AudacityProject &project)
This allows multiple clips to be a part of one WaveTrack.
double GetPlayStartTime() const noexcept
double GetPlayEndTime() const
static UIHandlePtr HitTest(std::weak_ptr< WaveClipTrimHandle > &holder, WaveTrackView &view, const AudacityProject *pProject, const TrackPanelMouseState &state)
A Track that contains audio waveform data.
const std::vector< Location > & Get() const
std::weak_ptr< TrackPanelResizeHandle > mResizeHandle
static void DrawBoldBoundaries(TrackPanelDrawingContext &context, const WaveTrack *track, const wxRect &rect)
WaveTrackSubView(WaveTrackView &waveTrackView)
std::weak_ptr< SubViewAdjustHandle > mAdjustHandle
std::weak_ptr< SubViewRearrangeHandle > mRearrangeHandle
virtual const Type & SubViewType() const =0
std::weak_ptr< WaveTrackView > mwWaveTrackView
std::weak_ptr< WaveClipTrimHandle > mClipTrimHandle
std::weak_ptr< CutlineHandle > mCutlineHandle
std::vector< MenuItem > GetMenuItems(const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject) override
Return a list of items for DoContextMenu() (empties for separators)
std::pair< bool, std::vector< UIHandlePtr > > DoDetailedHitTest(const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool, const std::shared_ptr< WaveTrack > &wt)
virtual void CopyToSubView(WaveTrackSubView *destSubView) const
std::weak_ptr< SubViewCloseHandle > mCloseHandle
std::weak_ptr< WaveTrackView > GetWaveTrackView() const
std::vector< UIHandlePtr > DetailedHitTest(const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool) override
void DoSetDisplay(Display display, bool exclusive=true)
std::weak_ptr< TrackPanelCell > mKeyEventDelegate
WaveTrackView(const WaveTrackView &)=delete
void SetDisplay(Display display, bool exclusive=true)
std::vector< std::shared_ptr< WaveTrackSubView > > GetAllSubViews()
bool CutSelectedText(AudacityProject &project)
wxCoord GetLastHeight() const
void RestorePlacements(const WaveTrackSubViewPlacements &placements)
bool GetMultiView() const
void DoSetMinimized(bool minimized) override
std::shared_ptr< TrackVRulerControls > DoGetVRulerControls() override
static bool HitTest(const WaveClip &clip, const ZoomInfo &zoomInfo, const wxRect &rect, const wxPoint &pos)
unsigned KeyDown(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override
void CopyTo(Track &track) const override
Copy state, for undo/redo purposes.
std::shared_ptr< CommonTrackCell > DoGetAffordance(const std::shared_ptr< Track > &track)
~WaveTrackView() override
const WaveTrackSubViewPlacements & SavePlacements() const
unsigned CaptureKey(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override
static wxRect ClipHitTestArea(const WaveClip &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)
unsigned Char(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override
bool SelectNextClip(ViewInfo &viewInfo, AudacityProject *project, bool forward)
static std::pair< bool, std::vector< UIHandlePtr > > DoDetailedHitTest(const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool, const std::shared_ptr< WaveTrack > &wt, CommonTrackView &view)
WaveTrackSubViewPlacements & DoGetPlacements()
void BuildSubViews() const
static WaveTrackView & Get(WaveTrack &track)
void Reparent(const std::shared_ptr< Track > &parent) override
Object may be shared among tracks but hold a special back-pointer to one of them; reassign it.
bool PasteText(AudacityProject &project)
bool ToggleSubView(Display id)
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
static WaveTrackView * Find(WaveTrack *pTrack)
std::vector< WaveTrackSubView::Type > GetDisplays() const
std::shared_ptr< CommonTrackCell > GetAffordanceControls() override
unsigned LoseFocus(AudacityProject *project) override
bool CopySelectedText(AudacityProject &project)
std::shared_ptr< CommonTrackCell > mpAffordanceCellControl
Refinement GetSubViews(const wxRect *rect=nullptr)
std::weak_ptr< WaveClip > GetSelectedClip()
static bool ClipDetailsVisible(const WaveClip &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)
static constexpr int kChannelSeparatorThickness
bool SelectAllText(AudacityProject &project)
double PositionToTime(int64 position, int64 origin=0, bool ignoreFisheye=false) const
int64 TimeToPosition(double time, int64 origin=0, bool ignoreFisheye=false) const
STM: Converts a project time to screen x position.
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?'.
AUDACITY_DLL_API void DrawCloseButton(TrackPanelDrawingContext &context, const wxRect &bev, const Track *pTrack, ButtonHandle *target)
Iter SelectedClip(const ViewInfo &viewInfo, Iter begin, Iter end)
@ MultiView
"Multi" is special, not really a view type on par with the others.
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
std::pair< const char *, const char * > Pair
bool Comp(const CollectedItems::NewItem &a, const CollectedItems::NewItem &b)
std::shared_ptr< Track > FindTrack(TrackPanelCell *pCell)
double CalculateAdjustmentForZoomLevel(const wxRect &viewRect, const ZoomInfo &zoomInfo, int rate, double &outAveragePPS, bool &outShowSamples)
static const Track::ChannelGroupAttachments::RegisteredFactory key
const WaveClip * NextClipLooped(ViewInfo &viewInfo, Iter begin, Iter end, Comp comp)
For defining overrides of the method.
A convenient base class defining abstract virtual Clone() for a given kind of pointer.
ClipParameters(bool spectrum, const SampleTrack *track, const WaveClip *clip, const wxRect &rect, const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo)
static wxRect GetClipRect(const WaveClip &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect, bool *outShowSamples=nullptr)
double averagePixelsPerSample
bool showIndividualSamples
SubViewAdjuster(WaveTrackView &view)
std::vector< wxCoord > ComputeHeights(wxCoord totalHeight)
void UpdateViews(bool rollback)
bool ModifyPermutation(bool top)
WaveTrackSubViewPlacements mNewPlacements
WaveTrackSubViewPtrs mSubViews
std::weak_ptr< WaveTrackView > mwView
size_t FindIndex(WaveTrackSubView &subView) const
std::vector< size_t > mPermutation
std::pair< size_t, bool > HitTest(WaveTrackSubView &subView, wxCoord yy, wxCoord top, wxCoord height)
WaveTrackSubViewPlacements mOrigPlacements
static Display Default()
Return a preferred type.
WaveTrackSubViewPlacements mPlacements
std::unique_ptr< Cloneable<> > Clone() const
~PlacementArray()=default