+
+ for (int i = 0; i < _history_items; ++i) {
+ delete _file_menu->Remove (ID_file_history + i);
+ }
+
+ if (_history_separator) {
+ _file_menu->Remove (_history_separator);
+ }
+ delete _history_separator;
+ _history_separator = 0;
+
+ int pos = _history_position;
+
+ vector<boost::filesystem::path> history = Config::instance()->player_history ();
+
+ if (!history.empty ()) {
+ _history_separator = _file_menu->InsertSeparator (pos++);
+ }
+
+ for (size_t i = 0; i < history.size(); ++i) {
+ string s;
+ if (i < 9) {
+ s = String::compose ("&%1 %2", i + 1, history[i].string());
+ } else {
+ s = history[i].string();
+ }
+ _file_menu->Insert (pos++, ID_file_history + i, std_to_wx (s));
+ }
+
+ _history_items = history.size ();
+ }
+
+ void set_menu_sensitivity ()
+ {
+ _tools_verify->Enable (static_cast<bool>(_film));
+ _file_add_ov->Enable (static_cast<bool>(_film));
+ _file_add_kdm->Enable (static_cast<bool>(_film));
+ _view_cpl->Enable (static_cast<bool>(_film));
+ }
+
+ void start_stop_pressed ()
+ {
+ if (_viewer->playing()) {
+ _viewer->stop();
+ } else {
+ _viewer->start();
+ }
+ }
+
+ void back_frame ()
+ {
+ _viewer->seek_by (-_viewer->one_video_frame(), true);
+ }
+
+ void forward_frame ()
+ {
+ _viewer->seek_by (_viewer->one_video_frame(), true);
+ }
+
+private:
+
+ /** @return false if the task was cancelled */
+ bool progress (wxString task)
+ {
+ JobManager* jm = JobManager::instance ();
+
+ wxProgressDialog* progress = new wxProgressDialog (_("DCP-o-matic Player"), task, 100, 0, wxPD_CAN_ABORT);
+
+ bool ok = true;
+
+ while (jm->work_to_do() || signal_manager->ui_idle()) {
+ dcpomatic_sleep (1);
+ if (!progress->Pulse()) {
+ /* user pressed cancel */
+ BOOST_FOREACH (shared_ptr<Job> i, jm->get()) {
+ i->cancel();
+ }
+ ok = false;
+ break;
+ }
+ }
+
+ progress->Destroy ();
+ return ok;
+ }
+
+ bool report_errors_from_last_job ()
+ {
+ JobManager* jm = JobManager::instance ();
+
+ DCPOMATIC_ASSERT (!jm->get().empty());
+
+ shared_ptr<Job> last = jm->get().back();
+ if (last->finished_in_error()) {
+ error_dialog(this, std_to_wx(last->error_summary()) + ".\n", std_to_wx(last->error_details()));
+ return false;
+ }
+
+ return true;
+ }
+
+ void setup_from_dcp (shared_ptr<DCPContent> dcp)
+ {
+ BOOST_FOREACH (shared_ptr<TextContent> i, dcp->text) {
+ i->set_use (true);
+ }
+
+ if (dcp->video) {
+ Ratio const * r = Ratio::nearest_from_ratio(dcp->video->size().ratio());
+ if (r) {
+ _film->set_container(r);
+ }
+ }