Updated nl_NL translation from Rob van Nieuwkerk.
[dcpomatic.git] / src / wx / closed_captions_dialog.cc
index 8e007c38fcae29daf93438cd986c6f49b00c0d10..5403e7f2e745f3aaeed41e1af87124470fb91ce0 100644 (file)
@@ -148,10 +148,11 @@ ClosedCaptionsDialog::update (DCPTime time)
                _current = optional<TextRingBuffers::Data>();
        }
 
-       if (!_current) {
+       if (!_current && !_tracks.empty()) {
                /* We have no current one: get another */
                shared_ptr<Butler> butler = _butler.lock ();
                DCPOMATIC_ASSERT (butler);
+               DCPOMATIC_ASSERT (_track->GetSelection() >= 0);
                DCPOMATIC_ASSERT (_track->GetSelection() < int(_tracks.size()));
                DCPTextTrack track = _tracks[_track->GetSelection()];
                while (true) {
@@ -190,6 +191,12 @@ ClosedCaptionsDialog::update (DCPTime time)
                Refresh ();
                _current_in_lines = true;
        }
+
+       if (!_current && _tracks.empty()) {
+               for (int i = 0; i < CLOSED_CAPTION_LINES; ++i) {
+                       _lines[i] = wxString();
+               }
+       }
 }
 
 void
@@ -200,8 +207,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 ();
 
@@ -224,5 +238,5 @@ ClosedCaptionsDialog::set_film_and_butler (shared_ptr<Film> film, weak_ptr<Butle
                _track->SetSelection (0);
        }
 
-       _butler = butler;
+       track_selected ();
 }