30 template <
typename ProcessScaleMethod>
31 static void updatePositions(
36 for(
auto it = propsToUpdate.timesyncs.cbegin(); it != propsToUpdate.timesyncs.cend();
39 auto& curTimenodeToUpdate = scenario.timeSync(it->first);
40 auto& curTimenodePropertiesToUpdate = it->second;
42 curTimenodeToUpdate.setDate(curTimenodePropertiesToUpdate.newDate);
45 for(
const auto& event : curTimenodeToUpdate.events())
47 scenario.events.at(event).setDate(curTimenodePropertiesToUpdate.newDate);
52 for(
auto& e : propsToUpdate.intervals)
54 auto curIntervalPropertiesToUpdate_id = e.first;
56 auto& curInterval = scenario.intervals.at(curIntervalPropertiesToUpdate_id);
57 auto& curIntervalPropertiesToUpdate = e.second;
60 const auto& date = Scenario::startEvent(curInterval, scenario).date();
61 const auto& endDate = Scenario::endEvent(curInterval, scenario).date();
63 TimeVal defaultDuration = endDate - date;
66 using namespace ossia;
67 if(curInterval.date() != date)
69 curInterval.setStartDate(date);
71 curInterval.duration.setDefaultDuration(defaultDuration);
73 curInterval.duration.setMinDuration(curIntervalPropertiesToUpdate.newMin);
74 curInterval.duration.setMaxDuration(curIntervalPropertiesToUpdate.newMax);
76 for(
auto& process : curInterval.processes)
78 scaleMethod(process, defaultDuration);
81 scenario.intervalMoved(&curInterval);
85 template <
typename ProcessScaleMethod>
86 static void revertPositions(
91 for(
auto it = propsToUpdate.timesyncs.cbegin(); it != propsToUpdate.timesyncs.cend();
94 auto& curTimenodeToUpdate = scenario.timeSync(it->first);
95 auto& curTimenodePropertiesToUpdate = it->second;
97 curTimenodeToUpdate.setDate(curTimenodePropertiesToUpdate.oldDate);
100 for(
const auto& event : curTimenodeToUpdate.events())
102 scenario.events.at(event).setDate(curTimenodePropertiesToUpdate.oldDate);
107 for(
auto& e : propsToUpdate.intervals)
109 auto curIntervalPropertiesToUpdate_id = e.first;
111 auto& curInterval = scenario.intervals.at(curIntervalPropertiesToUpdate_id);
115 const auto& date = Scenario::startEvent(curInterval, scenario).date();
116 const auto& endDate = Scenario::endEvent(curInterval, scenario).date();
118 TimeVal defaultDuration = endDate - date;
120 SCORE_ASSERT(defaultDuration == curIntervalPropertiesToUpdate.oldDefault);
123 using namespace ossia;
124 if(curInterval.date() != curIntervalPropertiesToUpdate.oldDate)
126 curInterval.setStartDate(curIntervalPropertiesToUpdate.oldDate);
128 curInterval.duration.setDefaultDuration(curIntervalPropertiesToUpdate.oldDefault);
131 curInterval.duration.setMinDuration(curIntervalPropertiesToUpdate.oldMin);
132 curInterval.duration.setMaxDuration(curIntervalPropertiesToUpdate.oldMax);
140 curInterval.clearSmallView();
144 auto processes = shallow_copy(curInterval.processes);
145 for(
auto process : processes)
148 RemoveProcess(curInterval, process->id());
155 curIntervalPropertiesToUpdate.reload(curInterval);
157 scenario.intervalMoved(&curInterval);
Definition DocumentContext.hpp:18