summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-07-23 16:42:28 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-23 16:42:28 +0100
commit24dcab1d4d8d7a28a939c7c4d786197684f155f6 (patch)
treecdd795a6caff66d17e35ed97fbb8b8d39f4fe9fc
parenta5c629cb9b638b67a0e4c2d26fe9ab2e124bf0eb (diff)
Introduce the idea of unknown original subtitle type to clean up the GUI a bit.
-rw-r--r--src/lib/dcp_content.cc2
-rw-r--r--src/lib/dcp_subtitle_content.cc2
-rw-r--r--src/lib/ffmpeg_content.cc2
-rw-r--r--src/lib/string_text_file_content.cc3
-rw-r--r--src/lib/text_content.cc9
-rw-r--r--src/lib/text_content.h2
-rw-r--r--src/lib/types.cc8
-rw-r--r--src/lib/types.h1
-rw-r--r--src/wx/text_panel.cc9
9 files changed, 27 insertions, 11 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index 5371fbc11..b6a66f90a 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -193,7 +193,7 @@ DCPContent::examine (shared_ptr<Job> job)
_name = examiner->name ();
for (int i = 0; i < TEXT_COUNT; ++i) {
if (examiner->has_text(static_cast<TextType>(i))) {
- text.push_back (shared_ptr<TextContent>(new TextContent(this, static_cast<TextType>(i))));
+ text.push_back (shared_ptr<TextContent>(new TextContent(this, static_cast<TextType>(i), static_cast<TextType>(i))));
}
}
texts = text.size ();
diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc
index 5acc51ac4..a8e98d426 100644
--- a/src/lib/dcp_subtitle_content.cc
+++ b/src/lib/dcp_subtitle_content.cc
@@ -40,7 +40,7 @@ using dcp::raw_convert;
DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
{
- text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE)));
+ text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_OPEN_SUBTITLE)));
}
DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index fc2a3ff40..ebcbcc47e 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -304,7 +304,7 @@ FFmpegContent::examine (shared_ptr<Job> job)
_subtitle_streams = examiner->subtitle_streams ();
if (!_subtitle_streams.empty ()) {
text.clear ();
- text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE)));
+ text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_UNKNOWN)));
_subtitle_stream = _subtitle_streams.front ();
}
diff --git a/src/lib/string_text_file_content.cc b/src/lib/string_text_file_content.cc
index 2698dbb6d..9c941c2bb 100644
--- a/src/lib/string_text_file_content.cc
+++ b/src/lib/string_text_file_content.cc
@@ -33,12 +33,13 @@
using std::string;
using std::cout;
using boost::shared_ptr;
+using boost::optional;
using dcp::raw_convert;
StringTextFileContent::StringTextFileContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
{
- text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE)));
+ text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_UNKNOWN)));
}
StringTextFileContent::StringTextFileContent (shared_ptr<const Film> film, cxml::ConstNodePtr node, int version)
diff --git a/src/lib/text_content.cc b/src/lib/text_content.cc
index 011c42f35..761ffc6b7 100644
--- a/src/lib/text_content.cc
+++ b/src/lib/text_content.cc
@@ -57,7 +57,7 @@ int const TextContentProperty::FADE_OUT = 513;
int const TextContentProperty::OUTLINE_WIDTH = 514;
int const TextContentProperty::TYPE = 515;
-TextContent::TextContent (Content* parent, TextType original_type)
+TextContent::TextContent (Content* parent, TextType type, TextType original_type)
: ContentPart (parent)
, _use (false)
, _burn (false)
@@ -67,7 +67,7 @@ TextContent::TextContent (Content* parent, TextType original_type)
, _y_scale (1)
, _line_spacing (1)
, _outline_width (2)
- , _type (original_type)
+ , _type (type)
, _original_type (original_type)
{
@@ -121,7 +121,6 @@ TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version)
, _line_spacing (node->optional_number_child<double>("LineSpacing").get_value_or (1))
, _outline_width (node->optional_number_child<int>("OutlineWidth").get_value_or (2))
, _type (TEXT_OPEN_SUBTITLE)
- , _original_type (TEXT_OPEN_SUBTITLE)
{
if (version >= 37) {
_use = node->bool_child ("Use");
@@ -226,7 +225,9 @@ TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version)
connect_to_fonts ();
_type = string_to_text_type (node->optional_string_child("Type").get_value_or("open"));
- _original_type = string_to_text_type (node->optional_string_child("OriginalType").get_value_or("open"));
+ if (node->optional_string_child("OriginalType")) {
+ _original_type = string_to_text_type (node->optional_string_child("OriginalType").get());
+ }
}
TextContent::TextContent (Content* parent, vector<shared_ptr<Content> > c)
diff --git a/src/lib/text_content.h b/src/lib/text_content.h
index 5aacc7ecf..e5981acaf 100644
--- a/src/lib/text_content.h
+++ b/src/lib/text_content.h
@@ -58,7 +58,7 @@ public:
class TextContent : public ContentPart
{
public:
- TextContent (Content* parent, TextType original_type);
+ TextContent (Content* parent, TextType type, TextType original_type);
TextContent (Content* parent, std::vector<boost::shared_ptr<Content> >);
void as_xml (xmlpp::Node *) const;
diff --git a/src/lib/types.cc b/src/lib/types.cc
index d25c9aba4..b193ac9cf 100644
--- a/src/lib/types.cc
+++ b/src/lib/types.cc
@@ -96,7 +96,9 @@ Crop::as_xml (xmlpp::Node* node) const
TextType
string_to_text_type (string s)
{
- if (s == "open-subtitle") {
+ if (s == "unknown") {
+ return TEXT_UNKNOWN;
+ } else if (s == "open-subtitle") {
return TEXT_OPEN_SUBTITLE;
} else if (s == "closed") {
return TEXT_CLOSED_CAPTION;
@@ -109,6 +111,8 @@ string
text_type_to_string (TextType t)
{
switch (t) {
+ case TEXT_UNKNOWN:
+ return "unknown";
case TEXT_OPEN_SUBTITLE:
return "open-subtitle";
case TEXT_CLOSED_CAPTION:
@@ -122,6 +126,8 @@ string
text_type_to_name (TextType t)
{
switch (t) {
+ case TEXT_UNKNOWN:
+ return _("Timed text");
case TEXT_OPEN_SUBTITLE:
return _("Open subtitles");
case TEXT_CLOSED_CAPTION:
diff --git a/src/lib/types.h b/src/lib/types.h
index 02d71e297..42e2e3eec 100644
--- a/src/lib/types.h
+++ b/src/lib/types.h
@@ -144,6 +144,7 @@ enum ReelType
*/
enum TextType
{
+ TEXT_UNKNOWN,
TEXT_OPEN_SUBTITLE,
TEXT_CLOSED_CAPTION,
TEXT_COUNT
diff --git a/src/wx/text_panel.cc b/src/wx/text_panel.cc
index 81ea9c941..980dd36cb 100644
--- a/src/wx/text_panel.cc
+++ b/src/wx/text_panel.cc
@@ -42,8 +42,10 @@ using std::string;
using std::list;
using std::cout;
using boost::shared_ptr;
+using boost::optional;
using boost::dynamic_pointer_cast;
+/** @param t Original text type of the content, if known */
TextPanel::TextPanel (ContentPanel* p, TextType t)
: ContentSubPanel (p, std_to_wx(text_type_to_name(t)))
, _text_view (0)
@@ -52,7 +54,12 @@ TextPanel::TextPanel (ContentPanel* p, TextType t)
{
wxBoxSizer* reference_sizer = new wxBoxSizer (wxVERTICAL);
- _reference = new wxCheckBox (this, wxID_ANY, _("Use this DCP's subtitle as OV and make VF"));
+ wxString refer = _("Use this DCP's subtitle as OV and make VF");
+ if (t == TEXT_CLOSED_CAPTION) {
+ refer = _("Use this DCP's closed caption as OV and make VF");
+ }
+
+ _reference = new wxCheckBox (this, wxID_ANY, refer);
reference_sizer->Add (_reference, 0, wxLEFT | wxRIGHT | wxTOP, DCPOMATIC_SIZER_GAP);
_reference_note = new wxStaticText (this, wxID_ANY, _(""));