From ae6fcba54eb5f9ef9e2a412cdb037101223d478a Mon Sep 17 00:00:00 2001 From: Fredrik Mellbin Date: Thu, 2 Feb 2006 18:17:54 +0000 Subject: [PATCH] fixing the fixmes Originally committed to SVN as r57. --- core/audio_display.cpp | 41 ++++++++++++++------------------------ core/dialog_properties.cpp | 4 ++-- core/dialog_resample.cpp | 2 +- core/frame_main.cpp | 4 ---- core/video_provider.cpp | 1 - 5 files changed, 18 insertions(+), 34 deletions(-) diff --git a/core/audio_display.cpp b/core/audio_display.cpp index ba2c2e4ab..49b58ffbc 100644 --- a/core/audio_display.cpp +++ b/core/audio_display.cpp @@ -202,7 +202,7 @@ void AudioDisplay::UpdateImage(bool weak) { // Draw seconds boundaries if (draw_boundary_lines) { __int64 start = Position*samples; - int rate = provider ? provider->GetSampleRate() : 0; //fix me? + int rate = provider->GetSampleRate(); int pixBounds = rate / samples; dc.SetPen(wxPen(Options.AsColour(_T("Audio Seconds Boundaries")),1,wxDOT)); if (pixBounds >= 8) { @@ -688,12 +688,10 @@ void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) { if (update) { // Center scroll int oldSamples = samples; - UpdateSamples(); PositionSample += (oldSamples-samples)*w*pivot; if (PositionSample < 0) PositionSample = 0; // Update - UpdateSamples(); UpdateScrollbar(); UpdateImage(); Refresh(false); @@ -705,7 +703,7 @@ void AudioDisplay::SetSamplesPercent(int percent,bool update,float pivot) { // Update samples void AudioDisplay::UpdateSamples() { // Set samples - __int64 totalSamples = provider ? provider->GetNumSamples() : 0; //fix me? + __int64 totalSamples = provider->GetNumSamples(); int total = totalSamples / w; int max = 5760000 / w; // 2 minutes at 48 kHz maximum if (total > max) total = max; @@ -742,30 +740,33 @@ void AudioDisplay::SetFile(wxString file) { delete provider; provider = NULL; Reset(); + + loaded = false; } - else { SetFile(_T("")); try { provider = new AudioProvider(file, this); + loaded = true; + // Add to recent Options.AddToRecentList(file,_T("Recent aud")); + + // Update + UpdateImage(); + Refresh(false); } catch (wxString &err) { wxMessageBox(err,_T("Error loading audio"),wxICON_ERROR | wxOK); } } - loaded = (provider != NULL); + assert(loaded == (provider != NULL)); // Set default selection int n = grid->editBox->linen; SetDialogue(grid,grid->GetDialogue(n),n); - - // Update - UpdateImage(); - Refresh(false); } @@ -809,40 +810,28 @@ int AudioDisplay::GetXAtSample(__int64 n) { ///////////////// // Get MS from X int AudioDisplay::GetMSAtX(__int64 x) { - //fix me? - if (provider) - return (PositionSample+(x*samples)) * 1000 / provider->GetSampleRate(); - return 0; + return (PositionSample+(x*samples)) * 1000 / provider->GetSampleRate(); } ///////////////// // Get X from MS int AudioDisplay::GetXAtMS(__int64 ms) { - //fix me? - if (provider) - return ((ms * provider->GetSampleRate() / 1000)-PositionSample)/samples; - return 0; + return ((ms * provider->GetSampleRate() / 1000)-PositionSample)/samples; } //////////////////// // Get MS At sample int AudioDisplay::GetMSAtSample(__int64 x) { - //fix me? - if (provider) - return x * 1000 / provider->GetSampleRate(); - return 0; + return x * 1000 / provider->GetSampleRate(); } //////////////////// // Get Sample at MS __int64 AudioDisplay::GetSampleAtMS(__int64 ms) { - //fix me? - if (provider) - return ms * provider->GetSampleRate() / 1000; - return 0; + return ms * provider->GetSampleRate() / 1000; } diff --git a/core/dialog_properties.cpp b/core/dialog_properties.cpp index 7e52d3f6d..623111ac0 100644 --- a/core/dialog_properties.cpp +++ b/core/dialog_properties.cpp @@ -191,7 +191,7 @@ int DialogProperties::SetInfoIfDifferent(wxString key,wxString value) { ////////////////////////// // Set res to match video void DialogProperties::OnSetFromVideo(wxCommandEvent &event) { - ResX->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceWidth())); //fix me, null check? - ResY->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceHeight())); //fix me, identical to other set? + ResX->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceWidth())); + ResY->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceHeight())); event.Skip(); } diff --git a/core/dialog_resample.cpp b/core/dialog_resample.cpp index b65a4c5ae..f3afea006 100644 --- a/core/dialog_resample.cpp +++ b/core/dialog_resample.cpp @@ -232,7 +232,7 @@ void DialogResample::OnResample (wxCommandEvent &event) { ///////////////////////////////////////// // Get destination resolution from video void DialogResample::OnGetDestRes (wxCommandEvent &event) { - ResX->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceWidth())); //fix me, null check? + ResX->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceWidth())); ResY->SetValue(wxString::Format(_T("%i"),vid->provider->GetSourceHeight())); } diff --git a/core/frame_main.cpp b/core/frame_main.cpp index f6ea02b18..87b29e871 100644 --- a/core/frame_main.cpp +++ b/core/frame_main.cpp @@ -512,9 +512,6 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) { // Sync SynchronizeProject(true); - // Update video - //videoBox->videoDisplay->SetSubtitles(filename); //fix me, remove? - // Update title bar UpdateTitle(); } @@ -549,7 +546,6 @@ bool FrameMain::SaveSubtitles(bool saveas,bool withCharset) { // Save try { - //videoBox->videoDisplay->SetSubtitles(filename); fix me, remove? AssFile::top->Save(filename,true,true,charset); UpdateTitle(); } diff --git a/core/video_provider.cpp b/core/video_provider.cpp index f30b56bd7..8d977b723 100644 --- a/core/video_provider.cpp +++ b/core/video_provider.cpp @@ -127,7 +127,6 @@ PClip VideoProvider::OpenVideo(wxString _filename, bool &usedDirectshow, bool mp const char *argnames[2] = { 0, "audio" }; AVSValue args[2] = { videoFilename, false }; script = env->Invoke("AviSource", AVSValue(args,2), argnames); - //fix me, check for video? } catch (AvisynthError &) { goto directshowOpen; }