+/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
+
/*
Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
#include "audio_dialog.h"
#include "imagemagick_content_dialog.h"
#include "ffmpeg_content_dialog.h"
-#include "audio_mapping_view.h"
#include "timeline_dialog.h"
using std::string;
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;
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));
- }
- ++r;
-
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);
_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);
- _timeline_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::timeline_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);
_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);
_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);
_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);
}
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);
add_label_to_sizer (h, _content_panel, _("times"));
_content_sizer->Add (h, 0, wxALL, 6);
- _timeline_button = new wxButton (_content_panel, wxID_ANY, _("Timeline..."));
- _content_sizer->Add (_timeline_button, 0, wxALL, 6);
-
_loop_count->SetRange (2, 1024);
}
grid->Add (s);
}
- _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);
}
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 ()))
)
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());
- break;
case Film::TRIM_TYPE:
checked_set (_trim_type, _film->trim_type() == Film::CPL ? 0 : 1);
break;
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 (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;
checked_set (_dcp_frame_rate, -1);
}
- if (_film->video_frame_rate()) {
- _best_dcp_frame_rate->Enable (best_dcp_frame_rate (_film->video_frame_rate ()) != _film->dcp_frame_rate ());
- } else {
- _best_dcp_frame_rate->Disable ();
- }
+ _best_dcp_frame_rate->Enable (_film->best_dcp_video_frame_rate () != _film->dcp_video_frame_rate ());
setup_frame_rate_description ();
break;
}
- case Film::AUDIO_MAPPING:
- _audio_mapping->set_mapping (_film->audio_mapping ());
- break;
}
}
} 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) {
FilmEditor::setup_length ()
{
stringstream s;
- ContentVideoFrame const frames = _film->content_length ();
+ Time const length = _film->length ();
- if (frames && _film->video_frame_rate()) {
- s << frames << " " << wx_to_std (_("frames")) << "; " << seconds_to_hms (frames / _film->video_frame_rate());
- } else if (frames) {
- s << frames << " " << wx_to_std (_("frames"));
- }
-
+ s << time_to_hms (length);
_length->SetLabel (std_to_wx (s.str ()));
-
- if (frames) {
- _trim_start->SetRange (0, frames);
- _trim_end->SetRange (0, frames);
- }
}
void
{
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;
-#ifdef HAVE_SWRESAMPLE
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"),
);
++lines;
}
-#endif
}
+#endif
for (int i = lines; i < 2; ++i) {
d << wxT ("\n ");
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);
_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);
Fit ();
}
-void
-FilmEditor::trim_start_changed (wxCommandEvent &)
-{
- if (!_film) {
- return;
- }
-
- _film->set_trim_start (_trim_start->GetValue ());
-}
-
-void
-FilmEditor::trim_end_changed (wxCommandEvent &)
-{
- if (!_film) {
- return;
- }
-
- _film->set_trim_end (_trim_end->GetValue ());
-}
-
void
FilmEditor::audio_gain_calculate_button_clicked (wxCommandEvent &)
{
{
bool h = false;
if (_generally_sensitive && _film) {
- h = !_film->has_subtitles ();
+ h = _film->has_subtitles ();
}
_with_subtitles->Enable (h);
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
_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) {
}
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
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 ();
}
- shared_ptr<FFmpegContent> ff = dynamic_pointer_cast<FFmpegContent> (c);
- if (ff) {
- FFmpegContentDialog* d = new FFmpegContentDialog (this, ff);
+ shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (content);
+ if (fc) {
+ FFmpegContentDialog* d = new FFmpegContentDialog (this, fc);
d->ShowModal ();
d->Destroy ();
}
}
-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);
- }
-}
-
void
FilmEditor::content_selection_changed (wxListEvent &)
{
shared_ptr<Content> selection = selected_content ();
- _content_edit->Enable (
+ _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>
return shared_ptr<Content> ();
}
- ContentList c = _film->content ();
+ Playlist::ContentList c = _film->content ();
if (s < 0 || size_t (s) >= c.size ()) {
return shared_ptr<Content> ();
}
{
wxString d;
+#if 0
+XXX
int lines = 0;
if (_film->video_size().width && _film->video_size().height) {
d << wxT ("\n ");
}
+#endif
_scaling_description->SetLabel (d);
}
}
void
-FilmEditor::timeline_clicked (wxCommandEvent &)
+FilmEditor::content_timeline_clicked (wxCommandEvent &)
{
if (_timeline_dialog) {
_timeline_dialog->Destroy ();
_timeline_dialog = 0;
}
- _timeline_dialog = new TimelineDialog (this, _film->playlist ());
+ _timeline_dialog = new TimelineDialog (this, _film);
_timeline_dialog->Show ();
}