void DisplayedElementsModel::setSelection(const Selection & s) { m_startEvent->selection.set(s.find(m_startEvent) != s.end()); m_endEvent->selection.set(s.find(m_endEvent) != s.end()); m_startState->selection.set(s.find(m_startState) != s.end()); m_endState->selection.set(s.find(m_endState) != s.end()); m_constraint->selection.set(s.find(m_constraint) != s.end()); }
void ScenarioModel::setSelection(const Selection& s) const { // TODO optimize if possible? for(auto& elt : m_constraints) elt->selection.set(s.find(elt) != s.end()); for(auto& elt : m_events) elt->selection.set(s.find(elt) != s.end()); for(auto& elt : m_timeNodes) elt->selection.set(s.find(elt) != s.end()); for(auto& elt : m_states) elt->selection.set(s.find(elt) != s.end()); }
/// @brief Retrieve a list of selected lines in the actual ASS file (ie. not as displayed in the grid but as represented in the file) /// @return /// std::vector<int> SubtitlesGrid::GetAbsoluteSelection() const { Selection sel = GetSelectedSet(); std::vector<int> result; result.reserve(sel.size()); int line_index = 0; for (entryIter it = context->ass->Line.begin(); it != context->ass->Line.end(); ++it, ++line_index) { if (sel.find(dynamic_cast<AssDialogue*>(*it)) != sel.end()) result.push_back(line_index); } return result; }