+ _timeline_dialog->set_selection (selected());
+ }
+
+ /* Make required tabs visible */
+
+ if (_notebook->GetPageCount() > 1) {
+ /* There's more than one tab in the notebook so the current selection could be meaningful
+ to the user; store it so that we can try to restore it later.
+ */
+ _last_selected_tab = 0;
+ if (_notebook->GetSelection() != wxNOT_FOUND) {
+ _last_selected_tab = _notebook->GetPage(_notebook->GetSelection());
+ }
+ }
+
+ bool have_video = false;
+ bool have_audio = false;
+ bool have_text[TEXT_COUNT] = { false, false };
+ BOOST_FOREACH (shared_ptr<Content> i, selected()) {
+ if (i->video) {
+ have_video = true;
+ }
+ if (i->audio) {
+ have_audio = true;
+ }
+ BOOST_FOREACH (shared_ptr<TextContent> j, i->text) {
+ have_text[j->original_type()] = true;
+ }
+ }
+
+ int off = 0;
+
+ if (have_video && !_video_panel) {
+ _video_panel = new VideoPanel (this);
+ _notebook->InsertPage (off, _video_panel, _video_panel->name());
+ } else if (!have_video && _video_panel) {
+ _notebook->DeletePage (off);
+ _video_panel = 0;
+ }
+
+ if (have_video) {
+ ++off;