- int r = 0;
- add_label_to_grid_bag_sizer (grid, _video_panel, _("Left crop"), true, wxGBPosition (r, 0));
- _left_crop = new wxSpinCtrl (_video_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
- grid->Add (_left_crop, wxGBPosition (r, 1));
- ++r;
-
- add_label_to_grid_bag_sizer (grid, _video_panel, _("Right crop"), true, wxGBPosition (r, 0));
- _right_crop = new wxSpinCtrl (_video_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
- grid->Add (_right_crop, wxGBPosition (r, 1));
- ++r;
-
- add_label_to_grid_bag_sizer (grid, _video_panel, _("Top crop"), true, wxGBPosition (r, 0));
- _top_crop = new wxSpinCtrl (_video_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
- grid->Add (_top_crop, wxGBPosition (r, 1));
- ++r;
-
- add_label_to_grid_bag_sizer (grid, _video_panel, _("Bottom crop"), true, wxGBPosition (r, 0));
- _bottom_crop = new wxSpinCtrl (_video_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
- grid->Add (_bottom_crop, wxGBPosition (r, 1));
- ++r;
-
- add_label_to_grid_bag_sizer (grid, _video_panel, _("Scale to"), true, wxGBPosition (r, 0));
- _ratio = new wxChoice (_video_panel, wxID_ANY);
- grid->Add (_ratio, wxGBPosition (r, 1));
- ++r;
-
- _scaling_description = new wxStaticText (_video_panel, wxID_ANY, wxT ("\n \n \n \n"), wxDefaultPosition, wxDefaultSize);
- grid->Add (_scaling_description, wxGBPosition (r, 0), wxGBSpan (1, 2), wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6);
- wxFont font = _scaling_description->GetFont();
- font.SetStyle(wxFONTSTYLE_ITALIC);
- font.SetPointSize(font.GetPointSize() - 1);
- _scaling_description->SetFont(font);
- ++r;
-
- /* VIDEO-only stuff */
- {
- add_label_to_grid_bag_sizer (grid, _video_panel, _("Filters"), true, wxGBPosition (r, 0));
- wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _filters = new wxStaticText (_video_panel, wxID_ANY, _("None"));
- s->Add (_filters, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
- _filters_button = new wxButton (_video_panel, wxID_ANY, _("Edit..."));
- s->Add (_filters_button, 0, wxALIGN_CENTER_VERTICAL);
- grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
- }
- ++r;
-
- _left_crop->SetRange (0, 1024);
- _top_crop->SetRange (0, 1024);
- _right_crop->SetRange (0, 1024);
- _bottom_crop->SetRange (0, 1024);
-}
-
-void
-FilmEditor::make_content_panel ()
-{
- _content_panel = new wxPanel (_main_notebook);
- _content_sizer = new wxBoxSizer (wxVERTICAL);
- _content_panel->SetSizer (_content_sizer);
-
- {
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-
- _content = new wxListCtrl (_content_panel, wxID_ANY, wxDefaultPosition, wxSize (320, 160), wxLC_REPORT | wxLC_NO_HEADER | wxLC_SINGLE_SEL);
- s->Add (_content, 1, wxEXPAND | wxTOP | wxBOTTOM, 6);
-
- _content->InsertColumn (0, wxT(""));
- _content->SetColumnWidth (0, 512);
-
- wxBoxSizer* b = new wxBoxSizer (wxVERTICAL);
- _content_add = new wxButton (_content_panel, wxID_ANY, _("Add..."));
- b->Add (_content_add, 1, wxEXPAND | wxLEFT | wxRIGHT);
- _content_remove = new wxButton (_content_panel, wxID_ANY, _("Remove"));
- b->Add (_content_remove, 1, wxEXPAND | wxLEFT | wxRIGHT);
- _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, 0.75, 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);
-
- make_video_panel ();
- _content_notebook->AddPage (_video_panel, _("Video"), false);
- make_audio_panel ();
- _content_notebook->AddPage (_audio_panel, _("Audio"), false);
- make_subtitle_panel ();
- _content_notebook->AddPage (_subtitle_panel, _("Subtitles"), false);
- make_timing_panel ();
- _content_notebook->AddPage (_timing_panel, _("Timing"), false);
-}
-
-void
-FilmEditor::make_audio_panel ()
-{
- _audio_panel = new wxPanel (_content_notebook);
- wxBoxSizer* audio_sizer = new wxBoxSizer (wxVERTICAL);
- _audio_panel->SetSizer (audio_sizer);
-
- wxFlexGridSizer* grid = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- 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);
- grid->AddSpacer (0);
-
- add_label_to_sizer (grid, _audio_panel, _("Audio Gain"), true);
- {
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _audio_gain = new wxSpinCtrl (_audio_panel);
- s->Add (_audio_gain, 1);
- add_label_to_sizer (s, _audio_panel, _("dB"), false);
- grid->Add (s, 1);
- }
-
- _audio_gain_calculate_button = new wxButton (_audio_panel, wxID_ANY, _("Calculate..."));
- grid->Add (_audio_gain_calculate_button);
-
- add_label_to_sizer (grid, _audio_panel, _("Audio Delay"), false);
- {
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _audio_delay = new wxSpinCtrl (_audio_panel);
- s->Add (_audio_delay, 1);
- /// TRANSLATORS: this is an abbreviation for milliseconds, the unit of time
- add_label_to_sizer (s, _audio_panel, _("ms"), false);
- grid->Add (s);
- }
-
- grid->AddSpacer (0);
-
- add_label_to_sizer (grid, _audio_panel, _("Audio Stream"), true);
- _audio_stream = new wxChoice (_audio_panel, wxID_ANY);
- grid->Add (_audio_stream, 1, wxEXPAND);
- _audio_description = new wxStaticText (_audio_panel, wxID_ANY, wxT (""));
- grid->AddSpacer (0);
-
- grid->Add (_audio_description, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8);
- grid->AddSpacer (0);
- grid->AddSpacer (0);
-
- _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);
-}
-
-void
-FilmEditor::make_subtitle_panel ()
-{
- _subtitle_panel = new wxPanel (_content_notebook);
- wxBoxSizer* subtitle_sizer = new wxBoxSizer (wxVERTICAL);
- _subtitle_panel->SetSizer (subtitle_sizer);
- wxFlexGridSizer* grid = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- subtitle_sizer->Add (grid, 0, wxALL, 8);
-
- _with_subtitles = new wxCheckBox (_subtitle_panel, wxID_ANY, _("With Subtitles"));
- grid->Add (_with_subtitles, 1);
- grid->AddSpacer (0);
-
- {
- add_label_to_sizer (grid, _subtitle_panel, _("Subtitle Offset"), true);
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _subtitle_offset = new wxSpinCtrl (_subtitle_panel);
- s->Add (_subtitle_offset);
- add_label_to_sizer (s, _subtitle_panel, _("%"), false);
- grid->Add (s);
- }
-
- {
- add_label_to_sizer (grid, _subtitle_panel, _("Subtitle Scale"), true);
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _subtitle_scale = new wxSpinCtrl (_subtitle_panel);
- s->Add (_subtitle_scale);
- add_label_to_sizer (s, _subtitle_panel, _("%"), false);
- grid->Add (s);
- }
-
- add_label_to_sizer (grid, _subtitle_panel, _("Subtitle Stream"), true);
- _subtitle_stream = new wxChoice (_subtitle_panel, wxID_ANY);
- grid->Add (_subtitle_stream, 1, wxEXPAND);
-
- _subtitle_offset->SetRange (-100, 100);
- _subtitle_scale->SetRange (1, 1000);
- _subtitle_scale->SetValue (100);
-}
-
-void
-FilmEditor::make_timing_panel ()
-{
- _timing_panel = new wxPanel (_content_notebook);
- wxBoxSizer* timing_sizer = new wxBoxSizer (wxVERTICAL);
- _timing_panel->SetSizer (timing_sizer);
- wxFlexGridSizer* grid = new wxFlexGridSizer (2, 4, 4);
- timing_sizer->Add (grid, 0, wxALL, 8);
-
- add_label_to_sizer (grid, _timing_panel, _("Start time"), true);
- _start = new Timecode (_timing_panel);
- grid->Add (_start);
- add_label_to_sizer (grid, _timing_panel, _("Length"), true);
- _length = new Timecode (_timing_panel);
- grid->Add (_length);
-}
-
-
-/** Called when the left crop widget has been changed */
-void
-FilmEditor::left_crop_changed (wxCommandEvent &)
-{
- shared_ptr<VideoContent> c = selected_video_content ();
- if (!c) {
- return;
- }
-
- c->set_left_crop (_left_crop->GetValue ());
-}
-
-/** Called when the right crop widget has been changed */
-void
-FilmEditor::right_crop_changed (wxCommandEvent &)
-{
- shared_ptr<VideoContent> c = selected_video_content ();
- if (!c) {
- return;
- }
-
- c->set_right_crop (_right_crop->GetValue ());
-}
-
-/** Called when the top crop widget has been changed */
-void
-FilmEditor::top_crop_changed (wxCommandEvent &)
-{
- shared_ptr<VideoContent> c = selected_video_content ();
- if (!c) {
- return;
- }
-
- c->set_top_crop (_top_crop->GetValue ());
-}
-
-/** Called when the bottom crop value has been changed */
-void
-FilmEditor::bottom_crop_changed (wxCommandEvent &)
-{
- shared_ptr<VideoContent> c = selected_video_content ();
- if (!c) {
- return;
- }
-
- c->set_bottom_crop (_bottom_crop->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()));
-}
-
-void
-FilmEditor::subtitle_offset_changed (wxCommandEvent &)
-{
- shared_ptr<SubtitleContent> c = selected_subtitle_content ();
- if (!c) {
- return;
- }
-
- c->set_subtitle_offset (_subtitle_offset->GetValue() / 100.0);
-}
-
-void
-FilmEditor::subtitle_scale_changed (wxCommandEvent &)
-{
- shared_ptr<SubtitleContent> c = selected_subtitle_content ();
- if (!c) {
- return;
- }
-
- c->set_subtitle_scale (_subtitle_scale->GetValue() / 100.0);
-}
-
-void
-FilmEditor::j2k_bandwidth_changed (wxCommandEvent &)
-{
- if (!_film) {
- return;
- }
-
- _film->set_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1e6);
-}
-
-void
-FilmEditor::dcp_frame_rate_changed (wxCommandEvent &)
-{
- if (!_film) {
- return;
- }
-
- _film->set_dcp_video_frame_rate (
- boost::lexical_cast<int> (
- wx_to_std (_dcp_frame_rate->GetString (_dcp_frame_rate->GetSelection ()))
- )
- );
-}
-
-void
-FilmEditor::dcp_audio_channels_changed (wxCommandEvent &)
-{
- if (!_film) {
- return;
- }
-
- _film->set_dcp_audio_channels (_dcp_audio_channels->GetValue ());
-}
-
-void
-FilmEditor::dcp_resolution_changed (wxCommandEvent &)
-{
- if (!_film) {
- return;
- }
-
- _film->set_resolution (_dcp_resolution->GetSelection() == 0 ? RESOLUTION_2K : RESOLUTION_4K);