forked from mia/Aegisub
Finished merging of SSA mode with standard mode and fixed auto-commit to work with it.
Originally committed to SVN as r720.
This commit is contained in:
parent
b3ddefa5ee
commit
7bdcb03fba
2 changed files with 37 additions and 35 deletions
|
@ -495,7 +495,7 @@ void AudioBox::OnPlayToEnd(wxCommandEvent &event) {
|
||||||
// Commit changes
|
// Commit changes
|
||||||
void AudioBox::OnCommit(wxCommandEvent &event) {
|
void AudioBox::OnCommit(wxCommandEvent &event) {
|
||||||
audioDisplay->SetFocus();
|
audioDisplay->SetFocus();
|
||||||
audioDisplay->CommitChanges();
|
audioDisplay->CommitChanges(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1150,51 +1150,52 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
||||||
// Loaded?
|
// Loaded?
|
||||||
if (!loaded) return;
|
if (!loaded) return;
|
||||||
|
|
||||||
|
// Check validity
|
||||||
|
bool wasKaraSplitting = false;
|
||||||
|
bool validCommit = true;
|
||||||
if (!box->audioKaraoke->splitting) {
|
if (!box->audioKaraoke->splitting) {
|
||||||
// Check if there's any need to commit
|
if (!NeedCommit || curEndMS < curStartMS) validCommit = false;
|
||||||
if (!NeedCommit) return;
|
|
||||||
|
|
||||||
// Check if selection is valid
|
|
||||||
if (curEndMS < curStartMS) return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset flags
|
|
||||||
diagUpdated = false;
|
|
||||||
NeedCommit = false;
|
|
||||||
|
|
||||||
// Update karaoke
|
// Update karaoke
|
||||||
int karSyl = 0;
|
int karSyl = 0;
|
||||||
bool wasKaraSplitting = false;
|
|
||||||
if (karaoke->enabled) {
|
if (karaoke->enabled) {
|
||||||
wasKaraSplitting = box->audioKaraoke->splitting;
|
wasKaraSplitting = box->audioKaraoke->splitting;
|
||||||
karaoke->Commit();
|
karaoke->Commit();
|
||||||
karSyl = karaoke->curSyllable;
|
karSyl = karaoke->curSyllable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Commit ok?
|
||||||
|
if (validCommit) {
|
||||||
|
// Reset flags
|
||||||
|
diagUpdated = false;
|
||||||
|
NeedCommit = false;
|
||||||
|
|
||||||
// Update dialogues
|
// Update dialogues
|
||||||
blockUpdate = true;
|
blockUpdate = true;
|
||||||
wxArrayInt sel = grid->GetSelection();
|
wxArrayInt sel = grid->GetSelection();
|
||||||
int sels = (int)sel.Count();
|
int sels = (int)sel.Count();
|
||||||
AssDialogue *curDiag;
|
AssDialogue *curDiag;
|
||||||
for (int i=-1;i<sels;i++) {
|
for (int i=-1;i<sels;i++) {
|
||||||
if (i == -1) curDiag = dialogue;
|
if (i == -1) curDiag = dialogue;
|
||||||
else {
|
else {
|
||||||
curDiag = grid->GetDialogue(sel[i]);
|
curDiag = grid->GetDialogue(sel[i]);
|
||||||
if (curDiag == dialogue) continue;
|
if (curDiag == dialogue) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
curDiag->Start.SetMS(curStartMS);
|
||||||
|
curDiag->End.SetMS(curEndMS);
|
||||||
|
curDiag->UpdateData();
|
||||||
}
|
}
|
||||||
|
|
||||||
curDiag->Start.SetMS(curStartMS);
|
// Update grid
|
||||||
curDiag->End.SetMS(curEndMS);
|
grid->editBox->Update(!karaoke->enabled);
|
||||||
curDiag->UpdateData();
|
grid->ass->FlagAsModified();
|
||||||
|
grid->CommitChanges();
|
||||||
|
karaoke->curSyllable = karSyl;
|
||||||
|
blockUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update grid
|
|
||||||
grid->editBox->Update(!karaoke->enabled);
|
|
||||||
grid->ass->FlagAsModified();
|
|
||||||
grid->CommitChanges();
|
|
||||||
karaoke->curSyllable = karSyl;
|
|
||||||
blockUpdate = false;
|
|
||||||
|
|
||||||
// Next line
|
// Next line
|
||||||
if (nextLine && Options.AsBool(_T("Audio Next Line on Commit")) && !wasKaraSplitting) {
|
if (nextLine && Options.AsBool(_T("Audio Next Line on Commit")) && !wasKaraSplitting) {
|
||||||
// Insert a line if it doesn't exist
|
// Insert a line if it doesn't exist
|
||||||
|
@ -1599,12 +1600,13 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
|
||||||
if (hold != 0) {
|
if (hold != 0) {
|
||||||
// Dragging
|
// Dragging
|
||||||
if (buttonIsDown) {
|
if (buttonIsDown) {
|
||||||
// Drag from nothing
|
// Drag from nothing or straight timing
|
||||||
if (hold == 3 && buttonIsDown) {
|
if (hold == 3 && buttonIsDown) {
|
||||||
if (!karMode) {
|
if (!karMode) {
|
||||||
if (leftIsDown) curStartMS = GetMSAtX(x);
|
if (leftIsDown) curStartMS = GetMSAtX(x);
|
||||||
else curEndMS = GetMSAtX(x);
|
else curEndMS = GetMSAtX(x);
|
||||||
updated = true;
|
updated = true;
|
||||||
|
diagUpdated = true;
|
||||||
|
|
||||||
if (x != lastX) {
|
if (x != lastX) {
|
||||||
selStart = x;
|
selStart = x;
|
||||||
|
@ -1834,13 +1836,13 @@ void AudioDisplay::OnKeyDown(wxKeyEvent &event) {
|
||||||
|
|
||||||
// Accept
|
// Accept
|
||||||
if (Hotkeys.IsPressed(_T("Audio Commit"))) {
|
if (Hotkeys.IsPressed(_T("Audio Commit"))) {
|
||||||
CommitChanges();
|
CommitChanges(true);
|
||||||
ChangeLine(1);
|
//ChangeLine(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accept (SSA's "Grab times")
|
// Accept (SSA's "Grab times")
|
||||||
if (Hotkeys.IsPressed(_T("Audio Commit Alt"))) {
|
if (Hotkeys.IsPressed(_T("Audio Commit Alt"))) {
|
||||||
CommitChanges();
|
CommitChanges(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accept (stay)
|
// Accept (stay)
|
||||||
|
|
Loading…
Reference in a new issue