mirror of https://github.com/odrling/Aegisub
Rename ASS -> Ass in symbol names
Most types and functions used Ass, but a decent number used ASS, so make them consistent.
This commit is contained in:
parent
006f820aea
commit
c7fd04a739
|
@ -76,7 +76,7 @@ public:
|
||||||
wxString GetFileName(bool raw=false) const;
|
wxString GetFileName(bool raw=false) const;
|
||||||
|
|
||||||
const wxString GetEntryData() const;
|
const wxString GetEntryData() const;
|
||||||
ASS_EntryType GetType() const { return ENTRY_ATTACHMENT; }
|
AssEntryType GetType() const { return ENTRY_ATTACHMENT; }
|
||||||
AssEntry *Clone() const;
|
AssEntry *Clone() const;
|
||||||
|
|
||||||
AssAttachment(wxString const& name, wxString const& group);
|
AssAttachment(wxString const& name, wxString const& group);
|
||||||
|
|
|
@ -173,8 +173,8 @@ wxString AssDialogue::GetData(bool ssa) const {
|
||||||
"%s: %s,%s,%s,%s,%s,%d,%d,%d,%s,%s",
|
"%s: %s,%s,%s,%s,%s,%d,%d,%d,%s,%s",
|
||||||
Comment ? "Comment" : "Dialogue",
|
Comment ? "Comment" : "Dialogue",
|
||||||
ssa ? "Marked=0" : wxString::Format("%01d", Layer),
|
ssa ? "Marked=0" : wxString::Format("%01d", Layer),
|
||||||
Start.GetASSFormated(),
|
Start.GetAssFormated(),
|
||||||
End.GetASSFormated(),
|
End.GetAssFormated(),
|
||||||
s, a,
|
s, a,
|
||||||
Margin[0], Margin[1], Margin[2],
|
Margin[0], Margin[1], Margin[2],
|
||||||
e,
|
e,
|
||||||
|
@ -270,7 +270,7 @@ std::vector<AssDialogueBlock*> AssDialogue::ParseTags() const {
|
||||||
return Blocks;
|
return Blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssDialogue::ParseASSTags() {
|
void AssDialogue::ParseAssTags() {
|
||||||
ClearBlocks();
|
ClearBlocks();
|
||||||
Blocks = ParseTags();
|
Blocks = ParseTags();
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ void AssDialogue::StripTags () {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssDialogue::StripTag (wxString tagName) {
|
void AssDialogue::StripTag (wxString tagName) {
|
||||||
ParseASSTags();
|
ParseAssTags();
|
||||||
wxString final;
|
wxString final;
|
||||||
|
|
||||||
// Look for blocks
|
// Look for blocks
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include "ass_entry.h"
|
#include "ass_entry.h"
|
||||||
#include "ass_time.h"
|
#include "ass_time.h"
|
||||||
|
|
||||||
enum ASS_BlockType {
|
enum AssBlockType {
|
||||||
BLOCK_BASE,
|
BLOCK_BASE,
|
||||||
BLOCK_PLAIN,
|
BLOCK_PLAIN,
|
||||||
BLOCK_OVERRIDE,
|
BLOCK_OVERRIDE,
|
||||||
|
@ -79,13 +79,13 @@ public:
|
||||||
AssDialogueBlock(wxString const& text) : text(text) { }
|
AssDialogueBlock(wxString const& text) : text(text) { }
|
||||||
virtual ~AssDialogueBlock() { }
|
virtual ~AssDialogueBlock() { }
|
||||||
|
|
||||||
virtual ASS_BlockType GetType() const = 0;
|
virtual AssBlockType GetType() const = 0;
|
||||||
virtual wxString GetText() { return text; }
|
virtual wxString GetText() { return text; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class AssDialogueBlockPlain : public AssDialogueBlock {
|
class AssDialogueBlockPlain : public AssDialogueBlock {
|
||||||
public:
|
public:
|
||||||
ASS_BlockType GetType() const { return BLOCK_PLAIN; }
|
AssBlockType GetType() const { return BLOCK_PLAIN; }
|
||||||
AssDialogueBlockPlain(wxString const& text = wxString()) : AssDialogueBlock(text) { }
|
AssDialogueBlockPlain(wxString const& text = wxString()) : AssDialogueBlock(text) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ class AssDialogueBlockDrawing : public AssDialogueBlock {
|
||||||
public:
|
public:
|
||||||
int Scale;
|
int Scale;
|
||||||
|
|
||||||
ASS_BlockType GetType() const { return BLOCK_DRAWING; }
|
AssBlockType GetType() const { return BLOCK_DRAWING; }
|
||||||
AssDialogueBlockDrawing(wxString const& text, int scale) : AssDialogueBlock(text), Scale(scale) { }
|
AssDialogueBlockDrawing(wxString const& text, int scale) : AssDialogueBlock(text), Scale(scale) { }
|
||||||
void TransformCoords(int trans_x,int trans_y,double mult_x,double mult_y);
|
void TransformCoords(int trans_x,int trans_y,double mult_x,double mult_y);
|
||||||
};
|
};
|
||||||
|
@ -105,7 +105,7 @@ public:
|
||||||
|
|
||||||
std::vector<AssOverrideTag*> Tags;
|
std::vector<AssOverrideTag*> Tags;
|
||||||
|
|
||||||
ASS_BlockType GetType() const { return BLOCK_OVERRIDE; }
|
AssBlockType GetType() const { return BLOCK_OVERRIDE; }
|
||||||
wxString GetText();
|
wxString GetText();
|
||||||
void ParseTags();
|
void ParseTags();
|
||||||
void AddTag(wxString const& tag);
|
void AddTag(wxString const& tag);
|
||||||
|
@ -143,7 +143,7 @@ public:
|
||||||
/// Raw text data
|
/// Raw text data
|
||||||
wxString Text;
|
wxString Text;
|
||||||
|
|
||||||
ASS_EntryType GetType() const { return ENTRY_DIALOGUE; }
|
AssEntryType GetType() const { return ENTRY_DIALOGUE; }
|
||||||
|
|
||||||
/// @brief Parse raw ASS data into everything else
|
/// @brief Parse raw ASS data into everything else
|
||||||
/// @param data ASS line
|
/// @param data ASS line
|
||||||
|
@ -151,7 +151,7 @@ public:
|
||||||
bool Parse(wxString const& data);
|
bool Parse(wxString const& data);
|
||||||
|
|
||||||
/// Parse text as ASS to generate block information
|
/// Parse text as ASS to generate block information
|
||||||
void ParseASSTags();
|
void ParseAssTags();
|
||||||
|
|
||||||
/// Parse text as ASS and return block information
|
/// Parse text as ASS and return block information
|
||||||
std::vector<AssDialogueBlock*> ParseTags() const;
|
std::vector<AssDialogueBlock*> ParseTags() const;
|
||||||
|
|
|
@ -47,7 +47,7 @@ class AssDialogue;
|
||||||
class AssStyle;
|
class AssStyle;
|
||||||
class AssAttachment;
|
class AssAttachment;
|
||||||
|
|
||||||
enum ASS_EntryType {
|
enum AssEntryType {
|
||||||
ENTRY_BASE,
|
ENTRY_BASE,
|
||||||
ENTRY_DIALOGUE,
|
ENTRY_DIALOGUE,
|
||||||
ENTRY_STYLE,
|
ENTRY_STYLE,
|
||||||
|
@ -89,7 +89,7 @@ public:
|
||||||
virtual AssEntry *Clone() const;
|
virtual AssEntry *Clone() const;
|
||||||
|
|
||||||
/// Get this entry's fully-derived type
|
/// Get this entry's fully-derived type
|
||||||
virtual ASS_EntryType GetType() const { return ENTRY_BASE; }
|
virtual AssEntryType GetType() const { return ENTRY_BASE; }
|
||||||
|
|
||||||
/// @brief Get this line's raw entry data in ASS format
|
/// @brief Get this line's raw entry data in ASS format
|
||||||
virtual const wxString GetEntryData() const { return data; }
|
virtual const wxString GetEntryData() const { return data; }
|
||||||
|
|
|
@ -95,7 +95,7 @@ void AssFile::Load(const wxString &_filename, wxString charset, bool addToRecent
|
||||||
|
|
||||||
// Check if the file has at least one style and at least one dialogue line
|
// Check if the file has at least one style and at least one dialogue line
|
||||||
for (entryIter it = temp.Line.begin(); it != temp.Line.end(); ++it) {
|
for (entryIter it = temp.Line.begin(); it != temp.Line.end(); ++it) {
|
||||||
ASS_EntryType type = (*it)->GetType();
|
AssEntryType type = (*it)->GetType();
|
||||||
if (type == ENTRY_STYLE) found_style = true;
|
if (type == ENTRY_STYLE) found_style = true;
|
||||||
if (type == ENTRY_DIALOGUE) found_dialogue = true;
|
if (type == ENTRY_DIALOGUE) found_dialogue = true;
|
||||||
if (found_style && found_dialogue) break;
|
if (found_style && found_dialogue) break;
|
||||||
|
|
|
@ -61,7 +61,7 @@ AssKaraoke::AssKaraoke(AssDialogue *line, bool auto_split, bool normalize)
|
||||||
|
|
||||||
void AssKaraoke::SetLine(AssDialogue *line, bool auto_split, bool normalize) {
|
void AssKaraoke::SetLine(AssDialogue *line, bool auto_split, bool normalize) {
|
||||||
active_line = line;
|
active_line = line;
|
||||||
line->ParseASSTags();
|
line->ParseAssTags();
|
||||||
|
|
||||||
syls.clear();
|
syls.clear();
|
||||||
Syllable syl;
|
Syllable syl;
|
||||||
|
|
|
@ -123,17 +123,17 @@ void AssDialogueBlockOverride::ProcessParameters(AssDialogueBlockOverride::Proce
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AssOverrideParamProto::AssOverrideParamProto(VariableDataType type,int opt,ASS_ParameterClass classi)
|
AssOverrideParamProto::AssOverrideParamProto(VariableDataType type,int opt,AssParameterClass classi)
|
||||||
: optional(opt)
|
: optional(opt)
|
||||||
, type(type)
|
, type(type)
|
||||||
, classification(classi)
|
, classification(classi)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssOverrideTagProto::AddParam(VariableDataType type, ASS_ParameterClass classi, int opt) {
|
void AssOverrideTagProto::AddParam(VariableDataType type, AssParameterClass classi, int opt) {
|
||||||
params.push_back(AssOverrideParamProto(type, opt, classi));
|
params.push_back(AssOverrideParamProto(type, opt, classi));
|
||||||
}
|
}
|
||||||
void AssOverrideTagProto::Set(wxString newName, VariableDataType type, ASS_ParameterClass classi, int opt) {
|
void AssOverrideTagProto::Set(wxString newName, VariableDataType type, AssParameterClass classi, int opt) {
|
||||||
name = newName;
|
name = newName;
|
||||||
params.push_back(AssOverrideParamProto(type, opt, classi));
|
params.push_back(AssOverrideParamProto(type, opt, classi));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include "variable_data.h"
|
#include "variable_data.h"
|
||||||
|
|
||||||
/// Type of parameter; probably only used by the resample tool
|
/// Type of parameter; probably only used by the resample tool
|
||||||
enum ASS_ParameterClass {
|
enum AssParameterClass {
|
||||||
PARCLASS_NORMAL,
|
PARCLASS_NORMAL,
|
||||||
PARCLASS_ABSOLUTE_SIZE,
|
PARCLASS_ABSOLUTE_SIZE,
|
||||||
PARCLASS_ABSOLUTE_POS_X,
|
PARCLASS_ABSOLUTE_POS_X,
|
||||||
|
@ -58,7 +58,7 @@ enum ASS_ParameterClass {
|
||||||
/// indicated number. Note that only arguments not at the end need to be marked
|
/// indicated number. Note that only arguments not at the end need to be marked
|
||||||
/// as optional; this is just to know which parameters to skip when there are
|
/// as optional; this is just to know which parameters to skip when there are
|
||||||
/// earlier optional arguments
|
/// earlier optional arguments
|
||||||
enum ASS_ParameterOptional {
|
enum AssParameterOptional {
|
||||||
NOT_OPTIONAL = 0xFF,
|
NOT_OPTIONAL = 0xFF,
|
||||||
OPTIONAL_1 = 0x01,
|
OPTIONAL_1 = 0x01,
|
||||||
OPTIONAL_2 = 0x02,
|
OPTIONAL_2 = 0x02,
|
||||||
|
@ -75,7 +75,7 @@ enum ASS_ParameterOptional {
|
||||||
class AssOverrideParameter : public VariableData {
|
class AssOverrideParameter : public VariableData {
|
||||||
public:
|
public:
|
||||||
/// Type of parameter
|
/// Type of parameter
|
||||||
ASS_ParameterClass classification;
|
AssParameterClass classification;
|
||||||
|
|
||||||
/// Is the parameter's value actually given?
|
/// Is the parameter's value actually given?
|
||||||
bool omitted;
|
bool omitted;
|
||||||
|
@ -96,9 +96,9 @@ struct AssOverrideParamProto {
|
||||||
VariableDataType type;
|
VariableDataType type;
|
||||||
|
|
||||||
/// Semantic type of this parameter
|
/// Semantic type of this parameter
|
||||||
ASS_ParameterClass classification;
|
AssParameterClass classification;
|
||||||
|
|
||||||
AssOverrideParamProto (VariableDataType type, int opt=NOT_OPTIONAL, ASS_ParameterClass classi=PARCLASS_NORMAL);
|
AssOverrideParamProto (VariableDataType type, int opt=NOT_OPTIONAL, AssParameterClass classi=PARCLASS_NORMAL);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
|
@ -115,13 +115,13 @@ struct AssOverrideTagProto {
|
||||||
/// @param type Data type of the parameter
|
/// @param type Data type of the parameter
|
||||||
/// @param classi Semantic type of the parameter
|
/// @param classi Semantic type of the parameter
|
||||||
/// @param opt Situations in which this parameter is present
|
/// @param opt Situations in which this parameter is present
|
||||||
void AddParam(VariableDataType type, ASS_ParameterClass classi = PARCLASS_NORMAL, int opt = NOT_OPTIONAL);
|
void AddParam(VariableDataType type, AssParameterClass classi = PARCLASS_NORMAL, int opt = NOT_OPTIONAL);
|
||||||
/// @brief Convenience function for single-argument tags
|
/// @brief Convenience function for single-argument tags
|
||||||
/// @param name Name of the tag, with slash
|
/// @param name Name of the tag, with slash
|
||||||
/// @param type Data type of the parameter
|
/// @param type Data type of the parameter
|
||||||
/// @param classi Semantic type of the parameter
|
/// @param classi Semantic type of the parameter
|
||||||
/// @param opt Situations in which this parameter is present
|
/// @param opt Situations in which this parameter is present
|
||||||
void Set(wxString name, VariableDataType type, ASS_ParameterClass classi = PARCLASS_NORMAL, int opt = NOT_OPTIONAL);
|
void Set(wxString name, VariableDataType type, AssParameterClass classi = PARCLASS_NORMAL, int opt = NOT_OPTIONAL);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DOCME
|
/// DOCME
|
||||||
|
|
|
@ -117,7 +117,7 @@ void AssColor::SetWXColor(const wxColor &color) {
|
||||||
/// @param stripped
|
/// @param stripped
|
||||||
/// @param isStyle
|
/// @param isStyle
|
||||||
/// @return
|
/// @return
|
||||||
wxString AssColor::GetASSFormatted(bool alpha,bool stripped,bool isStyle) const {
|
wxString AssColor::GetAssFormatted(bool alpha,bool stripped,bool isStyle) const {
|
||||||
wxString work;
|
wxString work;
|
||||||
if (!stripped) work += "&H";
|
if (!stripped) work += "&H";
|
||||||
if (alpha) work += wxString::Format("%02X",a);
|
if (alpha) work += wxString::Format("%02X",a);
|
||||||
|
@ -311,10 +311,10 @@ void AssStyle::UpdateData() {
|
||||||
|
|
||||||
final = wxString::Format("Style: %s,%s,%g,%s,%s,%s,%s,%d,%d,%d,%d,%g,%g,%g,%g,%d,%g,%g,%i,%i,%i,%i,%i",
|
final = wxString::Format("Style: %s,%s,%g,%s,%s,%s,%s,%d,%d,%d,%d,%g,%g,%g,%g,%d,%g,%g,%i,%i,%i,%i,%i",
|
||||||
name, font, fontsize,
|
name, font, fontsize,
|
||||||
primary.GetASSFormatted(true,false,true),
|
primary.GetAssFormatted(true,false,true),
|
||||||
secondary.GetASSFormatted(true,false,true),
|
secondary.GetAssFormatted(true,false,true),
|
||||||
outline.GetASSFormatted(true,false,true),
|
outline.GetAssFormatted(true,false,true),
|
||||||
shadow.GetASSFormatted(true,false,true),
|
shadow.GetAssFormatted(true,false,true),
|
||||||
(bold? -1 : 0), (italic ? -1 : 0),
|
(bold? -1 : 0), (italic ? -1 : 0),
|
||||||
(underline?-1:0),(strikeout?-1:0),
|
(underline?-1:0),(strikeout?-1:0),
|
||||||
scalex,scaley,spacing,angle,
|
scalex,scaley,spacing,angle,
|
||||||
|
|
|
@ -61,7 +61,7 @@ struct AssColor {
|
||||||
wxColor GetWXColor() const; // Return as a wxColor
|
wxColor GetWXColor() const; // Return as a wxColor
|
||||||
void SetWXColor(const wxColor &color); // Sets from a wxColor
|
void SetWXColor(const wxColor &color); // Sets from a wxColor
|
||||||
void Parse(wxString const& value); // Parse SSA or ASS-style color
|
void Parse(wxString const& value); // Parse SSA or ASS-style color
|
||||||
wxString GetASSFormatted(bool alpha,bool stripped=false,bool isStyle=false) const; // Gets color formated in ASS format
|
wxString GetAssFormatted(bool alpha,bool stripped=false,bool isStyle=false) const; // Gets color formated in ASS format
|
||||||
wxString GetSSAFormatted() const;
|
wxString GetSSAFormatted() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ public:
|
||||||
AssStyle& operator=(AssStyle const&);
|
AssStyle& operator=(AssStyle const&);
|
||||||
|
|
||||||
wxString GetSSAText() const;
|
wxString GetSSAText() const;
|
||||||
ASS_EntryType GetType() const { return ENTRY_STYLE; }
|
AssEntryType GetType() const { return ENTRY_STYLE; }
|
||||||
AssEntry *Clone() const;
|
AssEntry *Clone() const;
|
||||||
|
|
||||||
/// Convert an ASS alignment to the equivalent SSA alignment
|
/// Convert an ASS alignment to the equivalent SSA alignment
|
||||||
|
|
|
@ -79,7 +79,7 @@ AssTime::AssTime(wxString const& text)
|
||||||
time = mid(0, time, 10 * 60 * 60 * 1000 - 1);
|
time = mid(0, time, 10 * 60 * 60 * 1000 - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString AssTime::GetASSFormated(bool msPrecision) const {
|
wxString AssTime::GetAssFormated(bool msPrecision) const {
|
||||||
wxChar ret[] = {
|
wxChar ret[] = {
|
||||||
'0' + GetTimeHours(),
|
'0' + GetTimeHours(),
|
||||||
':',
|
':',
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
|
|
||||||
/// Return the time as a string
|
/// Return the time as a string
|
||||||
/// @param ms Use milliseconds precision, for non-ASS formats
|
/// @param ms Use milliseconds precision, for non-ASS formats
|
||||||
wxString GetASSFormated(bool ms=false) const;
|
wxString GetAssFormated(bool ms=false) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @class SmpteFormatter
|
/// @class SmpteFormatter
|
||||||
|
|
|
@ -968,7 +968,7 @@ void AudioDisplay::SetTrackCursor(int new_pos, bool show_time)
|
||||||
if (show_time)
|
if (show_time)
|
||||||
{
|
{
|
||||||
AssTime new_label_time = TimeFromAbsoluteX(track_cursor_pos);
|
AssTime new_label_time = TimeFromAbsoluteX(track_cursor_pos);
|
||||||
track_cursor_label = new_label_time.GetASSFormated();
|
track_cursor_label = new_label_time.GetAssFormated();
|
||||||
track_cursor_label_rect.x += new_pos - old_pos;
|
track_cursor_label_rect.x += new_pos - old_pos;
|
||||||
RefreshRect(track_cursor_label_rect, false);
|
RefreshRect(track_cursor_label_rect, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,10 +241,10 @@ namespace Automation4 {
|
||||||
set_field(L, "fontname", sty->font);
|
set_field(L, "fontname", sty->font);
|
||||||
set_field(L, "fontsize", sty->fontsize);
|
set_field(L, "fontsize", sty->fontsize);
|
||||||
|
|
||||||
set_field(L, "color1", sty->primary.GetASSFormatted(true));
|
set_field(L, "color1", sty->primary.GetAssFormatted(true));
|
||||||
set_field(L, "color2", sty->secondary.GetASSFormatted(true));
|
set_field(L, "color2", sty->secondary.GetAssFormatted(true));
|
||||||
set_field(L, "color3", sty->outline.GetASSFormatted(true));
|
set_field(L, "color3", sty->outline.GetAssFormatted(true));
|
||||||
set_field(L, "color4", sty->shadow.GetASSFormatted(true));
|
set_field(L, "color4", sty->shadow.GetAssFormatted(true));
|
||||||
|
|
||||||
set_field(L, "bold", sty->bold);
|
set_field(L, "bold", sty->bold);
|
||||||
set_field(L, "italic", sty->italic);
|
set_field(L, "italic", sty->italic);
|
||||||
|
|
|
@ -597,8 +597,8 @@ void BaseGrid::GetRowStrings(int row, AssDialogue *line, bool *paint_columns, wx
|
||||||
if (paint_columns[3]) strings[3] = wxString::Format("%d", context->videoController->FrameAtTime(line->End, agi::vfr::END));
|
if (paint_columns[3]) strings[3] = wxString::Format("%d", context->videoController->FrameAtTime(line->End, agi::vfr::END));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (paint_columns[2]) strings[2] = line->Start.GetASSFormated();
|
if (paint_columns[2]) strings[2] = line->Start.GetAssFormated();
|
||||||
if (paint_columns[3]) strings[3] = line->End.GetASSFormated();
|
if (paint_columns[3]) strings[3] = line->End.GetAssFormated();
|
||||||
}
|
}
|
||||||
if (paint_columns[4]) strings[4] = line->Style;
|
if (paint_columns[4]) strings[4] = line->Style;
|
||||||
if (paint_columns[5]) strings[5] = line->Actor;
|
if (paint_columns[5]) strings[5] = line->Actor;
|
||||||
|
@ -833,7 +833,7 @@ void BaseGrid::SetColumnWidths() {
|
||||||
int startLen = 0;
|
int startLen = 0;
|
||||||
int endLen = 0;
|
int endLen = 0;
|
||||||
if (!byFrame)
|
if (!byFrame)
|
||||||
startLen = endLen = dc.GetTextExtent(AssTime().GetASSFormated()).GetWidth();
|
startLen = endLen = dc.GetTextExtent(AssTime().GetAssFormated()).GetWidth();
|
||||||
|
|
||||||
// O(n) widths
|
// O(n) widths
|
||||||
bool showMargin[3] = { false, false, false };
|
bool showMargin[3] = { false, false, false };
|
||||||
|
|
|
@ -202,7 +202,7 @@ int block_at_pos(wxString const& text, int pos) {
|
||||||
void set_tag(const agi::Context *c, wxString const& tag, wxString const& value, int &sel_start, int &sel_end, bool at_end = false) {
|
void set_tag(const agi::Context *c, wxString const& tag, wxString const& value, int &sel_start, int &sel_end, bool at_end = false) {
|
||||||
AssDialogue * const line = c->selectionController->GetActiveLine();
|
AssDialogue * const line = c->selectionController->GetActiveLine();
|
||||||
if (line->Blocks.empty())
|
if (line->Blocks.empty())
|
||||||
line->ParseASSTags();
|
line->ParseAssTags();
|
||||||
|
|
||||||
int start = at_end ? sel_end : sel_start;
|
int start = at_end ? sel_end : sel_start;
|
||||||
int blockn = block_at_pos(line->Text, start);
|
int blockn = block_at_pos(line->Text, start);
|
||||||
|
@ -239,7 +239,7 @@ void set_tag(const agi::Context *c, wxString const& tag, wxString const& value,
|
||||||
if (plain || blockn < 0) {
|
if (plain || blockn < 0) {
|
||||||
line->Text = line->Text.Left(start) + "{" + insert + "}" + line->Text.Mid(start);
|
line->Text = line->Text.Left(start) + "{" + insert + "}" + line->Text.Mid(start);
|
||||||
shift += 2;
|
shift += 2;
|
||||||
line->ParseASSTags();
|
line->ParseAssTags();
|
||||||
}
|
}
|
||||||
else if(ovr) {
|
else if(ovr) {
|
||||||
wxString alt;
|
wxString alt;
|
||||||
|
@ -296,7 +296,7 @@ void toggle_override_tag(const agi::Context *c, bool (AssStyle::*field), const c
|
||||||
AssStyle const* const style = c->ass->GetStyle(line->Style);
|
AssStyle const* const style = c->ass->GetStyle(line->Style);
|
||||||
bool state = style ? style->*field : AssStyle().*field;
|
bool state = style ? style->*field : AssStyle().*field;
|
||||||
|
|
||||||
line->ParseASSTags();
|
line->ParseAssTags();
|
||||||
int sel_start = c->textSelectionController->GetSelectionStart();
|
int sel_start = c->textSelectionController->GetSelectionStart();
|
||||||
int sel_end = c->textSelectionController->GetSelectionEnd();
|
int sel_end = c->textSelectionController->GetSelectionEnd();
|
||||||
int blockn = block_at_pos(line->Text, sel_start);
|
int blockn = block_at_pos(line->Text, sel_start);
|
||||||
|
@ -315,7 +315,7 @@ void got_color(const agi::Context *c, const char *tag, int *commit_id, wxColour
|
||||||
if (new_color.Ok()) {
|
if (new_color.Ok()) {
|
||||||
int sel_start = c->textSelectionController->GetSelectionStart();
|
int sel_start = c->textSelectionController->GetSelectionStart();
|
||||||
int sel_end = c->textSelectionController->GetSelectionEnd();
|
int sel_end = c->textSelectionController->GetSelectionEnd();
|
||||||
set_tag(c, tag, AssColor(new_color).GetASSFormatted(false), sel_start, sel_end);
|
set_tag(c, tag, AssColor(new_color).GetAssFormatted(false), sel_start, sel_end);
|
||||||
commit_text(c, _("set color"), sel_start, sel_end, commit_id);
|
commit_text(c, _("set color"), sel_start, sel_end, commit_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ void show_color_picker(const agi::Context *c, AssColor (AssStyle::*field), const
|
||||||
AssStyle const* const style = c->ass->GetStyle(line->Style);
|
AssStyle const* const style = c->ass->GetStyle(line->Style);
|
||||||
wxColor color = (style ? style->*field : AssStyle().*field).GetWXColor();
|
wxColor color = (style ? style->*field : AssStyle().*field).GetWXColor();
|
||||||
|
|
||||||
line->ParseASSTags();
|
line->ParseAssTags();
|
||||||
|
|
||||||
int sel_start = c->textSelectionController->GetSelectionStart();
|
int sel_start = c->textSelectionController->GetSelectionStart();
|
||||||
int sel_end = c->textSelectionController->GetSelectionEnd();
|
int sel_end = c->textSelectionController->GetSelectionEnd();
|
||||||
|
@ -439,7 +439,7 @@ struct edit_font : public Command {
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
AssDialogue *const line = c->selectionController->GetActiveLine();
|
AssDialogue *const line = c->selectionController->GetActiveLine();
|
||||||
line->ParseASSTags();
|
line->ParseAssTags();
|
||||||
const int blockn = block_at_pos(line->Text, c->textSelectionController->GetInsertionPoint());
|
const int blockn = block_at_pos(line->Text, c->textSelectionController->GetInsertionPoint());
|
||||||
|
|
||||||
const AssStyle *style = c->ass->GetStyle(line->Style);
|
const AssStyle *style = c->ass->GetStyle(line->Style);
|
||||||
|
|
|
@ -238,7 +238,7 @@ class DialogColorPicker : public wxDialog {
|
||||||
/// Update all other controls as a result of modifying an HSV control
|
/// Update all other controls as a result of modifying an HSV control
|
||||||
void UpdateFromHSV(bool dirty = true);
|
void UpdateFromHSV(bool dirty = true);
|
||||||
/// Update all other controls as a result of modifying the ASS format control
|
/// Update all other controls as a result of modifying the ASS format control
|
||||||
void UpdateFromASS();
|
void UpdateFromAss();
|
||||||
/// Update all other controls as a result of modifying the HTML format control
|
/// Update all other controls as a result of modifying the HTML format control
|
||||||
void UpdateFromHTML();
|
void UpdateFromHTML();
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ wxString ColorPickerRecent::StoreToString()
|
||||||
{
|
{
|
||||||
wxString res;
|
wxString res;
|
||||||
for (int i = 0; i < rows*cols; i++) {
|
for (int i = 0; i < rows*cols; i++) {
|
||||||
res << AssColor(colors[i]).GetASSFormatted(false, false, false) << " ";
|
res << AssColor(colors[i]).GetAssFormatted(false, false, false) << " ";
|
||||||
}
|
}
|
||||||
return res.Trim(true);
|
return res.Trim(true);
|
||||||
}
|
}
|
||||||
|
@ -502,7 +502,7 @@ void ColorPickerRecent::OnClick(wxMouseEvent &evt)
|
||||||
|
|
||||||
if (i >= 0 && i < (int)colors.size()) {
|
if (i >= 0 && i < (int)colors.size()) {
|
||||||
wxCommandEvent evnt(EVT_RECENT_SELECT, GetId());
|
wxCommandEvent evnt(EVT_RECENT_SELECT, GetId());
|
||||||
evnt.SetString(AssColor(colors[i]).GetASSFormatted(false, false, false));
|
evnt.SetString(AssColor(colors[i]).GetAssFormatted(false, false, false));
|
||||||
AddPendingEvent(evnt);
|
AddPendingEvent(evnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -576,7 +576,7 @@ void ColorPickerScreenDropper::OnMouse(wxMouseEvent &evt)
|
||||||
wxColour color(pdi.Red(), pdi.Green(), pdi.Blue(), wxALPHA_OPAQUE);
|
wxColour color(pdi.Red(), pdi.Green(), pdi.Blue(), wxALPHA_OPAQUE);
|
||||||
|
|
||||||
wxCommandEvent evnt(EVT_DROPPER_SELECT, GetId());
|
wxCommandEvent evnt(EVT_DROPPER_SELECT, GetId());
|
||||||
evnt.SetString(AssColor(color).GetASSFormatted(false, false, false));
|
evnt.SetString(AssColor(color).GetAssFormatted(false, false, false));
|
||||||
AddPendingEvent(evnt);
|
AddPendingEvent(evnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -792,7 +792,7 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, wxColour initial_color, s
|
||||||
hsv_input[i]->Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, bind(&DialogColorPicker::UpdateFromHSV, this, true));
|
hsv_input[i]->Bind(wxEVT_COMMAND_SPINCTRL_UPDATED, bind(&DialogColorPicker::UpdateFromHSV, this, true));
|
||||||
hsv_input[i]->Bind(wxEVT_COMMAND_TEXT_UPDATED, bind(&DialogColorPicker::UpdateFromHSV, this, true));
|
hsv_input[i]->Bind(wxEVT_COMMAND_TEXT_UPDATED, bind(&DialogColorPicker::UpdateFromHSV, this, true));
|
||||||
}
|
}
|
||||||
ass_input->Bind(wxEVT_COMMAND_TEXT_UPDATED, bind(&DialogColorPicker::UpdateFromASS, this));
|
ass_input->Bind(wxEVT_COMMAND_TEXT_UPDATED, bind(&DialogColorPicker::UpdateFromAss, this));
|
||||||
html_input->Bind(wxEVT_COMMAND_TEXT_UPDATED, bind(&DialogColorPicker::UpdateFromHTML, this));
|
html_input->Bind(wxEVT_COMMAND_TEXT_UPDATED, bind(&DialogColorPicker::UpdateFromHTML, this));
|
||||||
|
|
||||||
screen_dropper_icon->Bind(wxEVT_MOTION, &DialogColorPicker::OnDropperMouse, this);
|
screen_dropper_icon->Bind(wxEVT_MOTION, &DialogColorPicker::OnDropperMouse, this);
|
||||||
|
@ -901,7 +901,7 @@ void DialogColorPicker::UpdateFromRGB(bool dirty)
|
||||||
SetHSL(r, g, b);
|
SetHSL(r, g, b);
|
||||||
SetHSV(r, g, b);
|
SetHSV(r, g, b);
|
||||||
cur_color = wxColour(r, g, b, wxALPHA_OPAQUE);
|
cur_color = wxColour(r, g, b, wxALPHA_OPAQUE);
|
||||||
ass_input->ChangeValue(AssColor(cur_color).GetASSFormatted(false, false, false));
|
ass_input->ChangeValue(AssColor(cur_color).GetAssFormatted(false, false, false));
|
||||||
html_input->ChangeValue(color_to_html(cur_color));
|
html_input->ChangeValue(color_to_html(cur_color));
|
||||||
|
|
||||||
if (dirty)
|
if (dirty)
|
||||||
|
@ -920,7 +920,7 @@ void DialogColorPicker::UpdateFromHSL(bool dirty)
|
||||||
SetRGB(r, g, b);
|
SetRGB(r, g, b);
|
||||||
SetHSV(r, g, b);
|
SetHSV(r, g, b);
|
||||||
|
|
||||||
ass_input->ChangeValue(AssColor(cur_color).GetASSFormatted(false, false, false));
|
ass_input->ChangeValue(AssColor(cur_color).GetAssFormatted(false, false, false));
|
||||||
html_input->ChangeValue(color_to_html(cur_color));
|
html_input->ChangeValue(color_to_html(cur_color));
|
||||||
|
|
||||||
if (dirty)
|
if (dirty)
|
||||||
|
@ -938,7 +938,7 @@ void DialogColorPicker::UpdateFromHSV(bool dirty)
|
||||||
hsv_to_rgb(h, s, v, &r, &g, &b);
|
hsv_to_rgb(h, s, v, &r, &g, &b);
|
||||||
SetRGB(r, g, b);
|
SetRGB(r, g, b);
|
||||||
SetHSL(r, g, b);
|
SetHSL(r, g, b);
|
||||||
ass_input->ChangeValue(AssColor(cur_color).GetASSFormatted(false, false, false));
|
ass_input->ChangeValue(AssColor(cur_color).GetAssFormatted(false, false, false));
|
||||||
html_input->ChangeValue(color_to_html(cur_color));
|
html_input->ChangeValue(color_to_html(cur_color));
|
||||||
|
|
||||||
if (dirty)
|
if (dirty)
|
||||||
|
@ -947,7 +947,7 @@ void DialogColorPicker::UpdateFromHSV(bool dirty)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Use the value entered in the ASS hex control to update the other controls
|
/// @brief Use the value entered in the ASS hex control to update the other controls
|
||||||
void DialogColorPicker::UpdateFromASS()
|
void DialogColorPicker::UpdateFromAss()
|
||||||
{
|
{
|
||||||
unsigned char r, g, b;
|
unsigned char r, g, b;
|
||||||
AssColor ass;
|
AssColor ass;
|
||||||
|
@ -975,7 +975,7 @@ void DialogColorPicker::UpdateFromHTML()
|
||||||
SetRGB(r, g, b);
|
SetRGB(r, g, b);
|
||||||
SetHSL(r, g, b);
|
SetHSL(r, g, b);
|
||||||
SetHSV(r, g, b);
|
SetHSV(r, g, b);
|
||||||
ass_input->ChangeValue(AssColor(cur_color).GetASSFormatted(false, false, false));
|
ass_input->ChangeValue(AssColor(cur_color).GetAssFormatted(false, false, false));
|
||||||
|
|
||||||
spectrum_dirty = true;
|
spectrum_dirty = true;
|
||||||
UpdateSpectrumDisplay();
|
UpdateSpectrumDisplay();
|
||||||
|
|
|
@ -69,7 +69,7 @@ DialogJumpTo::DialogJumpTo(agi::Context *c)
|
||||||
|
|
||||||
JumpFrame = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(-1,-1),wxTE_PROCESS_ENTER, NumValidator((int)jumpframe));
|
JumpFrame = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(-1,-1),wxTE_PROCESS_ENTER, NumValidator((int)jumpframe));
|
||||||
JumpFrame->SetMaxLength(maxLength.size());
|
JumpFrame->SetMaxLength(maxLength.size());
|
||||||
JumpTime = new TimeEdit(this, -1, c, AssTime(c->videoController->TimeAtFrame(jumpframe)).GetASSFormated(), wxSize(-1,-1));
|
JumpTime = new TimeEdit(this, -1, c, AssTime(c->videoController->TimeAtFrame(jumpframe)).GetAssFormated(), wxSize(-1,-1));
|
||||||
|
|
||||||
wxGridSizer *TimesSizer = new wxGridSizer(2, 5, 5);
|
wxGridSizer *TimesSizer = new wxGridSizer(2, 5, 5);
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ namespace {
|
||||||
void resample_line(resample_state *state, AssEntry *line) {
|
void resample_line(resample_state *state, AssEntry *line) {
|
||||||
AssDialogue *diag = dynamic_cast<AssDialogue*>(line);
|
AssDialogue *diag = dynamic_cast<AssDialogue*>(line);
|
||||||
if (diag && !(diag->Comment && (diag->Effect.StartsWith("template") || diag->Effect.StartsWith("code")))) {
|
if (diag && !(diag->Comment && (diag->Effect.StartsWith("template") || diag->Effect.StartsWith("code")))) {
|
||||||
diag->ParseASSTags();
|
diag->ParseAssTags();
|
||||||
diag->ProcessParameters(resample_tags, state);
|
diag->ProcessParameters(resample_tags, state);
|
||||||
|
|
||||||
for (size_t i = 0; i < diag->Blocks.size(); ++i) {
|
for (size_t i = 0; i < diag->Blocks.size(); ++i) {
|
||||||
|
|
|
@ -100,7 +100,7 @@ class StyleRenamer {
|
||||||
found_any = true;
|
found_any = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
diag->ParseASSTags();
|
diag->ParseAssTags();
|
||||||
diag->ProcessParameters(&StyleRenamer::ProcessTag, this);
|
diag->ProcessParameters(&StyleRenamer::ProcessTag, this);
|
||||||
if (replace)
|
if (replace)
|
||||||
diag->UpdateText();
|
diag->UpdateText();
|
||||||
|
|
|
@ -161,7 +161,7 @@ DialogTranslation::DialogTranslation(agi::Context *c)
|
||||||
|
|
||||||
Bind(wxEVT_KEY_DOWN, &DialogTranslation::OnKeyDown, this);
|
Bind(wxEVT_KEY_DOWN, &DialogTranslation::OnKeyDown, this);
|
||||||
|
|
||||||
active_line->ParseASSTags();
|
active_line->ParseAssTags();
|
||||||
if (bad_block(active_line->Blocks[0])) {
|
if (bad_block(active_line->Blocks[0])) {
|
||||||
if (!NextBlock())
|
if (!NextBlock())
|
||||||
throw NothingToTranslate(STD_STR(_("There is nothing to translate in the file.")));
|
throw NothingToTranslate(STD_STR(_("There is nothing to translate in the file.")));
|
||||||
|
@ -177,7 +177,7 @@ void DialogTranslation::OnActiveLineChanged(AssDialogue *new_line) {
|
||||||
if (switching_lines) return;
|
if (switching_lines) return;
|
||||||
|
|
||||||
active_line = new_line;
|
active_line = new_line;
|
||||||
active_line->ParseASSTags();
|
active_line->ParseAssTags();
|
||||||
cur_block = 0;
|
cur_block = 0;
|
||||||
line_number = count_if(c->ass->Line.begin(), find(c->ass->Line.begin(), c->ass->Line.end(), active_line), cast<AssDialogue*>()) + 1;
|
line_number = count_if(c->ass->Line.begin(), find(c->ass->Line.begin(), c->ass->Line.end(), active_line), cast<AssDialogue*>()) + 1;
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ bool DialogTranslation::NextBlock() {
|
||||||
|
|
||||||
active_line->ClearBlocks();
|
active_line->ClearBlocks();
|
||||||
active_line = new_line;
|
active_line = new_line;
|
||||||
active_line->ParseASSTags();
|
active_line->ParseAssTags();
|
||||||
cur_block = 0;
|
cur_block = 0;
|
||||||
++line_number;
|
++line_number;
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ bool DialogTranslation::PrevBlock() {
|
||||||
|
|
||||||
active_line->ClearBlocks();
|
active_line->ClearBlocks();
|
||||||
active_line = new_line;
|
active_line = new_line;
|
||||||
active_line->ParseASSTags();
|
active_line->ParseAssTags();
|
||||||
cur_block = active_line->Blocks.size() - 1;
|
cur_block = active_line->Blocks.size() - 1;
|
||||||
--line_number;
|
--line_number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ void AssTransformFramerateFilter::TransformFrameRate(AssFile *subs) {
|
||||||
newEnd = trunc_cs(ConvertTime(curDialogue->End) + 9);
|
newEnd = trunc_cs(ConvertTime(curDialogue->End) + 9);
|
||||||
|
|
||||||
// Process stuff
|
// Process stuff
|
||||||
curDialogue->ParseASSTags();
|
curDialogue->ParseAssTags();
|
||||||
curDialogue->ProcessParameters(TransformTimeTags, this);
|
curDialogue->ProcessParameters(TransformTimeTags, this);
|
||||||
curDialogue->Start = newStart;
|
curDialogue->Start = newStart;
|
||||||
curDialogue->End = newEnd;
|
curDialogue->End = newEnd;
|
||||||
|
|
|
@ -49,7 +49,7 @@ FontCollector::FontCollector(FontCollectorStatusCallback status_callback, FontFi
|
||||||
void FontCollector::ProcessDialogueLine(AssDialogue *line, int index) {
|
void FontCollector::ProcessDialogueLine(AssDialogue *line, int index) {
|
||||||
if (line->Comment) return;
|
if (line->Comment) return;
|
||||||
|
|
||||||
line->ParseASSTags();
|
line->ParseAssTags();
|
||||||
StyleInfo style = styles[line->Style];
|
StyleInfo style = styles[line->Style];
|
||||||
StyleInfo initial = style;
|
StyleInfo initial = style;
|
||||||
|
|
||||||
|
|
|
@ -117,11 +117,11 @@ static void read_subtitles(agi::ProgressSink *ps, MatroskaFile *file, MkvStdIO *
|
||||||
blockString.BeforeFirst(',', &afterOrder).ToLong(&order);
|
blockString.BeforeFirst(',', &afterOrder).ToLong(&order);
|
||||||
afterOrder.BeforeFirst(',', &afterLayer).ToLong(&layer);
|
afterOrder.BeforeFirst(',', &afterLayer).ToLong(&layer);
|
||||||
|
|
||||||
subList[order] = wxString::Format("Dialogue: %d,%s,%s,%s", (int)layer, subStart.GetASSFormated(), subEnd.GetASSFormated(), afterLayer);
|
subList[order] = wxString::Format("Dialogue: %d,%s,%s,%s", (int)layer, subStart.GetAssFormated(), subEnd.GetAssFormated(), afterLayer);
|
||||||
}
|
}
|
||||||
// Process SRT
|
// Process SRT
|
||||||
else {
|
else {
|
||||||
blockString = wxString::Format("Dialogue: 0,%s,%s,%s", subStart.GetASSFormated(), subEnd.GetASSFormated(), blockString);
|
blockString = wxString::Format("Dialogue: 0,%s,%s,%s", subStart.GetAssFormated(), subEnd.GetAssFormated(), blockString);
|
||||||
blockString.Replace("\r\n","\\N");
|
blockString.Replace("\r\n","\\N");
|
||||||
blockString.Replace("\r","\\N");
|
blockString.Replace("\r","\\N");
|
||||||
blockString.Replace("\n","\\N");
|
blockString.Replace("\n","\\N");
|
||||||
|
@ -138,7 +138,7 @@ static void read_subtitles(agi::ProgressSink *ps, MatroskaFile *file, MkvStdIO *
|
||||||
int version = ssa;
|
int version = ssa;
|
||||||
AssAttachment *attach = 0;
|
AssAttachment *attach = 0;
|
||||||
for (std::map<int, wxString>::iterator it = subList.begin(); it != subList.end(); ++it) {
|
for (std::map<int, wxString>::iterator it = subList.begin(); it != subList.end(); ++it) {
|
||||||
ASSSubtitleFormat::AddLine(target, it->second, &version, &attach);
|
AssSubtitleFormat::AddLine(target, it->second, &version, &attach);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ void MatroskaWrapper::GetSubtitles(wxString const& filename, AssFile *target) {
|
||||||
AssAttachment *attach = 0;
|
AssAttachment *attach = 0;
|
||||||
wxStringTokenizer token(privString, "\r\n", wxTOKEN_STRTOK);
|
wxStringTokenizer token(privString, "\r\n", wxTOKEN_STRTOK);
|
||||||
while (token.HasMoreTokens())
|
while (token.HasMoreTokens())
|
||||||
ASSSubtitleFormat::AddLine(target, token.GetNextToken(), &version, &attach);
|
AssSubtitleFormat::AddLine(target, token.GetNextToken(), &version, &attach);
|
||||||
}
|
}
|
||||||
// Load default if it's SRT
|
// Load default if it's SRT
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -67,7 +67,7 @@ void Spline::SetScale(int new_scale) {
|
||||||
scale = 1 << (raw_scale - 1);
|
scale = 1 << (raw_scale - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString Spline::EncodeToASS() const {
|
wxString Spline::EncodeToAss() const {
|
||||||
wxString result;
|
wxString result;
|
||||||
result.reserve(size() * 10);
|
result.reserve(size() * 10);
|
||||||
char last = 0;
|
char last = 0;
|
||||||
|
@ -107,7 +107,7 @@ wxString Spline::EncodeToASS() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spline::DecodeFromASS(wxString str) {
|
void Spline::DecodeFromAss(wxString str) {
|
||||||
// Clear current
|
// Clear current
|
||||||
clear();
|
clear();
|
||||||
std::vector<float> stack;
|
std::vector<float> stack;
|
||||||
|
|
|
@ -64,10 +64,10 @@ public:
|
||||||
Spline(const VisualToolBase &scale);
|
Spline(const VisualToolBase &scale);
|
||||||
|
|
||||||
/// Encode to an ASS vector drawing
|
/// Encode to an ASS vector drawing
|
||||||
wxString EncodeToASS() const;
|
wxString EncodeToAss() const;
|
||||||
|
|
||||||
/// Decode an ASS vector drawing
|
/// Decode an ASS vector drawing
|
||||||
void DecodeFromASS(wxString str);
|
void DecodeFromAss(wxString str);
|
||||||
|
|
||||||
/// Set the scale
|
/// Set the scale
|
||||||
/// @param new_scale Power-of-two to scale coordinates by
|
/// @param new_scale Power-of-two to scale coordinates by
|
||||||
|
|
|
@ -313,7 +313,7 @@ std::list<SubtitleFormat*> SubtitleFormat::formats;
|
||||||
|
|
||||||
void SubtitleFormat::LoadFormats() {
|
void SubtitleFormat::LoadFormats() {
|
||||||
if (formats.empty()) {
|
if (formats.empty()) {
|
||||||
new ASSSubtitleFormat;
|
new AssSubtitleFormat;
|
||||||
new Ebu3264SubtitleFormat;
|
new Ebu3264SubtitleFormat;
|
||||||
new EncoreSubtitleFormat;
|
new EncoreSubtitleFormat;
|
||||||
new MKVSubtitleFormat;
|
new MKVSubtitleFormat;
|
||||||
|
|
|
@ -48,26 +48,26 @@
|
||||||
|
|
||||||
DEFINE_SIMPLE_EXCEPTION(AssParseError, SubtitleFormatParseError, "subtitle_io/parse/ass")
|
DEFINE_SIMPLE_EXCEPTION(AssParseError, SubtitleFormatParseError, "subtitle_io/parse/ass")
|
||||||
|
|
||||||
ASSSubtitleFormat::ASSSubtitleFormat()
|
AssSubtitleFormat::AssSubtitleFormat()
|
||||||
: SubtitleFormat("Advanced Substation Alpha")
|
: SubtitleFormat("Advanced Substation Alpha")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
wxArrayString ASSSubtitleFormat::GetReadWildcards() const {
|
wxArrayString AssSubtitleFormat::GetReadWildcards() const {
|
||||||
wxArrayString formats;
|
wxArrayString formats;
|
||||||
formats.Add("ass");
|
formats.Add("ass");
|
||||||
formats.Add("ssa");
|
formats.Add("ssa");
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxArrayString ASSSubtitleFormat::GetWriteWildcards() const {
|
wxArrayString AssSubtitleFormat::GetWriteWildcards() const {
|
||||||
wxArrayString formats;
|
wxArrayString formats;
|
||||||
formats.Add("ass");
|
formats.Add("ass");
|
||||||
formats.Add("ssa");
|
formats.Add("ssa");
|
||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASSSubtitleFormat::ReadFile(AssFile *target, wxString const& filename, wxString const& encoding) const {
|
void AssSubtitleFormat::ReadFile(AssFile *target, wxString const& filename, wxString const& encoding) const {
|
||||||
target->Clear();
|
target->Clear();
|
||||||
|
|
||||||
TextFileReader file(filename, encoding);
|
TextFileReader file(filename, encoding);
|
||||||
|
@ -86,7 +86,7 @@ void ASSSubtitleFormat::ReadFile(AssFile *target, wxString const& filename, wxSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASSSubtitleFormat::WriteFile(const AssFile *src, wxString const& filename, wxString const& encoding) const {
|
void AssSubtitleFormat::WriteFile(const AssFile *src, wxString const& filename, wxString const& encoding) const {
|
||||||
TextFileWriter file(filename, encoding);
|
TextFileWriter file(filename, encoding);
|
||||||
bool ssa = filename.Right(4).Lower() == ".ssa";
|
bool ssa = filename.Right(4).Lower() == ".ssa";
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ void ASSSubtitleFormat::WriteFile(const AssFile *src, wxString const& filename,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASSSubtitleFormat::AddLine(AssFile *target, wxString data, int *version, AssAttachment **attach) {
|
void AssSubtitleFormat::AddLine(AssFile *target, wxString data, int *version, AssAttachment **attach) {
|
||||||
// Is this line an attachment filename?
|
// Is this line an attachment filename?
|
||||||
bool isFilename = data.StartsWith("fontname: ") || data.StartsWith("filename: ");
|
bool isFilename = data.StartsWith("fontname: ") || data.StartsWith("filename: ");
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,9 @@ class AssAttachment;
|
||||||
/// @brief DOCME
|
/// @brief DOCME
|
||||||
///
|
///
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class ASSSubtitleFormat : public SubtitleFormat {
|
class AssSubtitleFormat : public SubtitleFormat {
|
||||||
public:
|
public:
|
||||||
ASSSubtitleFormat();
|
AssSubtitleFormat();
|
||||||
|
|
||||||
wxArrayString GetReadWildcards() const;
|
wxArrayString GetReadWildcards() const;
|
||||||
wxArrayString GetWriteWildcards() const;
|
wxArrayString GetWriteWildcards() const;
|
||||||
|
|
|
@ -268,7 +268,7 @@ namespace
|
||||||
// Helper for finding special characters
|
// Helper for finding special characters
|
||||||
wxRegEx special_char_search("\\\\[nN]| ", wxRE_ADVANCED);
|
wxRegEx special_char_search("\\\\[nN]| ", wxRE_ADVANCED);
|
||||||
|
|
||||||
line->ParseASSTags();
|
line->ParseAssTags();
|
||||||
|
|
||||||
text_rows.clear();
|
text_rows.clear();
|
||||||
text_rows.push_back(EbuTextRow());
|
text_rows.push_back(EbuTextRow());
|
||||||
|
|
|
@ -215,7 +215,7 @@ public:
|
||||||
else if (attr_name == "color")
|
else if (attr_name == "color")
|
||||||
{
|
{
|
||||||
wxColour wxcl = html_to_color(attr_value);
|
wxColour wxcl = html_to_color(attr_value);
|
||||||
wxString colorstr = AssColor(wxcl).GetASSFormatted(false, false, false);
|
wxString colorstr = AssColor(wxcl).GetAssFormatted(false, false, false);
|
||||||
new_attribs.color = wxString::Format("{\\c%s}", colorstr);
|
new_attribs.color = wxString::Format("{\\c%s}", colorstr);
|
||||||
}
|
}
|
||||||
// remove this attribute to prepare for the next
|
// remove this attribute to prepare for the next
|
||||||
|
@ -567,7 +567,7 @@ wxString SRTSubtitleFormat::ConvertTags(AssDialogue *diag) const {
|
||||||
tag_states['u'] = false;
|
tag_states['u'] = false;
|
||||||
tag_states['s'] = false;
|
tag_states['s'] = false;
|
||||||
|
|
||||||
diag->ParseASSTags();
|
diag->ParseAssTags();
|
||||||
|
|
||||||
for (size_t i = 0; i < diag->Blocks.size(); ++i) {
|
for (size_t i = 0; i < diag->Blocks.size(); ++i) {
|
||||||
if (AssDialogueBlockOverride* block = dynamic_cast<AssDialogueBlockOverride*>(diag->Blocks[i])) {
|
if (AssDialogueBlockOverride* block = dynamic_cast<AssDialogueBlockOverride*>(diag->Blocks[i])) {
|
||||||
|
|
|
@ -246,7 +246,7 @@ void TTXTSubtitleFormat::WriteLine(wxXmlNode *root, AssDialogue *prev, AssDialog
|
||||||
// If it doesn't start at the end of previous, add blank
|
// If it doesn't start at the end of previous, add blank
|
||||||
if (prev && prev->End != line->Start) {
|
if (prev && prev->End != line->Start) {
|
||||||
wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextSample");
|
wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextSample");
|
||||||
node->AddAttribute("sampleTime", "0" + prev->End.GetASSFormated(true));
|
node->AddAttribute("sampleTime", "0" + prev->End.GetAssFormated(true));
|
||||||
node->AddAttribute("xml:space", "preserve");
|
node->AddAttribute("xml:space", "preserve");
|
||||||
root->AddChild(node);
|
root->AddChild(node);
|
||||||
node->AddChild(new wxXmlNode(wxXML_TEXT_NODE, "", ""));
|
node->AddChild(new wxXmlNode(wxXML_TEXT_NODE, "", ""));
|
||||||
|
@ -254,7 +254,7 @@ void TTXTSubtitleFormat::WriteLine(wxXmlNode *root, AssDialogue *prev, AssDialog
|
||||||
|
|
||||||
// Generate and insert node
|
// Generate and insert node
|
||||||
wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextSample");
|
wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, "TextSample");
|
||||||
node->AddAttribute("sampleTime", "0" + line->Start.GetASSFormated(true));
|
node->AddAttribute("sampleTime", "0" + line->Start.GetAssFormated(true));
|
||||||
node->AddAttribute("xml:space", "preserve");
|
node->AddAttribute("xml:space", "preserve");
|
||||||
root->AddChild(node);
|
root->AddChild(node);
|
||||||
node->AddChild(new wxXmlNode(wxXML_TEXT_NODE, "", line->Text));
|
node->AddChild(new wxXmlNode(wxXML_TEXT_NODE, "", line->Text));
|
||||||
|
|
|
@ -164,7 +164,7 @@ void TXTSubtitleFormat::WriteFile(const AssFile *src, wxString const& filename,
|
||||||
|
|
||||||
wxString out_text;
|
wxString out_text;
|
||||||
if (strip_formatting) {
|
if (strip_formatting) {
|
||||||
dia->ParseASSTags();
|
dia->ParseAssTags();
|
||||||
for (std::vector<AssDialogueBlock*>::iterator block = dia->Blocks.begin(); block != dia->Blocks.end(); ++block) {
|
for (std::vector<AssDialogueBlock*>::iterator block = dia->Blocks.begin(); block != dia->Blocks.end(); ++block) {
|
||||||
if ((*block)->GetType() == BLOCK_PLAIN) {
|
if ((*block)->GetType() == BLOCK_PLAIN) {
|
||||||
out_text += (*block)->GetText();
|
out_text += (*block)->GetText();
|
||||||
|
|
|
@ -87,7 +87,7 @@ TimeEdit::TimeEdit(wxWindow* parent, wxWindowID id, agi::Context *c, const wxStr
|
||||||
SetValidator(val);
|
SetValidator(val);
|
||||||
|
|
||||||
// Other stuff
|
// Other stuff
|
||||||
if (!value) SetValue(time.GetASSFormated());
|
if (!value) SetValue(time.GetAssFormated());
|
||||||
|
|
||||||
Bind(wxEVT_COMMAND_MENU_SELECTED, std::tr1::bind(&TimeEdit::CopyTime, this), Time_Edit_Copy);
|
Bind(wxEVT_COMMAND_MENU_SELECTED, std::tr1::bind(&TimeEdit::CopyTime, this), Time_Edit_Copy);
|
||||||
Bind(wxEVT_COMMAND_MENU_SELECTED, std::tr1::bind(&TimeEdit::PasteTime, this), Time_Edit_Paste);
|
Bind(wxEVT_COMMAND_MENU_SELECTED, std::tr1::bind(&TimeEdit::PasteTime, this), Time_Edit_Paste);
|
||||||
|
@ -136,7 +136,7 @@ void TimeEdit::UpdateText() {
|
||||||
if (byFrame)
|
if (byFrame)
|
||||||
ChangeValue(wxString::Format("%d", c->videoController->FrameAtTime(time, isEnd ? agi::vfr::END : agi::vfr::START)));
|
ChangeValue(wxString::Format("%d", c->videoController->FrameAtTime(time, isEnd ? agi::vfr::END : agi::vfr::START)));
|
||||||
else
|
else
|
||||||
ChangeValue(time.GetASSFormated());
|
ChangeValue(time.GetAssFormated());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeEdit::OnKeyDown(wxKeyEvent &event) {
|
void TimeEdit::OnKeyDown(wxKeyEvent &event) {
|
||||||
|
@ -197,7 +197,7 @@ void TimeEdit::OnKeyDown(wxKeyEvent &event) {
|
||||||
|
|
||||||
// Overwrite the digit
|
// Overwrite the digit
|
||||||
time = text.Left(start) + (char)key + text.Mid(start + 1);
|
time = text.Left(start) + (char)key + text.Mid(start + 1);
|
||||||
SetValue(time.GetASSFormated());
|
SetValue(time.GetAssFormated());
|
||||||
SetInsertionPoint(start + 1);
|
SetInsertionPoint(start + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ void TimeEdit::PasteTime() {
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
|
|
||||||
AssTime tempTime(text);
|
AssTime tempTime(text);
|
||||||
if (tempTime.GetASSFormated() == text) {
|
if (tempTime.GetAssFormated() == text) {
|
||||||
SetTime(tempTime);
|
SetTime(tempTime);
|
||||||
SetSelection(0, GetValue().size());
|
SetSelection(0, GetValue().size());
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ void VideoBox::UpdateTimeBoxes() {
|
||||||
int time = context->videoController->TimeAtFrame(frame, agi::vfr::EXACT);
|
int time = context->videoController->TimeAtFrame(frame, agi::vfr::EXACT);
|
||||||
|
|
||||||
// Set the text box for frame number and time
|
// Set the text box for frame number and time
|
||||||
VideoPosition->SetValue(wxString::Format("%s - %d", AssTime(time).GetASSFormated(true), frame));
|
VideoPosition->SetValue(wxString::Format("%s - %d", AssTime(time).GetAssFormated(true), frame));
|
||||||
if (binary_search(context->videoController->GetKeyFrames().begin(), context->videoController->GetKeyFrames().end(), frame)) {
|
if (binary_search(context->videoController->GetKeyFrames().begin(), context->videoController->GetKeyFrames().end(), frame)) {
|
||||||
// Set the background color to indicate this is a keyframe
|
// Set the background color to indicate this is a keyframe
|
||||||
VideoPosition->SetBackgroundColour(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Background/Selection")->GetColour()));
|
VideoPosition->SetBackgroundColour(lagi_wxColour(OPT_GET("Colour/Subtitle Grid/Background/Selection")->GetColour()));
|
||||||
|
|
|
@ -366,7 +366,7 @@ typedef const std::vector<AssOverrideParameter*> * param_vec;
|
||||||
// Parse line on creation and unparse at the end of scope
|
// Parse line on creation and unparse at the end of scope
|
||||||
struct scoped_tag_parse {
|
struct scoped_tag_parse {
|
||||||
AssDialogue *diag;
|
AssDialogue *diag;
|
||||||
scoped_tag_parse(AssDialogue *diag) : diag(diag) { diag->ParseASSTags(); }
|
scoped_tag_parse(AssDialogue *diag) : diag(diag) { diag->ParseAssTags(); }
|
||||||
~scoped_tag_parse() { diag->ClearBlocks(); }
|
~scoped_tag_parse() { diag->ClearBlocks(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ void VisualToolBase::SetOverride(AssDialogue* line, wxString const& tag, wxStrin
|
||||||
wxString insert = tag + value;
|
wxString insert = tag + value;
|
||||||
|
|
||||||
// Get block at start
|
// Get block at start
|
||||||
line->ParseASSTags();
|
line->ParseAssTags();
|
||||||
AssDialogueBlock *block = line->Blocks.front();
|
AssDialogueBlock *block = line->Blocks.front();
|
||||||
|
|
||||||
// Get current block as plain or override
|
// Get current block as plain or override
|
||||||
|
|
|
@ -203,7 +203,7 @@ void VisualToolVectorClip::Save() {
|
||||||
wxString value = "(";
|
wxString value = "(";
|
||||||
if (spline.GetScale() != 1)
|
if (spline.GetScale() != 1)
|
||||||
value += wxString::Format("%d,", spline.GetScale());
|
value += wxString::Format("%d,", spline.GetScale());
|
||||||
value += spline.EncodeToASS() + ")";
|
value += spline.EncodeToAss() + ")";
|
||||||
|
|
||||||
SetOverride(active_line, tag, value);
|
SetOverride(active_line, tag, value);
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ void VisualToolVectorClip::DoRefresh() {
|
||||||
int scale;
|
int scale;
|
||||||
vect = GetLineVectorClip(active_line, scale, inverse);
|
vect = GetLineVectorClip(active_line, scale, inverse);
|
||||||
spline.SetScale(scale);
|
spline.SetScale(scale);
|
||||||
spline.DecodeFromASS(vect);
|
spline.DecodeFromAss(vect);
|
||||||
|
|
||||||
MakeFeatures();
|
MakeFeatures();
|
||||||
SelectAll();
|
SelectAll();
|
||||||
|
|
Loading…
Reference in New Issue