From 2fea4bb1bafb475ac2ab4149a73235f5025565d5 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 30 Apr 2010 20:42:01 +0000 Subject: [PATCH] Ensure that after using the select lines dialog, the active line is always one of the selected lines. Updates #1176. Originally committed to SVN as r4253. --- aegisub/src/dialog_selection.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/aegisub/src/dialog_selection.cpp b/aegisub/src/dialog_selection.cpp index 70f0bc86a..7b9a39169 100644 --- a/aegisub/src/dialog_selection.cpp +++ b/aegisub/src/dialog_selection.cpp @@ -49,6 +49,7 @@ #include "help_button.h" #include "options.h" #include "subs_grid.h" +#include "subs_edit_box.h" /// @brief Constructor @@ -223,8 +224,8 @@ void DialogSelection::Process() { AssDialogue *current; int rows = grid->GetRows(); int action = Action->GetSelection(); - bool replaceSel = false; - if (action == 0) replaceSel = true; + bool replaceSel = (action == 0); + int firstSel = -1; int count = 0; // Build current selection list @@ -240,6 +241,7 @@ void DialogSelection::Process() { // Set/Add to selection if (action == 0 || action == 1) { grid->SelectRow(i,!replaceSel); + if (replaceSel) firstSel = i; replaceSel = false; count++; } @@ -267,10 +269,16 @@ void DialogSelection::Process() { if (action == 2 || action == 3) { grid->ClearSelection(); int count = sels.Count(); + if (count) { + grid->editBox->SetToLine(sels[0], true); + } for (int i=0;iSelectRow(sels[i],true); } } + else if (firstSel > -1) { + grid->editBox->SetToLine(firstSel, true); + } // Message saying number selected if (action == 0) wxMessageBox(wxString::Format(_("Selection was set to %i lines"),count), _("Selection"), wxOK);