Commiting text now commits times as well.

Originally committed to SVN as r1141.
This commit is contained in:
Rodrigo Braz Monteiro 2007-04-25 04:31:36 +00:00
parent 399a7396cf
commit 577295495e
3 changed files with 24 additions and 12 deletions

View file

@ -116,6 +116,7 @@ Please visit http://aegisub.net to download latest version
- Fixed drawing of inactive lines in audio display to prevent it from being drawn over selection. (AMZ)
- Style Editor dialog was redesigned to be more horizontal. (AMZ)
- Style Editor dialog received a realtime styles preview box. (AMZ)
- Commiting text now commits times as well. (AMZ)
= 1.10 beta - 2006.08.07 ===========================

View file

@ -627,6 +627,7 @@ void SubsEditBox::OnStartTimeChange(wxCommandEvent &event) {
if (StartTime->time > EndTime->time) StartTime->SetTime(EndTime->time.GetMS());
bool join = Options.AsBool(_T("Link Time Boxes Commit")) && EndTime->HasBeenModified();
StartTime->Update();
Duration->Update();
if (join) EndTime->Update();
CommitTimes(true,join,true);
}
@ -638,6 +639,7 @@ void SubsEditBox::OnEndTimeChange(wxCommandEvent &event) {
if (StartTime->time > EndTime->time) EndTime->SetTime(StartTime->time.GetMS());
bool join = Options.AsBool(_T("Link Time Boxes Commit")) && StartTime->HasBeenModified();
EndTime->Update();
Duration->Update();
if (join) StartTime->Update();
CommitTimes(join,true,false);
}
@ -647,6 +649,8 @@ void SubsEditBox::OnEndTimeChange(wxCommandEvent &event) {
// Duration changed
void SubsEditBox::OnDurationChange(wxCommandEvent &event) {
EndTime->SetTime(StartTime->time.GetMS() + Duration->time.GetMS());
StartTime->Update();
EndTime->Update();
Duration->Update();
CommitTimes(false,true,true);
}
@ -654,10 +658,9 @@ void SubsEditBox::OnDurationChange(wxCommandEvent &event) {
///////////////////////
// Commit time changes
void SubsEditBox::CommitTimes(bool start,bool end,bool fromStart) {
void SubsEditBox::CommitTimes(bool start,bool end,bool fromStart,bool commit) {
// Get selection
if (!start && !end) return;
grid->BeginBatch();
wxArrayInt sel = grid->GetSelection();
int n = sel.Count();
if (n == 0) return;
@ -677,18 +680,16 @@ void SubsEditBox::CommitTimes(bool start,bool end,bool fromStart) {
if (fromStart) cur->End = cur->Start;
else cur->Start = cur->End;
}
// Update
cur->UpdateData();
}
}
// Commit
grid->ass->FlagAsModified(_("commit times"));
grid->CommitChanges();
grid->EndBatch();
audio->SetDialogue(grid,grid->GetDialogue(sel[0]),sel[0]);
VideoContext::Get()->UpdateDisplays(false);
if (commit) {
grid->ass->FlagAsModified(_("modify times"));
grid->CommitChanges();
audio->SetDialogue(grid,grid->GetDialogue(sel[0]),sel[0]);
VideoContext::Get()->UpdateDisplays(false);
}
}
@ -866,8 +867,18 @@ void SubsEditBox::CommitText(bool weak) {
// Update line
if (cur) {
// Update text
cur->Text = TextEdit->GetText();
cur->UpdateData();
// Update times
cur->Start = StartTime->time;
cur->End = EndTime->time;
if (cur->Start > cur->End) cur->End = cur->Start;
StartTime->Update();
EndTime->Update();
Duration->Update();
// Update audio
if (!weak) {
grid->Refresh(false);
audio->SetDialogue(grid,cur,linen);

View file

@ -103,7 +103,7 @@ private:
wxSizer *BottomSizer;
void SetControlsState(bool state);
void CommitTimes(bool start,bool end,bool fromStart);
void CommitTimes(bool start,bool end,bool fromStart,bool commit=true);
int BlockAtPos(int pos);