Merge master.
[dcpomatic.git] / src / wx / film_editor.cc
index 6f08b656768af6f3b95205158ff9f665517c97d9..177202d25264cf2dec6700c1484c7017780720ec 100644 (file)
@@ -1,3 +1,5 @@
+/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
+
 /*
     Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
 
@@ -50,7 +52,8 @@
 #include "scaler.h"
 #include "audio_dialog.h"
 #include "imagemagick_content_dialog.h"
-#include "audio_mapping_view.h"
+#include "ffmpeg_content_dialog.h"
+#include "timeline_dialog.h"
 
 using std::string;
 using std::cout;
@@ -60,6 +63,7 @@ using std::fixed;
 using std::setprecision;
 using std::list;
 using std::vector;
+using std::max;
 using boost::shared_ptr;
 using boost::weak_ptr;
 using boost::dynamic_pointer_cast;
@@ -70,6 +74,7 @@ FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
        : wxPanel (parent)
        , _generally_sensitive (true)
        , _audio_dialog (0)
+       , _timeline_dialog (0)
 {
        wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
        _notebook = new wxNotebook (this, wxID_ANY);
@@ -86,6 +91,8 @@ FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
        make_subtitle_panel ();
        _notebook->AddPage (_subtitle_panel, _("Subtitles"), false);
 
+       setup_formats ();
+
        set_film (f);
        connect_to_widgets ();
 
@@ -93,8 +100,6 @@ FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
                bind (&FilmEditor::active_jobs_changed, this, _1)
                );
        
-       setup_formats ();
-
        SetSizerAndFit (s);
 }
 
@@ -126,7 +131,7 @@ FilmEditor::make_film_panel ()
        grid->Add (_edit_dci_button, wxGBPosition (r, 1), wxDefaultSpan);
        ++r;
 
-       _trust_content_headers = new wxCheckBox (_film_panel, wxID_ANY, _("Trust content's header"));
+       _trust_content_headers = new wxCheckBox (_film_panel, wxID_ANY, _("Trust content headers"));
        grid->Add (_trust_content_headers, wxGBPosition (r, 0), wxGBSpan(1, 2));
        ++r;
 
@@ -146,7 +151,7 @@ FilmEditor::make_film_panel ()
        }
        ++r;
 
-       _frame_rate_description = new wxStaticText (_film_panel, wxID_ANY, wxT (" \n "), wxDefaultPosition, wxDefaultSize);
+       _frame_rate_description = new wxStaticText (_film_panel, wxID_ANY, wxT ("\n \n "), wxDefaultPosition, wxDefaultSize);
        grid->Add (_frame_rate_description, wxGBPosition (r, 0), wxGBSpan (1, 2), wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6);
        wxFont font = _frame_rate_description->GetFont();
        font.SetStyle(wxFONTSTYLE_ITALIC);
@@ -159,19 +164,9 @@ FilmEditor::make_film_panel ()
        grid->Add (_length, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
        ++r;
 
-
-       {
-               add_label_to_grid_bag_sizer (grid, _film_panel, _("Trim frames"), wxGBPosition (r, 0));
-               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-               add_label_to_sizer (s, _film_panel, _("Start"));
-               _trim_start = new wxSpinCtrl (_film_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
-               s->Add (_trim_start);
-               add_label_to_sizer (s, _film_panel, _("End"));
-               _trim_end = new wxSpinCtrl (_film_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
-               s->Add (_trim_end);
-
-               grid->Add (s, wxGBPosition (r, 1));
-       }
+       add_label_to_grid_bag_sizer (grid, _film_panel, _("Trim method"), wxGBPosition (r, 0));
+       _trim_type = new wxChoice (_film_panel, wxID_ANY);
+       grid->Add (_trim_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
        ++r;
 
        _ab = new wxCheckBox (_film_panel, wxID_ANY, _("A/B"));
@@ -187,49 +182,50 @@ FilmEditor::make_film_panel ()
        for (list<int>::const_iterator i = dfr.begin(); i != dfr.end(); ++i) {
                _dcp_frame_rate->Append (std_to_wx (boost::lexical_cast<string> (*i)));
        }
+
+       _trim_type->Append (_("encode all frames and play the subset"));
+       _trim_type->Append (_("encode only the subset"));
 }
 
 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);
-       _format->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::format_changed), 0, this);
-       _trust_content_headers->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::trust_content_headers_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_ACTIVATED, wxListEventHandler (FilmEditor::content_activated), 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_edit->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::content_edit_clicked), 0, this);
-       _content_earlier->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::content_earlier_clicked), 0, this);
-       _content_later->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::content_later_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);
-       _ab->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::ab_toggled), 0, this);
-       _trim_start->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::trim_start_changed), 0, this);
-       _trim_end->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::trim_end_changed), 0, this);
-       _with_subtitles->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::with_subtitles_toggled), 0, this);
-       _subtitle_offset->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_offset_changed), 0, this);
-       _subtitle_scale->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_scale_changed), 0, this);
-       _colour_lut->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::colour_lut_changed), 0, this);
-       _j2k_bandwidth->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::j2k_bandwidth_changed), 0, this);
-       _ffmpeg_subtitle_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::ffmpeg_subtitle_stream_changed), 0, this);
-       _ffmpeg_audio_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::ffmpeg_audio_stream_changed), 0, this);
-       _audio_gain->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_gain_changed), 0, this);
+       _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);
+       _format->Connect                 (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::format_changed), 0, this);
+       _trust_content_headers->Connect  (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED,     wxCommandEventHandler (FilmEditor::trust_content_headers_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_ACTIVATED,  wxListEventHandler    (FilmEditor::content_activated), 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_properties->Connect     (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,       wxCommandEventHandler (FilmEditor::content_properties_clicked), 0, this);
+       _content_timeline->Connect       (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,       wxCommandEventHandler (FilmEditor::content_timeline_clicked), 0, this);
+       _loop_content->Connect           (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED,     wxCommandEventHandler (FilmEditor::loop_content_toggled), 0, this);
+       _loop_count->Connect             (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::loop_count_changed), 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);
+       _ab->Connect                     (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED,     wxCommandEventHandler (FilmEditor::ab_toggled), 0, this);
+       _trim_type->Connect              (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::trim_type_changed), 0, this);
+       _with_subtitles->Connect         (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED,     wxCommandEventHandler (FilmEditor::with_subtitles_toggled), 0, this);
+       _subtitle_offset->Connect        (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::subtitle_offset_changed), 0, this);
+       _subtitle_scale->Connect         (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::subtitle_scale_changed), 0, this);
+       _colour_lut->Connect             (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED,      wxCommandEventHandler (FilmEditor::colour_lut_changed), 0, this);
+       _j2k_bandwidth->Connect          (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::j2k_bandwidth_changed), 0, this);
+       _audio_gain->Connect             (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::audio_gain_changed), 0, this);
        _audio_gain_calculate_button->Connect (
                wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::audio_gain_calculate_button_clicked), 0, this
                );
-       _show_audio->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::show_audio_clicked), 0, this);
-       _audio_delay->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_delay_changed), 0, this);
+       _show_audio->Connect             (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,       wxCommandEventHandler (FilmEditor::show_audio_clicked), 0, this);
+       _audio_delay->Connect            (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED,     wxCommandEventHandler (FilmEditor::audio_delay_changed), 0, this);
 }
 
 void
@@ -248,14 +244,6 @@ FilmEditor::make_video_panel ()
        grid->Add (_format, wxGBPosition (r, 1));
        ++r;
 
-       _format_description = new wxStaticText (_video_panel, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize);
-       grid->Add (_format_description, wxGBPosition (r, 0), wxGBSpan (1, 2), wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6);
-       wxFont font = _format_description->GetFont();
-       font.SetStyle(wxFONTSTYLE_ITALIC);
-       font.SetPointSize(font.GetPointSize() - 1);
-       _format_description->SetFont(font);
-       ++r;
-
        add_label_to_grid_bag_sizer (grid, _video_panel, _("Left crop"), wxGBPosition (r, 0));
        _left_crop = new wxSpinCtrl (_video_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
        grid->Add (_left_crop, wxGBPosition (r, 1));
@@ -276,6 +264,14 @@ FilmEditor::make_video_panel ()
        grid->Add (_bottom_crop, 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"), wxGBPosition (r, 0));
@@ -321,8 +317,6 @@ FilmEditor::make_video_panel ()
        _top_crop->SetRange (0, 1024);
        _right_crop->SetRange (0, 1024);
        _bottom_crop->SetRange (0, 1024);
-       _trim_start->SetRange (0, 100);
-       _trim_end->SetRange (0, 100);
        _j2k_bandwidth->SetRange (50, 250);
 }
 
@@ -344,23 +338,31 @@ FilmEditor::make_content_panel ()
 
                 wxBoxSizer* b = new wxBoxSizer (wxVERTICAL);
                 _content_add = new wxButton (_content_panel, wxID_ANY, _("Add..."));
-                b->Add (_content_add);
+                b->Add (_content_add, 1, wxEXPAND | wxLEFT | wxRIGHT);
                 _content_remove = new wxButton (_content_panel, wxID_ANY, _("Remove"));
-                b->Add (_content_remove);
-                _content_edit = new wxButton (_content_panel, wxID_ANY, _("Edit..."));
-                b->Add (_content_edit);
-                _content_earlier = new wxButton (_content_panel, wxID_ANY, _("Earlier"));
-                b->Add (_content_earlier);
-                _content_later = new wxButton (_content_panel, wxID_ANY, _("Later"));
-                b->Add (_content_later);
+                b->Add (_content_remove, 1, wxEXPAND | wxLEFT | wxRIGHT);
+                _content_properties = new wxButton (_content_panel, wxID_ANY, _("Properties..."));
+                b->Add (_content_properties);
+               _content_timeline = new wxButton (_content_panel, wxID_ANY, _("Timeline..."));
+               b->Add (_content_timeline, 1, wxEXPAND | wxLEFT | wxRIGHT);
 
                 s->Add (b, 0, wxALL, 4);
 
-                _content_sizer->Add (s, 1, wxEXPAND | wxALL, 6);
+                _content_sizer->Add (s, 0.75, wxEXPAND | wxALL, 6);
         }
 
-       _content_information = new wxTextCtrl (_content_panel, wxID_ANY, wxT ("\n\n\n\n"), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_MULTILINE);
+       _content_information = new wxTextCtrl (_content_panel, wxID_ANY, wxT ("\n \n "), wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_MULTILINE);
        _content_sizer->Add (_content_information, 1, wxEXPAND | wxALL, 6);
+
+       wxBoxSizer* h = new wxBoxSizer (wxHORIZONTAL);
+       _loop_content = new wxCheckBox (_content_panel, wxID_ANY, _("Loop everything"));
+       h->Add (_loop_content, 0, wxALL, 6);
+       _loop_count = new wxSpinCtrl (_content_panel, wxID_ANY);
+       h->Add (_loop_count, 0, wxALL, 6);
+       add_label_to_sizer (h, _content_panel, _("times"));
+       _content_sizer->Add (h, 0, wxALL, 6);
+
+       _loop_count->SetRange (2, 1024);
 }
 
 void
@@ -398,19 +400,6 @@ FilmEditor::make_audio_panel ()
                grid->Add (s);
        }
 
-        {
-                add_label_to_sizer (grid, _audio_panel, _("Audio Stream"));
-                wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-                _ffmpeg_audio_stream = new wxChoice (_audio_panel, wxID_ANY);
-                s->Add (_ffmpeg_audio_stream, 1);
-                _audio = new wxStaticText (_audio_panel, wxID_ANY, wxT (""));
-                s->Add (_audio, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8);
-                grid->Add (s, 1, wxEXPAND);
-        }
-
-       _audio_mapping = new AudioMappingView (_audio_panel);
-       _audio_sizer->Add (_audio_mapping, 1, wxEXPAND | wxALL, 6);
-       
        _audio_gain->SetRange (-60, 60);
        _audio_delay->SetRange (-1000, 1000);
 }
@@ -426,13 +415,16 @@ FilmEditor::make_subtitle_panel ()
 
        _with_subtitles = new wxCheckBox (_subtitle_panel, wxID_ANY, _("With Subtitles"));
        grid->Add (_with_subtitles, 1);
+       grid->AddSpacer (0);
        
-       _ffmpeg_subtitle_stream = new wxChoice (_subtitle_panel, wxID_ANY);
-       grid->Add (_ffmpeg_subtitle_stream);
-
-       add_label_to_sizer (grid, _subtitle_panel, _("Subtitle Offset"));
-       _subtitle_offset = new wxSpinCtrl (_subtitle_panel);
-       grid->Add (_subtitle_offset, 1);
+       {
+               add_label_to_sizer (grid, _subtitle_panel, _("Subtitle Offset"));
+               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               _subtitle_offset = new wxSpinCtrl (_subtitle_panel);
+               s->Add (_subtitle_offset);
+               add_label_to_sizer (s, _subtitle_panel, _("pixels"));
+               grid->Add (s);
+       }
 
        {
                add_label_to_sizer (grid, _subtitle_panel, _("Subtitle Scale"));
@@ -570,7 +562,7 @@ FilmEditor::dcp_frame_rate_changed (wxCommandEvent &)
                return;
        }
 
-       _film->set_dcp_frame_rate (
+       _film->set_dcp_video_frame_rate (
                boost::lexical_cast<int> (
                        wx_to_std (_dcp_frame_rate->GetString (_dcp_frame_rate->GetSelection ()))
                        )
@@ -601,10 +593,14 @@ FilmEditor::film_changed (Film::Property p)
                setup_formats ();
                setup_format ();
                setup_subtitle_control_sensitivity ();
-               setup_streams ();
                setup_show_audio_sensitivity ();
                setup_length ();
                break;
+       case Film::LOOP:
+               checked_set (_loop_content, _film->loop() > 1);
+               checked_set (_loop_count, _film->loop());
+               setup_loop_sensitivity ();
+               break;
        case Film::TRUST_CONTENT_HEADERS:
                checked_set (_trust_content_headers, _film->trust_content_headers ());
                break;
@@ -616,6 +612,7 @@ FilmEditor::film_changed (Film::Property p)
                checked_set (_right_crop, _film->crop().right);
                checked_set (_top_crop, _film->crop().top);
                checked_set (_bottom_crop, _film->crop().bottom);
+               setup_scaling_description ();
                break;
        case Film::FILTERS:
        {
@@ -643,11 +640,8 @@ FilmEditor::film_changed (Film::Property p)
        case Film::SCALER:
                checked_set (_scaler, Scaler::as_index (_film->scaler ()));
                break;
-       case Film::TRIM_START:
-               checked_set (_trim_start, _film->trim_start());
-               break;
-       case Film::TRIM_END:
-               checked_set (_trim_end, _film->trim_end());
+       case Film::TRIM_TYPE:
+               checked_set (_trim_type, _film->trim_type() == Film::CPL ? 0 : 1);
                break;
        case Film::AUDIO_GAIN:
                checked_set (_audio_gain, _film->audio_gain ());
@@ -679,28 +673,26 @@ FilmEditor::film_changed (Film::Property p)
        case Film::DCI_METADATA:
                setup_dcp_name ();
                break;
-       case Film::DCP_FRAME_RATE:
+       case Film::DCP_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_frame_rate())) {
-                               if (_dcp_frame_rate->GetSelection() != int(i)) {
-                                       _dcp_frame_rate->SetSelection (i);
-                                       break;
-                               }
+                       if (wx_to_std (_dcp_frame_rate->GetString(i)) == boost::lexical_cast<string> (_film->dcp_video_frame_rate())) {
+                               checked_set (_dcp_frame_rate, i);
+                               done = true;
+                               break;
                        }
                }
 
-               if (_film->video_frame_rate()) {
-                       _frame_rate_description->SetLabel (std_to_wx (FrameRateConversion (_film->video_frame_rate(), _film->dcp_frame_rate()).description));
-                       _best_dcp_frame_rate->Enable (best_dcp_frame_rate (_film->video_frame_rate ()) != _film->dcp_frame_rate ());
-               } else {
-                       _frame_rate_description->SetLabel (wxT (""));
-                       _best_dcp_frame_rate->Disable ();
+               if (!done) {
+                       checked_set (_dcp_frame_rate, -1);
                }
-               break;
-       case Film::AUDIO_MAPPING:
-               _audio_mapping->set_mapping (_film->audio_mapping ());
+
+               _best_dcp_frame_rate->Enable (_film->best_dcp_video_frame_rate () != _film->dcp_video_frame_rate ());
+               setup_frame_rate_description ();
                break;
        }
+       }
 }
 
 void
@@ -715,27 +707,17 @@ FilmEditor::film_content_changed (weak_ptr<Content> content, int property)
                
        if (property == FFmpegContentProperty::SUBTITLE_STREAMS) {
                setup_subtitle_control_sensitivity ();
-               setup_streams ();
        } else if (property == FFmpegContentProperty::AUDIO_STREAMS) {
-               setup_streams ();
                setup_show_audio_sensitivity ();
-       } else if (property == VideoContentProperty::VIDEO_LENGTH) {
+       } else if (property == VideoContentProperty::VIDEO_LENGTH || property == AudioContentProperty::AUDIO_LENGTH) {
                setup_length ();
                boost::shared_ptr<Content> c = content.lock ();
-               if (c && c == selected_content()) {
+               if (selected_content() && c == selected_content()) {
                        setup_content_information ();
                }
        } else if (property == FFmpegContentProperty::AUDIO_STREAM) {
-               if (_film->ffmpeg_audio_stream()) {
-                       checked_set (_ffmpeg_audio_stream, boost::lexical_cast<string> (_film->ffmpeg_audio_stream()->id));
-               }
                setup_dcp_name ();
-               setup_audio_details ();
                setup_show_audio_sensitivity ();
-       } else if (property == FFmpegContentProperty::SUBTITLE_STREAM) {
-               if (_film->ffmpeg_subtitle_stream()) {
-                       checked_set (_ffmpeg_subtitle_stream, boost::lexical_cast<string> (_film->ffmpeg_subtitle_stream()->id));
-               }
        }
 }
 
@@ -748,38 +730,56 @@ FilmEditor::setup_format ()
                ++i;
                ++n;
        }
+       
        if (i == _formats.end()) {
                checked_set (_format, -1);
        } else {
                checked_set (_format, n);
        }
-       setup_dcp_name ();
        
-       if (_film->format ()) {
-               _format_description->SetLabel (std_to_wx (_film->format()->description ()));
-       } else {
-               _format_description->SetLabel (wxT (""));
-       }
+       setup_dcp_name ();
+       setup_scaling_description ();
 }      
 
 void
 FilmEditor::setup_length ()
 {
        stringstream s;
-       if (_film->video_frame_rate() > 0 && _film->video_length()) {
-               s << _film->video_length() << " "
-                 << wx_to_std (_("frames")) << "; " << seconds_to_hms (_film->video_length() / _film->video_frame_rate());
-       } else if (_film->video_length()) {
-               s << _film->video_length() << " "
-                 << wx_to_std (_("frames"));
-       } 
+       Time const length = _film->length ();
+       
+       s << time_to_hms (length);
        _length->SetLabel (std_to_wx (s.str ()));
-       if (_film->video_length()) {
-               _trim_start->SetRange (0, _film->video_length());
-               _trim_end->SetRange (0, _film->video_length());
-       }
 }      
 
+void
+FilmEditor::setup_frame_rate_description ()
+{
+       wxString d;
+       int lines = 0;
+
+#if 0
+       XXX
+               
+       if (_film->video_frame_rate()) {
+               d << std_to_wx (FrameRateConversion (_film->video_frame_rate(), _film->dcp_frame_rate()).description);
+               ++lines;
+               if (_film->audio_frame_rate() && _film->audio_frame_rate() != _film->target_audio_sample_rate ()) {
+                       d << wxString::Format (
+                               _("Audio will be resampled from %dHz to %dHz\n"),
+                               _film->audio_frame_rate(),
+                               _film->target_audio_sample_rate()
+                               );
+                       ++lines;
+               }
+       }
+#endif 
+
+       for (int i = lines; i < 2; ++i) {
+               d << wxT ("\n ");
+       }
+
+       _frame_rate_description->SetLabel (d);
+}
 
 /** Called when the format widget has been changed */
 void
