Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
undo_stack.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2020-2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __UNDO_UNDO_STACK_H__
11#define __UNDO_UNDO_STACK_H__
12
14#include "actions/channel_send_action.h"
15#include "actions/chord_action.h"
16#include "actions/midi_mapping_action.h"
17#include "actions/mixer_selections_action.h"
18#include "actions/port_action.h"
19#include "actions/port_connection_action.h"
20#include "actions/range_action.h"
21#include "actions/tracklist_selections.h"
23#include "utils/stack.h"
24#include "utils/yaml.h"
25
26typedef struct AudioClip AudioClip;
27
39typedef struct UndoStack
40{
43
44 /* the following are for serialization purposes only */
45
46 ArrangerSelectionsAction ** as_actions;
47 size_t num_as_actions;
48 size_t as_actions_size;
49
50 MixerSelectionsAction ** mixer_selections_actions;
51 size_t num_mixer_selections_actions;
52 size_t mixer_selections_actions_size;
53
54 TracklistSelectionsAction ** tracklist_selections_actions;
55 size_t num_tracklist_selections_actions;
56 size_t tracklist_selections_actions_size;
57
58 ChannelSendAction ** channel_send_actions;
59 size_t num_channel_send_actions;
60 size_t channel_send_actions_size;
61
62 PortConnectionAction ** port_connection_actions;
63 size_t num_port_connection_actions;
64 size_t port_connection_actions_size;
65
66 PortAction ** port_actions;
67 size_t num_port_actions;
68 size_t port_actions_size;
69
70 MidiMappingAction ** midi_mapping_actions;
71 size_t num_midi_mapping_actions;
72 size_t midi_mapping_actions_size;
73
74 RangeAction ** range_actions;
75 size_t num_range_actions;
76 size_t range_actions_size;
77
78 TransportAction ** transport_actions;
79 size_t num_transport_actions;
80 size_t transport_actions_size;
81
82 ChordAction ** chord_actions;
83 size_t num_chord_actions;
84 size_t chord_actions_size;
85
86} UndoStack;
87
88void
89undo_stack_init_loaded (UndoStack * self);
90
96
97NONNULL UndoStack *
98undo_stack_clone (const UndoStack * src);
99
103char *
105
111NONNULL size_t
113
114/* --- start wrappers --- */
115
116#define undo_stack_size(x) (stack_size ((x)->stack))
117
118#define undo_stack_is_empty(x) (stack_is_empty ((x)->stack))
119
120#define undo_stack_is_full(x) (stack_is_full ((x)->stack))
121
122#define undo_stack_peek(x) ((UndoableAction *) stack_peek ((x)->stack))
123
124#define undo_stack_peek_last(x) \
125 ((UndoableAction *) stack_peek_last ((x)->stack))
126
127void
128undo_stack_push (UndoStack * self, UndoableAction * action);
129
131undo_stack_pop (UndoStack * self);
132
138
139/* --- end wrappers --- */
140
141bool
142undo_stack_contains_clip (UndoStack * self, AudioClip * clip);
143
148bool
150
154NONNULL void
155undo_stack_get_plugins (UndoStack * self, GPtrArray * arr);
156
161void
162undo_stack_clear (UndoStack * self, bool free);
163
164void
165undo_stack_free (UndoStack * self);
166
171#endif
Action for a group of ArrangerObject's.
bool undo_stack_contains_action(UndoStack *self, UndoableAction *ua)
Checks if the undo stack contains the given action pointer.
NONNULL size_t undo_stack_get_total_cached_actions(UndoStack *self)
Returns the total cached actions.
void undo_stack_clear(UndoStack *self, bool free)
Clears the stack, optionally freeing all the elements.
NONNULL void undo_stack_get_plugins(UndoStack *self, GPtrArray *arr)
Returns the plugins referred to in the undo stack.
UndoStack * undo_stack_new(void)
Creates a new stack for undoable actions.
char * undo_stack_get_as_string(UndoStack *self, int limit)
Gets the list of actions as a string.
UndoableAction * undo_stack_pop_last(UndoStack *self)
Pops the last element and moves everything back.
Stack implementation.
Audio clips for the pool.
Definition clip.h:33
Action for channel send changes.
Action for chord pad changes.
MIDI mapping action.
Restrict selections to a channel.
Stack implementation.
Definition stack.h:32
Tracklist selections (tracks) action.
Transport action.
Serializable stack for undoable actions.
Definition undo_stack.h:40
Stack * stack
Actual stack used at runtime.
Definition undo_stack.h:42
Base struct to be inherited by implementing undoable actions.
Transport action.
YAML utils.