13#include <unordered_set>
19#include <wx/graphics.h>
24#include "../../../../../images/Cursors.h"
27#include "../../../../HitTestResult.h"
28#include "../../../../RefreshCode.h"
29#include "../../../../TrackArtist.h"
30#include "../../../../TrackPanel.h"
31#include "../../../../TrackPanelDrawingContext.h"
32#include "../../../../TrackPanelMouseEvent.h"
33#include "../../../../TrackPanelResizeHandle.h"
34#include "../../../../prefs/TracksPrefs.h"
42#include "../../../ui/TimeShiftHandle.h"
43#include "../../../ui/ButtonHandle.h"
44#include "../../../ui/CommonTrackInfo.h"
63 std::unique_ptr<Cloneable<>>
Clone()
const {
64 return std::make_unique<PlacementArray>(*
this); }
66 bool mMultiView{
false };
70key { [](
auto &) {
return std::make_unique<PlacementArray>(); } };
80 return Get(
const_cast<Track &
>(track));
130 return placement.index < 0 || placement.fraction <= 0;
132 const auto comp = [
this](
size_t ii,
size_t jj ){
134 bool iInvisible = invisible(
pi );
137 bool jInvisible = invisible( pj );
140 if ( iInvisible != jInvisible )
142 else if ( !iInvisible )
143 return pi.index < pj.index;
150 auto first = std::find_if(
begin,
end, [
this](
size_t ii){
161 bool rotated =
false;
186 for (
auto pIter = pBegin; pIter != pFirst; ++pIter ) {
188 placement.index = -1;
189 placement.fraction = 0;
192 for (
auto pIter = pFirst; pIter != pEnd; ++pIter )
200 auto iter = std::find_if(
begin,
end, [&](
size_t ii){
201 return mSubViews[ ii ].get() == &subView;
206 std::pair< size_t, bool >
208 wxCoord yy, wxCoord top, wxCoord height)
212 if ( index < (
int)
size ) {
214 if ( yy >= 0 && yy < HotZoneSize && index > 0 )
215 return { index,
true };
220 return { index,
false };
222 return {
size,
false };
231 total += std::max( 0.f, placement.fraction );
234 wxCoord lastCoord = 0;
235 std::vector<wxCoord> result;
238 auto fraction = std::max( 0.f, placement.fraction );
239 wxCoord coord = ( (partial + fraction ) / total ) * totalHeight;
240 auto height = coord - lastCoord;
241 result.emplace_back( height );
251 auto pView =
mwView.lock();
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 )
321 const auto size = permutation.size();
325 if (event.
event.LeftDClick()) {
327 if ( placement.index >= 0 )
328 placement.fraction = 1.0f;
330 placement.fraction = 0.0f;
339 const auto &rect =
event.rect;
340 const auto height = rect.GetHeight();
349 for (; index !=
end; ++index)
357 mYMax = rect.GetBottom();
361 mOrigY = rect.GetBottom();
362 mYMin = rect.GetTop();
378 const auto delta = newY -
mOrigY;
379 wxCoord newHeight =
mTop
383 wxASSERT( newHeight >= 0 && newHeight <=
mTotalHeight );
391 myPlacement.fraction = newHeight;
395 const auto adjustHeight = [&](
size_t ii) {
403 auto &fraction = placement.fraction;
405 if (excess > oldFraction) {
406 excess -= oldFraction, fraction = 0;
410 auto newFraction = oldFraction - excess;
413 myPlacement.fraction += newFraction;
417 fraction = newFraction;
424 if ( adjustHeight( ii ) )
432 if ( adjustHeight( ii ) )
445 static auto resizeCursor =
446 ::MakeCursor(wxCURSOR_ARROW, SubViewsCursorXpm, 16, 16);
449"Click and drag to adjust sizes of sub-views, double-click to split evenly"),
456 wxWindow *pParent)
override
500 if ( adjuster.NVisible() < 2 )
503 auto relX = state.
state.GetX() - state.
rect.GetLeft();
507 auto index = adjuster.FindIndex( subView );
514 auto relY = state.
state.GetY() - state.
rect.GetTop();
515 auto height = state.
rect.GetHeight();
517 ( ( 3 * relY < height ) && index > 0 )
519 ( ( 3 * relY > 2 * height ) &&
520 index < adjuster.mPermutation.size() - 1 )
525 auto result = std::make_shared< SubViewRearrangeHandle >(
526 std::move( adjuster ),
555 const auto size = permutation.size();
562 wxCoord heightAbove = 0;
566 mTopY =
event.rect.GetTop() - heightAbove;
579 auto yy =
event.event.GetY();
585 for (
auto nn =
mHeights.size(); ii < nn; ++ii ) {
646 static auto hoverCursor =
647 ::MakeCursor(wxCURSOR_HAND, RearrangeCursorXpm, 16, 16);
648 static auto clickedCursor =
649 ::MakeCursor(wxCURSOR_HAND, RearrangingCursorXpm, 16, 16);
651 XO(
"Click and drag to rearrange sub-views"),
652 Clicked() ? &*clickedCursor : &*hoverCursor,
653 XO(
"Rearrange sub-views")
659 wxWindow *pParent)
override
701 if ( adjuster.NVisible() < 2 )
705 if ( !rect.Contains( state.
state.GetPosition() ) )
707 auto index = adjuster.FindIndex( subView );
708 auto result = std::make_shared<SubViewCloseHandle>(
709 std::move(adjuster), index, view.
FindChannel(), rect);
716 const std::shared_ptr<Channel> &pChannel,
const wxRect &rect )
727 const wxMouseEvent &event,
AudacityProject *pProject, wxWindow *pParent)
733 myPlacement.fraction = 0;
741 return XO(
"Close sub-view");
763 std::vector<UIHandlePtr>
767 const std::shared_ptr<WaveChannel> &wc)
769 const auto waveTrack = wc->GetTrack().SharedPointer<
WaveTrack>();
771 state, pProject, currentTool, bMultiTool, wc, *
this);
776 if ( pWaveChannelView && !state.
state.HasModifiers() ) {
779 *pWaveChannelView, *
this, state ) )
780 results.second.push_back( pHandle );
782 auto &&channels = waveTrack->
Channels();
783 if(channels.size() > 1) {
786 auto subviews = pWaveChannelView->GetSubViews();
787 auto currentSubview = std::find_if(subviews.begin(), subviews.end(),
788 [self = shared_from_this()](
const auto& p){
789 return self == p.second;
791 if (currentSubview != subviews.end())
793 auto currentSubviewIndex = std::distance(subviews.begin(), currentSubview);
795 const auto py = state.
state.GetY();
796 const auto topBorderHit = std::abs(py - state.
rect.GetTop())
798 const auto bottomBorderHit = std::abs(py - state.
rect.GetBottom())
801 auto it = channels.find(wc);
802 auto currentChannelIndex = std::distance(channels.begin(), it);
805 ((currentChannelIndex != channels.size() - 1)
806 && (currentSubviewIndex ==
static_cast<int>(subviews.size()) - 1)
810 ((currentChannelIndex != 0) && currentSubviewIndex == 0 && topBorderHit))
814 if (!bottomBorderHit)
816 auto result = std::make_shared<TrackPanelResizeHandle>(*it, py);
818 results.second.push_back(result);
825 *pWaveChannelView, *
this, state ) )
826 results.second.push_back( pHandle );
829 *pWaveChannelView, *
this, state ) )
830 results.second.push_back( pHandle );
832 if( pWaveChannelView )
836 *pWaveChannelView, pProject, state))
837 results.second.push_back(pHandle);
842 results.second.push_back(result);
852 auto &dc = context.
dc;
855 const auto &zoomInfo = *artist->pZoomInfo;
857#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
862 bool highlightLoc =
false;
863#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
865 target2 && target2->
GetTrack().get() == &channel &&
866 target2->GetLocation() == loc;
868 const int xx = zoomInfo.TimeToPosition(loc.pos);
869 if (xx >= 0 && xx < rect.width) {
871 AColor::Line(dc, (
int) (rect.x + xx - 1), rect.y, (
int) (rect.x + xx - 1), rect.y + rect.height);
873 AColor::Line(dc, (
int) (rect.x + xx), rect.y, (
int) (rect.x + xx), rect.y + rect.height);
875 AColor::Line(dc, (
int) (rect.x + xx + 1), rect.y, (
int) (rect.x + xx + 1), rect.y + rect.height);
886 const wxRect &rect,
const wxPoint *pPosition,
AudacityProject *pProject)
887 -> std::vector<MenuItem>
889 auto pChannel = FindWaveChannel();
890 if (pChannel !=
nullptr && pPosition !=
nullptr)
892 auto &track = pChannel->GetTrack();
894 const auto t = viewInfo.PositionToTime(pPosition->x, rect.x);
895 if ((track.IsSelected() &&
896 t > viewInfo.selectedRegion.t0() && t < viewInfo.selectedRegion.t1() &&
898 viewInfo.selectedRegion.t0(), viewInfo.selectedRegion.t1())
907 { L
"Paste",
XO(
"Paste") },
909 { L
"TrackMute",
XO(
"Mute/Unmute Track") },
946 return pWt ? &
GetFirst(*pWt):
nullptr;
951 return pWt ? &
GetFirst(*pWt):
nullptr;
958 waveChannelView.shared_from_this() );
963 return FindChannel<WaveChannel>();
976 return FindChannel<WaveChannel>();
988 auto srcSubViewsPtrs =
990 auto destSubViewsPtrs =
992 wxASSERT(srcSubViewsPtrs.size() == destSubViewsPtrs.size());
994 for(
auto i = 0; i != srcSubViewsPtrs.size(); i++){
995 srcSubViewsPtrs[i]->CopyToSubView(destSubViewsPtrs[i].get());
1009std::pair< bool, std::vector<UIHandlePtr> >
1013 const std::shared_ptr<WaveChannel> &pChannel,
1024 std::vector<UIHandlePtr> results;
1027 const auto pTrack = pChannel->GetTrack().SharedPointer<
WaveTrack>();
1029 for (
const auto &clip : pChannel->Intervals())
1037 waveChannelView.mAffordanceHandle,
1038 std::make_shared<WaveTrackAffordanceHandle>(pTrack, clip)
1044 if (bMultiTool && st.
state.CmdDown()) {
1051 results.push_back(result);
1052 return {
true, results };
1055 return {
false, results };
1064 using Pair = std::pair<int, WaveChannelSubView::Type>;
1065 std::vector< Pair > pairs;
1069 auto &placement = placements[ii];
1070 if (placement.fraction > 0)
1071 pairs.emplace_back(placement.index, subView.
SubViewType());
1074 std::sort( pairs.begin(), pairs.end() );
1075 std::vector<WaveChannelSubView::Type> results;
1076 for (
const auto &pair : pairs)
1077 results.push_back(pair.second);
1100 auto &foundPlacement = placements[found];
1101 if ( foundPlacement.fraction > 0.0 ) {
1108 auto index = foundPlacement.index;
1109 foundPlacement = { -1, 0.0 };
1111 for (
auto &placement : placements ) {
1112 if ( placement.index > index )
1124 for (
const auto &placement : placements ) {
1125 if ( placement.fraction > 0.0 && placement.index >= 0 ) {
1126 total += placement.fraction;
1127 greatest = std::max( greatest, placement.index );
1133 foundPlacement = { greatest + 1, total / nn };
1152 std::vector<std::pair<WaveChannelViewConstants::Display, size_t>> pairs;
1154 pairs.push_back({ subView.
SubViewType().
id, ii++ });
1156 std::sort( pairs.begin(), pairs.end() );
1160 for (
const auto &pair : pairs ) {
1161 auto &placement = placements[ pair.second ];
1162 if (pair.first == display) {
1164 placement = { 0, 1.0 };
1166 else if( exclusive )
1168 placement = { -1, 0.0 };
1174 placement = { jj++, 1.0 };
1179 template<
typename Iter>
1183 const auto isClipSelected =
1184 [&viewInfo](
const std::shared_ptr<WaveChannelInterval> &pClip) {
1188 return std::find_if(
begin,
end, isClipSelected);
1191 template<
typename Iter,
typename Comp>
1192 std::shared_ptr<WaveChannelInterval>
1197 it = std::find_if(
begin,
end, comp);
1218 std::shared_ptr<WaveChannelInterval> clip{};
1222 [&](
const auto &other) {
1223 return other->GetPlayStartTime() >= viewInfo.selectedRegion.t1();
1229 [&](
const auto &other) {
1230 return other->GetPlayStartTime() <= viewInfo.selectedRegion.t0();
1238 auto it = std::find(clips.begin(), clips.end(), clip);
1239 auto index = std::distance(clips.begin(), it);
1241 auto &waveTrack = pChannel->GetTrack();
1242 auto wideClipIt = waveTrack.Intervals().first;
1243 std::advance(wideClipIt, waveTrack.GetClipIndex(clip->GetClip()));
1252 "%s, %d of %d clip",
1253 "%s, %d of %d clips",
1256 clip->GetClip().GetName(),
1257 static_cast<int>(index + 1),
1258 static_cast<int>(clips.size())
1267 return GetSubViews(&rect);
1276 int index;
float fraction; std::shared_ptr<ChannelView> pView;
1278 std::vector< Item > items;
1281 const auto &placements = DoGetPlacements();
1283 auto& placement = placements[ii];
1284 auto index = placement.index;
1285 auto fraction = placement.fraction;
1286 if (index >= 0 && fraction > 0.0)
1288 items.push_back({ index, fraction, subView.shared_from_this() });
1291 std::sort(items.begin(), items.end(), [](
const Item& a,
const Item& b) {
1292 return a.index < b.index;
1296 auto begin = items.begin(),
end = items.end(),
1297 newEnd = std::remove_if(
begin,
end,
1298 [](
const Item& item) {
return !item.pView; });
1299 items.erase(newEnd,
end);
1303 if (rect !=
nullptr)
1307 results.reserve(items.size());
1308 const auto top = rect->GetTop();
1309 const auto height = rect->GetHeight();
1311 wxCoord lastCoord = 0;
1312 for (
const auto& item : items) {
1313 wxCoord newCoord = top + (partial / total) * height;
1314 results.emplace_back(newCoord, item.pView);
1315 partial += item.fraction;
1319 mLastHeight = height;
1323 std::transform(items.begin(), items.end(), std::back_inserter(results), [](
const auto& item) {
1324 return std::make_pair(0, item.pView);
1340 wxKeyEvent& event,
ViewInfo& viewInfo, wxWindow* pParent,
1347 auto &track = pChannel->GetTrack();
1348 for (
auto pChannel : track.Channels()) {
1352 for (
auto &subView : waveChannelView.GetSubViews()) {
1354 wxASSERT(!event.GetSkipped());
1355 result |= subView.second->CaptureKey(event, viewInfo, pParent,
project);
1356 if (!event.GetSkipped()) {
1365 if (
auto affordance = waveChannelView.GetAffordanceControls()) {
1366 result |= affordance->CaptureKey(event, viewInfo, pParent,
project);
1367 if (!event.GetSkipped()) {
1375 switch (event.GetKeyCode())
1381 event, viewInfo, pParent,
project);
1384 if (!event.GetSkipped()) {
1392 wxKeyEvent& event,
ViewInfo& viewInfo, wxWindow* pParent,
1397 if (
auto pWaveChannelView =
1400 if (event.GetKeyCode() == WXK_TAB)
1406 result |= pWaveChannelView->CommonChannelView::KeyDown(
1407 event, viewInfo, pParent,
project);
1410 result |= delegate->KeyDown(event, viewInfo, pParent,
project);
1419 wxKeyEvent& event,
ViewInfo& viewInfo, wxWindow* pParent,
1424 if (
auto pWaveChannelView =
1426 result |= pWaveChannelView->CommonChannelView::Char(
1427 event, viewInfo, pParent,
project);
1429 result |= delegate->Char(event, viewInfo, pParent,
project);
1441 if (
auto pWaveChannelView =
1443 result = pWaveChannelView->CommonChannelView::LoseFocus(
project);
1445 result = delegate->LoseFocus(
project);
1456 const auto pTrack = &pWaveChannel->GetTrack();
1458 if (
const auto affordance =
1459 std::dynamic_pointer_cast<WaveTrackAffordanceControls>(
1460 channelView.GetAffordanceControls()).get()
1461 ; affordance && (affordance->*pmf)(
project)
1481 const ZoomInfo& zoomInfo,
const wxRect& viewRect)
1486 bool showSamples{
false };
1492 const ZoomInfo& zoomInfo,
const wxRect& viewRect)
1494 bool showSamples{
false };
1499 return clipRect.Inflate(2, 0);
1503 const ZoomInfo& viewInfo,
const wxRect& viewRect,
const wxPoint& pos)
1520std::vector<std::shared_ptr<WaveChannelSubView>>
1525 std::vector<std::shared_ptr<WaveChannelSubView>> results;
1527 results.push_back(std::static_pointer_cast<WaveChannelSubView>(
1528 subView.shared_from_this()));
1537 auto &track = pChannel->GetTrack();
1538 if (pChannel == *track.Channels().begin()) {
1556std::shared_ptr<CommonTrackCell>
1561 std::make_shared<WaveTrackAffordanceControls>(track.
SharedPointer());
1569 assert(
iChannel < channels.size());
1570 auto &iter = channels.first;
1572 return std::make_shared<WaveChannelView>(*iter);
1582 const std::shared_ptr<Track> &parent,
size_t iChannel)
1599 auto &track = pChannel->GetTrack();
1600 auto &topmostView =
Get(**track.Channels().begin());
1601 if (
auto affordance = std::dynamic_pointer_cast<WaveTrackAffordanceControls>(
1602 topmostView.GetAffordanceControls()))
1604 return *affordance->GetSelectedInterval();
1620 auto &placements = pThis->DoGetPlacements();
1621 if (placements.empty()) {
1627 pThis->SetMultiView(
true );
1631 pThis->DoSetDisplay( display, !multi );
1638 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(DoGetWaveChannelView)
std::vector< std::shared_ptr< WaveChannelSubView > > WaveChannelSubViewPtrs
constexpr int kClipDetailedViewMinimumWidth
std::vector< WaveChannelSubViewPlacement > WaveChannelSubViewPlacements
WaveTrackLocations FindWaveTrackLocations(const WaveTrack &track)
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...
std::shared_ptr< ChannelType > GetChannel(size_t iChannel)
Retrieve a channel, cast to the given type.
static ChannelView * Find(Channel *pChannel)
void Reparent(const std::shared_ptr< Track > &parent, size_t iChannel) override
Object may be shared among tracks but hold a special back-pointer to one of them; reassign it.
static ChannelView & Get(Channel &channel)
bool GetMinimized() const
virtual void DoSetMinimized(bool isMinimized)
void CopyTo(Track &track, size_t iChannel) const override
Copy state, for undo/redo purposes.
std::vector< std::pair< wxCoord, std::shared_ptr< ChannelView > > > Refinement
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.
auto FindChannel() -> std::shared_ptr< Subtype >
May return null.
Implements some hit-testing shared by many ChannelView subtypes.
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, std::shared_ptr< WaveTrack > pTrack)
bool setTimes(double t0, double t1)
static PitchAndSpeedDialog & Get(AudacityProject &project)
PitchAndSpeedDialog & Retarget(const std::shared_ptr< WaveTrack > &track, const WaveTrack::IntervalHolder &wideClip)
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
SubViewAdjuster mAdjuster
static UIHandlePtr HitTest(std::weak_ptr< SubViewAdjustHandle > &holder, WaveChannelView &view, WaveChannelSubView &subView, const TrackPanelMouseState &state)
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *) override
std::shared_ptr< const Track > FindTrack() const 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 wxRect GetButtonRect(const wxRect &rect)
SubViewCloseHandle(SubViewAdjuster &&adjuster, size_t index, const std::shared_ptr< Channel > &pChannel, const wxRect &rect)
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
std::weak_ptr< Channel > mpChannel
Result CommitChanges(const wxMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
static UIHandlePtr HitTest(std::weak_ptr< SubViewCloseHandle > &holder, WaveChannelView &view, WaveChannelSubView &subView, const TrackPanelMouseState &state)
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, WaveChannelView &view, WaveChannelSubView &subView, const TrackPanelMouseState &state)
std::vector< wxCoord > mHeights
SubViewAdjuster mAdjuster
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *) override
Result Cancel(AudacityProject *) override
std::shared_ptr< const Track > FindTrack() const override
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.
std::shared_ptr< Subclass > SharedPointer()
virtual unsigned CaptureKey(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
virtual void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
static WaveChannelViewConstants::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.
static std::shared_ptr< const Track > TrackFromChannel(const std::shared_ptr< const Channel > &pChannel)
A frequent convenience in the definition of UIHandles.
NotifyingSelectedRegion selectedRegion
static ViewInfo & Get(AudacityProject &project)
std::shared_ptr< WaveChannel > FindWaveChannel()
std::weak_ptr< SubViewAdjustHandle > mAdjustHandle
virtual const Type & SubViewType() const =0
std::weak_ptr< CutlineHandle > mCutlineHandle
static void DrawBoldBoundaries(TrackPanelDrawingContext &context, const WaveChannel &channel, const wxRect &rect)
virtual void CopyToSubView(WaveChannelSubView *destSubView) const
std::pair< bool, std::vector< UIHandlePtr > > DoDetailedHitTest(const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool, const std::shared_ptr< WaveChannel > &wt)
std::weak_ptr< TrackPanelResizeHandle > mResizeHandle
std::weak_ptr< WaveChannelView > mwWaveChannelView
std::weak_ptr< WaveClipAdjustBorderHandle > mClipBorderAdjustHandle
WaveChannelSubView(WaveChannelView &waveChannelView)
std::weak_ptr< SubViewCloseHandle > mCloseHandle
std::weak_ptr< WaveChannelView > GetWaveChannelView() const
std::weak_ptr< SubViewRearrangeHandle > mRearrangeHandle
std::vector< MenuItem > GetMenuItems(const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject) override
Return a list of items for DoContextMenu() (empties for separators)
std::vector< std::shared_ptr< WaveChannelSubView > > GetAllSubViews()
void SetDisplay(Display display, bool exclusive=true)
std::shared_ptr< CommonTrackCell > GetAffordanceControls() override
std::shared_ptr< WaveChannel > FindWaveChannel()
const WaveChannelSubViewPlacements & SavePlacements() const
bool GetMultiView() const
void BuildSubViews() const
std::shared_ptr< ChannelVRulerControls > DoGetVRulerControls() override
unsigned LoseFocus(AudacityProject *project) override
unsigned Char(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override
static WaveChannelView * Find(WaveChannel *pChannel)
std::shared_ptr< CommonTrackCell > DoGetAffordance(Track &track)
std::shared_ptr< CommonTrackCell > mpAffordanceCellControl
bool ToggleSubView(Display id)
std::weak_ptr< TrackPanelCell > mKeyEventDelegate
static bool ClipDetailsVisible(const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)
static bool HitTest(const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &rect, const wxPoint &pos)
unsigned KeyDown(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override
WaveTrack::IntervalHolder GetSelectedClip()
std::vector< UIHandlePtr > DetailedHitTest(const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool) override
~WaveChannelView() override
static WaveChannelView & Get(WaveChannel &channel)
static WaveChannelView * FindFirst(WaveTrack *pWt)
If pWt is not null, return a pointer to the view of the first channel.
bool CopySelectedText(AudacityProject &project)
WaveChannelSubViewPlacements & DoGetPlacements()
bool CutSelectedText(AudacityProject &project)
void DoSetMinimized(bool minimized) override
static constexpr int kChannelSeparatorThickness
unsigned CaptureKey(wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project) override
Refinement GetSubViews(const wxRect *rect=nullptr)
bool PasteText(AudacityProject &project)
static WaveChannelView & GetFirst(WaveTrack &wt)
Get the view of the first channel.
void DoSetDisplay(Display display, bool exclusive=true)
wxCoord GetLastHeight() const
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
bool SelectAllText(AudacityProject &project)
void CopyTo(Track &track, size_t iChannel) const override
Copy state, for undo/redo purposes.
void RestorePlacements(const WaveChannelSubViewPlacements &placements)
static std::pair< bool, std::vector< UIHandlePtr > > DoDetailedHitTest(const TrackPanelMouseState &state, const AudacityProject *pProject, int currentTool, bool bMultiTool, const std::shared_ptr< WaveChannel > &wt, CommonChannelView &view)
static wxRect ClipHitTestArea(const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect)
std::vector< WaveChannelSubView::Type > GetDisplays() const
bool SelectNextClip(ViewInfo &viewInfo, AudacityProject *project, bool forward)
void Reparent(const std::shared_ptr< Track > &parent, size_t iChannel) override
Object may be shared among tracks but hold a special back-pointer to one of them; reassign it.
static UIHandlePtr HitTest(std::weak_ptr< WaveClipAdjustBorderHandle > &holder, WaveChannelView &view, const AudacityProject *pProject, const TrackPanelMouseState &state)
bool OnTextCopy(AudacityProject &project)
bool OnTextSelect(AudacityProject &project)
bool OnTextCut(AudacityProject &project)
bool OnTextPaste(AudacityProject &project)
A Track that contains audio waveform data.
std::shared_ptr< Interval > IntervalHolder
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
AUDACITY_DLL_API void DrawCloseButton(TrackPanelDrawingContext &context, const wxRect &bev, const Channel *pChannel, UIHandle *target)
Namespace containing an enum 'what to do on a refresh?'.
WAVE_TRACK_API ClipPointer GetClipAtTime(WaveChannel &channel, double time)
WAVE_TRACK_API ClipPointers SortedClipArray(WaveChannel &channel)
Get clips sorted by play start time.
@ MultiView
"Multi" is special, not really a view type on par with the others.
std::vector< CommonTrackPanelCell::MenuItem > GetWaveClipMenuItems()
WAVE_TRACK_API WaveTrack::IntervalConstHolders GetClipsIntersecting(const WaveTrack &track, double t0, double t1)
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)
bool(WaveTrackAffordanceControls::*)(AudacityProject &) PMF
std::shared_ptr< WaveChannelInterval > NextClipLooped(ViewInfo &viewInfo, Iter begin, Iter end, Comp comp)
Iter SelectedClip(const ViewInfo &viewInfo, Iter begin, Iter end)
static const ChannelGroup::Attachments::RegisteredFactory key
bool AnyAffordance(AudacityProject &project, WaveChannelView &view, PMF pmf)
const char * end(const char *str) noexcept
const char * begin(const char *str) noexcept
void rotate(const float *oldPhase, const float *newPhase, std::complex< float > *dst, int32_t n)
For defining overrides of the method.
A convenient base class defining abstract virtual Clone() for a given kind of pointer.
static wxRect GetClipRect(const ClipTimes &clip, const ZoomInfo &zoomInfo, const wxRect &viewRect, bool *outShowSamples=nullptr)
SubViewAdjuster(WaveChannelView &view)
std::pair< size_t, bool > HitTest(WaveChannelSubView &subView, wxCoord yy, wxCoord top, wxCoord height)
WaveChannelSubViewPtrs mSubViews
WaveChannelSubViewPlacements mNewPlacements
std::vector< wxCoord > ComputeHeights(wxCoord totalHeight)
WaveChannelSubViewPlacements mOrigPlacements
void UpdateViews(bool rollback)
bool ModifyPermutation(bool top)
std::vector< size_t > mPermutation
std::weak_ptr< WaveChannelView > mwView
size_t FindIndex(WaveChannelSubView &subView) const
static Display Default()
Return a preferred type.
~PlacementArray()=default
std::unique_ptr< Cloneable<> > Clone() const
WaveChannelSubViewPlacements mPlacements