diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-02-24 00:17:26 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-02-24 00:17:26 +0000 |
| commit | e1ec5b2c81ec2e15d4c1d97cce8252fa34c7116a (patch) | |
| tree | 78aed756a937f979983de33f51acbf2b43744aa4 /src/wx | |
| parent | 794396aa29061894ea359a6f30aa0f759a1f1b74 (diff) | |
An unfortunately large set of timeline-related changes:
- Rename sequence_video to sequence, and sequence subtitle content
like we do video content (i.e. adding multiple subtitle contents
will result in them sequenced in time rather than overlaid).
- Stop doing selection-changed related stuff in ContentPanel
if no selection change has actually happened.
- Attempt to tidy up event handling in the timeline a bit.
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/content_panel.cc | 9 | ||||
| -rw-r--r-- | src/wx/content_panel.h | 1 | ||||
| -rw-r--r-- | src/wx/dcp_panel.cc | 2 | ||||
| -rw-r--r-- | src/wx/timeline.cc | 21 | ||||
| -rw-r--r-- | src/wx/timeline.h | 2 | ||||
| -rw-r--r-- | src/wx/timeline_content_view.cc | 9 | ||||
| -rw-r--r-- | src/wx/timeline_content_view.h | 2 | ||||
| -rw-r--r-- | src/wx/timeline_dialog.cc | 18 | ||||
| -rw-r--r-- | src/wx/timeline_dialog.h | 6 |
9 files changed, 36 insertions, 34 deletions
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index 59a43fa37..cefb5b0d9 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -228,6 +228,15 @@ ContentPanel::film_changed (Film::Property p) void ContentPanel::selection_changed () { + if (_last_selected == selected()) { + /* This was triggered by a re-build of the view but the selection + did not really change. + */ + return; + } + + _last_selected = selected (); + setup_sensitivity (); BOOST_FOREACH (ContentSubPanel* i, _panels) { diff --git a/src/wx/content_panel.h b/src/wx/content_panel.h index 5f6faa0a3..e356b5a49 100644 --- a/src/wx/content_panel.h +++ b/src/wx/content_panel.h @@ -99,6 +99,7 @@ private: ContentMenu* _menu; TimelineDialog* _timeline_dialog; wxNotebook* _parent; + ContentList _last_selected; boost::shared_ptr<Film> _film; FilmViewer* _film_viewer; diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc index c46dcba18..c8f1c0563 100644 --- a/src/wx/dcp_panel.cc +++ b/src/wx/dcp_panel.cc @@ -503,7 +503,7 @@ DCPPanel::set_film (shared_ptr<Film> film) film_changed (Film::ISDCF_METADATA); film_changed (Film::VIDEO_FRAME_RATE); film_changed (Film::AUDIO_CHANNELS); - film_changed (Film::SEQUENCE_VIDEO); + film_changed (Film::SEQUENCE); film_changed (Film::THREE_D); film_changed (Film::INTEROP); film_changed (Film::AUDIO_PROCESSOR); diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 1516202bc..a964ea98d 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr<Film> film) SetMinSize (wxSize (640, tracks() * track_height() + 96)); _film_changed_connection = film->Changed.connect (bind (&Timeline::film_changed, this, _1)); - _film_content_changed_connection = film->ContentChanged.connect (bind (&Timeline::film_content_changed, this, _2)); + _film_content_changed_connection = film->ContentChanged.connect (bind (&Timeline::film_content_changed, this, _2, _3)); } void @@ -103,11 +103,6 @@ Timeline::film_changed (Film::Property p) ensure_ui_thread (); recreate_views (); } else if (p == Film::CONTENT_ORDER) { - assign_tracks (); - if (!_left_down) { - /* Only do this if we are not dragging, as it's confusing otherwise */ - setup_pixels_per_second (); - } Refresh (); } } @@ -146,12 +141,15 @@ Timeline::recreate_views () } void -Timeline::film_content_changed (int property) +Timeline::film_content_changed (int property, bool frequent) { ensure_ui_thread (); if (property == AudioContentProperty::AUDIO_STREAMS) { recreate_views (); + } else if (!frequent) { + setup_pixels_per_second (); + Refresh (); } } @@ -311,9 +309,8 @@ Timeline::left_up (wxMouseEvent& ev) set_position_from_event (ev); - /* We don't do this during drag, and set_position_from_event above - might not have changed the position, so do it now. - */ + /* Clear up up the stuff we don't do during drag */ + assign_tracks (); setup_pixels_per_second (); Refresh (); @@ -419,7 +416,7 @@ Timeline::set_position_from_event (wxMouseEvent& ev) shared_ptr<Film> film = _film.lock (); DCPOMATIC_ASSERT (film); - film->set_sequence_video (false); + film->set_sequence (false); } void diff --git a/src/wx/timeline.h b/src/wx/timeline.h index e0e4dfb2a..c0a18ab0d 100644 --- a/src/wx/timeline.h +++ b/src/wx/timeline.h @@ -83,7 +83,7 @@ private: void right_down (wxMouseEvent &); void mouse_moved (wxMouseEvent &); void film_changed (Film::Property); - void film_content_changed (int); + void film_content_changed (int, bool frequent); void resized (); void assign_tracks (); void set_position_from_event (wxMouseEvent &); diff --git a/src/wx/timeline_content_view.cc b/src/wx/timeline_content_view.cc index 989be3fad..ed7e1d3d0 100644 --- a/src/wx/timeline_content_view.cc +++ b/src/wx/timeline_content_view.cc @@ -31,7 +31,7 @@ TimelineContentView::TimelineContentView (Timeline& tl, shared_ptr<Content> c) , _content (c) , _selected (false) { - _content_connection = c->Changed.connect (bind (&TimelineContentView::content_changed, this, _2, _3)); + _content_connection = c->Changed.connect (bind (&TimelineContentView::content_changed, this, _2)); } dcpomatic::Rect<int> @@ -152,16 +152,11 @@ TimelineContentView::y_pos (int t) const } void -TimelineContentView::content_changed (int p, bool frequent) +TimelineContentView::content_changed (int p) { ensure_ui_thread (); if (p == ContentProperty::POSITION || p == ContentProperty::LENGTH) { force_redraw (); } - - if (!frequent) { - _timeline.setup_pixels_per_second (); - _timeline.Refresh (); - } } diff --git a/src/wx/timeline_content_view.h b/src/wx/timeline_content_view.h index 676e4792b..07bfb2575 100644 --- a/src/wx/timeline_content_view.h +++ b/src/wx/timeline_content_view.h @@ -50,7 +50,7 @@ private: void do_paint (wxGraphicsContext* gc); int y_pos (int t) const; - void content_changed (int p, bool frequent); + void content_changed (int p); boost::weak_ptr<Content> _content; boost::optional<int> _track; diff --git a/src/wx/timeline_dialog.cc b/src/wx/timeline_dialog.cc index f054763c8..ac17cf6db 100644 --- a/src/wx/timeline_dialog.cc +++ b/src/wx/timeline_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,8 +40,8 @@ TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film) wxBoxSizer* controls = new wxBoxSizer (wxHORIZONTAL); _snap = new wxCheckBox (this, wxID_ANY, _("Snap")); controls->Add (_snap); - _sequence_video = new wxCheckBox (this, wxID_ANY, _("Keep video in sequence")); - controls->Add (_sequence_video, 1, wxLEFT, 12); + _sequence = new wxCheckBox (this, wxID_ANY, _("Keep video and subtitles in sequence")); + controls->Add (_sequence, 1, wxLEFT, 12); sizer->Add (controls, 0, wxALL, 12); sizer->Add (&_timeline, 1, wxEXPAND | wxALL, 12); @@ -59,8 +59,8 @@ TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film) _snap->SetValue (_timeline.snap ()); _snap->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&TimelineDialog::snap_toggled, this)); - film_changed (Film::SEQUENCE_VIDEO); - _sequence_video->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&TimelineDialog::sequence_video_toggled, this)); + film_changed (Film::SEQUENCE); + _sequence->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&TimelineDialog::sequence_toggled, this)); _film_changed_connection = film->Changed.connect (bind (&TimelineDialog::film_changed, this, _1)); } @@ -72,14 +72,14 @@ TimelineDialog::snap_toggled () } void -TimelineDialog::sequence_video_toggled () +TimelineDialog::sequence_toggled () { shared_ptr<Film> film = _film.lock (); if (!film) { return; } - film->set_sequence_video (_sequence_video->GetValue ()); + film->set_sequence (_sequence->GetValue ()); } void @@ -90,8 +90,8 @@ TimelineDialog::film_changed (Film::Property p) return; } - if (p == Film::SEQUENCE_VIDEO) { - _sequence_video->SetValue (film->sequence_video ()); + if (p == Film::SEQUENCE) { + _sequence->SetValue (film->sequence ()); } } diff --git a/src/wx/timeline_dialog.h b/src/wx/timeline_dialog.h index bc5b7228b..ce7c9113e 100644 --- a/src/wx/timeline_dialog.h +++ b/src/wx/timeline_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,12 +33,12 @@ public: private: void snap_toggled (); - void sequence_video_toggled (); + void sequence_toggled (); void film_changed (Film::Property); boost::weak_ptr<Film> _film; Timeline _timeline; wxCheckBox* _snap; - wxCheckBox* _sequence_video; + wxCheckBox* _sequence; boost::signals2::scoped_connection _film_changed_connection; }; |
