Add rref overloads to SetSelectedSet and SetSelectionAndActive

This commit is contained in:
Thomas Goyne 2014-03-12 15:02:49 -07:00
parent 92ae789b46
commit 7c2363ee5b
3 changed files with 17 additions and 0 deletions

View File

@ -960,6 +960,12 @@ void BaseGrid::SetSelectedSet(const Selection &new_selection) {
Refresh(false);
}
void BaseGrid::SetSelectedSet(Selection&& new_selection) {
selection = std::move(new_selection);
AnnounceSelectedSetChanged();
Refresh(false);
}
void BaseGrid::SetActiveLine(AssDialogue *new_line) {
if (new_line != active_line) {
assert(new_line == nullptr || line_index_map.count(new_line));
@ -980,6 +986,13 @@ void BaseGrid::SetSelectionAndActive(Selection const& new_selection, AssDialogue
EndBatch();
}
void BaseGrid::SetSelectionAndActive(Selection&& new_selection, AssDialogue *new_line) {
BeginBatch();
SetSelectedSet(std::move(new_selection));
SetActiveLine(new_line);
EndBatch();
}
void BaseGrid::PrevLine() {
if (!active_line) return;
auto it = context->ass->Events.iterator_to(*active_line);

View File

@ -126,10 +126,12 @@ public:
// SelectionController implementation
void SetActiveLine(AssDialogue *new_line) override;
AssDialogue * GetActiveLine() const override { return active_line; }
void SetSelectedSet(Selection&& new_selection) override;
void SetSelectedSet(const Selection &new_selection) override;
void GetSelectedSet(Selection &res) const override { res = selection; }
Selection const& GetSelectedSet() const override { return selection; }
void SetSelectionAndActive(Selection const& new_selection, AssDialogue *new_line) override;;
void SetSelectionAndActive(Selection&& new_selection, AssDialogue *new_line) override;;
void NextLine() override;
void PrevLine() override;

View File

@ -98,6 +98,7 @@ public:
/// because the new set was identical to the old set, no change notification may
/// be sent.
virtual void SetSelectedSet(const Selection &new_selection) = 0;
virtual void SetSelectedSet(Selection&& new_selection) = 0;
/// @brief Obtain the selected set
/// @param[out] selection Filled with the selected set on return
@ -115,6 +116,7 @@ public:
/// change to either of them, and is guaranteed to announce the active line
/// change before the selection change.
virtual void SetSelectionAndActive(Selection const& new_selection, ItemDataType new_line) = 0;
virtual void SetSelectionAndActive(Selection&& new_selection, ItemDataType new_line) = 0;
/// @brief Change the active line to the next in sequence
///