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:
Amar Takhar 2010-05-31 23:04:27 +00:00
parent 0a453fe127
commit f7993ce3ac

View file

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