2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /** @file src/filter_view.cc
21 * @brief A widget to select FFmpeg filters.
25 #include "lib/filter.h"
26 #include "filter_view.h"
30 FilterView::FilterView (vector<Filter const *> const & active)
34 vector<Filter const *> filters = Filter::all ();
36 for (vector<Filter const *>::iterator i = filters.begin(); i != filters.end(); ++i) {
37 Gtk::CheckButton* b = Gtk::manage (new Gtk::CheckButton ((*i)->name()));
38 bool const a = find (active.begin(), active.end(), *i) != active.end ();
41 b->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &FilterView::filter_toggled), *i));
42 _box.pack_start (*b, false, false);
55 FilterView::filter_toggled (Filter const * f)
57 _filters[f] = !_filters[f];
62 FilterView::active () const
64 vector<Filter const *> active;
65 for (map<Filter const *, bool>::const_iterator i = _filters.begin(); i != _filters.end(); ++i) {
67 active.push_back (i->first);