Fix two more badly-adapted instantiations of EditableList and make
authorCarl Hetherington <cth@carlh.net>
Thu, 1 Sep 2022 18:42:01 +0000 (20:42 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 1 Sep 2022 18:42:01 +0000 (20:42 +0200)
it harder to make similar errors in the future.

src/tools/dcpomatic_combiner.cc
src/tools/dcpomatic_disk.cc
src/tools/dcpomatic_editor.cc
src/wx/cinema_dialog.cc
src/wx/editable_list.h
src/wx/extra_kdm_email_dialog.cc
src/wx/full_config_dialog.cc
src/wx/metadata_dialog.cc
src/wx/recipient_dialog.cc
src/wx/screen_dialog.cc
src/wx/smpte_metadata_dialog.cc

index 5a6457d465baea48fe0e5b5048e7316bc865ca0f..2ef58bb85011fe59bfffd8491d78eb875a50a65c 100644 (file)
@@ -100,7 +100,7 @@ public:
                        boost::bind(&DOMFrame::inputs, this),
                        boost::bind(&DOMFrame::set_inputs, this, _1),
                        &display_string,
-                       true,
+                       EditableListTitle::VISIBLE,
                        EditableListButton::NEW | EditableListButton::REMOVE
                        );
 
index a517dde65203a4d7dcbb28b0ec4864d092f13891..115dabe46a9f309c2c90daecf5fecb71acca45c2 100644 (file)
@@ -135,7 +135,7 @@ public:
                        boost::bind(&DOMFrame::dcp_paths, this),
                        boost::bind(&DOMFrame::set_dcp_paths, this, _1),
                        [](boost::filesystem::path p, int) { return p.filename().string(); },
-                       false,
+                       EditableListTitle::INVISIBLE,
                        EditableListButton::NEW | EditableListButton::REMOVE
                        );
 
index 075cf177f091bea364a9424162818f0903dccae4..6bb3c2785eb396b4fd22f74210c8d140950924b3 100644 (file)
@@ -221,7 +221,7 @@ public:
                        [](shared_ptr<dcp::Reel> reel, int) {
                                return reel->id();
                        },
-                       false,
+                       EditableListTitle::INVISIBLE,
                        EditableListButton::EDIT
                );
                sizer->Add(_reels, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND);
index f6007d2351eeb4cd9e740ff4acb978cac50a77f9..8c7194c4a7433084878347568ddcdb1ccb17e322 100644 (file)
@@ -71,7 +71,7 @@ CinemaDialog::CinemaDialog (wxWindow* parent, wxString title, string name, list<
        _email_list = new EditableList<string, EmailDialog> (
                this, columns, bind (&CinemaDialog::get_emails, this), bind (&CinemaDialog::set_emails, this, _1), [](string s, int) {
                        return s;
-               }, false, EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
+               }, EditableListTitle::INVISIBLE, EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
                );
 
        sizer->Add (_email_list, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND);
index bd89090485a2fcfb8250c2ea0331f4fff70772e1..902d1ccbbf213e7c53288cd1066579de58222348 100644 (file)
@@ -61,6 +61,13 @@ namespace EditableListButton
 };
 
 
