34 const auto GetTrackHeight = [](
const Track *pTrack) ->
int {
45 return view.GetCumulativeHeightBefore() + view.GetHeight();
76 return std::make_shared<ChannelViewAttachments>(track,
88 auto &track =
static_cast<Track&
>(group);
113 leader->AdjustPositions();
122 std::stringstream stream{
name };
149 nValue = std::max( 40l,
std::min( nValue, 1000l ));
163 return { { rect.GetTop(), shared_from_this() } };
184std::shared_ptr<const ChannelVRulerControls>
257 .
Subscribe(*
this, &TrackPositioner::OnUpdate);
281 while (
auto pTrack = *iter) {
282 for (
auto pChannel : (*iter)->Channels()) {
284 view.SetCumulativeHeightBefore(yy);
285 yy += view.GetHeight();
296 return std::make_shared< TrackPositioner >(
project );
static const AttachedTrackObjects::RegisteredFactory keyC
DEFINE_ATTACHED_VIRTUAL(DoGetView)
Utility ClientData::Site to register hooks into a host class that attach client data.
const TranslatableString name
declares abstract base class Track, TrackList, and iterators over TrackList
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)
static int GetTotalHeight(const TrackList &list)
static ChannelView & Get(Channel &channel)
virtual std::shared_ptr< CommonTrackCell > GetAffordanceControls()
std::shared_ptr< ChannelVRulerControls > mpVRulerControls
virtual int GetMinimizedHeight() const =0
bool GetMinimized() const
virtual bool IsSpectral() const
virtual void DoSetMinimized(bool isMinimized)
void WriteXMLAttributes(XMLWriter &) const override
Serialize persistent attributes.
static int GetCumulativeHeight(const Channel *pChannel)
std::vector< std::pair< wxCoord, std::shared_ptr< ChannelView > > > Refinement
void SetMinimized(bool minimized)
int GetExpandedHeight() const
virtual Refinement GetSubViews(const wxRect &rect)
bool HandleXMLAttribute(const std::string_view &attr, const XMLAttributeValueView &valueView) override
Deserialize an attribute, returning true if recognized.
std::shared_ptr< ChannelVRulerControls > GetVRulerControls()
std::pair< int, int > vrulerSize
void CopyTo(Track &track) const override
Copy state, for undo/redo purposes.
static ChannelView & GetFromChannelGroup(ChannelGroup &group, size_t iChannel=0)
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...
size_t GetChannelIndex() const
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.
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)
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
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 HeightAttributeName(const ChannelView &view)
static const AudacityProject::AttachedObjects::RegisteredFactory key
std::string MinimizedAttributeName(const ChannelView &view)
std::string AttributeName(const ChannelView &view, std::string name)
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)