using boost::weak_ptr;
using dcp::Size;
-FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
+FilmViewer::FilmViewer (wxWindow* p)
: wxPanel (p)
, _panel (new wxPanel (this))
, _outline_content (new wxCheckBox (this, wxID_ANY, _("Outline content")))
_back_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmViewer::back_clicked, this));
_forward_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmViewer::forward_clicked, this));
- set_film (f);
-
+ set_film (shared_ptr<Film> ());
+
JobManager::instance()->ActiveJobsChanged.connect (
bind (&FilmViewer::active_jobs_changed, this, _1)
);
+
+ setup_sensitivity ();
}
void
return;
}
+ _film_connection = _film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1));
+
_player->set_approximate_size ();
- _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1));
+ _player_connection = _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1));
calculate_sizes ();
get (_position, _last_get_accurate);
+
+ setup_sensitivity ();
}
void
calculate_sizes ();
get (_position, _last_get_accurate);
}
+
+void
+FilmViewer::setup_sensitivity ()
+{
+ bool const c = _film && !_film->content().empty ();
+
+ _slider->Enable (c);
+ _back_button->Enable (c);
+ _forward_button->Enable (c);
+ _play_button->Enable (c);
+ _outline_content->Enable (c);
+ _frame_number->Enable (c);
+ _timecode->Enable (c);
+}
+
+void
+FilmViewer::film_changed (Film::Property p)
+{
+ if (p == Film::CONTENT) {
+ setup_sensitivity ();
+ }
+}