Configurable window arrangement in player dual-screen mode.
authorCarl Hetherington <cth@carlh.net>
Tue, 18 Sep 2018 20:34:37 +0000 (21:34 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 18 Sep 2018 20:34:37 +0000 (21:34 +0100)
src/lib/config.cc
src/lib/config.h
src/tools/dcpomatic_player.cc
src/wx/player_config_dialog.cc

index 702da44d084d72bec99c3aba9c715340d7c052a3..e5d241d2b97bc5e2d4cbdeaa97c1c972a6cd505d 100644 (file)
@@ -164,6 +164,7 @@ Config::set_defaults ()
        _gdc_password = optional<string>();
        _interface_complexity = INTERFACE_SIMPLE;
        _player_mode = PLAYER_MODE_WINDOW;
+       _image_display = 0;
        _respect_kdm_validity_periods = true;
        _player_log_file = boost::none;
 
@@ -493,6 +494,7 @@ try
                _player_mode = PLAYER_MODE_DUAL;
        }
 
+       _image_display = f.optional_number_child<int>("ImageDisplay").get_value_or(0);
        _respect_kdm_validity_periods = f.optional_bool_child("RespectKDMValidityPeriods").get_value_or(true);
        _player_log_file = f.optional_string_child("PlayerLogFile");
 
@@ -881,6 +883,7 @@ Config::write_config () const
                break;
        }
 
+       root->add_child("ImageDisplay")->add_child_text(raw_convert<string>(_image_display));
        root->add_child("RespectKDMValidityPeriods")->add_child_text(_respect_kdm_validity_periods ? "1" : "0");
        if (_player_log_file) {
                root->add_child("PlayerLogFile")->add_child_text(_player_log_file->string());
index 37c036587f4b75dad0992d057ba33cab1f98426e..02295725b36cfd58c1a31bf32d8115b6426b654f 100644 (file)
@@ -469,6 +469,10 @@ public:
                return _player_mode;
        }
 
+       int image_display () const {
+               return _image_display;
+       }
+
        bool respect_kdm_validity_periods () const {
                return _respect_kdm_validity_periods;
        }
@@ -879,6 +883,10 @@ public:
                maybe_set (_player_mode, m);
        }
 
+       void set_image_display (int n) {
+               maybe_set (_image_display, n);
+       }
+
        void set_respect_kdm_validity_periods (bool r) {
                maybe_set (_respect_kdm_validity_periods, r);
        }
@@ -1078,6 +1086,7 @@ private:
        boost::optional<std::string> _gdc_password;
        Interface _interface_complexity;
        PlayerMode _player_mode;
+       int _image_display;
        bool _respect_kdm_validity_periods;
        boost::optional<boost::filesystem::path> _player_log_file;
 
index dbd5b0fb6b08583eef807a87c39b2e57e2fff395..1925ab2e1e3d1a55a357807bedc622eecfcad9b6 100644 (file)
@@ -558,9 +558,17 @@ private:
                if (_mode == Config::PLAYER_MODE_DUAL) {
                        _cinema_dialog->Show ();
                        if (wxDisplay::GetCount() > 1) {
-                               this->Move (wxDisplay(0).GetClientArea().GetWidth(), 0);
-                               /* (0, 0) doesn't seem to work for some strange reason */
-                               _cinema_dialog->Move (8, 8);
+                               switch (Config::instance()->image_display()) {
+                               case 0:
+                                       this->Move (0, 0);
+                                       _cinema_dialog->Move (wxDisplay(0).GetClientArea().GetWidth(), 0);
+                                       break;
+                               case 1:
+                                       this->Move (wxDisplay(0).GetClientArea().GetWidth(), 0);
+                                       /* (0, 0) doesn't seem to work for some strange reason */
+                                       _cinema_dialog->Move (8, 8);
+                                       break;
+                               }
                        }
                }
        }
index 8d83f0bc6f9dd07925fe9f827ab71e7795033162..9ebb8be0b149768438af18d3cfab1ab18b8d43da 100644 (file)
@@ -90,10 +90,17 @@ private:
                _player_mode = new wxChoice (_panel, wxID_ANY);
                _player_mode->Append (_("window"));
                _player_mode->Append (_("full screen"));
-               _player_mode->Append (_("full screen with controls on second monitor"));
+               _player_mode->Append (_("full screen with controls on other monitor"));
                table->Add (_player_mode, wxGBPosition(r, 1));
                ++r;
 
+               add_label_to_sizer (table, _panel, _("Displays"), true, wxGBPosition(r, 0));
+               _image_display = new wxChoice (_panel, wxID_ANY);
+               _image_display->Append (_("Image on primary, controls on secondary"));
+               _image_display->Append (_("Image on secondary, controls on primary"));
+               table->Add (_image_display, wxGBPosition(r, 1));
+               ++r;
+
                _respect_kdm = new wxCheckBox (_panel, wxID_ANY, _("Respect KDM validity periods"));
                table->Add (_respect_kdm, wxGBPosition(r, 0), wxGBSpan(1, 2));
                ++r;
@@ -104,6 +111,7 @@ private:
                ++r;
 
                _player_mode->Bind (wxEVT_CHOICE, bind(&PlayerGeneralPage::player_mode_changed, this));
+               _image_display->Bind (wxEVT_CHOICE, bind(&PlayerGeneralPage::image_display_changed, this));
                _respect_kdm->Bind (wxEVT_CHECKBOX, bind(&PlayerGeneralPage::respect_kdm_changed, this));
                _log_file->Bind (wxEVT_FILEPICKER_CHANGED, bind(&PlayerGeneralPage::log_file_changed, this));
        }
@@ -126,6 +134,7 @@ private:
                        break;
                }
 
+               checked_set (_image_display, config->image_display());
                checked_set (_respect_kdm, config->respect_kdm_validity_periods());
                if (config->player_log_file()) {
                        checked_set (_log_file, *config->player_log_file());
@@ -148,6 +157,11 @@ private:
                }
        }
 
+       void image_display_changed ()
+       {
+               Config::instance()->set_image_display(_image_display->GetSelection());
+       }
+
        void respect_kdm_changed ()
        {
                Config::instance()->set_respect_kdm_validity_periods(_respect_kdm->GetValue());
@@ -159,6 +173,7 @@ private:
        }
 
        wxChoice* _player_mode;
+       wxChoice* _image_display;
        wxCheckBox* _respect_kdm;
        FilePickerCtrl* _log_file;
 };