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
|
|
|
|
|
|
|
////////////
|
|
|
|
// Includes
|
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
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Constructors AssColor //////////////////////////
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssColor::AssColor () {
|
|
|
|
r=g=b=a=0;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param color
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssColor::AssColor (wxColour &color) {
|
|
|
|
SetWXColor(color);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Parse from SSA/ASS
|
|
|
|
/// @param value
|
|
|
|
/// @return
|
|
|
|
///
|
2007-01-18 07:45:55 +01:00
|
|
|
void AssColor::Parse(const wxString value) {
|
2009-05-12 17:14:35 +02:00
|
|
|
if (value.Len() > 0 && value[0] == _T('#')) {
|
|
|
|
// HTML colour
|
|
|
|
SetWXColor(wxColor(value));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
// Prepare
|
2007-01-18 07:45:55 +01:00
|
|
|
char c,ostr[12];
|
|
|
|
unsigned long outval;
|
|
|
|
int oindex=11;
|
2007-07-21 00:41:43 +02:00
|
|
|
bool ishex=false;
|
2007-01-18 07:45:55 +01:00
|
|
|
|
|
|
|
ostr[11]=0;
|
|
|
|
|
|
|
|
for(int i=value.Len()-1;i>=0&&oindex>=0;i--) {
|
|
|
|
c=value[i];
|
2007-07-21 00:41:43 +02:00
|
|
|
if (isxdigit(c) || c=='-') {
|
2007-01-18 07:45:55 +01:00
|
|
|
ostr[--oindex] = c;
|
2007-07-21 00:41:43 +02:00
|
|
|
if (c>='A') ishex = true;
|
2007-04-09 21:04:11 +02:00
|
|
|
}
|
2007-01-18 07:45:55 +01:00
|
|
|
else if (c == 'H' || c == 'h') ishex = true;
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
2007-01-18 07:45:55 +01:00
|
|
|
|
|
|
|
outval=strtoul(ostr+oindex,0,ishex?16:10);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-18 07:45:55 +01:00
|
|
|
r = outval & 0xFF;
|
|
|
|
g = (outval>>8) & 0xFF;
|
|
|
|
b = (outval>>16)& 0xFF;
|
|
|
|
a = (outval>>24)& 0xFF;
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Gets a wxColour
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
wxColour AssColor::GetWXColor() {
|
2008-07-16 03:41:33 +02:00
|
|
|
return wxColour(r,g,b,255-a);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @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
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Get formatted in ASS format
|
|
|
|
/// @param alpha
|
|
|
|
/// @param stripped
|
|
|
|
/// @param isStyle
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString AssColor::GetASSFormatted (bool alpha,bool stripped,bool isStyle) {
|
|
|
|
wxString work;
|
|
|
|
if (!stripped) work += _T("&H");
|
|
|
|
if (alpha) work += wxString::Format(_T("%02X"),a);
|
|
|
|
work += wxString::Format(_T("%02X%02X%02X"),b,g,r);
|
|
|
|
if (!stripped && !isStyle) work += _T("&");
|
|
|
|
return work;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Get decimal formatted
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString AssColor::GetSSAFormatted () {
|
2007-07-21 00:41:43 +02:00
|
|
|
long color = (a<<24)+(b<<16)+(g<<8)+r;
|
2007-01-18 07:45:55 +01:00
|
|
|
wxString output=wxString::Format(_T("%i"),(long)color);
|
|
|
|
return output;
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Operators
|
|
|
|
/// @param col
|
|
|
|
/// @return
|
|
|
|
///
|
2007-04-17 01:41:06 +02:00
|
|
|
bool AssColor::operator==(AssColor &col) const {
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param col
|
|
|
|
/// @return
|
|
|
|
///
|
2007-04-17 01:41:06 +02:00
|
|
|
bool AssColor::operator!=(AssColor &col) const {
|
|
|
|
return r!=col.r || g!=col.g || b!=col.b || a!=col.a;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-18 07:45:55 +01:00
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Default Constructor AssStyle /////////////////////////
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssStyle::AssStyle() {
|
|
|
|
group = _T("[V4+ Styles]");
|
|
|
|
|
|
|
|
name = _T("Default");
|
|
|
|
font = _T("Arial");
|
|
|
|
fontsize = 20;
|
|
|
|
|
|
|
|
primary.r = 255;
|
|
|
|
primary.g = 255;
|
|
|
|
primary.b = 255;
|
|
|
|
primary.a = 0;
|
|
|
|
secondary.r = 255;
|
2007-07-27 09:14:49 +02:00
|
|
|
secondary.g = 0;
|
2006-01-16 22:02:54 +01:00
|
|
|
secondary.b = 0;
|
|
|
|
secondary.a = 0;
|
|
|
|
outline.r = 0;
|
|
|
|
outline.g = 0;
|
|
|
|
outline.b = 0;
|
|
|
|
outline.a = 0;
|
|
|
|
shadow.r = 0;
|
|
|
|
shadow.g = 0;
|
|
|
|
shadow.b = 0;
|
|
|
|
shadow.a = 0;
|
|
|
|
|
|
|
|
bold = false;
|
|
|
|
italic = false;
|
|
|
|
underline = false;
|
|
|
|
strikeout = false;
|
|
|
|
|
|
|
|
scalex = 100;
|
|
|
|
scaley = 100;
|
|
|
|
spacing = 0;
|
|
|
|
angle = 0.0;
|
|
|
|
borderstyle = 1;
|
|
|
|
outline_w = 2.0;
|
|
|
|
shadow_w = 2.0;
|
|
|
|
alignment = 2;
|
2007-01-08 02:08:50 +01:00
|
|
|
Margin[0] = 10;
|
|
|
|
Margin[1] = 10;
|
|
|
|
Margin[2] = 10;
|
|
|
|
Margin[3] = 10;
|
2008-03-15 22:34:55 +01:00
|
|
|
encoding = 1;
|
2007-01-08 02:54:02 +01:00
|
|
|
relativeTo = 1;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
UpdateData();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Constructor
|
|
|
|
/// @param _data
|
|
|
|
/// @param version
|
|
|
|
///
|
2007-01-08 02:00:44 +01:00
|
|
|
AssStyle::AssStyle(wxString _data,int version) {
|
|
|
|
Valid = Parse(_data,version);
|
2006-01-16 22:02:54 +01:00
|
|
|
if (!Valid) {
|
|
|
|
throw _T("[Error] Failed parsing line.");
|
|
|
|
}
|
|
|
|
UpdateData();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Destructor
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssStyle::~AssStyle() {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Parses value from ASS data
|
|
|
|
/// @param rawData
|
|
|
|
/// @param version
|
|
|
|
/// @return
|
|
|
|
///
|
2007-01-08 02:00:44 +01:00
|
|
|
bool AssStyle::Parse(wxString rawData,int version) {
|
2007-01-08 02:54:02 +01:00
|
|
|
// Tokenize
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString temp;
|
|
|
|
long templ;
|
2007-02-06 23:35:15 +01:00
|
|
|
wxStringTokenizer tkn(rawData.Trim(false).Mid(6),_T(","),wxTOKEN_RET_EMPTY_ALL);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read name
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
name = tkn.GetNextToken();
|
|
|
|
name.Trim(true);
|
|
|
|
name.Trim(false);
|
|
|
|
|
|
|
|
// Read font name
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
font = tkn.GetNextToken();
|
|
|
|
font.Trim(true);
|
|
|
|
font.Trim(false);
|
|
|
|
|
|
|
|
// Read font size
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
temp.ToLong(&templ);
|
|
|
|
fontsize = templ;
|
|
|
|
|
2007-01-08 02:00:44 +01:00
|
|
|
if (version != 0) {
|
2006-01-16 22:02:54 +01:00
|
|
|
// Read primary color
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-18 07:45:55 +01:00
|
|
|
primary.Parse(tkn.GetNextToken());
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read secondary color
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-18 07:45:55 +01:00
|
|
|
secondary.Parse(tkn.GetNextToken());
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read outline color
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-18 07:45:55 +01:00
|
|
|
outline.Parse(tkn.GetNextToken());
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read shadow color
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-18 07:45:55 +01:00
|
|
|
shadow.Parse(tkn.GetNextToken());
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
// Read primary color
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-18 07:45:55 +01:00
|
|
|
primary.Parse(tkn.GetNextToken());
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read secondary color
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-18 07:45:55 +01:00
|
|
|
secondary.Parse(tkn.GetNextToken());
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read and discard tertiary color
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
tkn.GetNextToken();
|
|
|
|
|
|
|
|
// Read shadow/outline color
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-18 07:45:55 +01:00
|
|
|
outline.Parse(tkn.GetNextToken());
|
2006-01-16 22:02:54 +01:00
|
|
|
shadow = outline;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Read bold
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
temp.ToLong(&templ);
|
2007-01-18 07:45:55 +01:00
|
|
|
bold = (templ==0)?false:true;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read italics
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken(); temp.ToLong(&templ);
|
2007-01-18 07:45:55 +01:00
|
|
|
italic = (templ==0)?false:true;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-08 02:00:44 +01:00
|
|
|
if (version != 0) {
|
2006-01-16 22:02:54 +01:00
|
|
|
// Read underline
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
temp.ToLong(&templ);
|
2007-01-18 07:45:55 +01:00
|
|
|
underline = (templ==0)?false:true;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read strikeout
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
temp.ToLong(&templ);
|
2007-01-18 07:45:55 +01:00
|
|
|
strikeout = (templ==0)?false:true;
|
2006-01-16 22:02:54 +01:00
|
|
|
// Read scale x
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
2006-04-04 22:41:09 +02:00
|
|
|
temp.ToDouble(&scalex);
|
|
|
|
//scalex = templ;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read scale y
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
2006-04-04 22:41:09 +02:00
|
|
|
temp.ToDouble(&scaley);
|
|
|
|
//scaley = templ;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read spacing
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
temp.ToDouble(&spacing);
|
|
|
|
//spacing = templ;
|
|
|
|
|
|
|
|
// Read angle
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
temp.ToDouble(&angle);
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
// SSA defaults
|
2007-01-18 07:45:55 +01:00
|
|
|
//shadow.a = 128; //Parsed
|
2006-01-16 22:02:54 +01:00
|
|
|
underline = false;
|
|
|
|
strikeout = false;
|
|
|
|
|
|
|
|
scalex = 100;
|
|
|
|
scaley = 100;
|
|
|
|
spacing = 0;
|
|
|
|
angle = 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Read border style
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
temp.ToLong(&templ);
|
|
|
|
borderstyle = templ;
|
|
|
|
|
|
|
|
// Read outline width
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
temp.ToDouble(&outline_w);
|
|
|
|
|
|
|
|
// Read shadow width
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
temp.ToDouble(&shadow_w);
|
|
|
|
|
|
|
|
// Read alignment
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
temp.ToLong(&templ);
|
2007-01-08 02:00:44 +01:00
|
|
|
if (version == 0) {
|
2006-01-16 22:02:54 +01:00
|
|
|
switch(templ) {
|
|
|
|
case 1: alignment = 1; break;
|
|
|
|
case 2: alignment = 2; break;
|
|
|
|
case 3: alignment = 3; break;
|
|
|
|
case 5: alignment = 7; break;
|
|
|
|
case 6: alignment = 8; break;
|
|
|
|
case 7: alignment = 9; break;
|
|
|
|
case 9: alignment = 4; break;
|
|
|
|
case 10: alignment = 5; break;
|
|
|
|
case 11: alignment = 6; break;
|
|
|
|
default: alignment = 2; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else alignment = templ;
|
|
|
|
|
|
|
|
// Read left margin
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-05 19:27:15 +01:00
|
|
|
SetMarginString(tkn.GetNextToken(),0);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Read right margin
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-05 19:27:15 +01:00
|
|
|
SetMarginString(tkn.GetNextToken(),1);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-08 02:54:02 +01:00
|
|
|
// Read top margin
|
2006-01-16 22:02:54 +01:00
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-08 02:54:02 +01:00
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
SetMarginString(temp,2);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-08 02:54:02 +01:00
|
|
|
// Read bottom margin
|
|
|
|
if (version == 2) {
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
SetMarginString(tkn.GetNextToken(),3);
|
|
|
|
}
|
|
|
|
else SetMarginString(temp,3);
|
|
|
|
|
|
|
|
// Read alpha level
|
2007-01-08 02:00:44 +01:00
|
|
|
if (version == 0) {
|
2006-01-16 22:02:54 +01:00
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Read encoding
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
temp.ToLong(&templ);
|
|
|
|
encoding = templ;
|
|
|
|
|
2007-01-08 02:54:02 +01:00
|
|
|
// Read relative to
|
|
|
|
if (version == 2) {
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
temp.ToLong(&templ);
|
|
|
|
relativeTo = templ;
|
|
|
|
}
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
// End
|
|
|
|
if (tkn.HasMoreTokens()) return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Writes data back to ASS (v4+) format
|
|
|
|
///
|
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
|
|
|
|
|
|
|
name.Replace(_T(","),_T(";"));
|
|
|
|
font.Replace(_T(","),_T(";"));
|
2007-01-18 07:45:55 +01:00
|
|
|
|
|
|
|
|
2007-02-11 00:56:10 +01:00
|
|
|
final = wxString::Format(_T("Style: %s,%s,%s,%s,%s,%s,%s,%d,%d,%d,%d,%s,%s,%s,%s,%d,%s,%s,%i,%i,%i,%i,%i"),
|
|
|
|
name.c_str(), font.c_str(), PrettyFloatD(fontsize).c_str(),
|
2007-01-22 20:31:49 +01:00
|
|
|
primary.GetASSFormatted(true,false,true).c_str(),
|
|
|
|
secondary.GetASSFormatted(true,false,true).c_str(),
|
|
|
|
outline.GetASSFormatted(true,false,true).c_str(),
|
|
|
|
shadow.GetASSFormatted(true,false,true).c_str(),
|
2007-01-18 07:45:55 +01:00
|
|
|
(bold? -1 : 0), (italic ? -1 : 0),
|
|
|
|
(underline?-1:0),(strikeout?-1:0),
|
2007-02-11 00:56:10 +01:00
|
|
|
PrettyFloatD(scalex).c_str(),PrettyFloatD(scaley).c_str(),PrettyFloatD(spacing).c_str(),PrettyFloatD(angle).c_str(),
|
|
|
|
borderstyle,PrettyFloatD(outline_w).c_str(),PrettyFloatD(shadow_w).c_str(),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
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Sets margin from a string
|
|
|
|
/// @param str
|
|
|
|
/// @param which
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void AssStyle::SetMarginString(const wxString str,int which) {
|
2009-08-05 22:52:44 +02:00
|
|
|
if (which < 0 || which >= 4) throw Aegisub::InvalidMarginIdError();
|
2007-01-18 07:45:55 +01:00
|
|
|
if (!str.IsNumber()) throw _T("Invalid margin value");
|
2006-01-16 22:02:54 +01:00
|
|
|
long value;
|
2007-01-18 07:45:55 +01:00
|
|
|
str.ToLong(&value);
|
2006-01-16 22:02:54 +01:00
|
|
|
if (value < 0) value = 0;
|
2007-01-18 07:45:55 +01:00
|
|
|
else if (value > 9999) value = 9999;
|
|
|
|
|
2007-01-08 02:08:50 +01:00
|
|
|
Margin[which] = value;
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Gets string for margin
|
|
|
|
/// @param which
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString AssStyle::GetMarginString(int which) {
|
2009-08-05 22:52:44 +02:00
|
|
|
if (which < 0 || which >= 4) throw Aegisub::InvalidMarginIdError();
|
2007-01-18 07:45:55 +01:00
|
|
|
wxString result = wxString::Format(_T("%04i"),Margin[which]);
|
2006-01-16 22:02:54 +01:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Convert style to SSA string
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString AssStyle::GetSSAText() {
|
2007-01-18 07:45:55 +01:00
|
|
|
wxString output;
|
2006-01-16 22:02:54 +01:00
|
|
|
int align = 0;
|
|
|
|
switch (alignment) {
|
|
|
|
case 1: align = 1; break;
|
|
|
|
case 2: align = 2; break;
|
|
|
|
case 3: align = 3; break;
|
|
|
|
case 4: align = 9; break;
|
|
|
|
case 5: align = 10; break;
|
|
|
|
case 6: align = 11; break;
|
|
|
|
case 7: align = 5; break;
|
|
|
|
case 8: align = 6; break;
|
|
|
|
case 9: align = 7; break;
|
|
|
|
}
|
2007-01-18 07:45:55 +01:00
|
|
|
name.Replace(_T(","),_T(";"));
|
|
|
|
font.Replace(_T(","),_T(";"));
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-02-11 00:56:10 +01:00
|
|
|
output = wxString::Format(_T("Style: %s,%s,%s,%s,%s,0,%s,%d,%d,%d,%s,%s,%d,%d,%d,%d,0,%i"),
|
|
|
|
name.c_str(), font.c_str(), PrettyFloatD(fontsize).c_str(),
|
2007-01-24 03:25:45 +01:00
|
|
|
primary.GetSSAFormatted().c_str(),
|
|
|
|
secondary.GetSSAFormatted().c_str(),
|
|
|
|
shadow.GetSSAFormatted().c_str(),
|
2007-01-18 07:45:55 +01:00
|
|
|
(bold? -1 : 0), (italic ? -1 : 0),
|
2007-02-11 00:56:10 +01:00
|
|
|
borderstyle,PrettyFloatD(outline_w).c_str(),PrettyFloatD(shadow_w).c_str(),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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Clone
|
|
|
|
/// @return
|
|
|
|
///
|
2009-06-07 02:22:36 +02:00
|
|
|
AssEntry *AssStyle::Clone() const {
|
2006-02-27 10:07:08 +01:00
|
|
|
// Create clone
|
|
|
|
AssStyle *final = new AssStyle();
|
|
|
|
|
|
|
|
// Copy data
|
|
|
|
final->group = group;
|
2009-05-15 01:45:20 +02:00
|
|
|
final->SetStartMS(GetStartMS());
|
2006-02-27 10:07:08 +01:00
|
|
|
final->Valid = Valid;
|
|
|
|
final->alignment = alignment;
|
|
|
|
final->angle = angle;
|
|
|
|
final->bold = bold;
|
|
|
|
final->borderstyle = borderstyle;
|
|
|
|
final->encoding = encoding;
|
|
|
|
final->font = font;
|
|
|
|
final->fontsize = fontsize;
|
|
|
|
final->italic = italic;
|
2007-01-18 07:45:55 +01:00
|
|
|
final->Margin[0] = Margin[0];
|
|
|
|
final->Margin[1] = Margin[1];
|
|
|
|
final->Margin[2] = Margin[2];
|
|
|
|
final->Margin[3] = Margin[3];
|
2006-02-27 10:07:08 +01:00
|
|
|
final->name = name;
|
|
|
|
final->outline = outline;
|
|
|
|
final->outline_w = outline_w;
|
|
|
|
final->primary = primary;
|
|
|
|
final->scalex = scalex;
|
|
|
|
final->scaley = scaley;
|
|
|
|
final->secondary = secondary;
|
|
|
|
final->shadow = shadow;
|
2006-03-03 20:53:04 +01:00
|
|
|
final->shadow_w = shadow_w;
|
2006-02-27 10:07:08 +01:00
|
|
|
final->spacing = spacing;
|
|
|
|
final->strikeout = strikeout;
|
|
|
|
final->underline = underline;
|
2007-01-08 02:54:02 +01:00
|
|
|
final->relativeTo = relativeTo;
|
2009-06-07 02:22:36 +02:00
|
|
|
final->SetEntryData(const_cast<AssStyle*>(this)->GetEntryData());
|
2006-02-27 10:07:08 +01:00
|
|
|
|
|
|
|
// Return
|
|
|
|
return final;
|
|
|
|
}
|
2007-04-17 00:13:09 +02:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Equal to another style?
|
|
|
|
/// @param style
|
|
|
|
/// @return
|
|
|
|
///
|
2007-04-17 01:41:06 +02:00
|
|
|
bool AssStyle::IsEqualTo(AssStyle *style) {
|
|
|
|
// memcmp won't work because strings won't match
|
|
|
|
if (style->alignment != alignment ||
|
|
|
|
style->angle != angle ||
|
|
|
|
style->bold != bold ||
|
|
|
|
style->borderstyle != borderstyle ||
|
|
|
|
style->encoding != encoding ||
|
|
|
|
style->font != font ||
|
|
|
|
style->fontsize != fontsize ||
|
|
|
|
style->italic != italic ||
|
|
|
|
style->Margin[0] != Margin[0] ||
|
|
|
|
style->Margin[1] != Margin[1] ||
|
|
|
|
style->Margin[2] != Margin[2] ||
|
|
|
|
style->Margin[3] != Margin[3] ||
|
|
|
|
style->name != name ||
|
|
|
|
style->outline != outline ||
|
|
|
|
style->outline_w != outline_w ||
|
|
|
|
style->primary != primary ||
|
|
|
|
style->scalex != scalex ||
|
|
|
|
style->scaley != scaley ||
|
|
|
|
style->secondary != secondary ||
|
|
|
|
style->shadow != shadow ||
|
|
|
|
style->shadow_w != shadow_w ||
|
|
|
|
style->spacing != spacing ||
|
|
|
|
style->strikeout != strikeout ||
|
|
|
|
style->underline != underline ||
|
|
|
|
style->relativeTo != relativeTo)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
else return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// @brief Get a list of valid ASS encodings
|
|
|
|
/// @param encodingStrings
|
|
|
|
///
|
2007-04-17 00:13:09 +02:00
|
|
|
void AssStyle::GetEncodings(wxArrayString &encodingStrings) {
|
|
|
|
encodingStrings.Clear();
|
|
|
|
encodingStrings.Add(wxString(_T("0 - ")) + _("ANSI"));
|
|
|
|
encodingStrings.Add(wxString(_T("1 - ")) + _("Default"));
|
|
|
|
encodingStrings.Add(wxString(_T("2 - ")) + _("Symbol"));
|
|
|
|
encodingStrings.Add(wxString(_T("77 - ")) + _("Mac"));
|
|
|
|
encodingStrings.Add(wxString(_T("128 - ")) + _("Shift_JIS"));
|
|
|
|
encodingStrings.Add(wxString(_T("129 - ")) + _("Hangeul"));
|
|
|
|
encodingStrings.Add(wxString(_T("130 - ")) + _("Johab"));
|
|
|
|
encodingStrings.Add(wxString(_T("134 - ")) + _("GB2312"));
|
|
|
|
encodingStrings.Add(wxString(_T("136 - ")) + _("Chinese BIG5"));
|
|
|
|
encodingStrings.Add(wxString(_T("161 - ")) + _("Greek"));
|
|
|
|
encodingStrings.Add(wxString(_T("162 - ")) + _("Turkish"));
|
|
|
|
encodingStrings.Add(wxString(_T("163 - ")) + _("Vietnamese"));
|
|
|
|
encodingStrings.Add(wxString(_T("177 - ")) + _("Hebrew"));
|
|
|
|
encodingStrings.Add(wxString(_T("178 - ")) + _("Arabic"));
|
|
|
|
encodingStrings.Add(wxString(_T("186 - ")) + _("Baltic"));
|
|
|
|
encodingStrings.Add(wxString(_T("204 - ")) + _("Russian"));
|
|
|
|
encodingStrings.Add(wxString(_T("222 - ")) + _("Thai"));
|
|
|
|
encodingStrings.Add(wxString(_T("238 - ")) + _("East European"));
|
|
|
|
encodingStrings.Add(wxString(_T("255 - ")) + _("OEM"));
|
|
|
|
}
|
2009-07-29 07:43:02 +02:00
|
|
|
|
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
|
|
|
|