Subtitle rearrangements.
[dcpomatic.git] / src / lib / subtitle_content.h
index 99cf3b3825f2050971a72ed515c6f0acd07fb18b..5982cc52c0e36aa7eed6b6c39ba90785f4b2f0cf 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #ifndef DCPOMATIC_SUBTITLE_CONTENT_H
 #define DCPOMATIC_SUBTITLE_CONTENT_H
 
-#include "content.h"
+#include "content_part.h"
+#include <libcxml/cxml.h>
+#include <dcp/types.h>
+#include <boost/signals2.hpp>
 
 class Font;
 
@@ -35,28 +38,26 @@ public:
        static int const BURN_SUBTITLES;
        static int const SUBTITLE_LANGUAGE;
        static int const FONTS;
+       static int const SUBTITLE_VIDEO_FRAME_RATE;
+       static int const SUBTITLE_COLOUR;
+       static int const SUBTITLE_OUTLINE;
+       static int const SUBTITLE_OUTLINE_COLOUR;
 };
 
-/** @class SubtitleContent
- *  @brief Parent for content which has the potential to include subtitles.
- *
- *  Although inheriting from this class indicates that the content could
- *  have subtitles, it may not.  ::has_subtitles() will tell you.
- */
-class SubtitleContent : public virtual Content
+class SubtitleContent : public ContentPart
 {
 public:
-       SubtitleContent (boost::shared_ptr<const Film>);
-       SubtitleContent (boost::shared_ptr<const Film>, boost::filesystem::path);
-       SubtitleContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int version);
-       SubtitleContent (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
+       SubtitleContent (Content* parent, boost::shared_ptr<const Film>);
+       SubtitleContent (Content* parent, boost::shared_ptr<const Film>, cxml::ConstNodePtr, int version);
+       SubtitleContent (Content* parent, boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
 
        void as_xml (xmlpp::Node *) const;
        std::string identifier () const;
 
-       bool has_subtitles () const;
-       virtual bool has_text_subtitles () const = 0;
-       virtual bool has_image_subtitles () const = 0;
+       bool has_image_subtitles () const {
+               /* XXX */
+               return true;
+       }
 
        void add_font (boost::shared_ptr<Font> font);
 
@@ -108,6 +109,27 @@ public:
                return _subtitle_language;
        }
 
+       void set_colour (dcp::Colour);
+
+       dcp::Colour colour () const {
+               boost::mutex::scoped_lock lm (_mutex);
+               return _colour;
+       }
+
+       void set_outline (bool);
+
+       bool outline () const {
+               boost::mutex::scoped_lock lm (_mutex);
+               return _outline;
+       }
+
+       void set_outline_colour (dcp::Colour);
+
+       dcp::Colour outline_colour () const {
+               boost::mutex::scoped_lock lm (_mutex);
+               return _outline_colour;
+       }
+
 protected:
        /** subtitle language (e.g. "German") or empty if it is not known */
        std::string _subtitle_language;
@@ -132,6 +154,9 @@ private:
        /** y scale factor to apply to subtitles */
        double _subtitle_y_scale;
        std::list<boost::shared_ptr<Font> > _fonts;
+       dcp::Colour _colour;
+       bool _outline;
+       dcp::Colour _outline_colour;
        std::list<boost::signals2::connection> _font_connections;
 };