#include "lib/playlist.h"
#include "lib/content.h"
#include "lib/content_factory.h"
+#include "lib/safe_stringstream.h"
#include "timecode.h"
#include "wx_util.h"
#include "film_editor.h"
using std::string;
using std::cout;
-using std::stringstream;
using std::pair;
using std::fixed;
using std::setprecision;
using boost::lexical_cast;
/** @param f Film to edit */
-FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
+FilmEditor::FilmEditor (wxWindow* parent)
: wxPanel (parent)
, _menu (this)
, _generally_sensitive (true)
make_dcp_panel ();
_main_notebook->AddPage (_dcp_panel, _("DCP"), false);
- set_film (f);
connect_to_widgets ();
JobManager::instance()->ActiveJobsChanged.connect (
);
Config::instance()->Changed.connect (boost::bind (&FilmEditor::config_changed, this));
-
+
+ set_film (shared_ptr<Film> ());
SetSizerAndFit (s);
}
grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
++r;
- 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;
-
int flags = wxALIGN_CENTER_VERTICAL;
#ifdef __WXOSX__
flags |= wxALIGN_RIGHT;
grid->Add (_edit_isdcf_button, wxGBPosition (r, 1), wxDefaultSpan);
++r;
+ 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;
+
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);
_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->Bind (wxEVT_DROP_FILES, boost::bind (&FilmEditor::content_files_dropped, 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));
_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));
}
_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);
_panels.push_back (_subtitle_panel);
_timing_panel = new TimingPanel (this);
_panels.push_back (_timing_panel);
+
+ _content->DragAcceptFiles (true);
}
/** Called when the name widget has been changed */
return;
}
- stringstream s;
+ SafeStringStream s;
for (list<FilmEditorPanel*>::iterator i = _panels.begin(); i != _panels.end(); ++i) {
(*i)->film_changed (p);
case Film::USE_ISDCF_NAME:
checked_set (_use_isdcf_name, _film->use_isdcf_name ());
setup_dcp_name ();
+ use_isdcf_name_changed ();
break;
case Film::ISDCF_METADATA:
setup_dcp_name ();
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 ();
case Film::INTEROP:
checked_set (_standard, _film->interop() ? 1 : 0);
break;
+ default:
+ break;
}
}
setup_content ();
} else if (property == ContentProperty::POSITION) {
setup_content ();
+ } else if (property == VideoContentProperty::VIDEO_SCALE) {
+ setup_dcp_name ();
}
}
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);
_j2k_bandwidth->Enable (s);
_container->Enable (s);
_best_frame_rate->Enable (s && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
- _sequence_video->Enable (s);
_resolution->Enable (s);
_scaler->Enable (s);
_three_d->Enable (s);
_film->set_use_isdcf_name (_use_isdcf_name->GetValue ());
}
+void
+FilmEditor::use_isdcf_name_changed ()
+{
+ bool const i = _film->use_isdcf_name ();
+
+ if (!i) {
+ _film->set_name (_film->isdcf_name (true));
+ }
+
+ _edit_isdcf_button->Enable (i);
+}
+
void
FilmEditor::edit_isdcf_button_clicked ()
{
_video_panel->Enable (!video_selection.empty() && _generally_sensitive);
_audio_panel->Enable (!audio_selection.empty() && _generally_sensitive);
_subtitle_panel->Enable (selection.size() == 1 && dynamic_pointer_cast<FFmpegContent> (selection.front()) && _generally_sensitive);
- _timing_panel->Enable (selection.size() == 1 && _generally_sensitive);
+ _timing_panel->Enable (!selection.empty() && _generally_sensitive);
}
ContentList
FilmEditor::selected_content ()
{
ContentList sel;
+
+ if (!_film) {
+ return sel;
+ }
+
+ /* The list was populated using a sorted content list, so we must sort it here too
+ so that we can look up by index and get the right thing.
+ */
+ ContentList content = _film->content ();
+ sort (content.begin(), content.end(), ContentSorter ());
+
long int s = -1;
while (true) {
s = _content->GetNextItem (s, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
}
if (s < int (_film->content().size ())) {
- sel.push_back (_film->content()[s]);
+ sel.push_back (content[s]);
}
}
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);
+ _content->SetItemState (i, 0, wxLIST_STATE_SELECTED);
}
}
}
-void
-FilmEditor::sequence_video_changed ()
-{
- if (!_film) {
- return;
- }
-
- _film->set_sequence_video (_sequence_video->GetValue ());
-}
-
void
FilmEditor::content_right_click (wxListEvent& ev)
{
_frame_rate_sizer->Layout ();
}
+
+void
+FilmEditor::content_files_dropped (wxDropFilesEvent& event)
+{
+ if (!_film) {
+ return;
+ }
+
+ wxString* paths = event.GetFiles ();
+ for (int i = 0; i < event.GetNumberOfFiles(); i++) {
+ _film->examine_and_add_content (content_factory (_film, wx_to_std (paths[i])));
+ }
+}