Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
clip_operator.h
1// SPDX-FileCopyrightText: © 2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "commands/set_clip_loop_points_command.h"
7#include "dsp/tick_types.h"
8#include "structure/arrangement/clip.h"
9#include "undo/undo_stack.h"
10#include "utils/iobject_registry.h"
11
12#include <QtQmlIntegration/qqmlintegration.h>
13
14namespace zrythm::actions
15{
16
30class ClipOperator : public QObject
31{
32 Q_OBJECT
33 Q_PROPERTY (
34 zrythm::structure::arrangement::Clip * clip READ clip WRITE setClip NOTIFY
35 clipChanged)
36 QML_ELEMENT
37 QML_UNCREATABLE ("One instance per project")
38
39public:
40 ClipOperator (
41 utils::IObjectRegistry &registry,
42 undo::UndoStack &undoStack,
43 QObject * parent = nullptr);
44
45 structure::arrangement::Clip * clip () const { return clip_; }
46 void setClip (structure::arrangement::Clip * clip);
47 Q_SIGNAL void clipChanged ();
48
51 Q_INVOKABLE void beginClipLoopPointsDrag ();
52
56 Q_INVOKABLE void updateClipLoopPointsDrag (
57 double clipStartTicks,
58 double loopStartTicks,
59 double loopEndTicks);
60
63 Q_INVOKABLE void endClipLoopPointsDrag ();
66 Q_INVOKABLE void abortClipLoopPointsDrag ();
67
68private:
69 utils::IObjectRegistry &registry_;
70 undo::UndoStack &undo_stack_;
72 bool drag_active_{ false };
74};
75
76} // namespace zrythm::actions
Q_INVOKABLE void beginClipLoopPointsDrag()
Begin a loop-points drag gesture.
Q_INVOKABLE void updateClipLoopPointsDrag(double clipStartTicks, double loopStartTicks, double loopEndTicks)
Live-update the clip's loop points to the given content-tick positions for visual feedback.
Q_INVOKABLE void abortClipLoopPointsDrag()
Revert the live preview to the pre-drag state without pushing a command.
Q_INVOKABLE void endClipLoopPointsDrag()
Commit the drag: push one SetClipLoopPointsCommand capturing the before/after states.
Intermediate base class for all clip types.
Definition clip.h:37
Abstract interface for a UUID-keyed object registry.
Snapshot of the three loop positions plus the track-bounds flag.