mirror of https://github.com/odrling/Aegisub
parent
dae123d225
commit
e255222316
|
@ -186,6 +186,10 @@
|
||||||
RelativePath=".\include\athenasub\athenawin.h"
|
RelativePath=".\include\athenasub\athenawin.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\athenasub\colour.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\athenasub\exception.h"
|
RelativePath=".\include\athenasub\exception.h"
|
||||||
>
|
>
|
||||||
|
@ -194,6 +198,10 @@
|
||||||
RelativePath=".\include\athenasub\interfaces.h"
|
RelativePath=".\include\athenasub\interfaces.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\include\athenasub\range.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\include\athenasub\tr1.h"
|
RelativePath=".\include\athenasub\tr1.h"
|
||||||
>
|
>
|
||||||
|
@ -242,10 +250,6 @@
|
||||||
RelativePath=".\src\colour.cpp"
|
RelativePath=".\src\colour.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\include\aegilib\colour.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\exception.cpp"
|
RelativePath=".\src\exception.cpp"
|
||||||
>
|
>
|
||||||
|
|
|
@ -34,19 +34,20 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "athenasub.h"
|
|
||||||
|
|
||||||
namespace Athenasub {
|
namespace Athenasub {
|
||||||
|
|
||||||
|
class String;
|
||||||
|
|
||||||
// Colour class
|
// Colour class
|
||||||
class CColour : public IColour {
|
class Colour {
|
||||||
private:
|
private:
|
||||||
unsigned char r, g, b, a;
|
unsigned char r, g, b, a;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CColour ();
|
Colour ();
|
||||||
CColour (unsigned char red,unsigned char green,unsigned char blue,unsigned char alpha=0);
|
Colour (unsigned char red,unsigned char green,unsigned char blue,unsigned char alpha=0);
|
||||||
CColour (int red,int green,int blue,int alpha=0);
|
Colour (int red,int green,int blue,int alpha=0);
|
||||||
|
|
||||||
void SetRed(unsigned char red) { r = red; }
|
void SetRed(unsigned char red) { r = red; }
|
||||||
void SetGreen(unsigned char green) { g = green; }
|
void SetGreen(unsigned char green) { g = green; }
|
|
@ -38,6 +38,7 @@
|
||||||
#include "tr1.h"
|
#include "tr1.h"
|
||||||
#include "athenatime.h"
|
#include "athenatime.h"
|
||||||
#include "athenastring.h"
|
#include "athenastring.h"
|
||||||
|
#include "colour.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
@ -52,7 +53,6 @@ namespace Athenasub {
|
||||||
class IController;
|
class IController;
|
||||||
class IView;
|
class IView;
|
||||||
class IFormatHandler;
|
class IFormatHandler;
|
||||||
class IColour;
|
|
||||||
class IEntry;
|
class IEntry;
|
||||||
class IDialogue;
|
class IDialogue;
|
||||||
class IStyle;
|
class IStyle;
|
||||||
|
@ -72,7 +72,6 @@ namespace Athenasub {
|
||||||
typedef shared_ptr<IController> Controller;
|
typedef shared_ptr<IController> Controller;
|
||||||
typedef shared_ptr<IView> View;
|
typedef shared_ptr<IView> View;
|
||||||
typedef shared_ptr<IFormatHandler> FormatHandler;
|
typedef shared_ptr<IFormatHandler> FormatHandler;
|
||||||
typedef shared_ptr<IColour> Colour;
|
|
||||||
typedef shared_ptr<IEntry> Entry;
|
typedef shared_ptr<IEntry> Entry;
|
||||||
typedef shared_ptr<IDialogue> Dialogue;
|
typedef shared_ptr<IDialogue> Dialogue;
|
||||||
typedef shared_ptr<IStyle> Style;
|
typedef shared_ptr<IStyle> Style;
|
||||||
|
@ -145,6 +144,8 @@ namespace Athenasub {
|
||||||
class IView {
|
class IView {
|
||||||
public:
|
public:
|
||||||
virtual ~IView() {}
|
virtual ~IView() {}
|
||||||
|
|
||||||
|
virtual void OnNotify(Notification notification) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -201,26 +202,6 @@ namespace Athenasub {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Color
|
|
||||||
class IColour {
|
|
||||||
public:
|
|
||||||
virtual ~IColour() {}
|
|
||||||
|
|
||||||
virtual void SetRed(int red) = 0;
|
|
||||||
virtual void SetGreen(int green) = 0;
|
|
||||||
virtual void SetBlue(int blue) = 0;
|
|
||||||
virtual void SetAlpha(int alpha) = 0;
|
|
||||||
|
|
||||||
virtual int GetRed() const = 0;
|
|
||||||
virtual int GetGreen() const = 0;
|
|
||||||
virtual int GetBlue() const = 0;
|
|
||||||
virtual int GetAlpha() const = 0;
|
|
||||||
|
|
||||||
virtual void Parse(String str,bool reverse) = 0;
|
|
||||||
virtual String GetVBHex(bool withAlpha=false,bool withHeader=true,bool withFooter=true) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
enum SectionEntryType {
|
enum SectionEntryType {
|
||||||
SECTION_ENTRY_PLAIN,
|
SECTION_ENTRY_PLAIN,
|
||||||
|
@ -304,7 +285,7 @@ namespace Athenasub {
|
||||||
virtual String GetName() const = 0;
|
virtual String GetName() const = 0;
|
||||||
virtual String GetFontName() const = 0;
|
virtual String GetFontName() const = 0;
|
||||||
virtual float GetFontSize() const = 0;
|
virtual float GetFontSize() const = 0;
|
||||||
virtual const IColour& GetColour(int n) const = 0;
|
virtual const Colour& GetColour(int n) const = 0;
|
||||||
virtual int GetMargin(int n) const = 0;
|
virtual int GetMargin(int n) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -356,8 +337,6 @@ namespace Athenasub {
|
||||||
virtual ~IAction() {}
|
virtual ~IAction() {}
|
||||||
virtual Action GetAntiAction() const = 0;
|
virtual Action GetAntiAction() const = 0;
|
||||||
virtual void Execute() = 0;
|
virtual void Execute() = 0;
|
||||||
|
|
||||||
//virtual Section GetSection(const String &name) const = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,18 +42,18 @@ using namespace Athenasub;
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
// Constructors
|
// Constructors
|
||||||
CColour::CColour ()
|
Colour::Colour ()
|
||||||
{
|
{
|
||||||
r = g = b = a = 0;
|
r = g = b = a = 0;
|
||||||
}
|
}
|
||||||
CColour::CColour (unsigned char red,unsigned char green,unsigned char blue,unsigned char alpha)
|
Colour::Colour (unsigned char red,unsigned char green,unsigned char blue,unsigned char alpha)
|
||||||
{
|
{
|
||||||
r = red;
|
r = red;
|
||||||
g = green;
|
g = green;
|
||||||
b = blue;
|
b = blue;
|
||||||
a = alpha;
|
a = alpha;
|
||||||
}
|
}
|
||||||
CColour::CColour (int red,int green,int blue,int alpha)
|
Colour::Colour (int red,int green,int blue,int alpha)
|
||||||
{
|
{
|
||||||
SetRed(red);
|
SetRed(red);
|
||||||
SetGreen(green);
|
SetGreen(green);
|
||||||
|
@ -64,15 +64,15 @@ CColour::CColour (int red,int green,int blue,int alpha)
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Set colour component
|
// Set colour component
|
||||||
void CColour::SetRed(int red) { r = (unsigned char) Mid(0,red,255); }
|
void Colour::SetRed(int red) { r = (unsigned char) Mid(0,red,255); }
|
||||||
void CColour::SetGreen(int green) { g = (unsigned char) Mid(0,green,255); }
|
void Colour::SetGreen(int green) { g = (unsigned char) Mid(0,green,255); }
|
||||||
void CColour::SetBlue(int blue) { b = (unsigned char) Mid(0,blue,255); }
|
void Colour::SetBlue(int blue) { b = (unsigned char) Mid(0,blue,255); }
|
||||||
void CColour::SetAlpha(int alpha) { a = (unsigned char) Mid(0,alpha,255); }
|
void Colour::SetAlpha(int alpha) { a = (unsigned char) Mid(0,alpha,255); }
|
||||||
|
|
||||||
|
|
||||||
//////////////
|
//////////////
|
||||||
// Parse text
|
// Parse text
|
||||||
void CColour::Parse(String value,bool reverse)
|
void Colour::Parse(String value,bool reverse)
|
||||||
{
|
{
|
||||||
// Prepare
|
// Prepare
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
@ -112,7 +112,7 @@ void CColour::Parse(String value,bool reverse)
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Generate Visual Basic hex
|
// Generate Visual Basic hex
|
||||||
String CColour::GetVBHex(bool withAlpha,bool withHeader,bool withFooter) const
|
String Colour::GetVBHex(bool withAlpha,bool withHeader,bool withFooter) const
|
||||||
{
|
{
|
||||||
String work;
|
String work;
|
||||||
if (withHeader) work += "&H";
|
if (withHeader) work += "&H";
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Athenasub {
|
||||||
float fontSize;
|
float fontSize;
|
||||||
int formatVersion;
|
int formatVersion;
|
||||||
|
|
||||||
array<CColour,5> colour; // 0 = Primary, 1 = Secondary, 2 = Tertiary, 3 = Outline, 4 = Shadow
|
array<Colour,5> colour; // 0 = Primary, 1 = Secondary, 2 = Tertiary, 3 = Outline, 4 = Shadow
|
||||||
array<int,4> margin;
|
array<int,4> margin;
|
||||||
|
|
||||||
bool bold;
|
bool bold;
|
||||||
|
@ -90,7 +90,7 @@ namespace Athenasub {
|
||||||
String GetName() const { return name; }
|
String GetName() const { return name; }
|
||||||
String GetFontName() const { return font; }
|
String GetFontName() const { return font; }
|
||||||
float GetFontSize() const { return fontSize; }
|
float GetFontSize() const { return fontSize; }
|
||||||
const IColour& GetColour(int n) const { return colour.at(n); }
|
const Colour& GetColour(int n) const { return colour.at(n); }
|
||||||
int GetMargin(int n) const { return margin.at(n); }
|
int GetMargin(int n) const { return margin.at(n); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue