X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ffilm_editor.cc;h=d0534f9c06f873accb754622412840d6149c035a;hb=888eedd469b461cd51a384518e075dbee9f6834f;hp=854877ecec86d1e063b982a95dc6fc9222facac6;hpb=6bc83f72f12c8513a1e9e9b6fd880697a73f968f;p=dcpomatic.git diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 854877ece..d0534f9c0 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -836,8 +836,8 @@ void FilmEditor::content_remove_clicked () { ContentList c = selected_content (); - if (c.size() == 1) { - _film->remove_content (c.front ()); + for (ContentList::iterator i = c.begin(); i != c.end(); ++i) { + _film->remove_content (*i); } content_selection_changed (); @@ -864,21 +864,32 @@ FilmEditor::setup_content_sensitivity () VideoContentList video_selection = selected_video_content (); AudioContentList audio_selection = selected_audio_content (); - _content_remove->Enable (selection.size() == 1 && _generally_sensitive); + _content_remove->Enable (!selection.empty() && _generally_sensitive); _content_earlier->Enable (selection.size() == 1 && _generally_sensitive); _content_later->Enable (selection.size() == 1 && _generally_sensitive); _content_timeline->Enable (!_film->content().empty() && _generally_sensitive); - _video_panel->Enable (video_selection.size() > 0 && _generally_sensitive); - _audio_panel->Enable (audio_selection.size() > 0 && _generally_sensitive); + _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 (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); @@ -887,7 +898,7 @@ FilmEditor::selected_content () } if (s < int (_film->content().size ())) { - sel.push_back (_film->content()[s]); + sel.push_back (content[s]); } }