Tweak layout and remove some code duplication.
authorCarl Hetherington <cth@carlh.net>
Fri, 6 Jul 2018 18:37:36 +0000 (19:37 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 6 Jul 2018 18:37:36 +0000 (19:37 +0100)
src/wx/kdm_output_panel.cc
src/wx/wx_util.cc
src/wx/wx_util.h

index 3befd702562e2254c5f45bfecff1263a3b1ba72b..6d741cf5ec41345ddf1275a55d8ca4a49b7b5ad2 100644 (file)
@@ -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";
index 4cd0d4bd793a074d893ae516822026ca205660a6..4fde32674c2129721c3b8c87839c2f14227238e7 100644 (file)
@@ -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;
index 2691eccf471a602e3ee50d2301f0c88b40533978..e1a7af1aaf060f1d1d11262dc6e6dff55eb50d4f 100644 (file)
@@ -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);