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 
11 namespace Scenario
12 {
13 class ScenarioInterface;
14 class ScenarioDocumentModel;
15 class ProcessModel;
16 SCORE_PLUGIN_SCENARIO_EXPORT const Scenario::ScenarioInterface*
17 focusedScenarioInterface(const score::DocumentContext& ctx);
18 SCORE_PLUGIN_SCENARIO_EXPORT const Scenario::ProcessModel*
19 focusedScenarioModel(const score::DocumentContext& ctx);
20 
22 class SCORE_PLUGIN_SCENARIO_EXPORT EnableWhenScenarioModelObject final
23  : public score::ActionCondition
24 {
25 public:
27 
28  static score::ActionConditionKey static_key();
29 
30 private:
31  void action(score::ActionManager& mgr, score::MaybeDocument doc) override;
32 };
33 
36 {
37 public:
39 
40  static score::ActionConditionKey static_key();
41 
42 private:
43  void action(score::ActionManager& mgr, score::MaybeDocument doc) override;
44 };
45 
48 {
49 public:
51 
52  static score::ActionConditionKey static_key();
53 
54 private:
55  void action(score::ActionManager& mgr, score::MaybeDocument doc) override;
56 };
57 }
58 
61 
62 SCORE_DECLARE_FOCUSED_PROCESS_CONDITION(Scenario::ProcessModel)
63 SCORE_DECLARE_FOCUSED_PROCESS_CONDITION(Scenario::ScenarioInterface)
64 
69 
70 // View
72 SCORE_DECLARE_ACTION(SelectAll, "&Select All", Scenario, QKeySequence::SelectAll)
73 SCORE_DECLARE_ACTION(DeselectAll, "&Deselect All", Scenario, QKeySequence::Deselect)
74 SCORE_DECLARE_ACTION(
75  SelectTop, "Select &Top", Scenario, QKeySequence{QObject::tr("Ctrl+Shift+T")})
76 
77 // Transport
78 SCORE_DECLARE_ACTION(Play, "&Play", Scenario, Qt::Key_Space)
79 SCORE_DECLARE_ACTION(PlayGlobal, "&Play Root", Scenario, QKeySequence("Shift+Space"))
80 SCORE_DECLARE_ACTION(Stop, "&Stop", Scenario, Qt::Key_Return)
81 SCORE_DECLARE_ACTION(GoToStart, "&Go to Start", Scenario, Qt::Key_Back)
82 SCORE_DECLARE_ACTION(GoToEnd, "Go to &End", Scenario, Qt::Key_Forward)
83 SCORE_DECLARE_ACTION(
84  Reinitialize, "&Reinitialize", Scenario, QKeySequence(QObject::tr("Ctrl+Return")))
85 SCORE_DECLARE_ACTION(Record, "&Record", Scenario, QKeySequence::UnknownKey)
86 
87 // Edit
88 SCORE_DECLARE_ACTION(SelectTool, "Tool &Select", Scenario, Qt::Key_S)
89 SCORE_DECLARE_ACTION_2S(
90  CreateTool, "Tool &Create", Scenario, QKeySequence{QObject::tr("A")},
91  QKeySequence{QObject::tr("Shift+A")})
92 SCORE_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
96 SCORE_DECLARE_ACTION(LockMode, "&Lock", Scenario, QKeySequence{})
97 SCORE_DECLARE_ACTION(Scale, "&Scale mode", Scenario, QKeySequence{})
98 
99 // Object
100 #if defined(__APPLE__)
101 SCORE_DECLARE_ACTION(RemoveElements, "&Remove elements", Scenario, Qt::Key_Backspace)
102 #else
103 SCORE_DECLARE_ACTION(RemoveElements, "&Remove elements", Scenario, Qt::Key_Delete)
104 #endif
105 SCORE_DECLARE_ACTION(CopyContent, "C&opy", Scenario, QKeySequence::Copy)
106 SCORE_DECLARE_ACTION(CutContent, "C&ut", Scenario, QKeySequence::Cut)
107 SCORE_DECLARE_ACTION(PasteElements, "&Paste (elements)", Scenario, QKeySequence::Paste)
108 SCORE_DECLARE_ACTION(
109  PasteElementsAfter, "&Paste (after)", Scenario, QKeySequence::UnknownKey)
110 SCORE_DECLARE_ACTION(
111  ElementsToJson, "Convert to &JSON", Scenario, QKeySequence::UnknownKey)
112 
113 // Event
114 SCORE_DECLARE_ACTION(MergeEvents, "Merge events", Scenario, QKeySequence::UnknownKey)
115 SCORE_DECLARE_ACTION(AddTrigger, "&Enable Trigger", Scenario, Qt::Key_T)
116 SCORE_DECLARE_ACTION(
117  RemoveTrigger, "&Disable Trigger", Scenario, QKeySequence(QObject::tr("Shift+T")))
118 
119 SCORE_DECLARE_ACTION(AddCondition, "&Add Condition", Scenario, Qt::Key_C)
120 SCORE_DECLARE_ACTION(
121  RemoveCondition, "&Remove Condition", Scenario, QKeySequence(QObject::tr("Shift+C")))
122 
123 // Interval
124 SCORE_DECLARE_ACTION(AddProcess, "&Add a process", Scenario, QKeySequence::UnknownKey)
125 SCORE_DECLARE_ACTION(
126  MergeTimeSyncs, "&Synchronize", Scenario, QKeySequence(QObject::tr("Shift+M")))
127 SCORE_DECLARE_ACTION(ShowRacks, "&Show processes", Scenario, QKeySequence::UnknownKey)
128 SCORE_DECLARE_ACTION(HideRacks, "&Hide processes", Scenario, QKeySequence::UnknownKey)
129 
130 SCORE_DECLARE_ACTION(
131  Encapsulate, "&Encapsulate", Scenario, QKeySequence(QObject::tr("Ctrl+Alt+E")))
132 SCORE_DECLARE_ACTION(
133  Decapsulate, "&Decapsulate", Scenario, QKeySequence(QObject::tr("Ctrl+Alt+D")))
134 SCORE_DECLARE_ACTION(
135  FoldIntervals, "Fold intervals", Scenario, QKeySequence(QObject::tr("Ctrl+Alt+F")))
136 SCORE_DECLARE_ACTION(
137  UnfoldIntervals, "Unfold intervals", Scenario,
138  QKeySequence(QObject::tr("Ctrl+Alt+U")))
139 SCORE_DECLARE_ACTION(
140  LevelUp, "Go to parent interval", Scenario, QKeySequence(QObject::tr("Ctrl+Alt+Up")))
141 
142 SCORE_DECLARE_ACTION(
143  Duplicate, "&Duplicate", Scenario, QKeySequence(QObject::tr("Alt+D")))
144 
145 SCORE_DECLARE_ACTION(
146  ShowCables, "&Show cables", Dataflow, QKeySequence(QObject::tr("Alt+Shift+G")))
147 
148 SCORE_DECLARE_ACTION(
149  AutoScroll, "&Auto-scroll", Dataflow, QKeySequence(QObject::tr("Alt+Shift+A")))
150 
151 // Navigation
152 SCORE_DECLARE_ACTION(MoveUp, "&Move up", Scenario, Qt::UpArrow)
153 SCORE_DECLARE_ACTION(MoveDown, "&Move down", Scenario, Qt::DownArrow)
154 SCORE_DECLARE_ACTION(MoveLeft, "&Move left", Scenario, Qt::LeftArrow)
155 SCORE_DECLARE_ACTION(MoveRight, "&Move right", Scenario, Qt::RightArrow)
156 SCORE_DECLARE_ACTION(
157  GoToParent, "&Go to parent", Scenario, QKeySequence(QObject::tr("Ctrl+Up")))
158 
160 SCORE_PROCESS_DECLARE_CONTEXT_MENU(
161  SCORE_PLUGIN_SCENARIO_EXPORT, ScenarioObjectContextMenu)
162 SCORE_PROCESS_DECLARE_CONTEXT_MENU(
163  SCORE_PLUGIN_SCENARIO_EXPORT, ScenarioModelContextMenu)
164 SCORE_PROCESS_DECLARE_CONTEXT_MENU(SCORE_PLUGIN_SCENARIO_EXPORT, IntervalContextMenu)
165 SCORE_PROCESS_DECLARE_CONTEXT_MENU(SCORE_PLUGIN_SCENARIO_EXPORT, EventContextMenu)
166 SCORE_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:14
The ActionCondition struct.
Definition: Action.hpp:166
Definition: DocumentContext.hpp:18