13#include <unordered_set>
19#include <wx/graphics.h>
22#include "../../../../WaveClip.h"
23#include "../../../../WaveTrack.h"
25#include "../../../../../images/Cursors.h"
28#include "../../../../commands/CommandContext.h"
29#include "../../../../HitTestResult.h"
31#include "../../../../RefreshCode.h"
32#include "../../../../SyncLock.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"
80 return placement.index < 0 || placement.fraction <= 0;
82 const auto comp = [
this](
size_t ii,
size_t jj ){
84 bool iInvisible = invisible( pi );
87 bool jInvisible = invisible( pj );
90 if ( iInvisible != jInvisible )
92 else if ( !iInvisible )
93 return pi.index < pj.index;
100 auto first = std::find_if(
begin,
end, [
this](
size_t ii){
111 bool rotated =
false;
131 std::rotate( pBegin, pBegin + 1, pEnd );
136 for (
auto pIter = pBegin; pIter != pFirst; ++pIter ) {
138 placement.index = -1;
139 placement.fraction = 0;
142 for (
auto pIter = pFirst; pIter != pEnd; ++pIter )
150 auto iter = std::find_if(
begin,
end, [&](
size_t ii){
151 return mSubViews[ ii ].get() == &subView;
156 std::pair< size_t, bool >
158 wxCoord yy, wxCoord top, wxCoord height )
162 if ( index < (
int)
size ) {
164 if ( yy >= 0 && yy < HotZoneSize && index > 0 )
165 return { index,
true };
170 return { index,
false };
172 return {
size,
false };
181 total += std::max( 0.f, placement.fraction );
184 wxCoord lastCoord = 0;
185 std::vector<wxCoord> result;
188 auto fraction = std::max( 0.f, placement.fraction );
189 wxCoord coord = ( (partial + fraction ) / total ) * totalHeight;
190 auto height = coord - lastCoord;
191 result.emplace_back( height );
201 auto pView =
mwView.lock();
203 auto pTrack =
static_cast< WaveTrack*
>( pView->FindTrack().get() );
204 for (
auto pChannel : TrackList::Channels<WaveTrack>( pTrack ) )
233 auto hit = adjuster.
HitTest( subView,
234 state.
state.GetY(), state.
rect.GetTop(), state.
rect.GetHeight() );
235 auto index = hit.first;
237 if ( index < adjuster.mPermutation.size() ) {
238 auto result = std::make_shared< SubViewAdjustHandle >(
239 std::move( adjuster ), index, view.
GetLastHeight(), hit.second
250 wxCoord viewHeight,
bool top )
265 const auto size = permutation.size();
269 if (event.
event.LeftDClick()) {
271 if ( placement.index >= 0 )
272 placement.fraction = 1.0f;
274 placement.fraction = 0.0f;
283 const auto &rect =
event.rect;
284 const auto height = rect.GetHeight();
293 for (; index !=
end; ++index)
301 mYMax = rect.GetBottom();
305 mOrigY = rect.GetBottom();
306 mYMin = rect.GetTop();
322 const auto delta = newY -
mOrigY;
323 wxCoord newHeight =
mTop
327 wxASSERT( newHeight >= 0 && newHeight <=
mTotalHeight );
335 myPlacement.fraction = newHeight;
339 const auto adjustHeight = [&](
size_t ii) {
347 auto &fraction = placement.fraction;
349 if (excess > oldFraction) {
350 excess -= oldFraction, fraction = 0;
354 auto newFraction = oldFraction - excess;
357 myPlacement.fraction += newFraction;
361 fraction = newFraction;
368 if ( adjustHeight( ii ) )
376 if ( adjustHeight( ii ) )
389 static auto resizeCursor =
390 ::MakeCursor(wxCURSOR_ARROW, SubViewsCursorXpm, 16, 16);
393"Click and drag to adjust sizes of sub-views, double-click to split evenly"),
400 wxWindow *pParent)
override
444 if ( adjuster.NVisible() < 2 )
447 auto relX = state.
state.GetX() - state.
rect.GetLeft();
451 auto index = adjuster.FindIndex( subView );
458 auto relY = state.
state.GetY() - state.
rect.GetTop();
459 auto height = state.
rect.GetHeight();
461 ( ( 3 * relY < height ) && index > 0 )
463 ( ( 3 * relY > 2 * height ) &&
464 index < adjuster.mPermutation.size() - 1 )
469 auto result = std::make_shared< SubViewRearrangeHandle >(
470 std::move( adjuster ),
491 const auto size = permutation.size();
498 wxCoord heightAbove = 0;
502 mTopY =
event.rect.GetTop() - heightAbove;
515 auto yy =
event.event.GetY();
521 for (
auto nn =
mHeights.size(); ii < nn; ++ii ) {
582 static auto hoverCursor =
583 ::MakeCursor(wxCURSOR_HAND, RearrangeCursorXpm, 16, 16);
584 static auto clickedCursor =
585 ::MakeCursor(wxCURSOR_HAND, RearrangingCursorXpm, 16, 16);
587 XO(
"Click and drag to rearrange sub-views"),
588 Clicked() ? &*clickedCursor : &*hoverCursor,
589 XO(
"Rearrange sub-views")
595 wxWindow *pParent)
override
637 if ( adjuster.NVisible() < 2 )
641 if ( !rect.Contains( state.
state.GetPosition() ) )
643 auto index = adjuster.FindIndex( subView );
644 auto result = std::make_shared<SubViewCloseHandle>(
645 std::move( adjuster ), index, view.
FindTrack(), rect );
652 const std::shared_ptr<Track> &pTrack,
const wxRect &rect )
660 const wxMouseEvent &event,
AudacityProject *pProject, wxWindow *pParent)
666 myPlacement.fraction = 0;
674 return XO(
"Close sub-view");
696 std::vector<UIHandlePtr>
700 const std::shared_ptr<WaveTrack> &wt)
703 state, pProject, currentTool, bMultiTool, wt, *
this );
708 if ( pWaveTrackView && !state.
state.HasModifiers() ) {
711 *pWaveTrackView, *
this, state ) )
712 results.second.push_back( pHandle );
715 if(channels.size() > 1) {
718 auto subviews = pWaveTrackView->GetSubViews();
719 auto currentSubview = std::find_if(subviews.begin(), subviews.end(),
720 [self = shared_from_this()](
const auto& p){
721 return self == p.second;
723 if (currentSubview != subviews.end())
725 auto currentSubviewIndex = std::distance(subviews.begin(), currentSubview);
727 const auto py = state.
state.GetY();
728 const auto topBorderHit = std::abs(py - state.
rect.GetTop())
730 const auto bottomBorderHit = std::abs(py - state.
rect.GetBottom())
733 auto currentChannel = channels.find(wt.get());
734 auto currentChannelIndex = std::distance(channels.begin(), currentChannel);
737 ((currentChannelIndex != channels.size() - 1)
738 && (currentSubviewIndex ==
static_cast<int>(subviews.size()) - 1)
742 ((currentChannelIndex != 0) && currentSubviewIndex == 0 && topBorderHit))
746 auto it = bottomBorderHit ? currentChannel : currentChannel.advance(-1);
747 auto result = std::make_shared<TrackPanelResizeHandle>((*it)->shared_from_this(), py);
749 results.second.push_back(result);
756 *pWaveTrackView, *
this, state ) )
757 results.second.push_back( pHandle );
760 *pWaveTrackView, *
this, state ) )
761 results.second.push_back( pHandle );
764 *pWaveTrackView, pProject, state))
765 results.second.push_back(pHandle);
771 results.second.push_back(result);
781 auto &dc = context.
dc;
784 const auto &zoomInfo = *artist->pZoomInfo;
786#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
790 bool highlightLoc =
false;
791#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
793 target2 && target2->
GetTrack().get() == track &&
794 target2->GetLocation() == loc;
796 const int xx = zoomInfo.TimeToPosition(loc.pos);
797 if (xx >= 0 && xx < rect.width) {
799 AColor::Line(dc, (
int) (rect.x + xx - 1), rect.y, (
int) (rect.x + xx - 1), rect.y + rect.height);
804#ifdef EXPERIMENTAL_DA
811 AColor::Line(dc, (
int) (rect.x + xx), rect.y, (
int) (rect.x + xx), rect.y + rect.height);
813 AColor::Line(dc, (
int) (rect.x + xx + 1), rect.y, (
int) (rect.x + xx + 1), rect.y + rect.height);
824 const wxRect &rect,
const wxPoint *pPosition,
AudacityProject *pProject )
825 -> std::vector<MenuItem>
830 if ( pTrack && pPosition ) {
832 time = viewInfo.PositionToTime( pPosition->x, rect.x );
833 pClip = pTrack->GetClipAtTime( time );
838 { L
"Cut",
XO(
"Cut") },
839 { L
"Copy",
XO(
"Copy") },
840 { L
"Paste",
XO(
"Paste") },
842 { L
"Split",
XO(
"Split Clip") },
843 { L
"TrackMute",
XO(
"Mute/Unmute Track") },
845 { L
"RenameClip",
XO(
"Rename Clip...") },
849 { L
"Paste",
XO(
"Paste") },
851 { L
"TrackMute",
XO(
"Mute/Unmute Track") },
884 waveTrackView.shared_from_this() );
900 if (
const auto pOther =
dynamic_cast< WaveTrackView*
>( &other ) ) {
907 wxASSERT(srcSubViewsPtrs.size() == destSubViewsPtrs.size());
909 for(
auto i = 0; i != srcSubViewsPtrs.size(); i++){
910 srcSubViewsPtrs[i]->CopyToSubView(destSubViewsPtrs[i].get());
924std::pair< bool, std::vector<UIHandlePtr> >
928 const std::shared_ptr<WaveTrack> &pTrack,
939 std::vector<UIHandlePtr> results;
943 for (
auto& clip : pTrack->GetClips())
951 waveTrackView.mAffordanceHandle,
952 std::make_shared<WaveTrackAffordanceHandle>(pTrack, clip)
958 if (bMultiTool && st.
state.CmdDown()) {
965 results.push_back(result);
966 return {
true, results };
969 return {
false, results };
978 using Pair = std::pair< int, WaveTrackSubView::Type >;
979 std::vector< Pair > pairs;
983 if ( placement.fraction > 0 )
984 pairs.emplace_back( placement.index, subView.
SubViewType() );
987 std::sort( pairs.begin(), pairs.end() );
988 std::vector< WaveTrackSubView::Type > results;
989 for (
const auto &pair : pairs )
990 results.push_back( pair.second );
1013 if ( foundPlacement.fraction > 0.0 ) {
1020 auto index = foundPlacement.index;
1021 foundPlacement = { -1, 0.0 };
1024 if ( placement.index > index )
1037 if ( placement.fraction > 0.0 && placement.index >= 0 ) {
1038 total += placement.fraction;
1039 greatest = std::max( greatest, placement.index );
1045 foundPlacement = { greatest + 1, total / nn };
1064 std::vector< std::pair< WaveTrackViewConstants::Display, size_t > > pairs;
1066 pairs.push_back( { subView.
SubViewType().
id, ii++ } );
1068 std::sort( pairs.begin(), pairs.end() );
1071 for (
const auto &pair : pairs ) {
1073 if (pair.first == display) {
1075 placement = { 0, 1.0 };
1077 else if( exclusive )
1079 placement = { -1, 0.0 };
1085 placement = { jj++, 1.0 };
1090 template<
typename Iter,
typename Comp>
1095 it = std::find_if(
begin,
end, comp);
1108 auto waveTrack = std::dynamic_pointer_cast<WaveTrack>(
FindTrack());
1111 auto clips = waveTrack->SortedClipArray();
1119 return other->GetPlayStartTime() >= viewInfo.selectedRegion.t1();
1125 return other->GetPlayStartTime() <= viewInfo.selectedRegion.t0();
1133 auto it = std::find(clips.begin(), clips.end(), clip);
1134 auto index = std::distance(clips.begin(), it);
1141 "%s, %d of %d clip",
1142 "%s, %d of %d clips",
1146 static_cast<int>(index + 1),
1147 static_cast<int>(clips.size())
1156 return GetSubViews(&rect);
1165 int index;
float fraction; std::shared_ptr< TrackView > pView;
1167 std::vector< Item > items;
1171 auto& placement = mPlacements[ii];
1172 auto index = placement.index;
1173 auto fraction = placement.fraction;
1174 if (index >= 0 && fraction > 0.0)
1176 items.push_back({ index, fraction, subView.shared_from_this() });
1179 std::sort(items.begin(), items.end(), [](
const Item& a,
const Item& b) {
1180 return a.index < b.index;
1184 auto begin = items.begin(),
end = items.end(),
1185 newEnd = std::remove_if(
begin,
end,
1186 [](
const Item& item) {
return !item.pView; });
1187 items.erase(newEnd,
end);
1191 if (rect !=
nullptr)
1195 results.reserve(items.size());
1196 const auto top = rect->GetTop();
1197 const auto height = rect->GetHeight();
1199 wxCoord lastCoord = 0;
1200 for (
const auto& item : items) {
1201 wxCoord newCoord = top + (partial / total) * height;
1202 results.emplace_back(newCoord, item.pView);
1203 partial += item.fraction;
1207 mLastHeight = height;
1211 std::transform(items.begin(), items.end(), std::back_inserter(results), [](
const auto& item) {
1212 return std::make_pair(0, item.pView);
1235 for (
auto &subView : waveTrackView.GetSubViews()) {
1237 wxASSERT(!event.GetSkipped());
1238 result |= subView.second->CaptureKey(event, viewInfo, pParent, project);
1239 if (!event.GetSkipped()) {
1248 if (
auto affordance = waveTrackView.GetAffordanceControls()) {
1249 result |= affordance->CaptureKey(event, viewInfo, pParent, project);
1250 if (!event.GetSkipped()) {
1258 switch (event.GetKeyCode())
1264 event, viewInfo, pParent, project);
1267 if (!event.GetSkipped()) {
1278 if (
auto pWaveTrackView =
dynamic_cast<WaveTrackView*
>(delegate.get()))
1280 if (event.GetKeyCode() == WXK_TAB)
1282 SelectNextClip(viewInfo, project, event.GetModifiers() != wxMOD_SHIFT);
1286 result |= pWaveTrackView->CommonTrackView::KeyDown(
1287 event, viewInfo, pParent, project);
1290 result |= delegate->KeyDown(event, viewInfo, pParent, project);
1302 if (
auto pWaveTrackView =
dynamic_cast<WaveTrackView*
>(delegate.get()))
1303 result |= pWaveTrackView->CommonTrackView::Char(
1304 event, viewInfo, pParent, project);
1306 result |= delegate->Char(event, viewInfo, pParent, project);
1318 if (
auto waveTrackView =
dynamic_cast<WaveTrackView*
>(delegate.get()))
1319 result = waveTrackView->CommonTrackView::LoseFocus(project);
1321 result = delegate->LoseFocus(project);
1333 = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(view.GetAffordanceControls()))
1335 if (affordance->OnTextCut(project))
1348 = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(view.GetAffordanceControls()))
1350 if (affordance->OnTextCopy(project))
1362 bool showSamples{
false };
1369 bool showSamples{
false };
1374 return clipRect.Inflate(2, 0);
1388 = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(view.GetAffordanceControls()))
1390 if (affordance->OnTextPaste(project))
1403 = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(view.GetAffordanceControls()))
1405 if (affordance->OnTextSelect(project))
1412std::vector< std::shared_ptr< WaveTrackSubView > >
1417 std::vector< std::shared_ptr< WaveTrackSubView > > results;
1419 results.push_back( std::static_pointer_cast<WaveTrackSubView>(
1420 subView.shared_from_this() ) );
1428 if (!track->IsAlignedWithLeader())
1456 return std::make_shared<WaveTrackView>( track.SharedPointer() );
1473 const wxRect& viewRect,
1476 double& outAveragePPS,
1478 bool& outShowSamples)
1480 static constexpr double pixelsOffset{ 2 };
1487 outAveragePPS = viewRect.width / (rate * (h1 - h));
1488 outShowSamples = outAveragePPS > 0.5;
1493 return pixelsOffset / (outAveragePPS * rate);
1512 double sel0 = selectedRegion.
t0();
1513 double sel1 = selectedRegion.
t1();
1529 const double sps = 1. /
rate;
1590 const int hiddenRightOffset = (time64 < rect.width) ? (
int)time64 : rect.width;
1607 leftOffset = (time64 < rect.width) ? (
int)time64 : rect.width;
1621 const int distortedRightOffset = (time64 < rect.width) ? (
int)time64 : rect.width;
1629 auto srs = 1. /
static_cast<double>(clip.
GetRate());
1632 auto clipEndingAdjustemt
1634 if (outShowSamples !=
nullptr)
1637 constexpr auto edgeRight =
static_cast<wxInt64
>(std::numeric_limits<int>::max());
1638 auto left = std::clamp(
1641 ), edgeLeft, edgeRight
1643 auto right = std::clamp(
1645 clip.
GetPlayEndTime() - .99 * srs + clipEndingAdjustemt, viewRect.x,
true
1646 ), edgeLeft, edgeRight
1653 static_cast<int>(left),
1655 std::max(1,
static_cast<int>(right - left)),
1675 if (
auto affordance = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(
GetAffordanceControls()))
1677 return affordance->GetSelectedClip();
1693 if ( pThis->mPlacements.empty() ) {
1696 auto pTrack = pThis->FindTrack();
1700 pThis->SetMultiView(
true );
1704 pThis->DoSetDisplay( display, !multi );
1711 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...
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.
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 > & GetCachedLocations() 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
WaveTrackSubViewPlacements mPlacements
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)
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(wxInt64 position, wxInt64 origin=0, bool ignoreFisheye=false) const
wxInt64 TimeToPosition(double time, wxInt64 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.
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)
const WaveClip * NextClipLooped(ViewInfo &viewInfo, Iter begin, Iter end, Comp comp)
For defining overrides of the method.
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.