#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);
}
_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));
_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);
setup_content ();
} else if (property == ContentProperty::POSITION) {
setup_content ();
+ } else if (property == VideoContentProperty::VIDEO_SCALE) {
+ setup_dcp_name ();
}
}
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);
}
}
}
_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])));
+ }
+}