1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        TextSub.h
3 // Purpose:     The class to store a DVD TextSub parameters
4 // Author:      Alex Thuering
5 // Created:	    09.04.2011
6 // RCS-ID:      $Id: TextSub.h,v 1.4 2016/04/19 23:09:52 ntalex Exp $
7 // Copyright:   (c) Alex Thuering
8 // Licence:     GPL
9 /////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef TEXTSUB_H
12 #define TEXTSUB_H
13 
14 #include "mediaenc.h"
15 #include "DVDAction.h"
16 #include <wx/wx.h>
17 #include <wx/dynarray.h>
18 #include <map>
19 
20 using namespace std;
21 typedef map<wxString, map<wxString, wxString> > FontMap;
22 
23 class wxSvgXmlNode;
24 
25 class TextSub {
26 public:
27 	TextSub(wxString filename = wxT(""));
28 
GetFilename()29 	wxString GetFilename() { return m_filename; }
SetFilename(wxString value)30 	void SetFilename(wxString value) { m_filename = value; }
31 
GetForce()32 	bool GetForce() { return m_force; }
SetForce(bool value)33 	void SetForce(bool value) { m_force = value; }
34 
GetCharacterSet()35 	wxString GetCharacterSet() { return m_characterSet; }
SetCharacterSet(const wxString & value)36 	void SetCharacterSet(const wxString& value) { m_characterSet = value; }
37 
38 	wxString GetFontFile();
39 
GetFontFamily()40 	wxString GetFontFamily() { return m_fontFamily; }
SetFontFamily(const wxString & value)41 	void SetFontFamily(const wxString& value) { m_fontFamily = value; }
42 
GetFontStyle()43 	wxString GetFontStyle() { return m_fontStyle; }
SetFontStyle(const wxString & value)44 	void SetFontStyle(const wxString& value) { m_fontStyle = value; }
45 
GetFontSize()46 	double GetFontSize() { return m_fontSize; }
SetFontSize(double value)47 	void SetFontSize(double value) { m_fontSize = value; }
48 
GetFillColour()49     wxColour GetFillColour() { return m_fillColour; }
SetFillColour(const wxColour & value)50     void SetFillColour(const wxColour& value) { m_fillColour = value; }
51 
GetOutlineColour()52     wxColour GetOutlineColour() { return m_outlineColour; }
SetOutlineColour(const wxColour & value)53     void SetOutlineColour(const wxColour& value) { m_outlineColour = value; }
54 
GetOutlineThickness()55     double GetOutlineThickness() { return m_outlineThickness; }
SetOutlineThickness(double value)56     void SetOutlineThickness(double value) { m_outlineThickness = value; }
57 
GetShadowColour()58     wxColour GetShadowColour() { return m_shadowColour; }
SetShadowColour(const wxColour & value)59     void SetShadowColour(const wxColour& value) { m_shadowColour = value; }
60 
GetShadowOffset()61     wxPoint GetShadowOffset() { return m_shadowOffset; }
SetShadowOffset(const wxPoint & value)62     void SetShadowOffset(const wxPoint& value) { m_shadowOffset = value; }
63 
GetAlignment()64 	wxAlignment GetAlignment() { return m_alignment; }
SetAlignment(wxAlignment value)65 	void SetAlignment(wxAlignment value) { m_alignment = value; }
66 
GetLeftMargin()67 	int GetLeftMargin() { return m_leftMargin; }
SetLeftMargin(int value)68 	void SetLeftMargin(int value) { m_leftMargin = value; }
69 
GetRightMargin()70 	int GetRightMargin() { return m_rightMargin; }
SetRightMargin(int value)71 	void SetRightMargin(int value) { m_rightMargin = value; }
72 
GetTopMargin()73 	int GetTopMargin() { return m_topMargin; }
SetTopMargin(int value)74 	void SetTopMargin(int value) { m_topMargin = value; }
75 
GetBottomMargin()76 	int GetBottomMargin() { return m_bottomMargin; }
SetBottomMargin(int value)77 	void SetBottomMargin(int value) { m_bottomMargin = value; }
78 
GetSubtitleFps()79 	double GetSubtitleFps() { return m_subtitleFps; }
SetSubtitleFps(double value)80 	void SetSubtitleFps(double value) { m_subtitleFps = value; }
81 
GetMovieFps()82 	double GetMovieFps() { return m_movieFps; }
SetMovieFps(double value)83 	void SetMovieFps(double value) { m_movieFps = value; }
84 
GetMovieSize()85 	wxSize GetMovieSize() { return m_movieSize; }
SetMovieSize(wxSize value)86 	void SetMovieSize(wxSize value) { m_movieSize = value; }
87 
GetAspectRatio()88 	AspectRatio GetAspectRatio() { return m_aspectRatio; }
SetAspectRatio(AspectRatio value)89 	void SetAspectRatio(AspectRatio value) { m_aspectRatio = value; }
90 
91 	wxSvgXmlNode* GetXML(DVDFileType type);
92 	bool PutXML(wxSvgXmlNode* node);
93 
94 	/** saves a configuration for spumux */
95 	bool SaveSpumux(const wxString& filename, VideoFormat videoFormat);
96 
97 	/** Returns subtitle attributes as sting */
98 	wxString AsString();
99 
100     /** Returns font map (font family -> font style -> font filename) */
101     static FontMap& GetFontMap();
102     /** Returns true, if font map is initialized */
103 	static bool IsFontMapInitialized();
104 
105 private:
106     wxString m_filename;
107     bool m_force;
108     wxString m_characterSet;
109     wxString m_fontFamily;
110     wxString m_fontStyle;
111     double m_fontSize;
112     wxColour m_fillColour;
113     wxColour m_outlineColour;
114     double m_outlineThickness;
115     wxColour m_shadowColour;
116     wxPoint m_shadowOffset;
117     wxAlignment m_alignment;
118     int m_leftMargin;
119     int m_rightMargin;
120     int m_topMargin;
121     int m_bottomMargin;
122     double m_subtitleFps;
123     double m_movieFps;
124     wxSize m_movieSize;
125     AspectRatio m_aspectRatio;
126     static FontMap s_fonts;
127 };
128 
129 WX_DEFINE_ARRAY(TextSub*, TextSubArray);
130 
131 #endif // TEXTSUB_H
132