2006-01-16 22:02:54 +01:00
|
|
|
// Copyright (c) 2005, Rodrigo Braz Monteiro
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
2006-01-16 22:02:54 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file ass_style.cpp
|
|
|
|
/// @brief Class for style definitions in subtitles
|
|
|
|
/// @ingroup subs_storage
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2009-01-04 07:31:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-09-10 15:06:40 +02:00
|
|
|
#ifndef AGI_PRE
|
|
|
|
#include <ctype.h>
|
|
|
|
|
2007-09-12 01:22:26 +02:00
|
|
|
#include <wx/intl.h>
|
2009-09-10 15:06:40 +02:00
|
|
|
#include <wx/tokenzr.h>
|
|
|
|
#endif
|
|
|
|
|
2006-04-04 22:41:09 +02:00
|
|
|
#include "ass_style.h"
|
|
|
|
#include "utils.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
AssColor::AssColor () {
|
|
|
|
r=g=b=a=0;
|
|
|
|
}
|
2010-07-08 09:14:55 +02:00
|
|
|
AssColor::AssColor(int r, int g, int b, int a)
|
|
|
|
: r(r)
|
|
|
|
, g(g)
|
|
|
|
, b(b)
|
|
|
|
, a(a)
|
|
|
|
{
|
|
|
|
}
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2012-03-10 03:16:08 +01:00
|
|
|
AssColor::AssColor(const wxColour &color)
|
|
|
|
: a(0)
|
|
|
|
{
|
2006-01-16 22:02:54 +01:00
|
|
|
SetWXColor(color);
|
|
|
|
}
|
|
|
|
|
2012-03-25 06:05:06 +02:00
|
|
|
/// @brief Parse from SSA/ASS
|
|
|
|
/// @param value
|
2011-12-26 23:20:49 +01:00
|
|
|
void AssColor::Parse(wxString const& value) {
|
|
|
|
if (value.size() > 0 && value[0] == '#') {
|
2009-05-12 17:14:35 +02:00
|
|
|
// HTML colour
|
|
|
|
SetWXColor(wxColor(value));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
// Prepare
|
2011-12-26 23:20:49 +01:00
|
|
|
char ostr[12];
|
|
|
|
int oindex = 11;
|
|
|
|
bool ishex = false;
|
2007-01-18 07:45:55 +01:00
|
|
|
|
2011-12-26 23:20:49 +01:00
|
|
|
ostr[11] = 0;
|
2007-01-18 07:45:55 +01:00
|
|
|
|
2011-12-26 23:20:49 +01:00
|
|
|
for(size_t i = value.size(); i > 0 && oindex >= 0; i--) {
|
|
|
|
unsigned char c = value[i - 1];
|
|
|
|
if (isxdigit(c) || c == '-') {
|
2007-01-18 07:45:55 +01:00
|
|
|
ostr[--oindex] = c;
|
2011-12-26 23:20:49 +01:00
|
|
|
if (c >= 'A')
|
|
|
|
ishex = true;
|
2007-04-09 21:04:11 +02:00
|
|
|
}
|
2011-12-26 23:20:49 +01:00
|
|
|
else if (c == 'H' || c == 'h')
|
|
|
|
ishex = true;
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-12-26 23:20:49 +01:00
|
|
|
unsigned long outval = strtoul(ostr + oindex, 0, ishex ? 16 : 10);
|
|
|
|
r = outval & 0xFF;
|
|
|
|
g = (outval>>8) & 0xFF;
|
|
|
|
b = (outval>>16) & 0xFF;
|
|
|
|
a = (outval>>24) & 0xFF;
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2012-03-25 06:05:06 +02:00
|
|
|
/// @brief Gets a wxColour
|
|
|
|
/// @return
|
2012-03-20 01:39:10 +01:00
|
|
|
wxColour AssColor::GetWXColor() const {
|
2008-07-16 03:41:33 +02:00
|
|
|
return wxColour(r,g,b,255-a);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2012-03-25 06:05:06 +02:00
|
|
|
/// @brief Sets color from wx
|
|
|
|
/// @param color
|
2007-01-03 22:18:19 +01:00
|
|
|
void AssColor::SetWXColor(const wxColor &color) {
|
2006-01-16 22:02:54 +01:00
|
|
|
r = color.Red();
|
|
|
|
g = color.Green();
|
|
|
|
b = color.Blue();
|
2007-01-18 09:01:16 +01:00
|
|
|
//a = color.Alpha();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2012-03-25 06:05:06 +02:00
|
|
|
/// @brief Get formatted in ASS format
|
|
|
|
/// @param alpha
|
|
|
|
/// @param stripped
|
|
|
|
/// @param isStyle
|
|
|
|
/// @return
|
2010-07-08 09:14:55 +02:00
|
|
|
wxString AssColor::GetASSFormatted(bool alpha,bool stripped,bool isStyle) const {
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString work;
|
2011-09-28 21:43:11 +02:00
|
|
|
if (!stripped) work += "&H";
|
|
|
|
if (alpha) work += wxString::Format("%02X",a);
|
|
|
|
work += wxString::Format("%02X%02X%02X",b,g,r);
|
|
|
|
if (!stripped && !isStyle) work += "&";
|
2006-01-16 22:02:54 +01:00
|
|
|
return work;
|
|
|
|
}
|
|
|
|
|
2012-03-25 06:05:06 +02:00
|
|
|
/// @brief Get decimal formatted
|
|
|
|
/// @return
|
2010-07-08 09:14:55 +02:00
|
|
|
wxString AssColor::GetSSAFormatted() const {
|
2007-07-21 00:41:43 +02:00
|
|
|
long color = (a<<24)+(b<<16)+(g<<8)+r;
|
2011-09-28 21:43:11 +02:00
|
|
|
wxString output=wxString::Format("%i",(long)color);
|
2007-01-18 07:45:55 +01:00
|
|
|
return output;
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2010-07-08 09:14:55 +02:00
|
|
|
bool AssColor::operator==(const AssColor &col) const {
|
2007-04-17 01:41:06 +02:00
|
|
|
return r==col.r && g==col.g && b==col.b && a==col.a;
|
|
|
|
}
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-07-08 09:14:55 +02:00
|
|
|
bool AssColor::operator!=(const AssColor &col) const {
|
|
|
|
return !(*this == col);
|
2007-04-17 01:41:06 +02:00
|
|
|
}
|
|
|
|
|
2010-07-08 09:14:55 +02:00
|
|
|
AssStyle::AssStyle()
|
2012-02-01 01:47:38 +01:00
|
|
|
: AssEntry(wxString(), wxS("[V4+ Styles]"))
|
|
|
|
, name("Default")
|
2011-09-28 21:43:11 +02:00
|
|
|
, font("Arial")
|
2010-07-08 09:14:55 +02:00
|
|
|
, fontsize(20.)
|
|
|
|
, primary(255, 255, 255)
|
|
|
|
, secondary(255, 0, 0)
|
|
|
|
, outline(0, 0, 0)
|
|
|
|
, shadow(0, 0, 0)
|
|
|
|
, bold(false)
|
|
|
|
, italic(false)
|
|
|
|
, underline(false)
|
|
|
|
, strikeout(false)
|
|
|
|
, scalex(100.)
|
|
|
|
, scaley(100.)
|
|
|
|
, spacing(0.)
|
|
|
|
, angle(0.)
|
|
|
|
, borderstyle(1)
|
|
|
|
, outline_w(2.)
|
|
|
|
, shadow_w(2.)
|
|
|
|
, alignment(2)
|
|
|
|
, encoding(1)
|
|
|
|
, relativeTo(1)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
Margin[i] = 10;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
UpdateData();
|
|
|
|
}
|
|
|
|
|
2011-12-22 22:15:19 +01:00
|
|
|
static wxString get_next_string(wxStringTokenizer &tok) {
|
|
|
|
if (!tok.HasMoreTokens()) throw "Malformed style: not enough fields";
|
|
|
|
return tok.GetNextToken();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2011-12-22 22:15:19 +01:00
|
|
|
static int get_next_int(wxStringTokenizer &tok) {
|
|
|
|
long temp;
|
|
|
|
if (!get_next_string(tok).ToLong(&temp))
|
|
|
|
throw "Malformed style: could not parse int field";
|
|
|
|
return temp;
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2012-01-26 21:17:31 +01:00
|
|
|
static double get_next_double(wxStringTokenizer &tok) {
|
2011-12-22 22:15:19 +01:00
|
|
|
double temp;
|
|
|
|
if (!get_next_string(tok).ToDouble(&temp))
|
|
|
|
throw "Malformed style: could not parse double field";
|
|
|
|
return temp;
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2012-02-01 01:47:38 +01:00
|
|
|
AssStyle::AssStyle(wxString rawData, int version)
|
|
|
|
: AssEntry(wxString(), wxS("[V4+ Styles]"))
|
|
|
|
{
|
2011-12-22 22:15:19 +01:00
|
|
|
wxStringTokenizer tkn(rawData.Trim(false).Mid(6), ",", wxTOKEN_RET_EMPTY_ALL);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-12-22 22:15:19 +01:00
|
|
|
name = get_next_string(tkn).Trim(true).Trim(false);
|
|
|
|
font = get_next_string(tkn).Trim(true).Trim(false);
|
2011-12-24 00:21:02 +01:00
|
|
|
fontsize = get_next_double(tkn);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-12-22 22:15:19 +01:00
|
|
|
if (version != 0) {
|
|
|
|
primary.Parse(get_next_string(tkn));
|
|
|
|
secondary.Parse(get_next_string(tkn));
|
|
|
|
outline.Parse(get_next_string(tkn));
|
|
|
|
shadow.Parse(get_next_string(tkn));
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
else {
|
2011-12-22 22:15:19 +01:00
|
|
|
primary.Parse(get_next_string(tkn));
|
|
|
|
secondary.Parse(get_next_string(tkn));
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read and discard tertiary color
|
2011-12-22 22:15:19 +01:00
|
|
|
get_next_string(tkn);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read shadow/outline color
|
2011-12-22 22:15:19 +01:00
|
|
|
outline.Parse(get_next_string(tkn));
|
2006-01-16 22:02:54 +01:00
|
|
|
shadow = outline;
|
|
|
|
}
|
|
|
|
|
2011-12-22 22:15:19 +01:00
|
|
|
bold = !!get_next_int(tkn);
|
|
|
|
italic = !!get_next_int(tkn);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-08 02:00:44 +01:00
|
|
|
if (version != 0) {
|
2011-12-22 22:15:19 +01:00
|
|
|
underline = !!get_next_int(tkn);
|
|
|
|
strikeout = !!get_next_int(tkn);
|
|
|
|
|
|
|
|
scalex = get_next_double(tkn);
|
|
|
|
scaley = get_next_double(tkn);
|
|
|
|
spacing = get_next_double(tkn);
|
|
|
|
angle = get_next_double(tkn);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
// SSA defaults
|
|
|
|
underline = false;
|
|
|
|
strikeout = false;
|
|
|
|
|
|
|
|
scalex = 100;
|
|
|
|
scaley = 100;
|
|
|
|
spacing = 0;
|
|
|
|
angle = 0.0;
|
|
|
|
}
|
|
|
|
|
2011-12-22 22:15:19 +01:00
|
|
|
borderstyle = get_next_int(tkn);
|
|
|
|
outline_w = get_next_double(tkn);
|
|
|
|
shadow_w = get_next_double(tkn);
|
|
|
|
alignment = get_next_int(tkn);
|
|
|
|
|
2012-03-25 06:04:54 +02:00
|
|
|
if (version == 0)
|
|
|
|
alignment = SsaToAss(alignment);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read left margin
|
2012-01-08 02:33:26 +01:00
|
|
|
Margin[0] = mid(0, get_next_int(tkn), 9999);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read right margin
|
2012-01-08 02:33:26 +01:00
|
|
|
Margin[1] = mid(0, get_next_int(tkn), 9999);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-08 02:54:02 +01:00
|
|
|
// Read top margin
|
2012-01-08 02:33:26 +01:00
|
|
|
Margin[2] = mid(0, get_next_int(tkn), 9999);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-08 02:54:02 +01:00
|
|
|
// Read bottom margin
|
2011-12-22 22:15:19 +01:00
|
|
|
if (version == 2)
|
2012-01-08 02:33:26 +01:00
|
|
|
Margin[3] = mid(0, get_next_int(tkn), 9999);
|
2011-12-22 22:15:19 +01:00
|
|
|
else
|
2012-01-08 02:33:26 +01:00
|
|
|
Margin[3] = Margin[2];
|
2007-01-08 02:54:02 +01:00
|
|
|
|
2011-12-22 22:15:19 +01:00
|
|
|
// Skip alpha level
|
|
|
|
if (version == 0)
|
|
|
|
get_next_string(tkn);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read encoding
|
2011-12-22 22:15:19 +01:00
|
|
|
encoding = get_next_int(tkn);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-08 02:54:02 +01:00
|
|
|
// Read relative to
|
2011-12-22 22:15:19 +01:00
|
|
|
if (version == 2)
|
|
|
|
relativeTo = get_next_int(tkn);
|
2007-01-08 02:54:02 +01:00
|
|
|
|
2011-12-22 22:15:19 +01:00
|
|
|
if (tkn.HasMoreTokens())
|
|
|
|
throw "Malformed style: too many fields";
|
|
|
|
|
|
|
|
UpdateData();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2012-02-01 01:47:38 +01:00
|
|
|
AssStyle& AssStyle::operator=(AssStyle const& rgt) {
|
|
|
|
name = rgt.name;
|
|
|
|
font = rgt.font;
|
|
|
|
fontsize = rgt.fontsize;
|
|
|
|
|
|
|
|
primary = rgt.primary;
|
|
|
|
secondary = rgt.secondary;
|
|
|
|
outline = rgt.outline;
|
|
|
|
shadow = rgt.shadow;
|
|
|
|
|
|
|
|
bold = rgt.bold;
|
|
|
|
italic = rgt.italic;
|
|
|
|
underline = rgt.underline;
|
|
|
|
strikeout = rgt.strikeout;
|
|
|
|
|
|
|
|
scalex = rgt.scalex;
|
|
|
|
scaley = rgt.scaley;
|
|
|
|
spacing = rgt.spacing;
|
|
|
|
angle = rgt.angle;
|
|
|
|
borderstyle = rgt.borderstyle;
|
|
|
|
outline_w = rgt.outline_w;
|
|
|
|
shadow_w = rgt.shadow_w;
|
|
|
|
alignment = rgt.alignment;
|
|
|
|
encoding = rgt.encoding;
|
|
|
|
relativeTo = rgt.relativeTo;
|
|
|
|
|
|
|
|
memcpy(Margin, rgt.Margin, sizeof(Margin));
|
|
|
|
|
2012-02-14 01:35:41 +01:00
|
|
|
SetEntryData(rgt.GetEntryData());
|
|
|
|
|
2012-02-01 01:47:38 +01:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
void AssStyle::UpdateData() {
|
2007-01-18 07:45:55 +01:00
|
|
|
wxString final;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-09-28 21:43:11 +02:00
|
|
|
name.Replace(",",";");
|
|
|
|
font.Replace(",",";");
|
2007-01-18 07:45:55 +01:00
|
|
|
|
|
|
|
|
2011-09-28 21:43:11 +02:00
|
|
|
final = wxString::Format("Style: %s,%s,%g,%s,%s,%s,%s,%d,%d,%d,%d,%g,%g,%g,%g,%d,%g,%g,%i,%i,%i,%i,%i",
|
2011-09-28 21:43:48 +02:00
|
|
|
name, font, fontsize,
|
|
|
|
primary.GetASSFormatted(true,false,true),
|
|
|
|
secondary.GetASSFormatted(true,false,true),
|
|
|
|
outline.GetASSFormatted(true,false,true),
|
|
|
|
shadow.GetASSFormatted(true,false,true),
|
2007-01-18 07:45:55 +01:00
|
|
|
(bold? -1 : 0), (italic ? -1 : 0),
|
|
|
|
(underline?-1:0),(strikeout?-1:0),
|
2010-05-13 20:41:46 +02:00
|
|
|
scalex,scaley,spacing,angle,
|
|
|
|
borderstyle,outline_w,shadow_w,alignment,
|
2007-01-18 07:45:55 +01:00
|
|
|
Margin[0],Margin[1],Margin[2],encoding);
|
|
|
|
|
2006-02-27 03:23:50 +01:00
|
|
|
SetEntryData(final);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2010-07-08 09:14:55 +02:00
|
|
|
wxString AssStyle::GetSSAText() const {
|
2007-01-18 07:45:55 +01:00
|
|
|
wxString output;
|
2012-03-25 06:04:54 +02:00
|
|
|
int align = AssToSsa(alignment);
|
2010-07-08 09:14:55 +02:00
|
|
|
wxString n = name;
|
2011-09-28 21:43:11 +02:00
|
|
|
n.Replace(",", ";");
|
2010-07-08 09:14:55 +02:00
|
|
|
wxString f = font;
|
2011-09-28 21:43:11 +02:00
|
|
|
f.Replace(",", ";");
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-09-28 21:43:11 +02:00
|
|
|
output = wxString::Format("Style: %s,%s,%g,%s,%s,0,%s,%d,%d,%d,%g,%g,%d,%d,%d,%d,0,%i",
|
2011-09-28 21:43:48 +02:00
|
|
|
n, f, fontsize,
|
|
|
|
primary.GetSSAFormatted(),
|
|
|
|
secondary.GetSSAFormatted(),
|
|
|
|
shadow.GetSSAFormatted(),
|
2007-01-18 07:45:55 +01:00
|
|
|
(bold? -1 : 0), (italic ? -1 : 0),
|
2010-05-13 20:41:46 +02:00
|
|
|
borderstyle,outline_w,shadow_w,align,
|
2007-01-18 07:45:55 +01:00
|
|
|
Margin[0],Margin[1],Margin[2],encoding);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
return output;
|
|
|
|
}
|
2006-02-27 10:07:08 +01:00
|
|
|
|
2009-06-07 02:22:36 +02:00
|
|
|
AssEntry *AssStyle::Clone() const {
|
2010-07-08 09:14:55 +02:00
|
|
|
return new AssStyle(*this);
|
2006-02-27 10:07:08 +01:00
|
|
|
}
|
2007-04-17 00:13:09 +02:00
|
|
|
|
|
|
|
void AssStyle::GetEncodings(wxArrayString &encodingStrings) {
|
|
|
|
encodingStrings.Clear();
|
2011-09-28 21:43:11 +02:00
|
|
|
encodingStrings.Add(wxString("0 - ") + _("ANSI"));
|
|
|
|
encodingStrings.Add(wxString("1 - ") + _("Default"));
|
|
|
|
encodingStrings.Add(wxString("2 - ") + _("Symbol"));
|
|
|
|
encodingStrings.Add(wxString("77 - ") + _("Mac"));
|
|
|
|
encodingStrings.Add(wxString("128 - ") + _("Shift_JIS"));
|
|
|
|
encodingStrings.Add(wxString("129 - ") + _("Hangeul"));
|
|
|
|
encodingStrings.Add(wxString("130 - ") + _("Johab"));
|
|
|
|
encodingStrings.Add(wxString("134 - ") + _("GB2312"));
|
|
|
|
encodingStrings.Add(wxString("136 - ") + _("Chinese BIG5"));
|
|
|
|
encodingStrings.Add(wxString("161 - ") + _("Greek"));
|
|
|
|
encodingStrings.Add(wxString("162 - ") + _("Turkish"));
|
|
|
|
encodingStrings.Add(wxString("163 - ") + _("Vietnamese"));
|
|
|
|
encodingStrings.Add(wxString("177 - ") + _("Hebrew"));
|
|
|
|
encodingStrings.Add(wxString("178 - ") + _("Arabic"));
|
|
|
|
encodingStrings.Add(wxString("186 - ") + _("Baltic"));
|
|
|
|
encodingStrings.Add(wxString("204 - ") + _("Russian"));
|
|
|
|
encodingStrings.Add(wxString("222 - ") + _("Thai"));
|
|
|
|
encodingStrings.Add(wxString("238 - ") + _("East European"));
|
|
|
|
encodingStrings.Add(wxString("255 - ") + _("OEM"));
|
2007-04-17 00:13:09 +02:00
|
|
|
}
|
2012-03-25 06:04:54 +02:00
|
|
|
|
|
|
|
int AssStyle::AssToSsa(int ass_align) {
|
|
|
|
switch (ass_align) {
|
|
|
|
case 1: return 1;
|
|
|
|
case 2: return 2;
|
|
|
|
case 3: return 3;
|
|
|
|
case 4: return 9;
|
|
|
|
case 5: return 10;
|
|
|
|
case 6: return 11;
|
|
|
|
case 7: return 5;
|
|
|
|
case 8: return 6;
|
|
|
|
case 9: return 7;
|
|
|
|
default: return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int AssStyle::SsaToAss(int ssa_align) {
|
|
|
|
switch(ssa_align) {
|
|
|
|
case 1: return 1;
|
|
|
|
case 2: return 2;
|
|
|
|
case 3: return 3;
|
|
|
|
case 5: return 7;
|
|
|
|
case 6: return 8;
|
|
|
|
case 7: return 9;
|
|
|
|
case 9: return 4;
|
|
|
|
case 10: return 5;
|
|
|
|
case 11: return 6;
|
|
|
|
default: return 2;
|
|
|
|
}
|
|
|
|
}
|