@@ -814,14 +814,14 @@ FilmEditor::dcp_content_type_changed (wxCommandEvent &)
 void
 FilmEditor::set_film (shared_ptr<Film> f)
 {
+       set_things_sensitive (f != 0);
+
        if (_film == f) {
                return;
        }
        
        _film = f;
 
-       set_things_sensitive (_film != 0);
-
        if (_film) {
                _film->Changed.connect (bind (&FilmEditor::film_changed, this, _1));
                _film->ContentChanged.connect (bind (&FilmEditor::film_content_changed, this, _1, _2));
@@ -840,6 +840,7 @@ FilmEditor::set_film (shared_ptr<Film> f)
        film_changed (Film::NAME);
        film_changed (Film::USE_DCI_NAME);
        film_changed (Film::CONTENT);
+       film_changed (Film::LOOP);
        film_changed (Film::TRUST_CONTENT_HEADERS);
        film_changed (Film::DCP_CONTENT_TYPE);
        film_changed (Film::FORMAT);
@@ -849,6 +850,7 @@ FilmEditor::set_film (shared_ptr<Film> f)
        film_changed (Film::TRIM_START);
        film_changed (Film::TRIM_END);
        film_changed (Film::AB);
+       film_changed (Film::TRIM_TYPE);
        film_changed (Film::AUDIO_GAIN);
        film_changed (Film::AUDIO_DELAY);
        film_changed (Film::WITH_SUBTITLES);
@@ -857,13 +859,14 @@ FilmEditor::set_film (shared_ptr<Film> f)
        film_changed (Film::COLOUR_LUT);
        film_changed (Film::J2K_BANDWIDTH);
        film_changed (Film::DCI_METADATA);
-       film_changed (Film::DCP_FRAME_RATE);
-       film_changed (Film::AUDIO_MAPPING);
+       film_changed (Film::DCP_VIDEO_FRAME_RATE);
 
        film_content_changed (boost::shared_ptr<Content> (), FFmpegContentProperty::SUBTITLE_STREAMS);
        film_content_changed (boost::shared_ptr<Content> (), FFmpegContentProperty::SUBTITLE_STREAM);
        film_content_changed (boost::shared_ptr<Content> (), FFmpegContentProperty::AUDIO_STREAMS);
        film_content_changed (boost::shared_ptr<Content> (), FFmpegContentProperty::AUDIO_STREAM);
+
+       setup_content_information ();
 }
 
 /** Updates the sensitivity of lots of widgets to a given value.
@@ -887,12 +890,11 @@ FilmEditor::set_things_sensitive (bool s)
        _bottom_crop->Enable (s);
        _filters_button->Enable (s);
        _scaler->Enable (s);
-       _ffmpeg_audio_stream->Enable (s);
        _dcp_content_type->Enable (s);
+       _best_dcp_frame_rate->Enable (s);
        _dcp_frame_rate->Enable (s);
-       _trim_start->Enable (s);
-       _trim_end->Enable (s);
        _ab->Enable (s);
+       _trim_type->Enable (s);
        _colour_lut->Enable (s);
        _j2k_bandwidth->Enable (s);
        _audio_gain->Enable (s);
@@ -950,23 +952,21 @@ FilmEditor::audio_delay_changed (wxCommandEvent &)
 }
 
 void
-FilmEditor::trim_start_changed (wxCommandEvent &)
-{
-       if (!_film) {
-               return;
-       }
-
-       _film->set_trim_start (_trim_start->GetValue ());
-}
-
-void
-FilmEditor::trim_end_changed (wxCommandEvent &)
+FilmEditor::setup_notebook_size ()
 {
-       if (!_film) {
-               return;
-       }
-
-       _film->set_trim_end (_trim_end->GetValue ());
+       _notebook->InvalidateBestSize ();
+       
+       _film_sizer->Layout ();
+       _film_sizer->SetSizeHints (_film_panel);
+       _video_sizer->Layout ();
+       _video_sizer->SetSizeHints (_video_panel);
+       _audio_sizer->Layout ();
+       _audio_sizer->SetSizeHints (_audio_panel);
+       _subtitle_sizer->Layout ();
+       _subtitle_sizer->SetSizeHints (_subtitle_panel);
+
+       _notebook->Fit ();
+       Fit ();
 }
 
 void
@@ -1024,7 +1024,7 @@ FilmEditor::setup_subtitle_control_sensitivity ()
 {
        bool h = false;
        if (_generally_sensitive && _film) {
-               h = !_film->ffmpeg_subtitle_streams().empty();
+               h = _film->has_subtitles ();
        }
        
        _with_subtitles->Enable (h);
@@ -1034,7 +1034,6 @@ FilmEditor::setup_subtitle_control_sensitivity ()
                j = _film->with_subtitles ();
        }
        
-       _ffmpeg_subtitle_stream->Enable (j);
        _subtitle_offset->Enable (j);
        _subtitle_scale->Enable (j);
 }
@@ -1062,91 +1061,6 @@ FilmEditor::edit_dci_button_clicked (wxCommandEvent &)
        d->Destroy ();
 }
 
-void
-FilmEditor::setup_streams ()
-{
-       if (!_film) {
-               return;
-       }
-       
-       _ffmpeg_audio_stream->Clear ();
-       vector<FFmpegAudioStream> a = _film->ffmpeg_audio_streams ();
-       for (vector<FFmpegAudioStream>::iterator i = a.begin(); i != a.end(); ++i) {
-               _ffmpeg_audio_stream->Append (std_to_wx (i->name), new wxStringClientData (std_to_wx (boost::lexical_cast<string> (i->id))));
-       }
-       
-       if (_film->ffmpeg_audio_stream()) {
-               checked_set (_ffmpeg_audio_stream, boost::lexical_cast<string> (_film->ffmpeg_audio_stream()->id));
-       }
-
-       _ffmpeg_subtitle_stream->Clear ();
-       vector<FFmpegSubtitleStream> s = _film->ffmpeg_subtitle_streams ();
-       for (vector<FFmpegSubtitleStream>::iterator i = s.begin(); i != s.end(); ++i) {
-               _ffmpeg_subtitle_stream->Append (std_to_wx (i->name), new wxStringClientData (std_to_wx (boost::lexical_cast<string> (i->id))));
-       }
-       
-       if (_film->ffmpeg_subtitle_stream()) {
-               checked_set (_ffmpeg_subtitle_stream, boost::lexical_cast<string> (_film->ffmpeg_subtitle_stream()->id));
-       } else {
-               _ffmpeg_subtitle_stream->SetSelection (wxNOT_FOUND);
-       }
-}
-
-void
-FilmEditor::ffmpeg_audio_stream_changed (wxCommandEvent &)
-{
-       if (!_film) {
-               return;
-       }
-
-       vector<FFmpegAudioStream> a = _film->ffmpeg_audio_streams ();
-       vector<FFmpegAudioStream>::iterator i = a.begin ();
-       string const s = string_client_data (_ffmpeg_audio_stream->GetClientObject (_ffmpeg_audio_stream->GetSelection ()));
-       while (i != a.end() && lexical_cast<string> (i->id) != s) {
-               ++i;
-       }
-
-       if (i != a.end ()) {
-               _film->set_ffmpeg_audio_stream (*i);
-       }
-}
-
-void
-FilmEditor::ffmpeg_subtitle_stream_changed (wxCommandEvent &)
-{
-       if (!_film) {
-               return;
-       }
-
-       vector<FFmpegSubtitleStream> a = _film->ffmpeg_subtitle_streams ();
-       vector<FFmpegSubtitleStream>::iterator i = a.begin ();
-       string const s = string_client_data (_ffmpeg_subtitle_stream->GetClientObject (_ffmpeg_subtitle_stream->GetSelection ()));
-       while (i != a.end() && lexical_cast<string> (i->id) != s) {
-               ++i;
-       }
-
-       if (i != a.end ()) {
-               _film->set_ffmpeg_subtitle_stream (*i);
-       }
-}
-
-void
-FilmEditor::setup_audio_details ()
-{
-       if (!_film->ffmpeg_audio_stream()) {
-               _audio->SetLabel (wxT (""));
-       } else {
-               stringstream s;
-               if (_film->audio_channels() == 1) {
-                       s << wx_to_std (_("1 channel"));
-               } else {
-                       s << _film->audio_channels() << " " << wx_to_std (_("channels"));
-               }
-               s << ", " << _film->audio_frame_rate() << wx_to_std (_("Hz"));
-               _audio->SetLabel (std_to_wx (s.str ()));
-       }
-}
-
 void
 FilmEditor::active_jobs_changed (bool a)
 {
@@ -1185,13 +1099,13 @@ FilmEditor::best_dcp_frame_rate_clicked (wxCommandEvent &)
                return;
        }
        
-       _film->set_dcp_frame_rate (best_dcp_frame_rate (_film->video_frame_rate ()));
+       _film->set_dcp_video_frame_rate (_film->best_dcp_video_frame_rate ());
 }
 
 void
 FilmEditor::setup_show_audio_sensitivity ()
 {
-       _show_audio->Enable (_film && _film->has_audio ());
+       _show_audio->Enable (_film);
 }
 
 void
@@ -1205,8 +1119,8 @@ FilmEditor::setup_content ()
        
        _content->DeleteAllItems ();
 
-       ContentList content = _film->content ();
-       for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
+       Playlist::ContentList content = _film->content ();
+       for (Playlist::ContentList::iterator i = content.begin(); i != content.end(); ++i) {
                int const t = _content->GetItemCount ();
                _content->InsertItem (t, std_to_wx ((*i)->summary ()));
                if ((*i)->summary() == selected_summary) {
@@ -1215,15 +1129,17 @@ FilmEditor::setup_content ()
        }
 
        if (selected_summary.empty () && !content.empty ()) {
-               /* Select the first item of content if non was selected before */
+               /* Select the item of content if non was selected before */
                _content->SetItemState (0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
        }
+
+       setup_content_information ();
 }
 
 void
 FilmEditor::content_add_clicked (wxCommandEvent &)
 {
-       wxFileDialog* d = new wxFileDialog (this);
+       wxFileDialog* d = new wxFileDialog (this, _("Choose a file or files"), wxT (""), wxT (""), wxT ("*.*"), wxFD_MULTIPLE);
        int const r = d->ShowModal ();
        d->Destroy ();
 
@@ -1231,16 +1147,20 @@ FilmEditor::content_add_clicked (wxCommandEvent &)
                return;
        }
 
