summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-07-28 22:20:19 +0200
committerCarl Hetherington <cth@carlh.net>2020-07-28 22:20:19 +0200
commitd902160e3c89a9f65f58a2463fac0b1de1d940b1 (patch)
treec1071f5b3f1046dda4820b4991331b21230fcaa6
parente83e799c027346681208c57181b28010d01c9b6e (diff)
Fix various problems with the closed caption viewer not being updated properly.v2.15.91
-rw-r--r--src/wx/closed_captions_dialog.cc17
-rw-r--r--src/wx/closed_captions_dialog.h3
-rw-r--r--src/wx/film_viewer.cc18
-rw-r--r--src/wx/film_viewer.h1
4 files changed, 35 insertions, 4 deletions
diff --git a/src/wx/closed_captions_dialog.cc b/src/wx/closed_captions_dialog.cc
index afcf5fa87..625652b8c 100644
--- a/src/wx/closed_captions_dialog.cc
+++ b/src/wx/closed_captions_dialog.cc
@@ -205,6 +205,12 @@ ClosedCaptionsDialog::update ()
Refresh ();
_current_in_lines = true;
}
+
+ if (!_current && _tracks.empty()) {
+ for (int i = 0; i < CLOSED_CAPTION_LINES; ++i) {
+ _lines[i] = wxString();
+ }
+ }
}
void
@@ -215,8 +221,15 @@ ClosedCaptionsDialog::clear ()
Refresh ();
}
+
+void
+ClosedCaptionsDialog::set_butler (weak_ptr<Butler> butler)
+{
+ _butler = butler;
+}
+
void
-ClosedCaptionsDialog::set_film_and_butler (shared_ptr<Film> film, weak_ptr<Butler> butler)
+ClosedCaptionsDialog::update_tracks (shared_ptr<const Film> film)
{
_tracks.clear ();
@@ -239,5 +252,5 @@ ClosedCaptionsDialog::set_film_and_butler (shared_ptr<Film> film, weak_ptr<Butle
_track->SetSelection (0);
}
- _butler = butler;
+ track_selected ();
}
diff --git a/src/wx/closed_captions_dialog.h b/src/wx/closed_captions_dialog.h
index cfdab5f3c..4117de263 100644
--- a/src/wx/closed_captions_dialog.h
+++ b/src/wx/closed_captions_dialog.h
@@ -35,7 +35,8 @@ public:
explicit ClosedCaptionsDialog (wxWindow* parent, FilmViewer* viewer);
void clear ();
- void set_film_and_butler (boost::shared_ptr<Film>, boost::weak_ptr<Butler>);
+ void update_tracks (boost::shared_ptr<const Film> film);
+ void set_butler (boost::weak_ptr<Butler>);
private:
void shown (wxShowEvent);
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 21a35c227..154b3a5fd 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -47,6 +47,7 @@
#include "lib/config.h"
#include "lib/compose.hpp"
#include "lib/dcpomatic_log.h"
+#include "lib/text_content.h"
extern "C" {
#include <libavutil/pixfmt.h>
}
@@ -179,6 +180,7 @@ FilmViewer::set_film (shared_ptr<Film> film)
_player->set_play_referenced ();
_film->Change.connect (boost::bind (&FilmViewer::film_change, this, _1, _2));
+ _film->ContentChange.connect (boost::bind(&FilmViewer::content_change, this, _1, _3));
_film->LengthChange.connect (boost::bind(&FilmViewer::film_length_change, this));
_player->Change.connect (boost::bind (&FilmViewer::player_change, this, _1, _2, _3));
@@ -221,7 +223,7 @@ FilmViewer::recreate_butler ()
_butler->disable_audio ();
}
- _closed_captions_dialog->set_film_and_butler (_film, _butler);
+ _closed_captions_dialog->set_butler (_butler);
resume ();
}
@@ -408,6 +410,8 @@ FilmViewer::film_change (ChangeType type, Film::Property p)
_video_view->set_video_frame_rate (_film->video_frame_rate());
} else if (p == Film::THREE_D) {
_video_view->set_three_d (_film->three_d());
+ } else if (p == Film::CONTENT) {
+ _closed_captions_dialog->update_tracks (_film);
}
}
@@ -703,3 +707,15 @@ FilmViewer::gets () const
}
+void
+FilmViewer::content_change (ChangeType type, int property)
+{
+ if (type != CHANGE_TYPE_DONE) {
+ return;
+ }
+
+ if (property == TextContentProperty::USE || property == TextContentProperty::TYPE || property == TextContentProperty::DCP_TRACK) {
+ _closed_captions_dialog->update_tracks (_film);
+ }
+}
+
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 6e995813c..11a4731fc 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -161,6 +161,7 @@ private:
void idle_handler ();
void request_idle_display_next_frame ();
void film_change (ChangeType, Film::Property);
+ void content_change (ChangeType, int property);
void recreate_butler ();
void config_changed (Config::Property);
void film_length_change ();