Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
move_arranger_objects_command.h
1// SPDX-FileCopyrightText: © 2025-2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <chrono>
7#include <vector>
8
9#include "structure/arrangement/arranger_object.h"
10
11#include <QUndoCommand>
12
13namespace zrythm::commands
14{
15
16class MoveArrangerObjectsCommand : public QUndoCommand
17{
18public:
19 enum class VerticalChangeType : std::uint8_t
20 {
21 Pitch,
22 Velocity,
23 AutomationValue,
24 };
25
26 MoveArrangerObjectsCommand (
27 std::vector<structure::arrangement::ArrangerObjectUuidReference> objects,
28 units::precise_tick_t tick_delta,
29 double vertical_delta = 0.0,
30 VerticalChangeType vertical_change_type = VerticalChangeType::Pitch);
31
32 int id () const override { return 894553188; }
33
34 bool mergeWith (const QUndoCommand * other) override;
35
36 void undo () override;
37 void redo () override;
38
39private:
40 std::vector<structure::arrangement::ArrangerObjectUuidReference> objects_;
41 std::vector<units::precise_tick_t> original_positions_;
42 std::vector<double> original_vertical_positions_;
43 units::precise_tick_t tick_delta_;
44 double vertical_delta_{};
45 VerticalChangeType vertical_change_type_{};
46 std::chrono::time_point<std::chrono::steady_clock> last_redo_timestamp_;
47};
48
50 : public MoveArrangerObjectsCommand
51{
52public:
53 static constexpr int CommandId = 1762956469;
54 using MoveArrangerObjectsCommand::MoveArrangerObjectsCommand;
55
56 int id () const override { return CommandId; }
57};
58
59} // namespace zrythm::commands