|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
Base class for objects that have a name. More...
#include <src/structure/arrangement/named_object.h>


Public Types | |
| using | NameValidator = std::function<bool (const utils::Utf8String &)> |
Public Types inherited from zrythm::structure::arrangement::ArrangerObject | |
| enum class | ResizeType : basic_enum_base_type_t { Normal , Loop , Fade , Stretch , StretchTempoChange } |
| Flag used in some functions. More... | |
| enum class | Type : basic_enum_base_type_t { MidiRegion , AudioRegion , ChordRegion , AutomationRegion , MidiNote , ChordObject , ScaleObject , Marker , AutomationPoint } |
| The type of the object. More... | |
| enum class | Flags : basic_enum_base_type_t { NonProject = 1 << 0 } |
| Flags. More... | |
| enum class | PositionType : basic_enum_base_type_t { Start , End , ClipStart , LoopStart , LoopEnd , FadeIn , FadeOut } |
| using | SelectionStatusGetter = std::function<bool (const Uuid &)> |
| using | TrackUuid = structure::tracks::TrackUuid |
| using | Track = structure::tracks::Track |
| using | TrackResolver = structure::tracks::TrackResolver |
| using | TrackPtrVariant = structure::tracks::TrackPtrVariant |
| using | Position = zrythm::dsp::Position |
| using | ArrangerObjectPtr = ArrangerObject * |
Public Member Functions | |
| NamedObject (NameValidator validator=[](const utils::Utf8String &) { return true;}) | |
| utils::Utf8String | get_name () const |
| Returns the name of the object. | |
| void | gen_escaped_name () |
| Generates the escaped name for the object. | |
| void | set_name (this auto &&self, const utils::Utf8String &name) |
| Sets the name of the object. | |
| void | generate_name_from_automation_track (this auto &self, const auto &track, const auto &at) |
| void | generate_name_from_track (this auto &self, const auto &track) |
| void | generate_name (this auto &self, std::optional< utils::Utf8String > base_name, const auto *at, const auto *track) |
| void | set_name_with_action (const utils::Utf8String &name) |
| Changes the name and adds an action to the undo stack. | |
| utils::Utf8String | gen_human_friendly_name () const final |
| Generates a human readable name for the object. | |
Public Member Functions inherited from zrythm::structure::arrangement::ArrangerObject | |
| auto | get_type () const |
| bool | is_start_hit_by_range (const dsp::Position &start, const dsp::Position &end, bool range_start_inclusive=true, bool range_end_inclusive=false) const |
| Returns whether the given object is hit by the given range. | |
| bool | is_start_hit_by_range (const signed_frame_t global_frames_start, const signed_frame_t global_frames_end, bool range_start_inclusive=true, bool range_end_inclusive=false) const |
| void | set_parent_on_base_qproperties (QObject &derived) |
| Set the parent on QObject's that are children of this class. | |
| auto | get_position () const |
| Getter. | |
| void | position_setter_validated (const dsp::Position &pos, dsp::TicksPerFrame ticks_per_frame) |
| The setter is for use in e.g. | |
| void | set_position_unvalidated (const dsp::Position &pos) |
| bool | is_position_valid (const dsp::Position &pos, PositionType pos_type, dsp::TicksPerFrame ticks_per_frame) const |
| Returns if the given Position is valid. | |
| bool | set_position (const dsp::Position &pos, PositionType pos_type, bool validate, dsp::TicksPerFrame ticks_per_frame) |
| Sets the given position on the object, optionally attempting to validate before. | |
| void | move (double ticks, dsp::FramesPerTick frames_per_tick) |
| Moves the object by the given amount of ticks. | |
| void | set_track_id (const TrackUuid &track_id) |
| void | set_track_id (std::optional< TrackUuid > track_id) |
| void | unset_track_id () |
| void | update_positions (bool from_ticks, bool bpm_change, dsp::FramesPerTick frames_per_tick) |
| Updates the positions in each child recursively. | |
| auto | get_track () const |
| Returns the Track this ArrangerObject is in. | |
| std::optional< TrackUuid > | get_track_id () const |
| virtual bool | validate (bool is_project, dsp::FramesPerTick frames_per_tick) const =0 |
| Validates the arranger object. | |
| virtual ArrangerObjectPtrVariant | add_clone_to_project (bool fire_events) const =0 |
| Appends the ArrangerObject to where it belongs in the project (eg, a Track), without taking into account its previous index (eg, before deletion if undoing). | |
| virtual ArrangerObjectPtrVariant | insert_clone_to_project () const =0 |
| Inserts the object where it belongs in the project (eg, a Track). | |
| std::optional< ArrangerObjectPtrVariant > | remove_from_project (bool free_obj, bool fire_events=false) |
| Removes the object (which can be obtained from find_in_project()) from its parent in the project. | |
| void | set_selection_status_getter (SelectionStatusGetter getter) |
| void | unset_selection_status_getter () |
| virtual bool | is_deletable () const |
| Returns whether the given object is deletable or not (eg, start marker). | |
Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< ArrangerObject > | |
| UuidIdentifiableObject (const Uuid &id) | |
| UuidIdentifiableObject (const UuidIdentifiableObject &other)=default | |
| UuidIdentifiableObject (UuidIdentifiableObject &&other)=default | |
| UuidIdentifiableObject & | operator= (const UuidIdentifiableObject &other)=default |
| UuidIdentifiableObject & | operator= (UuidIdentifiableObject &&other)=default |
| auto | get_uuid () const |
Protected Attributes | |
| utils::Utf8String | name_ |
| Name to be shown on the widget. | |
| utils::Utf8String | escaped_name_ |
| Escaped name for drawing. | |
| NameValidator | name_validator_ |
Protected Attributes inherited from zrythm::structure::arrangement::ArrangerObject | |
| TrackResolver | track_resolver_ |
| utils::QObjectUniquePtr< PositionProxy > | pos_ |
| Position (or start Position if the object has length). | |
| std::optional< TrackUuid > | track_id_ |
| ID of the track this object belongs to. | |
| std::optional< SelectionStatusGetter > | selection_status_getter_ |
Friends | |
| void | init_from (NamedObject &obj, const NamedObject &other, utils::ObjectCloneType clone_type) |
| void | to_json (nlohmann::json &j, const NamedObject &named_object) |
| void | from_json (const nlohmann::json &j, NamedObject &named_object) |
Additional Inherited Members | |
Data Fields inherited from zrythm::structure::arrangement::ArrangerObject | |
| Flags | flags_ {} |
| Flags. | |
Static Public Attributes inherited from zrythm::structure::arrangement::ArrangerObject | |
| static constexpr double | DEFAULT_NUDGE_TICKS = 0.1 |
Protected Member Functions inherited from zrythm::structure::arrangement::ArrangerObject | |
| ArrangerObject (Type type, TrackResolver track_resolver) noexcept | |
| bool | are_members_valid (bool is_project, dsp::FramesPerTick frames_per_tick) const |
| To be called by validate() implementations. | |
Base class for objects that have a name.
This class provides a common interface for objects that have a name. It includes methods for getting, setting, and validating the name, as well as generating an escaped version of the name for drawing purposes.
Derived classes that require name validation must pass a validator callable to the constructor.
Definition at line 42 of file named_object.h.
| using zrythm::structure::arrangement::NamedObject::NameValidator = std::function<bool (const utils::Utf8String &)> |
Definition at line 45 of file named_object.h.
|
inline |
Definition at line 47 of file named_object.h.
|
inlinefinalvirtual |
Generates a human readable name for the object.
If the object has a name, this returns a copy of the name, otherwise generates something appropriate.
Reimplemented from zrythm::structure::arrangement::ArrangerObject.
Definition at line 121 of file named_object.h.
|
inline |
Definition at line 93 of file named_object.h.
|
inline |
Definition at line 79 of file named_object.h.
|
inline |
Definition at line 88 of file named_object.h.
|
inline |
Returns the name of the object.
Definition at line 59 of file named_object.h.
|
inline |
Sets the name of the object.
| name | The new name for the object. |
| fire_events | Whether to fire events when the name is changed. |
Definition at line 72 of file named_object.h.
| void zrythm::structure::arrangement::NamedObject::set_name_with_action | ( | const utils::Utf8String & | name | ) |
Changes the name and adds an action to the undo stack.
Calls set_name() internally.
|
friend |
Definition at line 139 of file named_object.h.
|
friend |
Definition at line 124 of file named_object.h.
|
friend |
Definition at line 135 of file named_object.h.
|
protected |
Escaped name for drawing.
Definition at line 150 of file named_object.h.
|
protected |
Name to be shown on the widget.
Definition at line 147 of file named_object.h.
|
protected |
Definition at line 152 of file named_object.h.