2006-02-26 23:45:34 +01:00
|
|
|
// Copyright (c) 2006, 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-02-26 23:45:34 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file subtitle_format.cpp
|
|
|
|
/// @brief Base class for subtitle format handlers
|
|
|
|
/// @ingroup subtitle_io
|
|
|
|
///
|
2006-02-26 23:45:34 +01:00
|
|
|
|
|
|
|
|
|
|
|
///////////
|
|
|
|
// Headers
|
2009-01-04 07:31:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-09-10 15:06:40 +02:00
|
|
|
#ifndef AGI_PRE
|
|
|
|
#include <wx/intl.h>
|
2009-09-11 00:48:29 +02:00
|
|
|
#include <wx/choicdlg.h> // Keep this last so wxUSE_CHOICEDLG is set.
|
2009-09-10 15:06:40 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "ass_file.h"
|
2006-02-27 22:57:10 +01:00
|
|
|
#include "subtitle_format.h"
|
2006-02-27 01:06:46 +01:00
|
|
|
#include "subtitle_format_ass.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "subtitle_format_dvd.h"
|
2007-06-19 07:04:15 +02:00
|
|
|
#include "subtitle_format_encore.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "subtitle_format_microdvd.h"
|
|
|
|
#include "subtitle_format_mkv.h"
|
|
|
|
#include "subtitle_format_srt.h"
|
2008-07-18 03:36:20 +02:00
|
|
|
#include "subtitle_format_transtation.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "subtitle_format_ttxt.h"
|
|
|
|
#include "subtitle_format_txt.h"
|
2007-06-18 06:03:58 +02:00
|
|
|
#include "vfr.h"
|
2006-02-26 23:45:34 +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 Constructor
|
|
|
|
///
|
2006-02-27 22:57:10 +01:00
|
|
|
SubtitleFormat::SubtitleFormat() {
|
2006-02-26 23:45:34 +01:00
|
|
|
Line = NULL;
|
|
|
|
Register();
|
2006-02-27 22:57:10 +01:00
|
|
|
isCopy = false;
|
2006-02-26 23:45:34 +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 Destructor
|
|
|
|
///
|
2006-02-27 22:57:10 +01:00
|
|
|
SubtitleFormat::~SubtitleFormat () {
|
2006-02-26 23:45:34 +01:00
|
|
|
Remove();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/// DOCME
|
2006-02-27 22:57:10 +01:00
|
|
|
std::list<SubtitleFormat*> SubtitleFormat::formats;
|
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
|
|
|
|
|
|
|
/// DOCME
|
2006-02-27 22:57:10 +01:00
|
|
|
bool SubtitleFormat::loaded = false;
|
|
|
|
|
|
|
|
|
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 target
|
|
|
|
/// @param file
|
|
|
|
///
|
2006-02-27 22:57:10 +01:00
|
|
|
void SubtitleFormat::SetTarget(AssFile *file) {
|
|
|
|
ClearCopy();
|
2006-02-26 23:45:34 +01:00
|
|
|
if (!file) Line = NULL;
|
|
|
|
else Line = &file->Line;
|
|
|
|
assFile = file;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Create copy
|
|
|
|
///
|
2006-02-27 22:57:10 +01:00
|
|
|
void SubtitleFormat::CreateCopy() {
|
|
|
|
SetTarget(new AssFile(*assFile));
|
|
|
|
isCopy = true;
|
2006-02-26 23:45:34 +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 copy
|
|
|
|
///
|
2006-02-27 22:57:10 +01:00
|
|
|
void SubtitleFormat::ClearCopy() {
|
|
|
|
if (isCopy) {
|
|
|
|
delete assFile;
|
|
|
|
assFile = NULL;
|
|
|
|
isCopy = false;
|
2006-02-26 23:45:34 +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 subtitles
|
|
|
|
///
|
2006-02-27 22:57:10 +01:00
|
|
|
void SubtitleFormat::Clear() {
|
2006-02-26 23:45:34 +01:00
|
|
|
assFile->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 Load default
|
|
|
|
/// @param defline
|
|
|
|
///
|
2007-01-06 06:04:57 +01:00
|
|
|
void SubtitleFormat::LoadDefault(bool defline) {
|
|
|
|
assFile->LoadDefault(defline);
|
2006-02-26 23:45:34 +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 Add line
|
|
|
|
/// @param data
|
|
|
|
/// @param group
|
|
|
|
/// @param lasttime
|
|
|
|
/// @param version
|
|
|
|
/// @param outgroup
|
|
|
|
/// @return
|
|
|
|
///
|
2007-01-08 02:00:44 +01:00
|
|
|
int SubtitleFormat::AddLine(wxString data,wxString group,int lasttime,int &version,wxString *outgroup) {
|
|
|
|
return assFile->AddLine(data,group,lasttime,version,outgroup);
|
2006-02-27 01:06:46 +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 Add formats
|
|
|
|
///
|
2006-02-27 22:57:10 +01:00
|
|
|
void SubtitleFormat::LoadFormats () {
|
2006-02-27 01:06:46 +01:00
|
|
|
if (!loaded) {
|
2006-02-27 22:57:10 +01:00
|
|
|
new ASSSubtitleFormat();
|
|
|
|
new SRTSubtitleFormat();
|
|
|
|
new TXTSubtitleFormat();
|
2007-06-18 03:17:03 +02:00
|
|
|
new TTXTSubtitleFormat();
|
2007-06-18 06:03:58 +02:00
|
|
|
new MicroDVDSubtitleFormat();
|
2006-12-17 06:32:18 +01:00
|
|
|
new MKVSubtitleFormat();
|
2007-06-19 07:04:15 +02:00
|
|
|
new EncoreSubtitleFormat();
|
2008-07-18 03:36:20 +02:00
|
|
|
new TranStationSubtitleFormat();
|
2008-01-21 04:58:14 +01:00
|
|
|
#ifdef __WXDEBUG__
|
|
|
|
new DVDSubtitleFormat();
|
|
|
|
#endif
|
2006-02-27 01:06:46 +01:00
|
|
|
}
|
|
|
|
loaded = 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 Destroy formats
|
|
|
|
///
|
2006-02-27 22:57:10 +01:00
|
|
|
void SubtitleFormat::DestroyFormats () {
|
|
|
|
std::list<SubtitleFormat*>::iterator cur;
|
|
|
|
for (cur=formats.begin();cur!=formats.end();cur = formats.begin()) {
|
|
|
|
delete *cur;
|
|
|
|
}
|
|
|
|
formats.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 Get an appropriate reader
|
|
|
|
/// @param filename
|
|
|
|
/// @return
|
|
|
|
///
|
2006-02-27 22:57:10 +01:00
|
|
|
SubtitleFormat *SubtitleFormat::GetReader(wxString filename) {
|
|
|
|
LoadFormats();
|
|
|
|
std::list<SubtitleFormat*>::iterator cur;
|
|
|
|
SubtitleFormat *reader;
|
|
|
|
for (cur=formats.begin();cur!=formats.end();cur++) {
|
2006-02-27 01:06:46 +01:00
|
|
|
reader = *cur;
|
2006-02-27 22:57:10 +01:00
|
|
|
if (reader->CanReadFile(filename)) return reader;
|
|
|
|
}
|
|
|
|
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 Get an appropriate writer
|
|
|
|
/// @param filename
|
|
|
|
/// @return
|
|
|
|
///
|
2006-02-27 22:57:10 +01:00
|
|
|
SubtitleFormat *SubtitleFormat::GetWriter(wxString filename) {
|
|
|
|
LoadFormats();
|
|
|
|
std::list<SubtitleFormat*>::iterator cur;
|
|
|
|
SubtitleFormat *writer;
|
|
|
|
for (cur=formats.begin();cur!=formats.end();cur++) {
|
|
|
|
writer = *cur;
|
|
|
|
if (writer->CanWriteFile(filename)) return writer;
|
|
|
|
}
|
|
|
|
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 Register
|
|
|
|
/// @return
|
|
|
|
///
|
2006-02-27 22:57:10 +01:00
|
|
|
void SubtitleFormat::Register() {
|
|
|
|
std::list<SubtitleFormat*>::iterator cur;
|
|
|
|
for (cur=formats.begin();cur!=formats.end();cur++) {
|
|
|
|
if (*cur == this) return;
|
|
|
|
}
|
|
|
|
formats.push_back(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Remove
|
|
|
|
/// @return
|
|
|
|
///
|
2006-02-27 22:57:10 +01:00
|
|
|
void SubtitleFormat::Remove() {
|
|
|
|
std::list<SubtitleFormat*>::iterator cur;
|
|
|
|
for (cur=formats.begin();cur!=formats.end();cur++) {
|
|
|
|
if (*cur == this) {
|
|
|
|
formats.erase(cur);
|
|
|
|
return;
|
|
|
|
}
|
2006-02-27 01:06:46 +01:00
|
|
|
}
|
|
|
|
}
|
2006-12-26 19:26:13 +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 read wildcards
|
|
|
|
/// @return
|
|
|
|
///
|
2006-12-26 19:26:13 +01:00
|
|
|
wxArrayString SubtitleFormat::GetReadWildcards() {
|
|
|
|
return wxArrayString();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 write wildcards
|
|
|
|
/// @return
|
|
|
|
///
|
2006-12-26 19:26:13 +01:00
|
|
|
wxArrayString SubtitleFormat::GetWriteWildcards() {
|
|
|
|
return wxArrayString();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 wildcard list
|
|
|
|
/// @param mode
|
|
|
|
/// @return
|
|
|
|
///
|
2006-12-26 19:26:13 +01:00
|
|
|
wxString SubtitleFormat::GetWildcards(int mode) {
|
|
|
|
// Ensure it's loaded
|
|
|
|
LoadFormats();
|
|
|
|
|
|
|
|
// Variables
|
|
|
|
wxArrayString all;
|
|
|
|
wxArrayString cur;
|
|
|
|
wxString wild;
|
|
|
|
wxString final;
|
2006-12-26 19:32:25 +01:00
|
|
|
wxString temp1;
|
|
|
|
wxString temp2;
|
2006-12-26 19:26:13 +01:00
|
|
|
|
|
|
|
// For each format
|
|
|
|
std::list<SubtitleFormat*>::iterator curIter;
|
|
|
|
SubtitleFormat *format;
|
|
|
|
for (curIter=formats.begin();curIter!=formats.end();curIter++) {
|
|
|
|
// Get list
|
|
|
|
format = *curIter;
|
|
|
|
if (mode == 0) cur = format->GetReadWildcards();
|
|
|
|
else if (mode == 1) cur = format->GetWriteWildcards();
|
2006-12-26 19:32:25 +01:00
|
|
|
temp1.Clear();
|
|
|
|
temp2.Clear();
|
2006-12-26 19:26:13 +01:00
|
|
|
|
|
|
|
// Has wildcards
|
|
|
|
if (cur.Count()) {
|
|
|
|
// Process entries
|
|
|
|
for (unsigned int i=0;i<cur.Count();i++) {
|
|
|
|
wild = _T("*.") + cur[i];
|
|
|
|
all.Add(wild);
|
|
|
|
temp1 += wild + _T(",");
|
|
|
|
temp2 += wild + _T(";");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assemble final name
|
|
|
|
final += format->GetName() + _T(" (") + temp1.Left(temp1.Length()-1) + _T(")|") + temp2.Left(temp2.Length()-1) + _T("|");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-26 19:32:25 +01:00
|
|
|
// Add "all formats" list
|
|
|
|
temp1.Clear();
|
|
|
|
temp2.Clear();
|
|
|
|
for (unsigned int i=0;i<all.Count();i++) {
|
|
|
|
temp1 += all[i] + _T(",");
|
|
|
|
temp2 += all[i] + _T(";");
|
|
|
|
}
|
2008-01-17 21:30:44 +01:00
|
|
|
final = wxString(_("All Supported Formats")) + _T(" (") + temp1.Left(temp1.Length()-1) + _T(")|") + temp2.Left(temp2.Length()-1) + _T("|") + final.Left(final.Length()-1);
|
2006-12-26 19:32:25 +01:00
|
|
|
|
2006-12-26 19:26:13 +01:00
|
|
|
// Return final list
|
2006-12-26 19:32:25 +01:00
|
|
|
return final;
|
2006-12-26 19:26:13 +01:00
|
|
|
}
|
2007-06-18 06:03:58 +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 Ask the user to enter the FPS
|
|
|
|
/// @param showSMPTE
|
|
|
|
/// @return
|
|
|
|
///
|
2009-05-13 22:24:21 +02:00
|
|
|
SubtitleFormat::FPSRational SubtitleFormat::AskForFPS(bool showSMPTE) {
|
2007-06-18 06:03:58 +02:00
|
|
|
wxArrayString choices;
|
2009-05-13 22:24:21 +02:00
|
|
|
FPSRational fps_rat;
|
|
|
|
fps_rat.smpte_dropframe = false; // ensure it's false by default
|
2007-06-18 06:03:58 +02:00
|
|
|
|
|
|
|
// Video FPS
|
2009-05-13 22:24:21 +02:00
|
|
|
bool vidLoaded = VFR_Output.IsLoaded();
|
2007-06-18 06:03:58 +02:00
|
|
|
if (vidLoaded) {
|
|
|
|
wxString vidFPS;
|
|
|
|
if (VFR_Output.GetFrameRateType() == VFR) vidFPS = _T("VFR");
|
|
|
|
else vidFPS = wxString::Format(_T("%.3f"),VFR_Output.GetAverage());
|
|
|
|
choices.Add(wxString::Format(_T("From video (%s)"),vidFPS.c_str()));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Standard FPS values
|
2009-05-13 22:24:21 +02:00
|
|
|
choices.Add(_("15.000 FPS"));
|
|
|
|
choices.Add(_("23.976 FPS (Decimated NTSC)"));
|
|
|
|
choices.Add(_("24.000 FPS (FILM)"));
|
2007-06-18 06:03:58 +02:00
|
|
|
choices.Add(_("25.000 FPS (PAL)"));
|
|
|
|
choices.Add(_("29.970 FPS (NTSC)"));
|
2009-05-13 22:24:21 +02:00
|
|
|
if (showSMPTE)
|
|
|
|
choices.Add(_("29.970 FPS (NTSC with SMPTE dropframe)"));
|
|
|
|
choices.Add(_("30.000 FPS"));
|
|
|
|
choices.Add(_("50.000 FPS (PAL x2)"));
|
|
|
|
choices.Add(_("59.940 FPS (NTSC x2)"));
|
|
|
|
choices.Add(_("60.000 FPS"));
|
|
|
|
choices.Add(_("119.880 FPS (NTSC x4)"));
|
|
|
|
choices.Add(_("120.000 FPS"));
|
2007-06-18 06:03:58 +02:00
|
|
|
|
|
|
|
// Ask
|
|
|
|
int choice = wxGetSingleChoiceIndex(_("Please choose the appropriate FPS for the subtitles:"),_("FPS"),choices);
|
2009-05-13 22:24:21 +02:00
|
|
|
if (choice == -1) {
|
|
|
|
fps_rat.num = 0;
|
|
|
|
fps_rat.den = 0;
|
2007-06-18 06:03:58 +02:00
|
|
|
|
2009-05-13 22:24:21 +02:00
|
|
|
return fps_rat;
|
2007-06-19 07:04:15 +02:00
|
|
|
}
|
|
|
|
|
2007-06-18 06:03:58 +02:00
|
|
|
// Get FPS from choice
|
|
|
|
if (vidLoaded) choice--;
|
2009-05-13 22:24:21 +02:00
|
|
|
// dropframe was displayed, that means all choices >4 are bumped up by 1
|
|
|
|
if (showSMPTE) {
|
|
|
|
switch (choice) {
|
|
|
|
case -1: fps_rat.num = -1; fps_rat.den = 1; break; // VIDEO
|
|
|
|
case 0: fps_rat.num = 15; fps_rat.den = 1; break;
|
|
|
|
case 1: fps_rat.num = 24000; fps_rat.den = 1001; break;
|
|
|
|
case 2: fps_rat.num = 24; fps_rat.den = 1; break;
|
|
|
|
case 3: fps_rat.num = 25; fps_rat.den = 1; break;
|
|
|
|
case 4: fps_rat.num = 30000; fps_rat.den = 1001; break;
|
|
|
|
case 5: fps_rat.num = 30000; fps_rat.den = 1001; fps_rat.smpte_dropframe = true; break;
|
|
|
|
case 6: fps_rat.num = 30; fps_rat.den = 1; break;
|
|
|
|
case 7: fps_rat.num = 50; fps_rat.den = 1; break;
|
|
|
|
case 8: fps_rat.num = 60000; fps_rat.den = 1001; break;
|
|
|
|
case 9: fps_rat.num = 60; fps_rat.den = 1; break;
|
|
|
|
case 10: fps_rat.num = 120000; fps_rat.den = 1001; break;
|
|
|
|
case 11: fps_rat.num = 120; fps_rat.den = 1; break;
|
|
|
|
}
|
|
|
|
return fps_rat;
|
|
|
|
} else {
|
|
|
|
// dropframe wasn't displayed
|
|
|
|
switch (choice) {
|
|
|
|
case -1: fps_rat.num = -1; fps_rat.den = 1; break; // VIDEO
|
|
|
|
case 0: fps_rat.num = 15; fps_rat.den = 1; break;
|
|
|
|
case 1: fps_rat.num = 24000; fps_rat.den = 1001; break;
|
|
|
|
case 2: fps_rat.num = 24; fps_rat.den = 1; break;
|
|
|
|
case 3: fps_rat.num = 25; fps_rat.den = 1; break;
|
|
|
|
case 4: fps_rat.num = 30000; fps_rat.den = 1001; break;
|
|
|
|
case 5: fps_rat.num = 30; fps_rat.den = 1; break;
|
|
|
|
case 6: fps_rat.num = 50; fps_rat.den = 1; break;
|
|
|
|
case 7: fps_rat.num = 60000; fps_rat.den = 1001; break;
|
|
|
|
case 8: fps_rat.num = 60; fps_rat.den = 1; break;
|
|
|
|
case 9: fps_rat.num = 120000; fps_rat.den = 1001; break;
|
|
|
|
case 10: fps_rat.num = 120; fps_rat.den = 1; break;
|
|
|
|
}
|
|
|
|
return fps_rat;
|
2007-06-18 06:03:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// fubar
|
2009-05-13 22:24:21 +02:00
|
|
|
fps_rat.num = 0;
|
|
|
|
fps_rat.den = 0;
|
|
|
|
|
|
|
|
return fps_rat;
|
2007-06-18 06:03:58 +02:00
|
|
|
}
|
2007-06-19 05:34:53 +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 Sort lines
|
|
|
|
///
|
2007-06-19 05:34:53 +02:00
|
|
|
void SubtitleFormat::SortLines() {
|
|
|
|
Line->sort(LessByPointedToValue<AssEntry>());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 tags
|
|
|
|
/// @param format
|
|
|
|
/// @param lineEnd
|
|
|
|
///
|
2007-06-19 05:34:53 +02:00
|
|
|
void SubtitleFormat::ConvertTags(int format,wxString lineEnd) {
|
|
|
|
using std::list;
|
|
|
|
list<AssEntry*>::iterator next;
|
|
|
|
for (list<AssEntry*>::iterator cur=Line->begin();cur!=Line->end();cur++) {
|
|
|
|
AssDialogue *current = AssEntry::GetAsDialogue(*cur);
|
|
|
|
if (current) {
|
|
|
|
// Strip tags
|
|
|
|
if (format == 1) current->StripTags();
|
|
|
|
else if (format == 2) current->ConvertTagsToSRT();
|
|
|
|
|
|
|
|
// Replace line breaks
|
|
|
|
current->Text.Replace(_T("\\h"),_T(" "),true);
|
|
|
|
current->Text.Replace(_T("\\n"),lineEnd,true);
|
|
|
|
current->Text.Replace(_T("\\N"),lineEnd,true);
|
2009-09-02 10:26:52 +02:00
|
|
|
while (current->Text.Replace(lineEnd+lineEnd,lineEnd,true)) {};
|
2007-06-19 05:34:53 +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 Remove all comment lines
|
|
|
|
///
|
2008-07-18 17:39:34 +02:00
|
|
|
void SubtitleFormat::StripComments() {
|
|
|
|
using std::list;
|
|
|
|
list<AssEntry*>::iterator next;
|
|
|
|
|
|
|
|
for (list<AssEntry*>::iterator cur = Line->begin(); cur != Line->end(); cur = next) {
|
|
|
|
next = cur;
|
|
|
|
next++;
|
|
|
|
|
|
|
|
AssDialogue *dlg = AssEntry::GetAsDialogue(*cur);
|
|
|
|
if (dlg && (dlg->Comment || dlg->Text.IsEmpty())) {
|
|
|
|
delete *cur;
|
|
|
|
Line->erase(cur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Remove all non-dialogue lines
|
|
|
|
///
|
2008-07-18 17:39:34 +02:00
|
|
|
void SubtitleFormat::StripNonDialogue() {
|
|
|
|
using std::list;
|
|
|
|
list<AssEntry*>::iterator next;
|
|
|
|
|
|
|
|
for (list<AssEntry*>::iterator cur = Line->begin(); cur != Line->end(); cur = next) {
|
|
|
|
next = cur;
|
|
|
|
next++;
|
|
|
|
|
|
|
|
if (!AssEntry::GetAsDialogue(*cur)) {
|
|
|
|
delete *cur;
|
|
|
|
Line->erase(cur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Helper function for RecombineOverlaps()
|
|
|
|
/// @param list
|
|
|
|
/// @param next
|
|
|
|
/// @param newdlg
|
|
|
|
///
|
2008-07-18 17:39:34 +02:00
|
|
|
static void InsertLineSortedIntoList(std::list<AssEntry*> &list, std::list<AssEntry*>::iterator next, AssDialogue *newdlg) {
|
|
|
|
std::list<AssEntry*>::iterator insertpos = next;
|
|
|
|
bool inserted = false;
|
|
|
|
while (insertpos != list.end()) {
|
|
|
|
AssDialogue *candidate = AssEntry::GetAsDialogue(*insertpos);
|
|
|
|
if (candidate && candidate->Start >= newdlg->Start) {
|
|
|
|
list.insert(insertpos, newdlg);
|
|
|
|
inserted = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
insertpos++;
|
|
|
|
}
|
|
|
|
if (!inserted) {
|
|
|
|
list.push_back(newdlg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-01-06 06:23:58 +01:00
|
|
|
/// @brief Split and merge lines so there are no overlapping lines
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
///
|
2010-01-06 06:23:58 +01:00
|
|
|
/// Algorithm described at http://devel.aegisub.org/wiki/Technical/SplitMerge
|
2008-07-18 17:39:34 +02:00
|
|
|
void SubtitleFormat::RecombineOverlaps() {
|
|
|
|
using std::list;
|
|
|
|
list<AssEntry*>::iterator next;
|
|
|
|
|
|
|
|
for (list<AssEntry*>::iterator cur = Line->begin(); cur != Line->end(); cur = next) {
|
|
|
|
next = cur;
|
|
|
|
next++;
|
|
|
|
|
|
|
|
if (next == Line->end()) break;
|
|
|
|
|
|
|
|
AssDialogue *prevdlg = AssEntry::GetAsDialogue(*cur);
|
|
|
|
AssDialogue *curdlg = AssEntry::GetAsDialogue(*next);
|
|
|
|
|
|
|
|
if (curdlg && prevdlg && prevdlg->End > curdlg->Start) {
|
|
|
|
// Use names like in the algorithm description and prepare for erasing
|
|
|
|
// old dialogues from the list
|
|
|
|
list<AssEntry*>::iterator prev = cur;
|
|
|
|
cur = next;
|
|
|
|
next++;
|
|
|
|
|
|
|
|
// std::list::insert() inserts items before the given iterator, so
|
|
|
|
// we need 'next' for inserting. 'prev' and 'cur' can safely be erased
|
|
|
|
// from the list now.
|
|
|
|
Line->erase(prev);
|
|
|
|
Line->erase(cur);
|
|
|
|
|
|
|
|
//Is there an A part before the overlap?
|
|
|
|
if (curdlg->Start > prevdlg->Start) {
|
|
|
|
// Produce new entry with correct values
|
|
|
|
AssDialogue *newdlg = AssEntry::GetAsDialogue(prevdlg->Clone());
|
|
|
|
newdlg->Start = prevdlg->Start;
|
|
|
|
newdlg->End = curdlg->Start;
|
|
|
|
newdlg->Text = prevdlg->Text;
|
|
|
|
|
|
|
|
InsertLineSortedIntoList(*Line, next, newdlg);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Overlapping A+B part
|
|
|
|
{
|
|
|
|
AssDialogue *newdlg = AssEntry::GetAsDialogue(prevdlg->Clone());
|
|
|
|
newdlg->Start = curdlg->Start;
|
|
|
|
newdlg->End = (prevdlg->End < curdlg->End) ? prevdlg->End : curdlg->End;
|
|
|
|
// Put an ASS format hard linewrap between lines
|
|
|
|
newdlg->Text = curdlg->Text + _T("\\N") + prevdlg->Text;
|
|
|
|
|
|
|
|
InsertLineSortedIntoList(*Line, next, newdlg);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Is there an A part after the overlap?
|
|
|
|
if (prevdlg->End > curdlg->End) {
|
|
|
|
// Produce new entry with correct values
|
|
|
|
AssDialogue *newdlg = AssEntry::GetAsDialogue(prevdlg->Clone());
|
|
|
|
newdlg->Start = curdlg->End;
|
|
|
|
newdlg->End = prevdlg->End;
|
|
|
|
newdlg->Text = prevdlg->Text;
|
|
|
|
|
|
|
|
InsertLineSortedIntoList(*Line, next, newdlg);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Is there a B part after the overlap?
|
|
|
|
if (curdlg->End > prevdlg->End) {
|
|
|
|
// Produce new entry with correct values
|
|
|
|
AssDialogue *newdlg = AssEntry::GetAsDialogue(prevdlg->Clone());
|
|
|
|
newdlg->Start = prevdlg->End;
|
|
|
|
newdlg->End = curdlg->End;
|
|
|
|
newdlg->Text = curdlg->Text;
|
|
|
|
|
|
|
|
InsertLineSortedIntoList(*Line, next, newdlg);
|
|
|
|
}
|
|
|
|
|
|
|
|
next--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Merge identical lines that follow each other
|
|
|
|
///
|
2008-07-18 17:39:34 +02:00
|
|
|
void SubtitleFormat::MergeIdentical() {
|
|
|
|
using std::list;
|
|
|
|
list<AssEntry*>::iterator next;
|
|
|
|
|
|
|
|
for (list<AssEntry*>::iterator cur = Line->begin(); cur != Line->end(); cur = next) {
|
|
|
|
next = cur;
|
|
|
|
next++;
|
|
|
|
|
|
|
|
if (next == Line->end()) break;
|
|
|
|
|
|
|
|
AssDialogue *curdlg = AssEntry::GetAsDialogue(*cur);
|
|
|
|
AssDialogue *nextdlg = AssEntry::GetAsDialogue(*next);
|
|
|
|
|
2008-08-11 02:02:36 +02:00
|
|
|
if (curdlg && nextdlg && curdlg->End == nextdlg->Start && curdlg->Text == nextdlg->Text) {
|
2008-07-18 17:39:34 +02:00
|
|
|
// Merge timing
|
|
|
|
nextdlg->Start = (nextdlg->Start < curdlg->Start ? nextdlg->Start : curdlg->Start);
|
|
|
|
nextdlg->End = (nextdlg->End > curdlg->End ? nextdlg->End : curdlg->End);
|
|
|
|
|
|
|
|
// Remove duplicate line
|
|
|
|
delete *cur;
|
|
|
|
Line->erase(cur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|