Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
chord_action.h
1// SPDX-FileCopyrightText: © 2022, 2024 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/chord_descriptor.h"
7#include "gui/backend/backend/actions/undoable_action.h"
8
9namespace zrythm::gui::actions
10{
11
15class ChordAction : public QObject, public UndoableAction
16{
17 Q_OBJECT
18 QML_ELEMENT
19 DEFINE_UNDOABLE_ACTION_QML_PROPERTIES (ChordAction)
20
21public:
22 using ChordDescriptor = dsp::ChordDescriptor;
23
27 enum class Type
28 {
33
36 };
37
38 ChordAction (QObject * parent = nullptr);
39
47 const std::vector<ChordDescriptor> &chords_before,
48 const std::vector<ChordDescriptor> &chords_after,
49 QObject * parent = nullptr);
50
58 const ChordDescriptor &chord,
59 int chord_idx,
60 QObject * parent = nullptr);
61
62 QString to_string () const override;
63
64 friend void init_from (
65 ChordAction &obj,
66 const ChordAction &other,
67 utils::ObjectCloneType clone_type);
68
69private:
70 void init_loaded_impl () override { }
71 void perform_impl () override;
72 void undo_impl () override;
73
74 void do_or_undo (bool do_it);
75
76public:
77 Type type_ = (Type) 0;
78
79 ChordDescriptor chord_before_;
80 ChordDescriptor chord_after_;
81 int chord_idx_ = 0;
82
84 std::vector<ChordDescriptor> chords_before_;
85
87 std::vector<ChordDescriptor> chords_after_;
88};
89
90}; // namespace zrythm::gui::actions
A ChordDescriptor describes a chord and is not linked to any specific object by itself.
Action for chord pad changes.
std::vector< ChordDescriptor > chords_after_
Chords after the change.
ChordAction(const ChordDescriptor &chord, int chord_idx, QObject *parent=nullptr)
Creates a new action for changing a single chord.
std::vector< ChordDescriptor > chords_before_
Chords before the change.
QString to_string() const override
Stringizes the action to be used in Undo/Redo buttons.
ChordAction(const std::vector< ChordDescriptor > &chords_before, const std::vector< ChordDescriptor > &chords_after, QObject *parent=nullptr)
Creates a new action for changing all chords.