Merge master.
[dcpomatic.git] / src / wx / film_editor.cc
index 94aea9b1a4512bfdcf6e079b3ae76ae6a4687585..2cf6a0b6ccc6847a627bfeb63a848a8e407d6ab8 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #include "lib/filter.h"
 #include "lib/ratio.h"
 #include "lib/config.h"
-#include "lib/still_image_content.h"
+#include "lib/image_content.h"
+#include "lib/ffmpeg_content.h"
 #include "lib/sndfile_content.h"
 #include "lib/dcp_content_type.h"
 #include "lib/sound_processor.h"
 #include "lib/scaler.h"
+#include "lib/playlist.h"
+#include "lib/content.h"
+#include "lib/content_factory.h"
 #include "timecode.h"
-#include "filter_dialog.h"
 #include "wx_util.h"
 #include "film_editor.h"
 #include "dci_metadata_dialog.h"
@@ -50,6 +53,7 @@
 #include "timing_panel.h"
 #include "subtitle_panel.h"
 #include "audio_panel.h"
+#include "video_panel.h"
 
 using std::string;
 using std::cout;
@@ -68,7 +72,7 @@ using boost::lexical_cast;
 /** @param f Film to edit */
 FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
        : wxPanel (parent)
-       , _menu (f, this)
+       , _menu (this)
        , _generally_sensitive (true)
        , _timeline_dialog (0)
 {
@@ -82,14 +86,14 @@ FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
        make_dcp_panel ();
        _main_notebook->AddPage (_dcp_panel, _("DCP"), false);
        
-       setup_ratios ();
-
        set_film (f);
        connect_to_widgets ();
 
        JobManager::instance()->ActiveJobsChanged.connect (
                bind (&FilmEditor::active_jobs_changed, this, _1)
                );
+
+       Config::instance()->Changed.connect (boost::bind (&FilmEditor::config_changed, this));
        
        SetSizerAndFit (s);
 }
@@ -140,22 +144,34 @@ FilmEditor::make_dcp_panel ()
        {
                add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Frame Rate"), true, wxGBPosition (r, 0));
                wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-               _dcp_frame_rate = new wxChoice (_dcp_panel, wxID_ANY);
-               s->Add (_dcp_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
-               _best_dcp_frame_rate = new wxButton (_dcp_panel, wxID_ANY, _("Use best"));
-               s->Add (_best_dcp_frame_rate, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);
+               _frame_rate = new wxChoice (_dcp_panel, wxID_ANY);
+               s->Add (_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
+               _best_frame_rate = new wxButton (_dcp_panel, wxID_ANY, _("Use best"));
+               s->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);
                grid->Add (s, wxGBPosition (r, 1));
        }
        ++r;
 
+       _signed = new wxCheckBox (_dcp_panel, wxID_ANY, _("Signed"));
+       grid->Add (_signed, wxGBPosition (r, 0), wxGBSpan (1, 2));
+       ++r;
+       
+       _encrypted = new wxCheckBox (_dcp_panel, wxID_ANY, _("Encrypted"));
+       grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
+       ++r;
+
        add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Audio channels"), true, wxGBPosition (r, 0));
-       _dcp_audio_channels = new wxSpinCtrl (_dcp_panel, wxID_ANY);
-       grid->Add (_dcp_audio_channels, wxGBPosition (r, 1));
+       _audio_channels = new wxSpinCtrl (_dcp_panel, wxID_ANY);
+       grid->Add (_audio_channels, wxGBPosition (r, 1));
+       ++r;
+
+       _three_d = new wxCheckBox (_dcp_panel, wxID_ANY, _("3D"));
+       grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
        ++r;
 
        add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Resolution"), true, wxGBPosition (r, 0));
-       _dcp_resolution = new wxChoice (_dcp_panel, wxID_ANY);
-       grid->Add (_dcp_resolution, wxGBPosition (r, 1));
+       _resolution = new wxChoice (_dcp_panel, wxID_ANY);
+       grid->Add (_resolution, wxGBPosition (r, 1));
        ++r;
 
        {
@@ -163,11 +179,16 @@ FilmEditor::make_dcp_panel ()
                wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
                _j2k_bandwidth = new wxSpinCtrl (_dcp_panel, wxID_ANY);
                s->Add (_j2k_bandwidth, 1);
-               add_label_to_sizer (s, _dcp_panel, _("MBps"), false);
+               add_label_to_sizer (s, _dcp_panel, _("Mbit/s"), false);
                grid->Add (s, wxGBPosition (r, 1));
        }
        ++r;
 
+       add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Standard"), true, wxGBPosition (r, 0));
+       _standard = new wxChoice (_dcp_panel, wxID_ANY);
+       grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+       ++r;
+
        add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Scaler"), true, wxGBPosition (r, 0));
        _scaler = new wxChoice (_dcp_panel, wxID_ANY);
        grid->Add (_scaler, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
@@ -190,105 +211,47 @@ FilmEditor::make_dcp_panel ()
 
        list<int> const dfr = Config::instance()->allowed_dcp_frame_rates ();
        for (list<int>::const_iterator i = dfr.begin(); i != dfr.end(); ++i) {
-               _dcp_frame_rate->Append (std_to_wx (boost::lexical_cast<string> (*i)));
+               _frame_rate->Append (std_to_wx (boost::lexical_cast<string> (*i)));
        }
 
-       _dcp_audio_channels->SetRange (0, MAX_AUDIO_CHANNELS);
-       _j2k_bandwidth->SetRange (50, 250);
+       _audio_channels->SetRange (0, MAX_AUDIO_CHANNELS);
+       _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
 
-       _dcp_resolution->Append (_("2K"));
-       _dcp_resolution->Append (_("4K"));
-}
+       _resolution->Append (_("2K"));
+       _resolution->Append (_("4K"));
 
-void
-FilmEditor::connect_to_widgets ()
-{
-       _name->Connect                   (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED,         wxCommandEventHandler (FilmEditor::name_changed), 0, this);
-       _use_dci_name->Connect           (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED,     wxCommandEventHandler (FilmEditor::use_dci_name_toggled), 0, this);
-       _edit_dci_button->Connect        (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,       wxCommandEventHandler (FilmEditor::edit_dci_button_clicked), 0, this);
-       _container->Connect              (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::container_changed), 0, this);
-       _ratio->Connect                  (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::ratio_changed), 0, this);
-       _content->Connect                (wxID_ANY, wxEVT_COMMAND_LIST_ITEM_SELECTED,   wxListEventHandler    (FilmEditor::content_selection_changed), 0, this);
-       _content->Connect                (wxID_ANY, wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler    (FilmEditor::content_selection_changed), 0, this);
-       _content->Connect                (wxID_ANY, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK,wxListEventHandler    (FilmEditor::content_right_click), 0, this);
-       _content_add->Connect            (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,       wxCommandEventHandler (FilmEditor::content_add_clicked), 0, this);
-       _content_remove->Connect         (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,       wxCommandEventHandler (FilmEditor::content_remove_clicked), 0, this);
-       _content_timeline->Connect       (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,       wxCommandEventHandler (FilmEditor::content_timeline_clicked), 0, this);
-       _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_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::scaler_changed), 0, this);
-       _dcp_content_type->Connect       (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::dcp_content_type_changed), 0, this);
-       _dcp_frame_rate->Connect         (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::dcp_frame_rate_changed), 0, this);
-       _best_dcp_frame_rate->Connect    (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,       wxCommandEventHandler (FilmEditor::best_dcp_frame_rate_clicked), 0, this);
-       _dcp_audio_channels->Connect     (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::dcp_audio_channels_changed), 0, this);
-       _j2k_bandwidth->Connect          (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::j2k_bandwidth_changed), 0, this);
-       _dcp_resolution->Connect         (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::dcp_resolution_changed), 0, this);
-       _sequence_video->Connect         (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED,     wxCommandEventHandler (FilmEditor::sequence_video_changed), 0, this);
+       _standard->Append (_("SMPTE"));
+       _standard->Append (_("Interop"));
 }
 
 void
