-FontNode::FontNode (xmlpp::Node const * node)
- : XMLNode (node)
-{
- text = content ();
-
- id = optional_string_attribute ("Id");
- size = optional_int64_attribute ("Size");
- italic = optional_bool_attribute ("Italic");
- color = optional_color_attribute ("Color");
- string const e = optional_string_attribute ("Effect");
- if (!e.empty ()) {
- effect = string_to_effect (e);
- }
- effect_color = optional_color_attribute ("EffectColor");
- subtitle_nodes = type_children<SubtitleNode> ("Subtitle");
- font_nodes = type_children<FontNode> ("Font");
- text_nodes = type_children<TextNode> ("Text");
-}
-
-FontNode::FontNode (list<shared_ptr<FontNode> > const & font_nodes)
- : size (0)
- , italic (false)
- , color ("FFFFFFFF")
- , effect_color ("FFFFFFFF")
-{
- for (list<shared_ptr<FontNode> >::const_iterator i = font_nodes.begin(); i != font_nodes.end(); ++i) {
- if (!(*i)->id.empty ()) {
- id = (*i)->id;
- }
- if ((*i)->size != 0) {
- size = (*i)->size;
- }
- if ((*i)->italic) {
- italic = (*i)->italic.get ();
- }
- if ((*i)->color) {
- color = (*i)->color.get ();
- }
- if ((*i)->effect) {
- effect = (*i)->effect.get ();
- }
- if ((*i)->effect_color) {
- effect_color = (*i)->effect_color.get ();
- }
- }
-}
-
-LoadFontNode::LoadFontNode (xmlpp::Node const * node)
- : XMLNode (node)
-{
- id = string_attribute ("Id");
- uri = string_attribute ("URI");
-}
-
-
-SubtitleNode::SubtitleNode (xmlpp::Node const * node)
- : XMLNode (node)
-{
- in = time_attribute ("TimeIn");
- out = time_attribute ("TimeOut");
- font_nodes = type_children<FontNode> ("Font");
- text_nodes = type_children<TextNode> ("Text");
- fade_up_time = fade_time ("FadeUpTime");
- fade_down_time = fade_time ("FadeDownTime");
-}
-
-Time
-SubtitleNode::fade_time (string name)
-{
- string const u = optional_string_attribute (name);
- Time t;
-
- if (u.empty ()) {
- t = Time (0, 0, 0, 20);
- } else if (u.find (":") != string::npos) {
- t = Time (u);
- } else {
- t = Time (0, 0, 0, lexical_cast<int> (u));
- }
-
- if (t > Time (0, 0, 8, 0)) {
- t = Time (0, 0, 8, 0);
- }
-
- return t;
-}
-
-TextNode::TextNode (xmlpp::Node const * node)
- : XMLNode (node)
- , v_align (CENTER)
-{
- text = content ();
- v_position = float_attribute ("VPosition");
- string const v = optional_string_attribute ("VAlign");
- if (!v.empty ()) {
- v_align = string_to_valign (v);
- }
-
- font_nodes = type_children<FontNode> ("Font");
-}
-