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 panel to select FFmpeg filters.
26 #include "lib/filter.h"
27 #include "filter_view.h"
32 FilterView::FilterView (wxWindow* parent, vector<Filter const *> const & active)
35 wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
38 vector<Filter const *> filters = Filter::all ();
40 for (vector<Filter const *>::iterator i = filters.begin(); i != filters.end(); ++i) {
41 wxCheckBox* b = new wxCheckBox (this, wxID_ANY, std_to_wx ((*i)->name ()));
42 bool const a = find (active.begin(), active.end(), *i) != active.end ();
45 b->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilterView::filter_toggled), 0, this);
51 FilterView::filter_toggled (wxCommandEvent &)
57 FilterView::active () const
59 vector<Filter const *> active;
60 for (map<Filter const *, wxCheckBox*>::const_iterator i = _filters.begin(); i != _filters.end(); ++i) {
61 if (i->second->IsChecked ()) {
62 active.push_back (i->first);