Renamed Aegilib to Gorgonsub.

Originally committed to SVN as r2047.
This commit is contained in:
Rodrigo Braz Monteiro 2008-03-13 21:28:22 +00:00
parent 72145e8fa8
commit bb425f8a86
47 changed files with 196 additions and 214 deletions

View file

@ -160,18 +160,6 @@
RelativePath=".\include\aegilib\action.h" RelativePath=".\include\aegilib\action.h"
> >
</File> </File>
<File
RelativePath=".\include\aegilib\aegilib.h"
>
</File>
<File
RelativePath=".\include\aegilib\aegistring.h"
>
</File>
<File
RelativePath=".\include\aegilib\aegitime.h"
>
</File>
<File <File
RelativePath=".\include\aegilib\colour.h" RelativePath=".\include\aegilib\colour.h"
> >
@ -196,6 +184,18 @@
RelativePath=".\include\aegilib\format_manager.h" RelativePath=".\include\aegilib\format_manager.h"
> >
</File> </File>
<File
RelativePath=".\include\aegilib\gorgonstring.h"
>
</File>
<File
RelativePath=".\include\aegilib\gorgonsub.h"
>
</File>
<File
RelativePath=".\include\aegilib\gorgontime.h"
>
</File>
<File <File
RelativePath=".\include\aegilib\manipulator.h" RelativePath=".\include\aegilib\manipulator.h"
> >

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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
namespace Aegilib { namespace Gorgonsub {
// The different types of actions available // The different types of actions available
enum ActionType { enum ActionType {
ACTION_INSERT, ACTION_INSERT,

View file

@ -27,16 +27,16 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "aegistring.h" #include "gorgonstring.h"
namespace Aegilib { namespace Gorgonsub {
// Colour class // Colour class
class Colour { class Colour {

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "aegistring.h" #include "gorgonstring.h"
#include <exception> #include <exception>
namespace Aegilib { namespace Gorgonsub {
// Exception class // Exception class
class Exception : public std::exception { class Exception : public std::exception {

View file

@ -1,59 +0,0 @@
// Copyright (c) 2008, Rodrigo Braz Monteiro
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Aegisub Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// -----------------------------------------------------------------------------
//
// AEGISUB/AEGILIB
//
// Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net
//
#pragma once
#include "aegistring.h"
namespace Aegilib {
// File reader interface
class FileReader {
public:
virtual ~FileReader() {}
virtual String ReadLineFromFile() = 0;
virtual bool HasMoreLines() = 0;
virtual String GetCurrentEncoding() = 0;
};
// File writer interface
class FileWriter {
public:
virtual ~FileWriter() {}
virtual void WriteLineToFile(String line,bool addLineBreak=true) = 0;
};
};

View file

@ -27,17 +27,17 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "aegistring.h" #include "gorgonstring.h"
#include "tr1.h" #include "tr1.h"
namespace Aegilib { namespace Gorgonsub {
// Prototypes // Prototypes
class FormatHandler; class FormatHandler;
class Model; class Model;

View file

@ -27,17 +27,17 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "aegistring.h" #include "gorgonstring.h"
#include "tr1.h" #include "tr1.h"
namespace Aegilib { namespace Gorgonsub {
// Format handler interface // Format handler interface
class FormatHandler { class FormatHandler {

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 Aegilib { namespace Gorgonsub {
// Format manager class // Format manager class
class FormatManager { class FormatManager {

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 Aegilib { namespace Gorgonsub {
// 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,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "view.h" #include "view.h"
#include "controller.h" #include "controller.h"
#include "notification.h" #include "notification.h"
#include "aegistring.h" #include "gorgonstring.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 +48,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 "aegitime.h" #include "gorgontime.h"
#include "colour.h" #include "colour.h"
#include "utils.h" #include "utils.h"
#include "version.h" #include "version.h"

View file

@ -27,16 +27,16 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "aegistring.h" #include "gorgonstring.h"
namespace Aegilib { namespace Gorgonsub {
// Time class // Time class
class Time { class Time {

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// Website: http://www.aegisub.net // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
@ -36,9 +36,9 @@
#pragma once #pragma once
#include <list> #include <list>
#include "action.h" #include "action.h"
#include "aegistring.h" #include "gorgonstring.h"
namespace Aegilib { namespace Gorgonsub {
// Manipulator class // Manipulator class
class Manipulator { class Manipulator {

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "manipulator.h" #include "manipulator.h"
#include "section.h" #include "section.h"
namespace Aegilib { namespace Gorgonsub {
// Prototypes // Prototypes
class View; class View;
@ -71,6 +71,7 @@ namespace Aegilib {
const Format& GetFormat() const; const Format& GetFormat() const;
void AddListener(ViewPtr listener); void AddListener(ViewPtr listener);
void Clear();
void Load(wxInputStream &input,const FormatPtr format=FormatPtr(),const String encoding=L""); void Load(wxInputStream &input,const FormatPtr format=FormatPtr(),const String encoding=L"");
void Save(wxOutputStream &output,const FormatPtr format=FormatPtr(),const String encoding=L"UTF-8"); void Save(wxOutputStream &output,const FormatPtr format=FormatPtr(),const String encoding=L"UTF-8");
void LoadFile(const String filename,const String encoding=L""); void LoadFile(const String filename,const String encoding=L"");

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 Aegilib { namespace Gorgonsub {
// Notification class // Notification class
class Notification { class Notification {

View file

@ -27,20 +27,20 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "aegistring.h" #include "gorgonstring.h"
#include "section_entry.h" #include "section_entry.h"
#include "tr1.h" #include "tr1.h"
#include <list> #include <list>
#include <map> #include <map>
namespace Aegilib { namespace Gorgonsub {
// Section class // Section class
class Section { class Section {

View file

@ -27,17 +27,17 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "aegistring.h" #include "gorgonstring.h"
#include "tr1.h" #include "tr1.h"
namespace Aegilib { namespace Gorgonsub {
// Types // Types
enum SectionEntryType { enum SectionEntryType {
@ -84,4 +84,13 @@ namespace Aegilib {
static const SectionEntryRawPtr GetAsRaw(const SectionEntryPtr &ptr); static const SectionEntryRawPtr GetAsRaw(const SectionEntryPtr &ptr);
}; };
// Section plain-text entry
class SectionEntryPlain : public SectionEntry {
public:
SectionEntryType GetType() const { return SECTION_ENTRY_PLAIN; }
virtual ~SectionEntryPlain() {}
virtual String GetText() const =0;
virtual void SetText(const String &_data) =0;
};
}; };

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "exception.h" #include "exception.h"
#include "aegitime.h" #include "gorgontime.h"
#include "section_entry.h" #include "section_entry.h"
namespace Aegilib { namespace Gorgonsub {
// Dialogue class // Dialogue class
class SectionEntryDialogue : public SectionEntry { class SectionEntryDialogue : public SectionEntry {

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "section_entry.h" #include "section_entry.h"
namespace Aegilib { namespace Gorgonsub {
// Style class // Style class
class SectionEntryStyle : public SectionEntry { class SectionEntryStyle : public SectionEntry {

View file

@ -27,20 +27,20 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "aegistring.h" #include "gorgonstring.h"
#include "tr1.h" #include "tr1.h"
// Prototypes // Prototypes
class wxStringTokenizer; class wxStringTokenizer;
namespace Aegilib { namespace Gorgonsub {
// Tokenizer class // Tokenizer class
class Tokenizer { class Tokenizer {

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 Aegilib { namespace Gorgonsub {
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/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "aegilib.h" #include "Gorgonsub.h"
///////////// /////////////
@ -67,7 +67,7 @@ T Mid(T a,T b,T c)
//////////////////// ////////////////////
// Helper functions // Helper functions
namespace Aegilib { namespace Gorgonsub {
// 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/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "aegistring.h" #include "gorgonstring.h"
//////////////////// ////////////////////
// Helper functions // Helper functions
namespace Aegilib { namespace Gorgonsub {
// Version // Version
String GetLibraryName(); String GetLibraryName();

View file

@ -27,17 +27,17 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "aegistring.h" #include "gorgonstring.h"
#include <list> #include <list>
namespace Aegilib { namespace Gorgonsub {
// Prototypes // Prototypes
class Model; class Model;
class Notification; class Notification;

View file

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

View file

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

View file

@ -27,14 +27,14 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 Aegilib; using namespace Gorgonsub;
/////////////// ///////////////

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 Aegilib; using namespace Gorgonsub;
//////// ////////

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "../text_file_writer.h" #include "../text_file_writer.h"
#include <iostream> #include <iostream>
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
using namespace Aegilib; using namespace Gorgonsub;
/////// ///////
@ -118,6 +118,7 @@ void FormatHandlerASS::Load(wxInputStream &file,const String encoding)
while (reader.HasMoreLines()) { while (reader.HasMoreLines()) {
// Read a line // Read a line
wxString cur = reader.ReadLineFromFile(); wxString cur = reader.ReadLineFromFile();
if (cur.IsEmpty()) continue;
// Process group // Process group
prevGroup = curGroup; prevGroup = curGroup;
@ -188,7 +189,7 @@ SectionEntryPtr FormatHandlerASS::MakeEntry(const String &data,SectionPtr sectio
// Attachments // Attachments
if (group == _T("Fonts") || group == _T("Graphics")) { if (group == _T("Fonts") || group == _T("Graphics")) {
// TODO final = shared_ptr<PlainASS>(new PlainASS(data));
} }
// Events // Events
@ -206,7 +207,7 @@ SectionEntryPtr FormatHandlerASS::MakeEntry(const String &data,SectionPtr sectio
// Garbage/hard comments // Garbage/hard comments
else { else {
// TODO final = shared_ptr<PlainASS>(new PlainASS(data));
} }
} }
@ -237,6 +238,11 @@ SectionEntryPtr FormatHandlerASS::MakeEntry(const String &data,SectionPtr sectio
return SectionEntryPtr(); return SectionEntryPtr();
} }
// Unknown group, just leave it intact
else {
final = shared_ptr<PlainASS>(new PlainASS(data));
}
// Return entry // Return entry
return final; return final;
} }

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "section_entry_style.h" #include "section_entry_style.h"
#include "tr1.h" #include "tr1.h"
namespace Aegilib { namespace Gorgonsub {
// Prototypes // Prototypes
class Model; class Model;
@ -205,4 +205,18 @@ namespace Aegilib {
int GetMargin(int n) const { return margin.at(n); } int GetMargin(int n) const { return margin.at(n); }
}; };
// Raw line
class PlainASS : public SectionEntryPlain, public SerializeText {
private:
String data;
String ToText(int param) const { (void)param; return data; }
public:
PlainASS();
PlainASS(String _data) : data(_data) {}
String GetText() const { return data; }
void SetText(const String &_data) { data = _data; }
};
}; };

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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.h" #include "format_ass.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "utils.h" #include "utils.h"
using namespace Aegilib; using namespace Gorgonsub;
//////////////// ////////////////

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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.h" #include "format_ass.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "utils.h" #include "utils.h"
using namespace Aegilib; using namespace Gorgonsub;
//////////////// ////////////////

View file

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

View file

@ -27,14 +27,14 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// Website: http://www.aegisub.net // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
// //
#include "aegilib.h" #include "Gorgonsub.h"
using namespace Aegilib; using namespace Gorgonsub;
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
@ -89,7 +89,7 @@ Manipulator Model::CreateAntiManipulator(const Manipulator &src)
void Model::Load(wxInputStream &input,const FormatPtr format,const String encoding) void Model::Load(wxInputStream &input,const FormatPtr format,const String encoding)
{ {
// Autodetect format // Autodetect format
if (format == NULL) { if (!format) {
// TODO // TODO
// No format found // No format found
@ -100,6 +100,9 @@ void Model::Load(wxInputStream &input,const FormatPtr format,const String encodi
FormatHandlerPtr handler = format->GetHandler(*this); FormatHandlerPtr handler = format->GetHandler(*this);
if (!handler) throw Exception(Exception::No_Format_Handler); if (!handler) throw Exception(Exception::No_Format_Handler);
// Clear the model first
Clear();
// Load // Load
handler->Load(input,encoding); handler->Load(input,encoding);
} }
@ -110,7 +113,7 @@ void Model::Load(wxInputStream &input,const FormatPtr format,const String encodi
void Model::Save(wxOutputStream &output,const FormatPtr format,const String encoding) void Model::Save(wxOutputStream &output,const FormatPtr format,const String encoding)
{ {
// Autodetect format // Autodetect format
if (format == NULL) { if (!format) {
// TODO // TODO
// No format found // No format found
@ -182,3 +185,13 @@ size_t Model::GetSectionCount() const
{ {
return sections.size(); return sections.size();
} }
//////////
// Clear
void Model::Clear()
{
sections.clear();
undoStack.clear();
redoStack.clear();
}

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 Aegilib; using namespace Gorgonsub;
/////////////// ///////////////

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 Aegilib; using namespace Gorgonsub;
///////////////////////////////// /////////////////////////////////

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 Aegilib; using namespace Gorgonsub;
#ifdef WITH_UNIVCHARDET #ifdef WITH_UNIVCHARDET
#include "charset_detect.h" #include "charset_detect.h"
@ -49,7 +49,7 @@ using namespace Aegilib;
/////////////// ///////////////
// Constructor // Constructor
TextFileReader::TextFileReader(wxInputStream &stream,Aegilib::String enc,bool _trim) TextFileReader::TextFileReader(wxInputStream &stream,Gorgonsub::String enc,bool _trim)
: file(stream) : file(stream)
{ {
// Setup // Setup
@ -99,7 +99,7 @@ void TextFileReader::SetEncodingConfiguration() {
////////////////////////// //////////////////////////
// Reads a line from file // Reads a line from file
Aegilib::String TextFileReader::ReadLineFromFile() { Gorgonsub::String TextFileReader::ReadLineFromFile() {
wxString wxbuffer; wxString wxbuffer;
size_t bufAlloc = 1024; size_t bufAlloc = 1024;
wxbuffer.Alloc(bufAlloc); wxbuffer.Alloc(bufAlloc);
@ -169,7 +169,7 @@ Aegilib::String TextFileReader::ReadLineFromFile() {
wxbuffer.Trim(true); wxbuffer.Trim(true);
wxbuffer.Trim(false); wxbuffer.Trim(false);
} }
return Aegilib::String(wxbuffer.c_str()); return Gorgonsub::String(wxbuffer.c_str());
} }
@ -182,7 +182,7 @@ bool TextFileReader::HasMoreLines() {
//////////////////////////////// ////////////////////////////////
// Ensure that charset is valid // Ensure that charset is valid
void TextFileReader::EnsureValid(Aegilib::String enc) { void TextFileReader::EnsureValid(Gorgonsub::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 ");
error += enc; error += enc;
@ -194,6 +194,6 @@ void TextFileReader::EnsureValid(Aegilib::String enc) {
/////////////////////////// ///////////////////////////
// Get encoding being used // Get encoding being used
Aegilib::String TextFileReader::GetCurrentEncoding() { Gorgonsub::String TextFileReader::GetCurrentEncoding() {
return encoding.c_str(); return encoding.c_str();
} }

View file

@ -38,11 +38,11 @@
// Headers // Headers
#include "aegilib.h" #include "Gorgonsub.h"
#include <wx/stream.h> #include <wx/stream.h>
namespace Aegilib { namespace Gorgonsub {
class TextFileReader { class TextFileReader {
private: private:
wxString encoding; wxString encoding;

View file

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

View file

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

View file

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

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "tokenizer.h" #include "tokenizer.h"
#include "exception.h" #include "exception.h"
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
using namespace Aegilib; using namespace Gorgonsub;
/////////////// ///////////////
// Constructor // Constructor

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 Aegilib; using namespace Gorgonsub;
////////////////////////////////// //////////////////////////////////
// Convert a string to an integer // Convert a string to an integer
int Aegilib::StringToInt(const String &str) int Gorgonsub::StringToInt(const String &str)
{ {
if (!str.IsNumber()) return 0; if (!str.IsNumber()) return 0;
long temp; long temp;
@ -51,7 +51,7 @@ int Aegilib::StringToInt(const String &str)
//////////////// ////////////////
// Pretty float // Pretty float
String Aegilib::PrettyFloat(String src) { String Gorgonsub::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")) {
@ -66,19 +66,19 @@ String Aegilib::PrettyFloat(String src) {
return src; return src;
} }
String Aegilib::PrettyFloatF(float src) { return Aegilib::PrettyFloat(wxString::Format(_T("%f"),src)); } String Gorgonsub::PrettyFloatF(float src) { return Gorgonsub::PrettyFloat(wxString::Format(_T("%f"),src)); }
String Aegilib::PrettyFloatD(double src) { return Aegilib::PrettyFloat(wxString::Format(_T("%f"),src)); } String Gorgonsub::PrettyFloatD(double src) { return Gorgonsub::PrettyFloat(wxString::Format(_T("%f"),src)); }
/////////////////// ///////////////////
// Float to string // Float to string
String Aegilib::FloatToString(double value) { String Gorgonsub::FloatToString(double value) {
return PrettyFloat(wxString::Format(_T("%f"),value)); return PrettyFloat(wxString::Format(_T("%f"),value));
} }
///////////////// /////////////////
// Int to string // Int to string
String Aegilib::IntegerToString(int value) { String Gorgonsub::IntegerToString(int value) {
return wxString::Format(_T("%i"),value); return wxString::Format(_T("%i"),value);
} }

View file

@ -27,7 +27,7 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// 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 "aegistring.h" #include "gorgonstring.h"
using namespace Aegilib; using namespace Gorgonsub;
//////////////// ////////////////
// Library data // Library data
String Aegilib::GetLibraryName() String Gorgonsub::GetLibraryName()
{ {
return _T("Aegilib"); return _T("Gorgonsub");
} }
String Aegilib::GetLibraryVersionString() String Gorgonsub::GetLibraryVersionString()
{ {
return _T("Aegilib v0.x - EXPERIMENTAL"); return _T("Gorgonsub v0.x - EXPERIMENTAL");
} }
String Aegilib::GetLibraryURL() String Gorgonsub::GetLibraryURL()
{ {
return _T("http://www.aegisub.net"); return _T("http://www.aegisub.net");
} }
@ -60,22 +60,22 @@ String Aegilib::GetLibraryURL()
static String* hostName = NULL; static String* hostName = NULL;
static String* hostURL = NULL; static String* hostURL = NULL;
void Aegilib::SetHostApplicationName(const String name) void Gorgonsub::SetHostApplicationName(const String name)
{ {
if (!hostName) hostName = new String(); if (!hostName) hostName = new String();
*hostName = name; *hostName = name;
} }
void Aegilib::SetHostApplicationURL(const String url) void Gorgonsub::SetHostApplicationURL(const String url)
{ {
if (!hostURL) hostURL = new String(); if (!hostURL) hostURL = new String();
*hostURL = url; *hostURL = url;
} }
String Aegilib::GetHostApplicationName() String Gorgonsub::GetHostApplicationName()
{ {
if (hostName) return *hostName; if (hostName) return *hostName;
return L"unknown application"; return L"unknown application";
} }
String Aegilib::GetHostApplicationURL() String Gorgonsub::GetHostApplicationURL()
{ {
if (hostURL) return *hostURL; if (hostURL) return *hostURL;
return L""; return L"";

View file

@ -27,14 +27,14 @@
// //
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// //
// AEGISUB/AEGILIB // AEGISUB/GORGONSUB
// //
// Website: http://www.aegisub.net // Website: http://www.aegisub.net
// Contact: mailto:amz@aegisub.net // Contact: mailto:amz@aegisub.net
// //
#include "aegilib.h" #include "Gorgonsub.h"
using namespace Aegilib; using namespace Gorgonsub;
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/aegilib.h> #include <aegilib/gorgonsub.h>
#include <wx/wfstream.h> #include <wx/wfstream.h>
#include <iostream> #include <iostream>
#include "text_file_reader.h" #include "text_file_reader.h"
@ -41,14 +41,14 @@
int main () { int main () {
using namespace std; using namespace std;
using namespace Aegilib; using namespace Gorgonsub;
cout << "Aegilib test program by amz.\n\n"; cout << "Gorgonsub test program by amz.\n\n";
try { try {
// Set up the lib // Set up the lib
FormatManager::InitializeFormats(); FormatManager::InitializeFormats();
Aegilib::SetHostApplicationName(L"Aegilib test program"); Gorgonsub::SetHostApplicationName(L"Aegilib test program");
// Subtitles model // Subtitles model
Model subs; Model subs;

View file

@ -39,7 +39,6 @@
/////////// ///////////
// Headers // Headers
#include <aegilib/file.h>
#include <wx/wxprec.h> #include <wx/wxprec.h>
#include <wx/dynarray.h> #include <wx/dynarray.h>
#include <wx/string.h> #include <wx/string.h>
@ -52,7 +51,7 @@
///////// /////////
// Class // Class
class TextFileReader : public Aegilib::FileReader { class TextFileReader {
private: private:
wxString filename; wxString filename;
wxString encoding; wxString encoding;
@ -73,15 +72,15 @@ private:
void SetEncodingConfiguration(); void SetEncodingConfiguration();
public: public:
TextFileReader(Aegilib::String filename,Aegilib::String encoding=_T(""),bool trim=true); TextFileReader(Gorgonsub::String filename,Gorgonsub::String encoding=_T(""),bool trim=true);
~TextFileReader(); ~TextFileReader();
Aegilib::String ReadLineFromFile(); Gorgonsub::String ReadLineFromFile();
bool HasMoreLines(); bool HasMoreLines();
static void EnsureValid(const Aegilib::String encoding); static void EnsureValid(const Gorgonsub::String encoding);
Aegilib::String GetCurrentEncoding(); Gorgonsub::String GetCurrentEncoding();
static Aegilib::String GetEncoding(const Aegilib::String filename); static Gorgonsub::String GetEncoding(const Gorgonsub::String filename);
}; };

View file

@ -40,7 +40,6 @@
/////////// ///////////
// Headers // Headers
#include <aegilib/file.h>
#include <wx/wxprec.h> #include <wx/wxprec.h>
#include <wx/string.h> #include <wx/string.h>
#include <fstream> #include <fstream>
@ -48,7 +47,7 @@
///////// /////////
// Class // Class
class TextFileWriter : public Aegilib::FileWriter { class TextFileWriter {
private: private:
wxString filename; wxString filename;
wxString encoding; wxString encoding;
@ -66,10 +65,10 @@ private:
void SetEncoding(); void SetEncoding();
public: public:
TextFileWriter(Aegilib::String filename,Aegilib::String encoding=_T("")); TextFileWriter(Gorgonsub::String filename,Gorgonsub::String encoding=_T(""));
~TextFileWriter(); ~TextFileWriter();
void WriteLineToFile(Aegilib::String line,bool addLineBreak=true); void WriteLineToFile(Gorgonsub::String line,bool addLineBreak=true);
}; };