diff --git a/src/ass_karaoke.cpp b/src/ass_karaoke.cpp index b22b9e48f27a40a81941db1ac239f3887c62d824..1b17a663134171229d4cd37943059a26f91449d7 100644 --- a/src/ass_karaoke.cpp +++ b/src/ass_karaoke.cpp @@ -318,5 +318,5 @@ void AssKaraoke::SplitLines(std::set<AssDialogue*> const& lines, agi::Context *c AssDialogue *new_active = c->selectionController->GetActiveLine(); if (!sel.count(c->selectionController->GetActiveLine())) new_active = *sel.begin(); - c->selectionController->SetSelectionAndActive(sel, new_active); + c->selectionController->SetSelectionAndActive(std::move(sel), new_active); } diff --git a/src/auto4_lua.cpp b/src/auto4_lua.cpp index c6d71d59c98d4ac7af0eb4c3e7004f25ca28fb0c..eb55c153924894b8c08fea993b2404f9cc64ee97 100644 --- a/src/auto4_lua.cpp +++ b/src/auto4_lua.cpp @@ -949,7 +949,7 @@ namespace Automation4 { AssDialogue *new_active = c->selectionController->GetActiveLine(); if (active_line && (active_idx > 0 || !sel.count(new_active))) new_active = active_line; - c->selectionController->SetSelectionAndActive(sel, new_active); + c->selectionController->SetSelectionAndActive(std::move(sel), new_active); } else lua_pop(L, 1); diff --git a/src/base_grid.cpp b/src/base_grid.cpp index 274ea6c6f7a0ea0ab0b2ddb056ac0dab514b0a1a..382b840a37f45cf17481cbc49fa83b6902dce40d 100644 --- a/src/base_grid.cpp +++ b/src/base_grid.cpp @@ -298,7 +298,7 @@ void BaseGrid::UpdateMaps(bool preserve_selected_rows) { sel.insert(index_line_map[row]); } - SetSelectedSet(sel); + SetSelectedSet(std::move(sel)); } else { auto sorted = index_line_map; @@ -309,7 +309,7 @@ void BaseGrid::UpdateMaps(bool preserve_selected_rows) { sorted.begin(), sorted.end(), inserter(new_sel, new_sel.begin())); - SetSelectedSet(new_sel); + SetSelectedSet(std::move(new_sel)); } // The active line may have ceased to exist; pick a new one if so @@ -369,7 +369,7 @@ void BaseGrid::SelectRow(int row, bool addToSelected, bool select) { if (!addToSelected) { Selection sel; if (select) sel.insert(line); - SetSelectedSet(sel); + SetSelectedSet(std::move(sel)); return; } @@ -708,7 +708,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) { if (ctrl) newsel = selection; for (int i = i1; i <= i2; i++) newsel.insert(GetDialogue(i)); - SetSelectedSet(newsel); + SetSelectedSet(std::move(newsel)); return; } @@ -1006,7 +1006,7 @@ void BaseGrid::OnKeyDown(wxKeyEvent &event) { for (int i = begin; i <= end; i++) newsel.insert(GetDialogue(i)); - SetSelectedSet(newsel); + SetSelectedSet(std::move(newsel)); MakeRowVisible(next); return; diff --git a/src/command/edit.cpp b/src/command/edit.cpp index 3b99c8190e09d5d51e6113f338b984cc83330d05..8f974a6407014f55cfd1097cb989be744db57744 100644 --- a/src/command/edit.cpp +++ b/src/command/edit.cpp @@ -130,7 +130,7 @@ void paste_lines(agi::Context *c, bool paste_over, Paster&& paste_line) { c->ass->Commit(_("paste"), paste_over ? AssFile::COMMIT_DIAG_FULL : AssFile::COMMIT_DIAG_ADDREM); if (!paste_over) - c->selectionController->SetSelectionAndActive(newsel, first); + c->selectionController->SetSelectionAndActive(std::move(newsel), first); } } @@ -647,7 +647,7 @@ static void duplicate_lines(agi::Context *c, int shift) { c->ass->Commit(shift ? _("split") : _("duplicate lines"), AssFile::COMMIT_DIAG_ADDREM); - c->selectionController->SetSelectionAndActive(new_sel, new_active); + c->selectionController->SetSelectionAndActive(std::move(new_sel), new_active); } struct edit_line_duplicate : public validate_sel_nonempty { @@ -777,7 +777,7 @@ static bool try_paste_lines(agi::Context *c) { auto pos = c->ass->Line.iterator_to(*c->selectionController->GetActiveLine()); c->ass->Line.splice(pos, parsed, parsed.begin(), parsed.end()); c->ass->Commit(_("paste"), AssFile::COMMIT_DIAG_ADDREM); - c->selectionController->SetSelectionAndActive(new_selection, new_active); + c->selectionController->SetSelectionAndActive(std::move(new_selection), new_active); return true; } @@ -975,7 +975,7 @@ struct edit_line_recombine : public validate_sel_multiple { // Restore selection if (!new_sel.count(active_line)) active_line = *new_sel.begin(); - c->selectionController->SetSelectionAndActive(new_sel, active_line); + c->selectionController->SetSelectionAndActive(std::move(new_sel), active_line); c->ass->Commit(_("combining"), AssFile::COMMIT_DIAG_ADDREM | AssFile::COMMIT_DIAG_FULL); } diff --git a/src/command/subtitle.cpp b/src/command/subtitle.cpp index 0c258b7b8ded69fda417d2b03b8f64e405e8cf70..58cdf2153c895d7985b63f42a20c279df9654796 100644 --- a/src/command/subtitle.cpp +++ b/src/command/subtitle.cpp @@ -364,7 +364,7 @@ struct subtitle_select_all : public Command { transform(c->ass->Line.begin(), c->ass->Line.end(), inserter(sel, sel.begin()), cast<AssDialogue*>()); sel.erase(nullptr); - c->selectionController->SetSelectedSet(sel); + c->selectionController->SetSelectedSet(std::move(sel)); } }; @@ -394,7 +394,7 @@ struct subtitle_select_visible : public Command { } } - c->selectionController->SetSelectedSet(new_selection); + c->selectionController->SetSelectedSet(std::move(new_selection)); } bool Validate(const agi::Context *c) override { diff --git a/src/dialog_selection.cpp b/src/dialog_selection.cpp index 34d4c4ed3af144b440b08f26b3063fe36982e89c..929b3c7b28ef3ea93322d60abf64b2732d0c54d8 100644 --- a/src/dialog_selection.cpp +++ b/src/dialog_selection.cpp @@ -233,14 +233,10 @@ void DialogSelection::Process(wxCommandEvent&) { else StatusTimeout(message); - if (new_sel.size() && !new_sel.count(con->selectionController->GetActiveLine())) - con->selectionController->SetActiveLine(*new_sel.begin()); - con->selectionController->SetSelectedSet(new_sel); - AssDialogue *new_active = con->selectionController->GetActiveLine(); if (new_sel.size() && !new_sel.count(new_active)) new_active = *new_sel.begin(); - con->selectionController->SetSelectionAndActive(new_sel, new_active); + con->selectionController->SetSelectionAndActive(std::move(new_sel), new_active); Close(); } diff --git a/src/visual_tool.cpp b/src/visual_tool.cpp index c1977252a363a95b6c02112d871f46a395ee256b..3f6f80dac214b9cd8ec5f059743f933f6b1cb2d8 100644 --- a/src/visual_tool.cpp +++ b/src/visual_tool.cpp @@ -301,7 +301,7 @@ void VisualTool<FeatureType>::SetSelection(FeatureType *feat, bool clear) { if (!clear) sel = c->selectionController->GetSelectedSet(); if (sel.insert(feat->line).second) - c->selectionController->SetSelectedSet(sel); + c->selectionController->SetSelectedSet(std::move(sel)); } } @@ -324,7 +324,7 @@ void VisualTool<FeatureType>::RemoveSelection(FeatureType *feat) { if (feat->line == new_active) new_active = *sel.begin(); - c->selectionController->SetSelectionAndActive(sel, new_active); + c->selectionController->SetSelectionAndActive(std::move(sel), new_active); } //////// PARSERS