Renamed Gorgonsub into Athenasub.

Originally committed to SVN as r2078.
This commit is contained in:
Rodrigo Braz Monteiro 2008-03-18 03:44:00 +00:00
parent cd9d6f1cfb
commit a7b73fc2da
59 changed files with 258 additions and 209 deletions

View file

@ -157,18 +157,18 @@
<Filter
Name="Include"
>
<File
RelativePath=".\include\aegilib\athenastring.h"
>
</File>
<File
RelativePath=".\include\aegilib\athenasub.h"
>
</File>
<File
RelativePath=".\include\aegilib\fastbuffer.h"
>
</File>
<File
RelativePath=".\include\aegilib\gorgonstring.h"
>
</File>
<File
RelativePath=".\include\aegilib\gorgonsub.h"
>
</File>
<File
RelativePath=".\include\aegilib\tr1.h"
>
@ -217,6 +217,10 @@
<Filter
Name="Misc"
>
<File
RelativePath=".\include\aegilib\athenatime.h"
>
</File>
<File
RelativePath=".\src\colour.cpp"
>
@ -237,10 +241,6 @@
RelativePath=".\include\aegilib\exception.h"
>
</File>
<File
RelativePath=".\include\aegilib\gorgontime.h"
>
</File>
<File
RelativePath=".\src\prec.cpp"
>
@ -431,6 +431,10 @@
>
</File>
</Filter>
<File
RelativePath=".\todo.txt"
>
</File>
</Files>
<Globals>
</Globals>

View file

