forked from mia/Aegisub
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.
This commit is contained in:
parent
ae82498273
commit
2fea4bb1ba
1 changed files with 10 additions and 2 deletions
|
@ -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;i<count;i++) {
|
||||
grid->SelectRow(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);
|
||||
|
|
Loading…
Reference in a new issue