Fix build.
[dcpomatic.git] / src / wx / controls.cc
index 61c671788cacb2f328b31775e434b664c15f6d6e..f8bd7eeb93aabeaeb32e61b78e968ef3c2417c59 100644 (file)
 #include "lib/cross.h"
 #include "lib/dcp_content.h"
 #include "lib/examine_content_job.h"
+#include "lib/film.h"
 #include "lib/job.h"
 #include "lib/job_manager.h"
 #include "lib/player_video.h"
+#include "lib/scope_guard.h"
 #include <dcp/cpl.h>
 #include <dcp/dcp.h>
 #include <dcp/reel.h>
@@ -69,10 +71,6 @@ Controls::Controls(wxWindow* parent, FilmViewer& viewer, bool editor_controls)
        , _markers (new MarkersPanel(this, viewer))
        , _slider (new wxSlider(this, wxID_ANY, 0, 0, 4096))
        , _viewer (viewer)
-       , _slider_being_moved (false)
-       , _outline_content (0)
-       , _eye (0)
-       , _jump_to_selected (0)
        , _rewind_button (new Button(this, wxT("|<")))
        , _back_button (new Button(this, wxT("<")))
        , _forward_button (new Button(this, wxT(">")))
@@ -137,7 +135,7 @@ Controls::Controls(wxWindow* parent, FilmViewer& viewer, bool editor_controls)
                _eye->Bind (wxEVT_CHOICE, boost::bind (&Controls::eye_changed, this));
        }
        if (_outline_content) {
-               _outline_content->Bind (wxEVT_CHECKBOX, boost::bind (&Controls::outline_content_changed, this));
+               _outline_content->bind(&Controls::outline_content_changed, this);
        }
 
        _slider->Bind           (wxEVT_SCROLL_THUMBTRACK,    boost::bind(&Controls::slider_moved,    this, false));
@@ -150,7 +148,7 @@ Controls::Controls(wxWindow* parent, FilmViewer& viewer, bool editor_controls)
        _frame_number->Bind     (wxEVT_LEFT_DOWN,            boost::bind(&Controls::frame_number_clicked, this));
        _timecode->Bind         (wxEVT_LEFT_DOWN,            boost::bind(&Controls::timecode_clicked, this));
        if (_jump_to_selected) {
-               _jump_to_selected->Bind (wxEVT_CHECKBOX, boost::bind (&Controls::jump_to_selected_clicked, this));
+               _jump_to_selected->bind(&Controls::jump_to_selected_clicked, this);
                _jump_to_selected->SetValue (Config::instance()->jump_to_selected ());
        }
 
@@ -162,14 +160,11 @@ Controls::Controls(wxWindow* parent, FilmViewer& viewer, bool editor_controls)
 
        set_film(viewer.film());
 
-       setup_sensitivity ();
-
        JobManager::instance()->ActiveJobsChanged.connect (
                bind (&Controls::active_jobs_changed, this, _2)
                );
 
        _config_changed_connection = Config::instance()->Changed.connect (bind(&Controls::config_changed, this, _1));
-       config_changed (Config::OTHER);
 }
 
 void
@@ -380,22 +375,22 @@ Controls::setup_sensitivity ()
 void
 Controls::timecode_clicked ()
 {
-       auto dialog = new PlayheadToTimecodeDialog(this, _viewer.position(), _film->video_frame_rate());
+       auto dialog = make_wx<PlayheadToTimecodeDialog>(this, _viewer.position(), _film->video_frame_rate());
+
        if (dialog->ShowModal() == wxID_OK) {
                _viewer.seek(dialog->get(), true);
        }
-       dialog->Destroy ();
 }
 
 
 void
 Controls::frame_number_clicked ()
 {
-       auto dialog = new PlayheadToFrameDialog(this, _viewer.position(), _film->video_frame_rate());
+       auto dialog = make_wx<PlayheadToFrameDialog>(this, _viewer.position(), _film->video_frame_rate());
+
        if (dialog->ShowModal() == wxID_OK) {
                _viewer.seek(dialog->get(), true);
        }
-       dialog->Destroy ();
 }
 
 
@@ -436,14 +431,14 @@ Controls::film () const
 
 
 void
-Controls::film_change (ChangeType type, Film::Property p)
+Controls::film_change(ChangeType type, FilmProperty p)
 {
        if (type == ChangeType::DONE) {
-               if (p == Film::Property::CONTENT) {
+               if (p == FilmProperty::CONTENT) {
                        setup_sensitivity ();
                        update_position_label ();
                        update_position_slider ();
-               } else if (p == Film::Property::THREE_D) {
+               } else if (p == FilmProperty::THREE_D) {
                        setup_sensitivity ();
                }
        }