Finish off background image support for swaroop variant.
authorCarl Hetherington <cth@carlh.net>
Wed, 26 Sep 2018 21:17:11 +0000 (22:17 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 26 Sep 2018 21:17:11 +0000 (22:17 +0100)
src/lib/config.h
src/wx/film_viewer.cc
src/wx/player_config_dialog.cc

index 04f521575b23b3553b5024faf53f3465fda99e39..2ebfef84d5a9d8a7c196cb04ca57e7b8919ae979 100644 (file)
@@ -77,6 +77,9 @@ public:
                SOUND_OUTPUT,
                INTERFACE_COMPLEXITY,
                PLAYER_DCP_DIRECTORY,
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+               PLAYER_BACKGROUND_IMAGE,
+#endif
                OTHER
        };
 
@@ -944,7 +947,7 @@ public:
 
 #ifdef DCPOMATIC_VARIANT_SWAROOP
        void set_player_background_image (boost::filesystem::path p) {
-               maybe_set (_player_background_image, p);
+               maybe_set (_player_background_image, p, PLAYER_BACKGROUND_IMAGE);
        }
 
        void unset_player_background_image () {
@@ -952,7 +955,7 @@ public:
                        return;
                }
                _player_background_image = boost::none;
-               changed ();
+               changed (PLAYER_BACKGROUND_IMAGE);
        }
 #endif
 
index fd3bfa1c108472236ab502d5db066336914e70e1..5a3e58724e3c57acda36435db9575be838a6004f 100644 (file)
@@ -312,6 +312,14 @@ FilmViewer::paint_panel ()
 
        if (!_frame || !_film || !_out_size.width || !_out_size.height || _out_size != _frame->size()) {
                dc.Clear ();
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+               optional<boost::filesystem::path> bg = Config::instance()->player_background_image();
+               if (bg) {
+                       wxImage image (std_to_wx(bg->string()));
+                       wxBitmap bitmap (image);
+                       dc.DrawBitmap (bitmap, max(0, (_panel_size.width - image.GetSize().GetWidth()) / 2), max(0, (_panel_size.height - image.GetSize().GetHeight()) / 2));
+               }
+#endif
                return;
        }
 
@@ -562,6 +570,13 @@ FilmViewer::seek (DCPTime t, bool accurate)
 void
 FilmViewer::config_changed (Config::Property p)
 {
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+       if (p == Config::PLAYER_BACKGROUND_IMAGE) {
+               refresh_panel ();
+               return;
+       }
+#endif
+
        if (p != Config::SOUND && p != Config::SOUND_OUTPUT) {
                return;
        }
index a24dbc88022823e8c5b86a8975b24fe38cc9f023..768459e0a1b4298c5fe6b34c3c404a5d8aab42b3 100644 (file)
@@ -134,7 +134,7 @@ private:
                _dcp_directory->Bind (wxEVT_DIRPICKER_CHANGED, bind(&PlayerGeneralPage::dcp_directory_changed, this));
                _kdm_directory->Bind (wxEVT_DIRPICKER_CHANGED, bind(&PlayerGeneralPage::kdm_directory_changed, this));
 #ifdef DCPOMATIC_VARIANT_SWAROOP
-               _background_image->Bind (wxEVT_DIRPICKER_CHANGED, bind(&PlayerGeneralPage::background_image_changed, this));
+               _background_image->Bind (wxEVT_FILEPICKER_CHANGED, bind(&PlayerGeneralPage::background_image_changed, this));
 #endif
        }