summaryrefslogtreecommitdiff
path: root/src/subtitle.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/subtitle.h')
-rw-r--r--src/subtitle.h74
1 files changed, 28 insertions, 46 deletions
diff --git a/src/subtitle.h b/src/subtitle.h
index ca73b4b..795b11e 100644
--- a/src/subtitle.h
+++ b/src/subtitle.h
@@ -26,6 +26,9 @@
#include "vertical_reference.h"
#include "effect.h"
#include "time_pair.h"
+#include "font_size.h"
+#include "vertical_position.h"
+#include "raw_subtitle.h"
#include <boost/optional.hpp>
#include <string>
#include <list>
@@ -42,40 +45,16 @@ public:
, italic (false)
, underline (false)
{}
+
+ /** Construct a Block taking any relevant information from a RawSubtitle */
+ Block (RawSubtitle s);
/** Subtitle text in UTF-8 */
std::string text;
std::string font;
/** font size */
- class FontSize {
- public:
- void set_proportional (float p) {
- _proportional = p;
- }
-
- void set_points (int p) {
- _points = p;
- }
-
- boost::optional<float> proportional () const {
- return _proportional;
- }
-
- boost::optional<int> points () const {
- return _points;
- }
-
- float proportional (int screen_height_in_points) const;
- int points (int screen_height_in_points) const;
-
- private:
- /** as a proportion of screen height */
- boost::optional<float> _proportional;
- /** in points */
- boost::optional<int> _points;
-
- } font_size;
+ FontSize font_size;
boost::optional<Effect> effect;
boost::optional<Colour> effect_colour;
@@ -86,27 +65,32 @@ public:
bool underline; ///< true to underline
};
-/** A line of text which starts and stops at specific times */
-class Subtitle
+/** A line of text */
+class Line
{
public:
- Subtitle ()
- {}
+ Line () {}
+
+ /** Construct a Line taking any relevant information from a RawSubtitle */
+ Line (RawSubtitle s);
/** vertical position of the baseline of the text */
- struct VerticalPosition {
+ VerticalPosition vertical_position;
+
+ std::list<Block> blocks;
- /** as a proportion of screen height offset from some reference point */
- boost::optional<float> proportional;
- /** reference position for proportional */
- boost::optional<VerticalReference> reference;
- /** line number from the top of the screen */
- boost::optional<int> line;
+ bool same_metadata (RawSubtitle) const;
+};
- bool operator== (VerticalPosition const & other) const;
-
- } vertical_position;
+class Subtitle
+{
+public:
+ Subtitle ()
+ {}
+ /** Construct a Line taking any relevant information from a RawSubtitle */
+ Subtitle (RawSubtitle s);
+
/** from time */
TimePair from;
/** to time */
@@ -115,13 +99,11 @@ public:
boost::optional<MetricTime> fade_up;
boost::optional<MetricTime> fade_down;
- std::list<Block> blocks;
+ std::list<Line> lines;
- bool same_metadata (Subtitle const &) const;
+ bool same_metadata (RawSubtitle) const;
};
-bool operator< (Subtitle const & a, Subtitle const & b);
-
}
#endif