diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-07-26 00:20:21 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-07-26 00:20:21 +0100 |
| commit | 264a268f7c1244b47d9fa54ad342d80b0f98e16d (patch) | |
| tree | b184c193908fc96280ccffef4e51a67ab35eb69d /src/wx | |
| parent | 78e5a331074a456097a162d47501daf1df1ab1a3 (diff) | |
Basic if sketchy support for image sequences.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/film_editor.cc | 40 | ||||
| -rw-r--r-- | src/wx/film_editor.h | 6 |
2 files changed, 37 insertions, 9 deletions
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index cb14f70e7..d82013d8a 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -37,6 +37,7 @@ #include "lib/ratio.h" #include "lib/config.h" #include "lib/still_image_content.h" +#include "lib/moving_image_content.h" #include "lib/sndfile_content.h" #include "lib/dcp_content_type.h" #include "lib/sound_processor.h" @@ -212,7 +213,8 @@ 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_add->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::content_add_clicked, this)); + _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)); _content_timeline->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmEditor::content_timeline_clicked, this)); _scaler->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&FilmEditor::scaler_changed, this)); @@ -243,8 +245,10 @@ FilmEditor::make_content_panel () _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_add_file = new wxButton (_content_panel, wxID_ANY, _("Add file...")); + b->Add (_content_add_file, 1, wxEXPAND | wxLEFT | wxRIGHT); + _content_add_folder = new wxButton (_content_panel, wxID_ANY, _("Add folder...")); + b->Add (_content_add_folder, 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...")); @@ -546,7 +550,8 @@ FilmEditor::set_general_sensitivity (bool s) _use_dci_name->Enable (s); _edit_dci_button->Enable (s); _content->Enable (s); - _content_add->Enable (s); + _content_add_file->Enable (s); + _content_add_folder->Enable (s); _content_remove->Enable (s); _content_timeline->Enable (s); _dcp_content_type->Enable (s); @@ -658,7 +663,7 @@ FilmEditor::setup_content () } void -FilmEditor::content_add_clicked () +FilmEditor::content_add_file_clicked () { wxFileDialog* d = new wxFileDialog (this, _("Choose a file or files"), wxT (""), wxT (""), wxT ("*.*"), wxFD_MULTIPLE); int const r = d->ShowModal (); @@ -671,12 +676,14 @@ FilmEditor::content_add_clicked () wxArrayString paths; d->GetPaths (paths); + /* XXX: check for lots of files here and do something */ + for (unsigned int i = 0; i < paths.GetCount(); ++i) { boost::filesystem::path p (wx_to_std (paths[i])); shared_ptr<Content> c; - if (StillImageContent::valid_file (p)) { + if (valid_image_file (p)) { c.reset (new StillImageContent (_film, p)); } else if (SndfileContent::valid_file (p)) { c.reset (new SndfileContent (_film, p)); @@ -689,6 +696,24 @@ FilmEditor::content_add_clicked () } void +FilmEditor::content_add_folder_clicked () +{ + wxDirDialog* d = new wxDirDialog (this, _("Choose a folder"), wxT (""), wxDD_DIR_MUST_EXIST); + int const r = d->ShowModal (); + d->Destroy (); + + if (r != wxID_OK) { + return; + } + + _film->examine_and_add_content ( + shared_ptr<MovingImageContent> ( + new MovingImageContent (_film, boost::filesystem::path (wx_to_std (d->GetPath ()))) + ) + ); +} + +void FilmEditor::content_remove_clicked () { shared_ptr<Content> c = selected_content (); @@ -729,7 +754,8 @@ FilmEditor::content_selection_changed () void FilmEditor::setup_content_sensitivity () { - _content_add->Enable (_generally_sensitive); + _content_add_file->Enable (_generally_sensitive); + _content_add_folder->Enable (_generally_sensitive); shared_ptr<Content> selection = selected_content (); diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index 0f62f4479..f9f15e2ac 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -76,7 +76,8 @@ private: void use_dci_name_toggled (); void edit_dci_button_clicked (); void content_selection_changed (); - void content_add_clicked (); + void content_add_file_clicked (); + void content_add_folder_clicked (); void content_remove_clicked (); void container_changed (); void dcp_content_type_changed (); @@ -123,7 +124,8 @@ private: wxCheckBox* _use_dci_name; wxChoice* _container; wxListCtrl* _content; - wxButton* _content_add; + wxButton* _content_add_file; + wxButton* _content_add_folder; wxButton* _content_remove; wxButton* _content_earlier; wxButton* _content_later; |
