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)
|
||||
- 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)
|
||||
- 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 ===========================
|
||||
|
|
|
@ -96,8 +96,8 @@ DialogShiftTimes::DialogShiftTimes (wxWindow *parent,SubtitlesGrid *_grid,VideoD
|
|||
TimesSizer->Add(DirectionSizer,0,wxEXPAND | wxTOP,5);
|
||||
|
||||
// Selection
|
||||
wxString SelChoices[2] = { _("All rows"), _("Selected rows") };
|
||||
SelChoice = new wxRadioBox(this,-1,_("Affect"), wxDefaultPosition, wxDefaultSize, 2, SelChoices, 2, wxRA_SPECIFY_ROWS);
|
||||
wxString SelChoices[3] = { _("All rows"), _("Selected rows"), _("Selection onward") };
|
||||
SelChoice = new wxRadioBox(this,-1,_("Affect"), wxDefaultPosition, wxDefaultSize, 3, SelChoices, 3, wxRA_SPECIFY_ROWS);
|
||||
|
||||
// Times
|
||||
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")));
|
||||
}
|
||||
TimesChoice->SetSelection(Options.AsInt(_T("Shift Times Type")));
|
||||
if (Options.AsBool(_T("Shift Times All Rows"))) SelChoice->SetSelection(0);
|
||||
else SelChoice->SetSelection(1);
|
||||
SelChoice->SetSelection(Options.AsInt(_T("Shift Times Affect")));
|
||||
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
|
||||
LoadHistory(AegisubApp::folderName + _T("shift_history.txt"));
|
||||
}
|
||||
|
@ -186,40 +193,35 @@ void DialogShiftTimes::OnClose(wxCommandEvent &event) {
|
|||
void DialogShiftTimes::OnOK(wxCommandEvent &event) {
|
||||
// General values
|
||||
int type = TimesChoice->GetSelection();
|
||||
bool allrows = (SelChoice->GetSelection() == 0);
|
||||
int affect = SelChoice->GetSelection();
|
||||
bool allrows = affect == 0;
|
||||
bool selOnward = affect == 2;
|
||||
long len;
|
||||
bool byTime = RadioTime->GetValue();
|
||||
bool backward = DirectionBackward->GetValue();
|
||||
bool didSomething = false;
|
||||
|
||||
// Shift by time
|
||||
if (byTime) {
|
||||
len = ShiftTime->time.GetMS();
|
||||
if (backward) len = -len;
|
||||
|
||||
// Shift
|
||||
// Selection
|
||||
int nrows = grid->GetRows();
|
||||
for (int i=0;i<nrows;i++) {
|
||||
if (allrows || grid->IsInSelection(i,0)) {
|
||||
grid->ShiftLineByTime(i,len,type);
|
||||
didSomething = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
wxArrayInt sel = grid->GetSelection();
|
||||
int firstSel = 0;
|
||||
if (sel.Count()) firstSel = sel[0];
|
||||
|
||||
// Shift by frame
|
||||
else {
|
||||
ShiftFrame->GetValue().ToLong(&len);
|
||||
// Get length
|
||||
if (byTime) len = ShiftTime->time.GetMS();
|
||||
else ShiftFrame->GetValue().ToLong(&len);
|
||||
|
||||
// If backwards, invert
|
||||
if (backward) len = -len;
|
||||
|
||||
// Shift
|
||||
for (int i=0;i<grid->GetRows();i++) {
|
||||
if (allrows || grid->IsInSelection(i,0)) {
|
||||
grid->ShiftLineByFrames(i,len,type);
|
||||
for (int i=0;i<nrows;i++) {
|
||||
if (allrows || (i >= firstSel && selOnward) || grid->IsInSelection(i,0)) {
|
||||
if (byTime) grid->ShiftLineByTime(i,len,type);
|
||||
else grid->ShiftLineByFrames(i,len,type);
|
||||
didSomething = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add entry to history
|
||||
if (didSomething) {
|
||||
|
@ -227,19 +229,29 @@ void DialogShiftTimes::OnOK(wxCommandEvent &event) {
|
|||
wxString message = _T("");
|
||||
wxFileName assfile(AssFile::top->filename);
|
||||
wxString filename = assfile.GetFullName();
|
||||
|
||||
// File
|
||||
if (filename.IsEmpty()) message << _("unsaved, ");
|
||||
else message << filename << _T(", ");
|
||||
|
||||
// Time/frames
|
||||
if (byTime) message << ShiftTime->GetValue() << _T(" ");
|
||||
else message << len << _(" frames ");
|
||||
|
||||
// Forward/backwards
|
||||
if (backward) message << _("backward, ");
|
||||
else message << _("forward, ");
|
||||
|
||||
// Start/end
|
||||
if (type == 0) message << _("s+e, ");
|
||||
if (type == 1) message << _("s, ");
|
||||
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
|
||||
message << _("sel ");
|
||||
wxArrayInt sel = grid->GetSelection();
|
||||
int last = sel[0]-1;
|
||||
int first = sel[0];
|
||||
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);
|
||||
else message << wxString::Format(_T("%i"),first+1);
|
||||
}
|
||||
|
||||
// Done, append
|
||||
AppendToHistory(message);
|
||||
}
|
||||
|
||||
|
@ -260,7 +274,7 @@ void DialogShiftTimes::OnOK(wxCommandEvent &event) {
|
|||
Options.SetBool(_T("Shift Times ByTime"),byTime);
|
||||
Options.SetInt(_T("Shift Times Type"),type);
|
||||
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.Save();
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ void OptionsManager::LoadDefaults() {
|
|||
SetBool(_T("Shift Times ByTime"),true);
|
||||
SetInt(_T("Shift Times Type"),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);
|
||||
|
||||
SetInt(_T("Tips current"),0);
|
||||
|
|
Loading…
Reference in New Issue