summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-07-25 03:22:16 +0100
committerCarl Hetherington <cth@carlh.net>2012-07-25 03:22:16 +0100
commit3d4faebe28da789a9083e6a2cc0b345df6c17306 (patch)
tree0cb0cd06c838a541ae0261a3efa6caa9e4f2b919 /src
parent26b9ae1e7700b545df4b5445a7efba412c2cbb68 (diff)
Some vague sort of progress.
Diffstat (limited to 'src')
-rw-r--r--src/lib/util.cc4
-rw-r--r--src/tools/dvdomatic.cc167
-rw-r--r--src/tools/wscript7
-rw-r--r--src/wscript2
-rw-r--r--src/wx/film_editor.cc548
-rw-r--r--src/wx/film_editor.h123
-rw-r--r--src/wx/film_viewer.cc113
-rw-r--r--src/wx/film_viewer.h36
-rw-r--r--src/wx/wscript36
-rw-r--r--src/wx/wx_util.cc (renamed from src/wx/gtk_util.cc)20
-rw-r--r--src/wx/wx_util.h (renamed from src/wx/gtk_util.h)7
-rw-r--r--src/wx2/dvdomatic.cc76
-rw-r--r--src/wx2/film_editor.cc8
-rw-r--r--src/wx2/film_editor.h12
-rw-r--r--src/wx2/film_viewer.cc73
-rw-r--r--src/wx2/film_viewer.h21
-rw-r--r--src/wx2/wscript16
17 files changed, 814 insertions, 455 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 799d0e54e..450ba5b8e 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -56,7 +56,9 @@ extern "C" {
#include "filter.h"
#include "screen.h"
#include "film_state.h"
+#ifndef DVDOMATIC_DISABLE_PLAYER
#include "player_manager.h"
+#endif
#ifdef DEBUG_HASH
#include <mhash.h>
@@ -398,7 +400,9 @@ SocketReader::read_indefinite (uint8_t* data, int size)
void
sigchld_handler (int, siginfo_t* info, void *)
{
+#ifndef DVDOMATIC_DISABLE_PLAYER
PlayerManager::instance()->child_exited (info->si_pid);
+#endif
}
#endif
diff --git a/src/tools/dvdomatic.cc b/src/tools/dvdomatic.cc
index 9cca61eff..8fe447da5 100644
--- a/src/tools/dvdomatic.cc
+++ b/src/tools/dvdomatic.cc
@@ -19,17 +19,17 @@
#include <iostream>
#include <boost/filesystem.hpp>
-#include "gtk/film_viewer.h"
-#include "gtk/film_editor.h"
+#include "wx/film_viewer.h"
+#include "wx/film_editor.h"
#ifndef DVDOMATIC_DISABLE_PLAYER
-#include "gtk/film_player.h"
+#include "wx/film_player.h"
#endif
-#include "gtk/job_manager_view.h"
-#include "gtk/config_dialog.h"
-#include "gtk/gpl.h"
-#include "gtk/job_wrapper.h"
-#include "gtk/dvd_title_dialog.h"
-#include "gtk/gtk_util.h"
+//#include "gtk/job_manager_view.h"
+//#include "gtk/config_dialog.h"
+//#include "gtk/gpl.h"
+//#include "gtk/job_wrapper.h"
+//#include "gtk/dvd_title_dialog.h"
+//#include "gtk/gtk_util.h"
#include "lib/film.h"
#include "lib/format.h"
#include "lib/config.h"
@@ -41,9 +41,12 @@
using namespace std;
using namespace boost;
-static Gtk::Window* window = 0;
-static FilmViewer* film_viewer = 0;
static FilmEditor* film_editor = 0;
+static FilmViewer* film_viewer = 0;
+
+#if 0
+
+static Gtk::Window* window = 0;
#ifndef DVDOMATIC_DISABLE_PLAYER
static FilmPlayer* film_player = 0;
#endif
@@ -312,76 +315,102 @@ file_changed (string f)
window->set_title (s.str ());
}
-int
-main (int argc, char* argv[])
-{
- dvdomatic_setup ();
-
- Gtk::Main kit (argc, argv);
+#endif
- if (argc == 2 && boost::filesystem::is_directory (argv[1])) {
- film = new Film (argv[1]);
- }
- window = new Gtk::Window ();
- window->signal_delete_event().connect (sigc::ptr_fun (window_closed));
-
- film_viewer = new FilmViewer (film);
- film_editor = new FilmEditor (film);
-#ifndef DVDOMATIC_DISABLE_PLAYER
- film_player = new FilmPlayer (film);
-#endif
- JobManagerView jobs_view;
+enum {
+ ID_Quit = 1,
+};
- window->set_title ("DVD-o-matic");
+class Frame : public wxFrame
+{
+public:
+ Frame (wxString const & title)
+ : wxFrame (NULL, -1, title)
+ {
+ wxMenuBar* bar = new wxMenuBar;
+ bar->Show (true);
+
+ wxMenu *menu_file = new wxMenu;
+ menu_file->Append (ID_Quit, _("&Quit"));
- Gtk::VBox vbox;
+ bar->Append (menu_file, _("&File"));
- Gtk::MenuBar menu_bar;
- vbox.pack_start (menu_bar, false, false);
- setup_menu (menu_bar);
- set_menu_sensitivity ();
+ SetMenuBar (bar);
- Gtk::HBox hbox;
- hbox.set_spacing (12);
+ CreateStatusBar ();
+ SetStatusText (_("Welcome to DVD-o-matic!"));
+ }
+
+ void quit (wxCommandEvent& event)
+ {
+ Close (true);
+ }
+};
- Gtk::VBox left_vbox;
- left_vbox.set_spacing (12);
- left_vbox.pack_start (film_editor->widget (), false, false);
-#ifndef DVDOMATIC_DISABLE_PLAYER
- left_vbox.pack_start (film_player->widget (), false, false);
-#endif
- hbox.pack_start (left_vbox, false, false);
+class App : public wxApp
+{
+ bool OnInit ()
+ {
+ if (!wxApp::OnInit ()) {
+ return false;
+ }
- Gtk::VBox right_vbox;
- right_vbox.pack_start (film_viewer->widget (), true, true);
- right_vbox.pack_start (jobs_view.widget(), false, false);
- hbox.pack_start (right_vbox, true, true);
+ wxInitAllImageHandlers ();
+
+ dvdomatic_setup ();
+
+// if (argc == 2 && boost::filesystem::is_directory (argv[1])) {
+// film = new Film (argv[1]);
+// }
+
+ Film* film = new Film ("/home/carl/DCP/BitHarvest");
+
+ Frame* frame = new Frame (_("DVD-o-matic"));
+ frame->Show (true);
+
+ frame->Connect (
+ ID_Quit, wxEVT_COMMAND_MENU_SELECTED,
+ (wxObjectEventFunction) &Frame::quit
+ );
+
+ film_editor = new FilmEditor (film, frame);
+ film_editor->Show (true);
+ film_viewer = new FilmViewer (film, frame);
+ film_viewer->Show (true);
+#ifndef DVDOMATIC_DISABLE_PLAYER
+ film_player = new FilmPlayer (film, frame);
+#endif
- vbox.pack_start (hbox, true, true);
+ wxBoxSizer* main_sizer = new wxBoxSizer (wxHORIZONTAL);
+ main_sizer->Add (film_editor, 0);
+ main_sizer->Add (film_viewer, 1, wxEXPAND);
+ frame->SetSizer (main_sizer);
- window->add (vbox);
- window->show_all ();
+ SetTopWindow (frame);
+ frame->Maximize ();
- /* XXX: calling these here is a bit of a hack */
- film_editor->setup_visibility ();
+#if 0
+ /* XXX: calling these here is a bit of a hack */
+ film_editor->setup_visibility ();
#ifndef DVDOMATIC_DISABLE_PLAYER
- film_player->setup_visibility ();
+ film_player->setup_visibility ();
#endif
- film_viewer->setup_visibility ();
-
- film_editor->FileChanged.connect (ptr_fun (file_changed));
- if (film) {
- file_changed (film->directory ());
- } else {
- file_changed ("");
+ film_viewer->setup_visibility ();
+
+ film_editor->FileChanged.connect (ptr_fun (file_changed));
+ if (film) {
+ file_changed (film->directory ());
+ } else {
+ file_changed ("");
+ }
+#endif
+
+ /* XXX this should be in JobManagerView, shouldn't it? */
+//XXX Glib::signal_timeout().connect (sigc::bind_return (sigc::mem_fun (jobs_view, &JobManagerView::update), true), 1000);
+
+ return true;
}
+};
- /* XXX this should be in JobManagerView, shouldn't it? */
- Glib::signal_timeout().connect (sigc::bind_return (sigc::mem_fun (jobs_view, &JobManagerView::update), true), 1000);
-
- window->maximize ();
- Gtk::Main::run (*window);
-
- return 0;
-}
+IMPLEMENT_APP (App)
diff --git a/src/tools/wscript b/src/tools/wscript
index b3e523ba5..4c4979190 100644
--- a/src/tools/wscript
+++ b/src/tools/wscript
@@ -8,14 +8,15 @@ def build(bld):
obj.target = t
if not bld.env.DISABLE_GUI:
- p = ['dvdomatic', 'alignomatic']
+# p = ['dvdomatic', 'alignomatic']
+ p = ['dvdomatic']
if not bld.env.DISABLE_PLAYER:
p.append('playomatic')
for t in p:
obj = bld(features = 'cxx cxxprogram')
- obj.uselib = 'BOOST_THREAD GTKMM'
+ obj.uselib = 'BOOST_THREAD WXWIDGETS'
obj.includes = ['..']
- obj.use = ['libdvdomatic', 'libdvdomatic-gtk']
+ obj.use = ['libdvdomatic', 'libdvdomatic-wx']
obj.source = '%s.cc' % t
if bld.env.TARGET_WINDOWS:
obj.source += ' ../../windows/icon.rc'
diff --git a/src/wscript b/src/wscript
index 88b11de7a..2ebeba210 100644
--- a/src/wscript
+++ b/src/wscript
@@ -1,12 +1,10 @@
def configure(conf):
conf.recurse('lib')
if not conf.env.DISABLE_GUI:
- conf.recurse('gtk')
conf.recurse('wx')
def build(bld):
bld.recurse('lib')
bld.recurse('tools')
if not bld.env.DISABLE_GUI:
- bld.recurse('gtk')
bld.recurse('wx')
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index d46244082..5353eeb78 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -18,11 +18,11 @@
*/
/** @file src/film_editor.cc
- * @brief A GTK widget to edit a film's metadata, and perform various functions.
+ * @brief A wx widget to edit a film's metadata, and perform various functions.
*/
#include <iostream>
-#include <gtkmm.h>
+#include <wx/wx.h>
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
#include "lib/format.h"
@@ -35,256 +35,281 @@
#include "lib/filter.h"
#include "lib/screen.h"
#include "lib/config.h"
-#include "filter_dialog.h"
-#include "gtk_util.h"
+//#include "filter_dialog.h"
+#include "wx_util.h"
#include "film_editor.h"
-#include "dcp_range_dialog.h"
+//#include "dcp_range_dialog.h"
using namespace std;
using namespace boost;
-using namespace Gtk;
/** @param f Film to edit */
-FilmEditor::FilmEditor (Film* f)
- : _film (f)
- , _filters_button ("Edit...")
- , _change_dcp_range_button ("Edit...")
- , _dcp_ab ("A/B")
+FilmEditor::FilmEditor (Film* f, wxWindow* parent)
+ : wxPanel (parent)
+ , _film (f)
{
- _vbox.set_border_width (12);
- _vbox.set_spacing (12);
+ _name = new wxTextCtrl (this, wxID_ANY);
+ _frames_per_second = new wxSpinCtrl (this);
+ _format = new wxComboBox (this, wxID_ANY);
+// _content = new wxFileCtrl (this, wxID_ANY, wxT("*.*"), false);
+ _crop_panel = new wxPanel (this);
+ _left_crop = new wxSpinCtrl (_crop_panel);
+ _right_crop = new wxSpinCtrl (_crop_panel);
+ _top_crop = new wxSpinCtrl (_crop_panel);
+ _bottom_crop = new wxSpinCtrl (_crop_panel);
+ _filters = new wxStaticText (this, wxID_ANY, wxT (""));
+ _filters_button = new wxButton (this, wxID_ANY, wxT ("Edit..."));
+ _scaler = new wxComboBox (this, wxID_ANY);
+ _audio_gain = new wxSpinCtrl (this);
+ _audio_delay = new wxSpinCtrl (this);
+ _dcp_content_type = new wxComboBox (this, wxID_ANY);
+ _original_size = new wxStaticText (this, wxID_ANY, wxT (""));
+ _change_dcp_range_button = new wxButton (this, wxID_ANY, wxT ("Edit..."));
+ _dcp_ab = new wxCheckBox (this, wxID_ANY, wxT ("A/B"));
+
+//XXX _vbox.set_border_width (12);
+//XXX _vbox.set_spacing (12);
/* Set up our editing widgets */
- _left_crop.set_range (0, 1024);
- _left_crop.set_increments (1, 16);
- _top_crop.set_range (0, 1024);
- _top_crop.set_increments (1, 16);
- _right_crop.set_range (0, 1024);
- _right_crop.set_increments (1, 16);
- _bottom_crop.set_range (0, 1024);
- _bottom_crop.set_increments (1, 16);
- _filters.set_alignment (0, 0.5);
- _audio_gain.set_range (-60, 60);
- _audio_gain.set_increments (1, 3);
- _audio_delay.set_range (-1000, 1000);
- _audio_delay.set_increments (1, 20);
- _still_duration.set_range (0, 60 * 60);
- _still_duration.set_increments (1, 5);
- _dcp_range.set_alignment (0, 0.5);
+ _left_crop->SetRange (0, 1024);
+//XXX _left_crop.set_increments (1, 16);
+ _top_crop->SetRange (0, 1024);
+//XXX _top_crop.set_increments (1, 16);
+ _right_crop->SetRange (0, 1024);
+//XXX _right_crop.set_increments (1, 16);
+ _bottom_crop->SetRange (0, 1024);
+//XXX _bottom_crop.set_increments (1, 16);
+//XXX _filters.set_alignment (0, 0.5);
+ _audio_gain->SetRange (-60, 60);
+//XXX _audio_gain.set_increments (1, 3);
+ _audio_delay->SetRange (-1000, 1000);
+//XXX _audio_delay.set_increments (1, 20);
+ _still_duration = new wxSpinCtrl (this);
+ _still_duration->SetRange (0, 60 * 60);
+//XXX _still_duration.set_increments (1, 5);
+ _dcp_range = new wxStaticText (this, wxID_ANY, wxT (""));
+// _dcp_range.set_alignment (0, 0.5);
vector<Format const *> fmt = Format::all ();
for (vector<Format const *>::iterator i = fmt.begin(); i != fmt.end(); ++i) {
- _format.append_text ((*i)->name ());
+ _format->Append (wxString ((*i)->name().c_str(), wxConvUTF8));
}
- _frames_per_second.set_increments (1, 5);
- _frames_per_second.set_digits (2);
- _frames_per_second.set_range (0, 60);
+//XXX _frames_per_second.set_increments (1, 5);
+//XXX _frames_per_second.set_digits (2);
+ _frames_per_second->SetRange (0, 60);
vector<DCPContentType const *> const ct = DCPContentType::all ();
for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
- _dcp_content_type.append_text ((*i)->pretty_name ());
+ _dcp_content_type->Append (wxString ((*i)->pretty_name().c_str(), wxConvUTF8));
}
vector<Scaler const *> const sc = Scaler::all ();
for (vector<Scaler const *>::const_iterator i = sc.begin(); i != sc.end(); ++i) {
- _scaler.append_text ((*i)->name ());
+ _scaler->Append (wxString ((*i)->name().c_str(), wxConvUTF8));
}
-
- _original_size.set_alignment (0, 0.5);
- _length.set_alignment (0, 0.5);
- _audio.set_alignment (0, 0.5);
+
+//XXX _original_size.set_alignment (0, 0.5);
+ _length = new wxStaticText (this, wxID_ANY, wxT (""));
+//XXX _length.set_alignment (0, 0.5);
+ _audio = new wxStaticText (this, wxID_ANY, wxT (""));
+//XXX _audio.set_alignment (0, 0.5);
/* And set their values from the Film */
set_film (f);
/* Now connect to them, since initial values are safely set */
- _name.signal_changed().connect (sigc::mem_fun (*this, &FilmEditor::name_changed));
- _frames_per_second.signal_changed().connect (sigc::mem_fun (*this, &FilmEditor::frames_per_second_changed));
- _format.signal_changed().connect (sigc::mem_fun (*this, &FilmEditor::format_changed));
- _content.signal_file_set().connect (sigc::mem_fun (*this, &FilmEditor::content_changed));
- _left_crop.signal_value_changed().connect (sigc::mem_fun (*this, &FilmEditor::left_crop_changed));
- _right_crop.signal_value_changed().connect (sigc::mem_fun (*this, &FilmEditor::right_crop_changed));
- _top_crop.signal_value_changed().connect (sigc::mem_fun (*this, &FilmEditor::top_crop_changed));
- _bottom_crop.signal_value_changed().connect (sigc::mem_fun (*this, &FilmEditor::bottom_crop_changed));
- _filters_button.signal_clicked().connect (sigc::mem_fun (*this, &FilmEditor::edit_filters_clicked));
- _scaler.signal_changed().connect (sigc::mem_fun (*this, &FilmEditor::scaler_changed));
- _dcp_content_type.signal_changed().connect (sigc::mem_fun (*this, &FilmEditor::dcp_content_type_changed));
- _dcp_ab.signal_toggled().connect (sigc::mem_fun (*this, &FilmEditor::dcp_ab_toggled));
- _audio_gain.signal_value_changed().connect (sigc::mem_fun (*this, &FilmEditor::audio_gain_changed));
- _audio_delay.signal_value_changed().connect (sigc::mem_fun (*this, &FilmEditor::audio_delay_changed));
- _still_duration.signal_value_changed().connect (sigc::mem_fun (*this, &FilmEditor::still_duration_changed));
- _change_dcp_range_button.signal_clicked().connect (sigc::mem_fun (*this, &FilmEditor::change_dcp_range_clicked));
-
- /* Set up the table */
-
- Table* t = manage (new Table);
-
- t->set_row_spacings (4);
- t->set_col_spacings (12);
-
- int n = 0;
- t->attach (left_aligned_label ("Name"), 0, 1, n, n + 1);
- t->attach (_name, 1, 2, n, n + 1);
- ++n;
- t->attach (left_aligned_label ("Content"), 0, 1, n, n + 1);
- t->attach (_content, 1, 2, n, n + 1);
- ++n;
- t->attach (left_aligned_label ("Content Type"), 0, 1, n, n + 1);
- t->attach (_dcp_content_type, 1, 2, n, n + 1);
- ++n;
- t->attach (video_widget (left_aligned_label ("Frames Per Second")), 0, 1, n, n + 1);
- t->attach (video_widget (_frames_per_second), 1, 2, n, n + 1);
- ++n;
- t->attach (left_aligned_label ("Format"), 0, 1, n, n + 1);
- t->attach (_format, 1, 2, n, n + 1);
- ++n;
- t->attach (left_aligned_label ("Crop"), 0, 1, n, n + 1);
- HBox* c = manage (new HBox);
- c->set_spacing (4);
- c->pack_start (left_aligned_label ("L"), false, false);
- c->pack_start (_left_crop, true, true);
- c->pack_start (left_aligned_label ("R"), false, false);
- c->pack_start (_right_crop, true, true);
- c->pack_start (left_aligned_label ("T"), false, false);
- c->pack_start (_top_crop, true, true);
- c->pack_start (left_aligned_label ("B"), false, false);
- c->pack_start (_bottom_crop, true, true);
- t->attach (*c, 1, 2, n, n + 1);
- ++n;
-
- int const special = n;
-
+ _name->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (FilmEditor::name_changed), 0, this);
+ _frames_per_second->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::frames_per_second_changed), 0, this);
+ _format->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::format_changed), 0, this);
+//XXX _content.signal_file_set().connect (sigc::mem_fun (*this, &FilmEditor::content_changed));
+ _left_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::left_crop_changed), 0, this);
+ _right_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::right_crop_changed), 0, this);
+ _top_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::top_crop_changed), 0, this);
+ _bottom_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::bottom_crop_changed), 0, this);
+ _filters_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::edit_filters_clicked), 0, this);
+ _scaler->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::scaler_changed), 0, this);
+ _dcp_content_type->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::dcp_content_type_changed), 0, this);
+ _dcp_ab->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::dcp_ab_toggled), 0, this);
+ _audio_gain->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_gain_changed), 0, this);
+ _audio_delay->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_delay_changed), 0, this);
+ _still_duration->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::still_duration_changed), 0, this);
+ _change_dcp_range_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::change_dcp_range_clicked), 0, this);
+
+
+ /* Set up the sizer */
+ _sizer = new wxFlexGridSizer (3, 6, 6);
+ this->SetSizer (_sizer);
+
+ _name_label = new wxStaticText (this, wxID_ANY, wxT ("Name"));
+ _name_label->Show (true);
+ _sizer->Add (_name_label, 0, wxALIGN_CENTER_VERTICAL);
+ _sizer->Add (_name, 1, wxEXPAND);
+ _sizer->AddSpacer (0);
+
+#if 0
+ _content_label = new wxStaticText (this, wxID_ANY, wxT ("Content"));
+ _sizer->Add (_content_label, 0, wxALIGN_CENTER_VERTICAL);
+ _sizer->Add (_content, 1, wxEXPAND);
+ _sizer->AddSpacer (0);
+#endif
+
+ _dcp_content_type_label = new wxStaticText (this, wxID_ANY, wxT ("Content Type"));
+ _sizer->Add (_dcp_content_type_label, 0, wxALIGN_CENTER_VERTICAL);
+ _sizer->Add (_dcp_content_type);
+ _sizer->AddSpacer (0);
+
+ _frames_per_second_label = new wxStaticText (this, wxID_ANY, wxT ("Frames Per Second"));
+ video_control (_frames_per_second_label);
+ _sizer->Add (_frames_per_second_label, 0, wxALIGN_CENTER_VERTICAL);
+ _sizer->Add (video_control (_frames_per_second));
+ _sizer->AddSpacer (0);
+
+ _format_label = new wxStaticText (this, wxID_ANY, wxT ("Format"));
+ _sizer->Add (_format_label, 0, wxALIGN_CENTER_VERTICAL);
+ _sizer->Add (_format);
+ _sizer->AddSpacer (0);
+
+ _crop_label = new wxStaticText (this, wxID_ANY, wxT ("Crop"));
+ _sizer->Add (_crop_label, 0, wxALIGN_CENTER_VERTICAL);
+
+ _crop_sizer = new wxBoxSizer (wxHORIZONTAL);
+ _crop_panel->SetSizer (_crop_sizer);
+
+ _left_crop_label = new wxStaticText (_crop_panel, wxID_ANY, wxT ("L"));
+ _crop_sizer->Add (_left_crop_label, 0, wxALIGN_CENTER_VERTICAL);
+ _crop_sizer->Add (_left_crop, 0);
+ _right_crop_label = new wxStaticText (_crop_panel, wxID_ANY, wxT ("R"));
+ _crop_sizer->Add (_right_crop_label, 0, wxALIGN_CENTER_VERTICAL);
+ _crop_sizer->Add (_right_crop, 0);
+ _top_crop_label = new wxStaticText (_crop_panel, wxID_ANY, wxT ("T"));
+ _crop_sizer->Add (_top_crop_label, 0, wxALIGN_CENTER_VERTICAL);
+ _crop_sizer->Add (_top_crop, 0);
+ _bottom_crop_label = new wxStaticText (_crop_panel, wxID_ANY, wxT ("B"));
+ _crop_sizer->Add (_bottom_crop_label, 0, wxALIGN_CENTER_VERTICAL);
+ _crop_sizer->Add (_bottom_crop, 0);
+
+ _sizer->Add (_crop_panel);
+ _sizer->AddSpacer (0);
+
/* VIDEO-only stuff */
- t->attach (video_widget (left_aligned_label ("Filters")), 0, 1, n, n + 1);
- HBox* fb = manage (new HBox);
- fb->set_spacing (4);
- fb->pack_start (video_widget (_filters), true, true);
- fb->pack_start (video_widget (_filters_button), false, false);
- t->attach (*fb, 1, 2, n, n + 1);
- ++n;
- t->attach (video_widget (left_aligned_label ("Scaler")), 0, 1, n, n + 1);
- t->attach (video_widget (_scaler), 1, 2, n, n + 1);
- ++n;
- t->attach (video_widget (left_aligned_label ("Audio Gain")), 0, 1, n, n + 1);
- t->attach (video_widget (_audio_gain), 1, 2, n, n + 1);
- t->attach (video_widget (left_aligned_label ("dB")), 2, 3, n, n + 1);
- ++n;
- t->attach (video_widget (left_aligned_label ("Audio Delay")), 0, 1, n, n + 1);
- t->attach (video_widget (_audio_delay), 1, 2, n, n + 1);
- t->attach (video_widget (left_aligned_label ("ms")), 2, 3, n, n + 1);
- ++n;
- t->attach (video_widget (left_aligned_label ("Original Size")), 0, 1, n, n + 1);
- t->attach (video_widget (_original_size), 1, 2, n, n + 1);
- ++n;
- t->attach (video_widget (left_aligned_label ("Length")), 0, 1, n, n + 1);
- t->attach (video_widget (_length), 1, 2, n, n + 1);
- ++n;
- t->attach (video_widget (left_aligned_label ("Audio")), 0, 1, n, n + 1);
- t->attach (video_widget (_audio), 1, 2, n, n + 1);
- ++n;
- t->attach (video_widget (left_aligned_label ("Range")), 0, 1, n, n + 1);
- Gtk::HBox* db = manage (new Gtk::HBox);
- db->pack_start (_dcp_range, true, true);
- video_widget (_dcp_range);
- db->pack_start (_change_dcp_range_button, false, false);
- video_widget (_change_dcp_range_button);
- t->attach (*db, 1, 2, n, n + 1);
- ++n;
- t->attach (_dcp_ab, 0, 3, n, n + 1);
- video_widget (_dcp_ab);
+ _filters_label = new wxStaticText (this, wxID_ANY, wxT ("Filters"));
+ video_control (_filters_label);
+ _sizer->Add (_filters_label, 0, wxALIGN_CENTER_VERTICAL);
+ _sizer->Add (_filters, 1, wxALIGN_CENTER_VERTICAL);
+ _sizer->Add (_filters_button, 0);
+
+ video_control (add_label_to_sizer (_sizer, this, _labels, "Scaler"));
+ _sizer->Add (video_control (_scaler), 1);
+ _sizer->AddSpacer (0);
+
+ video_control (add_label_to_sizer (_sizer, this, _labels, "Audio Gain"));
+ _sizer->Add (video_control (_audio_gain), 1);
+ video_control (add_label_to_sizer (_sizer, this, _labels, "dB"));
+
+ video_control (add_label_to_sizer (_sizer, this, _labels, "Audio Delay"));
+ _sizer->Add (video_control (_audio_delay), 1);
+ video_control (add_label_to_sizer (_sizer, this, _labels, "ms"));
+
+ video_control (add_label_to_sizer (_sizer, this, _labels, "Original Size"));
+ _sizer->Add (video_control (_original_size), 1);
+ _sizer->AddSpacer (0);
+
+ video_control (add_label_to_sizer (_sizer, this, _labels, "Length"));
+ _sizer->Add (video_control (_length), 1);
+ _sizer->AddSpacer (0);
- /* STILL-only stuff */
- n = special;
- t->attach (still_widget (left_aligned_label ("Duration")), 0, 1, n, n + 1);
- t->attach (still_widget (_still_duration), 1, 2, n, n + 1);
- t->attach (still_widget (left_aligned_label ("s")), 2, 3, n, n + 1);
- ++n;
+ video_control (add_label_to_sizer (_sizer, this, _labels, "Audio"));
+ _sizer->Add (video_control (_audio), 1);
+ _sizer->AddSpacer (0);
- t->show_all ();
- _vbox.pack_start (*t, false, false);
+ video_control (add_label_to_sizer (_sizer, this, _labels, "Range"));
+ _sizer->Add (video_control (_dcp_range));
+ _sizer->Add (video_control (_change_dcp_range_button));
- setup_visibility ();
-}
+ _sizer->Add (_dcp_ab, 1);
+ _sizer->AddSpacer (0);
+ _sizer->AddSpacer (0);
-/** @return Our main widget, which contains everything else */
-Widget&
-FilmEditor::widget ()
-{
- return _vbox;
+ /* STILL-only stuff */
+ still_control (add_label_to_sizer (_sizer, this, _labels, "Duration"));
+ _sizer->Add (still_control (_still_duration));
+ still_control (add_label_to_sizer (_sizer, this, _labels, "s"));
+
+ setup_visibility ();
}
/** Called when the left crop widget has been changed */
void
-FilmEditor::left_crop_changed ()
+FilmEditor::left_crop_changed (wxCommandEvent &)
{
if (_film) {
- _film->set_left_crop (_left_crop.get_value ());
+ _film->set_left_crop (_left_crop->GetValue ());
}
}
/** Called when the right crop widget has been changed */
void
-FilmEditor::right_crop_changed ()
+FilmEditor::right_crop_changed (wxCommandEvent &)
{
if (_film) {
- _film->set_right_crop (_right_crop.get_value ());
+ _film->set_right_crop (_right_crop->GetValue ());
}
}
/** Called when the top crop widget has been changed */
void
-FilmEditor::top_crop_changed ()
+FilmEditor::top_crop_changed (wxCommandEvent &)
{
if (_film) {
- _film->set_top_crop (_top_crop.get_value ());
+ _film->set_top_crop (_top_crop->GetValue ());
}
}
/** Called when the bottom crop value has been changed */
void
-FilmEditor::bottom_crop_changed ()
+FilmEditor::bottom_crop_changed (wxCommandEvent &)
{
if (_film) {
- _film->set_bottom_crop (_bottom_crop.get_value ());
+ _film->set_bottom_crop (_bottom_crop->GetValue ());
}
}
/** Called when the content filename has been changed */
void
-FilmEditor::content_changed ()
+FilmEditor::content_changed (wxCommandEvent &)
{
if (!_film) {
return;
}
try {
- _film->set_content (_content.get_filename ());
+//XXX _film->set_content (_content.get_filename ());
} catch (std::exception& e) {
- _content.set_filename (_film->directory ());
+//XXX _content.set_filename (_film->directory ());
stringstream m;
m << "Could not set content: " << e.what() << ".";
- Gtk::MessageDialog d (m.str(), false, MESSAGE_ERROR);
- d.set_title ("DVD-o-matic");
- d.run ();
+//XXX Gtk::MessageDialog d (m.str(), false, MESSAGE_ERROR);
+//XXX d.set_title ("DVD-o-matic");
+//XXX d.run ();
}
}
/** Called when the DCP A/B switch has been toggled */
void
-FilmEditor::dcp_ab_toggled ()
+FilmEditor::dcp_ab_toggled (wxCommandEvent &)
{
if (_film) {
- _film->set_dcp_ab (_dcp_ab.get_active ());
+ _film->set_dcp_ab (_dcp_ab->GetValue ());
}
}
/** Called when the name widget has been changed */
void
-FilmEditor::name_changed ()
+FilmEditor::name_changed (wxCommandEvent &)
{
if (_film) {
- _film->set_name (_name.get_text ());
+ _film->set_name (string (_name->GetValue().mb_str()));
}
}
@@ -303,51 +328,52 @@ FilmEditor::film_changed (Film::Property p)
switch (p) {
case Film::CONTENT:
- _content.set_filename (_film->content ());
+//XXX _content.set_filename (_film->content ());
setup_visibility ();
break;
case Film::FORMAT:
- _format.set_active (Format::as_index (_film->format ()));
+ _format->SetSelection (Format::as_index (_film->format ()));
break;
case Film::LEFT_CROP:
- _left_crop.set_value (_film->left_crop ());
+ _left_crop->SetValue (_film->left_crop ());
break;
case Film::RIGHT_CROP:
- _right_crop.set_value (_film->right_crop ());
+ _right_crop->SetValue (_film->right_crop ());
break;
case Film::TOP_CROP:
- _top_crop.set_value (_film->top_crop ());
+ _top_crop->SetValue (_film->top_crop ());
break;
case Film::BOTTOM_CROP:
- _bottom_crop.set_value (_film->bottom_crop ());
+ _bottom_crop->SetValue (_film->bottom_crop ());
break;
case Film::FILTERS:
{
pair<string, string> p = Filter::ffmpeg_strings (_film->filters ());
- _filters.set_text (p.first + " " + p.second);
+ string const b = p.first + " " + p.second;
+ _filters->SetLabel (wxString (b.c_str(), wxConvUTF8));
break;
}
case Film::NAME:
- _name.set_text (_film->name ());
+ _name->SetValue (wxString (_film->name().c_str(), wxConvUTF8));
break;
case Film::FRAMES_PER_SECOND:
- _frames_per_second.set_value (_film->frames_per_second ());
+ _frames_per_second->SetValue (_film->frames_per_second ());
break;
case Film::AUDIO_CHANNELS:
case Film::AUDIO_SAMPLE_RATE:
if (_film->audio_channels() == 0 && _film->audio_sample_rate() == 0) {
- _audio.set_text ("");
+ _audio->SetLabel (wxT (""));
} else {
s << _film->audio_channels () << " channels, " << _film->audio_sample_rate() << "Hz";
- _audio.set_text (s.str ());
+ _audio->SetLabel (wxString (s.str().c_str(), wxConvUTF8));
}
break;
case Film::SIZE:
if (_film->size().width == 0 && _film->size().height == 0) {
- _original_size.set_text ("");
+ _original_size->SetLabel (wxT (""));
} else {
s << _film->size().width << " x " << _film->size().height;
- _original_size.set_text (s.str ());
+ _original_size->SetLabel (wxString (s.str().c_str(), wxConvUTF8));
}
break;
case Film::LENGTH:
@@ -356,63 +382,67 @@ FilmEditor::film_changed (Film::Property p)
} else if (_film->length() > 0) {
s << _film->length() << " frames";
}
- _length.set_text (s.str ());
+ _length->SetLabel (wxString (s.str().c_str(), wxConvUTF8));
break;
case Film::DCP_CONTENT_TYPE:
- _dcp_content_type.set_active (DCPContentType::as_index (_film->dcp_content_type ()));
+ _dcp_content_type->SetSelection (DCPContentType::as_index (_film->dcp_content_type ()));
break;
case Film::THUMBS:
break;
case Film::DCP_FRAMES:
if (_film->dcp_frames() == 0) {
- _dcp_range.set_text ("Whole film");
+ _dcp_range->SetLabel (wxT ("Whole film"));
} else {
stringstream s;
s << "First " << _film->dcp_frames() << " frames";
- _dcp_range.set_text (s.str ());
+ _dcp_range->SetLabel (wxString (s.str().c_str(), wxConvUTF8));
}
break;
case Film::DCP_TRIM_ACTION:
break;
case Film::DCP_AB:
- _dcp_ab.set_active (_film->dcp_ab ());
+ _dcp_ab->SetValue (_film->dcp_ab ());
break;
case Film::SCALER:
- _scaler.set_active (Scaler::as_index (_film->scaler ()));
+ _scaler->SetSelection (Scaler::as_index (_film->scaler ()));
break;
case Film::AUDIO_GAIN:
- _audio_gain.set_value (_film->audio_gain ());
+ _audio_gain->SetValue (_film->audio_gain ());
break;
case Film::AUDIO_DELAY:
- _audio_delay.set_value (_film->audio_delay ());
+ _audio_delay->SetValue (_film->audio_delay ());
break;
case Film::STILL_DURATION:
- _still_duration.set_value (_film->still_duration ());
+ _still_duration->SetValue (_film->still_duration ());
break;
}
}
/** Called when the format widget has been changed */
void
-FilmEditor::format_changed ()
+FilmEditor::format_changed (wxCommandEvent &)
{
- if (_film) {
- int const n = _format.get_active_row_number ();
- if (n >= 0) {
- _film->set_format (Format::from_index (n));
- }
+ if (!_film) {
+ return;
+ }
+
+ int const n = _format->GetSelection ();
+ if (n >= 0) {
+ _film->set_format (Format::from_index (n));
}
}
/** Called when the DCP content type widget has been changed */
void
-FilmEditor::dcp_content_type_changed ()
+FilmEditor::dcp_content_type_changed (wxCommandEvent &)
{
- if (_film) {
- int const n = _dcp_content_type.get_active_row_number ();
- if (n >= 0) {
- _film->set_dcp_content_type (DCPContentType::from_index (n));
- }
+ if (!_film) {
+ return;
+ }
+
+ int const n = _dcp_content_type->GetSelection ();
+ if (n >= 0) {
+ _film->set_dcp_content_type (DCPContentType::from_index (n));
}
}
@@ -429,9 +459,9 @@ FilmEditor::set_film (Film* f)
}
if (_film) {
- FileChanged (_film->directory ());
+// FileChanged (_film->directory ());
} else {
- FileChanged ("");
+// FileChanged ("");
}
film_changed (Film::NAME);
@@ -463,83 +493,91 @@ FilmEditor::set_film (Film* f)
void
FilmEditor::set_things_sensitive (bool s)
{
- _name.set_sensitive (s);
- _frames_per_second.set_sensitive (s);
- _format.set_sensitive (s);
- _content.set_sensitive (s);
- _left_crop.set_sensitive (s);
- _right_crop.set_sensitive (s);
- _top_crop.set_sensitive (s);
- _bottom_crop.set_sensitive (s);
- _filters_button.set_sensitive (s);
- _scaler.set_sensitive (s);
- _dcp_content_type.set_sensitive (s);
- _dcp_range.set_sensitive (s);
- _change_dcp_range_button.set_sensitive (s);
- _dcp_ab.set_sensitive (s);
- _audio_gain.set_sensitive (s);
- _audio_delay.set_sensitive (s);
- _still_duration.set_sensitive (s);
+ _name->Enable (s);
+ _frames_per_second->Enable (s);
+ _format->Enable (s);
+// _content->Enable (s);
+ _left_crop->Enable (s);
+ _right_crop->Enable (s);
+ _top_crop->Enable (s);
+ _bottom_crop->Enable (s);
+ _filters_button->Enable (s);
+ _scaler->Enable (s);
+ _dcp_content_type->Enable (s);
+ _dcp_range->Enable (s);
+ _change_dcp_range_button->Enable (s);
+ _dcp_ab->Enable (s);
+ _audio_gain->Enable (s);
+ _audio_delay->Enable (s);
+ _still_duration->Enable (s);
}
/** Called when the `Edit filters' button has been clicked */
void
-FilmEditor::edit_filters_clicked ()
+FilmEditor::edit_filters_clicked (wxCommandEvent &)
{
- FilterDialog d (_film->filters ());
- d.ActiveChanged.connect (sigc::mem_fun (*_film, &Film::set_filters));
- d.run ();
+// FilterDialog d (_film->filters ());
+// d.ActiveChanged.connect (sigc::mem_fun (*_film, &Film::set_filters));
+// d.run ();
}
/** Called when the scaler widget has been changed */
void
-FilmEditor::scaler_changed ()
+FilmEditor::scaler_changed (wxCommandEvent &)
{
- if (_film) {
- int const n = _scaler.get_active_row_number ();
- if (n >= 0) {
- _film->set_scaler (Scaler::from_index (n));
- }
+ if (!_film) {
+ return;
+ }
+
+ int const n = _scaler->GetSelection ();
+ if (n >= 0) {
+ _film->set_scaler (Scaler::from_index (n));
}
}
/** Called when the frames per second widget has been changed */
void
-FilmEditor::frames_per_second_changed ()
+FilmEditor::frames_per_second_changed (wxCommandEvent &)
{
- if (_film) {
- _film->set_frames_per_second (_frames_per_second.get_value ());
+ if (!_film) {
+ return;
}
+
+ _film->set_frames_per_second (_frames_per_second->GetValue ());
}
void
-FilmEditor::audio_gain_changed ()
+FilmEditor::audio_gain_changed (wxCommandEvent &)
{
- if (_film) {
- _film->set_audio_gain (_audio_gain.get_value ());
+ if (!_film) {
+ return;
}
+
+ _film->set_audio_gain (_audio_gain->GetValue ());
}
void
-FilmEditor::audio_delay_changed ()
+FilmEditor::audio_delay_changed (wxCommandEvent &)
{
- if (_film) {
- _film->set_audio_delay (_audio_delay.get_value ());
+ if (!_film) {
+ return;
}
+
+ _film->set_audio_delay (_audio_delay->GetValue ());
}
-Widget&
-FilmEditor::video_widget (Widget& w)
+wxControl *
+FilmEditor::video_control (wxControl* c)
{
- _video_widgets.push_back (&w);
- return w;
+ _video_controls.push_back (c);
+ return c;
}
-Widget&
-FilmEditor::still_widget (Widget& w)
+wxControl *
+FilmEditor::still_control (wxControl* c)
{
- _still_widgets.push_back (&w);
- return w;
+ _still_controls.push_back (c);
+ return c;
}
void
@@ -551,29 +589,29 @@ FilmEditor::setup_visibility ()
c = _film->content_type ();
}
- for (list<Widget *>::iterator i = _video_widgets.begin(); i != _video_widgets.end(); ++i) {
- (*i)->property_visible() = (c == VIDEO);
+ for (list<wxControl*>::iterator i = _video_controls.begin(); i != _video_controls.end(); ++i) {
+ (*i)->Show (c == VIDEO);
}
- for (list<Widget *>::iterator i = _still_widgets.begin(); i != _still_widgets.end(); ++i) {
- (*i)->property_visible() = (c == STILL);
+ for (list<wxControl*>::iterator i = _still_controls.begin(); i != _still_controls.end(); ++i) {
+ (*i)->Show (c == STILL);
}
}
void
-FilmEditor::still_duration_changed ()
+FilmEditor::still_duration_changed (wxCommandEvent &)
{
if (_film) {
- _film->set_still_duration (_still_duration.get_value ());
+ _film->set_still_duration (_still_duration->GetValue ());
}
}
void
-FilmEditor::change_dcp_range_clicked ()
+FilmEditor::change_dcp_range_clicked (wxCommandEvent &)
{
- DCPRangeDialog d (_film);
- d.Changed.connect (sigc::mem_fun (*this, &FilmEditor::dcp_range_changed));
- d.run ();
+//XXX DCPRangeDialog d (_film);
+//XXX d.Changed.connect (sigc::mem_fun (*this, &FilmEditor::dcp_range_changed));
+//XXX d.run ();
}
void
diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h
index 9d15b436d..2227a6d64 100644
--- a/src/wx/film_editor.h
+++ b/src/wx/film_editor.h
@@ -18,108 +18,123 @@
*/
/** @file src/film_editor.h
- * @brief A GTK widget to edit a film's metadata, and perform various functions.
+ * @brief A wx widget to edit a film's metadata, and perform various functions.
*/
-#include <gtkmm.h>
+#include <wx/wx.h>
+#include <wx/spinctrl.h>
+#include "lib/trim_action.h"
+#include "lib/film.h"
class Film;
/** @class FilmEditor
- * @brief A GTK widget to edit a film's metadata, and perform various functions.
+ * @brief A wx widget to edit a film's metadata, and perform various functions.
*/
-class FilmEditor
+class FilmEditor : public wxPanel
{
public:
- FilmEditor (Film *);
-
- Gtk::Widget& widget ();
+ FilmEditor (Film *, wxWindow *);
void set_film (Film *);
void setup_visibility ();
- sigc::signal1<void, std::string> FileChanged;
+//XXX sigc::signal1<void, std::string> FileChanged;
private:
/* Handle changes to the view */
- void name_changed ();
- void left_crop_changed ();
- void right_crop_changed ();
- void top_crop_changed ();
- void bottom_crop_changed ();
- void content_changed ();
- void frames_per_second_changed ();
- void format_changed ();
+ void name_changed (wxCommandEvent &);
+ void left_crop_changed (wxCommandEvent &);
+ void right_crop_changed (wxCommandEvent &);
+ void top_crop_changed (wxCommandEvent &);
+ void bottom_crop_changed (wxCommandEvent &);
+ void content_changed (wxCommandEvent &);
+ void frames_per_second_changed (wxCommandEvent &);
+ void format_changed (wxCommandEvent &);
void dcp_range_changed (int, TrimAction);
- void dcp_content_type_changed ();
- void dcp_ab_toggled ();
- void scaler_changed ();
- void audio_gain_changed ();
- void audio_delay_changed ();
- void still_duration_changed ();
+ void dcp_content_type_changed (wxCommandEvent &);
+ void dcp_ab_toggled (wxCommandEvent &);
+ void scaler_changed (wxCommandEvent &);
+ void audio_gain_changed (wxCommandEvent &);
+ void audio_delay_changed (wxCommandEvent &);
+ void still_duration_changed (wxCommandEvent &);
/* Handle changes to the model */
void film_changed (Film::Property);
/* Button clicks */
- void edit_filters_clicked ();
- void change_dcp_range_clicked ();
+ void edit_filters_clicked (wxCommandEvent &);
+ void change_dcp_range_clicked (wxCommandEvent &);
void set_things_sensitive (bool);
- Gtk::Widget & video_widget (Gtk::Widget &);
- Gtk::Widget & still_widget (Gtk::Widget &);
+ wxControl* video_control (wxControl *);
+ wxControl* still_control (wxControl *);
/** The film we are editing */
Film* _film;
- /** The overall VBox containing our widget */
- Gtk::VBox _vbox;
/** The Film's name */
- Gtk::Entry _name;
+ wxTextCtrl* _name;
/** The Film's frames per second */
- Gtk::SpinButton _frames_per_second;
+ wxSpinCtrl* _frames_per_second;
/** The Film's format */
- Gtk::ComboBoxText _format;
+ wxComboBox* _format;
/** The Film's content file */
- Gtk::FileChooserButton _content;
+ wxFileCtrl* _content;
/** The Film's left crop */
- Gtk::SpinButton _left_crop;
+ wxSpinCtrl* _left_crop;
/** The Film's right crop */
- Gtk::SpinButton _right_crop;
+ wxSpinCtrl* _right_crop;
/** The Film's top crop */
- Gtk::SpinButton _top_crop;
+ wxSpinCtrl* _top_crop;
/** The Film's bottom crop */
- Gtk::SpinButton _bottom_crop;
+ wxSpinCtrl* _bottom_crop;
/** Currently-applied filters */
- Gtk::Label _filters;
+ wxStaticText* _filters;
/** Button to open the filters dialogue */
- Gtk::Button _filters_button;
+ wxButton* _filters_button;
/** The Film's scaler */
- Gtk::ComboBoxText _scaler;
+ wxComboBox* _scaler;
/** The Film's audio gain */
- Gtk::SpinButton _audio_gain;
+ wxSpinCtrl* _audio_gain;
/** The Film's audio delay */
- Gtk::SpinButton _audio_delay;
+ wxSpinCtrl* _audio_delay;
/** The Film's DCP content type */
- Gtk::ComboBoxText _dcp_content_type;
+ wxComboBox* _dcp_content_type;
/** The Film's original size */
- Gtk::Label _original_size;
+ wxStaticText* _original_size;
/** The Film's length */
- Gtk::Label _length;
+ wxStaticText* _length;
/** The Film's audio details */
- Gtk::Label _audio;
+ wxStaticText* _audio;
/** The Film's duration for still sources */
- Gtk::SpinButton _still_duration;
+ wxSpinCtrl* _still_duration;
- /** Button to start making a DCP from existing J2K and WAV files */
- Gtk::Button _make_dcp_from_existing_button;
/** Display of the range of frames that will be used */
- Gtk::Label _dcp_range;
+ wxStaticText* _dcp_range;
/** Button to change the range */
- Gtk::Button _change_dcp_range_button;
+ wxButton* _change_dcp_range_button;
/** Selector to generate an A/B comparison DCP */
- Gtk::CheckButton _dcp_ab;
-
- std::list<Gtk::Widget*> _video_widgets;
- std::list<Gtk::Widget*> _still_widgets;
+ wxCheckBox* _dcp_ab;
+
+ wxFlexGridSizer* _sizer;
+ wxStaticText* _name_label;
+ wxStaticText* _content_label;
+ wxStaticText* _dcp_content_type_label;
+ wxStaticText* _frames_per_second_label;
+ wxStaticText* _format_label;
+ wxStaticText* _crop_label;
+ wxSizer* _crop_sizer;
+ wxPanel* _crop_panel;
+ wxStaticText* _left_crop_label;
+ wxStaticText* _right_crop_label;
+ wxStaticText* _top_crop_label;
+ wxStaticText* _bottom_crop_label;
+ wxStaticText* _filters_label;
+ wxStaticText* _scaler_label;
+
+ std::list<wxControl*> _video_controls;
+ std::list<wxControl*> _still_controls;
+
+ std::list<wxControl*> _labels;
};
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 1d50c2f88..c42ccf6fe 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -18,7 +18,7 @@
*/
/** @file src/film_viewer.cc
- * @brief A GTK widget to view `thumbnails' of a Film.
+ * @brief A wx widget to view `thumbnails' of a Film.
*/
#include <iostream>
@@ -35,11 +35,71 @@
using namespace std;
using namespace boost;
-FilmViewer::FilmViewer (Film* f)
- : _film (f)
+class ThumbPanel : public wxPanel
{
- _scroller.add (_image);
+public:
+ ThumbPanel (wxPanel* parent)
+ : wxPanel (parent)
+ , _image (0)
+ , _bitmap (0)
+ {
+ }
+
+ void paint_event (wxPaintEvent& ev)
+ {
+ if (!_bitmap) {
+ return;
+ }
+
+ int x, y;
+ GetSize (&x, &y);
+ cout << "Render " << x << " " << y << "\n";
+
+ wxPaintDC dc (this);
+ dc.DrawBitmap (*_bitmap, 0, 0, false);
+ }
+
+ void load (string f)
+ {
+ cout << "loading " << f << "\n";
+ clear ();
+ _image = new wxImage (wxString (f.c_str(), wxConvUTF8));
+ _bitmap = new wxBitmap (_image->Scale (512, 512));
+ }
+
+ void clear ()
+ {
+ delete _bitmap;
+ _bitmap = 0;
+ delete _image;
+ _image = 0;
+ }
+
+ DECLARE_EVENT_TABLE ();
+
+private:
+ wxImage* _image;
+ wxBitmap* _bitmap;
+};
+
+BEGIN_EVENT_TABLE (ThumbPanel, wxPanel)
+EVT_PAINT (ThumbPanel::paint_event)
+END_EVENT_TABLE ()
+FilmViewer::FilmViewer (Film* f, wxWindow* p)
+ : wxPanel (p)
+ , _film (f)
+{
+ _sizer = new wxBoxSizer (wxVERTICAL);
+ SetSizer (_sizer);
+
+ _thumb_panel = new ThumbPanel (this);
+ _thumb_panel->Show (true);
+ _sizer->Add (_thumb_panel, 1, wxEXPAND);
+
+#if 0
+ _scroller.add (_image);
+
Gtk::HBox* controls = manage (new Gtk::HBox);
controls->set_spacing (6);
controls->pack_start (_position_slider);
@@ -53,8 +113,11 @@ FilmViewer::FilmViewer (Film* f)
_position_slider.signal_value_changed().connect (sigc::mem_fun (*this, &FilmViewer::position_slider_changed));
_scroller.signal_size_allocate().connect (sigc::mem_fun (*this, &FilmViewer::scroller_size_allocate));
+#endif
set_film (_film);
+
+ load_thumbnail (42);//XXX
}
void
@@ -69,19 +132,21 @@ FilmViewer::load_thumbnail (int n)
int const top = _film->top_crop ();
int const bottom = _film->bottom_crop ();
- _pixbuf = Gdk::Pixbuf::create_from_file (_film->thumb_file (n));
+ _thumb_panel->load (_film->thumb_file(n));
+
+// _pixbuf = Gdk::Pixbuf::create_from_file (_film->thumb_file (n));
- int const cw = _film->size().width - left - right;
- int const ch = _film->size().height - top - bottom;
- _cropped_pixbuf = Gdk::Pixbuf::create_subpixbuf (_pixbuf, left, top, cw, ch);
- update_scaled_pixbuf ();
- _image.set (_scaled_pixbuf);
+// int const cw = _film->size().width - left - right;
+// int const ch = _film->size().height - top - bottom;
+// _cropped_pixbuf = Gdk::Pixbuf::create_subpixbuf (_pixbuf, left, top, cw, ch);
+// update_scaled_pixbuf ();
+// _image.set (_scaled_pixbuf);
}
void
FilmViewer::reload_current_thumbnail ()
{
- load_thumbnail (_position_slider.get_value ());
+ load_thumbnail (42);//_position_slider.get_value ());
}
void
@@ -93,6 +158,7 @@ FilmViewer::position_slider_changed ()
string
FilmViewer::format_position_slider_value (double v) const
{
+#if 0
stringstream s;
if (_film && int (v) < _film->num_thumbs ()) {
@@ -103,11 +169,13 @@ FilmViewer::format_position_slider_value (double v) const
}
return s.str ();
+#endif
}
void
FilmViewer::film_changed (Film::Property p)
{
+#if 0
if (p == Film::LEFT_CROP || p == Film::RIGHT_CROP || p == Film::TOP_CROP || p == Film::BOTTOM_CROP) {
reload_current_thumbnail ();
} else if (p == Film::THUMBS) {
@@ -127,6 +195,7 @@ FilmViewer::film_changed (Film::Property p)
_film->examine_content ();
update_thumbs ();
}
+#endif
}
void
@@ -135,11 +204,11 @@ FilmViewer::set_film (Film* f)
_film = f;
if (!_film) {
- _image.clear ();
+ _thumb_panel->clear ();
return;
}
- _film->Changed.connect (sigc::mem_fun (*this, &FilmViewer::film_changed));
+// _film->Changed.connect (sigc::mem_fun (*this, &FilmViewer::film_changed));
film_changed (Film::THUMBS);
}
@@ -147,6 +216,7 @@ FilmViewer::set_film (Film* f)
pair<int, int>
FilmViewer::scaled_pixbuf_size () const
{
+#if 0
if (_film == 0) {
return make_pair (0, 0);
}
@@ -162,22 +232,26 @@ FilmViewer::scaled_pixbuf_size () const
Gtk::Allocation const a = _scroller.get_allocation ();
float const zoom = min (float (a.get_width()) / (cw * ratio), float (a.get_height()) / cw);
return make_pair (cw * zoom * ratio, ch * zoom);
+#endif
}
void
FilmViewer::update_scaled_pixbuf ()
{
+#if 0
pair<int, int> const s = scaled_pixbuf_size ();
if (s.first > 0 && s.second > 0 && _cropped_pixbuf) {
_scaled_pixbuf = _cropped_pixbuf->scale_simple (s.first, s.second, Gdk::INTERP_HYPER);
_image.set (_scaled_pixbuf);
}
+#endif
}
void
FilmViewer::update_thumbs ()
{
+#if 0
if (!_film) {
return;
}
@@ -194,25 +268,18 @@ FilmViewer::update_thumbs ()
shared_ptr<Job> j (new ThumbsJob (s, o, _film->log ()));
j->Finished.connect (sigc::mem_fun (_film, &Film::update_thumbs_post_gui));
JobManager::instance()->add (j);
-}
-
-void
-FilmViewer::scroller_size_allocate (Gtk::Allocation a)
-{
- if (a.get_width() != _last_scroller_allocation.get_width() || a.get_height() != _last_scroller_allocation.get_height()) {
- update_scaled_pixbuf ();
- }
-
- _last_scroller_allocation = a;
+#endif
}
void
FilmViewer::setup_visibility ()
{
+#if 0
if (!_film) {
return;
}
ContentType const c = _film->content_type ();
_position_slider.property_visible() = (c == VIDEO);
+#endif
}
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index ae0633cd2..416dc7260 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -18,23 +18,21 @@
*/
/** @file src/film_viewer.h
- * @brief A GTK widget to view `thumbnails' of a Film.
+ * @brief A wx widget to view `thumbnails' of a Film.
*/
-#include <gtkmm.h>
+#include <wx/wx.h>
#include "lib/film.h"
+class ThumbPanel;
+
/** @class FilmViewer
- * @brief A GTK widget to view `thumbnails' of a Film.
+ * @brief A wx widget to view `thumbnails' of a Film.
*/
-class FilmViewer
+class FilmViewer : public wxPanel
{
public:
- FilmViewer (Film *);
-
- Gtk::Widget& widget () {
- return _vbox;
- }
+ FilmViewer (Film *, wxWindow *);
void set_film (Film *);
void setup_visibility ();
@@ -48,15 +46,17 @@ private:
void reload_current_thumbnail ();
void update_scaled_pixbuf ();
std::pair<int, int> scaled_pixbuf_size () const;
- void scroller_size_allocate (Gtk::Allocation);
+// void scroller_size_allocate (Gtk::Allocation);
Film* _film;
- Gtk::VBox _vbox;
- Gtk::ScrolledWindow _scroller;
- Gtk::Image _image;
- Glib::RefPtr<Gdk::Pixbuf> _pixbuf;
- Glib::RefPtr<Gdk::Pixbuf> _cropped_pixbuf;
- Glib::RefPtr<Gdk::Pixbuf> _scaled_pixbuf;
- Gtk::HScale _position_slider;
- Gtk::Allocation _last_scroller_allocation;
+ wxBoxSizer* _sizer;
+ ThumbPanel* _thumb_panel;
+// Gtk::VBox _vbox;
+// Gtk::ScrolledWindow _scroller;
+// Gtk::Image _image;
+// Glib::RefPtr<Gdk::Pixbuf> _pixbuf;
+// Glib::RefPtr<Gdk::Pixbuf> _cropped_pixbuf;
+// Glib::RefPtr<Gdk::Pixbuf> _scaled_pixbuf;
+// Gtk::HScale _position_slider;
+// Gtk::Allocation _last_scroller_allocation;
};
diff --git a/src/wx/wscript b/src/wx/wscript
index 8c809b675..845951b17 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -1,32 +1,32 @@
def configure(conf):
- conf.check_cfg(package = 'glib-2.0', args = '--cflags --libs', uselib_store = 'GLIB', mandatory = True)
- conf.check_cfg(package = 'gtkmm-2.4', args = '--cflags --libs', uselib_store = 'GTKMM', mandatory = True)
- conf.check_cfg(package = 'cairomm-1.0', args = '--cflags --libs', uselib_store = 'CAIROMM', mandatory = True)
+ conf.check_cfg(package = '', path = 'wx-config', args = '--cppflags --cxxflags --libs', uselib_store = 'WXWIDGETS', mandatory = True)
def build(bld):
obj = bld(features = 'cxx cxxshlib')
- obj.name = 'libdvdomatic-gtk'
+ obj.name = 'libdvdomatic-wx'
obj.includes = [ '..' ]
obj.export_includes = ['.']
- obj.uselib = 'GLIB GTKMM CAIROMM'
+ obj.uselib = 'WXWIDGETS'
obj.use = 'libdvdomatic'
obj.source = """
- alignment.cc
- config_dialog.cc
- dcp_range_dialog.cc
film_editor.cc
- film_list.cc
+ wx_util.cc
film_viewer.cc
- filter_dialog.cc
- filter_view.cc
- gpl.cc
- job_manager_view.cc
- gtk_util.cc
- job_wrapper.cc
- dvd_title_dialog.cc
- """
+ """
+
+# alignment.cc
+# config_dialog.cc
+# dcp_range_dialog.cc
+# film_editor.cc
+# film_list.cc
+# filter_dialog.cc
+# filter_view.cc
+# gpl.cc
+# job_manager_view.cc
+# job_wrapper.cc
+# dvd_title_dialog.cc
if not bld.env.DISABLE_PLAYER:
obj.source += " film_player.cc"
- obj.target = 'dvdomatic-gtk'
+ obj.target = 'dvdomatic-wx'
diff --git a/src/wx/gtk_util.cc b/src/wx/wx_util.cc
index 41f8cb5b5..97a66a5ba 100644
--- a/src/wx/gtk_util.cc
+++ b/src/wx/wx_util.cc
@@ -17,25 +17,24 @@
*/
-/** @file src/gtk/util.cc
+/** @file src/wx/wx_util.cc
* @brief Some utility functions.
*/
-#include <gtkmm.h>
+#include "wx_util.h"
using namespace std;
-/** @param t Label text.
- * @return GTK label containing t, left-aligned (passed through Gtk::manage)
- */
-Gtk::Label &
-left_aligned_label (string t)
+wxStaticText *
+add_label_to_sizer (wxSizer* s, wxWindow* p, list<wxControl*>& c, string t)
{
- Gtk::Label* l = Gtk::manage (new Gtk::Label (t));
- l->set_alignment (0, 0.5);
- return *l;
+ wxStaticText* m = new wxStaticText (p, wxID_ANY, wxString (t.c_str (), wxConvUTF8));
+ c.push_back (m);
+ s->Add (m, 0, wxALIGN_CENTER_VERTICAL);
+ return m;
}
+#if 0
void
error_dialog (string m)
{
@@ -43,3 +42,4 @@ error_dialog (string m)
d.set_title ("DVD-o-matic");
d.run ();
}
+#endif
diff --git a/src/wx/gtk_util.h b/src/wx/wx_util.h
index 518842872..8a84b1323 100644
--- a/src/wx/gtk_util.h
+++ b/src/wx/wx_util.h
@@ -17,11 +17,12 @@
*/
-#include <gtkmm.h>
+#include <list>
+#include <wx/wx.h>
-/** @file src/gtk/util.h
+/** @file src/wx/wx_util.h
* @brief Some utility functions.
*/
extern void error_dialog (std::string);
-extern Gtk::Label & left_aligned_label (std::string);
+extern wxStaticText* add_label_to_sizer (wxSizer *, wxWindow *, std::list<wxControl*>&, std::string);
diff --git a/src/wx2/dvdomatic.cc b/src/wx2/dvdomatic.cc
new file mode 100644
index 000000000..3e1114f03
--- /dev/null
+++ b/src/wx2/dvdomatic.cc
@@ -0,0 +1,76 @@
+#include <wx/wx.h>
+#include "lib/util.h"
+#include "lib/film.h"
+#include "film_viewer.h"
+#include "film_editor.h"
+
+enum {
+ ID_Quit = 1,
+};
+
+class Frame : public wxFrame
+{
+public:
+ Frame (wxString const & title, wxPoint const & pos, wxSize const & size)
+ : wxFrame (NULL, -1, title, pos, size)
+ {
+ wxMenuBar* bar = new wxMenuBar;
+
+ wxMenu *menu_file = new wxMenu;
+ menu_file->Append (ID_Quit, _("&Quit"));
+
+ bar->Append (menu_file, _("&File"));
+
+ SetMenuBar (bar);
+
+ CreateStatusBar ();
+ SetStatusText (_("Welcome to DVD-o-matic!"));
+ }
+
+ void OnQuit (wxCommandEvent& event)
+ {
+ Close (true);
+ }
+};
+
+class App : public wxApp
+{
+ bool OnInit ()
+ {
+ if (!wxApp::OnInit ()) {
+ return false;
+ }
+
+ wxInitAllImageHandlers ();
+
+ dvdomatic_setup ();
+
+ Film* film = new Film ("/home/carl/DCP/BitHarvest");
+
+ Frame* frame = new Frame (_("DVD-o-matic"), wxPoint (50, 50), wxSize(450, 350));
+ frame->Show (true);
+
+ frame->Connect (
+ ID_Quit, wxEVT_COMMAND_MENU_SELECTED,
+ (wxObjectEventFunction) &Frame::OnQuit
+ );
+
+ FilmEditor* editor = new FilmEditor (film, frame);
+ editor->Show (true);
+ FilmViewer* viewer = new FilmViewer (film, frame);
+ viewer->load_thumbnail (22);
+
+ wxBoxSizer* main_sizer = new wxBoxSizer (wxHORIZONTAL);
+ main_sizer->Add (editor, 0);
+ main_sizer->Add (viewer->get_widget (), 1, wxEXPAND);
+ frame->SetSizer (main_sizer);
+
+// frame->Add (viewer->get_widget ());
+
+ SetTopWindow (frame);
+ return true;
+ }
+};
+
+IMPLEMENT_APP (App)
+
diff --git a/src/wx2/film_editor.cc b/src/wx2/film_editor.cc
new file mode 100644
index 000000000..b99327879
--- /dev/null
+++ b/src/wx2/film_editor.cc
@@ -0,0 +1,8 @@
+#include "film_editor.h"
+
+FilmEditor::FilmEditor (Film* f, wxFrame* p)
+ : wxPanel (p)
+ , _film (f)
+{
+ new wxButton (this, 0, wxT("FUCK"));
+}
diff --git a/src/wx2/film_editor.h b/src/wx2/film_editor.h
new file mode 100644
index 000000000..d1278b80e
--- /dev/null
+++ b/src/wx2/film_editor.h
@@ -0,0 +1,12 @@
+#include <wx/wx.h>
+
+class Film;
+
+class FilmEditor : public wxPanel
+{
+public:
+ FilmEditor (Film* f, wxFrame *);
+
+private:
+ Film* _film;
+};
diff --git a/src/wx2/film_viewer.cc b/src/wx2/film_viewer.cc
new file mode 100644
index 000000000..c2481efb9
--- /dev/null
+++ b/src/wx2/film_viewer.cc
@@ -0,0 +1,73 @@
+#include <iostream>
+#include "lib/film.h"
+#include "film_viewer.h"
+
+using namespace std;
+
+class ThumbPanel : public wxPanel
+{
+public:
+ ThumbPanel (wxFrame* parent)
+ : wxPanel (parent)
+ , _bitmap (0)
+ {
+ }
+
+ void paint_event (wxPaintEvent& ev)
+ {
+ if (!_bitmap) {
+ return;
+ }
+
+ cout << "RENDER\n";
+
+ wxPaintDC dc (this);
+ dc.DrawBitmap (*_bitmap, 0, 0, false);
+ }
+
+ void set_bitmap (wxBitmap* bitmap)
+ {
+ _bitmap = bitmap;
+ }
+
+ DECLARE_EVENT_TABLE ();
+
+private:
+ wxBitmap* _bitmap;
+};
+
+BEGIN_EVENT_TABLE (ThumbPanel, wxPanel)
+EVT_PAINT (ThumbPanel::paint_event)
+END_EVENT_TABLE ()
+
+FilmViewer::FilmViewer (Film* f, wxFrame* p)
+ : _film (f)
+ , _image (0)
+ , _scaled_image (0)
+ , _bitmap (0)
+{
+ _thumb_panel = new ThumbPanel (p);
+ _thumb_panel->Show (true);
+ int x, y;
+ _thumb_panel->GetSize (&x, &y);
+ cout << x << " " << y << "\n";
+}
+
+void
+FilmViewer::load_thumbnail (int n)
+{
+ if (_film == 0 && _film->num_thumbs() <= n) {
+ return;
+ }
+
+ _image = new wxImage (wxString (_film->thumb_file(n).c_str (), wxConvUTF8));
+ _scaled_image = new wxImage (_image->Scale (512, 512));
+ _bitmap = new wxBitmap (*_scaled_image);
+ _thumb_panel->set_bitmap (_bitmap);
+}
+
+wxPanel *
+FilmViewer::get_widget ()
+{
+ return _thumb_panel;
+}
diff --git a/src/wx2/film_viewer.h b/src/wx2/film_viewer.h
new file mode 100644
index 000000000..b0a6aab04
--- /dev/null
+++ b/src/wx2/film_viewer.h
@@ -0,0 +1,21 @@
+#include <wx/wx.h>
+
+class Film;
+class ThumbPanel;
+
+class FilmViewer
+{
+public:
+ FilmViewer (Film *, wxFrame *);
+
+ void load_thumbnail (int);
+ wxPanel* get_widget ();
+
+private:
+ Film* _film;
+
+ wxImage* _image;
+ wxImage* _scaled_image;
+ wxBitmap* _bitmap;
+ ThumbPanel* _thumb_panel;
+};
diff --git a/src/wx2/wscript b/src/wx2/wscript
new file mode 100644
index 000000000..f8aa92896
--- /dev/null
+++ b/src/wx2/wscript
@@ -0,0 +1,16 @@
+def configure(conf):
+ conf.check_cfg(package = '', path = 'wx-config', args = '--cppflags --cxxflags --libs', uselib_store = 'WXWIDGETS', mandatory = True)
+
+def build(bld):
+ obj = bld(features = 'cxx cxxprogram')
+ obj.name = 'dvdomatic-wx'
+ obj.includes = [ '..' ]
+ obj.export_includes = ['.']
+ obj.uselib = 'WXWIDGETS'
+ obj.use = 'dvdomatic'
+ obj.source = """
+ dvdomatic.cc
+ film_viewer.cc
+ film_editor.cc
+ """
+ obj.target = 'dvdomatic-wx'