X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fcontent_panel.cc;h=e72ca28a18a11b0f667b7dfe545fc0a6d1ea3457;hb=8b2a3f31b6b4238d8534549f495e7276174ddfba;hp=e5990a564b1d1068f8841a996f223ae820398a91;hpb=23583dfb56181c76126e652042e9d1940367aa27;p=dcpomatic.git diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index e5990a564..e72ca28a1 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -26,7 +26,8 @@ #include "timing_panel.h" #include "timeline_dialog.h" #include "image_sequence_dialog.h" -#include "control_film_viewer.h" +#include "film_viewer.h" +#include "dcpomatic_button.h" #include "lib/audio_content.h" #include "lib/text_content.h" #include "lib/video_content.h" @@ -41,6 +42,7 @@ #include "lib/compose.hpp" #include "lib/string_text_file_content.h" #include "lib/string_text_file.h" +#include "lib/dcpomatic_log.h" #include #include #include @@ -59,9 +61,7 @@ using boost::weak_ptr; using boost::dynamic_pointer_cast; using boost::optional; -#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); - -ContentPanel::ContentPanel (wxNotebook* n, boost::shared_ptr film, ControlFilmViewer* viewer) +ContentPanel::ContentPanel (wxNotebook* n, shared_ptr film, weak_ptr viewer) : _video_panel (0) , _audio_panel (0) , _timeline_dialog (0) @@ -94,31 +94,31 @@ ContentPanel::ContentPanel (wxNotebook* n, boost::shared_ptr film, Control wxBoxSizer* b = new wxBoxSizer (wxVERTICAL); - _add_file = new wxButton (_panel, wxID_ANY, _("Add file(s)...")); + _add_file = new Button (_panel, _("Add file(s)...")); _add_file->SetToolTip (_("Add video, image, sound or subtitle files to the film.")); b->Add (_add_file, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - _add_folder = new wxButton (_panel, wxID_ANY, _("Add folder...")); + _add_folder = new Button (_panel, _("Add folder...")); _add_folder->SetToolTip (_("Add a folder of image files (which will be used as a moving image sequence) or a folder of sound files.")); b->Add (_add_folder, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - _add_dcp = new wxButton (_panel, wxID_ANY, _("Add DCP...")); + _add_dcp = new Button (_panel, _("Add DCP...")); _add_dcp->SetToolTip (_("Add a DCP.")); b->Add (_add_dcp, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - _remove = new wxButton (_panel, wxID_ANY, _("Remove")); + _remove = new Button (_panel, _("Remove")); _remove->SetToolTip (_("Remove the selected piece of content from the film.")); b->Add (_remove, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - _earlier = new wxButton (_panel, wxID_ANY, _("Earlier")); + _earlier = new Button (_panel, _("Earlier")); _earlier->SetToolTip (_("Move the selected piece of content earlier in the film.")); b->Add (_earlier, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - _later = new wxButton (_panel, wxID_ANY, _("Later")); + _later = new Button (_panel, _("Later")); _later->SetToolTip (_("Move the selected piece of content later in the film.")); b->Add (_later, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); - _timeline = new wxButton (_panel, wxID_ANY, _("Timeline...")); + _timeline = new Button (_panel, _("Timeline...")); _timeline->SetToolTip (_("Open the timeline for the film.")); b->Add (_timeline, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); @@ -302,7 +302,9 @@ ContentPanel::check_selection () } if (go_to && Config::instance()->jump_to_selected() && signal_manager) { - signal_manager->when_idle(boost::bind(&ControlFilmViewer::set_position, _film_viewer, go_to.get().ceil(_film->video_frame_rate()))); + shared_ptr fv = _film_viewer.lock (); + DCPOMATIC_ASSERT (fv); + signal_manager->when_idle(boost::bind(&FilmViewer::seek, fv.get(), go_to.get().ceil(_film->video_frame_rate()), true)); } if (_timeline_dialog) { @@ -448,7 +450,7 @@ ContentPanel::add_folder_clicked () list > content; try { - content = content_factory (_film, path); + content = content_factory (path); } catch (exception& e) { error_dialog (_parent, e.what()); return; @@ -491,7 +493,7 @@ ContentPanel::add_dcp_clicked () } try { - _film->examine_and_add_content (shared_ptr (new DCPContent (_film, path))); + _film->examine_and_add_content (shared_ptr (new DCPContent (path))); } catch (exception& e) { error_dialog (_parent, e.what()); } @@ -567,7 +569,7 @@ ContentPanel::setup_sensitivity () _text_panel[i]->Enable (_generally_sensitive && selection.size() == 1 && !selection.front()->text.empty()); } } - _timing_panel->Enable (_generally_sensitive); + _timing_panel->Enable (_generally_sensitive); } void @@ -753,7 +755,7 @@ ContentPanel::add_files (list paths) try { BOOST_FOREACH (boost::filesystem::path i, paths) { - BOOST_FOREACH (shared_ptr j, content_factory (_film, i)) { + BOOST_FOREACH (shared_ptr j, content_factory(i)) { _film->examine_and_add_content (j); } }