mirror of https://github.com/odrling/Aegisub
Remove the (59!) wxLogDebug lines, this is being rewritten by jfs so there's no point on porting it to the new logging system.
Originally committed to SVN as r4375.
This commit is contained in:
parent
0a453fe127
commit
f7993ce3ac
|
@ -153,7 +153,6 @@ AudioDisplay::~AudioDisplay() {
|
||||||
|
|
||||||
/// @brief Reset
|
/// @brief Reset
|
||||||
void AudioDisplay::Reset() {
|
void AudioDisplay::Reset() {
|
||||||
wxLogDebug(_T("AudioDisplay::Reset"));
|
|
||||||
hasSel = false;
|
hasSel = false;
|
||||||
diagUpdated = false;
|
diagUpdated = false;
|
||||||
NeedCommit = false;
|
NeedCommit = false;
|
||||||
|
@ -728,7 +727,6 @@ void AudioDisplay::RecreateImage() {
|
||||||
/// @brief Make dialogue visible
|
/// @brief Make dialogue visible
|
||||||
/// @param force
|
/// @param force
|
||||||
void AudioDisplay::MakeDialogueVisible(bool force) {
|
void AudioDisplay::MakeDialogueVisible(bool force) {
|
||||||
wxLogDebug(_T("AudioDisplay::MakeDialogueVisible(force=%d)"), force?1:0);
|
|
||||||
// Variables
|
// Variables
|
||||||
int startShow=0, endShow=0;
|
int startShow=0, endShow=0;
|
||||||
if (karaoke->enabled) {
|
if (karaoke->enabled) {
|
||||||
|
@ -761,7 +759,6 @@ void AudioDisplay::MakeDialogueVisible(bool force) {
|
||||||
/// @brief Set position
|
/// @brief Set position
|
||||||
/// @param pos
|
/// @param pos
|
||||||
void AudioDisplay::SetPosition(int pos) {
|
void AudioDisplay::SetPosition(int pos) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetPosition(pos=%d)"), pos);
|
|
||||||
Position = pos;
|
Position = pos;
|
||||||
PositionSample = pos * samples;
|
PositionSample = pos * samples;
|
||||||
UpdateImage();
|
UpdateImage();
|
||||||
|
@ -851,10 +848,8 @@ void AudioDisplay::SetScale(float _scale) {
|
||||||
/// @param file
|
/// @param file
|
||||||
/// @return
|
/// @return
|
||||||
void AudioDisplay::SetFile(wxString file) {
|
void AudioDisplay::SetFile(wxString file) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetFile(file=%s)"), file.c_str());
|
|
||||||
// Unload
|
// Unload
|
||||||
if (file.IsEmpty()) try {
|
if (file.IsEmpty()) try {
|
||||||
wxLogDebug(_T("AudioDisplay::SetFile: file is empty, just closing audio"));
|
|
||||||
try {
|
try {
|
||||||
if (player) player->CloseStream();
|
if (player) player->CloseStream();
|
||||||
}
|
}
|
||||||
|
@ -890,11 +885,9 @@ void AudioDisplay::SetFile(wxString file) {
|
||||||
|
|
||||||
// Load
|
// Load
|
||||||
else {
|
else {
|
||||||
wxLogDebug(_T("AudioDisplay::SetFile: unloading old file"));
|
|
||||||
SetFile(_T(""));
|
SetFile(_T(""));
|
||||||
try {
|
try {
|
||||||
// Get provider
|
// Get provider
|
||||||
wxLogDebug(_T("AudioDisplay::SetFile: get audio provider"));
|
|
||||||
bool is_dummy = false;
|
bool is_dummy = false;
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if (file == _T("?dummy")) {
|
if (file == _T("?dummy")) {
|
||||||
|
@ -911,7 +904,6 @@ void AudioDisplay::SetFile(wxString file) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Get player
|
// Get player
|
||||||
wxLogDebug(_T("AudioDisplay::SetFile: get audio player"));
|
|
||||||
player = AudioPlayerFactoryManager::GetAudioPlayer();
|
player = AudioPlayerFactoryManager::GetAudioPlayer();
|
||||||
player->SetDisplayTimer(&UpdateTimer);
|
player->SetDisplayTimer(&UpdateTimer);
|
||||||
player->SetProvider(provider);
|
player->SetProvider(provider);
|
||||||
|
@ -920,7 +912,6 @@ void AudioDisplay::SetFile(wxString file) {
|
||||||
|
|
||||||
// Add to recent
|
// Add to recent
|
||||||
if (!is_dummy) {
|
if (!is_dummy) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetFile: add to recent"));
|
|
||||||
AegisubApp::Get()->mru->Add("Audio", STD_STR(file));
|
AegisubApp::Get()->mru->Add("Audio", STD_STR(file));
|
||||||
wxFileName fn(file);
|
wxFileName fn(file);
|
||||||
StandardPaths::SetPathValue(_T("?audio"),fn.GetPath());
|
StandardPaths::SetPathValue(_T("?audio"),fn.GetPath());
|
||||||
|
@ -937,7 +928,6 @@ void AudioDisplay::SetFile(wxString file) {
|
||||||
catch (wxString &err) {
|
catch (wxString &err) {
|
||||||
if (player) { delete player; player = 0; }
|
if (player) { delete player; player = 0; }
|
||||||
if (provider) { delete provider; provider = 0; }
|
if (provider) { delete provider; provider = 0; }
|
||||||
wxLogDebug(_T("AudioDisplay::SetFile: gotcha!"));
|
|
||||||
wxMessageBox(err,_T("Error loading audio"),wxICON_ERROR | wxOK);
|
wxMessageBox(err,_T("Error loading audio"),wxICON_ERROR | wxOK);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
@ -952,15 +942,12 @@ void AudioDisplay::SetFile(wxString file) {
|
||||||
assert(loaded == (provider != NULL));
|
assert(loaded == (provider != NULL));
|
||||||
|
|
||||||
// Set default selection
|
// Set default selection
|
||||||
wxLogDebug(_T("AudioDisplay::SetFile: set default selection"));
|
|
||||||
int n = grid->editBox->linen;
|
int n = grid->editBox->linen;
|
||||||
SetDialogue(grid,grid->GetDialogue(n),n);
|
SetDialogue(grid,grid->GetDialogue(n),n);
|
||||||
wxLogDebug(_T("AudioDisplay::SetFile: returning"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Load from video
|
/// @brief Load from video
|
||||||
void AudioDisplay::SetFromVideo() {
|
void AudioDisplay::SetFromVideo() {
|
||||||
wxLogDebug(_T("AudioDisplay::SetFromVideo"));
|
|
||||||
if (VideoContext::Get()->IsLoaded()) {
|
if (VideoContext::Get()->IsLoaded()) {
|
||||||
wxString extension = VideoContext::Get()->videoName.Right(4);
|
wxString extension = VideoContext::Get()->videoName.Right(4);
|
||||||
extension.LowerCase();
|
extension.LowerCase();
|
||||||
|
@ -971,7 +958,6 @@ void AudioDisplay::SetFromVideo() {
|
||||||
|
|
||||||
/// @brief Reload audio
|
/// @brief Reload audio
|
||||||
void AudioDisplay::Reload() {
|
void AudioDisplay::Reload() {
|
||||||
wxLogDebug(_T("AudioDisplay::Reload"));
|
|
||||||
if (provider) SetFile(provider->GetFilename());
|
if (provider) SetFile(provider->GetFilename());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1032,17 +1018,14 @@ int64_t AudioDisplay::GetSampleAtMS(int64_t ms) {
|
||||||
/// @param end
|
/// @param end
|
||||||
/// @return
|
/// @return
|
||||||
void AudioDisplay::Play(int start,int end) {
|
void AudioDisplay::Play(int start,int end) {
|
||||||
wxLogDebug(_T("AudioDisplay::Play"));
|
|
||||||
Stop();
|
Stop();
|
||||||
|
|
||||||
// Check provider
|
// Check provider
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
wxLogDebug(_T("AudioDisplay::Play: no audio provider"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set defaults
|
// Set defaults
|
||||||
wxLogDebug(_T("AudioDisplay::Play: initialising playback"));
|
|
||||||
playingToEnd = end < 0;
|
playingToEnd = end < 0;
|
||||||
int64_t num_samples = provider->GetNumSamples();
|
int64_t num_samples = provider->GetNumSamples();
|
||||||
start = GetSampleAtMS(start);
|
start = GetSampleAtMS(start);
|
||||||
|
@ -1061,12 +1044,10 @@ void AudioDisplay::Play(int start,int end) {
|
||||||
|
|
||||||
// Call play
|
// Call play
|
||||||
player->Play(start,end-start);
|
player->Play(start,end-start);
|
||||||
wxLogDebug(_T("AudioDisplay::Play: playback started, returning"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Stop
|
/// @brief Stop
|
||||||
void AudioDisplay::Stop() {
|
void AudioDisplay::Stop() {
|
||||||
wxLogDebug(_T("AudioDisplay::Stop"));
|
|
||||||
if (VideoContext::Get()->IsPlaying()) VideoContext::Get()->Stop();
|
if (VideoContext::Get()->IsPlaying()) VideoContext::Get()->Stop();
|
||||||
if (player) player->Stop();
|
if (player) player->Stop();
|
||||||
}
|
}
|
||||||
|
@ -1076,7 +1057,6 @@ void AudioDisplay::Stop() {
|
||||||
/// @param end
|
/// @param end
|
||||||
/// @return
|
/// @return
|
||||||
void AudioDisplay::GetTimesDialogue(int &start,int &end) {
|
void AudioDisplay::GetTimesDialogue(int &start,int &end) {
|
||||||
wxLogDebug(_T("AudioDisplay::GetTimesDialogue"));
|
|
||||||
if (!dialogue) {
|
if (!dialogue) {
|
||||||
start = 0;
|
start = 0;
|
||||||
end = 0;
|
end = 0;
|
||||||
|
@ -1092,7 +1072,6 @@ void AudioDisplay::GetTimesDialogue(int &start,int &end) {
|
||||||
/// @param end
|
/// @param end
|
||||||
/// @return
|
/// @return
|
||||||
void AudioDisplay::GetTimesSelection(int &start,int &end) {
|
void AudioDisplay::GetTimesSelection(int &start,int &end) {
|
||||||
wxLogDebug(_T("AudioDisplay::GetTimesSelection"));
|
|
||||||
start = 0;
|
start = 0;
|
||||||
end = 0;
|
end = 0;
|
||||||
if (!dialogue) return;
|
if (!dialogue) return;
|
||||||
|
@ -1116,7 +1095,6 @@ void AudioDisplay::GetTimesSelection(int &start,int &end) {
|
||||||
/// @param start
|
/// @param start
|
||||||
/// @param end
|
/// @param end
|
||||||
void AudioDisplay::SetSelection(int start, int end) {
|
void AudioDisplay::SetSelection(int start, int end) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetSelection(start=%d, end=%d)"), start, end);
|
|
||||||
curStartMS = start;
|
curStartMS = start;
|
||||||
curEndMS = end;
|
curEndMS = end;
|
||||||
Update();
|
Update();
|
||||||
|
@ -1128,10 +1106,8 @@ void AudioDisplay::SetSelection(int start, int end) {
|
||||||
/// @param n
|
/// @param n
|
||||||
/// @return
|
/// @return
|
||||||
void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) {
|
void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetDialogue"));
|
|
||||||
// Actual parameters
|
// Actual parameters
|
||||||
if (_grid) {
|
if (_grid) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetDialogue: has grid"));
|
|
||||||
// Set variables
|
// Set variables
|
||||||
grid = _grid;
|
grid = _grid;
|
||||||
line_n = n;
|
line_n = n;
|
||||||
|
@ -1143,7 +1119,6 @@ void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) {
|
||||||
|
|
||||||
// Set times
|
// Set times
|
||||||
if (dialogue && !dontReadTimes && OPT_GET("Audio/Grab Times on Select")->GetBool()) {
|
if (dialogue && !dontReadTimes && OPT_GET("Audio/Grab Times on Select")->GetBool()) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetDialogue: grabbing times"));
|
|
||||||
int s = dialogue->Start.GetMS();
|
int s = dialogue->Start.GetMS();
|
||||||
int e = dialogue->End.GetMS();
|
int e = dialogue->End.GetMS();
|
||||||
|
|
||||||
|
@ -1157,25 +1132,21 @@ void AudioDisplay::SetDialogue(SubtitlesGrid *_grid,AssDialogue *diag,int n) {
|
||||||
|
|
||||||
// Read karaoke data
|
// Read karaoke data
|
||||||
if (dialogue && karaoke->enabled) {
|
if (dialogue && karaoke->enabled) {
|
||||||
wxLogDebug(_T("AudioDisplay::SetDialogue: in karaoke mode, loading new line into karaoke control"));
|
|
||||||
NeedCommit = karaoke->LoadFromDialogue(dialogue);
|
NeedCommit = karaoke->LoadFromDialogue(dialogue);
|
||||||
|
|
||||||
// Reset karaoke pos
|
// Reset karaoke pos
|
||||||
wxLogDebug(_T("AudioDisplay::SetDialogue: resetting karaoke position"));
|
|
||||||
if (karaoke->curSyllable == -1) karaoke->SetSyllable((int)karaoke->syllables.size()-1);
|
if (karaoke->curSyllable == -1) karaoke->SetSyllable((int)karaoke->syllables.size()-1);
|
||||||
else karaoke->SetSyllable(0);
|
else karaoke->SetSyllable(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
Update();
|
Update();
|
||||||
wxLogDebug(_T("AudioDisplay::SetDialogue: returning"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Commit changes
|
/// @brief Commit changes
|
||||||
/// @param nextLine
|
/// @param nextLine
|
||||||
/// @return
|
/// @return
|
||||||
void AudioDisplay::CommitChanges (bool nextLine) {
|
void AudioDisplay::CommitChanges (bool nextLine) {
|
||||||
wxLogDebug(_T("AudioDisplay::CommitChanges(nextLine=%d)"), nextLine?1:0);
|
|
||||||
// Loaded?
|
// Loaded?
|
||||||
if (!loaded) return;
|
if (!loaded) return;
|
||||||
|
|
||||||
|
@ -1192,7 +1163,6 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
||||||
// Update karaoke
|
// Update karaoke
|
||||||
int karaSelStart = 0, karaSelEnd = -1;
|
int karaSelStart = 0, karaSelEnd = -1;
|
||||||
if (karaoke->enabled) {
|
if (karaoke->enabled) {
|
||||||
wxLogDebug(_T("AudioDisplay::CommitChanges: karaoke enabled, committing it"));
|
|
||||||
wasKaraSplitting = karaoke->splitting;
|
wasKaraSplitting = karaoke->splitting;
|
||||||
karaoke->Commit();
|
karaoke->Commit();
|
||||||
// Get karaoke selection
|
// Get karaoke selection
|
||||||
|
@ -1203,7 +1173,6 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
||||||
if ((signed)k > karaSelEnd) karaSelEnd = k;
|
if ((signed)k > karaSelEnd) karaSelEnd = k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxLogDebug(_T("AudioDisplay::CommitChanges: karaSelStart=%d karaSelEnd=%d"), karaSelStart, karaSelEnd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get selected rows
|
// Get selected rows
|
||||||
|
@ -1211,7 +1180,6 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
||||||
|
|
||||||
// Commit ok?
|
// Commit ok?
|
||||||
if (validCommit) {
|
if (validCommit) {
|
||||||
wxLogDebug(_T("AudioDisplay::CommitChanges: valid commit"));
|
|
||||||
// Reset flags
|
// Reset flags
|
||||||
diagUpdated = false;
|
diagUpdated = false;
|
||||||
NeedCommit = false;
|
NeedCommit = false;
|
||||||
|
@ -1236,13 +1204,11 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update edit box
|
// Update edit box
|
||||||
wxLogDebug(_T("AudioDisplay::CommitChanges: updating time edit boxes"));
|
|
||||||
grid->editBox->StartTime->Update();
|
grid->editBox->StartTime->Update();
|
||||||
grid->editBox->EndTime->Update();
|
grid->editBox->EndTime->Update();
|
||||||
grid->editBox->Duration->Update();
|
grid->editBox->Duration->Update();
|
||||||
|
|
||||||
// Update grid
|
// Update grid
|
||||||
wxLogDebug(_T("AudioDisplay::CommitChanges: update grid"));
|
|
||||||
grid->editBox->Update(!karaoke->enabled);
|
grid->editBox->Update(!karaoke->enabled);
|
||||||
grid->ass->FlagAsModified(_T(""));
|
grid->ass->FlagAsModified(_T(""));
|
||||||
grid->CommitChanges();
|
grid->CommitChanges();
|
||||||
|
@ -1252,11 +1218,9 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
||||||
|
|
||||||
// Next line (ugh what a condition, can this be simplified?)
|
// Next line (ugh what a condition, can this be simplified?)
|
||||||
if (nextLine && !karaoke->enabled && OPT_GET("Audio/Next Line on Commit")->GetBool() && !wasKaraSplitting) {
|
if (nextLine && !karaoke->enabled && OPT_GET("Audio/Next Line on Commit")->GetBool() && !wasKaraSplitting) {
|
||||||
wxLogDebug(_T("AudioDisplay::CommitChanges: going to next line"));
|
|
||||||
// Insert a line if it doesn't exist
|
// Insert a line if it doesn't exist
|
||||||
int nrows = grid->GetRows();
|
int nrows = grid->GetRows();
|
||||||
if (nrows == line_n + 1) {
|
if (nrows == line_n + 1) {
|
||||||
wxLogDebug(_T("AudioDisplay::CommitChanges: was on last line, inserting new"));
|
|
||||||
AssDialogue *def = new AssDialogue;
|
AssDialogue *def = new AssDialogue;
|
||||||
def->Start = grid->GetDialogue(line_n)->End;
|
def->Start = grid->GetDialogue(line_n)->End;
|
||||||
def->End = grid->GetDialogue(line_n)->End;
|
def->End = grid->GetDialogue(line_n)->End;
|
||||||
|
@ -1282,7 +1246,6 @@ void AudioDisplay::CommitChanges (bool nextLine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
wxLogDebug(_T("AudioDisplay::CommitChanges: returning"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Add lead
|
/// @brief Add lead
|
||||||
|
@ -2207,9 +2170,7 @@ void AudioDisplay::OnKeyDown(wxKeyEvent &event) {
|
||||||
/// @param block
|
/// @param block
|
||||||
/// @return
|
/// @return
|
||||||
void AudioDisplay::ChangeLine(int delta, bool block) {
|
void AudioDisplay::ChangeLine(int delta, bool block) {
|
||||||
wxLogDebug(_T("AudioDisplay::ChangeLine(delta=%d)"), delta);
|
|
||||||
if (dialogue) {
|
if (dialogue) {
|
||||||
wxLogDebug(_T("AudioDisplay::ChangeLine: has dialogue"));
|
|
||||||
// Get next line number and make sure it's within bounds
|
// Get next line number and make sure it's within bounds
|
||||||
int next;
|
int next;
|
||||||
if (block && grid->IsInSelection(line_n)) next = grid->GetLastSelRow()+delta;
|
if (block && grid->IsInSelection(line_n)) next = grid->GetLastSelRow()+delta;
|
||||||
|
@ -2217,7 +2178,6 @@ void AudioDisplay::ChangeLine(int delta, bool block) {
|
||||||
|
|
||||||
if (next == -1) next = 0;
|
if (next == -1) next = 0;
|
||||||
if (next == grid->GetRows()) next = grid->GetRows() - 1;
|
if (next == grid->GetRows()) next = grid->GetRows() - 1;
|
||||||
wxLogDebug(_T("AudioDisplay::ChangeLine: next=%i"), next);
|
|
||||||
|
|
||||||
// Set stuff
|
// Set stuff
|
||||||
NeedCommit = false;
|
NeedCommit = false;
|
||||||
|
@ -2229,40 +2189,33 @@ void AudioDisplay::ChangeLine(int delta, bool block) {
|
||||||
else UpdateImage(false);
|
else UpdateImage(false);
|
||||||
line_n = next;
|
line_n = next;
|
||||||
}
|
}
|
||||||
wxLogDebug(_T("AudioDisplay::ChangeLine: returning"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Next
|
/// @brief Next
|
||||||
/// @param play
|
/// @param play
|
||||||
/// @return
|
/// @return
|
||||||
void AudioDisplay::Next(bool play) {
|
void AudioDisplay::Next(bool play) {
|
||||||
wxLogDebug(_T("AudioDisplay::Next"));
|
|
||||||
// Karaoke
|
// Karaoke
|
||||||
if (karaoke->enabled) {
|
if (karaoke->enabled) {
|
||||||
wxLogDebug(_T("AudioDisplay::Next: karaoke enables, going to next syllable"));
|
|
||||||
int nextSyl = karaoke->curSyllable+1;
|
int nextSyl = karaoke->curSyllable+1;
|
||||||
bool needsUpdate = true;
|
bool needsUpdate = true;
|
||||||
|
|
||||||
// Last syllable; jump to next
|
// Last syllable; jump to next
|
||||||
if (nextSyl >= (signed int)karaoke->syllables.size()) {
|
if (nextSyl >= (signed int)karaoke->syllables.size()) {
|
||||||
wxLogDebug(_T("AudioDisplay::Next: last syllable on line"));
|
|
||||||
// Already last?
|
// Already last?
|
||||||
if (line_n == grid->GetRows()-1) return;
|
if (line_n == grid->GetRows()-1) return;
|
||||||
|
|
||||||
if (NeedCommit) {
|
if (NeedCommit) {
|
||||||
wxLogDebug(_T("AudioDisplay::Next: uncommitted karaoke changes"));
|
|
||||||
int result = wxMessageBox(_("Do you want to commit your changes? If you choose No, they will be discarded."),_("Commit?"),wxYES_NO | wxCANCEL | wxICON_QUESTION);
|
int result = wxMessageBox(_("Do you want to commit your changes? If you choose No, they will be discarded."),_("Commit?"),wxYES_NO | wxCANCEL | wxICON_QUESTION);
|
||||||
//int result = wxNO;
|
//int result = wxNO;
|
||||||
if (result == wxYES) {
|
if (result == wxYES) {
|
||||||
CommitChanges();
|
CommitChanges();
|
||||||
}
|
}
|
||||||
else if (result == wxCANCEL) {
|
else if (result == wxCANCEL) {
|
||||||
wxLogDebug(_T("AudioDisplay::Next: cancelled, returning"));
|
|
||||||
karaoke->curSyllable = (int)karaoke->syllables.size()-1;
|
karaoke->curSyllable = (int)karaoke->syllables.size()-1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxLogDebug(_T("AudioDisplay::Next: going to next line"));
|
|
||||||
nextSyl = 0;
|
nextSyl = 0;
|
||||||
karaoke->curSyllable = 0;
|
karaoke->curSyllable = 0;
|
||||||
ChangeLine(1);
|
ChangeLine(1);
|
||||||
|
@ -2270,7 +2223,6 @@ void AudioDisplay::Next(bool play) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set syllable
|
// Set syllable
|
||||||
wxLogDebug(_T("AudioDisplay::Next: set syllable"));
|
|
||||||
karaoke->SetSyllable(nextSyl);
|
karaoke->SetSyllable(nextSyl);
|
||||||
if (needsUpdate) Update();
|
if (needsUpdate) Update();
|
||||||
int start=0,end=0;
|
int start=0,end=0;
|
||||||
|
@ -2280,50 +2232,41 @@ void AudioDisplay::Next(bool play) {
|
||||||
|
|
||||||
// Plain mode
|
// Plain mode
|
||||||
else {
|
else {
|
||||||
wxLogDebug(_T("AudioDisplay::Next: going to next line"));
|
|
||||||
ChangeLine(1);
|
ChangeLine(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogDebug(_T("AudioDisplay::Next: returning"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Previous
|
/// @brief Previous
|
||||||
/// @param play
|
/// @param play
|
||||||
/// @return
|
/// @return
|
||||||
void AudioDisplay::Prev(bool play) {
|
void AudioDisplay::Prev(bool play) {
|
||||||
wxLogDebug(_T("AudioDisplay::Prev"));
|
|
||||||
// Karaoke
|
// Karaoke
|
||||||
if (karaoke->enabled) {
|
if (karaoke->enabled) {
|
||||||
wxLogDebug(_T("AudioDisplay::Prev: karaoke enabled, going to prev syllable"));
|
|
||||||
int nextSyl = karaoke->curSyllable-1;
|
int nextSyl = karaoke->curSyllable-1;
|
||||||
bool needsUpdate = true;
|
bool needsUpdate = true;
|
||||||
|
|
||||||
// First syllable; jump line
|
// First syllable; jump line
|
||||||
if (nextSyl < 0) {
|
if (nextSyl < 0) {
|
||||||
wxLogDebug(_T("AudioDisplay::Prev: prev syllable on prev line"));
|
|
||||||
// Already first?
|
// Already first?
|
||||||
if (line_n == 0) return;
|
if (line_n == 0) return;
|
||||||
|
|
||||||
if (NeedCommit) {
|
if (NeedCommit) {
|
||||||
wxLogDebug(_T("AudioDisplay::Prev: uncommitted karaoke changes"));
|
|
||||||
int result = wxMessageBox(_("Do you want to commit your changes? If you choose No, they will be discarded."),_("Commit?"),wxYES_NO | wxCANCEL);
|
int result = wxMessageBox(_("Do you want to commit your changes? If you choose No, they will be discarded."),_("Commit?"),wxYES_NO | wxCANCEL);
|
||||||
if (result == wxYES) {
|
if (result == wxYES) {
|
||||||
CommitChanges();
|
CommitChanges();
|
||||||
}
|
}
|
||||||
else if (result == wxCANCEL) {
|
else if (result == wxCANCEL) {
|
||||||
karaoke->curSyllable = 0;
|
karaoke->curSyllable = 0;
|
||||||
wxLogDebug(_T("AudioDisplay::Prev: cancelled, returning"));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxLogDebug(_T("AudioDisplay::Prev: going to prev line"));
|
|
||||||
karaoke->curSyllable = -1;
|
karaoke->curSyllable = -1;
|
||||||
ChangeLine(-1);
|
ChangeLine(-1);
|
||||||
needsUpdate = false;
|
needsUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set syllable
|
// Set syllable
|
||||||
wxLogDebug(_T("AudioDisplay::Prev: set syllable"));
|
|
||||||
karaoke->SetSyllable(nextSyl);
|
karaoke->SetSyllable(nextSyl);
|
||||||
if (needsUpdate) Update();
|
if (needsUpdate) Update();
|
||||||
int start=0,end=0;
|
int start=0,end=0;
|
||||||
|
@ -2333,11 +2276,9 @@ void AudioDisplay::Prev(bool play) {
|
||||||
|
|
||||||
// Plain mode
|
// Plain mode
|
||||||
else {
|
else {
|
||||||
wxLogDebug(_T("AudioDisplay::Prev: going to prev line"));
|
|
||||||
ChangeLine(-1);
|
ChangeLine(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogDebug(_T("AudioDisplay::Prev: returning"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Gets syllable at x position
|
/// @brief Gets syllable at x position
|
||||||
|
|
Loading…
Reference in New Issue