Cleanup: extract HAlign to its own files.
[libdcp.git] / src / subtitle.h
index 8dba299de6b6aa2d8d9f4b9ccf14eaef79c2d955..1ca3f9d449d02c556412e9d6d588a4f2cee7706e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
     files in the program, then also delete it here.
 */
 
-#ifndef LIBDCP_SUBTITLE_H
-#define LIBDCP_SUBTITLE_H
 
 /** @file  src/subtitle.h
- *  @brief Subtitle class.
+ *  @brief Subtitle class
  */
 
+
+#ifndef LIBDCP_SUBTITLE_H
+#define LIBDCP_SUBTITLE_H
+
+
 #include "dcp_time.h"
+#include "h_align.h"
+#include "v_align.h"
+
 
 namespace dcp {
 
+
+class EqualityOptions;
+
+
 class Subtitle
 {
 public:
-       Subtitle (
-               Time in,
-               Time out,
-               float h_position,
-               HAlign h_align,
-               float v_position,
-               VAlign v_align,
-               Time fade_up_time,
-               Time fade_down_time
-               );
-
        virtual ~Subtitle () {}
 
+       /** @return subtitle start time (relative to the start of the reel) */
        Time in () const {
                return _in;
        }
 
+       /** @return subtitle finish time (relative to the start of the reel) */
        Time out () const {
                return _out;
        }
@@ -86,6 +87,10 @@ public:
                return _v_align;
        }
 
+       float z_position() const {
+               return _z_position;
+       }
+
        Time fade_up_time () const {
                return _fade_up_time;
        }
@@ -113,32 +118,53 @@ public:
                _v_position = p;
        }
 
-       void set_fade_up_time (dcp::Time t) {
+       void set_z_position(float z) {
+               _z_position = z;
+       }
+
+       void set_fade_up_time (Time t) {
                _fade_up_time = t;
        }
 
-       void set_fade_down_time (dcp::Time t) {
+       void set_fade_down_time (Time t) {
                _fade_down_time = t;
        }
 
+       virtual bool equals(std::shared_ptr<const dcp::Subtitle> other, EqualityOptions const& options, NoteHandler note) const;
 
 protected:
+
+       Subtitle (
+               Time in,
+               Time out,
+               float h_position,
+               HAlign h_align,
+               float v_position,
+               VAlign v_align,
+               float z_position,
+               Time fade_up_time,
+               Time fade_down_time
+               );
+
        Time _in;
        Time _out;
        /** Horizontal position as a proportion of the screen width from the _h_align
         *  (between 0 and 1)
         */
-       float _h_position;
-       HAlign _h_align;
+       float _h_position = 0;
+       HAlign _h_align = HAlign::CENTER;
        /** Vertical position as a proportion of the screen height from the _v_align
         *  (between 0 and 1)
         */
-       float _v_position;
-       VAlign _v_align;
+       float _v_position = 0;
+       VAlign _v_align = VAlign::CENTER;
+       float _z_position = 0;
        Time _fade_up_time;
        Time _fade_down_time;
 };
 
+
 }
 
+
 #endif