mirror of https://github.com/odrling/Aegisub
Eliminate some old selection code in BaseGrid
Originally committed to SVN as r5599.
This commit is contained in:
parent
05da23b22f
commit
11c40188c2
|
@ -343,12 +343,6 @@ void BaseGrid::SelectVisible() {
|
||||||
SetSelectedSet(new_selection);
|
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 {
|
int BaseGrid::GetFirstSelRow() const {
|
||||||
if (selection.empty()) return -1;
|
if (selection.empty()) return -1;
|
||||||
|
|
||||||
|
@ -363,14 +357,6 @@ int BaseGrid::GetFirstSelRow() const {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BaseGrid::GetLastSelRow() const {
|
|
||||||
int frow = GetFirstSelRow();
|
|
||||||
while (IsInSelection(frow)) {
|
|
||||||
frow++;
|
|
||||||
}
|
|
||||||
return frow-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxArrayInt BaseGrid::GetSelection() const {
|
wxArrayInt BaseGrid::GetSelection() const {
|
||||||
wxArrayInt res(selection.size());
|
wxArrayInt res(selection.size());
|
||||||
transform(selection.begin(), selection.end(), std::back_inserter(res),
|
transform(selection.begin(), selection.end(), std::back_inserter(res),
|
||||||
|
@ -540,7 +526,7 @@ void BaseGrid::DrawImage(wxDC &dc, bool paint_columns[]) {
|
||||||
|
|
||||||
// Set color
|
// Set color
|
||||||
curColor = 0;
|
curColor = 0;
|
||||||
bool inSel = IsInSelection(curRow);
|
bool inSel = !!selection.count(curDiag);
|
||||||
if (inSel && curDiag->Comment) curColor = 5;
|
if (inSel && curDiag->Comment) curColor = 5;
|
||||||
else if (inSel) curColor = 2;
|
else if (inSel) curColor = 2;
|
||||||
else if (curDiag->Comment) curColor = 3;
|
else if (curDiag->Comment) curColor = 3;
|
||||||
|
@ -693,7 +679,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) {
|
||||||
if ((click || holding || dclick) && dlg) {
|
if ((click || holding || dclick) && dlg) {
|
||||||
// Toggle selected
|
// Toggle selected
|
||||||
if (click && ctrl && !shift && !alt) {
|
if (click && ctrl && !shift && !alt) {
|
||||||
bool isSel = IsInSelection(row);
|
bool isSel = !!selection.count(dlg);
|
||||||
if (isSel && selection.size() == 1) return;
|
if (isSel && selection.size() == 1) return;
|
||||||
SelectRow(row,true,!isSel);
|
SelectRow(row,true,!isSel);
|
||||||
if (dlg == GetActiveLine()) {
|
if (dlg == GetActiveLine()) {
|
||||||
|
|
|
@ -141,9 +141,7 @@ public:
|
||||||
|
|
||||||
bool IsDisplayed(const AssDialogue *line) const;
|
bool IsDisplayed(const AssDialogue *line) const;
|
||||||
void SelectRow(int row, bool addToSelected = false, bool select=true);
|
void SelectRow(int row, bool addToSelected = false, bool select=true);
|
||||||
bool IsInSelection(int row) const;
|
|
||||||
int GetFirstSelRow() const;
|
int GetFirstSelRow() const;
|
||||||
int GetLastSelRow() const;
|
|
||||||
void SelectVisible();
|
void SelectVisible();
|
||||||
wxArrayInt GetSelection() const;
|
wxArrayInt GetSelection() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue