Timing Post-Processor can now be restricted to selection.

Originally committed to SVN as r743.
This commit is contained in:
Rodrigo Braz Monteiro 2007-01-08 03:27:47 +00:00
parent 0ad1815eed
commit 1e1d88b613
5 changed files with 22 additions and 6 deletions

View File

@ -101,7 +101,7 @@ public:
void SelectRow(int row, bool addToSelected = false, bool select=true); void SelectRow(int row, bool addToSelected = false, bool select=true);
void ClearSelection(); void ClearSelection();
bool IsInSelection(int row, int col) const; bool IsInSelection(int row, int col=0) const;
bool IsDisplayed(AssDialogue *line); bool IsDisplayed(AssDialogue *line);
int GetNumberSelection(); int GetNumberSelection();
int GetFirstSelRow(); int GetFirstSelRow();

View File

@ -83,6 +83,7 @@ Please visit http://aegisub.net to download latest version
- Added support for reading v4.00++ (ASS2) files. (AMZ) - Added support for reading v4.00++ (ASS2) files. (AMZ)
- Changes to text will no longer be discarded when you commit timing in the audio display and vice-versa. (AMZ) - Changes to text will no longer be discarded when you commit timing in the audio display and vice-versa. (AMZ)
- Fixed glitches related to the Duration time edit box. (AMZ) - Fixed glitches related to the Duration time edit box. (AMZ)
- Timing Post-Processor can now be restricted to selection. (AMZ)
= 1.10 beta - 2006.08.07 =========================== = 1.10 beta - 2006.08.07 ===========================

View File

