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 "help_button.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "subs_grid.h"
|
#include "subs_grid.h"
|
||||||
|
#include "subs_edit_box.h"
|
||||||
|
|
||||||
|
|
||||||
/// @brief Constructor
|
/// @brief Constructor
|
||||||
|
@ -223,8 +224,8 @@ void DialogSelection::Process() {
|
||||||
AssDialogue *current;
|
AssDialogue *current;
|
||||||
int rows = grid->GetRows();
|
int rows = grid->GetRows();
|
||||||
int action = Action->GetSelection();
|
int action = Action->GetSelection();
|
||||||
bool replaceSel = false;
|
bool replaceSel = (action == 0);
|
||||||
if (action == 0) replaceSel = true;
|
int firstSel = -1;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
// Build current selection list
|
// Build current selection list
|
||||||
|
@ -240,6 +241,7 @@ void DialogSelection::Process() {
|
||||||
// Set/Add to selection
|
// Set/Add to selection
|
||||||
if (action == 0 || action == 1) {
|
if (action == 0 || action == 1) {
|
||||||
grid->SelectRow(i,!replaceSel);
|
grid->SelectRow(i,!replaceSel);
|
||||||
|
if (replaceSel) firstSel = i;
|
||||||
replaceSel = false;
|
replaceSel = false;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -267,10 +269,16 @@ void DialogSelection::Process() {
|
||||||
if (action == 2 || action == 3) {
|
if (action == 2 || action == 3) {
|
||||||
grid->ClearSelection();
|
grid->ClearSelection();
|
||||||
int count = sels.Count();
|
int count = sels.Count();
|
||||||
|
if (count) {
|
||||||
|
grid->editBox->SetToLine(sels[0], true);
|
||||||
|
}
|
||||||
for (int i=0;i<count;i++) {
|
for (int i=0;i<count;i++) {
|
||||||
grid->SelectRow(sels[i],true);
|
grid->SelectRow(sels[i],true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (firstSel > -1) {
|
||||||
|
grid->editBox->SetToLine(firstSel, true);
|
||||||
|
}
|
||||||
|
|
||||||
// Message saying number selected
|
// Message saying number selected
|
||||||
if (action == 0) wxMessageBox(wxString::Format(_("Selection was set to %i lines"),count), _("Selection"), wxOK);
|
if (action == 0) wxMessageBox(wxString::Format(_("Selection was set to %i lines"),count), _("Selection"), wxOK);
|
||||||
|
|
Loading…
Reference in a new issue