diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-01-16 00:37:22 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-01-19 00:44:06 +0100 |
| commit | 17d9f8ba001eb14c3bbaf5cc5ebc37c5c0e1edb9 (patch) | |
| tree | 3549c87c08916fbd07c667377268d1e27c4ae2f1 | |
| parent | ef2eb8521358684042807dfcec62ce0e5639ec8d (diff) | |
Add option to force short screen layout (#2946).
| -rw-r--r-- | src/lib/config.cc | 4 | ||||
| -rw-r--r-- | src/lib/config.h | 9 | ||||
| -rw-r--r-- | src/wx/full_config_dialog.cc | 12 | ||||
| -rw-r--r-- | src/wx/wx_util.cc | 4 | ||||
| m--------- | test/data | 0 |
5 files changed, 29 insertions, 0 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index aa7c79bbe..aa783b7a2 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -222,6 +222,7 @@ Config::set_defaults () _enable_player_http_server = false; _player_http_server_port = 8080; _relative_paths = false; + _layout_for_short_screen = false; _allowed_dcp_frame_rates.clear (); _allowed_dcp_frame_rates.push_back (24); @@ -662,6 +663,7 @@ try _enable_player_http_server = f.optional_bool_child("EnablePlayerHTTPServer").get_value_or(false); _player_http_server_port = f.optional_number_child<int>("PlayerHTTPServerPort").get_value_or(8080); _relative_paths = f.optional_bool_child("RelativePaths").get_value_or(false); + _layout_for_short_screen = f.optional_bool_child("LayoutForShortScreen").get_value_or(false); #ifdef DCPOMATIC_GROK if (auto grok = f.optional_node_child("Grok")) { @@ -1139,6 +1141,8 @@ Config::write_config () const cxml::add_text_child(root, "PlayerHTTPServerPort", fmt::to_string(_player_http_server_port)); /* [XML] RelativePaths 1 to write relative paths to project metadata files, 0 to use absolute paths */ cxml::add_text_child(root, "RelativePaths", _relative_paths ? "1" : "0"); + /* [XML] LayoutForShortScreen 1 to set up DCP-o-matic as if the screen were less than 800 pixels high */ + cxml::add_text_child(root, "LayoutForShortScreen", _layout_for_short_screen ? "1" : "0"); #ifdef DCPOMATIC_GROK if (_grok) { diff --git a/src/lib/config.h b/src/lib/config.h index 794e39ec7..ba3e1cdd8 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -681,6 +681,10 @@ public: return _relative_paths; } + bool layout_for_short_screen() { + return _layout_for_short_screen; + } + /* SET (mostly) */ void set_master_encoding_threads (int n) { @@ -1232,6 +1236,10 @@ public: maybe_set(_relative_paths, relative); } + void set_layout_for_short_screen(bool layout) { + maybe_set(_layout_for_short_screen, layout); + } + void changed (Property p = OTHER); boost::signals2::signal<void (Property)> Changed; @@ -1473,6 +1481,7 @@ private: bool _enable_player_http_server; int _player_http_server_port; bool _relative_paths; + bool _layout_for_short_screen; #ifdef DCPOMATIC_GROK boost::optional<Grok> _grok; diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index 0291d4fa6..2b7eaac9d 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -1567,6 +1567,10 @@ private: table->Add (_only_servers_encode, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP); table->AddSpacer (0); + _layout_for_short_screen = new CheckBox(_panel, _("Layout for short screen")); + table->Add(_layout_for_short_screen, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_GAP); + table->AddSpacer (0); + { add_label_to_sizer (table, _panel, _("Maximum number of frames to store per thread"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); auto s = new wxBoxSizer (wxHORIZONTAL); @@ -1659,6 +1663,7 @@ private: _video_display_mode->Bind (wxEVT_CHOICE, boost::bind(&AdvancedPage::video_display_mode_changed, this)); _show_experimental_audio_processors->bind(&AdvancedPage::show_experimental_audio_processors_changed, this); _only_servers_encode->bind(&AdvancedPage::only_servers_encode_changed, this); + _layout_for_short_screen->bind(&AdvancedPage::layout_for_short_screen_changed, this); _frames_in_memory_multiplier->Bind (wxEVT_SPINCTRL, boost::bind(&AdvancedPage::frames_in_memory_multiplier_changed, this)); _dcp_metadata_filename_format->Changed.connect (boost::bind (&AdvancedPage::dcp_metadata_filename_format_changed, this)); _dcp_asset_filename_format->Changed.connect (boost::bind (&AdvancedPage::dcp_asset_filename_format_changed, this)); @@ -1691,6 +1696,7 @@ private: } checked_set (_show_experimental_audio_processors, config->show_experimental_audio_processors ()); checked_set (_only_servers_encode, config->only_servers_encode ()); + checked_set (_layout_for_short_screen, config->layout_for_short_screen()); checked_set (_log_general, config->log_types() & LogEntry::TYPE_GENERAL); checked_set (_log_warning, config->log_types() & LogEntry::TYPE_WARNING); checked_set (_log_error, config->log_types() & LogEntry::TYPE_ERROR); @@ -1731,6 +1737,11 @@ private: Config::instance()->set_only_servers_encode (_only_servers_encode->GetValue()); } + void layout_for_short_screen_changed() + { + Config::instance()->set_layout_for_short_screen(_layout_for_short_screen->GetValue()); + } + void dcp_metadata_filename_format_changed () { Config::instance()->set_dcp_metadata_filename_format(_dcp_metadata_filename_format->get()); @@ -1788,6 +1799,7 @@ private: wxSpinCtrl* _frames_in_memory_multiplier = nullptr; CheckBox* _show_experimental_audio_processors = nullptr; CheckBox* _only_servers_encode = nullptr; + CheckBox* _layout_for_short_screen = nullptr; NameFormatEditor* _dcp_metadata_filename_format = nullptr; NameFormatEditor* _dcp_asset_filename_format = nullptr; CheckBox* _log_general = nullptr; diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index e82ca8e1b..b1cd873fc 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -834,6 +834,10 @@ wx::report_problem() bool layout_for_short_screen(wxWindow* reference) { + if (Config::instance()->layout_for_short_screen()) { + return true; + } + auto const sn = wxDisplay::GetFromWindow(reference); return sn >= 0 && wxDisplay(sn).GetClientArea().height <= 800; } diff --git a/test/data b/test/data -Subproject c2ad073f0bf7105fb628dbbe2eb82d92bc800dc +Subproject 8cf2d01f470c8e5be3ab4a241dd88236c041a5c |