@ -63,6 +63,12 @@ DialogTimingProcessor::DialogTimingProcessor(wxWindow *parent,SubtitlesGrid *_gr
thresEndAfter = Options.AsText(_T("Timing processor key end after thres")); thresEndAfter = Options.AsText(_T("Timing processor key end after thres"));
adjsThresTime = Options.AsText(_T("Timing processor adjascent thres")); adjsThresTime = Options.AsText(_T("Timing processor adjascent thres"));
// Options box
wxSizer *optionsSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Options"));
onlySelection = new wxCheckBox(this,-1,_("Affect selection only"));
onlySelection->SetValue(Options.AsBool(_T("Timing processor Only Selection")));
optionsSizer->Add(onlySelection,1,wxALL,0);
// Lead-in/out box // Lead-in/out box
wxSizer *LeadSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Lead-in/Lead-out")); wxSizer *LeadSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Lead-in/Lead-out"));
hasLeadIn = new wxCheckBox(this,CHECK_ENABLE_LEADIN,_("Add lead in:")); hasLeadIn = new wxCheckBox(this,CHECK_ENABLE_LEADIN,_("Add lead in:"));
@ -143,6 +149,7 @@ DialogTimingProcessor::DialogTimingProcessor(wxWindow *parent,SubtitlesGrid *_gr
// Right Sizer // Right Sizer
wxSizer *RightSizer = new wxBoxSizer(wxVERTICAL); wxSizer *RightSizer = new wxBoxSizer(wxVERTICAL);
RightSizer->Add(optionsSizer,0,wxBOTTOM|wxEXPAND,5);
RightSizer->Add(LeadSizer,0,wxBOTTOM|wxEXPAND,5); RightSizer->Add(LeadSizer,0,wxBOTTOM|wxEXPAND,5);
RightSizer->Add(AdjascentSizer,0,wxBOTTOM|wxEXPAND,5); RightSizer->Add(AdjascentSizer,0,wxBOTTOM|wxEXPAND,5);
RightSizer->Add(KeyframesSizer,0,wxBOTTOM|wxEXPAND,5); RightSizer->Add(KeyframesSizer,0,wxBOTTOM|wxEXPAND,5);
@ -195,6 +202,7 @@ void DialogTimingProcessor::UpdateControls() {
leadIn->Enable(hasLeadIn->IsChecked()); leadIn->Enable(hasLeadIn->IsChecked());
leadOut->Enable(hasLeadOut->IsChecked()); leadOut->Enable(hasLeadOut->IsChecked());
adjascentThres->Enable(adjsEnable->IsChecked()); adjascentThres->Enable(adjsEnable->IsChecked());
adjascentBias->Enable(adjsEnable->IsChecked());
// Keyframes are only available if timecodes are loaded // Keyframes are only available if timecodes are loaded
bool keysAvailable = grid->video->KeyFramesLoaded(); bool keysAvailable = grid->video->KeyFramesLoaded();
@ -285,6 +293,7 @@ void DialogTimingProcessor::OnApply(wxCommandEvent &event) {
Options.SetBool(_T("Timing processor Enable lead-out"),hasLeadOut->IsChecked()); Options.SetBool(_T("Timing processor Enable lead-out"),hasLeadOut->IsChecked());
if (keysEnable->IsEnabled()) Options.SetBool(_T("Timing processor Enable keyframe"),keysEnable->IsChecked()); if (keysEnable->IsEnabled()) Options.SetBool(_T("Timing processor Enable keyframe"),keysEnable->IsChecked());
Options.SetBool(_T("Timing processor Enable adjascent"),adjsEnable->IsChecked()); Options.SetBool(_T("Timing processor Enable adjascent"),adjsEnable->IsChecked());
Options.SetBool(_T("Timing processor Only Selection"),onlySelection->IsChecked());
Options.Save(); Options.Save();
// Check if rows are valid // Check if rows are valid
@ -345,12 +354,14 @@ void DialogTimingProcessor::SortDialogues() {
// Copy from original to temporary list // Copy from original to temporary list
std::list<AssDialogue*> temp; std::list<AssDialogue*> temp;
AssDialogue *tempDiag; AssDialogue *tempDiag;
for (std::list<AssEntry*>::iterator cur=grid->ass->Line.begin();cur!=grid->ass->Line.end();cur++) { int count = grid->GetRows();
tempDiag = AssEntry::GetAsDialogue(*cur); for (int i=0;i<count;i++) {
// Only add valid lines tempDiag = grid->GetDialogue(i);
if (tempDiag && StyleOK(tempDiag->Style) && !tempDiag->Comment) { if (tempDiag && StyleOK(tempDiag->Style) && !tempDiag->Comment) {
tempDiag->StartMS = tempDiag->Start.GetMS(); if (!onlySelection->IsChecked() || grid->IsInSelection(i)) {
temp.push_back(tempDiag); tempDiag->StartMS = tempDiag->Start.GetMS();
temp.push_back(tempDiag);
}
} }
} }
@ -358,6 +369,7 @@ void DialogTimingProcessor::SortDialogues() {
temp.sort(LessByPointedToValue<AssDialogue>()); temp.sort(LessByPointedToValue<AssDialogue>());
// Copy temporary list to final vector // Copy temporary list to final vector
Sorted.clear();
for (std::list<AssDialogue*>::iterator cur=temp.begin();cur!=temp.end();cur++) { for (std::list<AssDialogue*>::iterator cur=temp.begin();cur!=temp.end();cur++) {
Sorted.push_back(*cur); Sorted.push_back(*cur);
} }

View File

@ -56,6 +56,8 @@ private:
SubtitlesGrid *grid; SubtitlesGrid *grid;
wxStaticBoxSizer *KeyframesSizer; wxStaticBoxSizer *KeyframesSizer;
wxCheckBox *onlySelection;
wxTextCtrl *leadIn; wxTextCtrl *leadIn;
wxTextCtrl *leadOut; wxTextCtrl *leadOut;
wxCheckBox *hasLeadIn; wxCheckBox *hasLeadIn;

View File

@ -289,6 +289,7 @@ void OptionsManager::LoadDefaults() {
SetBool(_T("Timing processor Enable lead-out"),true); SetBool(_T("Timing processor Enable lead-out"),true);
SetBool(_T("Timing processor Enable keyframe"),true); SetBool(_T("Timing processor Enable keyframe"),true);
SetBool(_T("Timing processor Enable adjascent"),true); SetBool(_T("Timing processor Enable adjascent"),true);
SetBool(_T("Timing processor Only Selection"),false);
SetFloat(_T("Timing processor adjascent bias"),1.0); SetFloat(_T("Timing processor adjascent bias"),1.0);
SetText(_T("Select Text"),_T("")); SetText(_T("Select Text"),_T(""));