diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-08-19 01:04:59 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-08-19 01:29:04 +0100 |
| commit | 6c7489e5d778d3e71065d88a094a7383ba2c117d (patch) | |
| tree | e3f05ad03095d88d297c7d61e03e265d28a97fa3 /src/wx | |
| parent | 9a27d60ea7888d300a5a2414a477091428589b82 (diff) | |
Replace May/Done/NotDone signal sets with one signal and extend
this treatment to anything that caused Player::setup_pieces. This should
fix out-of-sequence Player emissions caused by setup_pieces being called
by one thread while the butler is calling pass().
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/audio_dialog.cc | 8 | ||||
| -rw-r--r-- | src/wx/audio_dialog.h | 2 | ||||
| -rw-r--r-- | src/wx/content_widget.h | 6 | ||||
| -rw-r--r-- | src/wx/film_editor.cc | 8 | ||||
| -rw-r--r-- | src/wx/film_editor.h | 2 | ||||
| -rw-r--r-- | src/wx/film_viewer.cc | 8 | ||||
| -rw-r--r-- | src/wx/film_viewer.h | 2 | ||||
| -rw-r--r-- | src/wx/hints_dialog.cc | 10 | ||||
| -rw-r--r-- | src/wx/hints_dialog.h | 2 | ||||
| -rw-r--r-- | src/wx/subtitle_appearance_dialog.cc | 10 | ||||
| -rw-r--r-- | src/wx/subtitle_appearance_dialog.h | 1 | ||||
| -rw-r--r-- | src/wx/timeline.cc | 8 | ||||
| -rw-r--r-- | src/wx/timeline.h | 6 | ||||
| -rw-r--r-- | src/wx/timeline_content_view.cc | 8 | ||||
| -rw-r--r-- | src/wx/timeline_content_view.h | 3 |
15 files changed, 60 insertions, 24 deletions
diff --git a/src/wx/audio_dialog.cc b/src/wx/audio_dialog.cc index 8c015ab68..e1f7c15a6 100644 --- a/src/wx/audio_dialog.cc +++ b/src/wx/audio_dialog.cc @@ -150,7 +150,7 @@ AudioDialog::AudioDialog (wxWindow* parent, shared_ptr<Film> film, shared_ptr<Co overall_sizer->Layout (); overall_sizer->SetSizeHints (this); - _film_connection = film->ContentChanged.connect (boost::bind (&AudioDialog::content_changed, this, _2)); + _film_connection = film->ContentChange.connect (boost::bind (&AudioDialog::content_change, this, _1, _3)); DCPOMATIC_ASSERT (film->directory()); SetTitle(wxString::Format(_("DCP-o-matic audio - %s"), std_to_wx(film->directory().get().string()))); @@ -282,8 +282,12 @@ AudioDialog::channel_clicked (wxCommandEvent& ev) } void -AudioDialog::content_changed (int p) +AudioDialog::content_change (ChangeType type, int p) { + if (type != CHANGE_TYPE_DONE) { + return; + } + if (p == AudioContentProperty::STREAMS) { try_to_load_analysis (); } else if (p == AudioContentProperty::GAIN) { diff --git a/src/wx/audio_dialog.h b/src/wx/audio_dialog.h index 6d4428546..2c077c9d1 100644 --- a/src/wx/audio_dialog.h +++ b/src/wx/audio_dialog.h @@ -38,7 +38,7 @@ public: void set_cursor (boost::optional<DCPTime> time, boost::optional<float> db); private: - void content_changed (int); + void content_change (ChangeType, int); void channel_clicked (wxCommandEvent &); void type_clicked (wxCommandEvent &); void smoothing_changed (); diff --git a/src/wx/content_widget.h b/src/wx/content_widget.h index e162aca49..e5125680b 100644 --- a/src/wx/content_widget.h +++ b/src/wx/content_widget.h @@ -105,7 +105,7 @@ public: update_from_model (); for (typename List::iterator i = _content.begin(); i != _content.end(); ++i) { - _connections.push_back ((*i)->Changed.connect (boost::bind (&ContentWidget::model_changed, this, _2))); + _connections.push_back ((*i)->Change.connect (boost::bind (&ContentWidget::model_changed, this, _1, _3))); } } @@ -185,9 +185,9 @@ private: } } - void model_changed (int property) + void model_changed (ChangeType type, int property) { - if (property == _property && !_ignore_model_changes) { + if (type == CHANGE_TYPE_DONE && property == _property && !_ignore_model_changes) { update_from_model (); } } diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 5380cbd9b..1c1c02f5b 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -86,8 +86,12 @@ FilmEditor::film_changed (Film::Property p) } void -FilmEditor::film_content_changed (int property) +FilmEditor::film_content_change (ChangeType type, int property) { + if (type != CHANGE_TYPE_DONE) { + return; + } + ensure_ui_thread (); if (!_film) { @@ -118,7 +122,7 @@ FilmEditor::set_film (shared_ptr<Film> film) if (_film) { _film->Changed.connect (bind (&FilmEditor::film_changed, this, _1)); - _film->ContentChanged.connect (bind (&FilmEditor::film_content_changed, this, _2)); + _film->ContentChange.connect (bind (&FilmEditor::film_content_change, this, _1, _3)); } if (_film && _film->directory()) { diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index 576cd5ba1..cd2180b3c 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -57,7 +57,7 @@ public: /* Handle changes to the model */ void film_changed (Film::Property); - void film_content_changed (int); + void film_content_change (ChangeType type, int); void set_general_sensitivity (bool); void active_jobs_changed (boost::optional<std::string>); diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 0e0fc4315..463854992 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -225,7 +225,7 @@ FilmViewer::set_film (shared_ptr<Film> film) _player->set_play_referenced (); _film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1)); - _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1, _2)); + _player->Change.connect (boost::bind (&FilmViewer::player_change, this, _1, _2, _3)); /* Keep about 1 second's worth of history samples */ _latency_history_count = _film->audio_frame_rate() / _audio_block_size; @@ -665,9 +665,9 @@ FilmViewer::forward_clicked (wxKeyboardState& ev) } void -FilmViewer::player_changed (int property, bool frequent) +FilmViewer::player_change (ChangeType type, int property, bool frequent) { - if (frequent) { + if (type != CHANGE_TYPE_DONE || frequent) { return; } @@ -780,7 +780,7 @@ FilmViewer::set_coalesce_player_changes (bool c) if (!c) { BOOST_FOREACH (int i, _pending_player_changes) { - player_changed (i, false); + player_change (CHANGE_TYPE_DONE, i, false); } _pending_player_changes.clear (); } diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index a41500ace..d6d9a99a8 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -97,7 +97,7 @@ private: void rewind_clicked (wxMouseEvent &); void back_clicked (wxKeyboardState& s); void forward_clicked (wxKeyboardState &); - void player_changed (int, bool); + void player_change (ChangeType type, int, bool); void update_position_label (); void update_position_slider (); void get (); diff --git a/src/wx/hints_dialog.cc b/src/wx/hints_dialog.cc index 2c02a4f72..3872ea8ae 100644 --- a/src/wx/hints_dialog.cc +++ b/src/wx/hints_dialog.cc @@ -76,7 +76,7 @@ HintsDialog::HintsDialog (wxWindow* parent, boost::weak_ptr<Film> film, bool ok) boost::shared_ptr<Film> locked_film = _film.lock (); if (locked_film) { _film_changed_connection = locked_film->Changed.connect (boost::bind (&HintsDialog::film_changed, this)); - _film_content_changed_connection = locked_film->ContentChanged.connect (boost::bind (&HintsDialog::film_changed, this)); + _film_content_changed_connection = locked_film->ContentChange.connect (boost::bind (&HintsDialog::film_content_change, this, _1)); } _hints->Hint.connect (bind (&HintsDialog::hint, this, _1)); @@ -107,6 +107,14 @@ HintsDialog::film_changed () } void +HintsDialog::film_content_change (ChangeType type) +{ + if (type == CHANGE_TYPE_DONE) { + film_changed (); + } +} + +void HintsDialog::update () { _text->Clear (); diff --git a/src/wx/hints_dialog.h b/src/wx/hints_dialog.h index 06f979a74..83510643a 100644 --- a/src/wx/hints_dialog.h +++ b/src/wx/hints_dialog.h @@ -18,6 +18,7 @@ */ +#include "lib/types.h" #include <wx/wx.h> #include <boost/weak_ptr.hpp> #include <boost/signals2.hpp> @@ -33,6 +34,7 @@ public: private: void film_changed (); + void film_content_change (ChangeType type); void shut_up (wxCommandEvent& ev); void update (); void hint (std::string text); diff --git a/src/wx/subtitle_appearance_dialog.cc b/src/wx/subtitle_appearance_dialog.cc index cab473c18..6473cd68b 100644 --- a/src/wx/subtitle_appearance_dialog.cc +++ b/src/wx/subtitle_appearance_dialog.cc @@ -185,11 +185,19 @@ SubtitleAppearanceDialog::SubtitleAppearanceDialog (wxWindow* parent, shared_ptr _force_fade_in->Bind (wxEVT_CHECKBOX, bind (&SubtitleAppearanceDialog::setup_sensitivity, this)); _force_fade_out->Bind (wxEVT_CHECKBOX, bind (&SubtitleAppearanceDialog::setup_sensitivity, this)); _effect->Bind (wxEVT_CHOICE, bind (&SubtitleAppearanceDialog::setup_sensitivity, this)); - _content_connection = _content->Changed.connect (bind (&SubtitleAppearanceDialog::setup_sensitivity, this)); + _content_connection = _content->Change.connect (bind (&SubtitleAppearanceDialog::content_change, this, _1)); setup_sensitivity (); } +void +SubtitleAppearanceDialog::content_change (ChangeType type) +{ + if (type == CHANGE_TYPE_DONE) { + setup_sensitivity (); + } +} + wxCheckBox* SubtitleAppearanceDialog::set_to (wxWindow* w, int& r) { diff --git a/src/wx/subtitle_appearance_dialog.h b/src/wx/subtitle_appearance_dialog.h index 6cced717b..80ef58470 100644 --- a/src/wx/subtitle_appearance_dialog.h +++ b/src/wx/subtitle_appearance_dialog.h @@ -44,6 +44,7 @@ private: void setup_sensitivity (); void restore (); wxCheckBox* set_to (wxWindow* w, int& r); + void content_change (ChangeType type); wxCheckBox* _force_colour; wxColourPickerCtrl* _colour; diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 02f8be059..7353baf82 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -110,7 +110,7 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr<Film> film) SetMinSize (wxSize (640, 4 * pixels_per_track() + 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, _3)); + _film_content_change_connection = film->ContentChange.connect (bind (&Timeline::film_content_change, this, _1, _3, _4)); setup_scrollbars (); _labels_canvas->ShowScrollbars (wxSHOW_SB_NEVER, wxSHOW_SB_NEVER); @@ -243,8 +243,12 @@ Timeline::recreate_views () } void -Timeline::film_content_changed (int property, bool frequent) +Timeline::film_content_change (ChangeType type, int property, bool frequent) { + if (type != CHANGE_TYPE_DONE) { + return; + } + ensure_ui_thread (); if (property == AudioContentProperty::STREAMS) { diff --git a/src/wx/timeline.h b/src/wx/timeline.h index 2214ee13f..9f3a4a47b 100644 --- a/src/wx/timeline.h +++ b/src/wx/timeline.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -92,7 +92,7 @@ private: void mouse_moved_select (wxMouseEvent &); void mouse_moved_zoom (wxMouseEvent &); void film_changed (Film::Property); - void film_content_changed (int, bool frequent); + void film_content_change (ChangeType type, int, bool frequent); void resized (); void assign_tracks (); void set_position_from_event (wxMouseEvent &); @@ -139,5 +139,5 @@ private: static int const _minimum_pixels_per_track; boost::signals2::scoped_connection _film_changed_connection; - boost::signals2::scoped_connection _film_content_changed_connection; + boost::signals2::scoped_connection _film_content_change_connection; }; diff --git a/src/wx/timeline_content_view.cc b/src/wx/timeline_content_view.cc index bf22e0156..12691f661 100644 --- a/src/wx/timeline_content_view.cc +++ b/src/wx/timeline_content_view.cc @@ -33,7 +33,7 @@ TimelineContentView::TimelineContentView (Timeline& tl, shared_ptr<Content> c) , _content (c) , _selected (false) { - _content_connection = c->Changed.connect (bind (&TimelineContentView::content_changed, this, _2)); + _content_connection = c->Change.connect (bind (&TimelineContentView::content_change, this, _1, _3)); } dcpomatic::Rect<int> @@ -160,8 +160,12 @@ TimelineContentView::y_pos (int t) const } void -TimelineContentView::content_changed (int p) +TimelineContentView::content_change (ChangeType type, int p) { + if (type != CHANGE_TYPE_DONE) { + return; + } + ensure_ui_thread (); if (p == ContentProperty::POSITION || p == ContentProperty::LENGTH) { diff --git a/src/wx/timeline_content_view.h b/src/wx/timeline_content_view.h index b5b000bdb..27cfed53e 100644 --- a/src/wx/timeline_content_view.h +++ b/src/wx/timeline_content_view.h @@ -21,6 +21,7 @@ #ifndef DCPOMATIC_TIMELINE_CONTENT_VIEW_H #define DCPOMATIC_TIMELINE_CONTENT_VIEW_H +#include "lib/types.h" #include "timeline_view.h" #include <wx/wx.h> #include <boost/signals2.hpp> @@ -57,7 +58,7 @@ private: void do_paint (wxGraphicsContext* gc, std::list<dcpomatic::Rect<int> > overlaps); int y_pos (int t) const; - void content_changed (int p); + void content_change (ChangeType type, int p); boost::optional<int> _track; bool _selected; |
