Loading...
Searching...
No Matches
MoveNewEvent.hpp
1#pragma once
2
3#include "MoveEventOnCreationMeta.hpp"
4
5#include <Process/ExpandMode.hpp>
6#include <Process/TimeValue.hpp>
7
8#include <Scenario/Commands/ScenarioCommandFactory.hpp>
9
10#include <score/command/Command.hpp>
11#include <score/model/Identifier.hpp>
12#include <score/model/path/Path.hpp>
13#include <score/tools/Unused.hpp>
14#include <score/tools/std/Optional.hpp>
15
16#include <score_plugin_scenario_export.h>
17
18struct DataStreamInput;
19struct DataStreamOutput;
20
21/*
22 * Used on creation mode, when mouse is pressed and is moving.
23 * In this case, both vertical and horizontal move are allowed
24 */
25
26namespace Scenario
27{
28class EventModel;
29class IntervalModel;
30class ProcessModel;
31namespace Command
32{
33class SCORE_PLUGIN_SCENARIO_EXPORT MoveNewEvent final : public score::Command
34{
35 SCORE_COMMAND_DECL(CommandFactoryName(), MoveNewEvent, "Move a new event")
36public:
38 const Scenario::ProcessModel& scenarioPath, Id<IntervalModel> intervalId,
39 Id<EventModel> eventId, TimeVal date, const double y, bool yLocked);
41 const Scenario::ProcessModel& scenarioPath, Id<IntervalModel> intervalId,
42 Id<EventModel> eventId, TimeVal date, const double y, bool yLocked, ExpandMode);
43
44 void undo(const score::DocumentContext& ctx) const override;
45 void redo(const score::DocumentContext& ctx) const override;
46
47 void update(
48 Scenario::ProcessModel& s, unused_t, const Id<EventModel>& id, const TimeVal& date,
49 const double y, bool yLocked)
50 {
51 m_cmd.update(s, id, date, y, ExpandMode::Scale, LockMode::Free);
52 m_y = y;
53 m_yLocked = yLocked;
54 }
55
56 const Path<Scenario::ProcessModel>& path() const { return m_path; }
57
58protected:
59 void serializeImpl(DataStreamInput&) const override;
60 void deserializeImpl(DataStreamOutput&) override;
61
62private:
64 Id<IntervalModel> m_intervalId{};
65
67 double m_y{};
68 bool m_yLocked{true}; // default is true and intervals are on the same y.
69};
70}
71}
The Path class is a typesafe wrapper around ObjectPath.
Definition Path.hpp:52
Definition MoveEventOnCreationMeta.hpp:27
Definition MoveNewEvent.hpp:34
The core hierarchical and temporal process of score.
Definition ScenarioModel.hpp:37
The id_base_t class.
Definition Identifier.hpp:57
The Command class.
Definition Command.hpp:34
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition TimeValue.hpp:21
Definition DocumentContext.hpp:18
Definition Unused.hpp:3