/*
- Copyright (C) 2012 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 <iomanip>
#include <wx/wx.h>
#include <wx/notebook.h>
+#include <wx/listctrl.h>
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
-#include "lib/format.h"
#include "lib/film.h"
#include "lib/transcode_job.h"
#include "lib/exceptions.h"
-#include "lib/ab_transcode_job.h"
#include "lib/job_manager.h"
#include "lib/filter.h"
+#include "lib/ratio.h"
#include "lib/config.h"
-#include "lib/ffmpeg_decoder.h"
-#include "lib/log.h"
-#include "filter_dialog.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 "wx_util.h"
#include "film_editor.h"
-#include "gain_calculator_dialog.h"
-#include "sound_processor.h"
-#include "dci_metadata_dialog.h"
-#include "scaler.h"
-#include "audio_dialog.h"
+#include "isdcf_metadata_dialog.h"
+#include "timeline_dialog.h"
+#include "timing_panel.h"
+#include "subtitle_panel.h"
+#include "audio_panel.h"
+#include "video_panel.h"
using std::string;
using std::cout;
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;
+using boost::lexical_cast;
/** @param f Film to edit */
FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
: wxPanel (parent)
- , _film (f)
+ , _menu (this)
, _generally_sensitive (true)
- , _audio_dialog (0)
+ , _timeline_dialog (0)
{
wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
- SetSizer (s);
- _notebook = new wxNotebook (this, wxID_ANY);
- s->Add (_notebook, 1);
-
- make_film_panel ();
- _notebook->AddPage (_film_panel, _("Film"), true);
- make_video_panel ();
- _notebook->AddPage (_video_panel, _("Video"), false);
- make_audio_panel ();
- _notebook->AddPage (_audio_panel, _("Audio"), false);
- make_subtitle_panel ();
- _notebook->AddPage (_subtitle_panel, _("Subtitles"), false);
-
- set_film (_film);
+
+ _main_notebook = new wxNotebook (this, wxID_ANY);
+ s->Add (_main_notebook, 1);
+
+ make_content_panel ();
+ _main_notebook->AddPage (_content_panel, _("Content"), true);
+ make_dcp_panel ();
+ _main_notebook->AddPage (_dcp_panel, _("DCP"), false);
+
+ 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));
- setup_visibility ();
- setup_formats ();
+ SetSizerAndFit (s);
}
void
-FilmEditor::make_film_panel ()
+FilmEditor::make_dcp_panel ()
{
- _film_panel = new wxPanel (_notebook);
- _film_sizer = new wxBoxSizer (wxVERTICAL);
- _film_panel->SetSizer (_film_sizer);
+ _dcp_panel = new wxPanel (_main_notebook);
+ _dcp_sizer = new wxBoxSizer (wxVERTICAL);
+ _dcp_panel->SetSizer (_dcp_sizer);
- wxGridBagSizer* grid = new wxGridBagSizer (4, 4);
- _film_sizer->Add (grid, 0, wxALL, 8);
+ wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ _dcp_sizer->Add (grid, 0, wxEXPAND | wxALL, 8);
int r = 0;
- add_label_to_grid_bag_sizer (grid, _film_panel, _("Name"), wxGBPosition (r, 0));
- _name = new wxTextCtrl (_film_panel, wxID_ANY);
- grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND);
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Name"), true, wxGBPosition (r, 0));
+ _name = new wxTextCtrl (_dcp_panel, wxID_ANY);
+ grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
++r;
- add_label_to_grid_bag_sizer (grid, _film_panel, _("DCP Name"), wxGBPosition (r, 0));
- _dcp_name = new wxStaticText (_film_panel, wxID_ANY, wxT (""));
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("DCP Name"), true, wxGBPosition (r, 0));
+ _dcp_name = new wxStaticText (_dcp_panel, wxID_ANY, wxT (""));
grid->Add (_dcp_name, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
++r;
- _use_dci_name = new wxCheckBox (_film_panel, wxID_ANY, _("Use DCI name"));
- grid->Add (_use_dci_name, wxGBPosition (r, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
- _edit_dci_button = new wxButton (_film_panel, wxID_ANY, _("Details..."));
- grid->Add (_edit_dci_button, wxGBPosition (r, 1), wxDefaultSpan);
- ++r;
+ int flags = wxALIGN_CENTER_VERTICAL;
+#ifdef __WXOSX__
+ flags |= wxALIGN_RIGHT;
+#endif
- add_label_to_grid_bag_sizer (grid, _film_panel, _("Content"), wxGBPosition (r, 0));
- _content = new wxFilePickerCtrl (_film_panel, wxID_ANY, wxT (""), _("Select Content File"), wxT("*.*"));
- grid->Add (_content, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
+ _use_isdcf_name = new wxCheckBox (_dcp_panel, wxID_ANY, _("Use ISDCF name"));
+ grid->Add (_use_isdcf_name, wxGBPosition (r, 0), wxDefaultSpan, flags);
+ _edit_isdcf_button = new wxButton (_dcp_panel, wxID_ANY, _("Details..."));
+ grid->Add (_edit_isdcf_button, wxGBPosition (r, 1), wxDefaultSpan);
++r;
- _trust_content_header = new wxCheckBox (_film_panel, wxID_ANY, _("Trust content's header"));
- video_control (_trust_content_header);
- grid->Add (_trust_content_header, wxGBPosition (r, 0), wxGBSpan(1, 2));
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Container"), true, wxGBPosition (r, 0));
+ _container = new wxChoice (_dcp_panel, wxID_ANY);
+ grid->Add (_container, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
++r;
- add_label_to_grid_bag_sizer (grid, _film_panel, _("Content Type"), wxGBPosition (r, 0));
- _dcp_content_type = new wxChoice (_film_panel, wxID_ANY);
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Content Type"), true, wxGBPosition (r, 0));
+ _dcp_content_type = new wxChoice (_dcp_panel, wxID_ANY);
grid->Add (_dcp_content_type, wxGBPosition (r, 1));
++r;
- video_control (add_label_to_grid_bag_sizer (grid, _film_panel, _("Original Frame Rate"), wxGBPosition (r, 0)));
- _source_frame_rate = new wxStaticText (_film_panel, wxID_ANY, wxT (""));
- grid->Add (video_control (_source_frame_rate), wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
- ++r;
-
{
- add_label_to_grid_bag_sizer (grid, _film_panel, _("DCP Frame Rate"), wxGBPosition (r, 0));
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _dcp_frame_rate = new wxChoice (_film_panel, wxID_ANY);
- s->Add (_dcp_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
- _best_dcp_frame_rate = new wxButton (_film_panel, wxID_ANY, _("Use best"));
- s->Add (_best_dcp_frame_rate, 1, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 6);
- grid->Add (s, wxGBPosition (r, 1));
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Frame Rate"), true, wxGBPosition (r, 0));
+ _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
+ _frame_rate_choice = new wxChoice (_dcp_panel, wxID_ANY);
+ _frame_rate_sizer->Add (_frame_rate_choice, 1, wxALIGN_CENTER_VERTICAL);
+ _frame_rate_spin = new wxSpinCtrl (_dcp_panel, wxID_ANY);
+ _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
+ setup_frame_rate_widget ();
+ _best_frame_rate = new wxButton (_dcp_panel, wxID_ANY, _("Use best"));
+ _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND);
+ grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
}
++r;
- _frame_rate_description = new wxStaticText (_film_panel, wxID_ANY, wxT ("\n \n "), wxDefaultPosition, wxDefaultSize);
- grid->Add (video_control (_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);
- font.SetPointSize(font.GetPointSize() - 1);
- _frame_rate_description->SetFont(font);
+ _burn_subtitles = new wxCheckBox (_dcp_panel, wxID_ANY, _("Burn subtitles into image"));
+ grid->Add (_burn_subtitles, wxGBPosition (r, 0), wxGBSpan (1, 2));
+ ++r;
+
+ _signed = new wxCheckBox (_dcp_panel, wxID_ANY, _("Signed"));
+ grid->Add (_signed, wxGBPosition (r, 0), wxGBSpan (1, 2));
++r;
- video_control (add_label_to_grid_bag_sizer (grid, _film_panel, _("Length"), wxGBPosition (r, 0)));
- _length = new wxStaticText (_film_panel, wxID_ANY, wxT (""));
- grid->Add (video_control (_length), wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+ _encrypted = new wxCheckBox (_dcp_panel, wxID_ANY, _("Encrypted"));
+ grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
++r;
-
- {
- video_control (add_label_to_grid_bag_sizer (grid, _film_panel, _("Trim frames"), wxGBPosition (r, 0)));
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- video_control (add_label_to_sizer (s, _film_panel, _("Start")));
- _trim_start = new wxSpinCtrl (_film_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
- s->Add (video_control (_trim_start));
- video_control (add_label_to_sizer (s, _film_panel, _("End")));
- _trim_end = new wxSpinCtrl (_film_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
- s->Add (video_control (_trim_end));
-
- grid->Add (s, wxGBPosition (r, 1));
- }
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Audio channels"), true, wxGBPosition (r, 0));
+ _audio_channels = new wxSpinCtrl (_dcp_panel, wxID_ANY);
+ grid->Add (_audio_channels, wxGBPosition (r, 1));
++r;
- video_control (add_label_to_grid_bag_sizer (grid, _film_panel, _("Trim method"), wxGBPosition (r, 0)));
- _trim_type = new wxChoice (_film_panel, wxID_ANY);
- grid->Add (video_control (_trim_type), wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+ _three_d = new wxCheckBox (_dcp_panel, wxID_ANY, _("3D"));
+ grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
++r;
- _dcp_ab = new wxCheckBox (_film_panel, wxID_ANY, _("A/B"));
- video_control (_dcp_ab);
- grid->Add (_dcp_ab, wxGBPosition (r, 0));
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("Resolution"), true, wxGBPosition (r, 0));
+ _resolution = new wxChoice (_dcp_panel, wxID_ANY);
+ grid->Add (_resolution, wxGBPosition (r, 1));
++r;
- /* STILL-only stuff */
{
- still_control (add_label_to_grid_bag_sizer (grid, _film_panel, _("Duration"), wxGBPosition (r, 0)));
+ add_label_to_grid_bag_sizer (grid, _dcp_panel, _("JPEG2000 bandwidth"), true, wxGBPosition (r, 0));
wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _still_duration = new wxSpinCtrl (_film_panel);
- still_control (_still_duration);
- s->Add (_still_duration, 1, wxEXPAND);
- /// TRANSLATORS: `s' here is an abbreviation for seconds, the unit of time
- still_control (add_label_to_sizer (s, _film_panel, _("s")));
+ _j2k_bandwidth = new wxSpinCtrl (_dcp_panel, wxID_ANY);
+ s->Add (_j2k_bandwidth, 1);
+ add_label_to_sizer (s, _dcp_panel, _("Mbit/s"), false);
grid->Add (s, wxGBPosition (r, 1));
}
++r;
- vector<DCPContentType const *> const ct = DCPContentType::all ();
- for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
- _dcp_content_type->Append (std_to_wx ((*i)->pretty_name ()));
- }
-
- 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)));
- }
-
- _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);
- _content->Connect (wxID_ANY, wxEVT_COMMAND_FILEPICKER_CHANGED, wxCommandEventHandler (FilmEditor::content_changed), 0, this);
- _trust_content_header->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::trust_content_header_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);
- _pad_with_silence->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::pad_with_silence_toggled), 0, this);
- _minimum_audio_channels->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::minimum_audio_channels_changed), 0, this);
- _dcp_ab->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::dcp_ab_toggled), 0, this);
- _still_duration->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::still_duration_changed), 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);
- _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);
- _subtitle_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::subtitle_stream_changed), 0, this);
- _audio_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::audio_stream_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);
- _use_content_audio->Connect (wxID_ANY, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler (FilmEditor::use_audio_changed), 0, this);
- _use_external_audio->Connect (wxID_ANY, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler (FilmEditor::use_audio_changed), 0, this);
- for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) {
- _external_audio[i]->Connect (
- wxID_ANY, wxEVT_COMMAND_FILEPICKER_CHANGED, wxCommandEventHandler (FilmEditor::external_audio_changed), 0, this
- );
- }
-}
-
-void
-FilmEditor::make_video_panel ()
-{
- _video_panel = new wxPanel (_notebook);
- _video_sizer = new wxBoxSizer (wxVERTICAL);
- _video_panel->SetSizer (_video_sizer);
-
- wxGridBagSizer* grid = new wxGridBagSizer (4, 4);
- _video_sizer->Add (grid, 0, wxALL, 8);
-
- int r = 0;
- add_label_to_grid_bag_sizer (grid, _video_panel, _("Format"), wxGBPosition (r, 0));
- _format = new wxChoice (_video_panel, wxID_ANY);
- grid->Add (_format, wxGBPosition (r, 1));
- ++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));
+ 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, _video_panel, _("Right crop"), 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"), 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"), wxGBPosition (r, 0));
- _bottom_crop = new wxSpinCtrl (_video_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
- 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 */
- {
- video_control (add_label_to_grid_bag_sizer (grid, _video_panel, _("Filters"), wxGBPosition (r, 0)));
- wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _filters = new wxStaticText (_video_panel, wxID_ANY, _("None"));
- video_control (_filters);
- s->Add (_filters, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
- _filters_button = new wxButton (_video_panel, wxID_ANY, _("Edit..."));
- video_control (_filters_button);
- s->Add (_filters_button, 0);
- grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
- }
- ++r;
-
- video_control (add_label_to_grid_bag_sizer (grid, _video_panel, _("Scaler"), wxGBPosition (r, 0)));
- _scaler = new wxChoice (_video_panel, wxID_ANY);
- grid->Add (video_control (_scaler), wxGBPosition (r, 1));
+ 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);
++r;
vector<Scaler const *> const sc = Scaler::all ();
_scaler->Append (std_to_wx ((*i)->name()));
}
- add_label_to_grid_bag_sizer (grid, _video_panel, _("Colour look-up table"), wxGBPosition (r, 0));
- _colour_lut = new wxChoice (_video_panel, wxID_ANY);
- for (int i = 0; i < 2; ++i) {
- _colour_lut->Append (std_to_wx (colour_lut_index_to_name (i)));
- }
- _colour_lut->SetSelection (0);
- grid->Add (_colour_lut, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
- ++r;
-
- {
- add_label_to_grid_bag_sizer (grid, _video_panel, _("JPEG2000 bandwidth"), wxGBPosition (r, 0));
- wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _j2k_bandwidth = new wxSpinCtrl (_video_panel, wxID_ANY);
- s->Add (_j2k_bandwidth, 1);
- add_label_to_sizer (s, _video_panel, _("MBps"));
- grid->Add (s, wxGBPosition (r, 1));
+ vector<Ratio const *> const ratio = Ratio::all ();
+ for (vector<Ratio const *>::const_iterator i = ratio.begin(); i != ratio.end(); ++i) {
+ _container->Append (std_to_wx ((*i)->nickname ()));
}
- ++r;
-
- _left_crop->SetRange (0, 1024);
- _top_crop->SetRange (0, 1024);
- _right_crop->SetRange (0, 1024);
- _bottom_crop->SetRange (0, 1024);
- _still_duration->SetRange (1, 60 * 60);
- _trim_start->SetRange (0, 24 * 60 * 60);
- _trim_end->SetRange (0, 24 * 60 * 60);
- _j2k_bandwidth->SetRange (50, 250);
-}
-void
-FilmEditor::make_audio_panel ()
-{
- _audio_panel = new wxPanel (_notebook);
- _audio_sizer = new wxBoxSizer (wxVERTICAL);
- _audio_panel->SetSizer (_audio_sizer);
-
- wxFlexGridSizer* grid = new wxFlexGridSizer (2, 4, 4);
- _audio_sizer->Add (grid, 0, wxALL, 8);
-
- _show_audio = new wxButton (_audio_panel, wxID_ANY, _("Show Audio..."));
- grid->Add (_show_audio, 1);
- grid->AddSpacer (0);
-
- {
- video_control (add_label_to_sizer (grid, _audio_panel, _("Audio Gain")));
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _audio_gain = new wxSpinCtrl (_audio_panel);
- s->Add (video_control (_audio_gain), 1);
- video_control (add_label_to_sizer (s, _audio_panel, _("dB")));
- _audio_gain_calculate_button = new wxButton (_audio_panel, wxID_ANY, _("Calculate..."));
- video_control (_audio_gain_calculate_button);
- s->Add (_audio_gain_calculate_button, 1, wxEXPAND);
- grid->Add (s);
- }
-
- {
- video_control (add_label_to_sizer (grid, _audio_panel, _("Audio Delay")));
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _audio_delay = new wxSpinCtrl (_audio_panel);
- s->Add (video_control (_audio_delay), 1);
- /// TRANSLATORS: this is an abbreviation for milliseconds, the unit of time
- video_control (add_label_to_sizer (s, _audio_panel, _("ms")));
- grid->Add (s);
- }
-
- {
- _pad_with_silence = new wxCheckBox (_audio_panel, wxID_ANY, _("Pad with silence to"));
- grid->Add (_pad_with_silence);
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _minimum_audio_channels = new wxSpinCtrl (_audio_panel);
- s->Add (_minimum_audio_channels, 1);
- add_label_to_sizer (s, _audio_panel, _("channels"));
- grid->Add (s);
+ vector<DCPContentType const *> const ct = DCPContentType::all ();
+ for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
+ _dcp_content_type->Append (std_to_wx ((*i)->pretty_name ()));
}
- {
- _use_content_audio = new wxRadioButton (_audio_panel, wxID_ANY, _("Use content's audio"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
- grid->Add (video_control (_use_content_audio));
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _audio_stream = new wxChoice (_audio_panel, wxID_ANY);
- s->Add (video_control (_audio_stream), 1);
- _audio = new wxStaticText (_audio_panel, wxID_ANY, wxT (""));
- s->Add (video_control (_audio), 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8);
- grid->Add (s, 1, wxEXPAND);
+ list<int> const dfr = Config::instance()->allowed_dcp_frame_rates ();
+ for (list<int>::const_iterator i = dfr.begin(); i != dfr.end(); ++i) {
+ _frame_rate_choice->Append (std_to_wx (boost::lexical_cast<string> (*i)));
}
- _use_external_audio = new wxRadioButton (_audio_panel, wxID_ANY, _("Use external audio"));
- grid->Add (_use_external_audio);
- grid->AddSpacer (0);
+ _audio_channels->SetRange (0, MAX_DCP_AUDIO_CHANNELS);
+ _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
+ _frame_rate_spin->SetRange (1, 480);
- for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) {
- add_label_to_sizer (grid, _audio_panel, std_to_wx (audio_channel_name (i)));
- _external_audio[i] = new wxFilePickerCtrl (_audio_panel, wxID_ANY, wxT (""), _("Select Audio File"), wxT ("*.wav"));
- grid->Add (_external_audio[i], 1, wxEXPAND);
- }
+ _resolution->Append (_("2K"));
+ _resolution->Append (_("4K"));
- _audio_gain->SetRange (-60, 60);
- _audio_delay->SetRange (-1000, 1000);
- _minimum_audio_channels->SetRange (0, MAX_AUDIO_CHANNELS);
+ _standard->Append (_("SMPTE"));
+ _standard->Append (_("Interop"));
}
void
-FilmEditor::make_subtitle_panel ()
+FilmEditor::connect_to_widgets ()
{
- _subtitle_panel = new wxPanel (_notebook);
- _subtitle_sizer = new wxBoxSizer (wxVERTICAL);
- _subtitle_panel->SetSizer (_subtitle_sizer);
- wxFlexGridSizer* grid = new wxFlexGridSizer (2, 4, 4);
- _subtitle_sizer->Add (grid, 0, wxALL, 8);
-
- _with_subtitles = new wxCheckBox (_subtitle_panel, wxID_ANY, _("With Subtitles"));
- video_control (_with_subtitles);
- grid->Add (_with_subtitles, 1);
-
- _subtitle_stream = new wxChoice (_subtitle_panel, wxID_ANY);
- grid->Add (video_control (_subtitle_stream));
-
- {
- video_control (add_label_to_sizer (grid, _subtitle_panel, _("Subtitle Offset")));
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _subtitle_offset = new wxSpinCtrl (_subtitle_panel);
- s->Add (_subtitle_offset);
- video_control (add_label_to_sizer (s, _subtitle_panel, _("pixels")));
- grid->Add (s);
- }
-
- {
- video_control (add_label_to_sizer (grid, _subtitle_panel, _("Subtitle Scale")));
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _subtitle_scale = new wxSpinCtrl (_subtitle_panel);
- s->Add (video_control (_subtitle_scale));
- video_control (add_label_to_sizer (s, _subtitle_panel, _("%")));
- grid->Add (s);
- }
-
- _subtitle_offset->SetRange (-1024, 1024);
- _subtitle_scale->SetRange (1, 1000);
+ _name->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&FilmEditor::name_changed, this));
+ _use_isdcf_name->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::use_isdcf_name_toggled, this));
+ _edit_isdcf_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::edit_isdcf_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_choice->Bind(wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::frame_rate_choice_changed, this));
+ _frame_rate_spin->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&FilmEditor::frame_rate_spin_changed, this));
+ _best_frame_rate->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::best_frame_rate_clicked, this));
+ _burn_subtitles->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&FilmEditor::burn_subtitles_toggled, 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));
}
-/** Called when the left crop widget has been changed */
void
-FilmEditor::left_crop_changed (wxCommandEvent &)
+FilmEditor::make_content_panel ()
{
- if (!_film) {
- return;
- }
+ _content_panel = new wxPanel (_main_notebook);
+ _content_sizer = new wxBoxSizer (wxVERTICAL);
+ _content_panel->SetSizer (_content_sizer);
- _film->set_left_crop (_left_crop->GetValue ());
+ {
+ wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+
+ _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);
+
+ wxBoxSizer* b = new wxBoxSizer (wxVERTICAL);
+ _content_add_file = new wxButton (_content_panel, wxID_ANY, _("Add file(s)..."));
+ b->Add (_content_add_file, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+ _content_add_folder = new wxButton (_content_panel, wxID_ANY, _("Add folder..."));
+ b->Add (_content_add_folder, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+ _content_remove = new wxButton (_content_panel, wxID_ANY, _("Remove"));
+ b->Add (_content_remove, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+ _content_earlier = new wxButton (_content_panel, wxID_ANY, _("Up"));
+ b->Add (_content_earlier, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+ _content_later = new wxButton (_content_panel, wxID_ANY, _("Down"));
+ b->Add (_content_later, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+ _content_timeline = new wxButton (_content_panel, wxID_ANY, _("Timeline..."));
+ b->Add (_content_timeline, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+
+ s->Add (b, 0, wxALL, 4);
+
+ _content_sizer->Add (s, 0, wxEXPAND | wxALL, 6);
+ }
+
+ _sequence_video = new wxCheckBox (_content_panel, wxID_ANY, _("Keep video in sequence"));
+ _content_sizer->Add (_sequence_video);
+
+ _content_notebook = new wxNotebook (_content_panel, wxID_ANY);
+ _content_sizer->Add (_content_notebook, 1, wxEXPAND | wxTOP, 6);
+
+ _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 right crop widget has been changed */
+/** Called when the name widget has been changed */
void
-FilmEditor::right_crop_changed (wxCommandEvent &)
+FilmEditor::name_changed ()
{
if (!_film) {
return;
}
- _film->set_right_crop (_right_crop->GetValue ());
+ _film->set_name (string (_name->GetValue().mb_str()));
}
-/** Called when the top crop widget has been changed */
void
-FilmEditor::top_crop_changed (wxCommandEvent &)
+FilmEditor::j2k_bandwidth_changed ()
{
if (!_film) {
return;
}
-
- _film->set_top_crop (_top_crop->GetValue ());
+
+ _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000);
}
-/** Called when the bottom crop value has been changed */
void
-FilmEditor::bottom_crop_changed (wxCommandEvent &)
+FilmEditor::signed_toggled ()
{
if (!_film) {
return;
}
- _film->set_bottom_crop (_bottom_crop->GetValue ());
+ _film->set_signed (_signed->GetValue ());
}
-/** Called when the content filename has been changed */
void
-FilmEditor::content_changed (wxCommandEvent &)
+FilmEditor::burn_subtitles_toggled ()
{
if (!_film) {
return;
}
- try {
- _film->set_content (wx_to_std (_content->GetPath ()));
- } catch (std::exception& e) {
- _content->SetPath (std_to_wx (_film->directory ()));
- error_dialog (this, wxString::Format (_("Could not set content: %s"), std_to_wx (e.what()).data()));
- }
+ _film->set_burn_subtitles (_burn_subtitles->GetValue ());
}
void
-FilmEditor::trust_content_header_changed (wxCommandEvent &)
+FilmEditor::encrypted_toggled ()
{
if (!_film) {
return;
}
- _film->set_trust_content_header (_trust_content_header->GetValue ());
+ _film->set_encrypted (_encrypted->GetValue ());
}
-
-/** Called when the DCP A/B switch has been toggled */
+
+/** Called when the frame rate choice widget has been changed */
void
-FilmEditor::dcp_ab_toggled (wxCommandEvent &)
+FilmEditor::frame_rate_choice_changed ()
{
if (!_film) {
return;
}
-
- _film->set_dcp_ab (_dcp_ab->GetValue ());
-}
-/** Called when the name widget has been changed */
-void
-FilmEditor::name_changed (wxCommandEvent &)
-{
- if (!_film) {
- return;
- }
-
- _film->set_name (string (_name->GetValue().mb_str()));
+ _film->set_video_frame_rate (
+ boost::lexical_cast<int> (
+ wx_to_std (_frame_rate_choice->GetString (_frame_rate_choice->GetSelection ()))
+ )
+ );
}
+/** Called when the frame rate spin widget has been changed */
void
-FilmEditor::subtitle_offset_changed (wxCommandEvent &)
+FilmEditor::frame_rate_spin_changed ()
{
if (!_film) {
return;
}
- _film->set_subtitle_offset (_subtitle_offset->GetValue ());
+ _film->set_video_frame_rate (_frame_rate_spin->GetValue ());
}
void
-FilmEditor::subtitle_scale_changed (wxCommandEvent &)
+FilmEditor::audio_channels_changed ()
{
if (!_film) {
return;
}
- _film->set_subtitle_scale (_subtitle_scale->GetValue() / 100.0);
+ _film->set_audio_channels (_audio_channels->GetValue ());
}
void
-FilmEditor::colour_lut_changed (wxCommandEvent &)
+FilmEditor::resolution_changed ()
{
if (!_film) {
return;
}
-
- _film->set_colour_lut (_colour_lut->GetSelection ());
-}
-void
-FilmEditor::j2k_bandwidth_changed (wxCommandEvent &)
-{
- if (!_film) {
- return;
- }
-
- _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1e6);
+ _film->set_resolution (_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);
}
void
-FilmEditor::dcp_frame_rate_changed (wxCommandEvent &)
+FilmEditor::standard_changed ()
{
if (!_film) {
return;
}
- _film->set_dcp_frame_rate (
- boost::lexical_cast<int> (
- wx_to_std (_dcp_frame_rate->GetString (_dcp_frame_rate->GetSelection ()))
- )
- );
+ _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.
}
stringstream s;
+
+ for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+ (*i)->film_changed (p);
+ }
switch (p) {
case Film::NONE:
break;
case Film::CONTENT:
- checked_set (_content, _film->content ());
- setup_visibility ();
- setup_formats ();
- setup_subtitle_control_sensitivity ();
- setup_streams ();
- setup_show_audio_sensitivity ();
- setup_frame_rate_description ();
- setup_minimum_audio_channels ();
- break;
- case Film::TRUST_CONTENT_HEADER:
- checked_set (_trust_content_header, _film->trust_content_header ());
- break;
- case Film::SUBTITLE_STREAMS:
- setup_subtitle_control_sensitivity ();
- setup_streams ();
+ setup_content ();
break;
- case Film::CONTENT_AUDIO_STREAMS:
- setup_streams ();
- setup_show_audio_sensitivity ();
- setup_frame_rate_description ();
- setup_minimum_audio_channels ();
+ case Film::CONTAINER:
+ setup_container ();
break;
- case Film::FORMAT:
- {
- int n = 0;
- vector<Format const *>::iterator i = _formats.begin ();
- while (i != _formats.end() && *i != _film->format ()) {
- ++i;
- ++n;
- }
- if (i == _formats.end()) {
- checked_set (_format, -1);
- } else {
- checked_set (_format, n);
- }
- setup_dcp_name ();
- setup_scaling_description ();
- break;
- }
- case Film::CROP:
- checked_set (_left_crop, _film->crop().left);
- 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:
- {
- pair<string, string> p = Filter::ffmpeg_strings (_film->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));
- }
- _film_sizer->Layout ();
- break;
- }
case Film::NAME:
checked_set (_name, _film->name());
setup_dcp_name ();
break;
- case Film::SOURCE_FRAME_RATE:
- s << fixed << setprecision(2) << _film->source_frame_rate();
- _source_frame_rate->SetLabel (std_to_wx (s.str ()));
- setup_frame_rate_description ();
- break;
- case Film::SIZE:
- setup_scaling_description ();
- break;
- case Film::LENGTH:
- if (_film->source_frame_rate() > 0 && _film->length()) {
- s << _film->length().get() << " "
- << wx_to_std (_("frames")) << "; " << seconds_to_hms (_film->length().get() / _film->source_frame_rate());
- } else if (_film->length()) {
- s << _film->length().get() << " "
- << wx_to_std (_("frames"));
- }
- _length->SetLabel (std_to_wx (s.str ()));
- if (_film->length()) {
- _trim_start->SetRange (0, _film->length().get());
- _trim_end->SetRange (0, _film->length().get());
- }
- break;
case Film::DCP_CONTENT_TYPE:
checked_set (_dcp_content_type, DCPContentType::as_index (_film->dcp_content_type ()));
setup_dcp_name ();
break;
- case Film::DCP_AB:
- checked_set (_dcp_ab, _film->dcp_ab ());
- break;
case Film::SCALER:
checked_set (_scaler, Scaler::as_index (_film->scaler ()));
break;
- case Film::TRIM_START:
- checked_set (_trim_start, _film->trim_start());
+ case Film::BURN_SUBTITLES:
+ checked_set (_burn_subtitles, _film->burn_subtitles ());
break;
- case Film::TRIM_END:
- checked_set (_trim_end, _film->trim_end());
+ case Film::SIGNED:
+ checked_set (_signed, _film->is_signed ());
break;
- 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 ());
- break;
- case Film::AUDIO_DELAY:
- checked_set (_audio_delay, _film->audio_delay ());
- break;
- case Film::STILL_DURATION:
- checked_set (_still_duration, _film->still_duration ());
+ 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::WITH_SUBTITLES:
- checked_set (_with_subtitles, _film->with_subtitles ());
- setup_subtitle_control_sensitivity ();
+ case Film::RESOLUTION:
+ checked_set (_resolution, _film->resolution() == RESOLUTION_2K ? 0 : 1);
setup_dcp_name ();
break;
- case Film::SUBTITLE_OFFSET:
- checked_set (_subtitle_offset, _film->subtitle_offset ());
- break;
- case Film::SUBTITLE_SCALE:
- checked_set (_subtitle_scale, _film->subtitle_scale() * 100);
- break;
- case Film::COLOUR_LUT:
- checked_set (_colour_lut, _film->colour_lut ());
- break;
case Film::J2K_BANDWIDTH:
- checked_set (_j2k_bandwidth, double (_film->j2k_bandwidth()) / 1e6);
- break;
- case Film::USE_DCI_NAME:
- checked_set (_use_dci_name, _film->use_dci_name ());
- setup_dcp_name ();
- break;
- case Film::DCI_METADATA:
- setup_dcp_name ();
+ checked_set (_j2k_bandwidth, _film->j2k_bandwidth() / 1000000);
break;
- case Film::CONTENT_AUDIO_STREAM:
- if (_film->content_audio_stream()) {
- checked_set (_audio_stream, _film->content_audio_stream()->to_string());
- }
+ case Film::USE_ISDCF_NAME:
+ checked_set (_use_isdcf_name, _film->use_isdcf_name ());
setup_dcp_name ();
- setup_audio_details ();
- setup_audio_control_sensitivity ();
- setup_show_audio_sensitivity ();
- setup_frame_rate_description ();
- setup_minimum_audio_channels ();
break;
- case Film::USE_CONTENT_AUDIO:
- _film->log()->log (String::compose ("Film::USE_CONTENT_AUDIO changed; setting GUI using %1", _film->use_content_audio ()));
- checked_set (_use_content_audio, _film->use_content_audio());
- checked_set (_use_external_audio, !_film->use_content_audio());
+ case Film::ISDCF_METADATA:
setup_dcp_name ();
- setup_audio_details ();
- setup_audio_control_sensitivity ();
- setup_show_audio_sensitivity ();
- setup_frame_rate_description ();
- setup_minimum_audio_channels ();
- break;
- case Film::SUBTITLE_STREAM:
- if (_film->subtitle_stream()) {
- checked_set (_subtitle_stream, _film->subtitle_stream()->to_string());
- }
break;
- case Film::EXTERNAL_AUDIO:
+ case Film::VIDEO_FRAME_RATE:
{
- vector<string> a = _film->external_audio ();
- for (size_t i = 0; i < a.size() && i < MAX_AUDIO_CHANNELS; ++i) {
- checked_set (_external_audio[i], a[i]);
- }
- setup_audio_details ();
- setup_show_audio_sensitivity ();
- setup_frame_rate_description ();
- setup_minimum_audio_channels ();
- break;
- }
- case Film::DCP_FRAME_RATE:
- 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;
- }
+ bool done = false;
+ for (unsigned int i = 0; i < _frame_rate_choice->GetCount(); ++i) {
+ if (wx_to_std (_frame_rate_choice->GetString(i)) == boost::lexical_cast<string> (_film->video_frame_rate())) {
+ checked_set (_frame_rate_choice, i);
+ done = true;
+ break;
}
}
- if (_film->source_frame_rate()) {
- _best_dcp_frame_rate->Enable (best_dcp_frame_rate (_film->source_frame_rate ()) != _film->dcp_frame_rate ());
- } else {
- _best_dcp_frame_rate->Disable ();
+ if (!done) {
+ checked_set (_frame_rate_choice, -1);
}
- setup_frame_rate_description ();
- case Film::MINIMUM_AUDIO_CHANNELS:
- checked_set (_minimum_audio_channels, _film->minimum_audio_channels ());
- setup_minimum_audio_channels ();
+ _frame_rate_spin->SetValue (_film->video_frame_rate ());
+
+ _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
+ break;
+ }
+ 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::setup_frame_rate_description ()
+FilmEditor::film_content_changed (int property)
{
- wxString d;
- int lines = 0;
+ ensure_ui_thread ();
- if (_film->source_frame_rate()) {
- d << std_to_wx (FrameRateConversion (_film->source_frame_rate(), _film->dcp_frame_rate()).description);
- ++lines;
-#ifdef HAVE_SWRESAMPLE
- if (_film->audio_stream() && _film->audio_stream()->sample_rate() != _film->target_audio_sample_rate ()) {
- d << wxString::Format (
- _("Audio will be resampled from %dHz to %dHz\n"),
- _film->audio_stream()->sample_rate(),
- _film->target_audio_sample_rate()
- );
- ++lines;
- }
-#endif
+ if (!_film) {
+ /* We call this method ourselves (as well as using it as a signal handler)
+ so _film can be 0.
+ */
+ return;
}
- for (int i = lines; i < 2; ++i) {
- d << wxT ("\n ");
+ for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+ (*i)->film_content_changed (property);
}
- _frame_rate_description->SetLabel (d);
+ if (property == FFmpegContentProperty::AUDIO_STREAM || property == SubtitleContentProperty::SUBTITLE_USE) {
+ setup_dcp_name ();
+ } else if (property == ContentProperty::PATH) {
+ setup_content ();
+ } else if (property == ContentProperty::POSITION) {
+ setup_content ();
+ }
}
-/** Called when the format widget has been changed */
void
-FilmEditor::format_changed (wxCommandEvent &)
+FilmEditor::setup_container ()
+{
+ int n = 0;
+ vector<Ratio const *> ratios = Ratio::all ();
+ vector<Ratio const *>::iterator i = ratios.begin ();
+ while (i != ratios.end() && *i != _film->container ()) {
+ ++i;
+ ++n;
+ }
+
+ if (i == ratios.end()) {
+ checked_set (_container, -1);
+ } else {
+ checked_set (_container, n);
+ }
+
+ setup_dcp_name ();
+}
+
+/** Called when the container widget has been changed */
+void
+FilmEditor::container_changed ()
{
if (!_film) {
return;
}
- int const n = _format->GetSelection ();
+ int const n = _container->GetSelection ();
if (n >= 0) {
- assert (n < int (_formats.size()));
- _film->set_format (_formats[n]);
+ vector<Ratio const *> ratios = Ratio::all ();
+ assert (n < int (ratios.size()));
+ _film->set_container (ratios[n]);
}
}
/** 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;
void
FilmEditor::set_film (shared_ptr<Film> f)
{
- _film = f;
+ set_general_sensitivity (f != 0);
- set_things_sensitive (_film != 0);
+ if (_film == f) {
+ return;
+ }
+
+ _film = f;
if (_film) {
_film->Changed.connect (bind (&FilmEditor::film_changed, this, _1));
+ _film->ContentChanged.connect (bind (&FilmEditor::film_content_changed, this, _2));
}
if (_film) {
FileChanged ("");
}
- if (_audio_dialog) {
- _audio_dialog->set_film (_film);
- }
-
film_changed (Film::NAME);
- film_changed (Film::USE_DCI_NAME);
+ film_changed (Film::USE_ISDCF_NAME);
film_changed (Film::CONTENT);
- film_changed (Film::TRUST_CONTENT_HEADER);
film_changed (Film::DCP_CONTENT_TYPE);
- film_changed (Film::FORMAT);
- film_changed (Film::CROP);
- film_changed (Film::FILTERS);
+ film_changed (Film::CONTAINER);
+ film_changed (Film::RESOLUTION);
film_changed (Film::SCALER);
- film_changed (Film::TRIM_START);
- film_changed (Film::TRIM_END);
- film_changed (Film::TRIM_TYPE);
- film_changed (Film::DCP_AB);
- film_changed (Film::CONTENT_AUDIO_STREAM);
- film_changed (Film::EXTERNAL_AUDIO);
- film_changed (Film::USE_CONTENT_AUDIO);
- film_changed (Film::AUDIO_GAIN);
- film_changed (Film::AUDIO_DELAY);
- film_changed (Film::STILL_DURATION);
- film_changed (Film::WITH_SUBTITLES);
- film_changed (Film::SUBTITLE_OFFSET);
- film_changed (Film::SUBTITLE_SCALE);
- film_changed (Film::COLOUR_LUT);
+ film_changed (Film::SIGNED);
+ film_changed (Film::BURN_SUBTITLES);
+ film_changed (Film::ENCRYPTED);
film_changed (Film::J2K_BANDWIDTH);
- film_changed (Film::DCI_METADATA);
- film_changed (Film::SIZE);
- film_changed (Film::LENGTH);
- film_changed (Film::CONTENT_AUDIO_STREAMS);
- film_changed (Film::SUBTITLE_STREAMS);
- film_changed (Film::SOURCE_FRAME_RATE);
- film_changed (Film::DCP_FRAME_RATE);
+ film_changed (Film::ISDCF_METADATA);
+ 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 ());
+ }
+
+ 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);
- _format->Enable (s);
+ _use_isdcf_name->Enable (s);
+ _edit_isdcf_button->Enable (s);
_content->Enable (s);
- _trust_content_header->Enable (s);
- _left_crop->Enable (s);
- _right_crop->Enable (s);
- _top_crop->Enable (s);
- _bottom_crop->Enable (s);
- _filters_button->Enable (s);
- _scaler->Enable (s);
- _audio_stream->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);
- _trim_start->Enable (s);
- _trim_end->Enable (s);
- _trim_type->Enable (s);
- _dcp_ab->Enable (s);
- _colour_lut->Enable (s);
+
+ bool si = s;
+ if (_film && _film->encrypted ()) {
+ si = false;
+ }
+ _burn_subtitles->Enable (s);
+ _signed->Enable (si);
+
+ _encrypted->Enable (s);
+ _frame_rate_choice->Enable (s);
+ _frame_rate_spin->Enable (s);
+ _audio_channels->Enable (s);
_j2k_bandwidth->Enable (s);
- _audio_gain->Enable (s);
- _audio_gain_calculate_button->Enable (s);
- _show_audio->Enable (s);
- _audio_delay->Enable (s);
- _still_duration->Enable (s);
-
- setup_subtitle_control_sensitivity ();
- setup_audio_control_sensitivity ();
- setup_show_audio_sensitivity ();
-}
+ _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);
-/** Called when the `Edit filters' button has been clicked */
-void
-FilmEditor::edit_filters_clicked (wxCommandEvent &)
-{
- FilterDialog* d = new FilterDialog (this, _film->filters());
- d->ActiveChanged.connect (bind (&Film::set_filters, _film, _1));
- d->ShowModal ();
- d->Destroy ();
+ /* Set the panels in the content notebook */
+ for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
+ (*i)->Enable (s);
+ }
}
/** Called when the scaler widget has been changed */
void
-FilmEditor::scaler_changed (wxCommandEvent &)
+FilmEditor::scaler_changed ()
{
if (!_film) {
return;
}
void
-FilmEditor::audio_gain_changed (wxCommandEvent &)
+FilmEditor::use_isdcf_name_toggled ()
{
if (!_film) {
return;
}
- _film->set_audio_gain (_audio_gain->GetValue ());
+ _film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
}
void
-FilmEditor::audio_delay_changed (wxCommandEvent &)
+FilmEditor::edit_isdcf_button_clicked ()
{
if (!_film) {
return;
}
- _film->set_audio_delay (_audio_delay->GetValue ());
-}
-
-wxControl *
-FilmEditor::video_control (wxControl* c)
-{
- _video_controls.push_back (c);
- return c;
-}
-
-wxControl *
-FilmEditor::still_control (wxControl* c)
-{
- _still_controls.push_back (c);
- return c;
-}
-
-void
-FilmEditor::setup_visibility ()
-{
- ContentType c = VIDEO;
-
- if (_film) {
- c = _film->content_type ();
- }
-
- for (list<wxControl*>::iterator i = _video_controls.begin(); i != _video_controls.end(); ++i) {
- (*i)->Show (c == VIDEO);
- }
-
- for (list<wxControl*>::iterator i = _still_controls.begin(); i != _still_controls.end(); ++i) {
- (*i)->Show (c == STILL);
- }
-
- setup_notebook_size ();
-}
-
-void
-FilmEditor::setup_notebook_size ()
-{
- _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 ();
+ ISDCFMetadataDialog* d = new ISDCFMetadataDialog (this, _film->isdcf_metadata ());
+ d->ShowModal ();
+ _film->set_isdcf_metadata (d->isdcf_metadata ());
+ d->Destroy ();
}
void
-FilmEditor::still_duration_changed (wxCommandEvent &)
+FilmEditor::active_jobs_changed (bool a)
{
- if (!_film) {
- return;
- }
-
- _film->set_still_duration (_still_duration->GetValue ());
+ set_general_sensitivity (!a);
}
void
-FilmEditor::trim_start_changed (wxCommandEvent &)
+FilmEditor::setup_dcp_name ()
{
- if (!_film) {
- return;
+ string s = _film->dcp_name (true);
+ if (s.length() > 28) {
+ _dcp_name->SetLabel (std_to_wx (s.substr (0, 28)) + N_("..."));
+ _dcp_name->SetToolTip (std_to_wx (s));
+ } else {
+ _dcp_name->SetLabel (std_to_wx (s));
}
-
- _film->set_trim_start (_trim_start->GetValue ());
}
void
-FilmEditor::trim_end_changed (wxCommandEvent &)
+FilmEditor::best_frame_rate_clicked ()
{
if (!_film) {
return;
}
-
- _film->set_trim_end (_trim_end->GetValue ());
+
+ _film->set_video_frame_rate (_film->best_video_frame_rate ());
}
void
-FilmEditor::audio_gain_calculate_button_clicked (wxCommandEvent &)
+FilmEditor::setup_content ()
{
- GainCalculatorDialog* d = new GainCalculatorDialog (this);
- d->ShowModal ();
-
- if (d->wanted_fader() == 0 || d->actual_fader() == 0) {
- d->Destroy ();
- return;
+ string selected_summary;
+ int const s = _content->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ if (s != -1) {
+ selected_summary = wx_to_std (_content->GetItemText (s));
}
- _audio_gain->SetValue (
- Config::instance()->sound_processor()->db_for_fader_change (
- d->wanted_fader (),
- d->actual_fader ()
- )
- );
+ _content->DeleteAllItems ();
- /* This appears to be necessary, as the change is not signalled,
- I think.
- */
- wxCommandEvent dummy;
- audio_gain_changed (dummy);
+ ContentList content = _film->content ();
+ sort (content.begin(), content.end(), ContentSorter ());
- d->Destroy ();
-}
+ for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
+ int const t = _content->GetItemCount ();
+ bool const valid = (*i)->paths_valid ();
-void
-FilmEditor::setup_formats ()
-{
- ContentType c = VIDEO;
+ string s = (*i)->summary ();
+ if (!valid) {
+ s = _("MISSING: ") + s;
+ }
- if (_film) {
- c = _film->content_type ();
- }
-
- _formats.clear ();
+ _content->InsertItem (t, std_to_wx (s));
- vector<Format const *> fmt = Format::all ();
- for (vector<Format const *>::iterator i = fmt.begin(); i != fmt.end(); ++i) {
- if (c == VIDEO || (c == STILL && dynamic_cast<VariableFormat const *> (*i))) {
- _formats.push_back (*i);
+ if ((*i)->summary() == selected_summary) {
+ _content->SetItemState (t, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
- }
- _format->Clear ();
- for (vector<Format const *>::iterator i = _formats.begin(); i != _formats.end(); ++i) {
- _format->Append (std_to_wx ((*i)->name ()));
+ if (!valid) {
+ _content->SetItemTextColour (t, *wxRED);
+ }
}
- _film_sizer->Layout ();
+ if (selected_summary.empty () && !content.empty ()) {
+ /* Select the item of content if none was selected before */
+ _content->SetItemState (0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+ }
}
void
-FilmEditor::with_subtitles_toggled (wxCommandEvent &)
+FilmEditor::content_add_file_clicked ()
{
- if (!_film) {
+ /* 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 ();
+
+ if (r != wxID_OK) {
+ d->Destroy ();
return;
}
- _film->set_with_subtitles (_with_subtitles->GetValue ());
-}
+ wxArrayString paths;
+ d->GetPaths (paths);
-void
-FilmEditor::setup_subtitle_control_sensitivity ()
-{
- bool h = false;
- if (_generally_sensitive && _film) {
- h = !_film->subtitle_streams().empty();
- }
-
- _with_subtitles->Enable (h);
+ /* XXX: check for lots of files here and do something */
- bool j = false;
- if (_film) {
- j = _film->with_subtitles ();
+ for (unsigned int i = 0; i < paths.GetCount(); ++i) {
+ _film->examine_and_add_content (content_factory (_film, wx_to_std (paths[i])));
}
-
- _subtitle_stream->Enable (j);
- _subtitle_offset->Enable (j);
- _subtitle_scale->Enable (j);
+
+ d->Destroy ();
}
void
-FilmEditor::setup_audio_control_sensitivity ()
+FilmEditor::content_add_folder_clicked ()
{
- _use_content_audio->Enable (_generally_sensitive && _film && !_film->content_audio_streams().empty());
- _use_external_audio->Enable (_generally_sensitive);
+ wxDirDialog* d = new wxDirDialog (this, _("Choose a folder"), wxT (""), wxDD_DIR_MUST_EXIST);
+ int const r = d->ShowModal ();
+ d->Destroy ();
- bool const source = _generally_sensitive && _use_content_audio->GetValue();
- bool const external = _generally_sensitive && _use_external_audio->GetValue();
-
- _audio_stream->Enable (source);
- for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) {
- _external_audio[i]->Enable (external);
+ if (r != wxID_OK) {
+ return;
}
- _pad_with_silence->Enable (_generally_sensitive && _film && _film->audio_stream() && _film->audio_stream()->channels() < MAX_AUDIO_CHANNELS);
- _minimum_audio_channels->Enable (_generally_sensitive && _pad_with_silence->GetValue ());
-}
-
-void
-FilmEditor::use_dci_name_toggled (wxCommandEvent &)
-{
- if (!_film) {
+ 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->set_use_dci_name (_use_dci_name->GetValue ());
+ _film->examine_and_add_content (ic);
}
void
-FilmEditor::edit_dci_button_clicked (wxCommandEvent &)
+FilmEditor::content_remove_clicked ()
{
- if (!_film) {
- return;
+ ContentList c = selected_content ();
+ if (c.size() == 1) {
+ _film->remove_content (c.front ());
}
- DCIMetadataDialog* d = new DCIMetadataDialog (this, _film->dci_metadata ());
- d->ShowModal ();
- _film->set_dci_metadata (d->dci_metadata ());
- d->Destroy ();
+ content_selection_changed ();
}
void
-FilmEditor::setup_streams ()
+FilmEditor::content_selection_changed ()
{
- _audio_stream->Clear ();
- vector<shared_ptr<AudioStream> > a = _film->content_audio_streams ();
- for (vector<shared_ptr<AudioStream> >::iterator i = a.begin(); i != a.end(); ++i) {
- shared_ptr<FFmpegAudioStream> ffa = dynamic_pointer_cast<FFmpegAudioStream> (*i);
- assert (ffa);
- _audio_stream->Append (std_to_wx (ffa->name()), new wxStringClientData (std_to_wx (ffa->to_string ())));
- }
-
- if (_film->use_content_audio() && _film->audio_stream()) {
- checked_set (_audio_stream, _film->audio_stream()->to_string());
- }
+ setup_content_sensitivity ();
- _subtitle_stream->Clear ();
- vector<shared_ptr<SubtitleStream> > s = _film->subtitle_streams ();
- for (vector<shared_ptr<SubtitleStream> >::iterator i = s.begin(); i != s.end(); ++i) {
- _subtitle_stream->Append (std_to_wx ((*i)->name()), new wxStringClientData (std_to_wx ((*i)->to_string ())));
- }
- if (_film->subtitle_stream()) {
- checked_set (_subtitle_stream, _film->subtitle_stream()->to_string());
- } else {
- _subtitle_stream->SetSelection (wxNOT_FOUND);
+ 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::audio_stream_changed (wxCommandEvent &)
+FilmEditor::setup_content_sensitivity ()
{
- if (!_film) {
- return;
- }
-
- _film->set_content_audio_stream (
- audio_stream_factory (
- string_client_data (_audio_stream->GetClientObject (_audio_stream->GetSelection ())),
- Film::state_version
- )
- );
+ _content_add_file->Enable (_generally_sensitive);
+ _content_add_folder->Enable (_generally_sensitive);
+
+ ContentList selection = selected_content ();
+ VideoContentList video_selection = selected_video_content ();
+ AudioContentList audio_selection = selected_audio_content ();
+
+ _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 (!_film->content().empty() && _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);
}
-void
-FilmEditor::subtitle_stream_changed (wxCommandEvent &)
+ContentList
+FilmEditor::selected_content ()
{
- if (!_film) {
- return;
+ ContentList sel;
+ long int s = -1;
+ while (true) {
+ s = _content->GetNextItem (s, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ if (s == -1) {
+ break;
+ }
+
+ if (s < int (_film->content().size ())) {
+ sel.push_back (_film->content()[s]);
+ }
}
- _film->set_subtitle_stream (
- subtitle_stream_factory (
- string_client_data (_subtitle_stream->GetClientObject (_subtitle_stream->GetSelection ())),
- Film::state_version
- )
- );
+ return sel;
}
-void
-FilmEditor::setup_audio_details ()
+VideoContentList
+FilmEditor::selected_video_content ()
{
- if (!_film->content_audio_stream()) {
- _audio->SetLabel (wxT (""));
- } else {
- wxString s;
- if (_film->audio_stream()->channels() == 1) {
- s << _("1 channel");
- } else {
- s << _film->audio_stream()->channels () << wxT (" ") << _("channels");
+ 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);
}
- s << wxT (", ") << _film->audio_stream()->sample_rate() << _("Hz");
- _audio->SetLabel (s);
}
- setup_notebook_size ();
+ return vc;
}
-void
-FilmEditor::active_jobs_changed (bool a)
+AudioContentList
+FilmEditor::selected_audio_content ()
{
- set_things_sensitive (!a);
+ 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 ac;
}
-void
-FilmEditor::use_audio_changed (wxCommandEvent &)
+SubtitleContentList
+FilmEditor::selected_subtitle_content ()
{
- _film->set_use_content_audio (_use_content_audio->GetValue());
+ 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 sc;
}
-void
-FilmEditor::external_audio_changed (wxCommandEvent &)
+FFmpegContentList
+FilmEditor::selected_ffmpeg_content ()
{
- vector<string> a;
- for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) {
- a.push_back (wx_to_std (_external_audio[i]->GetPath()));
+ 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);
+ }
}
- _film->set_external_audio (a);
+ return sc;
}
void
-FilmEditor::setup_dcp_name ()
+FilmEditor::content_timeline_clicked ()
{
- string s = _film->dcp_name (true);
- if (s.length() > 28) {
- _dcp_name->SetLabel (std_to_wx (s.substr (0, 28)) + N_("..."));
- _dcp_name->SetToolTip (std_to_wx (s));
- } else {
- _dcp_name->SetLabel (std_to_wx (s));
+ if (_timeline_dialog) {
+ _timeline_dialog->Destroy ();
+ _timeline_dialog = 0;
}
+
+ _timeline_dialog = new TimelineDialog (this, _film);
+ _timeline_dialog->Show ();
}
void
-FilmEditor::show_audio_clicked (wxCommandEvent &)
+FilmEditor::set_selection (weak_ptr<Content> wc)
{
- if (_audio_dialog) {
- _audio_dialog->Destroy ();
- _audio_dialog = 0;
+ ContentList content = _film->content ();
+ for (size_t i = 0; i < content.size(); ++i) {
+ if (content[i] == wc.lock ()) {
+ _content->SetItemState (i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
+ } else {
+ _content->SetItemState (i, 0, wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
+ }
}
-
- _audio_dialog = new AudioDialog (this);
- _audio_dialog->Show ();
- _audio_dialog->set_film (_film);
}
void
-FilmEditor::best_dcp_frame_rate_clicked (wxCommandEvent &)
+FilmEditor::sequence_video_changed ()
{
if (!_film) {
return;
}
- _film->set_dcp_frame_rate (best_dcp_frame_rate (_film->source_frame_rate ()));
+ _film->set_sequence_video (_sequence_video->GetValue ());
}
void
-FilmEditor::setup_show_audio_sensitivity ()
+FilmEditor::content_right_click (wxListEvent& ev)
{
- _show_audio->Enable (_film && _film->has_audio ());
+ _menu.popup (_film, selected_content (), ev.GetPoint ());
}
void
-FilmEditor::setup_scaling_description ()
+FilmEditor::three_d_changed ()
{
- wxString d;
-
- int lines = 0;
-
- if (_film->size().width && _film->size().height) {
- d << wxString::Format (
- _("Original video is %dx%d (%.2f:1)\n"),
- _film->size().width, _film->size().height,
- float (_film->size().width) / _film->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->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 ");
+ if (!_film) {
+ return;
}
- _scaling_description->SetLabel (d);
+ _film->set_three_d (_three_d->GetValue ());
}
void
-FilmEditor::trim_type_changed (wxCommandEvent &)
+FilmEditor::content_earlier_clicked ()
{
- _film->set_trim_type (_trim_type->GetSelection () == 0 ? Film::CPL : Film::ENCODE);
+ ContentList sel = selected_content ();
+ if (sel.size() == 1) {
+ _film->move_content_earlier (sel.front ());
+ content_selection_changed ();
+ }
}
void
-FilmEditor::setup_minimum_audio_channels ()
+FilmEditor::content_later_clicked ()
{
- if (!_film || !_film->audio_stream ()) {
- _pad_with_silence->SetValue (false);
- return;
+ ContentList sel = selected_content ();
+ if (sel.size() == 1) {
+ _film->move_content_later (sel.front ());
+ content_selection_changed ();
}
-
- _pad_with_silence->SetValue (_film->audio_stream()->channels() < _film->minimum_audio_channels());
-
- AudioMapping m (_film);
- _minimum_audio_channels->SetRange (m.minimum_dcp_channels() + 1, MAX_AUDIO_CHANNELS);
}
void
-FilmEditor::pad_with_silence_toggled (wxCommandEvent &)
+FilmEditor::config_changed ()
{
- setup_audio_control_sensitivity ();
+ _j2k_bandwidth->SetRange (1, Config::instance()->maximum_j2k_bandwidth() / 1000000);
+ setup_frame_rate_widget ();
}
void
-FilmEditor::minimum_audio_channels_changed (wxCommandEvent &)
+FilmEditor::setup_frame_rate_widget ()
{
- if (!_film) {
- return;
+ if (Config::instance()->allow_any_dcp_frame_rate ()) {
+ _frame_rate_choice->Hide ();
+ _frame_rate_spin->Show ();
+ } else {
+ _frame_rate_choice->Show ();
+ _frame_rate_spin->Hide ();
}
- _film->set_minimum_audio_channels (_minimum_audio_channels->GetValue ());
+ _frame_rate_sizer->Layout ();
}