/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
/** @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 <boost/foreach.hpp>
using namespace std;
FilterDialog::FilterDialog (wxWindow* parent, vector<Filter const *> 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<Filter const *> filters = Filter::all ();
+ auto filters = Filter::all ();
- typedef map<string, list<Filter const *> > CategoryMap;
- CategoryMap categories;
+ map<string, list<Filter const *>> 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<Filter const *> 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& i: categories) {
+ auto c = new StaticText (panel, std_to_wx(i.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()));
+ for (auto j: i.second) {
+ auto b = new CheckBox(panel, std_to_wx(j->name()));
bool const a = find (active.begin(), active.end(), j) != active.end();
b->SetValue (a);
_filters[j] = b;
sizer->AddSpacer (6);
}
- wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
+ auto 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);
SetSizerAndFit (overall_sizer);
}
FilterDialog::active () const
{
vector<Filter const *> active;
- for (map<Filter const *, wxCheckBox*>::const_iterator i = _filters.begin(); i != _filters.end(); ++i) {
- if (i->second->IsChecked()) {
- active.push_back(i->first);
+ for (auto const& i: _filters) {
+ if (i.second->IsChecked()) {
+ active.push_back(i.first);
}
}