@ -27,17 +27,17 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
#include "selection.h"
namespace Gorgonsub {
namespace Athenasub {
// Prototypes
class Model;
class Entry;

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -36,11 +36,11 @@
#pragma once
#include <list>
#include "action.h"
#include "gorgonstring.h"
#include "athenastring.h"
#include "section_entry.h"
#include "selection.h"
namespace Gorgonsub {
namespace Athenasub {
// Prototypes
class Controller;

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -38,7 +38,7 @@
#include <wx/string.h>
#include <vector>
namespace Gorgonsub {
namespace Athenasub {
// Define the string type used throughout this library
//typedef std::basic_string<wchar_t> String;

View file

@ -27,20 +27,25 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#ifndef UNICODE
#error "This library requires unicode support."
#endif
#include "tr1.h"
#include "exception.h"
#include "model.h"
#include "view.h"
#include "controller.h"
#include "notification.h"
#include "gorgonstring.h"
#include "athenastring.h"
#include "format.h"
#include "format_handler.h"
#include "format_manager.h"
@ -48,7 +53,7 @@
#include "section.h"
#include "section_entry_dialogue.h"
#include "section_entry_style.h"
#include "gorgontime.h"
#include "athenatime.h"
#include "colour.h"
#include "utils.h"
#include "version.h"

View file

@ -27,17 +27,17 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
#include "utils.h"
namespace Gorgonsub {
namespace Athenasub {
// Time class
class Time {

View file

@ -27,16 +27,16 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
namespace Gorgonsub {
namespace Athenasub {
// Colour class
class Colour {

View file

@ -27,18 +27,18 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
#include "tr1.h"
#include "format.h"
namespace Gorgonsub {
namespace Athenasub {
// Prototypes
class Model;

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -36,7 +36,7 @@
#pragma once
#include "tr1.h"
namespace Gorgonsub {
namespace Athenasub {
// Void pointer prototyle
typedef shared_ptr<void> VoidPtr;

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -35,10 +35,10 @@
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
#include <exception>
namespace Gorgonsub {
namespace Athenasub {
// Exception class
class Exception : public std::exception {
@ -54,6 +54,7 @@ namespace Gorgonsub {
Invalid_Token,
Out_Of_Range,
Invalid_Section,
Internal_Error,
TODO
};
@ -72,7 +73,7 @@ namespace Gorgonsub {
}
#ifdef _MSC_VER
#define THROW_GORGON_EXCEPTION(code) throw Gorgonsub::Exception(code,__FILE__,__LINE__)
#define THROW_ATHENA_EXCEPTION(code) throw Athenasub::Exception(code,__FILE__,__LINE__)
#else
#define THROW_GORGON_EXCEPTION(code) throw Gorgonsub::Exception(code)
#define THROW_ATHENA_EXCEPTION(code) throw Athenasub::Exception(code)
#endif

View file

@ -39,7 +39,7 @@
#include "utils.h"
namespace Gorgonsub {
namespace Athenasub {
// Fast buffer class
template <typename T>
class FastBuffer {

View file

@ -27,18 +27,18 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
#include "tr1.h"
#include "section_entry.h"
namespace Gorgonsub {
namespace Athenasub {
// Prototypes
class FormatHandler;
class Model;

View file

@ -27,18 +27,18 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
#include "model.h"
#include "tr1.h"
namespace Gorgonsub {
namespace Athenasub {
// Format handler interface
class FormatHandler {

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -36,7 +36,7 @@
#pragma once
#include "format.h"
namespace Gorgonsub {
namespace Athenasub {
// Format manager class
class FormatManager {

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -40,7 +40,7 @@
#include "actionlist.h"
#include "section.h"
namespace Gorgonsub {
namespace Athenasub {
// Prototypes
class View;

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -38,7 +38,7 @@
#include "model.h"
#include "notification.h"
namespace Gorgonsub {
namespace Athenasub {
// Notification class
class Notification {

View file

@ -27,20 +27,20 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
#include "section_entry.h"
#include "tr1.h"
#include <list>
#include <map>
namespace Gorgonsub {
namespace Athenasub {
// Section class
class Section {

View file

@ -27,18 +27,18 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
#include "tr1.h"
#include "deltacoder.h"
namespace Gorgonsub {
namespace Athenasub {
// Types
enum SectionEntryType {

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -36,17 +36,17 @@
#pragma once
#include "exception.h"
#include "gorgontime.h"
#include "athenatime.h"
#include "section_entry.h"
namespace Gorgonsub {
namespace Athenasub {
// Dialogue class
class Dialogue : public Entry {
private:
static const bool dodgeWarning = true;
void ThrowUnsupported() const { if (dodgeWarning) THROW_GORGON_EXCEPTION(Exception::Unsupported_Format_Feature); }
void ThrowUnsupported() const { if (dodgeWarning) THROW_ATHENA_EXCEPTION(Exception::Unsupported_Format_Feature); }
public:
// Destructor

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -40,13 +40,13 @@
#include "section_entry.h"
namespace Gorgonsub {
namespace Athenasub {
// Style class
class Style : public Entry {
private:
static const bool dodgeWarning = true;
void ThrowUnsupported() const { if (dodgeWarning) THROW_GORGON_EXCEPTION(Exception::Unsupported_Format_Feature); }
void ThrowUnsupported() const { if (dodgeWarning) THROW_ATHENA_EXCEPTION(Exception::Unsupported_Format_Feature); }
public:
// Destructor

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -36,7 +36,7 @@
#pragma once
#include <vector>
namespace Gorgonsub {
namespace Athenasub {
// Range class
class Range {

View file

@ -27,16 +27,16 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
namespace Gorgonsub {
namespace Athenasub {
// Interface to serialize classes
class SerializeText {
public:

View file

@ -27,17 +27,17 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
#include "tr1.h"
namespace Gorgonsub {
namespace Athenasub {
// Tokenizer class
class Tokenizer {

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -42,7 +42,7 @@
#include <tr1/memory>
#include <tr1/array>
namespace Gorgonsub {
namespace Athenasub {
using std::tr1::shared_ptr;
using std::tr1::weak_ptr;
using std::tr1::array;

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -35,7 +35,7 @@
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
/////////////
@ -67,7 +67,7 @@ T Mid(T a,T b,T c)
////////////////////
// Helper functions
namespace Gorgonsub {
namespace Athenasub {
// Convert a string to an integer
int StringToInt(const String &str);

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -35,11 +35,11 @@
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
////////////////////
// Helper functions
namespace Gorgonsub {
namespace Athenasub {
// Version
String GetLibraryName();

View file

@ -27,17 +27,17 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
#include <list>
namespace Gorgonsub {
namespace Athenasub {
// Prototypes
class Model;
class Notification;

View file

@ -27,14 +27,14 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#include "gorgonsub.h"
using namespace Gorgonsub;
#include "athenasub.h"
using namespace Athenasub;
////////////////////////////////
@ -104,7 +104,7 @@ void ActionRemove::Execute(Model &model)
{
// Find the section to remote it from
String sect = section;
if (sect.IsEmpty()) THROW_GORGON_EXCEPTION(Exception::TODO); // TODO
if (sect.IsEmpty()) THROW_ATHENA_EXCEPTION(Exception::TODO); // TODO
SectionPtr section = GetSection(model,sect);
// Remove the line

View file

@ -27,14 +27,14 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#include "Gorgonsub.h"
using namespace Gorgonsub;
#include "Athenasub.h"
using namespace Athenasub;
///////////////
@ -58,7 +58,7 @@ ActionList::~ActionList()
// Add an action to the queue
void ActionList::AddAction(const ActionPtr action)
{
if (!valid) THROW_GORGON_EXCEPTION(Exception::Invalid_ActionList);
if (!valid) THROW_ATHENA_EXCEPTION(Exception::Invalid_ActionList);
actions.push_back(action);
if (actions.size() > 2) {
int a = 0;
@ -71,7 +71,7 @@ void ActionList::AddAction(const ActionPtr action)
// Add an action to the start of the queue
void ActionList::AddActionStart(const ActionPtr action)
{
if (!valid) THROW_GORGON_EXCEPTION(Exception::Invalid_ActionList);
if (!valid) THROW_ATHENA_EXCEPTION(Exception::Invalid_ActionList);
actions.push_front(action);
if (actions.size() > 2) {
int a = 0;

View file

@ -27,15 +27,15 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#include "Gorgonsub.h"
using namespace Gorgonsub;
#include "Athenasub.h"
using namespace Athenasub;
////////////////

View file

@ -27,15 +27,15 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#include "controller.h"
#include "Gorgonsub.h"
using namespace Gorgonsub;
#include "Athenasub.h"
using namespace Athenasub;
///////////////
@ -60,7 +60,6 @@ void Controller::LoadFile(const String filename,const String encoding)
{
const FormatPtr handler = FormatManager::GetFormatFromFilename(filename,true);
wxFFileInputStream stream(filename);
//wxBufferedInputStream buffer(stream);
model.Load(stream,handler,encoding);
}
@ -71,7 +70,6 @@ void Controller::SaveFile(const String filename,const String encoding)
{
const FormatPtr handler = FormatManager::GetFormatFromFilename(filename,true);
wxFFileOutputStream stream(filename);
//wxBufferedOutputStream buffer(stream);
model.Save(stream,handler,encoding);
}
@ -122,7 +120,7 @@ DialogueConstPtr Controller::GetDialogue(size_t n) const
{
// TODO
(void) n;
THROW_GORGON_EXCEPTION(Exception::TODO);
THROW_ATHENA_EXCEPTION(Exception::TODO);
}
@ -132,7 +130,7 @@ DialogueConstPtr Controller::GetStyle(size_t n) const
{
// TODO
(void) n;
THROW_GORGON_EXCEPTION(Exception::TODO);
THROW_ATHENA_EXCEPTION(Exception::TODO);
}
@ -144,7 +142,7 @@ StyleConstPtr Controller::GetStyle(String name) const
StylePtr dummy = CreateStyle();
String section = dummy->GetDefaultGroup();
SectionPtr sect = model.GetSection(section);
if (!sect) THROW_GORGON_EXCEPTION(Exception::Invalid_Section);
if (!sect) THROW_ATHENA_EXCEPTION(Exception::Invalid_Section);
// Return from index
return dynamic_pointer_cast<const Style> (sect->GetFromIndex(name));
@ -156,6 +154,6 @@ StyleConstPtr Controller::GetStyle(String name) const
EntryConstPtr Controller::GetEntry(size_t n,String section) const
{
SectionPtr sect = model.GetSection(section);
if (!sect) THROW_GORGON_EXCEPTION(Exception::Invalid_Section);
if (!sect) THROW_ATHENA_EXCEPTION(Exception::Invalid_Section);
return sect->GetEntry(n);
}

View file

@ -27,14 +27,14 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#include "exception.h"
using namespace Gorgonsub;
using namespace Athenasub;
////////////////
@ -67,6 +67,7 @@ const char* Exception::GetMessageChar(int code)
case Invalid_Token: return "Invalid type for this token.";
case Out_Of_Range: return "Out of range.";
case Invalid_Section: return "Invalid section.";
case Internal_Error: return "Internal error.";
case TODO: return "TODO";
}
return "Invalid code.";

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -36,7 +36,7 @@
#include "format_manager.h"
#include "formats/format_ass.h"
#include <wx/string.h>
using namespace Gorgonsub;
using namespace Athenasub;
////////

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -42,7 +42,7 @@
#include "../text_file_writer.h"
#include <iostream>
#include <wx/tokenzr.h>
using namespace Gorgonsub;
using namespace Athenasub;
///////
@ -139,6 +139,9 @@ void FormatHandlerASS::Load(wxInputStream &file,const String encoding)
EntryPtr entry = MakeEntry(cur,section,version);
if (entry) section->AddEntry(entry);
}
// Ensure validity
MakeValid();
}
@ -316,7 +319,7 @@ void FormatHandlerASS::ProcessGroup(String cur,String &curGroup,int &version) {
if (versionString == _T("v4.00")) trueVersion = 0;
else if (versionString == _T("v4.00+")) trueVersion = 1;
else if (versionString == _T("v4.00++")) trueVersion = 2;
else THROW_GORGON_EXCEPTION(Exception::Unknown_Format);
else THROW_ATHENA_EXCEPTION(Exception::Unknown_Format);
if (trueVersion != version) {
// TODO: issue warning?
version = trueVersion;
@ -361,3 +364,37 @@ void FormatHandlerASS::WriteSection(TextFileWriter &writer,SectionPtr section)
writer.WriteLineToFile(serial->ToText(formatVersion));
}
}
///////////////////////
// Validate the format
void FormatHandlerASS::MakeValid()
{
// Only ASS supported right now
if (formatVersion != 1) THROW_ATHENA_EXCEPTION(Exception::TODO);
// Check for [Script Info]
SectionPtr section = GetSection(L"Script Info");
if (!section) AddSection(L"Script Info");
section = GetSection(L"Script Info");
if (!section) THROW_ATHENA_EXCEPTION(Exception::Internal_Error);
// Check if necessary variables are available
if (section->GetProperty(L"PlayResX").IsEmpty()) section->SetProperty(L"PlayResX",L"384"); // These two mystical values come from Substation Alpha
if (section->GetProperty(L"PlayResY").IsEmpty()) section->SetProperty(L"PlayResY",L"288"); // 288 is half of 576, the PAL resolution, and 384 makes it 4:3
section->SetProperty(L"ScriptType",L"v4.00+");
// Get [V4+ Styles]
section = GetSection(L"V4+ Styles");
if (!section) AddSection(L"V4+ Styles");
section = GetSection(L"V4+ Styles");
if (!section) THROW_ATHENA_EXCEPTION(Exception::Internal_Error);
section->SetProperty(L"Format",L"Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding");
// Get [Events]
section = GetSection(L"Events");
if (!section) AddSection(L"Events");
section = GetSection(L"Events");
if (!section) THROW_ATHENA_EXCEPTION(Exception::Internal_Error);
section->SetProperty(L"Format",L"Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text");
}

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -43,7 +43,7 @@
#include "section_entry_style.h"
#include "tr1.h"
namespace Gorgonsub {
namespace Athenasub {
// Prototypes
class Model;
@ -57,6 +57,7 @@ namespace Gorgonsub {
EntryPtr MakeEntry(const String &data,SectionPtr section,int version);
void ProcessGroup(String cur,String &curGroup,int &version);
void WriteSection(TextFileWriter &writer,SectionPtr section);
void MakeValid();
public:
FormatHandlerASS(Model &model,int version);

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -36,7 +36,7 @@
#include "format_ass_dialogue.h"
#include "tokenizer.h"
#include "utils.h"
using namespace Gorgonsub;
using namespace Athenasub;
////////////////
@ -57,7 +57,7 @@ DialogueASS::DialogueASS(const String &data,int version)
if (version > 2) version = 0;
}
if (!valid) {
THROW_GORGON_EXCEPTION(Exception::Parse_Error);
THROW_ATHENA_EXCEPTION(Exception::Parse_Error);
}
}

View file

@ -27,19 +27,19 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "gorgonstring.h"
#include "athenastring.h"
#include "section_entry_dialogue.h"
#include "format_ass_dialogue_delta.h"
#include "serialize.h"
namespace Gorgonsub {
namespace Athenasub {
// Dialogue
class DialogueASS : public Dialogue, public SerializeText {

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -41,7 +41,7 @@
#include <stdint.h>
#endif
using namespace Gorgonsub;
using namespace Athenasub;
////////////////////////////////////
// Encode delta between two entries

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -36,7 +36,7 @@
#pragma once
#include "deltacoder.h"
namespace Gorgonsub {
namespace Athenasub {
// Delta coder
class DialogueASS;

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -37,7 +37,7 @@
#include "section_entry.h"
#include "serialize.h"
namespace Gorgonsub {
namespace Athenasub {
// Raw line
class PlainASS : public PlainText, public SerializeText {

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -36,7 +36,7 @@
#include "format_ass_style.h"
#include "tokenizer.h"
#include "utils.h"
using namespace Gorgonsub;
using namespace Athenasub;
////////////////
@ -55,7 +55,7 @@ StyleASS::StyleASS(String data,int version)
version++;
if (version > 2) version = 0;
}
if (!valid) THROW_GORGON_EXCEPTION(Exception::Parse_Error);
if (!valid) THROW_ATHENA_EXCEPTION(Exception::Parse_Error);
}

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -38,7 +38,7 @@
#include "serialize.h"
#include "tr1.h"
namespace Gorgonsub {
namespace Athenasub {
// Style
class StyleASS : public Style, public SerializeText {

View file

@ -27,14 +27,14 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#include "Gorgonsub.h"
using namespace Gorgonsub;
#include "Athenasub.h"
using namespace Athenasub;
/////////////////////////////////////////////////////////
@ -99,12 +99,12 @@ void Model::Load(wxInputStream &input,const FormatPtr _format,const String encod
// TODO
// No format found
THROW_GORGON_EXCEPTION(Exception::No_Format_Handler);
THROW_ATHENA_EXCEPTION(Exception::No_Format_Handler);
}
// Get handler
FormatHandlerPtr handler = _format->GetHandler(*this);
if (!handler) THROW_GORGON_EXCEPTION(Exception::No_Format_Handler);
if (!handler) THROW_ATHENA_EXCEPTION(Exception::No_Format_Handler);
// Clear the model first
Clear();
@ -124,12 +124,12 @@ void Model::Save(wxOutputStream &output,const FormatPtr _format,const String enc
// Use another format
if (_format && _format != format) {
// TODO
THROW_GORGON_EXCEPTION(Exception::TODO);
THROW_ATHENA_EXCEPTION(Exception::TODO);
}
// Get handler
FormatHandlerPtr handler = format->GetHandler(*this);
if (!handler) THROW_GORGON_EXCEPTION(Exception::No_Format_Handler);
if (!handler) THROW_ATHENA_EXCEPTION(Exception::No_Format_Handler);
// Load
handler->Save(output,encoding);
@ -141,7 +141,7 @@ void Model::Save(wxOutputStream &output,const FormatPtr _format,const String enc
void Model::AddSection(String name)
{
SectionPtr prev = GetSection(name);
if (prev) THROW_GORGON_EXCEPTION(Exception::Section_Already_Exists);
if (prev) THROW_ATHENA_EXCEPTION(Exception::Section_Already_Exists);
sections.push_back(SectionPtr(new Section(name)));
}

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -35,7 +35,7 @@
#include "section.h"
using namespace Gorgonsub;
using namespace Athenasub;
///////////////

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -37,7 +37,7 @@
#include "section_entry.h"
#include "section_entry_dialogue.h"
#include "section_entry_style.h"
using namespace Gorgonsub;
using namespace Athenasub;
/////////////////////////////////

View file

@ -27,14 +27,14 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#include "gorgonsub.h"
using namespace Gorgonsub;
#include "athenasub.h"
using namespace Athenasub;
///////////////
@ -60,7 +60,7 @@ void Selection::RemoveRange(const Range &range)
{
// TODO
(void) range;
THROW_GORGON_EXCEPTION(Exception::TODO);
THROW_ATHENA_EXCEPTION(Exception::TODO);
}
@ -159,5 +159,5 @@ void Selection::RemoveSelection (const Selection &param)
size_t Range::GetLine(size_t n) const
{
if (start+n < end) return start+n;
else THROW_GORGON_EXCEPTION(Exception::Out_Of_Range);
else THROW_ATHENA_EXCEPTION(Exception::Out_Of_Range);
}

View file

@ -40,7 +40,7 @@
#include <string>
#include <wx/wfstream.h>
#include "text_file_reader.h"
using namespace Gorgonsub;
using namespace Athenasub;
#ifdef WITH_UNIVCHARDET
#include "charset_detect.h"
@ -49,7 +49,7 @@ using namespace Gorgonsub;
///////////////
// Constructor
TextFileReader::TextFileReader(wxInputStream &stream,Gorgonsub::String enc,bool _trim,bool prefetch)
TextFileReader::TextFileReader(wxInputStream &stream,Athenasub::String enc,bool _trim,bool prefetch)
: file(stream)
{
// Setup
@ -177,7 +177,7 @@ void ParseLine(FastBuffer<T> &_buffer,wxInputStream &file,wxString &stringBuffer
//////////////////////////
// Reads a line from file
Gorgonsub::String TextFileReader::ActuallyReadLine()
Athenasub::String TextFileReader::ActuallyReadLine()
{
wxString stringBuffer;
size_t bufAlloc = 1024;
@ -213,7 +213,7 @@ bool TextFileReader::HasMoreLines()
////////////////////////////////
// Ensure that charset is valid
void TextFileReader::EnsureValid(Gorgonsub::String enc)
void TextFileReader::EnsureValid(Athenasub::String enc)
{
if (enc == _T("unknown") || enc == _T("UTF-32BE") || enc == _T("UTF-32LE")) {
wxString error = _T("Character set ");

View file

@ -38,12 +38,12 @@
// Headers
#include "Gorgonsub.h"
#include "Athenasub.h"
#include "fastbuffer.h"
#include <wx/stream.h>
namespace Gorgonsub {
namespace Athenasub {
// Text file reader
class TextFileReader {

View file

@ -39,7 +39,7 @@
#include <fstream>
#include "text_file_writer.h"
#include "utils.h"
using namespace Gorgonsub;
using namespace Athenasub;
///////////////
@ -65,7 +65,7 @@ TextFileWriter::~TextFileWriter() {
/////////////////
// Write to file
void TextFileWriter::WriteLineToFile(Gorgonsub::String line,bool addLineBreak) {
void TextFileWriter::WriteLineToFile(Athenasub::String line,bool addLineBreak) {
// Add line break
wxString temp = line;
if (addLineBreak && Is16) temp += _T("\r\n");

View file

@ -35,11 +35,11 @@
#pragma once
#include "Gorgonsub.h"
#include "Athenasub.h"
#include <wx/stream.h>
namespace Gorgonsub {
namespace Athenasub {
class TextFileWriter {
private:
wxString encoding;
@ -58,6 +58,6 @@ namespace Gorgonsub {
TextFileWriter(wxOutputStream &stream,String encoding=_T(""));
~TextFileWriter();
void WriteLineToFile(Gorgonsub::String line,bool addLineBreak=true);
void WriteLineToFile(Athenasub::String line,bool addLineBreak=true);
};
}

View file

@ -27,14 +27,14 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#include "Gorgonsub.h"
using namespace Gorgonsub;
#include "Athenasub.h"
using namespace Athenasub;
//////////////////////

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -37,7 +37,7 @@
#include "exception.h"
#include "utils.h"
#include <wx/tokenzr.h>
using namespace Gorgonsub;
using namespace Athenasub;
///////////////
// Constructor
@ -72,7 +72,7 @@ int Tokenizer::GetPosition()
String Tokenizer::GetString(bool trim)
{
// Has any more?
if (!HasMoreTokens()) THROW_GORGON_EXCEPTION(Exception::Invalid_Token);
if (!HasMoreTokens()) THROW_ATHENA_EXCEPTION(Exception::Invalid_Token);
// Find token
size_t len = string.Length();

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -35,12 +35,12 @@
#include "utils.h"
using namespace Gorgonsub;
using namespace Athenasub;
//////////////////////////////////
// Convert a string to an integer
int Gorgonsub::StringToInt(const String &str)
int Athenasub::StringToInt(const String &str)
{
size_t len = str.Length();
int value = 0;
@ -55,7 +55,7 @@ int Gorgonsub::StringToInt(const String &str)
//////////////////////////////////////
// Converts a substring to an integer
int Gorgonsub::SubStringToInteger(const String &str,size_t start,size_t end)
int Athenasub::SubStringToInteger(const String &str,size_t start,size_t end)
{
int value = 0;
int chr;
@ -69,7 +69,7 @@ int Gorgonsub::SubStringToInteger(const String &str,size_t start,size_t end)
////////////////
// Pretty float
String Gorgonsub::PrettyFloat(String src) {
String Athenasub::PrettyFloat(String src) {
if (src.Contains(_T("."))) {
size_t len = src.Length();
while (src.Right(1) == _T("0")) {
@ -84,27 +84,27 @@ String Gorgonsub::PrettyFloat(String src) {
return src;
}
String Gorgonsub::PrettyFloatF(float src) { return Gorgonsub::PrettyFloat(wxString::Format(_T("%f"),src)); }
String Gorgonsub::PrettyFloatD(double src) { return Gorgonsub::PrettyFloat(wxString::Format(_T("%f"),src)); }
String Athenasub::PrettyFloatF(float src) { return Athenasub::PrettyFloat(wxString::Format(_T("%f"),src)); }
String Athenasub::PrettyFloatD(double src) { return Athenasub::PrettyFloat(wxString::Format(_T("%f"),src)); }
///////////////////
// Float to string
String Gorgonsub::FloatToString(double value) {
String Athenasub::FloatToString(double value) {
return PrettyFloat(wxString::Format(_T("%f"),value));
}
/////////////////
// Int to string
String Gorgonsub::IntegerToString(int value) {
String Athenasub::IntegerToString(int value) {
return wxString::Format(_T("%i"),value);
}
////////////////////////////
// Fast writing to a string
void Gorgonsub::WriteNumber(wxChar *&dst,wxChar *temp,int number,int pad,size_t &pos) {
void Athenasub::WriteNumber(wxChar *&dst,wxChar *temp,int number,int pad,size_t &pos) {
// Write number backwards first
int div, value;
size_t len;
@ -134,7 +134,7 @@ void Gorgonsub::WriteNumber(wxChar *&dst,wxChar *temp,int number,int pad,size_t
/////////////////
// Trim a string
const wxChar *Gorgonsub::StringPtrTrim(wxChar *chr,size_t len,size_t startPos)
const wxChar *Athenasub::StringPtrTrim(wxChar *chr,size_t len,size_t startPos)
{
// String metrics
wxChar *read = chr;
@ -168,7 +168,7 @@ const wxChar *Gorgonsub::StringPtrTrim(wxChar *chr,size_t len,size_t startPos)
return chr + start;
}
const wxChar *Gorgonsub::StringTrim(wxString &str,size_t startPos)
const wxChar *Athenasub::StringTrim(wxString &str,size_t startPos)
{
// Get a pointer to the string data
wxChar *chr = const_cast<wxChar*> (str.c_str());
@ -178,7 +178,7 @@ const wxChar *Gorgonsub::StringTrim(wxString &str,size_t startPos)
//////////////////////////////////////////////////
// Compares a string to a constant, ignoring case
bool Gorgonsub::AsciiStringCompareNoCase(const wxString &str1,const wxChar *str2)
bool Athenasub::AsciiStringCompareNoCase(const wxString &str1,const wxChar *str2)
{
const wxChar *src = str1.c_str();
wxChar c1,c2;
@ -204,7 +204,7 @@ bool Gorgonsub::AsciiStringCompareNoCase(const wxString &str1,const wxChar *str2
///////////////////////////////////////////////
// Get the UTF-8 length out of a UTF-16 string
size_t Gorgonsub::GetUTF8Len(const wchar_t *utf16)
size_t Athenasub::GetUTF8Len(const wchar_t *utf16)
{
size_t len = 0;
wchar_t curChar = utf16[0];
@ -234,7 +234,7 @@ size_t Gorgonsub::GetUTF8Len(const wchar_t *utf16)
///////////////////////////
// Convert UTF-16 to UTF-8
size_t Gorgonsub::UTF16toUTF8(const wchar_t *utf16,char *utf8)
size_t Athenasub::UTF16toUTF8(const wchar_t *utf16,char *utf8)
{
wchar_t curChar = 1;
size_t value;

View file

@ -27,7 +27,7 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
@ -35,21 +35,21 @@
#include "version.h"
#include "gorgonstring.h"
using namespace Gorgonsub;
#include "athenastring.h"
using namespace Athenasub;
////////////////
// Library data
String Gorgonsub::GetLibraryName()
String Athenasub::GetLibraryName()
{
return _T("Gorgonsub");
return _T("Athenasub");
}
String Gorgonsub::GetLibraryVersionString()
String Athenasub::GetLibraryVersionString()
{
return _T("Gorgonsub v0.x - EXPERIMENTAL");
return _T("Athenasub v0.x - EXPERIMENTAL");
}
String Gorgonsub::GetLibraryURL()
String Athenasub::GetLibraryURL()
{
return _T("http://www.aegisub.net");
}
@ -60,22 +60,22 @@ String Gorgonsub::GetLibraryURL()
static String* hostName = NULL;
static String* hostURL = NULL;
void Gorgonsub::SetHostApplicationName(const String name)
void Athenasub::SetHostApplicationName(const String name)
{
if (!hostName) hostName = new String();
*hostName = name;
}
void Gorgonsub::SetHostApplicationURL(const String url)
void Athenasub::SetHostApplicationURL(const String url)
{
if (!hostURL) hostURL = new String();
*hostURL = url;
}
String Gorgonsub::GetHostApplicationName()
String Athenasub::GetHostApplicationName()
{
if (hostName) return *hostName;
return L"unknown application";
}
String Gorgonsub::GetHostApplicationURL()
String Athenasub::GetHostApplicationURL()
{
if (hostURL) return *hostURL;
return L"";

View file

@ -27,14 +27,14 @@
//
// -----------------------------------------------------------------------------
//
// AEGISUB/GORGONSUB
// AEGISUB/ATHENASUB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#include "Gorgonsub.h"
using namespace Gorgonsub;
#include "Athenasub.h"
using namespace Athenasub;
void View::Register(Model &model)
{

View file

@ -33,7 +33,7 @@
// Contact: mailto:amz@aegisub.net
//
#include <aegilib/gorgonsub.h>
#include <aegilib/athenasub.h>
#include <wx/wfstream.h>
#include <iostream>
#include <wx/stopwatch.h>
@ -43,14 +43,14 @@
int main()
{
using namespace std;
using namespace Gorgonsub;
using namespace Athenasub;
cout << "Gorgonsub test program by amz.\n\n";
cout << "Athenasub test program by amz.\n\n";
try {
// Set up the lib
FormatManager::InitializeFormats();
Gorgonsub::SetHostApplicationName(L"Aegilib test program");
Athenasub::SetHostApplicationName(L"Aegilib test program");
// Subtitles model
Model subs;

View file

@ -72,15 +72,15 @@ private:
void SetEncodingConfiguration();
public:
TextFileReader(Gorgonsub::String filename,Gorgonsub::String encoding=_T(""),bool trim=true);
TextFileReader(Athenasub::String filename,Athenasub::String encoding=_T(""),bool trim=true);
~TextFileReader();
Gorgonsub::String ReadLineFromFile();
Athenasub::String ReadLineFromFile();
bool HasMoreLines();
static void EnsureValid(const Gorgonsub::String encoding);
Gorgonsub::String GetCurrentEncoding();
static Gorgonsub::String GetEncoding(const Gorgonsub::String filename);
static void EnsureValid(const Athenasub::String encoding);
Athenasub::String GetCurrentEncoding();
static Athenasub::String GetEncoding(const Athenasub::String filename);
};

View file

@ -65,10 +65,10 @@ private:
void SetEncoding();
public:
TextFileWriter(Gorgonsub::String filename,Gorgonsub::String encoding=_T(""));
TextFileWriter(Athenasub::String filename,Athenasub::String encoding=_T(""));
~TextFileWriter();
void WriteLineToFile(Gorgonsub::String line,bool addLineBreak=true);
void WriteLineToFile(Athenasub::String line,bool addLineBreak=true);
};

View file

@ -1,4 +1,4 @@
Todo for Gorgonsub:
Todo for Athenasub:
-------------------
x = done
@ -6,7 +6,8 @@ x = done
. = partially done
= not done
* = not necessary
* = features not present in current Aegisub, therefore have low priority
(which doesn't mean that they won't be implemented before the others... >_>)
-------------------
@ -14,7 +15,7 @@ x = done
[x] Text file reader/writer
[ ] Automatic character set detection
[ ] Conversion between subtitle formats
[ ] Format comformity checks
[x] Format comformity checks
[ ] Override tag support
[:] ASS format support
[ ] ASS override tags
@ -23,6 +24,7 @@ x = done
[ ] DVD subtitles support (*)
[ ] Blu-Ray subtitles support (*)
[ ] OCR support (through Tesseract) (*)
[ ] Logging system
[:] Time helper class
[:] Colour helper class