Reword again: Text -> Caption and Plain -> Text.
[dcpomatic.git] / src / wx / content_panel.cc
index fa3754dd67381c7547641c7338c95d2634b181e0..3dc0e2b63e50e9788b0a44956e5d592c4cb69271 100644 (file)
 #include "wx_util.h"
 #include "video_panel.h"
 #include "audio_panel.h"
-#include "subtitle_panel.h"
+#include "caption_panel.h"
 #include "timing_panel.h"
 #include "timeline_dialog.h"
 #include "image_sequence_dialog.h"
 #include "film_viewer.h"
 #include "lib/audio_content.h"
-#include "lib/subtitle_content.h"
+#include "lib/text_content.h"
 #include "lib/video_content.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/content_factory.h"
@@ -39,8 +39,8 @@
 #include "lib/config.h"
 #include "lib/log.h"
 #include "lib/compose.hpp"
-#include "lib/text_subtitle_content.h"
-#include "lib/text_subtitle.h"
+#include "lib/text_caption_file_content.h"
+#include "lib/plain_text_file.h"
 #include <wx/wx.h>
 #include <wx/notebook.h>
 #include <wx/listctrl.h>
@@ -125,8 +125,8 @@ ContentPanel::ContentPanel (wxNotebook* n, boost::shared_ptr<Film> film, FilmVie
        _panels.push_back (_video_panel);
        _audio_panel = new AudioPanel (this);
        _panels.push_back (_audio_panel);
-       _subtitle_panel = new SubtitlePanel (this);
-       _panels.push_back (_subtitle_panel);
+       _caption_panel = new CaptionPanel (this);
+       _panels.push_back (_caption_panel);
        _timing_panel = new TimingPanel (this, _film_viewer);
        _panels.push_back (_timing_panel);
 
@@ -258,11 +258,11 @@ ContentPanel::selection_changed ()
        BOOST_FOREACH (shared_ptr<Content> i, selected ()) {
                DCPTime p;
                p = i->position();
-               if (dynamic_pointer_cast<TextSubtitleContent>(i)) {
+               if (dynamic_pointer_cast<TextCaptionFileContent>(i) && i->paths_valid()) {
                        /* Rather special case; if we select a text subtitle file jump to its
                           first subtitle.
                        */
-                       TextSubtitle ts (dynamic_pointer_cast<TextSubtitleContent>(i));
+                       TextCaptionFile ts (dynamic_pointer_cast<TextCaptionFileContent>(i));
                        if (ts.first()) {
                                p += DCPTime(ts.first().get(), _film->active_frame_rate_change(i->position()));
                        }
@@ -273,7 +273,7 @@ ContentPanel::selection_changed ()
        }
 
        if (go_to && Config::instance()->jump_to_selected ()) {
-               _film_viewer->set_position (go_to.get ());
+               _film_viewer->set_position (go_to.get().ceil(_film->video_frame_rate()));
        }
 
        if (_timeline_dialog) {
@@ -409,6 +409,10 @@ ContentPanel::remove_clicked (bool hotkey)
 void
 ContentPanel::timeline_clicked ()
 {
+       if (!_film) {
+               return;
+       }
+
        if (_timeline_dialog) {
                _timeline_dialog->Destroy ();
                _timeline_dialog = 0;
@@ -443,7 +447,7 @@ ContentPanel::setup_sensitivity ()
 
        _video_panel->Enable    (_generally_sensitive && video_selection.size() > 0);
        _audio_panel->Enable    (_generally_sensitive && audio_selection.size() > 0);
-       _subtitle_panel->Enable (_generally_sensitive && selection.size() == 1 && selection.front()->subtitle);
+       _caption_panel->Enable  (_generally_sensitive && selection.size() == 1 && selection.front()->subtitle);
        _timing_panel->Enable   (_generally_sensitive);
 }