Emit no audio from DCPs if none is mapped
[dcpomatic.git] / src / wx / controls.cc
index 7cb75ef153874a5e158a56b596e9c302cd5370d1..b6270f91ab424e69ac5e69f72aea2f8cde5f8e48 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>
@@ -107,7 +107,7 @@ Controls::Controls(wxWindow* parent, FilmViewer& viewer, bool editor_controls)
        h_sizer->Add (_forward_button, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);
 
        _button_sizer = new wxBoxSizer (wxHORIZONTAL);
-       h_sizer->Add (_button_sizer, 0, wxEXPAND);
+       h_sizer->Add(_button_sizer, 0, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_GAP);
 
        {
                auto box = new wxBoxSizer (wxVERTICAL);
@@ -159,14 +159,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
@@ -246,6 +243,10 @@ Controls::slider_moved (bool page)
 void
 Controls::slider_released ()
 {
+       if (!_film) {
+               return;
+       }
+
        /* Restart after a drag */
        _viewer.resume();
        _slider_being_moved = false;
@@ -433,14 +434,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 ();
                }
        }