From: Carl Hetherington Date: Fri, 6 Jul 2018 18:37:36 +0000 (+0100) Subject: Tweak layout and remove some code duplication. X-Git-Tag: v2.13.34~5 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=cf7d4e462769264868588be5c46b0c968eb570c9 Tweak layout and remove some code duplication. --- diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc index 3befd7025..6d741cf5e 100644 --- a/src/wx/kdm_output_panel.cc +++ b/src/wx/kdm_output_panel.cc @@ -61,31 +61,11 @@ KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop) table->Add (_type, 1, wxEXPAND); _type->SetSelection (0); - { - int flags = wxALIGN_TOP | wxTOP | wxLEFT | wxRIGHT; - wxString t = _("Folder / ZIP name format"); -#ifdef __WXOSX__ - flags |= wxALIGN_RIGHT; - t += wxT (":"); -#endif - wxStaticText* m = new wxStaticText (this, wxID_ANY, t); - table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP); - } - + add_label_to_sizer (table, this, _("Folder / ZIP name format"), true, 0, wxALIGN_TOP | wxTOP | wxLEFT | wxRIGHT); _container_name_format = new NameFormatEditor (this, Config::instance()->kdm_container_name_format(), dcp::NameFormat::Map(), dcp::NameFormat::Map(), ""); table->Add (_container_name_format->panel(), 1, wxEXPAND); - { - int flags = wxALIGN_TOP | wxTOP | wxLEFT | wxRIGHT; - wxString t = _("Filename format"); -#ifdef __WXOSX__ - flags |= wxALIGN_RIGHT; - t += wxT (":"); -#endif - wxStaticText* m = new wxStaticText (this, wxID_ANY, t); - table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP); - } - + add_label_to_sizer (table, this, _("Filename format"), true, 0, wxALIGN_TOP | wxTOP | wxLEFT | wxRIGHT); dcp::NameFormat::Map titles; titles['f'] = "film name"; titles['c'] = "cinema"; diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 4cd0d4bd7..4fde32674 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -46,12 +46,11 @@ using dcp::locale_convert; */ wxStaticText * #ifdef __WXOSX__ -add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, bool left, int prop) +add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, bool left, int prop, int flags) #else -add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, bool, int prop) +add_label_to_sizer (wxSizer* s, wxWindow* p, wxString t, bool, int prop, int flags) #endif { - int flags = wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT; #ifdef __WXOSX__ if (left) { flags |= wxALIGN_RIGHT; diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index 2691eccf4..e1a7af1aa 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -72,7 +72,7 @@ class wxSplashScreen; extern void error_dialog (wxWindow *, wxString, boost::optional e = boost::optional()); extern void message_dialog (wxWindow *, wxString); extern bool confirm_dialog (wxWindow *, wxString); -extern wxStaticText* add_label_to_sizer (wxSizer *, wxWindow *, wxString, bool left, int prop = 0); +extern wxStaticText* add_label_to_sizer (wxSizer *, wxWindow *, wxString, bool left, int prop = 0, int flags = wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT); extern wxStaticText* add_label_to_sizer (wxGridBagSizer *, wxWindow *, wxString, bool, wxGBPosition, wxGBSpan span = wxDefaultSpan); extern std::string wx_to_std (wxString); extern wxString std_to_wx (std::string);