Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
range_action.h
1// SPDX-FileCopyrightText: © 2020-2021 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#ifndef __UNDO_RANGE_ACTION_H__
5#define __UNDO_RANGE_ACTION_H__
6
8#include "dsp/position.h"
9#include "dsp/transport.h"
11
18typedef enum RangeActionType
19{
20 RANGE_ACTION_INSERT_SILENCE,
21 RANGE_ACTION_REMOVE,
22} RangeActionType;
23
24typedef struct RangeAction
25{
26 UndoableAction parent_instance;
27
30 Position end_pos;
31
33 RangeActionType type;
34
39
42
46
49
51
52void
53range_action_init_loaded (RangeAction * self);
54
61WARN_UNUSED_RESULT UndoableAction *
63 RangeActionType type,
64 Position * start_pos,
65 Position * end_pos,
66 GError ** error);
67
68#define range_action_new_insert_silence(start, end, error) \
69 range_action_new (RANGE_ACTION_INSERT_SILENCE, start, end, error)
70
71#define range_action_new_remove(start, end, error) \
72 range_action_new (RANGE_ACTION_REMOVE, start, end, error)
73
74NONNULL RangeAction *
75range_action_clone (const RangeAction * src);
76
77bool
78range_action_perform (
79 RangeActionType type,
80 Position * start_pos,
81 Position * end_pos,
82 GError ** error);
83
84#define range_action_perform_insert_silence(start, end, error) \
85 range_action_perform (RANGE_ACTION_INSERT_SILENCE, start, end, error)
86
87#define range_action_perform_remove(start, end, error) \
88 range_action_perform (RANGE_ACTION_REMOVE, start, end, error)
89
90int
91range_action_do (RangeAction * self, GError ** error);
92
93int
94range_action_undo (RangeAction * self, GError ** error);
95
96char *
97range_action_stringize (RangeAction * self);
98
99void
100range_action_free (RangeAction * self);
101
106#endif
WARN_UNUSED_RESULT UndoableAction * range_action_new(RangeActionType type, Position *start_pos, Position *end_pos, GError **error)
Creates a new action.
Position struct and API.
A Position is made up of bars.beats.sixteenths.ticks.
Definition position.h:126
TimelineSelections * sel_after
Selections after the action.
Transport * transport
A copy of the transport at the start of the action.
Position start_pos
Range positions.
bool first_run
Whether this is the first run.
TimelineSelections * sel_before
Selections before the action, starting from objects intersecting with the start position and ending i...
RangeActionType type
Action type.
Selections to be used for the timeline's current selections, copying, undoing, etc.
The transport.
Definition transport.h:148
Base struct to be inherited by implementing undoable actions.
Current TimelineArranger selections.
Transport API.
Undoable actions.