summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-07-26 01:51:55 +0100
committerCarl Hetherington <cth@carlh.net>2012-07-26 01:51:55 +0100
commit5fa99824e1bf31f569245e5f2640aeecd84de42d (patch)
tree0838decd7808e2c959bbdde376296b79493f5f52 /src
parent02d9138d94899fa16b4a16ebc730fd929bf72b1d (diff)
Port filters dialog. Make command line loading work again.
Diffstat (limited to 'src')
-rw-r--r--src/tools/dvdomatic.cc33
-rw-r--r--src/wx/config_dialog.cc9
-rw-r--r--src/wx/film_editor.cc84
-rw-r--r--src/wx/film_editor.h2
-rw-r--r--src/wx/filter_dialog.cc23
-rw-r--r--src/wx/filter_dialog.h10
-rw-r--r--src/wx/filter_view.cc35
-rw-r--r--src/wx/filter_view.h18
-rw-r--r--src/wx/wscript6
9 files changed, 113 insertions, 107 deletions
diff --git a/src/tools/dvdomatic.cc b/src/tools/dvdomatic.cc
index ae94a949a..ab687c955 100644
--- a/src/tools/dvdomatic.cc
+++ b/src/tools/dvdomatic.cc
@@ -21,6 +21,7 @@
#include <boost/filesystem.hpp>
#include <wx/aboutdlg.h>
#include <wx/stdpaths.h>
+#include <wx/cmdline.h>
#include "wx/film_viewer.h"
#include "wx/film_editor.h"
#include "wx/job_manager_view.h"
@@ -223,10 +224,18 @@ public:
} else {
file_changed ("");
}
+
+ set_film ();
+ }
+
+ void set_film ()
+ {
+ film_viewer->set_film (film);
+ film_editor->set_film (film);
+ set_menu_sensitivity ();
}
- void
- file_changed (string f)
+ void file_changed (string f)
{
stringstream s;
s << "DVD-o-matic";
@@ -250,10 +259,8 @@ public:
film->set_name (filesystem::path (wx_to_std (c->GetPath())).filename().generic_string());
#else
film->set_name (filesystem::path (wx_to_std (c->GetPath())).filename());
-#endif
- film_viewer->set_film (film);
- film_editor->set_film (film);
- set_menu_sensitivity ();
+#endif
+ set_film ();
}
}
@@ -266,9 +273,7 @@ public:
if (r == wxID_OK) {
maybe_save_then_delete_film ();
film = new Film (wx_to_std (c->GetPath ()));
- film_viewer->set_film (film);
- film_editor->set_film (film);
- set_menu_sensitivity ();
+ set_film ();
}
}
@@ -345,17 +350,13 @@ class App : public wxApp
{
bool OnInit ()
{
- if (!wxApp::OnInit ()) {
- return false;
- }
-
wxInitAllImageHandlers ();
dvdomatic_setup ();
-// if (argc == 2 && boost::filesystem::is_directory (argv[1])) {
-// film = new Film (argv[1]);
-// }
+ if (argc == 2 && boost::filesystem::is_directory (wx_to_std (argv[1]))) {
+ film = new Film (wx_to_std (argv[1]));
+ }
Frame* f = new Frame (_("DVD-o-matic"));
SetTopWindow (f);
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index 34282895d..2ff016a20 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -31,7 +31,7 @@
#include "lib/filter.h"
#include "config_dialog.h"
#include "wx_util.h"
-//#include "filter_dialog.h"
+#include "filter_dialog.h"
using namespace std;
using namespace boost;
@@ -264,9 +264,10 @@ ConfigDialog::reference_scaler_changed (wxCommandEvent &)
void
ConfigDialog::edit_reference_filters_clicked (wxCommandEvent &)
{
-// FilterDialog d (Config::instance()->reference_filters ());
-// d.ActiveChanged.connect (sigc::mem_fun (*this, &ConfigDialog::reference_filters_changed));
-// d.run ();
+ FilterDialog* d = new FilterDialog (this, Config::instance()->reference_filters ());
+ d->ActiveChanged.connect (sigc::mem_fun (*this, &ConfigDialog::reference_filters_changed));
+ d->ShowModal ();
+ d->Destroy ();
}
void
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index 385bc4110..62acbfb70 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -37,7 +37,7 @@
#include "lib/filter.h"
#include "lib/screen.h"
#include "lib/config.h"
-//#include "filter_dialog.h"
+#include "filter_dialog.h"
#include "wx_util.h"
#include "film_editor.h"
//#include "dcp_range_dialog.h"
@@ -51,27 +51,27 @@ FilmEditor::FilmEditor (Film* f, wxWindow* parent)
, _ignore_changes (false)
, _film (f)
{
- wxSizer* sizer = new wxFlexGridSizer (2, 6, 6);
- SetSizer (sizer);
+ _sizer = new wxFlexGridSizer (2, 6, 6);
+ SetSizer (_sizer);
- add_label_to_sizer (sizer, this, "Name");
+ add_label_to_sizer (_sizer, this, "Name");
_name = new wxTextCtrl (this, wxID_ANY);
- sizer->Add (_name, 1, wxEXPAND);
+ _sizer->Add (_name, 1, wxEXPAND);
- add_label_to_sizer (sizer, this, "Content");
+ add_label_to_sizer (_sizer, this, "Content");
_content = new wxFilePickerCtrl (this, wxID_ANY, wxT (""), wxT ("Select Content File"), wxT("*.*"));
- sizer->Add (_content, 1, wxEXPAND);
+ _sizer->Add (_content, 1, wxEXPAND);
- add_label_to_sizer (sizer, this, "Content Type");
+ add_label_to_sizer (_sizer, this, "Content Type");
_dcp_content_type = new wxComboBox (this, wxID_ANY);
- sizer->Add (_dcp_content_type);
+ _sizer->Add (_dcp_content_type);
- add_label_to_sizer (sizer, this, "Format");
+ add_label_to_sizer (_sizer, this, "Format");
_format = new wxComboBox (this, wxID_ANY);
- sizer->Add (_format);
+ _sizer->Add (_format);
{
- add_label_to_sizer (sizer, this, "Crop");
+ add_label_to_sizer (_sizer, this, "Crop");
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
add_label_to_sizer (s, this, "L");
@@ -87,78 +87,78 @@ FilmEditor::FilmEditor (Film* f, wxWindow* parent)
_bottom_crop = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
s->Add (_bottom_crop, 0);
- sizer->Add (s);
+ _sizer->Add (s);
}
/* VIDEO-only stuff */
{
- video_control (add_label_to_sizer (sizer, this, "Filters"));
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ video_control (add_label_to_sizer (_sizer, this, "Filters"));
+ wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
_filters = new wxStaticText (this, wxID_ANY, wxT (""));
- s->Add (_filters, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6);
+ s->Add (_filters, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
_filters_button = new wxButton (this, wxID_ANY, wxT ("Edit..."));
s->Add (_filters_button, 0);
- sizer->Add (s, 1);
+ _sizer->Add (s, 1);
}
- video_control (add_label_to_sizer (sizer, this, "Scaler"));
+ video_control (add_label_to_sizer (_sizer, this, "Scaler"));
_scaler = new wxComboBox (this, wxID_ANY);
- sizer->Add (video_control (_scaler), 1);
+ _sizer->Add (video_control (_scaler), 1);
{
- video_control (add_label_to_sizer (sizer, this, "Audio Gain"));
+ video_control (add_label_to_sizer (_sizer, this, "Audio Gain"));
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
_audio_gain = new wxSpinCtrl (this);
s->Add (video_control (_audio_gain), 1);
video_control (add_label_to_sizer (s, this, "dB"));
- sizer->Add (s);
+ _sizer->Add (s);
}
{
- video_control (add_label_to_sizer (sizer, this, "Audio Delay"));
+ video_control (add_label_to_sizer (_sizer, this, "Audio Delay"));
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
_audio_delay = new wxSpinCtrl (this);
s->Add (video_control (_audio_delay), 1);
video_control (add_label_to_sizer (s, this, "ms"));
- sizer->Add (s);
+ _sizer->Add (s);
}
- video_control (add_label_to_sizer (sizer, this, "Frames Per Second"));
+ video_control (add_label_to_sizer (_sizer, this, "Frames Per Second"));
_frames_per_second = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator (wxFILTER_NUMERIC));
- sizer->Add (video_control (_frames_per_second));
+ _sizer->Add (video_control (_frames_per_second));
- video_control (add_label_to_sizer (sizer, this, "Original Size"));
+ video_control (add_label_to_sizer (_sizer, this, "Original Size"));
_original_size = new wxStaticText (this, wxID_ANY, wxT (""));
- sizer->Add (video_control (_original_size), 1, wxALIGN_CENTER_VERTICAL);
+ _sizer->Add (video_control (_original_size), 1, wxALIGN_CENTER_VERTICAL);
- video_control (add_label_to_sizer (sizer, this, "Length"));
+ video_control (add_label_to_sizer (_sizer, this, "Length"));
_length = new wxStaticText (this, wxID_ANY, wxT (""));
- sizer->Add (video_control (_length), 1, wxALIGN_CENTER_VERTICAL);
+ _sizer->Add (video_control (_length), 1, wxALIGN_CENTER_VERTICAL);
- video_control (add_label_to_sizer (sizer, this, "Audio"));
+ video_control (add_label_to_sizer (_sizer, this, "Audio"));
_audio = new wxStaticText (this, wxID_ANY, wxT (""));
- sizer->Add (video_control (_audio), 1, wxALIGN_CENTER_VERTICAL);
+ _sizer->Add (video_control (_audio), 1, wxALIGN_CENTER_VERTICAL);
{
- video_control (add_label_to_sizer (sizer, this, "Range"));
+ video_control (add_label_to_sizer (_sizer, this, "Range"));
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
_dcp_range = new wxStaticText (this, wxID_ANY, wxT (""));
s->Add (video_control (_dcp_range), 1, wxALIGN_CENTER_VERTICAL);
_change_dcp_range_button = new wxButton (this, wxID_ANY, wxT ("Edit..."));
s->Add (video_control (_change_dcp_range_button));
- sizer->Add (s);
+ _sizer->Add (s);
}
_dcp_ab = new wxCheckBox (this, wxID_ANY, wxT ("A/B"));
video_control (_dcp_ab);
- sizer->Add (_dcp_ab, 1);
- sizer->AddSpacer (0);
+ _sizer->Add (_dcp_ab, 1);
+ _sizer->AddSpacer (0);
/* STILL-only stuff */
- still_control (add_label_to_sizer (sizer, this, "Duration"));
+ still_control (add_label_to_sizer (_sizer, this, "Duration"));
_still_duration = new wxSpinCtrl (this);
- sizer->Add (still_control (_still_duration));
- still_control (add_label_to_sizer (sizer, this, "s"));
+ _sizer->Add (still_control (_still_duration));
+ still_control (add_label_to_sizer (_sizer, this, "s"));
/* Set up our editing widgets */
@@ -347,6 +347,7 @@ FilmEditor::film_changed (Film::Property p)
pair<string, string> p = Filter::ffmpeg_strings (_film->filters ());
string const b = p.first + " " + p.second;
_filters->SetLabel (std_to_wx (b));
+ _sizer->Layout ();
break;
}
case Film::NAME:
@@ -520,9 +521,10 @@ FilmEditor::set_things_sensitive (bool s)
void
FilmEditor::edit_filters_clicked (wxCommandEvent &)
{
-// FilterDialog d (_film->filters ());
-// d.ActiveChanged.connect (sigc::mem_fun (*_film, &Film::set_filters));
-// d.run ();
+ FilterDialog* d = new FilterDialog (this, _film->filters ());
+ d->ActiveChanged.connect (sigc::mem_fun (*_film, &Film::set_filters));
+ d->ShowModal ();
+ d->Destroy ();
}
/** Called when the scaler widget has been changed */
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index e73508092..bd6170a83 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -122,4 +122,6 @@ private:
std::list<wxControl*> _video_controls;
std::list<wxControl*> _still_controls;
+
+ wxSizer* _sizer;
};
diff --git a/src/wx/filter_dialog.cc b/src/wx/filter_dialog.cc
index e52efb68b..bd8448452 100644
--- a/src/wx/filter_dialog.cc
+++ b/src/wx/filter_dialog.cc
@@ -23,25 +23,32 @@
#include "lib/film.h"
#include "filter_dialog.h"
+#include "filter_view.h"
using namespace std;
-FilterDialog::FilterDialog (vector<Filter const *> const & f)
- : Gtk::Dialog ("Filters")
- , _filters (f)
+FilterDialog::FilterDialog (wxWindow* parent, vector<Filter const *> const & f)
+ : wxDialog (parent, wxID_ANY, _("Filters"))
+ , _filters (new FilterView (this, f))
{
- get_vbox()->pack_start (_filters.widget ());
+ wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+ sizer->Add (_filters, 1, wxEXPAND);
- _filters.ActiveChanged.connect (sigc::mem_fun (*this, &FilterDialog::active_changed));
+ _filters->ActiveChanged.connect (sigc::mem_fun (*this, &FilterDialog::active_changed));
- add_button ("Close", Gtk::RESPONSE_CLOSE);
+ wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
+ if (buttons) {
+ sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
+ }
- show_all ();
+ SetSizer (sizer);
+ sizer->Layout ();
+ sizer->SetSizeHints (this);
}
void
FilterDialog::active_changed ()
{
- ActiveChanged (_filters.active ());
+ ActiveChanged (_filters->active ());
}
diff --git a/src/wx/filter_dialog.h b/src/wx/filter_dialog.h
index 84c6e2966..882d740cb 100644
--- a/src/wx/filter_dialog.h
+++ b/src/wx/filter_dialog.h
@@ -21,23 +21,23 @@
* @brief A dialog to select FFmpeg filters.
*/
-#include <gtkmm.h>
-#include "filter_view.h"
+#include <wx/wx.h>
class Film;
+class FilterView;
/** @class FilterDialog
* @brief A dialog to select FFmpeg filters.
*/
-class FilterDialog : public Gtk::Dialog
+class FilterDialog : public wxDialog
{
public:
- FilterDialog (std::vector<Filter const *> const &);
+ FilterDialog (wxWindow *, std::vector<Filter const *> const &);
sigc::signal1<void, std::vector<Filter const *> > ActiveChanged;
private:
void active_changed ();
- FilterView _filters;
+ FilterView* _filters;
};
diff --git a/src/wx/filter_view.cc b/src/wx/filter_view.cc
index f686c204d..8d9535d81 100644
--- a/src/wx/filter_view.cc
+++ b/src/wx/filter_view.cc
@@ -18,43 +18,38 @@
*/
/** @file src/filter_view.cc
- * @brief A widget to select FFmpeg filters.
+ * @brief A panel to select FFmpeg filters.
*/
#include <iostream>
+#include <algorithm>
#include "lib/filter.h"
#include "filter_view.h"
+#include "wx_util.h"
using namespace std;
-FilterView::FilterView (vector<Filter const *> const & active)
+FilterView::FilterView (wxWindow* parent, vector<Filter const *> const & active)
+ : wxPanel (parent)
{
- _box.set_spacing (4);
+ wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+ SetSizer (sizer);
vector<Filter const *> filters = Filter::all ();
for (vector<Filter const *>::iterator i = filters.begin(); i != filters.end(); ++i) {
- Gtk::CheckButton* b = Gtk::manage (new Gtk::CheckButton ((*i)->name()));
+ wxCheckBox* b = new wxCheckBox (this, wxID_ANY, std_to_wx ((*i)->name ()));
bool const a = find (active.begin(), active.end(), *i) != active.end ();
- b->set_active (a);
- _filters[*i] = a;
- b->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &FilterView::filter_toggled), *i));
- _box.pack_start (*b, false, false);
+ b->SetValue (a);
+ _filters[*i] = b;
+ b->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilterView::filter_toggled), 0, this);
+ sizer->Add (b);
}
-
- _box.show_all ();
-}
-
-Gtk::Widget &
-FilterView::widget ()
-{
- return _box;
}
void
-FilterView::filter_toggled (Filter const * f)
+FilterView::filter_toggled (wxCommandEvent &)
{
- _filters[f] = !_filters[f];
ActiveChanged ();
}
@@ -62,8 +57,8 @@ vector<Filter const*>
FilterView::active () const
{
vector<Filter const *> active;
- for (map<Filter const *, bool>::const_iterator i = _filters.begin(); i != _filters.end(); ++i) {
- if (i->second) {
+ for (map<Filter const *, wxCheckBox*>::const_iterator i = _filters.begin(); i != _filters.end(); ++i) {
+ if (i->second->IsChecked ()) {
active.push_back (i->first);
}
}
diff --git a/src/wx/filter_view.h b/src/wx/filter_view.h
index 0c96b0e14..770b55da6 100644
--- a/src/wx/filter_view.h
+++ b/src/wx/filter_view.h
@@ -18,30 +18,30 @@
*/
/** @file src/filter_view.h
- * @brief A widget to select FFmpeg filters.
+ * @brief A panel to select FFmpeg filters.
*/
-#include <gtkmm.h>
#include <vector>
+#include <map>
+#include <sigc++/sigc++.h>
+#include <wx/wx.h>
class Filter;
/** @class FilterView
- * @brief A widget to select FFmpeg filters.
+ * @brief A panel to select FFmpeg filters.
*/
-class FilterView
+class FilterView : public wxPanel
{
public:
- FilterView (std::vector<Filter const *> const &);
+ FilterView (wxWindow *, std::vector<Filter const *> const &);
- Gtk::Widget & widget ();
std::vector<Filter const *> active () const;
sigc::signal0<void> ActiveChanged;
private:
- void filter_toggled (Filter const *);
+ void filter_toggled (wxCommandEvent &);
- Gtk::VBox _box;
- std::map<Filter const *, bool> _filters;
+ std::map<Filter const *, wxCheckBox *> _filters;
};
diff --git a/src/wx/wscript b/src/wx/wscript
index e7e988c60..a4227ccd8 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -15,15 +15,13 @@ def build(bld):
job_manager_view.cc
job_wrapper.cc
config_dialog.cc
+ filter_dialog.cc
+ filter_view.cc
"""
# alignment.cc
# dcp_range_dialog.cc
-# film_editor.cc
# film_list.cc
-# filter_dialog.cc
-# filter_view.cc
-# gpl.cc
# dvd_title_dialog.cc
if not bld.env.DISABLE_PLAYER: