+ , _viewer (viewer)
+ /* XXX: empirical and probably unhelpful default size here; needs to be related to font metrics */
+ , _display (new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(640, (640 / 10) + 64)))
+ , _track (new wxChoice(this, wxID_ANY))
+ , _current_in_lines (false)
+ , _timer (this)
+{
+ _lines.resize (MAX_CLOSED_CAPTION_LINES);
+
+ wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+
+ wxBoxSizer* track_sizer = new wxBoxSizer (wxHORIZONTAL);
+ add_label_to_sizer (track_sizer, this, _("Track"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL);
+ track_sizer->Add (_track, 0, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
+
+ sizer->Add (track_sizer, 0, wxALL, DCPOMATIC_SIZER_GAP);
+ sizer->Add (_display, 1, wxEXPAND);
+
+ Bind (wxEVT_SHOW, boost::bind(&ClosedCaptionsDialog::shown, this, _1));
+ Bind (wxEVT_TIMER, boost::bind(&ClosedCaptionsDialog::update, this));
+ _display->Bind (wxEVT_PAINT, boost::bind(&ClosedCaptionsDialog::paint, this));
+ _track->Bind (wxEVT_CHOICE, boost::bind(&ClosedCaptionsDialog::track_selected, this));
+
+ SetSizerAndFit (sizer);
+}
+
+void
+ClosedCaptionsDialog::shown (wxShowEvent ev)
+{
+ if (ev.IsShown ()) {
+ _timer.Start (40);
+ } else {
+ _timer.Stop ();
+ }
+}