Kill BaseGrid::SelectVisible

Originally committed to SVN as r5600.
This commit is contained in:
Thomas Goyne 2011-09-15 05:17:43 +00:00
parent 11c40188c2
commit 683dd6c0a9
3 changed files with 18 additions and 21 deletions

View File

@ -324,25 +324,6 @@ void BaseGrid::SelectRow(int row, bool addToSelected, bool select) {
RefreshRect(wxRect(0, (row + 1 - yPos) * lineHeight, w, lineHeight), false);
}
void BaseGrid::SelectVisible() {
Selection new_selection;
int rows = GetRows();
bool selectedOne = false;
for (int i=0;i<rows;i++) {
AssDialogue *diag = GetDialogue(i);
if (IsDisplayed(diag)) {
if (!selectedOne) {
MakeCellVisible(i,0);
selectedOne = true;
}
new_selection.insert(diag);
}
}
SetSelectedSet(new_selection);
}
int BaseGrid::GetFirstSelRow() const {
if (selection.empty()) return -1;

View File

@ -142,7 +142,6 @@ public:
bool IsDisplayed(const AssDialogue *line) const;
void SelectRow(int row, bool addToSelected = false, bool select=true);
int GetFirstSelRow() const;
void SelectVisible();
wxArrayInt GetSelection() const;
void ClearMaps();

View File

@ -394,8 +394,25 @@ struct subtitle_select_visible : public Command {
CMD_TYPE(COMMAND_VALIDATE)
void operator()(agi::Context *c) {
if (!c->videoController->IsLoaded()) return;
c->videoController->Stop();
c->subsGrid->SelectVisible();
SubtitleSelectionController::Selection new_selection;
int frame = c->videoController->GetFrameN();
for (entryIter it = c->ass->Line.begin(); it != c->ass->Line.end(); ++it) {
AssDialogue *diag = dynamic_cast<AssDialogue*>(*it);
if (diag &&
c->videoController->FrameAtTime(diag->Start.GetMS(), agi::vfr::START) <= frame &&
c->videoController->FrameAtTime(diag->End.GetMS(), agi::vfr::END) >= frame)
{
if (new_selection.empty())
c->selectionController->SetActiveLine(diag);
new_selection.insert(diag);
}
}
c->selectionController->SetSelectedSet(new_selection);
}
bool Validate(agi::Context *c) {