diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-02-18 17:42:58 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-02-18 17:42:58 +0000 |
| commit | d8a19dca28268e3ac92f117d00c1064c0b06515c (patch) | |
| tree | c3a9d9d6b25689c828578300c46361444bb72c1b /src/wx | |
| parent | 1b81ba7c24e7f117d1960021d7e28c8f0147009f (diff) | |
Various improvements to the content properties dialogue (including #791).
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/content_properties_dialog.cc | 22 | ||||
| -rw-r--r-- | src/wx/table_dialog.cc | 15 |
2 files changed, 32 insertions, 5 deletions
diff --git a/src/wx/content_properties_dialog.cc b/src/wx/content_properties_dialog.cc index 0b9bd0bb8..8920ad913 100644 --- a/src/wx/content_properties_dialog.cc +++ b/src/wx/content_properties_dialog.cc @@ -25,10 +25,12 @@ #include "lib/audio_content.h" #include "lib/single_stream_audio_content.h" #include <boost/algorithm/string.hpp> +#include <boost/foreach.hpp> using std::string; using std::list; using std::pair; +using std::map; using boost::shared_ptr; using boost::dynamic_pointer_cast; @@ -40,10 +42,22 @@ ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr<C add (_("Filename"), true); add (new wxStaticText (this, wxID_ANY, std_to_wx (n))); - list<pair<string, string> > properties = content->properties (); - for (list<pair<string, string> >::const_iterator i = properties.begin(); i != properties.end(); ++i) { - add (std_to_wx (i->first), true); - add (new wxStaticText (this, wxID_ANY, std_to_wx (i->second))); + map<string, list<Content::UserProperty> > grouped; + BOOST_FOREACH (Content::UserProperty i, content->user_properties()) { + if (grouped.find(i.category) == grouped.end()) { + grouped[i.category] = list<Content::UserProperty> (); + } + grouped[i.category].push_back (i); + } + + for (map<string, list<Content::UserProperty> >::const_iterator i = grouped.begin(); i != grouped.end(); ++i) { + add (std_to_wx ("<b>" + i->first + "</b>"), false); + add_spacer (); + + BOOST_FOREACH (Content::UserProperty j, i->second) { + add (std_to_wx (j.key), true); + add (new wxStaticText (this, wxID_ANY, std_to_wx (j.value + " " + j.unit))); + } } layout (); diff --git a/src/wx/table_dialog.cc b/src/wx/table_dialog.cc index 3c5d9d3d5..3f8d10fe1 100644 --- a/src/wx/table_dialog.cc +++ b/src/wx/table_dialog.cc @@ -50,9 +50,22 @@ TableDialog::layout () } void +#ifdef DCPOMATIC_OSX TableDialog::add (wxString text, bool label) +#else +TableDialog::add (wxString text, bool) +#endif { - add_label_to_sizer (_table, this, text, label); + int flags = wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT; +#ifdef __WXOSX__ + if (label) { + flags |= wxALIGN_RIGHT; + t += wxT (":"); + } +#endif + wxStaticText* m = new wxStaticText (this, wxID_ANY, wxT ("")); + m->SetLabelMarkup (text); + _table->Add (m, 0, flags, 6); } void |
