Stub player.
[dcpomatic.git] / src / wx / film_viewer.cc
index 69496b630286eb607f405d1a38e53b14a5d37263..776926fbefed8b3682e1e8f0a1e738f1cd1b173c 100644 (file)
@@ -72,7 +72,7 @@ rtaudio_callback (void* out, void *, unsigned int frames, double, RtAudioStreamS
        return reinterpret_cast<FilmViewer*>(data)->audio_callback (out, frames);
 }
 
-FilmViewer::FilmViewer (wxWindow* p)
+FilmViewer::FilmViewer (wxWindow* p, bool outline_content, bool jump_to_selected)
        : wxPanel (p)
        , _panel (new wxPanel (this))
        , _outline_content (new wxCheckBox (this, wxID_ANY, _("Outline content")))
@@ -106,10 +106,14 @@ FilmViewer::FilmViewer (wxWindow* p)
        _v_sizer->Add (_panel, 1, wxEXPAND);
 
        wxBoxSizer* view_options = new wxBoxSizer (wxHORIZONTAL);
-       view_options->Add (_outline_content, 0, wxRIGHT, DCPOMATIC_SIZER_GAP);
+       if (outline_content) {
+               view_options->Add (_outline_content, 0, wxRIGHT, DCPOMATIC_SIZER_GAP);
+       }
        view_options->Add (_left_eye, 0, wxLEFT | wxRIGHT, DCPOMATIC_SIZER_GAP);
        view_options->Add (_right_eye, 0, wxLEFT | wxRIGHT, DCPOMATIC_SIZER_GAP);
-       view_options->Add (_jump_to_selected, 0, wxLEFT | wxRIGHT, DCPOMATIC_SIZER_GAP);
+       if (jump_to_selected) {
+               view_options->Add (_jump_to_selected, 0, wxLEFT | wxRIGHT, DCPOMATIC_SIZER_GAP);
+       }
        _v_sizer->Add (view_options, 0, wxALL, DCPOMATIC_SIZER_GAP);
 
        wxBoxSizer* h_sizer = new wxBoxSizer (wxHORIZONTAL);
@@ -135,9 +139,10 @@ FilmViewer::FilmViewer (wxWindow* p)
        _outline_content->Bind  (wxEVT_CHECKBOX,          boost::bind (&FilmViewer::refresh_panel,   this));
        _left_eye->Bind         (wxEVT_RADIOBUTTON,       boost::bind (&FilmViewer::refresh,         this));
        _right_eye->Bind        (wxEVT_RADIOBUTTON,       boost::bind (&FilmViewer::refresh,         this));
-       _slider->Bind           (wxEVT_SCROLL_THUMBTRACK, boost::bind (&FilmViewer::slider_moved,    this));
-       _slider->Bind           (wxEVT_SCROLL_PAGEUP,     boost::bind (&FilmViewer::slider_moved,    this));
-       _slider->Bind           (wxEVT_SCROLL_PAGEDOWN,   boost::bind (&FilmViewer::slider_moved,    this));
+       _slider->Bind           (wxEVT_SCROLL_THUMBTRACK, boost::bind (&FilmViewer::slider_moved,    this, false));
+       _slider->Bind           (wxEVT_SCROLL_PAGEUP,     boost::bind (&FilmViewer::slider_moved,    this, false));
+       _slider->Bind           (wxEVT_SCROLL_PAGEDOWN,   boost::bind (&FilmViewer::slider_moved,    this, false));
+       _slider->Bind           (wxEVT_SCROLL_CHANGED,    boost::bind (&FilmViewer::slider_moved,    this, true));
        _play_button->Bind      (wxEVT_TOGGLEBUTTON,      boost::bind (&FilmViewer::play_clicked,    this));
        _timer.Bind             (wxEVT_TIMER,             boost::bind (&FilmViewer::timer,           this));
        _back_button->Bind      (wxEVT_LEFT_DOWN,         boost::bind (&FilmViewer::back_clicked,    this, _1));
@@ -238,7 +243,7 @@ FilmViewer::recreate_butler ()
                map.set (2, 1, 1 / sqrt(2)); // C -> R
        }
 
-       _butler.reset (new Butler (_film, _player, map, _audio_channels));
+       _butler.reset (new Butler (_player, _film->log(), map, _audio_channels));
        if (!Config::instance()->preview_sound()) {
                _butler->disable_audio ();
        }
@@ -371,7 +376,7 @@ FilmViewer::paint_panel ()
 }
 
 void
-FilmViewer::slider_moved ()
+FilmViewer::slider_moved (bool update_slider)
 {
        if (!_film) {
                return;
@@ -384,6 +389,9 @@ FilmViewer::slider_moved ()
        }
        seek (t, false);
        update_position_label ();
+       if (update_slider) {
+               update_position_slider ();
+       }
 }
 
 void