Loading...
Searching...
No Matches
ScenarioActions.hpp
1#pragma once
2#include <Process/Actions/ProcessActions.hpp>
3#include <Process/Layer/LayerContextMenu.hpp>
4
5#include <Scenario/Document/ScenarioDocument/ScenarioDocumentModel.hpp>
6#include <Scenario/Process/ScenarioModel.hpp>
7
9#include <score/selection/SelectionStack.hpp>
10
11namespace Scenario
12{
13class ScenarioInterface;
14class ScenarioDocumentModel;
15class ProcessModel;
16SCORE_PLUGIN_SCENARIO_EXPORT const Scenario::ScenarioInterface*
17focusedScenarioInterface(const score::DocumentContext& ctx);
18SCORE_PLUGIN_SCENARIO_EXPORT const Scenario::ProcessModel*
19focusedScenarioModel(const score::DocumentContext& ctx);
20
22class SCORE_PLUGIN_SCENARIO_EXPORT EnableWhenScenarioModelObject final
24{
25public:
27
28 static score::ActionConditionKey static_key();
29
30private:
31 void action(score::ActionManager& mgr, score::MaybeDocument doc) override;
32};
33
36{
37public:
39
40 static score::ActionConditionKey static_key();
41
42private:
43 void action(score::ActionManager& mgr, score::MaybeDocument doc) override;
44};
45
48{
49public:
51
52 static score::ActionConditionKey static_key();
53
54private:
55 void action(score::ActionManager& mgr, score::MaybeDocument doc) override;
56};
57}
58
61
62SCORE_DECLARE_FOCUSED_PROCESS_CONDITION(Scenario::ProcessModel)
63SCORE_DECLARE_FOCUSED_PROCESS_CONDITION(Scenario::ScenarioInterface)
64
69
70
71// View
72SCORE_DECLARE_ACTION(SelectAll, "&Select All", Scenario, QKeySequence::SelectAll)
73SCORE_DECLARE_ACTION(DeselectAll, "&Deselect All", Scenario, QKeySequence::Deselect)
74SCORE_DECLARE_ACTION(
75 SelectTop, "Select &Top", Scenario, QKeySequence{QObject::tr("Ctrl+Shift+T")})
76
77// Transport
78SCORE_DECLARE_ACTION(Play, "&Play", Scenario, Qt::Key_Space)
79SCORE_DECLARE_ACTION(PlayGlobal, "&Play Root", Scenario, QKeySequence("Shift+Space"))
80SCORE_DECLARE_ACTION(Stop, "&Stop", Scenario, Qt::Key_Return)
81SCORE_DECLARE_ACTION(GoToStart, "&Go to Start", Scenario, Qt::Key_Back)
82SCORE_DECLARE_ACTION(GoToEnd, "Go to &End", Scenario, Qt::Key_Forward)
83SCORE_DECLARE_ACTION(
84 Reinitialize, "&Reinitialize", Scenario, QKeySequence(QObject::tr("Ctrl+Return")))
85SCORE_DECLARE_ACTION(Record, "&Record", Scenario, QKeySequence::UnknownKey)
86
87// Edit
88SCORE_DECLARE_ACTION(SelectTool, "Tool &Select", Scenario, Qt::Key_S)
89SCORE_DECLARE_ACTION_2S(
90 CreateTool, "Tool &Create", Scenario, QKeySequence{QObject::tr("A")},
91 QKeySequence{QObject::tr("Shift+A")})
92SCORE_DECLARE_ACTION(PlayTool, "Tool &Play", Scenario, Qt::Key_P)
93
94// For those two the "shortcuts" are just shift and alt, but this is not supported
95// by QKeySequence. See ToolMenuActions.cpp
96SCORE_DECLARE_ACTION(LockMode, "&Lock", Scenario, QKeySequence{})
97SCORE_DECLARE_ACTION(Scale, "&Scale mode", Scenario, QKeySequence{})
98
99// Object
100#if defined(__APPLE__)
101SCORE_DECLARE_ACTION(RemoveElements, "&Remove elements", Scenario, Qt::Key_Backspace)
102#else
103SCORE_DECLARE_ACTION(RemoveElements, "&Remove elements", Scenario, Qt::Key_Delete)
104#endif
105SCORE_DECLARE_ACTION(CopyContent, "C&opy", Scenario, QKeySequence::Copy)
106SCORE_DECLARE_ACTION(CutContent, "C&ut", Scenario, QKeySequence::Cut)
107SCORE_DECLARE_ACTION(PasteElements, "&Paste (elements)", Scenario, QKeySequence::Paste)
108SCORE_DECLARE_ACTION(
109 PasteElementsAfter, "&Paste (after)", Scenario, QKeySequence::UnknownKey)
110SCORE_DECLARE_ACTION(
111 ElementsToJson, "Convert to &JSON", Scenario, QKeySequence::UnknownKey)
112
113// Event
114SCORE_DECLARE_ACTION(MergeEvents, "Merge events", Scenario, QKeySequence::UnknownKey)
115SCORE_DECLARE_ACTION(AddTrigger, "&Enable Trigger", Scenario, Qt::Key_T)
116SCORE_DECLARE_ACTION(
117 RemoveTrigger, "&Disable Trigger", Scenario, QKeySequence(QObject::tr("Shift+T")))
118
119SCORE_DECLARE_ACTION(AddCondition, "&Add Condition", Scenario, Qt::Key_C)
120SCORE_DECLARE_ACTION(
121 RemoveCondition, "&Remove Condition", Scenario, QKeySequence(QObject::tr("Shift+C")))
122
123// Interval
124SCORE_DECLARE_ACTION(AddProcess, "&Add a process", Scenario, QKeySequence::UnknownKey)
125SCORE_DECLARE_ACTION(
126 MergeTimeSyncs, "&Synchronize", Scenario, QKeySequence(QObject::tr("Shift+M")))
127SCORE_DECLARE_ACTION(ShowRacks, "&Show processes", Scenario, QKeySequence::UnknownKey)
128SCORE_DECLARE_ACTION(HideRacks, "&Hide processes", Scenario, QKeySequence::UnknownKey)
129
130SCORE_DECLARE_ACTION(
131 Encapsulate, "&Encapsulate", Scenario, QKeySequence(QObject::tr("Ctrl+Alt+E")))
132SCORE_DECLARE_ACTION(
133 Decapsulate, "&Decapsulate", Scenario, QKeySequence(QObject::tr("Ctrl+Alt+D")))
134SCORE_DECLARE_ACTION(
135 FoldIntervals, "Fold intervals", Scenario, QKeySequence(QObject::tr("Ctrl+Alt+F")))
136SCORE_DECLARE_ACTION(
137 UnfoldIntervals, "Unfold intervals", Scenario,
138 QKeySequence(QObject::tr("Ctrl+Alt+U")))
139SCORE_DECLARE_ACTION(
140 LevelUp, "Go to parent interval", Scenario, QKeySequence(QObject::tr("Ctrl+Alt+Up")))
141
142SCORE_DECLARE_ACTION(
143 Duplicate, "&Duplicate", Scenario, QKeySequence(QObject::tr("Alt+D")))
144
145SCORE_DECLARE_ACTION(
146 ShowCables, "&Show cables", Dataflow, QKeySequence(QObject::tr("Alt+Shift+G")))
147
148SCORE_DECLARE_ACTION(
149 AutoScroll, "&Auto-scroll", Dataflow, QKeySequence(QObject::tr("Alt+Shift+A")))
150
151// Navigation
152SCORE_DECLARE_ACTION(MoveUp, "&Move up", Scenario, Qt::UpArrow)
153SCORE_DECLARE_ACTION(MoveDown, "&Move down", Scenario, Qt::DownArrow)
154SCORE_DECLARE_ACTION(MoveLeft, "&Move left", Scenario, Qt::LeftArrow)
155SCORE_DECLARE_ACTION(MoveRight, "&Move right", Scenario, Qt::RightArrow)
156SCORE_DECLARE_ACTION(
157 GoToParent, "&Go to parent", Scenario, QKeySequence(QObject::tr("Ctrl+Up")))
158
160SCORE_PROCESS_DECLARE_CONTEXT_MENU(
161 SCORE_PLUGIN_SCENARIO_EXPORT, ScenarioObjectContextMenu)
162SCORE_PROCESS_DECLARE_CONTEXT_MENU(
163 SCORE_PLUGIN_SCENARIO_EXPORT, ScenarioModelContextMenu)
164SCORE_PROCESS_DECLARE_CONTEXT_MENU(SCORE_PLUGIN_SCENARIO_EXPORT, IntervalContextMenu)
165SCORE_PROCESS_DECLARE_CONTEXT_MENU(SCORE_PLUGIN_SCENARIO_EXPORT, EventContextMenu)
166SCORE_PROCESS_DECLARE_CONTEXT_MENU(SCORE_PLUGIN_SCENARIO_EXPORT, StateContextMenu)
#define SCORE_DECLARE_DOCUMENT_CONDITION(Type)
Definition Action.hpp:415
#define SCORE_DECLARE_SELECTED_OBJECT_CONDITION(Type)
Definition Action.hpp:312
Only events, nodes, states.
Definition ScenarioActions.hpp:36
Anything in a scenario interface.
Definition ScenarioActions.hpp:48
Anything in a scenario model.
Definition ScenarioActions.hpp:24
Definition EventModel.hpp:36
Definition IntervalModel.hpp:50
The core hierarchical and temporal process of score.
Definition ScenarioModel.hpp:37
Definition ScenarioDocumentModel.hpp:29
Definition ScenarioInterface.hpp:20
Definition StateModel.hpp:63
Definition TimeSyncModel.hpp:34
The ActionManager class.
Definition ActionManager.hpp:19
Main plug-in of score.
Definition score-plugin-dataflow/Dataflow/PortItem.hpp:13
The ActionCondition struct.
Definition Action.hpp:166
Definition DocumentContext.hpp:18