32 const std::shared_ptr<Track> &parent,
size_t iChannel)
41 const auto GetChannelHeight = [](
const auto &pChannel) ->
int {
44 return pTrack ? pTrack->
Channels().sum(GetChannelHeight) : 0;
52 return view.GetCumulativeHeightBefore() + view.GetHeight();
83 return std::make_shared<ChannelViewAttachments>(track,
95 auto &track =
static_cast<Track&
>(group);
118 pTrack->AdjustPositions();
127 return name + std::to_string(index);
153 nValue = std::max( 40l,
std::min( nValue, 1000l ));
167 return { { rect.GetTop(), shared_from_this() } };
188std::shared_ptr<const ChannelVRulerControls>
261 .
Subscribe(*
this, &TrackPositioner::OnUpdate);
285 while (
auto pTrack = *iter) {
286 for (
auto pChannel : (*iter)->Channels()) {
288 view.SetCumulativeHeightBefore(yy);
289 yy += view.GetHeight();
300 return std::make_shared< TrackPositioner >(
project );
Adapts TrackAttachment interface with extra channel index argument.
static const AttachedTrackObjects::RegisteredFactory keyC
DEFINE_ATTACHED_VIRTUAL(DoGetView)
Utility ClientData::Site to register hooks into a host class that attach client data.
Class template generates single-dispatch, open method registry tables.
static Return Call(This &obj, Arguments ...arguments)
Invoke the method – but only after static initialization time.
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Holds multiple objects of the parameter type as a single attachment to Track.
static Attachment * Find(const AttachedTrackObjects::RegisteredFactory &key, Track *pTrack, size_t iChannel)
static Attachment & Get(const AttachedTrackObjects::RegisteredFactory &key, Track &track, size_t iChannel)
IteratorRange< ChannelIterator< ChannelType > > Channels()
Get range of channels with mutative access.
virtual size_t NChannels() const =0
Report the number of channels.
ChannelGroup & GetChannelGroup()
Channel object's lifetime is assumed to be nested in its Track's.
size_t GetChannelIndex() const
virtual std::shared_ptr< ChannelVRulerControls > DoGetVRulerControls()=0
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 int GetTotalHeight(const TrackList &list)
static ChannelView & Get(Channel &channel)
virtual std::shared_ptr< CommonTrackCell > GetAffordanceControls()
std::shared_ptr< ChannelVRulerControls > mpVRulerControls
static ChannelView & GetFromChannelGroup(ChannelGroup &group, size_t iChannel)
virtual int GetMinimizedHeight() const =0
bool GetMinimized() const
bool HandleXMLAttribute(const std::string_view &attr, const XMLAttributeValueView &valueView, size_t iChannel) override
Deserialize an attribute, returning true if recognized.
virtual bool IsSpectral() const
virtual void DoSetMinimized(bool isMinimized)
static int GetCumulativeHeight(const Channel *pChannel)
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
void SetMinimized(bool minimized)
int GetExpandedHeight() const
virtual Refinement GetSubViews(const wxRect &rect)
std::shared_ptr< ChannelVRulerControls > GetVRulerControls()
std::pair< int, int > vrulerSize
void WriteXMLAttributes(XMLWriter &writer, size_t iChannel) const override
Serialize persistent attributes.
static int GetChannelGroupHeight(const Track *pTrack)
void SetExpandedHeight(int height)
ChannelView(const ChannelView &)=delete
static ChannelView * FindFromChannelGroup(ChannelGroup *pGroup, size_t iChannel=0)
Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrie...
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.
std::shared_ptr< Track > FindTrack()
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
A move-only handle representing a connection to a Publisher.
static PendingTracks & Get(AudacityProject &project)
Abstract base class for an object holding data associated with points on a time axis.
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
TrackIter< Track > Find(Track *pTrack)
reverse_iterator rbegin()
static TrackList & Get(AudacityProject &project)
A view into an attribute value. The class does not take the ownership of the data.
bool TryGet(bool &value) const noexcept
Try to get a boolean value from the view.
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
void WriteAttr(const wxString &name, const Identifier &value)
std::string AttributeName(const std::string &name, size_t index)
std::string MinimizedAttributeName(size_t index)
std::string HeightAttributeName(size_t index)
static const AudacityProject::AttachedObjects::RegisteredFactory key
A convenient default parameter for class template Site.
Notification of changes in individual tracks of TrackList, or of TrackList's composition.
const std::weak_ptr< Track > mpTrack
@ RESIZING
Posted when some track changed its height.
@ DELETION
Posted when a track has been deleted from a tracklist. Also posted when one track replaces another.
@ ADDITION
Posted when a track has been added to a tracklist. Also posted when one track replaces another.
@ PERMUTED
Posted when tracks are reordered but otherwise unchanged.
Observer::Subscription mSubscription
TrackPositioner(const TrackPositioner &)=delete
AudacityProject & mProject
void OnUpdate(const TrackListEvent &e)
TrackPositioner & operator=(const TrackPositioner &)=delete
TrackPositioner(AudacityProject &project)