-       boost::filesystem::path p (wx_to_std (d->GetPath()));
+       wxArrayString paths;
+       d->GetPaths (paths);
 
-       if (ImageMagickContent::valid_file (p)) {
-               _film->add_content (shared_ptr<ImageMagickContent> (new ImageMagickContent (p)));
-       } else if (SndfileContent::valid_file (p)) {
-               _film->add_content (shared_ptr<SndfileContent> (new SndfileContent (p)));
-       } else {
-               _film->add_content (shared_ptr<FFmpegContent> (new FFmpegContent (p)));
+       for (unsigned int i = 0; i < paths.GetCount(); ++i) {
+               boost::filesystem::path p (wx_to_std (paths[i]));
+
+               if (ImageMagickContent::valid_file (p)) {
+                       _film->add_content (shared_ptr<ImageMagickContent> (new ImageMagickContent (p)));
+               } else if (SndfileContent::valid_file (p)) {
+                       _film->add_content (shared_ptr<SndfileContent> (new SndfileContent (p)));
+               } else {
+                       _film->add_content (shared_ptr<FFmpegContent> (new FFmpegContent (p)));
+               }
        }
-       
 }
 
 void
@@ -1255,51 +1175,38 @@ FilmEditor::content_remove_clicked (wxCommandEvent &)
 void
 FilmEditor::content_activated (wxListEvent& ev)
 {
-       ContentList c = _film->content ();
+       Playlist::ContentList c = _film->content ();
        assert (ev.GetIndex() >= 0 && size_t (ev.GetIndex()) < c.size ());
 
-       edit_content (c[ev.GetIndex()]);
+       content_properties (c[ev.GetIndex()]);
 }
 
 void
