Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
undoable_action.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2018-2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __UNDO_UNDOABLE_ACTION_H__
11#define __UNDO_UNDOABLE_ACTION_H__
12
13#include <stdbool.h>
14
15#include "utils/types.h"
16#include "utils/yaml.h"
17
18typedef struct AudioClip AudioClip;
20
31{
32 /* ---- Track/Channel ---- */
33 UA_TRACKLIST_SELECTIONS,
34
35 UA_CHANNEL_SEND,
36
37 /* ---- end ---- */
38
39 UA_MIXER_SELECTIONS,
40 UA_ARRANGER_SELECTIONS,
41
42 /* ---- connections ---- */
43
44 UA_MIDI_MAPPING,
45 UA_PORT_CONNECTION,
46 UA_PORT,
47
48 /* ---- end ---- */
49
50 /* ---- range ---- */
51
52 UA_RANGE,
53
54 /* ---- end ---- */
55
56 UA_TRANSPORT,
57
58 UA_CHORD,
59
61
62static const cyaml_strval_t undoable_action_type_strings[] = {
63 {"Tracklist selections", UA_TRACKLIST_SELECTIONS},
64 { "Channel send", UA_CHANNEL_SEND },
65 { "Mixer selections", UA_MIXER_SELECTIONS },
66 { "Arranger selections", UA_ARRANGER_SELECTIONS },
67 { "MIDI mapping", UA_MIDI_MAPPING },
68 { "Port connection", UA_PORT_CONNECTION },
69 { "Port", UA_PORT },
70 { "Range", UA_RANGE },
71 { "Transport", UA_TRANSPORT },
72 { "Chord", UA_CHORD },
73};
74
114
115NONNULL void
116undoable_action_init_loaded (UndoableAction * self);
117
121NONNULL void
123
128NONNULL bool
130
139NONNULL bool
141
146NONNULL bool
148
149NONNULL void
150undoable_action_get_plugins (UndoableAction * self, GPtrArray * arr);
151
158NONNULL void
160
170NONNULL_ARGS (1)
172 UndoableAction * self,
173 bool _do,
174 PortConnectionsManager ** before,
175 PortConnectionsManager ** after);
176
184NONNULL_ARGS (1)
185int undoable_action_do (UndoableAction * self, GError ** error);
186
192NONNULL_ARGS (1)
193int undoable_action_undo (UndoableAction * self, GError ** error);
194
195void
196undoable_action_free (UndoableAction * self);
197
204NONNULL char *
206
211#endif
int undoable_action_undo(UndoableAction *self, GError **error)
Undoes the action.
NONNULL char * undoable_action_to_string(UndoableAction *ua)
Stringizes the action to be used in Undo/Redo buttons.
NONNULL void undoable_action_set_num_actions(UndoableAction *self, int num_actions)
Sets the number of actions for this action.
void undoable_action_save_or_load_port_connections(UndoableAction *self, bool _do, PortConnectionsManager **before, PortConnectionsManager **after)
To be used by actions that save/load port connections.
NONNULL bool undoable_action_needs_pause(UndoableAction *self)
Returns whether the action requires pausing the engine.
UndoableActionType
Type of UndoableAction.
NONNULL void undoable_action_init(UndoableAction *self, UndoableActionType type)
Initializer to be used by implementing actions.
NONNULL bool undoable_action_contains_clip(UndoableAction *self, AudioClip *clip)
Checks whether the action actually contains or refers to the given audio clip.
NONNULL bool undoable_action_can_contain_clip(UndoableAction *self)
Checks whether the action can contain an audio clip.
int undoable_action_do(UndoableAction *self, GError **error)
Performs the action.
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
uint32_t sample_rate_t
Sample rate.
Definition types.h:38
Audio clips for the pool.
Definition clip.h:33
Port connections manager.
Base struct to be inherited by implementing undoable actions.
int num_actions
Number of actions to perform.
UndoableActionType type
Undoable action type.
int stack_idx
Index in the stack.
double frames_per_tick
A snapshot of AudioEngine.frames_per_tick when the action is executed.
sample_rate_t sample_rate
Sample rate of this action.
Custom types.
YAML utils.