Rename 'Add folder' button to 'Add image sequence' and add some tooltips.
[dcpomatic.git] / src / wx / film_editor.cc
index e2886b5f586a9138defe7901dd6b3167b7c8dede..4b3898859686a6b1af2003ea2d57637daf1f6a7a 100644 (file)
@@ -115,11 +115,6 @@ FilmEditor::make_dcp_panel ()
        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;
@@ -131,6 +126,11 @@ FilmEditor::make_dcp_panel ()
        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);
@@ -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));
@@ -254,7 +255,6 @@ FilmEditor::connect_to_widgets ()
        _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));
 }
@@ -276,27 +276,36 @@ FilmEditor::make_content_panel ()
                _content->SetColumnWidth (0, 512);
 
                wxBoxSizer* b = new wxBoxSizer (wxVERTICAL);
+
                _content_add_file = new wxButton (_content_panel, wxID_ANY, _("Add file(s)..."));
-               b->Add (_content_add_file, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
-               _content_add_folder = new wxButton (_content_panel, wxID_ANY, _("Add folder..."));
+               _content_add_file->SetToolTip (_("Add video, image or sound files to the film."));
+               b->Add (_content_add_file,   0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+               
+               _content_add_folder = new wxButton (_content_panel, wxID_ANY, _("Add image\nsequence..."));
+               _content_add_folder->SetToolTip (_("Add a directory of image files which will be used as a moving image sequence."));
                b->Add (_content_add_folder, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+               
                _content_remove = new wxButton (_content_panel, wxID_ANY, _("Remove"));
-               b->Add (_content_remove, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+               _content_remove->SetToolTip (_("Remove the selected piece of content from the film."));
+               b->Add (_content_remove, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+               
                _content_earlier = new wxButton (_content_panel, wxID_ANY, _("Up"));
-               b->Add (_content_earlier, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+               _content_earlier->SetToolTip (_("Move the selected piece of content earlier in the film."));
+               b->Add (_content_earlier, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+               
                _content_later = new wxButton (_content_panel, wxID_ANY, _("Down"));
-               b->Add (_content_later, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+               _content_later->SetToolTip (_("Move the selected piece of content later in the film."));
+               b->Add (_content_later, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+
                _content_timeline = new wxButton (_content_panel, wxID_ANY, _("Timeline..."));
-               b->Add (_content_timeline, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+               _content_timeline->SetToolTip (_("Open the timeline for the film."));
+               b->Add (_content_timeline, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
 
                s->Add (b, 0, wxALL, 4);
 
                _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);
 
@@ -308,6 +317,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 */
@@ -471,6 +482,7 @@ FilmEditor::film_changed (Film::Property 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 ();
@@ -499,9 +511,6 @@ FilmEditor::film_changed (Film::Property p)
                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 ();
@@ -509,6 +518,8 @@ FilmEditor::film_changed (Film::Property p)
        case Film::INTEROP:
                checked_set (_standard, _film->interop() ? 1 : 0);
                break;
+       default:
+               break;
        }
 }
 
@@ -534,6 +545,8 @@ FilmEditor::film_content_changed (int property)
                setup_content ();
        } else if (property == ContentProperty::POSITION) {
                setup_content ();
+       } else if (property == VideoContentProperty::VIDEO_SCALE) {
+               setup_dcp_name ();
        }
 }
 
@@ -624,7 +637,6 @@ FilmEditor::set_film (shared_ptr<Film> f)
        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);
 
@@ -666,7 +678,6 @@ FilmEditor::set_general_sensitivity (bool s)
        _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);
@@ -702,6 +713,18 @@ FilmEditor::use_isdcf_name_toggled ()
        _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 ()
 {
@@ -994,16 +1017,6 @@ FilmEditor::set_selection (weak_ptr<Content> wc)
        }
 }
 
-void
-FilmEditor::sequence_video_changed ()
-{
-       if (!_film) {
-               return;
-       }
-       
-       _film->set_sequence_video (_sequence_video->GetValue ());
-}
-
 void
 FilmEditor::content_right_click (wxListEvent& ev)
 {
@@ -1060,3 +1073,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])));
+       }
+}