X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ffilter_dialog.cc;h=f9ba06eae9b752ff7e98855ed6e55e907b4617f2;hb=HEAD;hp=6f479e5466c68f58783104a73ee4a529693e41f1;hpb=0f13efdcc1a1994085b20940a2b9657a3f99bfcf;p=dcpomatic.git diff --git a/src/wx/filter_dialog.cc b/src/wx/filter_dialog.cc index 6f479e546..517978c74 100644 --- a/src/wx/filter_dialog.cc +++ b/src/wx/filter_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,74 +18,72 @@ */ + /** @file src/filter_dialog.cc * @brief A dialog to select FFmpeg filters. */ + #include "check_box.h" #include "filter_dialog.h" #include "static_text.h" #include "wx_util.h" #include "lib/film.h" #include "lib/filter.h" -#include using namespace std; using boost::bind; -FilterDialog::FilterDialog (wxWindow* parent, vector const & active) +FilterDialog::FilterDialog(wxWindow* parent, vector const& active) : wxDialog (parent, wxID_ANY, wxString(_("Filters"))) { - wxPanel* panel = new wxPanel (this); - wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL); + auto panel = new wxPanel (this); + auto sizer = new wxBoxSizer (wxVERTICAL); - vector filters = Filter::all (); + auto filters = Filter::all (); - typedef map > CategoryMap; - CategoryMap categories; + map> categories; - BOOST_FOREACH (Filter const* i, filters) { - CategoryMap::iterator j = categories.find (i->category()); + for (auto i: filters) { + auto j = categories.find(i.category()); if (j == categories.end ()) { - list c; - c.push_back (i); - categories[i->category()] = c; + categories[i.category()] = { i }; } else { j->second.push_back (i); } } - for (CategoryMap::iterator i = categories.begin(); i != categories.end(); ++i) { - - wxStaticText* c = new StaticText (panel, std_to_wx(i->first)); - wxFont font = c->GetFont(); + for (auto const& category: categories) { + auto c = new StaticText(panel, std_to_wx(category.first)); + auto font = c->GetFont(); font.SetWeight(wxFONTWEIGHT_BOLD); c->SetFont(font); sizer->Add (c, 1, wxTOP | wxBOTTOM, DCPOMATIC_SIZER_GAP); - BOOST_FOREACH (Filter const* j, i->second) { - wxCheckBox* b = new CheckBox(panel, std_to_wx(j->name())); - bool const a = find (active.begin(), active.end(), j) != active.end(); + for (auto const& filter: category.second) { + auto b = new CheckBox(panel, std_to_wx(filter.name())); + bool const a = find(active.begin(), active.end(), filter) != active.end(); b->SetValue (a); - _filters[j] = b; - b->Bind (wxEVT_CHECKBOX, boost::bind(&FilterDialog::filter_toggled, this)); + _filters[filter] = b; + b->bind(&FilterDialog::filter_toggled, this); sizer->Add (b); } sizer->AddSpacer (6); } - wxSizer* buttons = CreateSeparatedButtonSizer (wxOK); - if (buttons) { - sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); - } - panel->SetSizer (sizer); - wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); + auto overall_sizer = new wxBoxSizer (wxVERTICAL); overall_sizer->Add (panel, 1, wxTOP | wxLEFT | wxRIGHT, DCPOMATIC_SIZER_GAP); + + auto buttons = CreateSeparatedButtonSizer(wxOK); + if (buttons) { + overall_sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder()); + } + SetSizerAndFit (overall_sizer); } @@ -97,13 +95,13 @@ FilterDialog::filter_toggled () } -vector +vector FilterDialog::active () const { - vector active; - for (map::const_iterator i = _filters.begin(); i != _filters.end(); ++i) { - if (i->second->IsChecked()) { - active.push_back(i->first); + vector active; + for (auto const& i: _filters) { + if (i.second->IsChecked()) { + active.push_back(i.first); } }