DoForSelectedIntervals.hpp
1 #pragma once
2 #include <Scenario/Document/Interval/IntervalModel.hpp>
3 #include <Scenario/Process/ScenarioModel.hpp>
4 
5 #include <score/application/ApplicationContext.hpp>
6 #include <score/document/DocumentContext.hpp>
7 #include <score/selection/SelectionStack.hpp>
8 
9 namespace Scenario
10 {
11 template <typename Fun>
12 void DoForSelectedIntervals(const score::DocumentContext& doc, Fun f)
13 {
14  using namespace std;
15 
16  // Fetch the selected intervals
17  auto selected_intervals
18  = filterSelectionByType<IntervalModel>(doc.selectionStack.currentSelection());
19 
20  if(selected_intervals.empty())
21  return;
22 
23  f(selected_intervals, doc.commandStack);
24 }
25 }
Main plug-in of score.
Definition: score-plugin-dataflow/Dataflow/PortItem.hpp:14
Definition: DocumentContext.hpp:18