mirror of https://github.com/odrling/Aegisub
Add support for new override tags: \iclip \fax \fay \xshad \yshad \xbord \ybord \blur
Support redefined override tags: \move (float-pos) \pos (float-pos) \be (variable) Make visual typesetting understand inverse clips and edit them correctly. Make vector clip visual tool able to convert a rectangular clip to a vector clip. What's missing: Proper rendering of inverse vector clips in visual tool overlay. Originally committed to SVN as r2336.
This commit is contained in:
parent
aca234ebcc
commit
30a0b7e82b
|
@ -232,11 +232,31 @@ void AssOverrideTagProto::LoadProtos () {
|
||||||
proto.back().name = _T("\\bord");
|
proto.back().name = _T("\\bord");
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
|
||||||
|
|
||||||
|
// \xbord<depth>
|
||||||
|
proto.push_back(AssOverrideTagProto());
|
||||||
|
proto.back().name = _T("\\xbord");
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
|
||||||
|
|
||||||
|
// \ybord<depth>
|
||||||
|
proto.push_back(AssOverrideTagProto());
|
||||||
|
proto.back().name = _T("\\ybord");
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
|
||||||
|
|
||||||
// \shad<depth>
|
// \shad<depth>
|
||||||
proto.push_back(AssOverrideTagProto());
|
proto.push_back(AssOverrideTagProto());
|
||||||
proto.back().name = _T("\\shad");
|
proto.back().name = _T("\\shad");
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
|
||||||
|
|
||||||
|
// \xshad<depth>
|
||||||
|
proto.push_back(AssOverrideTagProto());
|
||||||
|
proto.back().name = _T("\\xshad");
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
|
||||||
|
|
||||||
|
// \yshad<depth>
|
||||||
|
proto.push_back(AssOverrideTagProto());
|
||||||
|
proto.back().name = _T("\\yshad");
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_SIZE));
|
||||||
|
|
||||||
// \fade(<a1>,<a2>,<a3>,<t1>,<t2>,<t3>,<t4>)
|
// \fade(<a1>,<a2>,<a3>,<t1>,<t2>,<t3>,<t4>)
|
||||||
proto.push_back(AssOverrideTagProto());
|
proto.push_back(AssOverrideTagProto());
|
||||||
proto.back().name = _T("\\fade");
|
proto.back().name = _T("\\fade");
|
||||||
|
@ -251,10 +271,10 @@ void AssOverrideTagProto::LoadProtos () {
|
||||||
// \move(<x1>,<y1>,<x2>,<y2>[,<t1>,<t2>])
|
// \move(<x1>,<y1>,<x2>,<y2>[,<t1>,<t2>])
|
||||||
proto.push_back(AssOverrideTagProto());
|
proto.push_back(AssOverrideTagProto());
|
||||||
proto.back().name = _T("\\move");
|
proto.back().name = _T("\\move");
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_6,PARCLASS_RELATIVE_TIME_START));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_6,PARCLASS_RELATIVE_TIME_START));
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_6,PARCLASS_RELATIVE_TIME_START));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_6,PARCLASS_RELATIVE_TIME_START));
|
||||||
|
|
||||||
|
@ -272,6 +292,20 @@ void AssOverrideTagProto::LoadProtos () {
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_2,PARCLASS_NORMAL));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_2,PARCLASS_NORMAL));
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_DRAWING));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_DRAWING));
|
||||||
|
|
||||||
|
// \iclip(<x1>,<y1>,<x2>,<y2>)
|
||||||
|
proto.push_back(AssOverrideTagProto());
|
||||||
|
proto.back().name = _T("\\iclip");
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
|
||||||
|
|
||||||
|
// \iclip([<scale>,]<some drawings>)
|
||||||
|
proto.push_back(AssOverrideTagProto());
|
||||||
|
proto.back().name = _T("\\iclip");
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,OPTIONAL_2,PARCLASS_NORMAL));
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_TEXT,NOT_OPTIONAL,PARCLASS_DRAWING));
|
||||||
|
|
||||||
// \fscx<percent>
|
// \fscx<percent>
|
||||||
proto.push_back(AssOverrideTagProto());
|
proto.push_back(AssOverrideTagProto());
|
||||||
proto.back().name = _T("\\fscx");
|
proto.back().name = _T("\\fscx");
|
||||||
|
@ -285,8 +319,8 @@ void AssOverrideTagProto::LoadProtos () {
|
||||||
// \pos(<x>,<y>)
|
// \pos(<x>,<y>)
|
||||||
proto.push_back(AssOverrideTagProto());
|
proto.push_back(AssOverrideTagProto());
|
||||||
proto.back().name = _T("\\pos");
|
proto.back().name = _T("\\pos");
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_X));
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_ABSOLUTE_POS_Y));
|
||||||
|
|
||||||
// \org(<x>,<y>)
|
// \org(<x>,<y>)
|
||||||
proto.push_back(AssOverrideTagProto());
|
proto.push_back(AssOverrideTagProto());
|
||||||
|
@ -330,6 +364,16 @@ void AssOverrideTagProto::LoadProtos () {
|
||||||
proto.back().name = _T("\\fr");
|
proto.back().name = _T("\\fr");
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
|
||||||
|
|
||||||
|
// \fax<factor>
|
||||||
|
proto.push_back(AssOverrideTagProto());
|
||||||
|
proto.back().name = _T("\\fax");
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
|
||||||
|
|
||||||
|
// \fay<factor>
|
||||||
|
proto.push_back(AssOverrideTagProto());
|
||||||
|
proto.back().name = _T("\\fay");
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
|
||||||
|
|
||||||
// \1c&H<bbggrr>&
|
// \1c&H<bbggrr>&
|
||||||
proto.push_back(AssOverrideTagProto());
|
proto.push_back(AssOverrideTagProto());
|
||||||
proto.back().name = _T("\\1c");
|
proto.back().name = _T("\\1c");
|
||||||
|
@ -385,10 +429,15 @@ void AssOverrideTagProto::LoadProtos () {
|
||||||
proto.back().name = _T("\\kf");
|
proto.back().name = _T("\\kf");
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_KARAOKE));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_KARAOKE));
|
||||||
|
|
||||||
// \be<0/1>
|
// \be<strength>
|
||||||
proto.push_back(AssOverrideTagProto());
|
proto.push_back(AssOverrideTagProto());
|
||||||
proto.back().name = _T("\\be");
|
proto.back().name = _T("\\be");
|
||||||
proto.back().params.push_back(AssOverrideParamProto(VARDATA_BOOL,NOT_OPTIONAL,PARCLASS_NORMAL));
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_INT,NOT_OPTIONAL,PARCLASS_NORMAL));
|
||||||
|
|
||||||
|
// \blur<strength>
|
||||||
|
proto.push_back(AssOverrideTagProto());
|
||||||
|
proto.back().name = _T("\\blur");
|
||||||
|
proto.back().params.push_back(AssOverrideParamProto(VARDATA_FLOAT,NOT_OPTIONAL,PARCLASS_NORMAL));
|
||||||
|
|
||||||
// \fn<name>
|
// \fn<name>
|
||||||
proto.push_back(AssOverrideTagProto());
|
proto.push_back(AssOverrideTagProto());
|
||||||
|
@ -502,7 +551,7 @@ void AssOverrideTag::Clear() {
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Parses text and sets tag
|
// Parses text and sets tag
|
||||||
void AssOverrideTag::SetText (wxString text) {
|
void AssOverrideTag::SetText (const wxString &text) {
|
||||||
// Determine name
|
// Determine name
|
||||||
Name = _T("");
|
Name = _T("");
|
||||||
AssOverrideTagProto *proto;
|
AssOverrideTagProto *proto;
|
||||||
|
@ -537,7 +586,7 @@ bool AssOverrideTag::IsValid() {
|
||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// Parses parameters
|
// Parses parameters
|
||||||
void AssOverrideTag::ParseParameters(wxString text) {
|
void AssOverrideTag::ParseParameters(const wxString &text) {
|
||||||
// Clear first
|
// Clear first
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
|
@ -551,7 +600,8 @@ void AssOverrideTag::ParseParameters(wxString text) {
|
||||||
if (text.IsEmpty() || text[0] != _T('(')) {
|
if (text.IsEmpty() || text[0] != _T('(')) {
|
||||||
// There's just one (or none at all) parameter (because there's no parantheses)
|
// There's just one (or none at all) parameter (because there's no parantheses)
|
||||||
// This means text is all our parameters
|
// This means text is all our parameters
|
||||||
paramList.Add(text.Trim(true).Trim(false));
|
wxString param(text);
|
||||||
|
paramList.Add(param.Trim(true).Trim(false));
|
||||||
// Only using goto here to avoid yet another nested block (keeps the code cleaner!)
|
// Only using goto here to avoid yet another nested block (keeps the code cleaner!)
|
||||||
goto end_tokenizing;
|
goto end_tokenizing;
|
||||||
}
|
}
|
||||||
|
@ -613,7 +663,7 @@ end_tokenizing:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find prototype
|
// Find prototype
|
||||||
bool clipOnce = true;
|
bool clipOnce = true, iclipOnce = true;
|
||||||
AssOverrideTagProto *proto = NULL;
|
AssOverrideTagProto *proto = NULL;
|
||||||
for (std::list<AssOverrideTagProto>::iterator cur=AssOverrideTagProto::proto.begin();cur!=AssOverrideTagProto::proto.end();cur++) {
|
for (std::list<AssOverrideTagProto>::iterator cur=AssOverrideTagProto::proto.begin();cur!=AssOverrideTagProto::proto.end();cur++) {
|
||||||
if (Name == (*cur).name) {
|
if (Name == (*cur).name) {
|
||||||
|
@ -621,6 +671,10 @@ end_tokenizing:
|
||||||
clipOnce = false;
|
clipOnce = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (Name == _T("\\iclip") && totalPars != 4 && iclipOnce) {
|
||||||
|
iclipOnce = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
proto = &(*cur);
|
proto = &(*cur);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -731,7 +785,14 @@ wxString AssOverrideTag::ToString() {
|
||||||
|
|
||||||
// Determine if it needs parentheses
|
// Determine if it needs parentheses
|
||||||
bool parenthesis = false;
|
bool parenthesis = false;
|
||||||
if (Name == _T("\\t") || Name == _T("\\pos") || Name == _T("\\fad") || Name == _T("\\org") || Name == _T("\\clip") || Name == _T("\\move") || Name == _T("\\fade")) parenthesis = true;
|
if (Name == _T("\\t") ||
|
||||||
|
Name == _T("\\pos") ||
|
||||||
|
Name == _T("\\fad") ||
|
||||||
|
Name == _T("\\org") ||
|
||||||
|
Name == _T("\\clip") ||
|
||||||
|
Name == _T("\\iclip") ||
|
||||||
|
Name == _T("\\move") ||
|
||||||
|
Name == _T("\\fade")) parenthesis = true;
|
||||||
if (parenthesis) result += _T("(");
|
if (parenthesis) result += _T("(");
|
||||||
|
|
||||||
// Add parameters
|
// Add parameters
|
||||||
|
|
|
@ -98,9 +98,9 @@ public:
|
||||||
~AssOverrideTag();
|
~AssOverrideTag();
|
||||||
|
|
||||||
bool IsValid();
|
bool IsValid();
|
||||||
void ParseParameters(wxString text);
|
void ParseParameters(const wxString &text);
|
||||||
void Clear();
|
void Clear();
|
||||||
void SetText(wxString text);
|
void SetText(const wxString &text);
|
||||||
wxString ToString();
|
wxString ToString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -584,13 +584,14 @@ void VisualTool::GetLineScale(AssDialogue *diag,float &scalX,float &scalY) {
|
||||||
|
|
||||||
///////////////////
|
///////////////////
|
||||||
// Get line's clip
|
// Get line's clip
|
||||||
void VisualTool::GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2) {
|
void VisualTool::GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2,bool &inverse) {
|
||||||
// Default values
|
// Default values
|
||||||
x1 = y1 = 0;
|
x1 = y1 = 0;
|
||||||
int sw,sh;
|
int sw,sh;
|
||||||
VideoContext::Get()->GetScriptSize(sw,sh);
|
VideoContext::Get()->GetScriptSize(sw,sh);
|
||||||
x2 = sw-1;
|
x2 = sw-1;
|
||||||
y2 = sh-1;
|
y2 = sh-1;
|
||||||
|
inverse = false;
|
||||||
|
|
||||||
// Prepare overrides
|
// Prepare overrides
|
||||||
diag->ParseASSTags();
|
diag->ParseASSTags();
|
||||||
|
@ -612,6 +613,14 @@ void VisualTool::GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2)
|
||||||
y1 = tag->Params[1]->AsInt();
|
y1 = tag->Params[1]->AsInt();
|
||||||
x2 = tag->Params[2]->AsInt();
|
x2 = tag->Params[2]->AsInt();
|
||||||
y2 = tag->Params[3]->AsInt();
|
y2 = tag->Params[3]->AsInt();
|
||||||
|
inverse = false;
|
||||||
|
}
|
||||||
|
else if (tag->Name == _T("\\iclip") && tag->Params.size() == 4) {
|
||||||
|
x1 = tag->Params[0]->AsInt();
|
||||||
|
y1 = tag->Params[1]->AsInt();
|
||||||
|
x2 = tag->Params[2]->AsInt();
|
||||||
|
y2 = tag->Params[3]->AsInt();
|
||||||
|
inverse = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -621,10 +630,11 @@ void VisualTool::GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2)
|
||||||
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// Get line vector clip, if it exists
|
// Get line vector clip, if it exists
|
||||||
wxString VisualTool::GetLineVectorClip(AssDialogue *diag,int &scale) {
|
wxString VisualTool::GetLineVectorClip(AssDialogue *diag,int &scale,bool &inverse) {
|
||||||
// Prepare overrides
|
// Prepare overrides
|
||||||
wxString result;
|
wxString result;
|
||||||
scale = 1;
|
scale = 1;
|
||||||
|
inverse = false;
|
||||||
diag->ParseASSTags();
|
diag->ParseASSTags();
|
||||||
AssDialogueBlockOverride *override;
|
AssDialogueBlockOverride *override;
|
||||||
AssOverrideTag *tag;
|
AssOverrideTag *tag;
|
||||||
|
@ -639,14 +649,22 @@ wxString VisualTool::GetLineVectorClip(AssDialogue *diag,int &scale) {
|
||||||
if (override) {
|
if (override) {
|
||||||
for (size_t j=0;j<override->Tags.size();j++) {
|
for (size_t j=0;j<override->Tags.size();j++) {
|
||||||
tag = override->Tags.at(j);
|
tag = override->Tags.at(j);
|
||||||
if (tag->Name == _T("\\clip")) {
|
if (tag->Name == _T("\\clip") || tag->Name == _T("\\iclip")) {
|
||||||
if (tag->Params.size() == 1) {
|
if (tag->Params.size() == 1) {
|
||||||
result = tag->Params[0]->AsText();
|
result = tag->Params[0]->AsText();
|
||||||
}
|
}
|
||||||
if (tag->Params.size() == 2) {
|
else if (tag->Params.size() == 2) {
|
||||||
scale = tag->Params[0]->AsInt();
|
scale = tag->Params[0]->AsInt();
|
||||||
result = tag->Params[1]->AsText();
|
result = tag->Params[1]->AsText();
|
||||||
}
|
}
|
||||||
|
else if (tag->Params.size() == 4) {
|
||||||
|
int x1 = tag->Params[0]->AsInt(),
|
||||||
|
y1 = tag->Params[1]->AsInt(),
|
||||||
|
x2 = tag->Params[2]->AsInt(),
|
||||||
|
y2 = tag->Params[3]->AsInt();
|
||||||
|
result = wxString::Format(_T("m %d %d l %d %d %d %d %d %d"), x1, y1, x2, y1, x2, y2, x1, y2);
|
||||||
|
}
|
||||||
|
inverse = tag->Name == _T("\\iclip");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,8 +107,8 @@ protected:
|
||||||
void GetLineMove(AssDialogue *diag,bool &hasMove,int &x1,int &y1,int &x2,int &y2,int &t1,int &t2);
|
void GetLineMove(AssDialogue *diag,bool &hasMove,int &x1,int &y1,int &x2,int &y2,int &t1,int &t2);
|
||||||
void GetLineRotation(AssDialogue *diag,float &rx,float &ry,float &rz);
|
void GetLineRotation(AssDialogue *diag,float &rx,float &ry,float &rz);
|
||||||
void GetLineScale(AssDialogue *diag,float &scalX,float &scalY);
|
void GetLineScale(AssDialogue *diag,float &scalX,float &scalY);
|
||||||
void GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2);
|
void GetLineClip(AssDialogue *diag,int &x1,int &y1,int &x2,int &y2,bool &inverse);
|
||||||
wxString GetLineVectorClip(AssDialogue *diag,int &scale);
|
wxString GetLineVectorClip(AssDialogue *diag,int &scale,bool &inverse);
|
||||||
void FillPositionData();
|
void FillPositionData();
|
||||||
void SetOverride(wxString tag,wxString value);
|
void SetOverride(wxString tag,wxString value);
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,9 @@ VisualToolClip::VisualToolClip(VideoDisplay *_parent)
|
||||||
curX1 = curY1 = 0;
|
curX1 = curY1 = 0;
|
||||||
curX2 = sw;
|
curX2 = sw;
|
||||||
curY2 = sh;
|
curY2 = sh;
|
||||||
|
inverse = false;
|
||||||
AssDialogue *line = GetActiveDialogueLine();
|
AssDialogue *line = GetActiveDialogueLine();
|
||||||
if (line) GetLineClip(line,curX1,curY1,curX2,curY2);
|
if (line) GetLineClip(line,curX1,curY1,curX2,curY2,inverse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ void VisualToolClip::Draw() {
|
||||||
if (!line) return;
|
if (!line) return;
|
||||||
|
|
||||||
// Get position
|
// Get position
|
||||||
if (!dragging && !holding) GetLineClip(line,curX1,curY1,curX2,curY2);
|
if (!dragging && !holding) GetLineClip(line,curX1,curY1,curX2,curY2,inverse);
|
||||||
int dx1 = curX1;
|
int dx1 = curX1;
|
||||||
int dy1 = curY1;
|
int dy1 = curY1;
|
||||||
int dx2 = curX2;
|
int dx2 = curX2;
|
||||||
|
@ -90,10 +91,15 @@ void VisualToolClip::Draw() {
|
||||||
// Draw outside area
|
// Draw outside area
|
||||||
SetLineColour(colour[3],0.0f);
|
SetLineColour(colour[3],0.0f);
|
||||||
SetFillColour(wxColour(0,0,0),0.5f);
|
SetFillColour(wxColour(0,0,0),0.5f);
|
||||||
DrawRectangle(0,0,sw,dy1);
|
if (inverse) {
|
||||||
DrawRectangle(0,dy2,sw,sh);
|
DrawRectangle(dx1,dy1,dx2,dy2);
|
||||||
DrawRectangle(0,dy1,dx1,dy2);
|
}
|
||||||
DrawRectangle(dx2,dy1,sw,dy2);
|
else {
|
||||||
|
DrawRectangle(0,0,sw,dy1);
|
||||||
|
DrawRectangle(0,dy2,sw,sh);
|
||||||
|
DrawRectangle(0,dy1,dx1,dy2);
|
||||||
|
DrawRectangle(dx2,dy1,sw,dy2);
|
||||||
|
}
|
||||||
|
|
||||||
// Draw circles
|
// Draw circles
|
||||||
SetLineColour(colour[0]);
|
SetLineColour(colour[0]);
|
||||||
|
@ -114,6 +120,7 @@ void VisualToolClip::InitializeHold() {
|
||||||
startX = mouseX;
|
startX = mouseX;
|
||||||
startY = mouseY;
|
startY = mouseY;
|
||||||
curDiag->StripTag(_T("\\clip"));
|
curDiag->StripTag(_T("\\clip"));
|
||||||
|
curDiag->StripTag(_T("\\iclip"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,7 +151,10 @@ void VisualToolClip::UpdateHold() {
|
||||||
///////////////
|
///////////////
|
||||||
// Commit hold
|
// Commit hold
|
||||||
void VisualToolClip::CommitHold() {
|
void VisualToolClip::CommitHold() {
|
||||||
SetOverride(_T("\\clip"),wxString::Format(_T("(%i,%i,%i,%i)"),curX1,curY1,curX2,curY2));
|
if (inverse)
|
||||||
|
SetOverride(_T("\\iclip"),wxString::Format(_T("(%i,%i,%i,%i)"),curX1,curY1,curX2,curY2));
|
||||||
|
else
|
||||||
|
SetOverride(_T("\\clip"),wxString::Format(_T("(%i,%i,%i,%i)"),curX1,curY1,curX2,curY2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -201,6 +211,7 @@ void VisualToolClip::PopulateFeatureList() {
|
||||||
void VisualToolClip::InitializeDrag(VisualDraggableFeature &feature) {
|
void VisualToolClip::InitializeDrag(VisualDraggableFeature &feature) {
|
||||||
curDiag = GetActiveDialogueLine();
|
curDiag = GetActiveDialogueLine();
|
||||||
curDiag->StripTag(_T("\\clip"));
|
curDiag->StripTag(_T("\\clip"));
|
||||||
|
curDiag->StripTag(_T("\\iclip"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
class VisualToolClip : public VisualTool {
|
class VisualToolClip : public VisualTool {
|
||||||
private:
|
private:
|
||||||
int startX,startY,curX1,curY1,curX2,curY2;
|
int startX,startY,curX1,curY1,curX2,curY2;
|
||||||
|
bool inverse;
|
||||||
|
|
||||||
bool CanHold() { return true; }
|
bool CanHold() { return true; }
|
||||||
void InitializeHold();
|
void InitializeHold();
|
||||||
|
|
|
@ -123,6 +123,7 @@ void VisualToolVectorClip::Draw() {
|
||||||
spline.GetPointList(points,pointCurve);
|
spline.GetPointList(points,pointCurve);
|
||||||
|
|
||||||
// Draw stencil mask
|
// Draw stencil mask
|
||||||
|
// FIXME: This should understand inverse clips too
|
||||||
glEnable(GL_STENCIL_TEST);
|
glEnable(GL_STENCIL_TEST);
|
||||||
glColorMask(0,0,0,0);
|
glColorMask(0,0,0,0);
|
||||||
glStencilFunc(GL_NEVER,1,1);
|
glStencilFunc(GL_NEVER,1,1);
|
||||||
|
@ -273,7 +274,10 @@ void VisualToolVectorClip::UpdateDrag(VisualDraggableFeature &feature) {
|
||||||
//////////
|
//////////
|
||||||
// Commit
|
// Commit
|
||||||
void VisualToolVectorClip::CommitDrag(VisualDraggableFeature &feature) {
|
void VisualToolVectorClip::CommitDrag(VisualDraggableFeature &feature) {
|
||||||
SetOverride(_T("\\clip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
if (inverse)
|
||||||
|
SetOverride(_T("\\iclip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
||||||
|
else
|
||||||
|
SetOverride(_T("\\clip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -294,7 +298,10 @@ void VisualToolVectorClip::ClickedFeature(VisualDraggableFeature &feature) {
|
||||||
|
|
||||||
// Erase and save changes
|
// Erase and save changes
|
||||||
spline.curves.erase(cur);
|
spline.curves.erase(cur);
|
||||||
SetOverride(_T("\\clip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
if (inverse)
|
||||||
|
SetOverride(_T("\\iclip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
||||||
|
else
|
||||||
|
SetOverride(_T("\\clip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
||||||
curFeature = -1;
|
curFeature = -1;
|
||||||
Commit(true);
|
Commit(true);
|
||||||
return;
|
return;
|
||||||
|
@ -389,7 +396,10 @@ void VisualToolVectorClip::InitializeHold() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit
|
// Commit
|
||||||
SetOverride(_T("\\clip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
if (inverse)
|
||||||
|
SetOverride(_T("\\iclip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
||||||
|
else
|
||||||
|
SetOverride(_T("\\clip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
||||||
Commit(true);
|
Commit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +470,12 @@ void VisualToolVectorClip::CommitHold() {
|
||||||
if (!holding && mode == 7) spline.Smooth();
|
if (!holding && mode == 7) spline.Smooth();
|
||||||
|
|
||||||
// Save it
|
// Save it
|
||||||
if (mode != 3 && mode != 4) SetOverride(_T("\\clip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
if (mode != 3 && mode != 4) {
|
||||||
|
if (inverse)
|
||||||
|
SetOverride(_T("\\iclip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
||||||
|
else
|
||||||
|
SetOverride(_T("\\clip"),_T("(") + spline.EncodeToASS() + _T(")"));
|
||||||
|
}
|
||||||
|
|
||||||
// End freedraw
|
// End freedraw
|
||||||
if (!holding && (mode == 6 || mode == 7)) SetMode(0);
|
if (!holding && (mode == 6 || mode == 7)) SetMode(0);
|
||||||
|
@ -478,7 +493,7 @@ void VisualToolVectorClip::DoRefresh() {
|
||||||
// Get clip vector
|
// Get clip vector
|
||||||
wxString vect;
|
wxString vect;
|
||||||
int scale;
|
int scale;
|
||||||
vect = GetLineVectorClip(line,scale);
|
vect = GetLineVectorClip(line,scale,inverse);
|
||||||
//if (!vect.IsEmpty()) return;
|
//if (!vect.IsEmpty()) return;
|
||||||
spline.DecodeFromASS(vect);
|
spline.DecodeFromASS(vect);
|
||||||
PopulateFeatureList();
|
PopulateFeatureList();
|
||||||
|
|
|
@ -52,6 +52,7 @@ private:
|
||||||
wxToolBar *toolBar;
|
wxToolBar *toolBar;
|
||||||
int mode;
|
int mode;
|
||||||
int lastX,lastY;
|
int lastX,lastY;
|
||||||
|
bool inverse;
|
||||||
|
|
||||||
void SetMode(int mode);
|
void SetMode(int mode);
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="..\lib\"
|
OutputDirectory="$(ProjectDir)..\lib\$(PlatformName)\"
|
||||||
IntermediateDirectory="Debug"
|
IntermediateDirectory="$(ProjectDir)build_vc9\$(PlatformName)\$(ConfigurationName)\"
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
CharacterSet="1"
|
CharacterSet="1"
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
OutputFile="$(OutDir)/lua51d.lib"
|
OutputFile="$(OutDir)lua51_D.lib"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -89,8 +89,8 @@
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|x64"
|
Name="Debug|x64"
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
OutputDirectory="$(ProjectDir)..\lib\$(PlatformName)\"
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
IntermediateDirectory="$(ProjectDir)build_vc9\$(PlatformName)\$(ConfigurationName)\"
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
CharacterSet="1"
|
CharacterSet="1"
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
OutputFile="$(OutDir)/lua51d_x64.lib"
|
OutputFile="$(OutDir)lua51_D.lib"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -158,8 +158,8 @@
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="..\lib\"
|
OutputDirectory="$(ProjectDir)..\lib\$(PlatformName)\"
|
||||||
IntermediateDirectory="Release"
|
IntermediateDirectory="$(ProjectDir)build_vc9\$(PlatformName)\$(ConfigurationName)\"
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
CharacterSet="2"
|
CharacterSet="2"
|
||||||
|
@ -200,7 +200,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
OutputFile="$(OutDir)/lua51.lib"
|
OutputFile="$(OutDir)lua51.lib"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -220,8 +220,8 @@
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|x64"
|
Name="Release|x64"
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
OutputDirectory="$(ProjectDir)..\lib\$(PlatformName)\"
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
IntermediateDirectory="$(ProjectDir)build_vc9\$(PlatformName)\$(ConfigurationName)\"
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
CharacterSet="2"
|
CharacterSet="2"
|
||||||
|
@ -263,7 +263,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
OutputFile="$(OutDir)/lua51_x64.lib"
|
OutputFile="$(OutDir)lua51.lib"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
|
Loading…
Reference in New Issue