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_dialogue.cpp
|
|
|
|
/// @brief Class for dialogue lines 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 04:23:43 +02:00
|
|
|
#ifndef WX_PRE
|
2007-06-19 05:34:53 +02:00
|
|
|
#include <wx/regex.h>
|
2009-09-10 04:23:43 +02:00
|
|
|
#include <wx/tokenzr.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <fstream>
|
2007-01-08 22:11:06 +01:00
|
|
|
#include "ass_dialogue.h"
|
|
|
|
#include "ass_override.h"
|
|
|
|
#include "vfr.h"
|
|
|
|
#include "utils.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-02-27 05:18:00 +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 Constructs AssDialogue AssDialogue //////////////////////
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssDialogue::AssDialogue() {
|
|
|
|
group = _T("[Events]");
|
|
|
|
|
|
|
|
Valid = true;
|
2009-05-15 01:45:20 +02:00
|
|
|
SetStartMS(0);
|
|
|
|
SetEndMS(5000);
|
2006-01-16 22:02:54 +01:00
|
|
|
Layer = 0;
|
2007-01-05 19:27:15 +01:00
|
|
|
for (int i=0;i<4;i++) Margin[i] = 0;
|
2006-01-16 22:02:54 +01:00
|
|
|
Text = _T("");
|
|
|
|
Style = _T("Default");
|
|
|
|
Actor = _T("");
|
|
|
|
Effect = _T("");
|
|
|
|
Comment = false;
|
|
|
|
|
|
|
|
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 DOCME
|
|
|
|
/// @param _data
|
|
|
|
/// @param version
|
|
|
|
///
|
2007-01-08 02:00:44 +01:00
|
|
|
AssDialogue::AssDialogue(wxString _data,int version) {
|
2007-01-08 02:54:02 +01:00
|
|
|
// Set group
|
2006-01-16 22:02:54 +01:00
|
|
|
group = _T("[Events]");
|
2007-01-08 02:54:02 +01:00
|
|
|
|
|
|
|
// Try parsing in different ways
|
|
|
|
int count = 0;
|
|
|
|
Valid = false;
|
|
|
|
while (!Valid && count < 3) {
|
|
|
|
Valid = Parse(_data,version);
|
|
|
|
count++;
|
|
|
|
version++;
|
|
|
|
if (version > 2) version = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Not valid
|
2006-01-16 22:02:54 +01:00
|
|
|
if (!Valid) {
|
|
|
|
throw _T("Failed parsing line.");
|
|
|
|
}
|
2007-01-08 02:54:02 +01:00
|
|
|
|
|
|
|
// update
|
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 Destructor
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssDialogue::~AssDialogue () {
|
|
|
|
Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Clear
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void AssDialogue::Clear () {
|
2006-02-21 04:13:35 +01:00
|
|
|
ClearBlocks();
|
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 Clear blocks
|
|
|
|
///
|
2006-02-21 04:13:35 +01:00
|
|
|
void AssDialogue::ClearBlocks() {
|
|
|
|
using std::vector;
|
|
|
|
for (vector<AssDialogueBlock*>::iterator cur=Blocks.begin();cur!=Blocks.end();cur++) {
|
|
|
|
delete *cur;
|
|
|
|
}
|
|
|
|
Blocks.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 ASS Data
|
|
|
|
/// @param rawData
|
|
|
|
/// @param version
|
|
|
|
/// @return
|
|
|
|
///
|
2007-01-08 02:00:44 +01:00
|
|
|
bool AssDialogue::Parse(wxString rawData, int version) {
|
2006-01-16 22:02:54 +01:00
|
|
|
size_t pos = 0;
|
|
|
|
wxString temp;
|
|
|
|
|
|
|
|
// Get type
|
2007-06-03 03:54:39 +02:00
|
|
|
if (rawData.StartsWith(_T("Dialogue:"))) {
|
2006-01-16 22:02:54 +01:00
|
|
|
Comment = false;
|
|
|
|
pos = 10;
|
|
|
|
}
|
2007-06-03 03:54:39 +02:00
|
|
|
else if (rawData.StartsWith(_T("Comment:"))) {
|
2006-01-16 22:02:54 +01:00
|
|
|
Comment = true;
|
|
|
|
pos = 9;
|
|
|
|
}
|
|
|
|
else return false;
|
2007-06-03 03:54:39 +02:00
|
|
|
|
2006-02-27 03:23:50 +01:00
|
|
|
wxStringTokenizer tkn(rawData.Mid(pos),_T(","),wxTOKEN_RET_EMPTY_ALL);
|
2007-06-03 03:54:39 +02:00
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-08 02:54:02 +01:00
|
|
|
// Get first token and see if it has "Marked=" in it
|
2006-01-16 22:02:54 +01:00
|
|
|
temp = tkn.GetNextToken().Trim(false).Trim(true);
|
2007-06-03 03:54:39 +02:00
|
|
|
if (temp.Lower().StartsWith(_T("marked="))) version = 0;
|
2007-01-08 02:54:02 +01:00
|
|
|
else if (version == 0) version = 1;
|
|
|
|
|
|
|
|
// Get layer number
|
2007-01-08 02:00:44 +01:00
|
|
|
if (version == 0) Layer = 0;
|
2006-01-16 22:02:54 +01:00
|
|
|
else {
|
|
|
|
long templ;
|
|
|
|
temp.ToLong(&templ);
|
|
|
|
Layer = templ;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get start time
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
Start.ParseASS(tkn.GetNextToken());
|
2009-05-15 01:45:20 +02:00
|
|
|
FixStartMS();
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Get end time
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
End.ParseASS(tkn.GetNextToken());
|
|
|
|
|
|
|
|
// Get style
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
Style = tkn.GetNextToken();
|
|
|
|
Style.Trim(true);
|
|
|
|
Style.Trim(false);
|
|
|
|
|
|
|
|
// Get actor
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
Actor = tkn.GetNextToken();
|
|
|
|
Actor.Trim(true);
|
|
|
|
Actor.Trim(false);
|
|
|
|
|
|
|
|
// Get left margin
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-05 19:27:15 +01:00
|
|
|
SetMarginString(tkn.GetNextToken().Trim(false).Trim(true),0);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Get right margin
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-05 19:27:15 +01:00
|
|
|
SetMarginString(tkn.GetNextToken().Trim(false).Trim(true),1);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-08 02:54:02 +01:00
|
|
|
// Get top margin
|
2006-01-16 22:02:54 +01:00
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
2007-01-05 19:33:48 +01:00
|
|
|
temp = tkn.GetNextToken().Trim(false).Trim(true);
|
|
|
|
SetMarginString(temp,2);
|
2007-01-08 02:54:02 +01:00
|
|
|
if (version == 1) SetMarginString(temp,3);
|
|
|
|
|
|
|
|
// Get bottom margin
|
|
|
|
bool rollBack = false;
|
|
|
|
if (version == 2) {
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
wxString oldTemp = temp;
|
|
|
|
temp = tkn.GetNextToken().Trim(false).Trim(true);
|
|
|
|
if (!temp.IsNumber()) {
|
|
|
|
version = 1;
|
|
|
|
rollBack = true;
|
|
|
|
}
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Get effect
|
2007-01-08 02:54:02 +01:00
|
|
|
if (!rollBack) {
|
|
|
|
if (!tkn.HasMoreTokens()) return false;
|
|
|
|
temp = tkn.GetNextToken();
|
|
|
|
}
|
|
|
|
Effect = temp;
|
2006-01-16 22:02:54 +01:00
|
|
|
Effect.Trim(true);
|
|
|
|
Effect.Trim(false);
|
|
|
|
|
|
|
|
// Get text
|
2007-06-03 03:54:39 +02:00
|
|
|
Text = rawData.Mid(pos+tkn.GetPosition());
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
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 Make data
|
|
|
|
/// @return
|
|
|
|
///
|
2006-02-27 05:18:00 +01:00
|
|
|
wxString AssDialogue::MakeData() {
|
2006-01-16 22:02:54 +01:00
|
|
|
// Prepare
|
2007-04-19 17:22:47 +02:00
|
|
|
static wxString final = _T("");
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-02-27 03:23:50 +01:00
|
|
|
// Write all final
|
2007-04-19 17:22:47 +02:00
|
|
|
if (Comment) final = _T("Comment: ");
|
|
|
|
else final = _T("Dialogue: ");
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-02-27 03:23:50 +01:00
|
|
|
final += wxString::Format(_T("%01i"),Layer);
|
|
|
|
final += _T(",");
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-02-27 03:23:50 +01:00
|
|
|
final += Start.GetASSFormated() + _T(",");
|
|
|
|
final += End.GetASSFormated() + _T(",");
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
Style.Replace(_T(","),_T(";"));
|
|
|
|
Actor.Replace(_T(","),_T(";"));
|
2006-02-27 03:23:50 +01:00
|
|
|
final += Style + _T(",");
|
|
|
|
final += Actor + _T(",");
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-01-05 19:27:15 +01:00
|
|
|
final += GetMarginString(0);
|
|
|
|
final += _T(",");
|
2006-02-27 03:23:50 +01:00
|
|
|
final += GetMarginString(1);
|
|
|
|
final += _T(",");
|
|
|
|
final += GetMarginString(2);
|
|
|
|
final += _T(",");
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
Effect.Replace(_T(","),_T(";"));
|
2006-02-27 03:23:50 +01:00
|
|
|
final += Effect + _T(",");
|
|
|
|
final += Text;
|
2007-04-19 17:22:47 +02:00
|
|
|
|
|
|
|
// Make sure that final has no line breaks
|
|
|
|
final.Replace(_T("\n"),_T(""));
|
|
|
|
final.Replace(_T("\r"),_T(""));
|
|
|
|
|
|
|
|
// Return final
|
2006-02-27 05:18:00 +01:00
|
|
|
return final;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Update AssDialogue's data line
|
|
|
|
///
|
2006-02-27 05:18:00 +01:00
|
|
|
void AssDialogue::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 Get entry data
|
|
|
|
/// @return
|
|
|
|
///
|
2006-02-27 05:18:00 +01:00
|
|
|
const wxString AssDialogue::GetEntryData() {
|
|
|
|
return MakeData();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Set entry data
|
|
|
|
/// @param newData
|
|
|
|
///
|
2006-02-27 05:18:00 +01:00
|
|
|
void AssDialogue::SetEntryData(wxString newData) {
|
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 SSA version of Dialogue
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString AssDialogue::GetSSAText () {
|
|
|
|
// Prepare
|
|
|
|
wxString work = _T("");
|
|
|
|
|
|
|
|
// Write all work
|
|
|
|
if (Comment) work += _T("Comment: ");
|
|
|
|
else work += _T("Dialogue: ");
|
|
|
|
|
|
|
|
work += _T("Marked=0,");
|
|
|
|
|
|
|
|
work += Start.GetASSFormated() + _T(",");
|
|
|
|
work += End.GetASSFormated() + _T(",");
|
|
|
|
|
|
|
|
Style.Replace(_T(","),_T(";"));
|
|
|
|
Actor.Replace(_T(","),_T(";"));
|
|
|
|
work += Style + _T(",");
|
|
|
|
work += Actor + _T(",");
|
|
|
|
|
2007-01-05 19:27:15 +01:00
|
|
|
work += GetMarginString(0);
|
|
|
|
work += _T(",");
|
2006-01-16 22:02:54 +01:00
|
|
|
work += GetMarginString(1);
|
|
|
|
work += _T(",");
|
|
|
|
work += GetMarginString(2);
|
|
|
|
work += _T(",");
|
|
|
|
|
|
|
|
Effect.Replace(_T(","),_T(";"));
|
|
|
|
work += Effect + _T(",");
|
|
|
|
work += Text;
|
|
|
|
|
|
|
|
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 Yea, I convert to ASS tags, then parse that. So sue me. -------------- Parse SRT tags
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void AssDialogue::ParseSRTTags () {
|
|
|
|
// Search and replace
|
|
|
|
size_t total = 0;
|
|
|
|
total += Text.Replace(_T("<i>"),_T("{\\i1}"));
|
|
|
|
total += Text.Replace(_T("</i>"),_T("{\\i0}"));
|
|
|
|
total += Text.Replace(_T("<b>"),_T("{\\b1}"));
|
|
|
|
total += Text.Replace(_T("</b>"),_T("{\\b0}"));
|
|
|
|
total += Text.Replace(_T("<u>"),_T("{\\u1}"));
|
|
|
|
total += Text.Replace(_T("</u>"),_T("{\\u0}"));
|
|
|
|
total += Text.Replace(_T("<s>"),_T("{\\s1}"));
|
|
|
|
total += Text.Replace(_T("</s>"),_T("{\\s0}"));
|
|
|
|
|
|
|
|
// Process <font> tag
|
|
|
|
wxString work = Text;
|
|
|
|
work.UpperCase();
|
|
|
|
size_t pos_open = 0;
|
|
|
|
size_t pos_close = 0;
|
|
|
|
size_t pos = 0;
|
|
|
|
size_t end = 0;
|
|
|
|
size_t start = 0;
|
|
|
|
bool isOpen;
|
|
|
|
|
|
|
|
// Iterate
|
|
|
|
pos_open = work.find(_T("<FONT"),0);
|
|
|
|
pos_close = work.find(_T("</FONT"),0);
|
|
|
|
while (pos_open != wxString::npos || pos_close != wxString::npos) {
|
|
|
|
// Determine if it's an open or close tag
|
|
|
|
if (pos_open < pos_close) {
|
|
|
|
start = pos_open;
|
|
|
|
isOpen = true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
start = pos_close;
|
|
|
|
isOpen = false;
|
|
|
|
}
|
|
|
|
end = work.find(_T(">"),start)+1;
|
|
|
|
//if (end == wxString::npos) continue;
|
|
|
|
|
|
|
|
// Open tag
|
|
|
|
if (isOpen) {
|
|
|
|
wxString replaced = _T("");
|
|
|
|
|
|
|
|
// Color tag
|
|
|
|
if ((pos = work.find(_T("COLOR=\""),start)) != wxString::npos) {
|
|
|
|
if (pos < end) {
|
|
|
|
pos += 7;
|
|
|
|
size_t end_tag = Text.find(_T("\""),pos);
|
|
|
|
if (end_tag != wxString::npos) {
|
|
|
|
if (end_tag-pos == 7) {
|
|
|
|
replaced += _T("{\\c&H");
|
|
|
|
replaced += work.substr(pos+5,2);
|
|
|
|
replaced += work.substr(pos+3,2);
|
|
|
|
replaced += work.substr(pos+1,2);
|
|
|
|
replaced += _T("&}");
|
|
|
|
total++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Face tag
|
|
|
|
if ((pos = work.find(_T("FACE=\""),start)) != wxString::npos) {
|
|
|
|
if (pos < end) {
|
|
|
|
pos += 6;
|
|
|
|
size_t end_tag = work.find(_T("\""),pos);
|
|
|
|
if (end_tag != wxString::npos) {
|
|
|
|
replaced += _T("{\\fn");
|
|
|
|
replaced += work.substr(pos,end_tag-pos);
|
|
|
|
replaced += _T("}");
|
|
|
|
total++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Size tag
|
|
|
|
if ((pos = work.find(_T("SIZE=\""),start)) != wxString::npos) {
|
|
|
|
if (pos < end) {
|
|
|
|
pos += 6;
|
|
|
|
size_t end_tag = Text.find(_T("\""),pos);
|
|
|
|
if (end_tag != wxString::npos) {
|
|
|
|
replaced += _T("{\\fs");
|
|
|
|
replaced += work.substr(pos,end_tag-pos);
|
|
|
|
replaced += _T("}");
|
|
|
|
total++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Replace whole tag
|
2007-01-22 20:31:49 +01:00
|
|
|
//Text = Text.substr(0,start) + replaced + Text.substr(end);
|
|
|
|
Text = Text.substr(0, start);
|
|
|
|
Text << replaced << Text.substr(end);
|
2006-01-16 22:02:54 +01:00
|
|
|
total++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close tag
|
|
|
|
else {
|
|
|
|
// Find if it's italic, bold, underline, and strikeout
|
|
|
|
wxString prev = Text.Left(start);
|
|
|
|
bool isItalic=false,isBold=false,isUnder=false,isStrike=false;
|
|
|
|
if (CountMatches(prev,_T("{\\i1}")) > CountMatches(prev,_T("{\\i0}"))) isItalic = true;
|
|
|
|
if (CountMatches(prev,_T("{\\b1}")) > CountMatches(prev,_T("{\\b0}"))) isBold = true;
|
|
|
|
if (CountMatches(prev,_T("{\\u1}")) > CountMatches(prev,_T("{\\u0}"))) isUnder = true;
|
|
|
|
if (CountMatches(prev,_T("{\\s1}")) > CountMatches(prev,_T("{\\s0}"))) isStrike = true;
|
|
|
|
|
|
|
|
// Generate new tag, by reseting and then restoring flags
|
|
|
|
wxString replaced = _T("{\\r");
|
|
|
|
if (isItalic) replaced += _T("\\i1");
|
|
|
|
if (isBold) replaced += _T("\\b1");
|
|
|
|
if (isUnder) replaced += _T("\\u1");
|
|
|
|
if (isStrike) replaced += _T("\\s1");
|
|
|
|
replaced += _T("}");
|
|
|
|
|
|
|
|
// Replace
|
2007-01-22 20:31:49 +01:00
|
|
|
//Text = Text.substr(0,start) + replaced + Text.substr(end);
|
|
|
|
Text = Text.substr(0, start);
|
|
|
|
Text << replaced << Text.substr(end);
|
2006-01-16 22:02:54 +01:00
|
|
|
total++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get next
|
|
|
|
work = Text;
|
|
|
|
work.UpperCase();
|
|
|
|
pos_open = work.find(_T("<FONT"),0);
|
|
|
|
pos_close = work.find(_T("</FONT"),0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove double tagging
|
|
|
|
Text.Replace(_T("}{"),_T(""));
|
|
|
|
|
|
|
|
// Update all stuff
|
2006-02-21 04:13:35 +01:00
|
|
|
//if (total > 0) UpdateText();
|
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 Parse ASS tags
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void AssDialogue::ParseASSTags () {
|
|
|
|
// Clear blocks
|
2006-02-21 04:13:35 +01:00
|
|
|
ClearBlocks();
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Is drawing?
|
|
|
|
int drawingLevel = 0;
|
|
|
|
|
|
|
|
// Loop through
|
|
|
|
const size_t len = Text.size();
|
|
|
|
size_t cur = 0;
|
|
|
|
size_t end = 0;
|
|
|
|
while (cur < len) {
|
|
|
|
// Overrides block
|
|
|
|
if (Text[cur] == '{') {
|
|
|
|
// Get contents of block
|
|
|
|
wxString work;
|
|
|
|
end = Text.find(_T("}"),cur);
|
|
|
|
if (end == wxString::npos) {
|
|
|
|
work = Text.substr(cur);
|
|
|
|
end = len;
|
|
|
|
}
|
2007-06-09 23:45:14 +02:00
|
|
|
else work = Text.substr(cur,end-cur+1);
|
2007-06-03 03:54:39 +02:00
|
|
|
|
|
|
|
if (work.Find(_T("\\")) == wxNOT_FOUND) {
|
|
|
|
//We've found an override block with no backslashes
|
|
|
|
//We're going to assume it's a comment and not consider it an override block
|
|
|
|
//Currently we'll treat this as a plain text block, but feel free to create a new class
|
|
|
|
AssDialogueBlockPlain *block = new AssDialogueBlockPlain;
|
|
|
|
block->text = work;
|
|
|
|
Blocks.push_back(block);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
2007-06-09 23:45:14 +02:00
|
|
|
work = work.substr(1,work.Len()-2); // trim { and }
|
2007-06-03 03:54:39 +02:00
|
|
|
// Create block
|
|
|
|
AssDialogueBlockOverride *block = new AssDialogueBlockOverride;
|
|
|
|
block->parent = this;
|
|
|
|
block->text = work;
|
|
|
|
block->ParseTags();
|
|
|
|
Blocks.push_back(block);
|
|
|
|
|
|
|
|
// Look for \p in block
|
|
|
|
std::vector<AssOverrideTag*>::iterator curTag;
|
|
|
|
for (curTag = block->Tags.begin();curTag != block->Tags.end();curTag++) {
|
|
|
|
AssOverrideTag *tag = *curTag;
|
|
|
|
if (tag->Name == _T("\\p")) {
|
|
|
|
drawingLevel = tag->Params.at(0)->AsInt();
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Increase
|
|
|
|
cur = end+1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Plain-text/drawing block
|
|
|
|
else {
|
|
|
|
wxString work;
|
|
|
|
end = Text.find(_T("{"),cur);
|
|
|
|
if (end == wxString::npos) {
|
|
|
|
work = Text.substr(cur);
|
|
|
|
end = len;
|
|
|
|
}
|
|
|
|
else work = Text.substr(cur,end-cur);
|
|
|
|
|
|
|
|
// Plain-text
|
|
|
|
if (drawingLevel == 0) {
|
|
|
|
AssDialogueBlockPlain *block = new AssDialogueBlockPlain;
|
|
|
|
block->text = work;
|
|
|
|
Blocks.push_back(block);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Drawing
|
|
|
|
else {
|
|
|
|
AssDialogueBlockDrawing *block = new AssDialogueBlockDrawing;
|
|
|
|
block->text = work;
|
|
|
|
block->Scale = drawingLevel;
|
|
|
|
Blocks.push_back(block);
|
|
|
|
}
|
|
|
|
|
|
|
|
cur = end;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Empty line, make an empty block
|
|
|
|
if (len == 0) {
|
|
|
|
AssDialogueBlockPlain *block = new AssDialogueBlockPlain;
|
|
|
|
block->text = _T("");
|
|
|
|
Blocks.push_back(block);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Strip tags
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void AssDialogue::StripTags () {
|
2007-06-19 05:34:53 +02:00
|
|
|
static wxRegEx reg(_T("\\{[^\\{]*\\}"),wxRE_ADVANCED);
|
|
|
|
reg.Replace(&Text,_T(""));
|
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 Strip a specific tag
|
|
|
|
/// @param tagName
|
|
|
|
///
|
2007-01-13 23:33:02 +01:00
|
|
|
void AssDialogue::StripTag (wxString tagName) {
|
|
|
|
// Parse
|
|
|
|
using std::list;
|
|
|
|
using std::vector;
|
|
|
|
ParseASSTags();
|
|
|
|
wxString final;
|
|
|
|
|
|
|
|
// Look for blocks
|
|
|
|
for (vector<AssDialogueBlock*>::iterator cur=Blocks.begin();cur!=Blocks.end();cur++) {
|
2008-01-14 01:30:00 +01:00
|
|
|
if ((*cur)->GetType() == BLOCK_OVERRIDE) {
|
2007-01-13 23:33:02 +01:00
|
|
|
AssDialogueBlockOverride *over = AssDialogueBlock::GetAsOverride(*cur);
|
|
|
|
wxString temp;
|
|
|
|
for (size_t i=0;i<over->Tags.size();i++) {
|
|
|
|
if (over->Tags[i]->Name != tagName) temp += over->Tags[i]->ToString();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Insert
|
|
|
|
if (!temp.IsEmpty()) final += _T("{") + temp + _T("}");
|
|
|
|
}
|
|
|
|
else final += (*cur)->GetText();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update
|
|
|
|
ClearBlocks();
|
|
|
|
Text = final;
|
|
|
|
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 TODO: Improve this code ------------------- Convert tags to SRT
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void AssDialogue::ConvertTagsToSRT () {
|
|
|
|
// Setup
|
|
|
|
using std::list;
|
|
|
|
using std::vector;
|
|
|
|
AssDialogueBlockOverride* curBlock;
|
|
|
|
AssDialogueBlockPlain *curPlain;
|
|
|
|
AssOverrideTag* curTag;
|
|
|
|
wxString final = _T("");
|
|
|
|
bool isItalic=false,isBold=false,isUnder=false,isStrike=false;
|
|
|
|
bool temp;
|
|
|
|
|
|
|
|
// Iterate through blocks
|
2006-02-21 04:13:35 +01:00
|
|
|
ParseASSTags();
|
2006-01-16 22:02:54 +01:00
|
|
|
for (size_t i=0;i<Blocks.size();i++) {
|
|
|
|
curBlock = AssDialogueBlock::GetAsOverride(Blocks.at(i));
|
|
|
|
if (curBlock) {
|
|
|
|
// Iterate through overrides
|
|
|
|
for (size_t j=0;j<curBlock->Tags.size();j++) {
|
|
|
|
curTag = curBlock->Tags.at(j);
|
|
|
|
if (curTag->IsValid()) {
|
|
|
|
// Italics
|
|
|
|
if (curTag->Name == _T("\\i")) {
|
|
|
|
temp = curTag->Params.at(0)->AsBool();
|
|
|
|
if (temp && !isItalic) {
|
|
|
|
isItalic = true;
|
|
|
|
final += _T("<i>");
|
|
|
|
}
|
|
|
|
if (!temp && isItalic) {
|
|
|
|
isItalic = false;
|
|
|
|
final += _T("</i>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Underline
|
|
|
|
if (curTag->Name == _T("\\u")) {
|
|
|
|
temp = curTag->Params.at(0)->AsBool();
|
|
|
|
if (temp && !isUnder) {
|
|
|
|
isUnder = true;
|
|
|
|
final += _T("<u>");
|
|
|
|
}
|
|
|
|
if (!temp && isUnder) {
|
|
|
|
isUnder = false;
|
|
|
|
final += _T("</u>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Strikeout
|
|
|
|
if (curTag->Name == _T("\\s")) {
|
|
|
|
temp = curTag->Params.at(0)->AsBool();
|
|
|
|
if (temp && !isStrike) {
|
|
|
|
isStrike = true;
|
|
|
|
final += _T("<s>");
|
|
|
|
}
|
|
|
|
if (!temp && isStrike) {
|
|
|
|
isStrike = false;
|
|
|
|
final += _T("</s>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bold
|
|
|
|
if (curTag->Name == _T("\\b")) {
|
|
|
|
temp = curTag->Params.at(0)->AsBool();
|
|
|
|
if (temp && !isBold) {
|
|
|
|
isBold = true;
|
|
|
|
final += _T("<b>");
|
|
|
|
}
|
|
|
|
if (!temp && isBold) {
|
|
|
|
isBold = false;
|
|
|
|
final += _T("</b>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Plain text
|
|
|
|
else {
|
|
|
|
curPlain = AssDialogueBlock::GetAsPlain(Blocks.at(i));
|
|
|
|
if (curPlain) {
|
|
|
|
final += curPlain->GetText();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-15 03:34:00 +02:00
|
|
|
// Ensure all tags are closed
|
|
|
|
if (isBold)
|
|
|
|
final += _T("</b>");
|
|
|
|
if (isItalic)
|
|
|
|
final += _T("</i>");
|
|
|
|
if (isUnder)
|
|
|
|
final += _T("</u>");
|
|
|
|
if (isStrike)
|
|
|
|
final += _T("</s>");
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
Text = final;
|
|
|
|
UpdateData();
|
2006-02-21 04:13:35 +01:00
|
|
|
ClearBlocks();
|
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 Updates text from tags
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void AssDialogue::UpdateText () {
|
|
|
|
using std::vector;
|
|
|
|
Text = _T("");
|
|
|
|
for (vector<AssDialogueBlock*>::iterator cur=Blocks.begin();cur!=Blocks.end();cur++) {
|
2008-01-14 01:30:00 +01:00
|
|
|
if ((*cur)->GetType() == BLOCK_OVERRIDE) {
|
2006-01-16 22:02:54 +01:00
|
|
|
Text += _T("{");
|
|
|
|
Text += (*cur)->GetText();
|
|
|
|
Text += _T("}");
|
|
|
|
}
|
|
|
|
else Text += (*cur)->GetText();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 origvalue
|
|
|
|
/// @param which
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void AssDialogue::SetMarginString(const wxString origvalue,int which) {
|
|
|
|
// Make it numeric
|
|
|
|
wxString strvalue = origvalue;
|
|
|
|
if (!strvalue.IsNumber()) {
|
|
|
|
strvalue = _T("");
|
|
|
|
for (size_t i=0;i<origvalue.Length();i++) {
|
|
|
|
if (origvalue.Mid(i,1).IsNumber()) {
|
|
|
|
strvalue += origvalue.Mid(i,1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get value
|
|
|
|
long value;
|
|
|
|
strvalue.ToLong(&value);
|
|
|
|
|
|
|
|
// Cap it
|
|
|
|
if (value < 0) value = 0;
|
|
|
|
if (value > 9999) value = 9999;
|
|
|
|
|
|
|
|
// Assign
|
2009-08-05 22:52:44 +02:00
|
|
|
if (which < 0 || which >= 4) throw Aegisub::InvalidMarginIdError();
|
2007-01-05 19:27:15 +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
|
|
|
|
/// @param pad
|
|
|
|
/// @return
|
|
|
|
///
|
2006-12-30 15:31:41 +01:00
|
|
|
wxString AssDialogue::GetMarginString(int which,bool pad) {
|
2009-08-05 22:52:44 +02:00
|
|
|
if (which < 0 || which >= 4) throw Aegisub::InvalidMarginIdError();
|
2007-01-05 19:27:15 +01:00
|
|
|
int value = Margin[which];
|
2006-12-30 15:31:41 +01:00
|
|
|
if (pad) return wxString::Format(_T("%04i"),value);
|
|
|
|
else return wxString::Format(_T("%i"),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
|
|
|
|
2009-08-01 05:27:13 +02:00
|
|
|
void AssDialogue::ProcessParameters(AssDialogueBlockOverride::ProcessParametersCallback callback,void *userData) {
|
2006-01-16 22:02:54 +01:00
|
|
|
// Apply for all override blocks
|
|
|
|
AssDialogueBlockOverride *curBlock;
|
2006-02-21 04:13:35 +01:00
|
|
|
//ParseASSTags();
|
2006-01-16 22:02:54 +01:00
|
|
|
for (std::vector<AssDialogueBlock*>::iterator cur=Blocks.begin();cur!=Blocks.end();cur++) {
|
2008-01-14 01:30:00 +01:00
|
|
|
if ((*cur)->GetType() == BLOCK_OVERRIDE) {
|
2006-01-16 22:02:54 +01:00
|
|
|
curBlock = static_cast<AssDialogueBlockOverride*> (*cur);
|
|
|
|
curBlock->ProcessParameters(callback,userData);
|
|
|
|
}
|
|
|
|
}
|
2006-02-21 04:13:35 +01:00
|
|
|
//ClearBlocks();
|
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 Checks if two lines collide
|
|
|
|
/// @param target
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
bool AssDialogue::CollidesWith(AssDialogue *target) {
|
|
|
|
if (!target) return false;
|
|
|
|
int a = Start.GetMS();
|
|
|
|
int b = End.GetMS();
|
|
|
|
int c = target->Start.GetMS();
|
|
|
|
int d = target->End.GetMS();
|
|
|
|
return ((a < c) ? (c < b) : (a < d));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Return just the text without any overrides
|
|
|
|
/// @return
|
|
|
|
///
|
2009-06-06 21:32:17 +02:00
|
|
|
wxString AssDialogue::GetStrippedText() const {
|
2007-01-13 03:22:28 +01:00
|
|
|
wxString justtext = wxString(_T(""));
|
|
|
|
bool inCode = false;
|
|
|
|
|
2007-01-24 03:11:26 +01:00
|
|
|
for (size_t charindex = 0; charindex != Text.Len(); charindex++) {
|
2007-01-13 03:22:28 +01:00
|
|
|
if (Text[charindex] == '{') inCode = true;
|
|
|
|
else if (Text[charindex] == '}') inCode = false;
|
|
|
|
else if (!inCode) justtext = justtext + Text[charindex];
|
|
|
|
}
|
|
|
|
return justtext;
|
|
|
|
}
|
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 *AssDialogue::Clone() const {
|
2006-02-27 10:07:08 +01:00
|
|
|
// Create clone
|
|
|
|
AssDialogue *final = new AssDialogue();
|
|
|
|
|
|
|
|
// Copy data
|
|
|
|
final->group = group;
|
|
|
|
final->Valid = Valid;
|
|
|
|
final->Actor = Actor;
|
|
|
|
final->Comment = Comment;
|
|
|
|
final->Effect = Effect;
|
|
|
|
final->Layer = Layer;
|
2007-01-05 19:27:15 +01:00
|
|
|
for (int i=0;i<4;i++) final->Margin[i] = Margin[i];
|
2009-05-15 01:45:20 +02:00
|
|
|
final->SetStartMS(GetStartMS());
|
|
|
|
final->SetEndMS(GetEndMS());
|
2006-02-27 10:07:08 +01:00
|
|
|
final->Style = Style;
|
|
|
|
final->Text = Text;
|
2007-04-19 17:22:47 +02:00
|
|
|
//final->SetEntryData(GetEntryData());
|
2006-02-27 10:07:08 +01:00
|
|
|
|
|
|
|
// Return
|
|
|
|
return final;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 AssDialogueBlock //////////////////////
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssDialogueBlock::AssDialogueBlock () {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssDialogueBlock::~AssDialogueBlock () {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 If it isn't a plain block, returns NULL ---------------------- Returns as a plain block
|
|
|
|
/// @param base
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssDialogueBlockPlain *AssDialogueBlock::GetAsPlain(AssDialogueBlock *base) {
|
|
|
|
if (!base) return NULL;
|
2008-01-14 01:30:00 +01:00
|
|
|
if (base->GetType() == BLOCK_PLAIN) {
|
2006-01-16 22:02:54 +01:00
|
|
|
return static_cast<AssDialogueBlockPlain*> (base);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 If it isn't an override block, returns NULL ---------------------------- Returns as an override block
|
|
|
|
/// @param base
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssDialogueBlockOverride *AssDialogueBlock::GetAsOverride(AssDialogueBlock *base) {
|
|
|
|
if (!base) return NULL;
|
2008-01-14 01:30:00 +01:00
|
|
|
if (base->GetType() == BLOCK_OVERRIDE) {
|
2006-01-16 22:02:54 +01:00
|
|
|
return static_cast<AssDialogueBlockOverride*> (base);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 If it isn't an drawing block, returns NULL ---------------------------- Returns as a drawing block
|
|
|
|
/// @param base
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssDialogueBlockDrawing *AssDialogueBlock::GetAsDrawing(AssDialogueBlock *base) {
|
|
|
|
if (!base) return NULL;
|
2008-01-14 01:30:00 +01:00
|
|
|
if (base->GetType() == BLOCK_DRAWING) {
|
2006-01-16 22:02:54 +01:00
|
|
|
return static_cast<AssDialogueBlockDrawing*> (base);
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 AssDialogueBlockPlain //////////////////////
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssDialogueBlockPlain::AssDialogueBlockPlain () {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 AssDialogueBlockDrawing //////////////////////
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
AssDialogueBlockDrawing::AssDialogueBlockDrawing () {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Multiply coordinates
|
|
|
|
/// @param mx
|
|
|
|
/// @param my
|
|
|
|
/// @param x
|
|
|
|
/// @param y
|
|
|
|
///
|
2007-10-18 04:47:13 +02:00
|
|
|
void AssDialogueBlockDrawing::TransformCoords(int mx,int my,double x,double y) {
|
2006-01-16 22:02:54 +01:00
|
|
|
// HACK: Implement a proper parser ffs!!
|
|
|
|
wxStringTokenizer tkn(GetText(),_T(" "),wxTOKEN_DEFAULT);
|
|
|
|
wxString cur;
|
|
|
|
wxString final;
|
|
|
|
bool isX = true;
|
|
|
|
long temp;
|
|
|
|
|
|
|
|
// Process tokens
|
|
|
|
while (tkn.HasMoreTokens()) {
|
|
|
|
cur = tkn.GetNextToken().Lower();
|
|
|
|
|
|
|
|
// Number, process it
|
|
|
|
if (cur.IsNumber()) {
|
2007-10-18 04:47:13 +02:00
|
|
|
// Transform it
|
2006-01-16 22:02:54 +01:00
|
|
|
cur.ToLong(&temp);
|
2007-10-18 04:47:13 +02:00
|
|
|
if (isX) temp = (long int)((temp+mx)*x + 0.5);
|
|
|
|
else temp = (long int)((temp+my)*y + 0.5);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Write back to list
|
|
|
|
final += wxString::Format(_T("%i "),temp);
|
|
|
|
|
|
|
|
// Toggle X/Y
|
|
|
|
isX = !isX;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Text
|
|
|
|
else {
|
|
|
|
if (cur == _T("m") || cur == _T("n") || cur == _T("l") || cur == _T("b") || cur == _T("s") || cur == _T("p") || cur == _T("c")) isX = true;
|
|
|
|
final += cur + _T(" ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Write back final
|
|
|
|
final = final.Left(final.Length()-1);
|
|
|
|
text = final;
|
|
|
|
}
|
2007-01-13 03:22:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|