-FilmEditor::content_edit_clicked (wxCommandEvent &)
+FilmEditor::content_properties_clicked (wxCommandEvent &)
 {
        shared_ptr<Content> c = selected_content ();
        if (!c) {
                return;
        }
 
-       edit_content (c);
+       content_properties (c);
 }
 
 void
-FilmEditor::edit_content (shared_ptr<Content> c)
+FilmEditor::content_properties (shared_ptr<Content> content)
 {
-       shared_ptr<ImageMagickContent> im = dynamic_pointer_cast<ImageMagickContent> (c);
-       if (im) {
-               ImageMagickContentDialog* d = new ImageMagickContentDialog (this, im);
+       shared_ptr<ImageMagickContent> ic = dynamic_pointer_cast<ImageMagickContent> (content);
+       if (ic) {
+               ImageMagickContentDialog* d = new ImageMagickContentDialog (this, ic);
                d->ShowModal ();
                d->Destroy ();
-
-               im->set_video_length (d->video_length() * 24);
        }
-}
 
-void
-FilmEditor::content_earlier_clicked (wxCommandEvent &)
-{
-       shared_ptr<Content> c = selected_content ();
-       if (c) {
-               _film->move_content_earlier (c);
-       }
-}
-
-void
-FilmEditor::content_later_clicked (wxCommandEvent &)
-{
-       shared_ptr<Content> c = selected_content ();
-       if (c) {
-               _film->move_content_later (c);
+       shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (content);
+       if (fc) {
+               FFmpegContentDialog* d = new FFmpegContentDialog (this, fc);
+               d->ShowModal ();
+               d->Destroy ();
        }
 }
 
@@ -1329,10 +1236,13 @@ FilmEditor::setup_content_button_sensitivity ()
 
        shared_ptr<Content> selection = selected_content ();
 
-        _content_edit->Enable (selection && _generally_sensitive && dynamic_pointer_cast<ImageMagickContent> (selection));
+        _content_properties->Enable (
+               selection && _generally_sensitive &&
+               (dynamic_pointer_cast<ImageMagickContent> (selection) || dynamic_pointer_cast<FFmpegContent> (selection))
+               );
+       
         _content_remove->Enable (selection && _generally_sensitive);
-        _content_earlier->Enable (selection && _generally_sensitive);
-        _content_later->Enable (selection && _generally_sensitive);
+       _content_timeline->Enable (_generally_sensitive);
 }
 
 shared_ptr<Content>
@@ -1343,7 +1253,111 @@ FilmEditor::selected_content ()
                return shared_ptr<Content> ();
        }
 
