From 15895d47cebc0988aecf0a6b84947f4b6bae9aa3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 11 Sep 2018 19:58:28 +0100 Subject: [PATCH 1/1] Full-screen mode for player. --- ChangeLog | 4 ++++ src/tools/dcpomatic_player.cc | 29 ++++++++++++++++++++++------- src/wx/film_viewer.cc | 1 + 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4420c78a8..93029bab7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-09-11 Carl Hetherington + + * Full-screen mode for player (#1329). + 2018-09-10 Carl Hetherington * Basic export of multiple reels to multiple files. diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index a95476fc1..9a9316717 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -85,7 +85,8 @@ enum { ID_file_close = 100, ID_view_cpl, /* Allow spare IDs for CPLs */ - ID_view_closed_captions = 200, + ID_view_full_screen = 200, + ID_view_closed_captions, ID_view_scale_appropriate, ID_view_scale_full, ID_view_scale_half, @@ -107,6 +108,7 @@ public: , _update_news_requested (false) , _info (0) , _config_dialog (0) + , _full_screen (false) , _file_menu (0) , _history_items (0) , _history_position (0) @@ -137,6 +139,7 @@ public: Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_close, this), ID_file_close); 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_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); @@ -150,17 +153,17 @@ public: /* Use a panel as the only child of the Frame so that we avoid the dark-grey background on Windows. */ - wxPanel* overall_panel = new wxPanel (this, wxID_ANY); + _overall_panel = new wxPanel (this, wxID_ANY); - _viewer.reset (new FilmViewer (overall_panel)); - _controls = new Controls (overall_panel, _viewer); + _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); + _info = new PlayerInformation (_overall_panel, _viewer); wxSizer* main_sizer = new wxBoxSizer (wxVERTICAL); - main_sizer->Add (_viewer->panel(), 1, wxEXPAND | wxALL, 6); + main_sizer->Add (_viewer->panel(), 1, wxEXPAND); main_sizer->Add (_controls, 0, wxEXPAND | wxALL, 6); main_sizer->Add (_info, 0, wxEXPAND | wxALL, 6); - overall_panel->SetSizer (main_sizer); + _overall_panel->SetSizer (main_sizer); #ifdef __WXOSX__ int accelerators = 4; @@ -274,6 +277,7 @@ 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->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)); @@ -438,6 +442,15 @@ private: dcp->examine (shared_ptr()); } + 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); + } + void view_closed_captions () { _viewer->show_closed_captions (); @@ -646,6 +659,8 @@ private: bool _update_news_requested; PlayerInformation* _info; wxPreferencesEditor* _config_dialog; + bool _full_screen; + wxPanel* _overall_panel; wxMenu* _file_menu; wxMenuItem* _view_cpl; wxMenu* _cpl_menu; diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index bd83821be..c062524e9 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -91,6 +91,7 @@ FilmViewer::FilmViewer (wxWindow* p) #endif _panel->SetBackgroundStyle (wxBG_STYLE_PAINT); + _panel->SetBackgroundColour (*wxBLACK); _panel->Bind (wxEVT_PAINT, boost::bind (&FilmViewer::paint_panel, this)); _panel->Bind (wxEVT_SIZE, boost::bind (&FilmViewer::panel_sized, this, _1)); -- 2.30.2