-FilmEditor::make_video_panel ()
+FilmEditor::connect_to_widgets ()
 {
-       _video_panel = new wxPanel (_content_notebook);
-       wxBoxSizer* video_sizer = new wxBoxSizer (wxVERTICAL);
-       _video_panel->SetSizer (video_sizer);
-       
-       wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
-       video_sizer->Add (grid, 0, wxALL, 8);
-
-       int r = 0;
-       add_label_to_grid_bag_sizer (grid, _video_panel, _("Left crop"), true, wxGBPosition (r, 0));
-       _left_crop = new wxSpinCtrl (_video_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
-       grid->Add (_left_crop, wxGBPosition (r, 1));
-       ++r;
-
-       add_label_to_grid_bag_sizer (grid, _video_panel, _("Right crop"), true, wxGBPosition (r, 0));
-       _right_crop = new wxSpinCtrl (_video_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
-       grid->Add (_right_crop, wxGBPosition (r, 1));
-       ++r;
-       
-       add_label_to_grid_bag_sizer (grid, _video_panel, _("Top crop"), true, wxGBPosition (r, 0));
-       _top_crop = new wxSpinCtrl (_video_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
-       grid->Add (_top_crop, wxGBPosition (r, 1));
-       ++r;
-       
-       add_label_to_grid_bag_sizer (grid, _video_panel, _("Bottom crop"), true, wxGBPosition (r, 0));
-       _bottom_crop = new wxSpinCtrl (_video_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
-       grid->Add (_bottom_crop, wxGBPosition (r, 1));
-       ++r;
-
-       add_label_to_grid_bag_sizer (grid, _video_panel, _("Scale to"), true, wxGBPosition (r, 0));
-       _ratio = new wxChoice (_video_panel, wxID_ANY);
-       grid->Add (_ratio, wxGBPosition (r, 1));
-       ++r;
-
-       _scaling_description = new wxStaticText (_video_panel, wxID_ANY, wxT ("\n \n \n \n"), wxDefaultPosition, wxDefaultSize);
-       grid->Add (_scaling_description, wxGBPosition (r, 0), wxGBSpan (1, 2), wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6);
-       wxFont font = _scaling_description->GetFont();
-       font.SetStyle(wxFONTSTYLE_ITALIC);
-       font.SetPointSize(font.GetPointSize() - 1);
-       _scaling_description->SetFont(font);
-       ++r;
-
-       /* VIDEO-only stuff */
-       {
-               add_label_to_grid_bag_sizer (grid, _video_panel, _("Filters"), true, wxGBPosition (r, 0));
-               wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-               _filters = new wxStaticText (_video_panel, wxID_ANY, _("None"));
-               s->Add (_filters, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
-               _filters_button = new wxButton (_video_panel, wxID_ANY, _("Edit..."));
-               s->Add (_filters_button, 0, wxALIGN_CENTER_VERTICAL);
-               grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
-       }
-       ++r;
-
-       _left_crop->SetRange (0, 1024);
-       _top_crop->SetRange (0, 1024);
-       _right_crop->SetRange (0, 1024);
-       _bottom_crop->SetRange (0, 1024);
+       _name->Bind             (wxEVT_COMMAND_TEXT_UPDATED,          boost::bind (&FilmEditor::name_changed, this));
+       _use_dci_name->Bind     (wxEVT_COMMAND_CHECKBOX_CLICKED,      boost::bind (&FilmEditor::use_dci_name_toggled, this));
+       _edit_dci_button->Bind  (wxEVT_COMMAND_BUTTON_CLICKED,        boost::bind (&FilmEditor::edit_dci_button_clicked, this));
+       _container->Bind        (wxEVT_COMMAND_CHOICE_SELECTED,       boost::bind (&FilmEditor::container_changed, this));
+       _content->Bind          (wxEVT_COMMAND_LIST_ITEM_SELECTED,    boost::bind (&FilmEditor::content_selection_changed, this));
+       _content->Bind          (wxEVT_COMMAND_LIST_ITEM_DESELECTED,  boost::bind (&FilmEditor::content_selection_changed, this));
+       _content->Bind          (wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, boost::bind (&FilmEditor::content_right_click, this, _1));
+       _content_add_file->Bind (wxEVT_COMMAND_BUTTON_CLICKED,        boost::bind (&FilmEditor::content_add_file_clicked, this));
+       _content_add_folder->Bind (wxEVT_COMMAND_BUTTON_CLICKED,      boost::bind (&FilmEditor::content_add_folder_clicked, this));
+       _content_remove->Bind   (wxEVT_COMMAND_BUTTON_CLICKED,        boost::bind (&FilmEditor::content_remove_clicked, this));
+       _content_earlier->Bind  (wxEVT_COMMAND_BUTTON_CLICKED,        boost::bind (&FilmEditor::content_earlier_clicked, this));
+       _content_later->Bind    (wxEVT_COMMAND_BUTTON_CLICKED,        boost::bind (&FilmEditor::content_later_clicked, this));
+       _content_timeline->Bind (wxEVT_COMMAND_BUTTON_CLICKED,        boost::bind (&FilmEditor::content_timeline_clicked, this));
+       _scaler->Bind           (wxEVT_COMMAND_CHOICE_SELECTED,       boost::bind (&FilmEditor::scaler_changed, this));
+       _dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED,       boost::bind (&FilmEditor::dcp_content_type_changed, this));
+       _frame_rate->Bind       (wxEVT_COMMAND_CHOICE_SELECTED,       boost::bind (&FilmEditor::frame_rate_changed, this));
+       _best_frame_rate->Bind  (wxEVT_COMMAND_BUTTON_CLICKED,        boost::bind (&FilmEditor::best_frame_rate_clicked, this));
+       _signed->Bind           (wxEVT_COMMAND_CHECKBOX_CLICKED,      boost::bind (&FilmEditor::signed_toggled, this));
+       _encrypted->Bind        (wxEVT_COMMAND_CHECKBOX_CLICKED,      boost::bind (&FilmEditor::encrypted_toggled, this));
+       _audio_channels->Bind   (wxEVT_COMMAND_SPINCTRL_UPDATED,      boost::bind (&FilmEditor::audio_channels_changed, this));
+       _j2k_bandwidth->Bind    (wxEVT_COMMAND_SPINCTRL_UPDATED,      boost::bind (&FilmEditor::j2k_bandwidth_changed, this));
+       _resolution->Bind       (wxEVT_COMMAND_CHOICE_SELECTED,       boost::bind (&FilmEditor::resolution_changed, this));
+       _sequence_video->Bind   (wxEVT_COMMAND_CHECKBOX_CLICKED,      boost::bind (&FilmEditor::sequence_video_changed, this));
+       _three_d->Bind          (wxEVT_COMMAND_CHECKBOX_CLICKED,      boost::bind (&FilmEditor::three_d_changed, this));
+       _standard->Bind         (wxEVT_COMMAND_CHOICE_SELECTED,       boost::bind (&FilmEditor::standard_changed, this));
 }
 
 void
@@ -301,23 +264,35 @@ FilmEditor::make_content_panel ()
        {
                wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
                
-               _content = new wxListCtrl (_content_panel, wxID_ANY, wxDefaultPosition, wxSize (320, 160), wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL);
+               _content = new wxListCtrl (_content_panel, wxID_ANY, wxDefaultPosition, wxSize (320, 160), wxLC_REPORT | wxLC_NO_HEADER);
                s->Add (_content, 1, wxEXPAND | wxTOP | wxBOTTOM, 6);
 
                _content->InsertColumn (0, wxT(""));
                _content->SetColumnWidth (0, 512);
 
+#ifdef DCPOMATIC_OSX
+               int const pad = 2;
+#else
+               int const pad = 0;
+#endif         
+
                wxBoxSizer* b = new wxBoxSizer (wxVERTICAL);
-               _content_add = new wxButton (_content_panel, wxID_ANY, _("Add..."));
-               b->Add (_content_add, 1, wxEXPAND | wxLEFT | wxRIGHT);
+               _content_add_file = new wxButton (_content_panel, wxID_ANY, _("Add file(s)..."));
+               b->Add (_content_add_file, 1, wxEXPAND | wxALL, pad);
+               _content_add_folder = new wxButton (_content_panel, wxID_ANY, _("Add folder..."));
+               b->Add (_content_add_folder, 1, wxEXPAND | wxALL, pad);
                _content_remove = new wxButton (_content_panel, wxID_ANY, _("Remove"));
-               b->Add (_content_remove, 1, wxEXPAND | wxLEFT | wxRIGHT);
+               b->Add (_content_remove, 1, wxEXPAND | wxALL, pad);
+               _content_earlier = new wxButton (_content_panel, wxID_ANY, _("Up"));
+               b->Add (_content_earlier, 1, wxEXPAND | wxALL, pad);
+               _content_later = new wxButton (_content_panel, wxID_ANY, _("Down"));
+               b->Add (_content_later, 1, wxEXPAND | wxALL, pad);
                _content_timeline = new wxButton (_content_panel, wxID_ANY, _("Timeline..."));
-               b->Add (_content_timeline, 1, wxEXPAND | wxLEFT | wxRIGHT);
+               b->Add (_content_timeline, 1, wxEXPAND | wxALL, pad);
 
                s->Add (b, 0, wxALL, 4);
 
-               _content_sizer->Add (s, 0.75, wxEXPAND | wxALL, 6);
+               _content_sizer->Add (s, 0, wxEXPAND | wxALL, 6);
        }
 
        _sequence_video = new wxCheckBox (_content_panel, wxID_ANY, _("Keep video in sequence"));
@@ -326,117 +301,102 @@ FilmEditor::make_content_panel ()
        _content_notebook = new wxNotebook (_content_panel, wxID_ANY);
        _content_sizer->Add (_content_notebook, 1, wxEXPAND | wxTOP, 6);
 
-       make_video_panel ();
-       _content_notebook->AddPage (_video_panel, _("Video"), false);
+       _video_panel = new VideoPanel (this);
+       _panels.push_back (_video_panel);
        _audio_panel = new AudioPanel (this);
+       _panels.push_back (_audio_panel);
        _subtitle_panel = new SubtitlePanel (this);
+       _panels.push_back (_subtitle_panel);
        _timing_panel = new TimingPanel (this);
+       _panels.push_back (_timing_panel);
 }
 
-/** Called when the left crop widget has been changed */
+/** Called when the name widget has been changed */
 void
-FilmEditor::left_crop_changed (wxCommandEvent &)
+FilmEditor::name_changed ()
 {
-       shared_ptr<VideoContent> c = selected_video_content ();
-       if (!c) {
+       if (!_film) {
                return;
        }
 
-       c->set_left_crop (_left_crop->GetValue ());
+       _film->set_name (string (_name->GetValue().mb_str()));
 }
 
-/** Called when the right crop widget has been changed */
 void
-FilmEditor::right_crop_changed (wxCommandEvent &)
+FilmEditor::j2k_bandwidth_changed ()
 {
-       shared_ptr<VideoContent> c = selected_video_content ();
-       if (!c) {
+       if (!_film) {
                return;
        }
-
-       c->set_right_crop (_right_crop->GetValue ());
+       
+       _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
 }
 
-/** Called when the top crop widget has been changed */
 void
-FilmEditor::top_crop_changed (wxCommandEvent &)
+FilmEditor::signed_toggled ()
 {
-       shared_ptr<VideoContent> c = selected_video_content ();
-       if (!c) {
+       if (!_film) {
                return;
        }
 
-       c->set_top_crop (_top_crop->GetValue ());
+       _film->set_signed (_signed->GetValue ());
 }
 
-/** Called when the bottom crop value has been changed */
 void
-FilmEditor::bottom_crop_changed (wxCommandEvent &)
+FilmEditor::encrypted_toggled ()
 {
-       shared_ptr<VideoContent> c = selected_video_content ();
-       if (!c) {
+       if (!_film) {
                return;
        }
 
-       c->set_bottom_crop (_bottom_crop->GetValue ());
+       _film->set_encrypted (_encrypted->GetValue ());
 }
-
+                              
 /** Called when the name widget has been changed */
 void
-FilmEditor::name_changed (wxCommandEvent &)
+FilmEditor::frame_rate_changed ()
 {
        if (!_film) {
                return;
        }
 
-       _film->set_name (string (_name->GetValue().mb_str()));
-}
-
-void
-FilmEditor::j2k_bandwidth_changed (wxCommandEvent &)
-{
-       if (!_film) {
-               return;
-       }
-       
-       _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1e6);
+       _film->set_video_frame_rate (
+               boost::lexical_cast<int> (
+                       wx_to_std (_frame_rate->GetString (_frame_rate->GetSelection ()))
+                       )
+               );
 }
 
 void
-FilmEditor::dcp_frame_rate_changed (wxCommandEvent &)
+FilmEditor::audio_channels_changed ()
 {
        if (!_film) {
                return;
        }
 
-       _film->set_dcp_video_frame_rate (
-               boost::lexical_cast<int> (
-                       wx_to_std (_dcp_frame_rate->GetString (_dcp_frame_rate->GetSelection ()))
-                       )
-               );
+       _film->set_audio_channels (_audio_channels->GetValue ());
 }
 
 void
-FilmEditor::dcp_audio_channels_changed (wxCommandEvent &)
+FilmEditor::resolution_changed ()
 {
        if (!_film) {
                return;
        }
 
-       _film->set_dcp_audio_channels (_dcp_audio_channels->GetValue ());
+       _film->set_resolution (_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
 }
 
 void
-FilmEditor::dcp_resolution_changed (wxCommandEvent &)
+FilmEditor::standard_changed ()
 {
        if (!_film) {
                return;
        }
 
-       _film->set_resolution (_dcp_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
+       _film->set_interop (_standard->GetSelection() == 1);
 }
 
-
 /** Called when the metadata stored in the Film object has changed;
  *  so that we can update the GUI.
  *  @param p Property of the Film that has changed.
@@ -452,9 +412,9 @@ FilmEditor::film_changed (Film::Property p)
 
        stringstream s;
 
-       _audio_panel->film_changed (p);
-       _subtitle_panel->film_changed (p);
-       _timing_panel->film_changed (p);
+       for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+               (*i)->film_changed (p);
+       }
                
        switch (p) {
        case Film::NONE:
@@ -479,12 +439,24 @@ FilmEditor::film_changed (Film::Property p)
        case Film::SCALER:
                checked_set (_scaler, Scaler::as_index (_film->scaler ()));
                break;
+       case Film::SIGNED:
+               checked_set (_signed, _film->is_signed ());
+               break;
+       case Film::ENCRYPTED:
+               checked_set (_encrypted, _film->encrypted ());
+               if (_film->encrypted ()) {
+                       _film->set_signed (true);
+                       _signed->Enable (false);
+               } else {
+                       _signed->Enable (_generally_sensitive);
+               }
+               break;
        case Film::RESOLUTION:
-               checked_set (_dcp_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
+               checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
                setup_dcp_name ();
                break;
        case Film::J2K_BANDWIDTH:
-               checked_set (_j2k_bandwidth, double (_film->j2k_bandwidth()) / 1e6);
+               checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
                break;
        case Film::USE_DCI_NAME:
                checked_set (_use_dci_name, _film->use_dci_name ());
@@ -493,36 +465,43 @@ FilmEditor::film_changed (Film::Property p)
        case Film::DCI_METADATA:
                setup_dcp_name ();
                break;
-       case Film::DCP_VIDEO_FRAME_RATE:
+       case Film::VIDEO_FRAME_RATE:
        {
                bool done = false;
-               for (unsigned int i = 0; i < _dcp_frame_rate->GetCount(); ++i) {
-                       if (wx_to_std (_dcp_frame_rate->GetString(i)) == boost::lexical_cast<string> (_film->dcp_video_frame_rate())) {
-                               checked_set (_dcp_frame_rate, i);
+               for (unsigned int i = 0; i < _frame_rate->GetCount(); ++i) {
+                       if (wx_to_std (_frame_rate->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
+                               checked_set (_frame_rate, i);
                                done = true;
                                break;
                        }
                }
 
                if (!done) {
-                       checked_set (_dcp_frame_rate, -1);
+                       checked_set (_frame_rate, -1);
                }
 
-               _best_dcp_frame_rate->Enable (_film->best_dcp_video_frame_rate () != _film->dcp_video_frame_rate ());
+               _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
                break;
        }
-       case Film::DCP_AUDIO_CHANNELS:
-               _dcp_audio_channels->SetValue (_film->dcp_audio_channels ());
+       case Film::AUDIO_CHANNELS:
+               checked_set (_audio_channels, _film->audio_channels ());
                setup_dcp_name ();
                break;
        case Film::SEQUENCE_VIDEO:
                checked_set (_sequence_video, _film->sequence_video ());
                break;
+       case Film::THREE_D:
+               checked_set (_three_d, _film->three_d ());
+               setup_dcp_name ();
+               break;
+       case Film::INTEROP:
+               checked_set (_standard, _film->interop() ? 1 : 0);
+               break;
        }
 }
 
 void
-FilmEditor::film_content_changed (weak_ptr<Content> weak_content, int property)
+FilmEditor::film_content_changed (int property)
 {
        ensure_ui_thread ();
        
@@ -533,66 +512,14 @@ FilmEditor::film_content_changed (weak_ptr<Content> weak_content, int property)
                return;
        }
 
-       shared_ptr<Content> content = weak_content.lock ();
-       if (content != selected_content ()) {
-               return;
-       }
-       
-       shared_ptr<VideoContent> video_content;
-       shared_ptr<AudioContent> audio_content;
-       shared_ptr<SubtitleContent> subtitle_content;
-       shared_ptr<FFmpegContent> ffmpeg_content;
-       if (content) {
-               video_content = dynamic_pointer_cast<VideoContent> (content);
-               audio_content = dynamic_pointer_cast<AudioContent> (content);
-               subtitle_content = dynamic_pointer_cast<SubtitleContent> (content);
-               ffmpeg_content = dynamic_pointer_cast<FFmpegContent> (content);
+       for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+               (*i)->film_content_changed (property);
        }
 
-       _audio_panel->film_content_changed    (content, audio_content, subtitle_content, ffmpeg_content, property);
-       _subtitle_panel->film_content_changed (content, audio_content, subtitle_content, ffmpeg_content, property);
-       _timing_panel->film_content_changed   (content, audio_content, subtitle_content, ffmpeg_content, property);
-
-       /* We can't use case {} here */
-       
-       if (property == VideoContentProperty::VIDEO_CROP) {
-               checked_set (_left_crop,   video_content ? video_content->crop().left   : 0);
-               checked_set (_right_crop,  video_content ? video_content->crop().right  : 0);
-               checked_set (_top_crop,    video_content ? video_content->crop().top    : 0);
-               checked_set (_bottom_crop, video_content ? video_content->crop().bottom : 0);
-               setup_scaling_description ();
-       } else if (property == VideoContentProperty::VIDEO_RATIO) {
-               if (video_content) {
-                       int n = 0;
-                       vector<Ratio const *> ratios = Ratio::all ();
-                       vector<Ratio const *>::iterator i = ratios.begin ();
-                       while (i != ratios.end() && *i != video_content->ratio()) {
-                               ++i;
-                               ++n;
-                       }
-
-                       if (i == ratios.end()) {
-                               checked_set (_ratio, -1);
-                       } else {
-                               checked_set (_ratio, n);
-                       }
-               } else {
-                       checked_set (_ratio, -1);
-               }
-               setup_scaling_description ();
-       } else if (property == FFmpegContentProperty::AUDIO_STREAM) {
+       if (property == FFmpegContentProperty::AUDIO_STREAM) {
                setup_dcp_name ();
-       } else if (property == FFmpegContentProperty::FILTERS) {
-               if (ffmpeg_content) {
-                       pair<string, string> p = Filter::ffmpeg_strings (ffmpeg_content->filters ());
-                       if (p.first.empty () && p.second.empty ()) {
-                               _filters->SetLabel (_("None"));
-                       } else {
-                               string const b = p.first + " " + p.second;
-                               _filters->SetLabel (std_to_wx (b));
-                       }
-                       _dcp_sizer->Layout ();
-               }
+       } else if (property == ContentProperty::PATH) {
+               setup_content ();
        }
 }
 
@@ -614,12 +541,11 @@ FilmEditor::setup_container ()
        }
        
        setup_dcp_name ();
-       setup_scaling_description ();
 }      
 
 /** Called when the container widget has been changed */
 void
-FilmEditor::container_changed (wxCommandEvent &)
+FilmEditor::container_changed ()
 {
        if (!_film) {
                return;
@@ -635,7 +561,7 @@ FilmEditor::container_changed (wxCommandEvent &)
 
 /** Called when the DCP content type widget has been changed */
 void
-FilmEditor::dcp_content_type_changed (wxCommandEvent &)
+FilmEditor::dcp_content_type_changed ()
 {
        if (!_film) {
                return;
@@ -651,7 +577,7 @@ FilmEditor::dcp_content_type_changed (wxCommandEvent &)
 void
 FilmEditor::set_film (shared_ptr<Film> f)
 {
-       set_things_sensitive (f != 0);
+       set_general_sensitivity (f != 0);
 
        if (_film == f) {
                return;
@@ -661,7 +587,7 @@ FilmEditor::set_film (shared_ptr<Film> f)
 
        if (_film) {
                _film->Changed.connect (bind (&FilmEditor::film_changed, this, _1));
-               _film->ContentChanged.connect (bind (&FilmEditor::film_content_changed, this, _1, _2));
+               _film->ContentChanged.connect (bind (&FilmEditor::film_content_changed, this, _2));
        }
 
        if (_film) {
@@ -678,67 +604,68 @@ FilmEditor::set_film (shared_ptr<Film> f)
        film_changed (Film::RESOLUTION);
        film_changed (Film::SCALER);
        film_changed (Film::WITH_SUBTITLES);
+       film_changed (Film::SIGNED);
+       film_changed (Film::ENCRYPTED);
        film_changed (Film::J2K_BANDWIDTH);
        film_changed (Film::DCI_METADATA);
-       film_changed (Film::DCP_VIDEO_FRAME_RATE);
-       film_changed (Film::DCP_AUDIO_CHANNELS);
+       film_changed (Film::VIDEO_FRAME_RATE);
+       film_changed (Film::AUDIO_CHANNELS);
        film_changed (Film::SEQUENCE_VIDEO);
+       film_changed (Film::THREE_D);
+       film_changed (Film::INTEROP);
 
        if (!_film->content().empty ()) {
                set_selection (_film->content().front ());
        }
 
-       wxListEvent ev;
-       content_selection_changed (ev);
+       content_selection_changed ();
 }
 
-/** Updates the sensitivity of lots of widgets to a given value.
- *  @param s true to make sensitive, false to make insensitive.
- */
 void
-FilmEditor::set_things_sensitive (bool s)
+FilmEditor::set_general_sensitivity (bool s)
 {
        _generally_sensitive = s;
-       
+
+       /* Stuff in the Content / DCP tabs */
        _name->Enable (s);
        _use_dci_name->Enable (s);
        _edit_dci_button->Enable (s);
        _content->Enable (s);
+       _content_add_file->Enable (s);
+       _content_add_folder->Enable (s);
+       _content_remove->Enable (s);
+       _content_earlier->Enable (s);
+       _content_later->Enable (s);
+       _content_timeline->Enable (s);
        _dcp_content_type->Enable (s);
-       _dcp_frame_rate->Enable (s);
-       _dcp_audio_channels->Enable (s);
-       _j2k_bandwidth->Enable (s);
-       _container->Enable (s);
 
-       _subtitle_panel->setup_control_sensitivity ();
-       _audio_panel->setup_sensitivity ();
-       setup_content_sensitivity ();
-       _best_dcp_frame_rate->Enable (s && _film && _film->best_dcp_video_frame_rate () != _film->dcp_video_frame_rate ());
-}
-
-/** Called when the `Edit filters' button has been clicked */
-void
-FilmEditor::edit_filters_clicked (wxCommandEvent &)
-{
-       shared_ptr<Content> c = selected_content ();
-       if (!c) {
-               return;
+       bool si = s;
+       if (_film && _film->encrypted ()) {
+               si = false;
        }
+       _signed->Enable (si);
+       
+       _encrypted->Enable (s);
+       _frame_rate->Enable (s);
+       _audio_channels->Enable (s);
+       _j2k_bandwidth->Enable (s);
+       _container->Enable (s);
+       _best_frame_rate->Enable (s && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
+       _sequence_video->Enable (s);
+       _resolution->Enable (s);
+       _scaler->Enable (s);
+       _three_d->Enable (s);
+       _standard->Enable (s);
 
-       shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c);
-       if (!fc) {
-               return;
+       /* Set the panels in the content notebook */
+       for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+               (*i)->Enable (s);
        }
-       
-       FilterDialog* d = new FilterDialog (this, fc->filters());
-       d->ActiveChanged.connect (bind (&FFmpegContent::set_filters, fc, _1));
-       d->ShowModal ();
-       d->Destroy ();
 }
 
 /** Called when the scaler widget has been changed */
 void
-FilmEditor::scaler_changed (wxCommandEvent &)
+FilmEditor::scaler_changed ()
 {
        if (!_film) {
                return;
@@ -751,20 +678,7 @@ FilmEditor::scaler_changed (wxCommandEvent &)
 }
 
 void
-FilmEditor::setup_ratios ()
-{
-       _ratios = Ratio::all ();
-
-       _ratio->Clear ();
-       for (vector<Ratio const *>::iterator i = _ratios.begin(); i != _ratios.end(); ++i) {
-               _ratio->Append (std_to_wx ((*i)->nickname ()));
-       }
-
-       _dcp_sizer->Layout ();
-}
-
-void
-FilmEditor::use_dci_name_toggled (wxCommandEvent &)
+FilmEditor::use_dci_name_toggled ()
 {
        if (!_film) {
                return;
@@ -774,7 +688,7 @@ FilmEditor::use_dci_name_toggled (wxCommandEvent &)
 }
 
 void
-FilmEditor::edit_dci_button_clicked (wxCommandEvent &)
+FilmEditor::edit_dci_button_clicked ()
 {
        if (!_film) {
                return;
@@ -789,7 +703,7 @@ FilmEditor::edit_dci_button_clicked (wxCommandEvent &)
 void
 FilmEditor::active_jobs_changed (bool a)
 {
-       set_things_sensitive (!a);
+       set_general_sensitivity (!a);
 }
 
 void
@@ -805,13 +719,13 @@ FilmEditor::setup_dcp_name ()
 }
 
 void
-FilmEditor::best_dcp_frame_rate_clicked (wxCommandEvent &)
+FilmEditor::best_frame_rate_clicked ()
 {
        if (!_film) {
                return;
        }
        
-       _film->set_dcp_video_frame_rate (_film->best_dcp_video_frame_rate ());
+       _film->set_video_frame_rate (_film->best_video_frame_rate ());
 }
 
 void
@@ -828,10 +742,22 @@ FilmEditor::setup_content ()
        ContentList content = _film->content ();
        for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
                int const t = _content->GetItemCount ();
-               _content->InsertItem (t, std_to_wx ((*i)->summary ()));
+               bool const valid = (*i)->paths_valid ();
+
+               string s = (*i)->summary ();
+               if (!valid) {
+                       s = _("MISSING: ") + s;
+               }
+                       
+               _content->InsertItem (t, std_to_wx (s));
+
                if ((*i)->summary() == selected_summary) {
                        _content->SetItemState (t, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
                }
+
+               if (!valid) {
+                       _content->SetItemTextColour (t, *wxRED);
+               }
        }
 
        if (selected_summary.empty () && !content.empty ()) {
@@ -841,203 +767,182 @@ FilmEditor::setup_content ()
 }
 
 void
-FilmEditor::content_add_clicked (wxCommandEvent &)
+FilmEditor::content_add_file_clicked ()
 {
-       wxFileDialog* d = new wxFileDialog (this, _("Choose a file or files"), wxT (""), wxT (""), wxT ("*.*"), wxFD_MULTIPLE);
+       /* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using
+          non-Latin filenames or paths.
+       */
+       wxFileDialog* d = new wxFileDialog (this, _("Choose a file or files"), wxT (""), wxT (""), wxT ("*.*"), wxFD_MULTIPLE | wxFD_CHANGE_DIR);
        int const r = d->ShowModal ();
-       d->Destroy ();
 
        if (r != wxID_OK) {
+               d->Destroy ();
                return;
        }
 
        wxArrayString paths;
        d->GetPaths (paths);
 
+       /* XXX: check for lots of files here and do something */
+
        for (unsigned int i = 0; i < paths.GetCount(); ++i) {
-               boost::filesystem::path p (wx_to_std (paths[i]));
+               _film->examine_and_add_content (content_factory (_film, wx_to_std (paths[i])));
+       }
 
-               shared_ptr<Content> c;
+       d->Destroy ();
+}
 
-               if (StillImageContent::valid_file (p)) {
-                       c.reset (new StillImageContent (_film, p));
-               } else if (SndfileContent::valid_file (p)) {
-                       c.reset (new SndfileContent (_film, p));
-               } else {
-                       c.reset (new FFmpegContent (_film, p));
-               }
+void
+FilmEditor::content_add_folder_clicked ()
+{
+       wxDirDialog* d = new wxDirDialog (this, _("Choose a folder"), wxT (""), wxDD_DIR_MUST_EXIST);
+       int const r = d->ShowModal ();
+       d->Destroy ();
+       
+       if (r != wxID_OK) {
+               return;
+       }
 
-               _film->examine_and_add_content (c);
+       shared_ptr<ImageContent> ic;
+       
+       try {
+               ic.reset (new ImageContent (_film, boost::filesystem::path (wx_to_std (d->GetPath ()))));
+       } catch (FileError& e) {
+               error_dialog (this, std_to_wx (e.what ()));
+               return;
        }
+
+       _film->examine_and_add_content (ic);
 }
 
 void
-FilmEditor::content_remove_clicked (wxCommandEvent &)
+FilmEditor::content_remove_clicked ()
 {
-       shared_ptr<Content> c = selected_content ();
-       if (c) {
-               _film->remove_content (c);
+       ContentList c = selected_content ();
+       if (c.size() == 1) {
+               _film->remove_content (c.front ());
        }
 
-       wxListEvent ev;
-       content_selection_changed (ev);
+       content_selection_changed ();
 }
 
 void
-FilmEditor::content_selection_changed (wxListEvent &)
+FilmEditor::content_selection_changed ()
 {
        setup_content_sensitivity ();
-       shared_ptr<Content> s = selected_content ();
 
-       _audio_panel->content_selection_changed ();
-       
-       film_content_changed (s, ContentProperty::START);
-       film_content_changed (s, ContentProperty::LENGTH);
-       film_content_changed (s, VideoContentProperty::VIDEO_CROP);
-       film_content_changed (s, VideoContentProperty::VIDEO_RATIO);
-       film_content_changed (s, AudioContentProperty::AUDIO_GAIN);
-       film_content_changed (s, AudioContentProperty::AUDIO_DELAY);
-       film_content_changed (s, AudioContentProperty::AUDIO_MAPPING);
-       film_content_changed (s, FFmpegContentProperty::AUDIO_STREAM);
-       film_content_changed (s, FFmpegContentProperty::AUDIO_STREAMS);
-       film_content_changed (s, FFmpegContentProperty::SUBTITLE_STREAM);
-       film_content_changed (s, FFmpegContentProperty::SUBTITLE_STREAMS);
-       film_content_changed (s, FFmpegContentProperty::FILTERS);
-       film_content_changed (s, SubtitleContentProperty::SUBTITLE_OFFSET);
-       film_content_changed (s, SubtitleContentProperty::SUBTITLE_SCALE);
+       for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+               (*i)->content_selection_changed ();
+       }
 }
 
+/** Set up broad sensitivity based on the type of content that is selected */
 void
 FilmEditor::setup_content_sensitivity ()
 {
-       _content_add->Enable (_generally_sensitive);
+       _content_add_file->Enable (_generally_sensitive);
+       _content_add_folder->Enable (_generally_sensitive);
 
-       shared_ptr<Content> selection = selected_content ();
+       ContentList selection = selected_content ();
+       VideoContentList video_selection = selected_video_content ();
+       AudioContentList audio_selection = selected_audio_content ();
 
-       _content_remove->Enable (selection && _generally_sensitive);
+       _content_remove->Enable   (selection.size() == 1 && _generally_sensitive);
+       _content_earlier->Enable  (selection.size() == 1 && _generally_sensitive);
+       _content_later->Enable    (selection.size() == 1 && _generally_sensitive);
        _content_timeline->Enable (_generally_sensitive);
 
-       _video_panel->Enable    (selection && dynamic_pointer_cast<VideoContent>  (selection) && _generally_sensitive);
-       _audio_panel->Enable    (selection && dynamic_pointer_cast<AudioContent>  (selection) && _generally_sensitive);
-       _subtitle_panel->Enable (selection && dynamic_pointer_cast<FFmpegContent> (selection) && _generally_sensitive);
-       _timing_panel->Enable   (selection && _generally_sensitive);
+       _video_panel->Enable    (video_selection.size() > 0 && _generally_sensitive);
+       _audio_panel->Enable    (audio_selection.size() > 0 && _generally_sensitive);
+       _subtitle_panel->Enable (selection.size() == 1 && dynamic_pointer_cast<SubtitleContent> (selection.front()) && _generally_sensitive);
+       _timing_panel->Enable   (selection.size() == 1 && _generally_sensitive);
 }
 
-shared_ptr<Content>
+ContentList
 FilmEditor::selected_content ()
 {
-       int const s = _content->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
-       if (s == -1) {
-               return shared_ptr<Content> ();
-       }
+       ContentList sel;
+       long int s = -1;
+       while (1) {
+               s = _content->GetNextItem (s, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+               if (s == -1) {
+                       break;
+               }
 
-       ContentList c = _film->content ();
-       if (s < 0 || size_t (s) >= c.size ()) {
-               return shared_ptr<Content> ();
+               if (s < int (_film->content().size ())) {
+                       sel.push_back (_film->content()[s]);
+               }
        }
-       
-       return c[s];
+
+       return sel;
 }
 
-shared_ptr<VideoContent>
+VideoContentList
 FilmEditor::selected_video_content ()
 {
-       shared_ptr<Content> c = selected_content ();
-       if (!c) {
-               return shared_ptr<VideoContent> ();
+       ContentList c = selected_content ();
+       VideoContentList vc;
+       
+       for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
+               shared_ptr<VideoContent> t = dynamic_pointer_cast<VideoContent> (*i);
+               if (t) {
+                       vc.push_back (t);
+               }
        }
 
-       return dynamic_pointer_cast<VideoContent> (c);
+       return vc;
 }
 
-shared_ptr<AudioContent>
+AudioContentList
 FilmEditor::selected_audio_content ()
 {
-       shared_ptr<Content> c = selected_content ();
-       if (!c) {
-               return shared_ptr<AudioContent> ();
+       ContentList c = selected_content ();
+       AudioContentList ac;
+       
+       for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
+               shared_ptr<AudioContent> t = dynamic_pointer_cast<AudioContent> (*i);
+               if (t) {
+                       ac.push_back (t);
+               }
        }
 
-       return dynamic_pointer_cast<AudioContent> (c);
+       return ac;
 }
 
-shared_ptr<SubtitleContent>
+SubtitleContentList
 FilmEditor::selected_subtitle_content ()
 {
-       shared_ptr<Content> c = selected_content ();
-       if (!c) {
-               return shared_ptr<SubtitleContent> ();
+       ContentList c = selected_content ();
+       SubtitleContentList sc;
+       
+       for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
+               shared_ptr<SubtitleContent> t = dynamic_pointer_cast<SubtitleContent> (*i);
+               if (t) {
+                       sc.push_back (t);
+               }
        }
 
-       return dynamic_pointer_cast<SubtitleContent> (c);
+       return sc;
 }
 
-void
-FilmEditor::setup_scaling_description ()
+FFmpegContentList
+FilmEditor::selected_ffmpeg_content ()
 {
-       shared_ptr<VideoContent> vc = selected_video_content ();
-       if (!vc) {
-               _scaling_description->SetLabel ("");
-               return;
-       }
-
-       wxString d;
-
-       int lines = 0;
-
-       if (vc->video_size().width && vc->video_size().height) {
-               d << wxString::Format (
-                       _("Original video is %dx%d (%.2f:1)\n"),
-                       vc->video_size().width, vc->video_size().height,
-                       float (vc->video_size().width) / vc->video_size().height
-                       );
-               ++lines;
-       }
-
-       Crop const crop = vc->crop ();
-       if ((crop.left || crop.right || crop.top || crop.bottom) && vc->video_size() != libdcp::Size (0, 0)) {
-               libdcp::Size cropped = vc->video_size ();
-               cropped.width -= crop.left + crop.right;
-               cropped.height -= crop.top + crop.bottom;
-               d << wxString::Format (
-                       _("Cropped to %dx%d (%.2f:1)\n"),
-                       cropped.width, cropped.height,
-                       float (cropped.width) / cropped.height
-                       );
-               ++lines;
-       }
-
-       Ratio const * ratio = vc->ratio ();
-       if (ratio) {
-               libdcp::Size container_size = _film->container()->size (_film->full_frame ());
-               
-               libdcp::Size const scaled = ratio->size (container_size);
-               d << wxString::Format (
-                       _("Scaled to %dx%d (%.2f:1)\n"),
-                       scaled.width, scaled.height,
-                       float (scaled.width) / scaled.height
-                       );
-               ++lines;
-
-               if (scaled != container_size) {
-                       d << wxString::Format (
-                               _("Padded with black to %dx%d (%.2f:1)\n"),
-                               container_size.width, container_size.height,
-                               float (container_size.width) / container_size.height
-                               );
-                       ++lines;
+       ContentList c = selected_content ();
+       FFmpegContentList sc;
+       
+       for (ContentList::iterator i = c.begin(); i != c.end(); ++i) {
+               shared_ptr<FFmpegContent> t = dynamic_pointer_cast<FFmpegContent> (*i);
+               if (t) {
+                       sc.push_back (t);
                }
        }
 
-       for (int i = lines; i < 4; ++i) {
-               d << wxT ("\n ");
-       }
-
-       _scaling_description->SetLabel (d);
+       return sc;
 }
 
 void
-FilmEditor::content_timeline_clicked (wxCommandEvent &)
+FilmEditor::content_timeline_clicked ()
 {
        if (_timeline_dialog) {
                _timeline_dialog->Destroy ();
@@ -1062,40 +967,53 @@ FilmEditor::set_selection (weak_ptr<Content> wc)
 }
 
 void
-FilmEditor::ratio_changed (wxCommandEvent &)
+FilmEditor::sequence_video_changed ()
 {
        if (!_film) {
                return;
        }
+       
+       _film->set_sequence_video (_sequence_video->GetValue ());
+}
 
-       shared_ptr<Content> c = selected_content ();
-       if (!c) {
-               return;
-       }
+void
+FilmEditor::content_right_click (wxListEvent& ev)
+{
+       _menu.popup (_film, selected_content (), ev.GetPoint ());
+}
 
-       shared_ptr<VideoContent> vc = dynamic_pointer_cast<VideoContent> (c);
-       if (!vc) {
+void
+FilmEditor::three_d_changed ()
+{
+       if (!_film) {
                return;
        }
-       
-       int const n = _ratio->GetSelection ();
-       if (n >= 0) {
-               vector<Ratio const *> ratios = Ratio::all ();
-               assert (n < int (ratios.size()));
-               vc->set_ratio (ratios[n]);
+
+       _film->set_three_d (_three_d->GetValue ());
+}
+
+void
+FilmEditor::content_earlier_clicked ()
+{
+       ContentList sel = selected_content ();
+       if (sel.size() == 1) {
+               _film->move_content_earlier (sel.front ());
+               content_selection_changed ();
        }
 }
 
 void
-FilmEditor::sequence_video_changed (wxCommandEvent &)
+FilmEditor::content_later_clicked ()
 {
-       _film->set_sequence_video (_sequence_video->GetValue ());
+       ContentList sel = selected_content ();
+       if (sel.size() == 1) {
+               _film->move_content_later (sel.front ());
+               content_selection_changed ();
+       }
 }
 
 void
-FilmEditor::content_right_click (wxListEvent& ev)
+FilmEditor::config_changed ()
 {
-       ContentList cl;
-       cl.push_back (selected_content ());
-       _menu.popup (cl, ev.GetPoint ());
+       _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
 }