Separate out management of controls.
[dcpomatic.git] / src / tools / dcpomatic_player.cc
index e5745403d0c60e343b46d7bc2082b33fe8c7d9a6..a8895e8e8ff451500625ee4ccb2eb3fce9acfab9 100644 (file)
 
 */
 
+
+#include "wx/wx_signal_manager.h"
+#include "wx/wx_util.h"
+#include "wx/about_dialog.h"
+#include "wx/report_problem_dialog.h"
+#include "wx/film_viewer.h"
+#include "wx/player_information.h"
+#include "wx/update_dialog.h"
+#include "wx/player_config_dialog.h"
+#include "wx/verify_dcp_dialog.h"
+#include "wx/control_film_viewer.h"
 #include "lib/cross.h"
 #include "lib/config.h"
 #include "lib/util.h"
 #include "lib/dcp_content.h"
 #include "lib/job_manager.h"
 #include "lib/job.h"
+#include "lib/film.h"
 #include "lib/video_content.h"
-#include "lib/caption_content.h"
+#include "lib/text_content.h"
 #include "lib/ratio.h"
 #include "lib/verify_dcp_job.h"
 #include "lib/dcp_examiner.h"
 #include "lib/examine_content_job.h"
 #include "lib/server.h"
 #include "lib/dcpomatic_socket.h"
-#include "wx/wx_signal_manager.h"
-#include "wx/wx_util.h"
-#include "wx/about_dialog.h"
-#include "wx/report_problem_dialog.h"
-#include "wx/film_viewer.h"
-#include "wx/player_information.h"
-#include "wx/update_dialog.h"
-#include "wx/player_config_dialog.h"
-#include "wx/verify_dcp_dialog.h"
 #include <wx/wx.h>
 #include <wx/stdpaths.h>
 #include <wx/splash.h>
@@ -108,7 +111,6 @@ public:
                , _history_items (0)
                , _history_position (0)
                , _history_separator (0)
-               , _viewer (0)
        {
 
 #if defined(DCPOMATIC_WINDOWS)
@@ -150,11 +152,13 @@ public:
                */
                wxPanel* overall_panel = new wxPanel (this, wxID_ANY);
 
-               _viewer = new FilmViewer (overall_panel, false, false);
+               _viewer.reset (new FilmViewer (overall_panel));
+               _controls = new Controls (overall_panel, _viewer);
                _viewer->set_dcp_decode_reduction (Config::instance()->decode_reduction ());
                _info = new PlayerInformation (overall_panel, _viewer);
                wxSizer* main_sizer = new wxBoxSizer (wxVERTICAL);
-               main_sizer->Add (_viewer, 1, wxEXPAND | wxALL, 6);
+               main_sizer->Add (_viewer->panel(), 1, wxEXPAND | wxALL, 6);
+               main_sizer->Add (_controls, 0, wxEXPAND | wxALL, 6);
                main_sizer->Add (_info, 0, wxEXPAND | wxALL, 6);
                overall_panel->SetSizer (main_sizer);
 
@@ -228,10 +232,11 @@ public:
                DCPExaminer ex (dcp);
                int id = ID_view_cpl;
                BOOST_FOREACH (shared_ptr<dcp::CPL> i, ex.cpls()) {
-                       wxMenuItem* j = _cpl_menu->AppendRadioItem(id, i->id());
-                       if (!dcp->cpl() || i->id() == *dcp->cpl()) {
-                               j->Check(true);
-                       }
+                       wxMenuItem* j = _cpl_menu->AppendRadioItem(
+                               id,
+                               wxString::Format("%s (%s)", std_to_wx(i->annotation_text()).data(), std_to_wx(i->id()).data())
+                               );
+                       j->Check(!dcp->cpl() || i->id() == *dcp->cpl());
                        ++id;
                }
        }
@@ -574,12 +579,12 @@ private:
 
        void back_frame ()
        {
-               _viewer->back_frame ();
+               _viewer->move (-_viewer->one_video_frame());
        }
 
        void forward_frame ()
        {
-               _viewer->forward_frame ();
+               _viewer->move (_viewer->one_video_frame());
        }
 
 private:
@@ -626,7 +631,7 @@ private:
 
        void setup_from_dcp (shared_ptr<DCPContent> dcp)
        {
-               BOOST_FOREACH (shared_ptr<CaptionContent> i, dcp->caption) {
+               BOOST_FOREACH (shared_ptr<TextContent> i, dcp->text) {
                        i->set_use (true);
                }
 
@@ -647,7 +652,8 @@ private:
        int _history_items;
        int _history_position;
        wxMenuItem* _history_separator;
-       FilmViewer* _viewer;
+       shared_ptr<FilmViewer> _viewer;
+       Controls* _controls;
        boost::shared_ptr<Film> _film;
        boost::signals2::scoped_connection _config_changed_connection;
        wxMenuItem* _file_add_ov;