JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_MarkerList.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
38class JUCE_API MarkerList
39{
40public:
41 //==============================================================================
43 MarkerList();
45 MarkerList (const MarkerList&);
47 MarkerList& operator= (const MarkerList&);
50
51 //==============================================================================
53 class JUCE_API Marker
54 {
55 public:
57 Marker (const Marker&);
59 Marker (const String& name, const RelativeCoordinate& position);
60
63
76
78 bool operator== (const Marker&) const noexcept;
80 bool operator!= (const Marker&) const noexcept;
81 };
82
83 //==============================================================================
85 int getNumMarkers() const noexcept;
86
88 const Marker* getMarker (int index) const noexcept;
89
93 const Marker* getMarker (const String& name) const noexcept;
94
99 double getMarkerPosition (const Marker& marker, Component* parentComponent) const;
100
106 void setMarker (const String& name, const RelativeCoordinate& position);
107
109 void removeMarker (int index);
110
112 void removeMarker (const String& name);
113
115 bool operator== (const MarkerList&) const noexcept;
117 bool operator!= (const MarkerList&) const noexcept;
118
119 //==============================================================================
128 class JUCE_API Listener
129 {
130 public:
132 virtual ~Listener() = default;
133
135 virtual void markersChanged (MarkerList* markerList) = 0;
136
138 virtual void markerListBeingDeleted (MarkerList* markerList);
139 };
140
142 void addListener (Listener* listener);
143
145 void removeListener (Listener* listener);
146
148 void markersHaveChanged();
149
150 //==============================================================================
153 {
154 virtual ~MarkerListHolder() = default;
155
157 virtual MarkerList* getMarkers (bool xAxis) = 0;
158 };
159
160 //==============================================================================
163 {
164 public:
165 ValueTreeWrapper (const ValueTree& state);
166
167 ValueTree& getState() noexcept { return state; }
168 int getNumMarkers() const;
169 ValueTree getMarkerState (int index) const;
170 ValueTree getMarkerState (const String& name) const;
171 bool containsMarker (const ValueTree& state) const;
172 MarkerList::Marker getMarker (const ValueTree& state) const;
173 void setMarker (const MarkerList::Marker& marker, UndoManager* undoManager);
174 void removeMarker (const ValueTree& state, UndoManager* undoManager);
175
176 void applyTo (MarkerList& markerList);
177 void readFrom (const MarkerList& markerList, UndoManager* undoManager);
178
179 static const Identifier markerTag, nameProperty, posProperty;
180
181 private:
182 ValueTree state;
183 };
184
185private:
186 //==============================================================================
187 OwnedArray<Marker> markers;
188 ListenerList<Listener> listeners;
189
190 Marker* getMarkerByName (const String& name) const noexcept;
191
193};
194
195} // namespace juce
The base class for all JUCE user-interface objects.
Represents a string identifier, designed for accessing properties by name.
Holds a set of objects and can invoke a member function callback on each object in the set with a sin...
A class for receiving events when changes are made to a MarkerList.
virtual void markersChanged(MarkerList *markerList)=0
Called when something in the given marker list changes.
virtual ~Listener()=default
Destructor.
Represents a marker in a MarkerList.
String name
The marker's name.
RelativeCoordinate position
The marker's position.
Forms a wrapper around a ValueTree that can be used for storing a MarkerList.
Holds a set of named marker points along a one-dimensional axis.
An array designed for holding objects.
Expresses a coordinate as a dynamically evaluated expression.
The JUCE String class!
Definition juce_String.h:53
Manages a list of undo/redo commands.
A powerful tree structure that can be used to hold free-form data, and which can handle its own undo ...
#define JUCE_LEAK_DETECTOR(OwnerClass)
This macro lets you embed a leak-detecting object inside a class.
JUCE Namespace.
A base class for objects that want to provide a MarkerList.
virtual MarkerList * getMarkers(bool xAxis)=0
Objects can implement this method to provide a MarkerList.