+enum class EditableListTitle
+{
+       VISIBLE,
+       INVISIBLE
+};
+
+
 /** @param T type of things being edited.
  *  @param S dialog to edit a thing.
  *  @param get Function to get a std::vector of the things being edited.
@@ -77,7 +84,7 @@ public:
                std::function<std::vector<T> ()> get,
                std::function<void (std::vector<T>)> set,
                std::function<std::string (T, int)> column,
-               bool title,
+               EditableListTitle title,
                int buttons
                )
                : wxPanel (parent)
@@ -91,7 +98,7 @@ public:
                SetSizer (_sizer);
 
                long style = wxLC_REPORT | wxLC_SINGLE_SEL;
-               if (!title) {
+               if (title == EditableListTitle::INVISIBLE) {
                        style |= wxLC_NO_HEADER;
                }
 
index 8a8a37f0a89fe7cc84026ae97297d5de7119f06e..de11825f4e46db11ee91e60adf644d2c63973ed7 100644 (file)
@@ -48,7 +48,7 @@ ExtraKDMEmailDialog::ExtraKDMEmailDialog (wxWindow* parent, vector<string> email
        _email_list = new EditableList<string, EmailDialog> (
                this, columns, bind(&ExtraKDMEmailDialog::get, this), bind(&ExtraKDMEmailDialog::set, this, _1), [](string s, int) {
                        return s;
-               }, false, EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
+               }, EditableListTitle::INVISIBLE, EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
                );
 
        sizer->Add (_email_list, wxGBPosition(r, 0), wxGBSpan(1, 2), wxEXPAND);
index 0f99d85d806d917ee51d5e29ad89f25367292fc8..40cb0c2853dbdda295c3ab85c54f5b950dbcfe37 100644 (file)
@@ -633,7 +633,7 @@ private:
                        boost::bind (&Config::servers, Config::instance()),
                        boost::bind (&Config::set_servers, Config::instance(), _1),
                        boost::bind (&EncodingServersPage::server_column, this, _1),
-                       false,
+                       EditableListTitle::INVISIBLE,
                        EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
                        );
 
@@ -991,7 +991,7 @@ private:
                        [] (string s, int) {
                                return s;
                        },
-                       true,
+                       EditableListTitle::VISIBLE,
                        EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
                        );
                table->Add (_cc, 1, wxEXPAND | wxALL);
@@ -1128,7 +1128,7 @@ private:
                        [] (string s, int) {
                                return s;
                        },
-                       true,
+                       EditableListTitle::VISIBLE,
                        EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
                        );
                table->Add (_cc, 1, wxEXPAND | wxALL);
index b1c58a27e96616b0c4a92a80046a7e96263bc494..7e0d304f86f9541dfb7b62495f446e86de314a94 100644 (file)
@@ -207,7 +207,7 @@ MetadataDialog::setup_standard (wxPanel* panel, wxSizer* sizer)
                        }
                        return r.label;
                },
-               true,
+               EditableListTitle::VISIBLE,
                EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
                );
        _ratings->SetMinSize(wxSize(600, -1));
index 66b7f0e19bd24110c1e3bc65092f9ff64bbfb09f..688dcafbdc15d304f3a3568938201ba656ada735 100644 (file)
@@ -91,7 +91,8 @@ RecipientDialog::RecipientDialog (
        columns.push_back (EditableListColumn(_("Address")));
        _email_list = new EditableList<string, EmailDialog> (
                this, columns, bind(&RecipientDialog::get_emails, this), bind(&RecipientDialog::set_emails, this, _1), bind(&column, _1),
-               EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE, true
+               EditableListTitle::VISIBLE,
+               EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
                );
 
        _sizer->Add (_email_list, wxGBPosition (r, 0), wxGBSpan (1, 2), wxEXPAND);
index 58ea8a3285119a184a2d9441a30a081c25bd44d6..38e6a85bfff392c885a6c9d0869cfe664480484a 100644 (file)
@@ -178,8 +178,8 @@ ScreenDialog::ScreenDialog (
                [] (TrustedDevice const& d, int) {
                        return d.thumbprint();
                },
-               EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE,
-               false
+               EditableListTitle::INVISIBLE,
+               EditableListButton::NEW | EditableListButton::EDIT | EditableListButton::REMOVE
                );
 
        _sizer->Add (_trusted_device_list, wxGBPosition (r, 0), wxGBSpan (1, 3), wxEXPAND);
index a31b9ad765973f3c8ad81792be370b2d91ea484a..afcbfafce6619d41f5d814c61393d66a6bae19b1 100644 (file)
@@ -112,8 +112,8 @@ SMPTEMetadataDialog::setup_advanced (wxPanel* panel, wxSizer* sizer)
                boost::bind(&SMPTEMetadataDialog::content_versions, this),
                boost::bind(&SMPTEMetadataDialog::set_content_versions, this, _1),
                boost::bind(&content_versions_column, _1, _2),
-               true,
-               false
+               EditableListTitle::INVISIBLE,
+               EditableListButton::NEW | EditableListButton::REMOVE
                );
        sizer->Add (_content_versions, 1, wxEXPAND);
 }