2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
28 struct Point
{float x
, y
;};
29 struct PointAuto
: public Point
{bool auto_x
, auto_y
;};
30 struct Size
{float cx
, cy
;};
31 struct Rect
{float t
, r
, b
, l
;};
32 struct Align
{float v
, h
;};
33 struct Angle
{float x
, y
, z
;};
34 struct Color
{float a
, r
, g
, b
; operator DWORD(); void operator = (DWORD c
);};
35 struct Frame
{CStringW reference
; Size resolution
;};
36 struct Direction
{CStringW primary
, secondary
;};
37 struct Time
{float start
, stop
;};
38 struct Background
{Color color
; float size
, blur
; CStringW type
;};
39 struct Shadow
{Color color
; float depth
, angle
, blur
;};
41 class Path
: public CAtlArray
<Point
>
45 Path(const Path
& path
) {*this = path
;}
46 Path
& operator = (const Path
& path
) {Copy(path
); return *this;}
47 Path(LPCWSTR str
) {*this = str
;}
48 Path
& operator = (LPCWSTR str
);
68 bool underline
, strikethrough
, italic
;
76 static unsigned int gen_id
;
80 struct Fill() : id(0) {}
88 Background background
;
92 bool IsSimilar(const Style
& s
);
97 enum {SP
= 0x20, NBSP
= 0xa0, LSEP
= 0x0a};
104 static struct n2n_t
{StringMapW
<float> align
[2], weight
, transition
;} m_n2n
;
108 void GetStyle(Definition
* pDef
, Style
& style
);
109 float GetMixWeight(Definition
* pDef
, float at
, StringMapW
<float>& offset
, int default_id
);
110 template<class T
> bool MixValue(Definition
& def
, T
& value
, float t
);
111 template<> bool MixValue(Definition
& def
, float& value
, float t
);
112 template<class T
> bool MixValue(Definition
& def
, T
& value
, float t
, StringMapW
<T
>* n2n
);
113 template<> bool MixValue(Definition
& def
, float& value
, float t
, StringMapW
<float>* n2n
);
114 template<> bool MixValue(Definition
& def
, Path
& value
, float t
);
115 void MixStyle(Definition
* pDef
, Style
& dst
, float t
);
117 void Parse(InputStream
& s
, Style style
, float at
, StringMapW
<float> offset
, Reference
* pParentRef
);
119 void AddChar(Text
& t
, WCHAR c
);
120 void AddText(Text
& t
);
126 Direction m_direction
;
130 CAtlList
<Text
> m_text
;
133 Subtitle(File
* pFile
);
136 bool Parse(Definition
* pDef
, float start
, float stop
, float at
);