From 11c40188c2d59eedb7d4f37aa5075f97d9e2f10b Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 15 Sep 2011 05:17:36 +0000 Subject: [PATCH] Eliminate some old selection code in BaseGrid Originally committed to SVN as r5599. --- aegisub/src/base_grid.cpp | 18 ++---------------- aegisub/src/base_grid.h | 2 -- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/aegisub/src/base_grid.cpp b/aegisub/src/base_grid.cpp index 9363fc448..882b84423 100644 --- a/aegisub/src/base_grid.cpp +++ b/aegisub/src/base_grid.cpp @@ -343,12 +343,6 @@ void BaseGrid::SelectVisible() { SetSelectedSet(new_selection); } -bool BaseGrid::IsInSelection(int row) const { - return - static_cast(row) < line_index_map.size() && - selection.count(index_line_map[row]); -} - int BaseGrid::GetFirstSelRow() const { if (selection.empty()) return -1; @@ -363,14 +357,6 @@ int BaseGrid::GetFirstSelRow() const { return index; } -int BaseGrid::GetLastSelRow() const { - int frow = GetFirstSelRow(); - while (IsInSelection(frow)) { - frow++; - } - return frow-1; -} - wxArrayInt BaseGrid::GetSelection() const { wxArrayInt res(selection.size()); transform(selection.begin(), selection.end(), std::back_inserter(res), @@ -540,7 +526,7 @@ void BaseGrid::DrawImage(wxDC &dc, bool paint_columns[]) { // Set color curColor = 0; - bool inSel = IsInSelection(curRow); + bool inSel = !!selection.count(curDiag); if (inSel && curDiag->Comment) curColor = 5; else if (inSel) curColor = 2; else if (curDiag->Comment) curColor = 3; @@ -693,7 +679,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) { if ((click || holding || dclick) && dlg) { // Toggle selected if (click && ctrl && !shift && !alt) { - bool isSel = IsInSelection(row); + bool isSel = !!selection.count(dlg); if (isSel && selection.size() == 1) return; SelectRow(row,true,!isSel); if (dlg == GetActiveLine()) { diff --git a/aegisub/src/base_grid.h b/aegisub/src/base_grid.h index c4e978db6..89b3c8fab 100644 --- a/aegisub/src/base_grid.h +++ b/aegisub/src/base_grid.h @@ -141,9 +141,7 @@ public: bool IsDisplayed(const AssDialogue *line) const; void SelectRow(int row, bool addToSelected = false, bool select=true); - bool IsInSelection(int row) const; int GetFirstSelRow() const; - int GetLastSelRow() const; void SelectVisible(); wxArrayInt GetSelection() const;