mirror of https://github.com/odrling/Aegisub
Added a "Selection Onward" option to the Shift Times dialogue.
Originally committed to SVN as r660.
This commit is contained in:
parent
5d242641d8
commit
9037e186f9
|
@ -59,6 +59,8 @@ Please visit http://aegisub.net to download latest version
|
||||||
- A few minor tweaks to the Find dialogue. (AMZ)
|
- A few minor tweaks to the Find dialogue. (AMZ)
|
||||||
- Tweaked the behavior of the margin boxes, now they no longer show padding zeros. (AMZ)
|
- Tweaked the behavior of the margin boxes, now they no longer show padding zeros. (AMZ)
|
||||||
- Minor fix to the calculation of the grid's "Style" column width. (AMZ)
|
- Minor fix to the calculation of the grid's "Style" column width. (AMZ)
|
||||||
|
- Added a "Selection Onward" option to the Shift Times dialogue. (AMZ)
|
||||||
|
- Main menu was completely re-designed, including several new options. (AMZ)
|
||||||
|
|
||||||
|
|
||||||
= 1.10 beta - 2006.08.07 ===========================
|
= 1.10 beta - 2006.08.07 ===========================
|
||||||
|
|
|
@ -96,8 +96,8 @@ DialogShiftTimes::DialogShiftTimes (wxWindow *parent,SubtitlesGrid *_grid,VideoD
|
||||||
TimesSizer->Add(DirectionSizer,0,wxEXPAND | wxTOP,5);
|
TimesSizer->Add(DirectionSizer,0,wxEXPAND | wxTOP,5);
|
||||||
|
|
||||||
// Selection
|
// Selection
|
||||||
wxString SelChoices[2] = { _("All rows"), _("Selected rows") };
|
wxString SelChoices[3] = { _("All rows"), _("Selected rows"), _("Selection onward") };
|
||||||
SelChoice = new wxRadioBox(this,-1,_("Affect"), wxDefaultPosition, wxDefaultSize, 2, SelChoices, 2, wxRA_SPECIFY_ROWS);
|
SelChoice = new wxRadioBox(this,-1,_("Affect"), wxDefaultPosition, wxDefaultSize, 3, SelChoices, 3, wxRA_SPECIFY_ROWS);
|
||||||
|
|
||||||
// Times
|
// Times
|
||||||
wxString TimesChoices[3] = { _("Start and End times"), _("Start times only"), _("End times only") };
|
wxString TimesChoices[3] = { _("Start and End times"), _("Start times only"), _("End times only") };
|
||||||
|
@ -155,10 +155,17 @@ DialogShiftTimes::DialogShiftTimes (wxWindow *parent,SubtitlesGrid *_grid,VideoD
|
||||||
ShiftTime->SetTime(Options.AsInt(_T("Shift Times Length")));
|
ShiftTime->SetTime(Options.AsInt(_T("Shift Times Length")));
|
||||||
}
|
}
|
||||||
TimesChoice->SetSelection(Options.AsInt(_T("Shift Times Type")));
|
TimesChoice->SetSelection(Options.AsInt(_T("Shift Times Type")));
|
||||||
if (Options.AsBool(_T("Shift Times All Rows"))) SelChoice->SetSelection(0);
|
SelChoice->SetSelection(Options.AsInt(_T("Shift Times Affect")));
|
||||||
else SelChoice->SetSelection(1);
|
|
||||||
if (Options.AsBool(_T("Shift Times Direction"))) DirectionBackward->SetValue(true);
|
if (Options.AsBool(_T("Shift Times Direction"))) DirectionBackward->SetValue(true);
|
||||||
|
|
||||||
|
// Has selection?
|
||||||
|
wxArrayInt sel = grid->GetSelection();
|
||||||
|
if (sel.Count() == 0) {
|
||||||
|
SelChoice->Enable(1,false);
|
||||||
|
SelChoice->Enable(2,false);
|
||||||
|
SelChoice->SetSelection(0);
|
||||||
|
}
|
||||||
|
|
||||||
// Load history
|
// Load history
|
||||||
LoadHistory(AegisubApp::folderName + _T("shift_history.txt"));
|
LoadHistory(AegisubApp::folderName + _T("shift_history.txt"));
|
||||||
}
|
}
|
||||||
|
@ -186,40 +193,35 @@ void DialogShiftTimes::OnClose(wxCommandEvent &event) {
|
||||||
void DialogShiftTimes::OnOK(wxCommandEvent &event) {
|
void DialogShiftTimes::OnOK(wxCommandEvent &event) {
|
||||||
// General values
|
// General values
|
||||||
int type = TimesChoice->GetSelection();
|
int type = TimesChoice->GetSelection();
|
||||||
bool allrows = (SelChoice->GetSelection() == 0);
|
int affect = SelChoice->GetSelection();
|
||||||
|
bool allrows = affect == 0;
|
||||||
|
bool selOnward = affect == 2;
|
||||||
long len;
|
long len;
|
||||||
bool byTime = RadioTime->GetValue();
|
bool byTime = RadioTime->GetValue();
|
||||||
bool backward = DirectionBackward->GetValue();
|
bool backward = DirectionBackward->GetValue();
|
||||||
bool didSomething = false;
|
bool didSomething = false;
|
||||||
|
|
||||||
// Shift by time
|
// Selection
|
||||||
if (byTime) {
|
|
||||||
len = ShiftTime->time.GetMS();
|
|
||||||
if (backward) len = -len;
|
|
||||||
|
|
||||||
// Shift
|
|
||||||
int nrows = grid->GetRows();
|
int nrows = grid->GetRows();
|
||||||
for (int i=0;i<nrows;i++) {
|
wxArrayInt sel = grid->GetSelection();
|
||||||
if (allrows || grid->IsInSelection(i,0)) {
|
int firstSel = 0;
|
||||||
grid->ShiftLineByTime(i,len,type);
|
if (sel.Count()) firstSel = sel[0];
|
||||||
didSomething = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shift by frame
|
// Get length
|
||||||
else {
|
if (byTime) len = ShiftTime->time.GetMS();
|
||||||
ShiftFrame->GetValue().ToLong(&len);
|
else ShiftFrame->GetValue().ToLong(&len);
|
||||||
|
|
||||||
|
// If backwards, invert
|
||||||
if (backward) len = -len;
|
if (backward) len = -len;
|
||||||
|
|
||||||
// Shift
|
// Shift
|
||||||
for (int i=0;i<grid->GetRows();i++) {
|
for (int i=0;i<nrows;i++) {
|
||||||
if (allrows || grid->IsInSelection(i,0)) {
|
if (allrows || (i >= firstSel && selOnward) || grid->IsInSelection(i,0)) {
|
||||||
grid->ShiftLineByFrames(i,len,type);
|
if (byTime) grid->ShiftLineByTime(i,len,type);
|
||||||
|
else grid->ShiftLineByFrames(i,len,type);
|
||||||
didSomething = true;
|
didSomething = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Add entry to history
|
// Add entry to history
|
||||||
if (didSomething) {
|
if (didSomething) {
|
||||||
|
@ -227,19 +229,29 @@ void DialogShiftTimes::OnOK(wxCommandEvent &event) {
|
||||||
wxString message = _T("");
|
wxString message = _T("");
|
||||||
wxFileName assfile(AssFile::top->filename);
|
wxFileName assfile(AssFile::top->filename);
|
||||||
wxString filename = assfile.GetFullName();
|
wxString filename = assfile.GetFullName();
|
||||||
|
|
||||||
|
// File
|
||||||
if (filename.IsEmpty()) message << _("unsaved, ");
|
if (filename.IsEmpty()) message << _("unsaved, ");
|
||||||
else message << filename << _T(", ");
|
else message << filename << _T(", ");
|
||||||
|
|
||||||
|
// Time/frames
|
||||||
if (byTime) message << ShiftTime->GetValue() << _T(" ");
|
if (byTime) message << ShiftTime->GetValue() << _T(" ");
|
||||||
else message << len << _(" frames ");
|
else message << len << _(" frames ");
|
||||||
|
|
||||||
|
// Forward/backwards
|
||||||
if (backward) message << _("backward, ");
|
if (backward) message << _("backward, ");
|
||||||
else message << _("forward, ");
|
else message << _("forward, ");
|
||||||
|
|
||||||
|
// Start/end
|
||||||
if (type == 0) message << _("s+e, ");
|
if (type == 0) message << _("s+e, ");
|
||||||
if (type == 1) message << _("s, ");
|
if (type == 1) message << _("s, ");
|
||||||
if (type == 2) message << _("e, ");
|
if (type == 2) message << _("e, ");
|
||||||
if (allrows) message << _("all");
|
|
||||||
|
// Selection range
|
||||||
|
if (affect == 0) message << _("all");
|
||||||
|
else if (affect == 2) message << wxString::Format(_("from %i onward"),sel[0]);
|
||||||
else { // This huge block of code prints the selected ranges of subs
|
else { // This huge block of code prints the selected ranges of subs
|
||||||
message << _("sel ");
|
message << _("sel ");
|
||||||
wxArrayInt sel = grid->GetSelection();
|
|
||||||
int last = sel[0]-1;
|
int last = sel[0]-1;
|
||||||
int first = sel[0];
|
int first = sel[0];
|
||||||
for (unsigned int i=0;i<sel.Count();i++) {
|
for (unsigned int i=0;i<sel.Count();i++) {
|
||||||
|
@ -253,6 +265,8 @@ void DialogShiftTimes::OnOK(wxCommandEvent &event) {
|
||||||
if (first != last) message << wxString::Format(_T("%i"),first+1) << _T("-") << wxString::Format(_T("%i"),last+1);
|
if (first != last) message << wxString::Format(_T("%i"),first+1) << _T("-") << wxString::Format(_T("%i"),last+1);
|
||||||
else message << wxString::Format(_T("%i"),first+1);
|
else message << wxString::Format(_T("%i"),first+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Done, append
|
||||||
AppendToHistory(message);
|
AppendToHistory(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +274,7 @@ void DialogShiftTimes::OnOK(wxCommandEvent &event) {
|
||||||
Options.SetBool(_T("Shift Times ByTime"),byTime);
|
Options.SetBool(_T("Shift Times ByTime"),byTime);
|
||||||
Options.SetInt(_T("Shift Times Type"),type);
|
Options.SetInt(_T("Shift Times Type"),type);
|
||||||
Options.SetInt(_T("Shift Times Length"),len);
|
Options.SetInt(_T("Shift Times Length"),len);
|
||||||
Options.SetBool(_T("Shift Times All Rows"),allrows);
|
Options.SetInt(_T("Shift Times Affect"),affect);
|
||||||
Options.SetBool(_T("Shift Times Direction"),backward);
|
Options.SetBool(_T("Shift Times Direction"),backward);
|
||||||
Options.Save();
|
Options.Save();
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ void OptionsManager::LoadDefaults() {
|
||||||
SetBool(_T("Shift Times ByTime"),true);
|
SetBool(_T("Shift Times ByTime"),true);
|
||||||
SetInt(_T("Shift Times Type"),0);
|
SetInt(_T("Shift Times Type"),0);
|
||||||
SetInt(_T("Shift Times Length"),0);
|
SetInt(_T("Shift Times Length"),0);
|
||||||
SetBool(_T("Shift Times All Rows"),true);
|
SetInt(_T("Shift Times Affect"),0);
|
||||||
SetBool(_T("Shift Times Direction"),true);
|
SetBool(_T("Shift Times Direction"),true);
|
||||||
|
|
||||||
SetInt(_T("Tips current"),0);
|
SetInt(_T("Tips current"),0);
|
||||||
|
|
Loading…
Reference in New Issue