11#ifndef __GUI_BACKEND_ARRANGER_SELECTIONS_H__
12#define __GUI_BACKEND_ARRANGER_SELECTIONS_H__
26#define ARRANGER_SELECTIONS_MAGIC 35867752
27#define IS_ARRANGER_SELECTIONS(x) \
28 (((ArrangerSelections *) x)->magic == ARRANGER_SELECTIONS_MAGIC)
29#define IS_ARRANGER_SELECTIONS_AND_NONNULL(x) (x && IS_ARRANGER_SELECTIONS (x))
30#define ARRANGER_SELECTIONS(x) arranger_selections_cast (x)
32#define ARRANGER_SELECTIONS_DEFAULT_NUDGE_TICKS 0.1
34enum class ArrangerSelectionsType
36 ARRANGER_SELECTIONS_TYPE_NONE,
37 ARRANGER_SELECTIONS_TYPE_CHORD,
38 ARRANGER_SELECTIONS_TYPE_TIMELINE,
39 ARRANGER_SELECTIONS_TYPE_MIDI,
40 ARRANGER_SELECTIONS_TYPE_AUTOMATION,
41 ARRANGER_SELECTIONS_TYPE_AUDIO,
44static const char * arranger_selections_type_strings[] = {
45 "None",
"Chord",
"Timeline",
"MIDI",
"Automation",
"Audio",
51 ArrangerSelectionsType
type;
56enum class ArrangerSelectionsProperty
58 ARRANGER_SELECTIONS_PROPERTY_HAS_LENGTH,
59 ARRANGER_SELECTIONS_PROPERTY_CAN_LOOP,
60 ARRANGER_SELECTIONS_PROPERTY_HAS_LOOPED,
61 ARRANGER_SELECTIONS_PROPERTY_CAN_FADE,
64static inline const char *
67 return arranger_selections_type_strings[
static_cast<int> (self->
type)];
71arranger_selections_cast (
void * sel)
75 g_warning (
"%s", __func__);
230arranger_selections_redraw (
334arranger_selections_contains_unrenamable_object (
349 ArrangerSelectionsProperty property,
387arranger_selections_can_split_at_pos (
392arranger_selections_get_for_type (ArrangerSelectionsType type);
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
NONNULL bool arranger_selections_contains_object_with_property(ArrangerSelections *self, ArrangerSelectionsProperty property, bool value)
Checks whether an object matches the given parameters.
NONNULL void arranger_selections_remove_object(ArrangerSelections *self, ArrangerObject *obj)
Removes the arranger object from the selections.
NONNULL void arranger_selections_add_ticks(ArrangerSelections *self, const double ticks)
Moves the selections by the given amount of ticks.
NONNULL void arranger_selections_merge(ArrangerSelections *self)
Merges the given selections into one region.
NONNULL void arranger_selections_set_from_selections(ArrangerSelections *dest, ArrangerSelections *src)
Sets the values of each object in the dest selections to the values in the src selections.
NONNULL bool arranger_selections_verify(ArrangerSelections *self)
Verify that the objects are not invalid.
NONNULL void arranger_selections_post_deserialize(ArrangerSelections *self)
Code to run after deserializing.
NONNULL void arranger_selections_free_members(ArrangerSelections *self)
Frees anything allocated by the selections but not the objects or self itself.
NONNULL void arranger_selections_get_all_objects(const ArrangerSelections *self, GPtrArray *arr)
Appends all objects in the given array.
NONNULL ArrangerObject * arranger_selections_get_last_object(const ArrangerSelections *self, bool ends_last)
Gets last object.
NONNULL bool arranger_selections_all_on_same_lane(ArrangerSelections *self)
Returns whether all the selections are on the same lane (track lane or automation lane).
NONNULL void arranger_selections_get_start_pos(const ArrangerSelections *self, Position *pos, const bool global)
Returns the position of the leftmost object.
NONNULL void arranger_selections_free(ArrangerSelections *self)
Frees the selections but not the objects.
NONNULL void arranger_selections_add_object(ArrangerSelections *self, ArrangerObject *obj)
Appends the given object to the selections.
NONNULL void arranger_selections_init(ArrangerSelections *self, ArrangerSelectionsType type)
Initializes the selections.
NONNULL int arranger_selections_get_num_objects(const ArrangerSelections *self)
Returns the number of selected objects.
NONNULL bool arranger_selections_can_be_pasted(ArrangerSelections *self)
Returns if the selections can be pasted.
void arranger_selections_add_to_region(ArrangerSelections *self, Region *region, bool clone)
Adds each object in the selection to the given region (if applicable).
NONNULL int arranger_selections_contains_object(ArrangerSelections *self, ArrangerObject *obj)
Returns if the arranger object is in the selections or not.
NONNULL void arranger_selections_paste_to_pos(ArrangerSelections *self, Position *pos, bool undoable)
Pastes the given selections to the given Position.
NONNULL void arranger_selections_select_all(ArrangerSelections *self, bool fire_events)
Selects all possible objects from the project.
NONNULL void arranger_selections_free_full(ArrangerSelections *self)
Frees all the objects as well.
NONNULL void arranger_selections_clear(ArrangerSelections *self, bool free, bool fire_events)
Clears selections.
NONNULL ArrangerObject * arranger_selections_get_first_object(const ArrangerSelections *self)
Gets first object.
NONNULL bool arranger_selections_contains_unclonable_object(const ArrangerSelections *self)
Returns if the selections contain an unclonable object (such as the start marker).
NONNULL void arranger_selections_sort_by_indices(ArrangerSelections *sel, int desc)
Sorts the selections by their indices (eg, for regions, their track indices, then the lane indices,...
NONNULL bool arranger_selections_has_any(ArrangerSelections *self)
Returns if there are any selections.
ArrangerSelections * arranger_selections_new(ArrangerSelectionsType type)
Creates new arranger selections.
NONNULL bool arranger_selections_contains_undeletable_object(const ArrangerSelections *self)
Returns if the selections contain an undeletable object (such as the start marker).
void arranger_selections_init_loaded(ArrangerSelections *self, bool project, UndoableAction *action)
Inits the selections after loading a project.
NONNULL void arranger_selections_get_end_pos(ArrangerSelections *self, Position *pos, int global)
Returns the end position of the rightmost object.
NONNULL ArrangerSelections * arranger_selections_clone(const ArrangerSelections *self)
Clone the struct for copying, undoing, etc.
Base struct for arranger objects.
ArrangerSelectionsType type
Type of selections.
Audio clips for the pool.
A Position is made up of bars.beats.sixteenths.ticks.
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.
Base struct to be inherited by implementing undoable actions.