X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ffilm_editor.cc;h=fd1dd2b33ac7a5b1b727289d61ef0fd8d8ef15e5;hb=cb83eb7b209054da2f81b456a0fbda6ea9d03844;hp=99b3c59a5e6450f1848b2c2e56ffc8eb64521953;hpb=deafd62ea410aa23b6b4c87989e8bc7e95db46e3;p=dcpomatic.git diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 99b3c59a5..fd1dd2b33 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -470,7 +470,7 @@ FilmEditor::film_changed (Film::Property p) } void -FilmEditor::film_content_changed (weak_ptr weak_content, int property) +FilmEditor::film_content_changed (int property) { ensure_ui_thread (); @@ -481,13 +481,8 @@ FilmEditor::film_content_changed (weak_ptr weak_content, int property) return; } - shared_ptr content = weak_content.lock (); - if (!content || content != selected_content ()) { - return; - } - for (list::iterator i = _panels.begin(); i != _panels.end(); ++i) { - (*i)->film_content_changed (content, property); + (*i)->film_content_changed (property); } if (property == FFmpegContentProperty::AUDIO_STREAM) { @@ -561,7 +556,7 @@ FilmEditor::set_film (shared_ptr f) if (_film) { _film->Changed.connect (bind (&FilmEditor::film_changed, this, _1)); - _film->ContentChanged.connect (bind (&FilmEditor::film_content_changed, this, _1, _2)); + _film->ContentChanged.connect (bind (&FilmEditor::film_content_changed, this, _2)); } if (_film) { @@ -775,9 +770,9 @@ FilmEditor::content_add_folder_clicked () void FilmEditor::content_remove_clicked () { - shared_ptr c = selected_content (); - if (c) { - _film->remove_content (c); + ContentList c = selected_content (); + if (c.size() == 1) { + _film->remove_content (c.front ()); } content_selection_changed (); @@ -787,29 +782,10 @@ void FilmEditor::content_selection_changed () { setup_content_sensitivity (); - shared_ptr s = selected_content (); - - /* All other sensitivity in content panels should be triggered by - one of these. - */ - film_content_changed (s, ContentProperty::POSITION); - film_content_changed (s, ContentProperty::LENGTH); - film_content_changed (s, ContentProperty::TRIM_START); - film_content_changed (s, ContentProperty::TRIM_END); - film_content_changed (s, VideoContentProperty::VIDEO_CROP); - film_content_changed (s, VideoContentProperty::VIDEO_RATIO); - film_content_changed (s, VideoContentProperty::VIDEO_FRAME_TYPE); - film_content_changed (s, VideoContentProperty::COLOUR_CONVERSION); - film_content_changed (s, AudioContentProperty::AUDIO_GAIN); - film_content_changed (s, AudioContentProperty::AUDIO_DELAY); - film_content_changed (s, AudioContentProperty::AUDIO_MAPPING); - film_content_changed (s, FFmpegContentProperty::AUDIO_STREAM); - film_content_changed (s, FFmpegContentProperty::AUDIO_STREAMS); - film_content_changed (s, FFmpegContentProperty::SUBTITLE_STREAM); - film_content_changed (s, FFmpegContentProperty::SUBTITLE_STREAMS); - film_content_changed (s, FFmpegContentProperty::FILTERS); - film_content_changed (s, SubtitleContentProperty::SUBTITLE_OFFSET); - film_content_changed (s, SubtitleContentProperty::SUBTITLE_SCALE); + + for (list::iterator i = _panels.begin(); i != _panels.end(); ++i) { + (*i)->content_selection_changed (); + } } /** Set up broad sensitivity based on the type of content that is selected */ @@ -819,17 +795,18 @@ FilmEditor::setup_content_sensitivity () _content_add_file->Enable (_generally_sensitive); _content_add_folder->Enable (_generally_sensitive); - shared_ptr selection = selected_content (); + ContentList selection = selected_content (); + VideoContentList video_selection = selected_video_content (); - _content_remove->Enable (selection && _generally_sensitive); - _content_earlier->Enable (selection && _generally_sensitive); - _content_later->Enable (selection && _generally_sensitive); + _content_remove->Enable (selection.size() == 1 && _generally_sensitive); + _content_earlier->Enable (selection.size() == 1 && _generally_sensitive); + _content_later->Enable (selection.size() == 1 && _generally_sensitive); _content_timeline->Enable (_generally_sensitive); - _video_panel->Enable (selection && dynamic_pointer_cast (selection) && _generally_sensitive); - _audio_panel->Enable (selection && dynamic_pointer_cast (selection) && _generally_sensitive); - _subtitle_panel->Enable (selection && dynamic_pointer_cast (selection) && _generally_sensitive); - _timing_panel->Enable (selection && _generally_sensitive); + _video_panel->Enable (video_selection.size() > 0 && _generally_sensitive); + _audio_panel->Enable (selection.size() == 1 && dynamic_pointer_cast (selection.front()) && _generally_sensitive); + _subtitle_panel->Enable (selection.size() == 1 && dynamic_pointer_cast (selection.front()) && _generally_sensitive); + _timing_panel->Enable (selection.size() == 1 && _generally_sensitive); } ContentList @@ -843,7 +820,7 @@ FilmEditor::selected_content () break; } - sel.push_back (_film->content[s]); + sel.push_back (_film->content()[s]); } return sel; @@ -897,6 +874,22 @@ FilmEditor::selected_subtitle_content () return sc; } +FFmpegContentList +FilmEditor::selected_ffmpeg_content () +{ + ContentList c = selected_content (); + FFmpegContentList sc; + + for (ContentList::iterator i = c.begin(); i != c.end(); ++i) { + shared_ptr t = dynamic_pointer_cast (*i); + if (t) { + sc.push_back (t); + } + } + + return sc; +} + void FilmEditor::content_timeline_clicked () { @@ -935,11 +928,7 @@ FilmEditor::sequence_video_changed () void FilmEditor::content_right_click (wxListEvent& ev) { - ContentList cl; - if (selected_content ()) { - cl.push_back (selected_content ()); - } - _menu.popup (cl, ev.GetPoint ()); + _menu.popup (selected_content (), ev.GetPoint ()); } void @@ -955,13 +944,19 @@ FilmEditor::three_d_changed () void FilmEditor::content_earlier_clicked () { - _film->move_content_earlier (selected_content ()); - content_selection_changed (); + ContentList sel = selected_content (); + if (sel.size() == 1) { + _film->move_content_earlier (sel.front ()); + content_selection_changed (); + } } void FilmEditor::content_later_clicked () { - _film->move_content_later (selected_content ()); - content_selection_changed (); + ContentList sel = selected_content (); + if (sel.size() == 1) { + _film->move_content_later (sel.front ()); + content_selection_changed (); + } }