From c2f7680e0d4c5d01d00597e854f296e17626392a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 12 Mar 2026 01:51:04 +0100 Subject: Put a scrollbar into the content properties dialogue (#3143). --- src/wx/content_properties_dialog.cc | 39 ++++++++++++++++++++++++------------- src/wx/content_properties_dialog.h | 12 ++++++++++-- 2 files changed, 36 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/wx/content_properties_dialog.cc b/src/wx/content_properties_dialog.cc index 63f7fcf3e..154df4efe 100644 --- a/src/wx/content_properties_dialog.cc +++ b/src/wx/content_properties_dialog.cc @@ -39,8 +39,19 @@ using boost::optional; ContentPropertiesDialog::ContentPropertiesDialog(wxWindow* parent, shared_ptr film, shared_ptr content) - : TableDialog(parent, _("Content Properties"), 2, 1, false) + : wxDialog(parent, wxID_ANY, _("Content Properties"), wxDefaultPosition, wxSize(640, 600), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { + _scroll = new wxScrolledWindow(this); + _scroll->SetMinSize(wxSize(740, 600)); + _scroll->EnableScrolling(false, true); + _scroll->SetScrollRate(0, 32); + + _table = new wxFlexGridSizer(2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_X_GAP); + _table->AddGrowableCol(1, 1); + auto sizer = new wxBoxSizer(wxVERTICAL); + sizer->Add(_table, 1, wxEXPAND); + _scroll->SetSizer(sizer); + map> grouped; for (auto i: content->user_properties(film)) { if (grouped.find(i.category) == grouped.end()) { @@ -55,10 +66,12 @@ ContentPropertiesDialog::ContentPropertiesDialog(wxWindow* parent, shared_ptrAdd(new wxStaticText(_scroll, wxID_ANY, wxT("")), 0, 0); + _table->Add(new wxStaticText(_scroll, wxID_ANY, wxT("")), 0, 0); - layout(); + auto overall_sizer = new wxBoxSizer(wxVERTICAL); + overall_sizer->Add(_scroll, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); + SetSizerAndFit(overall_sizer); } @@ -86,15 +99,15 @@ ContentPropertiesDialog::maybe_add_group(mapSetFont(font); - add_spacer(); - add_spacer(); - add(m, false); - add_spacer(); + _table->AddSpacer(0); + _table->AddSpacer(0); + _table->Add(m, 1); + _table->AddSpacer(0); vector sub_headings; for (auto j: i->second) { @@ -109,16 +122,16 @@ ContentPropertiesDialog::maybe_add_group(map sub_heading) { if (sub_heading) { - auto heading = add_label_to_sizer(_table, this, std_to_wx(*sub_heading), true, 0, wxALIGN_TOP); + auto heading = add_label_to_sizer(_table, _scroll, std_to_wx(*sub_heading), true, 0, wxALIGN_TOP); wxFont font(*wxNORMAL_FONT); font.SetStyle(wxFONTSTYLE_ITALIC); heading->SetFont(font); - add_spacer(); + _table->AddSpacer(0); } for (auto j: i->second) { if (j.sub_heading == sub_heading) { - add_label_to_sizer(_table, this, std_to_wx(j.key), true, 0, wxALIGN_TOP); - add(new StaticText(this, std_to_wx(j.value + " " + j.unit))); + add_label_to_sizer(_table, _scroll, std_to_wx(j.key), true, 0, wxALIGN_TOP); + _table->Add(new StaticText(_scroll, std_to_wx(j.value + " " + j.unit)), 1); } } }; diff --git a/src/wx/content_properties_dialog.h b/src/wx/content_properties_dialog.h index 253d7ff4a..844b6c6de 100644 --- a/src/wx/content_properties_dialog.h +++ b/src/wx/content_properties_dialog.h @@ -19,22 +19,30 @@ */ -#include "table_dialog.h" #include "lib/user_property.h" #include #include +#include +LIBDCP_DISABLE_WARNINGS +#include +LIBDCP_ENABLE_WARNINGS class Content; class Film; class UserProperty; +class wxFlexGridSizer; +class wxScrolledWindow; -class ContentPropertiesDialog : public TableDialog +class ContentPropertiesDialog : public wxDialog { public: ContentPropertiesDialog(wxWindow* parent, std::shared_ptr film, std::shared_ptr content); private: void maybe_add_group(std::map> const & groups, UserProperty::Category category); + + wxFlexGridSizer* _table; + wxScrolledWindow* _scroll; }; -- cgit v1.2.3