diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-03-12 01:51:04 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-03-12 01:51:04 +0100 |
| commit | c2f7680e0d4c5d01d00597e854f296e17626392a (patch) | |
| tree | 47011c5b8cc396423784e5baeb6d5492cfc74d33 /src/wx | |
| parent | e22d8a737efff9516b8013cf796dabb750f396d2 (diff) | |
Put a scrollbar into the content properties dialogue (#3143).
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/content_properties_dialog.cc | 39 | ||||
| -rw-r--r-- | src/wx/content_properties_dialog.h | 12 |
2 files changed, 36 insertions, 15 deletions
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<const Film> film, shared_ptr<Content> 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<UserProperty::Category, list<UserProperty>> grouped; for (auto i: content->user_properties(film)) { if (grouped.find(i.category) == grouped.end()) { @@ -55,10 +66,12 @@ ContentPropertiesDialog::ContentPropertiesDialog(wxWindow* parent, shared_ptr<co maybe_add_group(grouped, UserProperty::LENGTH); /* Nasty hack to stop the bottom property being cut off on Windows / OS X */ - add(wxString(), false); - add(wxString(), false); + _table->Add(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(map<UserProperty::Category, list<UserPr break; } - auto m = new StaticText(this, category_name); + auto m = new StaticText(_scroll, category_name); wxFont font(*wxNORMAL_FONT); font.SetWeight(wxFONTWEIGHT_BOLD); m->SetFont(font); - add_spacer(); - add_spacer(); - add(m, false); - add_spacer(); + _table->AddSpacer(0); + _table->AddSpacer(0); + _table->Add(m, 1); + _table->AddSpacer(0); vector<string> sub_headings; for (auto j: i->second) { @@ -109,16 +122,16 @@ ContentPropertiesDialog::maybe_add_group(map<UserProperty::Category, list<UserPr auto add_sub_heading = [&](optional<string> 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 <list> #include <map> +#include <dcp/warnings.h> +LIBDCP_DISABLE_WARNINGS +#include <wx/wx.h> +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<const Film> film, std::shared_ptr<Content> content); private: void maybe_add_group(std::map<UserProperty::Category, std::list<UserProperty>> const & groups, UserProperty::Category category); + + wxFlexGridSizer* _table; + wxScrolledWindow* _scroll; }; |
