Basic dual-screen mode for player.
authorCarl Hetherington <cth@carlh.net>
Fri, 14 Sep 2018 19:10:36 +0000 (20:10 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 14 Sep 2018 19:10:36 +0000 (20:10 +0100)
ChangeLog
src/tools/dcpomatic_player.cc
src/wx/cinema_player_dialog.cc [new file with mode: 0644]
src/wx/cinema_player_dialog.h [new file with mode: 0644]
src/wx/controls.cc
src/wx/controls.h
src/wx/wscript

index 93029bab772fd6506019f969bd2a25d78cd5c3bc..243f2aa1697461e0d2352e818bb47b392f6f62c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-09-14  Carl Hetherington  <cth@carlh.net>
+
+       * Basic dual-screen mode for player.
+
 2018-09-11  Carl Hetherington  <cth@carlh.net>
 
        * Full-screen mode for player (#1329).
index 9a9316717b9efc86d33b644db2fe115655feb990..7991a35e208d65b830fb2232bbb16c9cc8b071f2 100644 (file)
@@ -18,7 +18,6 @@
 
 */
 
-
 #include "wx/wx_signal_manager.h"
 #include "wx/wx_util.h"
 #include "wx/about_dialog.h"
@@ -29,6 +28,7 @@
 #include "wx/player_config_dialog.h"
 #include "wx/verify_dcp_dialog.h"
 #include "wx/controls.h"
+#include "wx/cinema_player_dialog.h"
 #include "lib/cross.h"
 #include "lib/config.h"
 #include "lib/util.h"
@@ -52,6 +52,7 @@
 #include <wx/cmdline.h>
 #include <wx/preferences.h>
 #include <wx/progdlg.h>
+#include <wx/display.h>
 #ifdef __WXOSX__
 #include <ApplicationServices/ApplicationServices.h>
 #endif
@@ -86,6 +87,7 @@ enum {
        ID_view_cpl,
        /* Allow spare IDs for CPLs */
        ID_view_full_screen = 200,
+       ID_view_dual_screen,
        ID_view_closed_captions,
        ID_view_scale_appropriate,
        ID_view_scale_full,
@@ -103,12 +105,19 @@ enum {
 class DOMFrame : public wxFrame
 {
 public:
+       enum Screen {
+               SCREEN_WINDOW,
+               SCREEN_FULL,
+               SCREEN_DUAL
+       };
+
        DOMFrame ()
                : wxFrame (0, -1, _("DCP-o-matic Player"))
                , _update_news_requested (false)
                , _info (0)
                , _config_dialog (0)
-               , _full_screen (false)
+               , _screen (SCREEN_WINDOW)
+               , _cinema_dialog (0)
                , _file_menu (0)
                , _history_items (0)
                , _history_position (0)
@@ -140,6 +149,7 @@ public:
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_exit, this), wxID_EXIT);
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::edit_preferences, this), wxID_PREFERENCES);
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::view_full_screen, this), ID_view_full_screen);
+               Bind (wxEVT_MENU, boost::bind (&DOMFrame::view_dual_screen, this), ID_view_dual_screen);
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::view_closed_captions, this), ID_view_closed_captions);
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::view_cpl, this, _1), ID_view_cpl, ID_view_cpl + MAX_CPLS);
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::set_decode_reduction, this, optional<int>(0)), ID_view_scale_full);
@@ -186,6 +196,8 @@ public:
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::back_frame, this), ID_back_frame);
                Bind (wxEVT_MENU, boost::bind (&DOMFrame::forward_frame, this), ID_forward_frame);
 
+               _cinema_dialog = new CinemaPlayerDialog (this, _viewer);
+
                UpdateChecker::instance()->StateChanged.connect (boost::bind (&DOMFrame::update_checker_state_changed, this));
        }
 
@@ -277,7 +289,8 @@ private:
                wxMenu* view = new wxMenu;
                optional<int> c = Config::instance()->decode_reduction();
                _view_cpl = view->Append(ID_view_cpl, _("CPL"), _cpl_menu);
-               view->AppendCheckItem(ID_view_full_screen, _("Full screen\tF11"))->Check(_full_screen);
+               view->AppendCheckItem(ID_view_full_screen, _("Full screen\tF11"))->Check(_screen == SCREEN_FULL);
+               view->AppendCheckItem(ID_view_dual_screen, _("Dual screen\tShift+F11"))->Check(_screen == SCREEN_DUAL);
                view->Append(ID_view_closed_captions, _("Closed captions..."));
                view->AppendSeparator();
                view->AppendRadioItem(ID_view_scale_appropriate, _("Set decode resolution to match display"))->Check(!static_cast<bool>(c));
@@ -444,11 +457,37 @@ private:
 
        void view_full_screen ()
        {
-               _full_screen = !_full_screen;
-               _controls->Show (!_full_screen);
-               _info->Show (!_full_screen);
-               _overall_panel->SetBackgroundColour (_full_screen ? wxColour(0, 0, 0) : wxNullColour);
-               ShowFullScreen (_full_screen);
+               if (_screen == SCREEN_FULL) {
+                       _screen = SCREEN_WINDOW;
+               } else {
+                       _screen = SCREEN_FULL;
+               }
+               setup_screen ();
+       }
+
+       void view_dual_screen ()
+       {
+               if (_screen == SCREEN_DUAL) {
+                       _screen = SCREEN_WINDOW;
+               } else {
+                       _screen = SCREEN_DUAL;
+               }
+               setup_screen ();
+       }
+
+       void setup_screen ()
+       {
+               _controls->Show (_screen == SCREEN_WINDOW);
+               _info->Show (_screen == SCREEN_WINDOW);
+               _overall_panel->SetBackgroundColour (_screen == SCREEN_WINDOW ? wxNullColour : wxColour(0, 0, 0));
+               ShowFullScreen (_screen != SCREEN_WINDOW);
+               if (_screen == SCREEN_DUAL) {
+                       _cinema_dialog->Show ();
+                       if (wxDisplay::GetCount() > 1) {
+                               this->Move (0, 0);
+                               _cinema_dialog->Move (wxDisplay(0).GetClientArea().GetWidth(), 0);
+                       }
+               }
        }
 
        void view_closed_captions ()
