summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-07-06 19:37:36 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-06 19:37:36 +0100
commitcf7d4e462769264868588be5c46b0c968eb570c9 (patch)
tree09b4bdcc6fe379be0d0d7d40e279e1e61537251f /src
parent220fe9ef5a0f9198630d3335fa901fd9c41b14f4 (diff)
Tweak layout and remove some code duplication.
Diffstat (limited to 'src')
-rw-r--r--src/wx/kdm_output_panel.cc24
-rw-r--r--src/wx/wx_util.cc5
-rw-r--r--src/wx/wx_util.h2
3 files changed, 5 insertions, 26 deletions
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<wxString> e = boost::optional<wxString>());
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);