Allow drag-and-drop of files onto the content panel (#395).
authorCarl Hetherington <cth@carlh.net>
Sun, 31 Aug 2014 13:54:41 +0000 (14:54 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 31 Aug 2014 13:54:41 +0000 (14:54 +0100)
ChangeLog
src/wx/film_editor.cc
src/wx/film_editor.h

index a966e75328eb11056504958b02aa2a195d7bc464..d2938bda9a7e2901d09c541804aa06a32ea5b738 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-08-31  Carl Hetherington  <cth@carlh.net>
+
+       * Allow drag-and-drop of files onto the content list (#395).
+
 2014-08-29  Carl Hetherington  <cth@carlh.net>
 
        * Some improvements to the manual.
index e2886b5f586a9138defe7901dd6b3167b7c8dede..017a9d7c9514b3310407be957a5285f8a9d99869 100644 (file)
@@ -238,6 +238,7 @@ FilmEditor::connect_to_widgets ()
        _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));
@@ -308,6 +309,8 @@ FilmEditor::make_content_panel ()
        _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 */
@@ -1060,3 +1063,16 @@ FilmEditor::setup_frame_rate_widget ()
 
        _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])));
+       }
+}
index 6f39f2d68428d8ecc4fb0d391bbb3f316b129b8e..1854df05eae850bc2f6e5570963bd77effa8bb82 100644 (file)
@@ -83,6 +83,7 @@ private:
        void content_remove_clicked ();
        void content_earlier_clicked ();
        void content_later_clicked ();
+       void content_files_dropped (wxDropFilesEvent& event);
        void container_changed ();
        void dcp_content_type_changed ();
        void scaler_changed ();