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
18enum class RangeActionType
19{
20 RANGE_ACTION_INSERT_SILENCE,
21 RANGE_ACTION_REMOVE,
22};
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 ( \
70 RangeActionType::RANGE_ACTION_INSERT_SILENCE, start, end, error)
71
72#define range_action_new_remove(start, end, error) \
73 range_action_new (RangeActionType::RANGE_ACTION_REMOVE, start, end, error)
74
75NONNULL RangeAction *
76range_action_clone (const RangeAction * src);
77
78bool
79range_action_perform (
80 RangeActionType type,
81 Position * start_pos,
82 Position * end_pos,
83 GError ** error);
84
85#define range_action_perform_insert_silence(start, end, error) \
86 range_action_perform ( \
87 RangeActionType::RANGE_ACTION_INSERT_SILENCE, start, end, error)
88
89#define range_action_perform_remove(start, end, error) \
90 range_action_perform (RangeActionType::RANGE_ACTION_REMOVE, start, end, error)
91
92int
93range_action_do (RangeAction * self, GError ** error);
94
95int
96range_action_undo (RangeAction * self, GError ** error);
97
98char *
99range_action_stringize (RangeAction * self);
100
101void
102range_action_free (RangeAction * self);
103
108#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:124
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:151
Base struct to be inherited by implementing undoable actions.
Current TimelineArranger selections.
Transport API.
Undoable actions.