-       ContentList c = _film->content ();
-       assert (s >= 0 && size_t (s) < c.size ());
+       Playlist::ContentList c = _film->content ();
+       if (s < 0 || size_t (s) >= c.size ()) {
+               return shared_ptr<Content> ();
+       }
+       
        return c[s];
 }
+
+void
+FilmEditor::setup_scaling_description ()
+{
+       wxString d;
+
+#if 0  
+XXX
+       int lines = 0;
+
+       if (_film->video_size().width && _film->video_size().height) {
+               d << wxString::Format (
+                       _("Original video is %dx%d (%.2f:1)\n"),
+                       _film->video_size().width, _film->video_size().height,
+                       float (_film->video_size().width) / _film->video_size().height
+                       );
+               ++lines;
+       }
+
+       Crop const crop = _film->crop ();
+       if (crop.left || crop.right || crop.top || crop.bottom) {
+               libdcp::Size const cropped = _film->cropped_size (_film->video_size ());
+               d << wxString::Format (
+                       _("Cropped to %dx%d (%.2f:1)\n"),
+                       cropped.width, cropped.height,
+                       float (cropped.width) / cropped.height
+                       );
+               ++lines;
+       }
+
+       Format const * format = _film->format ();
+       if (format) {
+               int const padding = format->dcp_padding (_film);
+               libdcp::Size scaled = format->dcp_size ();
+               scaled.width -= padding * 2;
+               d << wxString::Format (
+                       _("Scaled to %dx%d (%.2f:1)\n"),
+                       scaled.width, scaled.height,
+                       float (scaled.width) / scaled.height
+                       );
+               ++lines;
+
+               if (padding) {
+                       d << wxString::Format (
+                               _("Padded with black to %dx%d (%.2f:1)\n"),
+                               format->dcp_size().width, format->dcp_size().height,
+                               float (format->dcp_size().width) / format->dcp_size().height
+                               );
+                       ++lines;
+               }
+       }
+
+       for (int i = lines; i < 4; ++i) {
+               d << wxT ("\n ");
+       }
+
+#endif 
+       _scaling_description->SetLabel (d);
+}
+
+void
+FilmEditor::trim_type_changed (wxCommandEvent &)
+{
+       _film->set_trim_type (_trim_type->GetSelection () == 0 ? Film::CPL : Film::ENCODE);
+}
+
+void
+FilmEditor::loop_content_toggled (wxCommandEvent &)
+{
+       if (_loop_content->GetValue ()) {
+               _film->set_loop (_loop_count->GetValue ());
+       } else {
+               _film->set_loop (1);
+       }
+               
+       setup_loop_sensitivity ();
+}
+
+void
+FilmEditor::loop_count_changed (wxCommandEvent &)
+{
+       _film->set_loop (_loop_count->GetValue ());
+}
+
+void
+FilmEditor::setup_loop_sensitivity ()
+{
+       _loop_count->Enable (_loop_content->GetValue ());
+}
+
+void
+FilmEditor::content_timeline_clicked (wxCommandEvent &)
+{
+       if (_timeline_dialog) {
+               _timeline_dialog->Destroy ();
+               _timeline_dialog = 0;
+       }
+       
+       _timeline_dialog = new TimelineDialog (this, _film);
+       _timeline_dialog->Show ();
+}