From 45dcdd17c7f860e92d7b1d75598afea64c5fbc50 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 14 Sep 2018 20:10:36 +0100 Subject: [PATCH] Basic dual-screen mode for player. --- ChangeLog | 4 +++ src/tools/dcpomatic_player.cc | 58 ++++++++++++++++++++++++++++------ src/wx/cinema_player_dialog.cc | 41 ++++++++++++++++++++++++ src/wx/cinema_player_dialog.h | 36 +++++++++++++++++++++ src/wx/controls.cc | 22 ++++++++----- src/wx/controls.h | 2 +- src/wx/wscript | 1 + 7 files changed, 146 insertions(+), 18 deletions(-) create mode 100644 src/wx/cinema_player_dialog.cc create mode 100644 src/wx/cinema_player_dialog.h diff --git a/ChangeLog b/ChangeLog index 93029bab7..243f2aa16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-09-14 Carl Hetherington + + * Basic dual-screen mode for player. + 2018-09-11 Carl Hetherington * Full-screen mode for player (#1329). diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 9a9316717..7991a35e2 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -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 #include #include +#include #ifdef __WXOSX__ #include #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(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 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(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 index 000000000..3545608ed --- /dev/null +++ b/src/wx/cinema_player_dialog.cc @@ -0,0 +1,41 @@ +/* + Copyright (C) 2018 Carl Hetherington + + 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 . + +*/ + +#include "cinema_player_dialog.h" +#include "controls.h" +#include "player_information.h" +#include + +using boost::shared_ptr; + +CinemaPlayerDialog::CinemaPlayerDialog (wxWindow* parent, shared_ptr 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 index 000000000..045dafb28 --- /dev/null +++ b/src/wx/cinema_player_dialog.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2018 Carl Hetherington + + 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 . + +*/ + +#include +#include + +class Controls; +class PlayerInformation; +class FilmViewer; + +class CinemaPlayerDialog : public wxDialog +{ +public: + CinemaPlayerDialog (wxWindow* parent, boost::shared_ptr viewer); + +private: + Controls* _controls; + PlayerInformation* _info; +}; diff --git a/src/wx/controls.cc b/src/wx/controls.cc index de0060d64..feef2e91c 100644 --- a/src/wx/controls.cc +++ b/src/wx/controls.cc @@ -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 viewer, bool outline_content, bool jump_to_selected) +Controls::Controls (wxWindow* parent, shared_ptr 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 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 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 diff --git a/src/wx/controls.h b/src/wx/controls.h index 1795612af..1c8474e54 100644 --- a/src/wx/controls.h +++ b/src/wx/controls.h @@ -15,7 +15,7 @@ class wxToggleButton; class Controls : public wxPanel { public: - Controls (wxWindow* parent, boost::shared_ptr, bool outline_content = true, bool jump_to_selected = true); + Controls (wxWindow* parent, boost::shared_ptr, bool outline_content = true, bool jump_to_selected = true, bool eyes = true); boost::shared_ptr film () const; void back_frame (); diff --git a/src/wx/wscript b/src/wx/wscript index ad0292a47..0c9f0c731 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -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 -- 2.30.2