X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fcontent_panel.cc;h=69dd724266abfc35a780f141833587c2853bd13a;hb=59953282b9f9da1164f39181347a01672c4f674c;hp=5ec503720ca91ce0f8875bb7470ae611adbe9982;hpb=19e47294d1de485a12dccf2c25bec0c8144049e8;p=dcpomatic.git diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index 5ec503720..69dd72426 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -36,6 +36,8 @@ #include "lib/content_factory.h" #include "lib/cross.h" #include "lib/dcp_content.h" +#include "lib/dcp_subtitle_content.h" +#include "lib/dcp_subtitle_decoder.h" #include "lib/dcpomatic_log.h" #include "lib/ffmpeg_content.h" #include "lib/image_content.h" @@ -45,20 +47,20 @@ #include "lib/string_text_file_content.h" #include "lib/text_content.h" #include "lib/video_content.h" -#include -#include -#include +#include +LIBDCP_DISABLE_WARNINGS #include +#include +#include +#include +LIBDCP_ENABLE_WARNINGS #include -#include -using std::cout; using std::dynamic_pointer_cast; using std::exception; using std::list; using std::make_shared; -using std::max; using std::shared_ptr; using std::string; using std::vector; @@ -85,7 +87,7 @@ ContentPanel::ContentPanel (wxNotebook* n, shared_ptr film, weak_ptr film, weak_ptrSetToolTip (_("Add a folder of image files (which will be used as a moving image sequence) or a folder of sound files.")); - b->Add (_add_folder, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); + b->Add (_add_folder, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); _add_dcp = new Button (_top_panel, _("Add DCP...")); _add_dcp->SetToolTip (_("Add a DCP.")); - b->Add (_add_dcp, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); + b->Add (_add_dcp, 0, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP); _remove = new Button (_top_panel, _("Remove")); _remove->SetToolTip (_("Remove the selected piece of content from the film.")); @@ -300,20 +302,27 @@ ContentPanel::check_selection () } optional go_to; - for (auto i: selected()) { - DCPTime p; - p = i->position(); - if (dynamic_pointer_cast(i) && i->paths_valid()) { - /* Rather special case; if we select a text subtitle file jump to its - first subtitle. - */ - StringTextFile ts (dynamic_pointer_cast(i)); - if (ts.first()) { - p += DCPTime(ts.first().get(), _film->active_frame_rate_change(i->position())); + for (auto content: selected()) { + if (content->paths_valid()) { + auto position = content->position(); + if (auto text_content = dynamic_pointer_cast(content)) { + /* Rather special case; if we select a text subtitle file jump to its + first subtitle. + */ + StringTextFile ts(text_content); + if (auto first = ts.first()) { + position += DCPTime(first.get(), _film->active_frame_rate_change(content->position())); + } + } else if (auto dcp_content = dynamic_pointer_cast(content)) { + /* Do the same for DCP subtitles */ + DCPSubtitleDecoder ts(_film, dcp_content); + if (auto first = ts.first()) { + position += DCPTime(first.get(), _film->active_frame_rate_change(content->position())); + } + } + if (!go_to || position < go_to.get()) { + go_to = position; } - } - if (!go_to || p < go_to.get()) { - go_to = p; } }