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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/GORGONSUB // AEGISUB/ATHENASUB
// //
// Website: http://www.aegisub.net // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
@ -36,17 +36,17 @@
#pragma once #pragma once
#include "exception.h" #include "exception.h"
#include "gorgontime.h" #include "athenatime.h"
#include "section_entry.h" #include "section_entry.h"
namespace Gorgonsub { namespace Athenasub {
// Dialogue class // Dialogue class
class Dialogue : public Entry { class Dialogue : public Entry {
private: private:
static const bool dodgeWarning = true; 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: public:
// Destructor // Destructor

View File

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/GORGONSUB // AEGISUB/ATHENASUB
// //
// Website: http://www.aegisub.net // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
@ -40,13 +40,13 @@
#include "section_entry.h" #include "section_entry.h"
namespace Gorgonsub { namespace Athenasub {
// Style class // Style class
class Style : public Entry { class Style : public Entry {
private: private:
static const bool dodgeWarning = true; 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: public:
// Destructor // Destructor

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,14 +27,14 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/GORGONSUB // AEGISUB/ATHENASUB
// //
// Website: http://www.aegisub.net // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
// //
#include "exception.h" #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 Invalid_Token: return "Invalid type for this token.";
case Out_Of_Range: return "Out of range."; case Out_Of_Range: return "Out of range.";
case Invalid_Section: return "Invalid section."; case Invalid_Section: return "Invalid section.";
case Internal_Error: return "Internal error.";
case TODO: return "TODO"; case TODO: return "TODO";
} }
return "Invalid code."; return "Invalid code.";

View File

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/GORGONSUB // AEGISUB/ATHENASUB
// //
// Website: http://www.aegisub.net // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
@ -36,7 +36,7 @@
#include "format_manager.h" #include "format_manager.h"
#include "formats/format_ass.h" #include "formats/format_ass.h"
#include <wx/string.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 // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
@ -42,7 +42,7 @@
#include "../text_file_writer.h" #include "../text_file_writer.h"
#include <iostream> #include <iostream>
#include <wx/tokenzr.h> #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); EntryPtr entry = MakeEntry(cur,section,version);
if (entry) section->AddEntry(entry); 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; if (versionString == _T("v4.00")) trueVersion = 0;
else if (versionString == _T("v4.00+")) trueVersion = 1; else if (versionString == _T("v4.00+")) trueVersion = 1;
else if (versionString == _T("v4.00++")) trueVersion = 2; 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) { if (trueVersion != version) {
// TODO: issue warning? // TODO: issue warning?
version = trueVersion; version = trueVersion;
@ -361,3 +364,37 @@ void FormatHandlerASS::WriteSection(TextFileWriter &writer,SectionPtr section)
writer.WriteLineToFile(serial->ToText(formatVersion)); 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 // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
@ -43,7 +43,7 @@
#include "section_entry_style.h" #include "section_entry_style.h"
#include "tr1.h" #include "tr1.h"
namespace Gorgonsub { namespace Athenasub {
// Prototypes // Prototypes
class Model; class Model;
@ -57,6 +57,7 @@ namespace Gorgonsub {
EntryPtr MakeEntry(const String &data,SectionPtr section,int version); EntryPtr MakeEntry(const String &data,SectionPtr section,int version);
void ProcessGroup(String cur,String &curGroup,int &version); void ProcessGroup(String cur,String &curGroup,int &version);
void WriteSection(TextFileWriter &writer,SectionPtr section); void WriteSection(TextFileWriter &writer,SectionPtr section);
void MakeValid();
public: public:
FormatHandlerASS(Model &model,int version); FormatHandlerASS(Model &model,int version);

View File

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/GORGONSUB // AEGISUB/ATHENASUB
// //
// Website: http://www.aegisub.net // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
@ -36,7 +36,7 @@
#include "format_ass_dialogue.h" #include "format_ass_dialogue.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "utils.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 (version > 2) version = 0;
} }
if (!valid) { 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 // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
// //
#pragma once #pragma once
#include "gorgonstring.h" #include "athenastring.h"
#include "section_entry_dialogue.h" #include "section_entry_dialogue.h"
#include "format_ass_dialogue_delta.h" #include "format_ass_dialogue_delta.h"
#include "serialize.h" #include "serialize.h"
namespace Gorgonsub { namespace Athenasub {
// Dialogue // Dialogue
class DialogueASS : public Dialogue, public SerializeText { class DialogueASS : public Dialogue, public SerializeText {

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/GORGONSUB // AEGISUB/ATHENASUB
// //
// Website: http://www.aegisub.net // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
@ -36,7 +36,7 @@
#include "format_ass_style.h" #include "format_ass_style.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "utils.h" #include "utils.h"
using namespace Gorgonsub; using namespace Athenasub;
//////////////// ////////////////
@ -55,7 +55,7 @@ StyleASS::StyleASS(String data,int version)
version++; version++;
if (version > 2) version = 0; 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 // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
@ -38,7 +38,7 @@
#include "serialize.h" #include "serialize.h"
#include "tr1.h" #include "tr1.h"
namespace Gorgonsub { namespace Athenasub {
// Style // Style
class StyleASS : public Style, public SerializeText { class StyleASS : public Style, public SerializeText {

View File

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

View File

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

View File

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/GORGONSUB // AEGISUB/ATHENASUB
// //
// Website: http://www.aegisub.net // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
@ -37,7 +37,7 @@
#include "section_entry.h" #include "section_entry.h"
#include "section_entry_dialogue.h" #include "section_entry_dialogue.h"
#include "section_entry_style.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 // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
// //
#include "gorgonsub.h" #include "athenasub.h"
using namespace Gorgonsub; using namespace Athenasub;
/////////////// ///////////////
@ -60,7 +60,7 @@ void Selection::RemoveRange(const Range &range)
{ {
// TODO // TODO
(void) range; (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 size_t Range::GetLine(size_t n) const
{ {
if (start+n < end) return start+n; 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 <string>
#include <wx/wfstream.h> #include <wx/wfstream.h>
#include "text_file_reader.h" #include "text_file_reader.h"
using namespace Gorgonsub; using namespace Athenasub;
#ifdef WITH_UNIVCHARDET #ifdef WITH_UNIVCHARDET
#include "charset_detect.h" #include "charset_detect.h"
@ -49,7 +49,7 @@ using namespace Gorgonsub;
/////////////// ///////////////
// Constructor // 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) : file(stream)
{ {
// Setup // Setup
@ -177,7 +177,7 @@ void ParseLine(FastBuffer<T> &_buffer,wxInputStream &file,wxString &stringBuffer
////////////////////////// //////////////////////////
// Reads a line from file // Reads a line from file
Gorgonsub::String TextFileReader::ActuallyReadLine() Athenasub::String TextFileReader::ActuallyReadLine()
{ {
wxString stringBuffer; wxString stringBuffer;
size_t bufAlloc = 1024; size_t bufAlloc = 1024;
@ -213,7 +213,7 @@ bool TextFileReader::HasMoreLines()
//////////////////////////////// ////////////////////////////////
// Ensure that charset is valid // 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")) { if (enc == _T("unknown") || enc == _T("UTF-32BE") || enc == _T("UTF-32LE")) {
wxString error = _T("Character set "); wxString error = _T("Character set ");

View File

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

View File

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

View File

@ -35,11 +35,11 @@
#pragma once #pragma once
#include "Gorgonsub.h" #include "Athenasub.h"
#include <wx/stream.h> #include <wx/stream.h>
namespace Gorgonsub { namespace Athenasub {
class TextFileWriter { class TextFileWriter {
private: private:
wxString encoding; wxString encoding;
@ -58,6 +58,6 @@ namespace Gorgonsub {
TextFileWriter(wxOutputStream &stream,String encoding=_T("")); TextFileWriter(wxOutputStream &stream,String encoding=_T(""));
~TextFileWriter(); ~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 // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
// //
#include "Gorgonsub.h" #include "Athenasub.h"
using namespace Gorgonsub; using namespace Athenasub;
////////////////////// //////////////////////

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -65,10 +65,10 @@ private:
void SetEncoding(); void SetEncoding();
public: public:
TextFileWriter(Gorgonsub::String filename,Gorgonsub::String encoding=_T("")); TextFileWriter(Athenasub::String filename,Athenasub::String encoding=_T(""));
~TextFileWriter(); ~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 x = done
@ -6,7 +6,8 @@ x = done
. = partially done . = partially done
= not 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 [x] Text file reader/writer
[ ] Automatic character set detection [ ] Automatic character set detection
[ ] Conversion between subtitle formats [ ] Conversion between subtitle formats
[ ] Format comformity checks [x] Format comformity checks
[ ] Override tag support [ ] Override tag support
[:] ASS format support [:] ASS format support
[ ] ASS override tags [ ] ASS override tags
@ -23,6 +24,7 @@ x = done
[ ] DVD subtitles support (*) [ ] DVD subtitles support (*)
[ ] Blu-Ray subtitles support (*) [ ] Blu-Ray subtitles support (*)
[ ] OCR support (through Tesseract) (*) [ ] OCR support (through Tesseract) (*)
[ ] Logging system
[:] Time helper class [:] Time helper class
[:] Colour helper class [:] Colour helper class