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") },
923 const std::shared_ptr<Track> &pTrack,
size_t channel
925 , mChannel{ channel }
931 , mChannel(waveTrackView.GetChannel())
934 waveTrackView.shared_from_this() );
950 if (
const auto pOther =
dynamic_cast< WaveTrackView*
>( &other ) ) {
957 wxASSERT(srcSubViewsPtrs.size() == destSubViewsPtrs.size());
959 for(
auto i = 0; i != srcSubViewsPtrs.size(); i++){
960 srcSubViewsPtrs[i]->CopyToSubView(destSubViewsPtrs[i].get());
974std::pair< bool, std::vector<UIHandlePtr> >
978 const std::shared_ptr<WaveTrack> &pTrack,
989 std::vector<UIHandlePtr> results;
993 for (
auto& clip : pTrack->GetClips())
1001 waveTrackView.mAffordanceHandle,
1002 std::make_shared<WaveTrackAffordanceHandle>(pTrack, clip)
1008 if (bMultiTool && st.
state.CmdDown()) {
1015 results.push_back(result);
1016 return {
true, results };
1019 return {
false, results };
1028 using Pair = std::pair< int, WaveTrackSubView::Type >;
1029 std::vector< Pair > pairs;
1033 auto &placement = placements[ii];
1034 if ( placement.fraction > 0 )
1035 pairs.emplace_back( placement.index, subView.
SubViewType() );
1038 std::sort( pairs.begin(), pairs.end() );
1039 std::vector< WaveTrackSubView::Type > results;
1040 for (
const auto &pair : pairs )
1041 results.push_back( pair.second );
1064 auto &foundPlacement = placements[found];
1065 if ( foundPlacement.fraction > 0.0 ) {
1072 auto index = foundPlacement.index;
1073 foundPlacement = { -1, 0.0 };
1075 for (
auto &placement : placements ) {
1076 if ( placement.index > index )
1088 for (
const auto &placement : placements ) {
1089 if ( placement.fraction > 0.0 && placement.index >= 0 ) {
1090 total += placement.fraction;
1091 greatest = std::max( greatest, placement.index );
1097 foundPlacement = { greatest + 1, total / nn };
1116 std::vector< std::pair< WaveTrackViewConstants::Display, size_t > > pairs;
1118 pairs.push_back( { subView.
SubViewType().
id, ii++ } );
1120 std::sort( pairs.begin(), pairs.end() );
1124 for (
const auto &pair : pairs ) {
1125 auto &placement = placements[ pair.second ];
1126 if (pair.first == display) {
1128 placement = { 0, 1.0 };
1130 else if( exclusive )
1132 placement = { -1, 0.0 };
1138 placement = { jj++, 1.0 };
1143 template<
typename Iter,
typename Comp>
1148 it = std::find_if(
begin,
end, comp);
1161 auto waveTrack = std::dynamic_pointer_cast<WaveTrack>(
FindTrack());
1164 auto clips = waveTrack->SortedClipArray();
1172 return other->GetPlayStartTime() >= viewInfo.selectedRegion.t1();
1178 return other->GetPlayStartTime() <= viewInfo.selectedRegion.t0();
1186 auto it = std::find(clips.begin(), clips.end(), clip);
1187 auto index = std::distance(clips.begin(), it);
1194 "%s, %d of %d clip",
1195 "%s, %d of %d clips",
1199 static_cast<int>(index + 1),
1200 static_cast<int>(clips.size())
1209 return GetSubViews(&rect);
1218 int index;
float fraction; std::shared_ptr< TrackView > pView;
1220 std::vector< Item > items;
1223 const auto &placements = DoGetPlacements();
1225 auto& placement = placements[ii];
1226 auto index = placement.index;
1227 auto fraction = placement.fraction;
1228 if (index >= 0 && fraction > 0.0)
1230 items.push_back({ index, fraction, subView.shared_from_this() });
1233 std::sort(items.begin(), items.end(), [](
const Item& a,
const Item& b) {
1234 return a.index < b.index;
1238 auto begin = items.begin(),
end = items.end(),
1239 newEnd = std::remove_if(
begin,
end,
1240 [](
const Item& item) {
return !item.pView; });
1241 items.erase(newEnd,
end);
1245 if (rect !=
nullptr)
1249 results.reserve(items.size());
1250 const auto top = rect->GetTop();
1251 const auto height = rect->GetHeight();
1253 wxCoord lastCoord = 0;
1254 for (
const auto& item : items) {
1255 wxCoord newCoord = top + (partial / total) * height;
1256 results.emplace_back(newCoord, item.pView);
1257 partial += item.fraction;
1261 mLastHeight = height;
1265 std::transform(items.begin(), items.end(), std::back_inserter(results), [](
const auto& item) {
1266 return std::make_pair(0, item.pView);
1289 for (
auto &subView : waveTrackView.GetSubViews()) {
1291 wxASSERT(!event.GetSkipped());
1292 result |= subView.second->CaptureKey(event, viewInfo, pParent, project);
1293 if (!event.GetSkipped()) {
1302 if (
auto affordance = waveTrackView.GetAffordanceControls()) {
1303 result |= affordance->CaptureKey(event, viewInfo, pParent, project);
1304 if (!event.GetSkipped()) {
1312 switch (event.GetKeyCode())
1318 event, viewInfo, pParent, project);
1321 if (!event.GetSkipped()) {
1332 if (
auto pWaveTrackView =
dynamic_cast<WaveTrackView*
>(delegate.get()))
1334 if (event.GetKeyCode() == WXK_TAB)
1336 SelectNextClip(viewInfo, project, event.GetModifiers() != wxMOD_SHIFT);
1340 result |= pWaveTrackView->CommonTrackView::KeyDown(
1341 event, viewInfo, pParent, project);
1344 result |= delegate->KeyDown(event, viewInfo, pParent, project);
1356 if (
auto pWaveTrackView =
dynamic_cast<WaveTrackView*
>(delegate.get()))
1357 result |= pWaveTrackView->CommonTrackView::Char(
1358 event, viewInfo, pParent, project);
1360 result |= delegate->Char(event, viewInfo, pParent, project);
1372 if (
auto waveTrackView =
dynamic_cast<WaveTrackView*
>(delegate.get()))
1373 result = waveTrackView->CommonTrackView::LoseFocus(project);
1375 result = delegate->LoseFocus(project);
1387 = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(view.GetAffordanceControls()))
1389 if (affordance->OnTextCut(project))
1402 = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(view.GetAffordanceControls()))
1404 if (affordance->OnTextCopy(project))
1416 bool showSamples{
false };
1423 bool showSamples{
false };
1428 return clipRect.Inflate(2, 0);
1442 = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(view.GetAffordanceControls()))
1444 if (affordance->OnTextPaste(project))
1457 = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(view.GetAffordanceControls()))
1459 if (affordance->OnTextSelect(project))
1466std::vector< std::shared_ptr< WaveTrackSubView > >
1471 std::vector< std::shared_ptr< WaveTrackSubView > > results;
1473 results.push_back( std::static_pointer_cast<WaveTrackSubView>(
1474 subView.shared_from_this() ) );
1482 if (!track->IsAlignedWithLeader())
1511 return std::make_shared<WaveTrackView>(track.SharedPointer(), 0);
1528 const wxRect& viewRect,
1531 double& outAveragePPS,
1533 bool& outShowSamples)
1535 static constexpr double pixelsOffset{ 2 };
1542 outAveragePPS = viewRect.width / (rate * (h1 - h));
1543 outShowSamples = outAveragePPS > 0.5;
1548 return pixelsOffset / (outAveragePPS * rate);
1567 double sel0 = selectedRegion.
t0();
1568 double sel1 = selectedRegion.
t1();
1584 const double sps = 1. /
rate;
1645 const int hiddenRightOffset = (time64 < rect.width) ? (
int)time64 : rect.width;
1662 leftOffset = (time64 < rect.width) ? (
int)time64 : rect.width;
1676 const int distortedRightOffset = (time64 < rect.width) ? (
int)time64 : rect.width;
1684 auto srs = 1. /
static_cast<double>(clip.
GetRate());
1687 auto clipEndingAdjustemt
1689 if (outShowSamples !=
nullptr)
1692 constexpr auto edgeRight =
static_cast<ZoomInfo::int64>(std::numeric_limits<int>::max());
1693 auto left = std::clamp(
1696 ), edgeLeft, edgeRight
1698 auto right = std::clamp(
1700 clip.
GetPlayEndTime() - .99 * srs + clipEndingAdjustemt, viewRect.x,
true
1701 ), edgeLeft, edgeRight
1708 static_cast<int>(left),
1710 std::max(1,
static_cast<int>(right - left)),
1730 if (
auto affordance = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(
GetAffordanceControls()))
1732 return affordance->GetSelectedClip();
1748 auto &placements = pThis->DoGetPlacements();
1749 if (placements.empty()) {
1752 auto pTrack = pThis->FindTrack();
1756 pThis->SetMultiView(
true );
1760 pThis->DoSetDisplay( display, !multi );
1767 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)
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)
sampleCount TimeToLongSamples(double t0) const
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