@@ -659,7 +698,8 @@ private:
        bool _update_news_requested;
        PlayerInformation* _info;
        wxPreferencesEditor* _config_dialog;
-       bool _full_screen;
+       Screen _screen;
+       CinemaPlayerDialog* _cinema_dialog;
        wxPanel* _overall_panel;
        wxMenu* _file_menu;
        wxMenuItem* _view_cpl;
diff --git a/src/wx/cinema_player_dialog.cc b/src/wx/cinema_player_dialog.cc
new file mode 100644 (file)
index 0000000..3545608
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    DCP-o-matic is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "cinema_player_dialog.h"
+#include "controls.h"
+#include "player_information.h"
+#include <boost/shared_ptr.hpp>
+
+using boost::shared_ptr;
+
+CinemaPlayerDialog::CinemaPlayerDialog (wxWindow* parent, shared_ptr<FilmViewer> viewer)
+       : wxDialog (parent, wxID_ANY, _("DCP-o-matic Player"))
+{
+       _controls = new Controls (this, viewer, false, false, false);
+       _info = new PlayerInformation (this, viewer);
+
+       wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
+       s->Add (_controls, 0, wxEXPAND | wxALL, 6);
+       s->Add (_info, 0, wxEXPAND | wxALL, 6);
+
+       SetSize (640, -1);
+
+       SetSizer (s);
+}
diff --git a/src/wx/cinema_player_dialog.h b/src/wx/cinema_player_dialog.h
new file mode 100644 (file)
index 0000000..045dafb
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    DCP-o-matic is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <wx/wx.h>
+#include <boost/shared_ptr.hpp>
+
+class Controls;
+class PlayerInformation;
+class FilmViewer;
+
+class CinemaPlayerDialog : public wxDialog
+{
+public:
+       CinemaPlayerDialog (wxWindow* parent, boost::shared_ptr<FilmViewer> viewer);
+
+private:
+       Controls* _controls;
+       PlayerInformation* _info;
+};
index de0060d649e163cc19767d40097aeaa6b4fe94e1..feef2e91c53c87862abe0f9ff8baec2536a3c4ea 100644 (file)
@@ -15,7 +15,7 @@ using boost::weak_ptr;
 /** @param outline_content true if viewer should present an "outline content" checkbox.
  *  @param jump_to_selected true if viewer should present a "jump to selected" checkbox.
  */
-Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool outline_content, bool jump_to_selected)
+Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool outline_content, bool jump_to_selected, bool eye)
        : wxPanel (parent)
        , _viewer (viewer)
        , _slider_being_moved (false)
@@ -40,11 +40,13 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool outlin
                view_options->Add (_outline_content, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP);
        }
 
-       _eye = new wxChoice (this, wxID_ANY);
-       _eye->Append (_("Left"));
-       _eye->Append (_("Right"));
-       _eye->SetSelection (0);
-       view_options->Add (_eye, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP);
+       if (eye) {
+               _eye = new wxChoice (this, wxID_ANY);
+               _eye->Append (_("Left"));
+               _eye->Append (_("Right"));
+               _eye->SetSelection (0);
+               view_options->Add (_eye, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP);
+       }
 
        if (jump_to_selected) {
                _jump_to_selected = new wxCheckBox (this, wxID_ANY, _("Jump to selected content"));
@@ -73,7 +75,9 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool outlin
        _back_button->SetMinSize (wxSize (32, -1));
        _forward_button->SetMinSize (wxSize (32, -1));
 
-       _eye->Bind (wxEVT_CHOICE, boost::bind (&Controls::eye_changed, this));
+       if (_eye) {
+               _eye->Bind (wxEVT_CHOICE, boost::bind (&Controls::eye_changed, this));
+       }
        if (_outline_content) {
                _outline_content->Bind (wxEVT_CHECKBOX, boost::bind (&Controls::outline_content_changed, this));
        }
@@ -314,7 +318,9 @@ Controls::setup_sensitivity ()
                _jump_to_selected->Enable (c);
        }
 
-       _eye->Enable (c && _film->three_d ());
+       if (_eye) {
+               _eye->Enable (c && _film->three_d ());
+       }
 }
 
 void
index 1795612af694587e181b27c595a0711132208f17..1c8474e54e067f763fd62db51f55a5844029ec9b 100644 (file)
@@ -15,7 +15,7 @@ class wxToggleButton;
 class Controls : public wxPanel
 {
 public:
-       Controls (wxWindow* parent, boost::shared_ptr<FilmViewer>, bool outline_content = true, bool jump_to_selected = true);
+       Controls (wxWindow* parent, boost::shared_ptr<FilmViewer>, bool outline_content = true, bool jump_to_selected = true, bool eyes = true);
 
        boost::shared_ptr<Film> film () const;
        void back_frame ();
index ad0292a47988c1f3c2c5af9356f243044d5d4a5b..0c9f0c73199988f0f14e0e99092229d6959b6557 100644 (file)
@@ -38,6 +38,7 @@ sources = """
           text_view.cc
           christie_certificate_panel.cc
           cinema_dialog.cc
+          cinema_player_dialog.cc
           colour_conversion_editor.cc
           config_dialog.cc
           config_move_dialog.cc