Eliminate some old selection code in BaseGrid

Originally committed to SVN as r5599.
This commit is contained in:
Thomas Goyne 2011-09-15 05:17:36 +00:00
parent 05da23b22f
commit 11c40188c2
2 changed files with 2 additions and 18 deletions

View file

@ -343,12 +343,6 @@ void BaseGrid::SelectVisible() {
SetSelectedSet(new_selection);
}
bool BaseGrid::IsInSelection(int row) const {
return
static_cast<size_t>(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()) {

View file

@ -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;