mirror of
https://github.com/odrling/Aegisub
synced 2025-04-11 22:56:02 +02:00
Fixed visual typesetting overwriting wrong tags.
Originally committed to SVN as r799.
This commit is contained in:
parent
c3995de991
commit
ddcc52b0fd
@ -1031,6 +1031,9 @@ void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Overrides being inserted
|
||||||
|
wxArrayString insertTags;
|
||||||
|
|
||||||
// Toggle value
|
// Toggle value
|
||||||
if (isFlag) {
|
if (isFlag) {
|
||||||
state = !state;
|
state = !state;
|
||||||
@ -1040,6 +1043,7 @@ void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos)
|
|||||||
// Generate insert string
|
// Generate insert string
|
||||||
insert = tagname + wxString::Format(_T("%i"),stateval);
|
insert = tagname + wxString::Format(_T("%i"),stateval);
|
||||||
insert2 = tagname + wxString::Format(_T("%i"),1-stateval);
|
insert2 = tagname + wxString::Format(_T("%i"),1-stateval);
|
||||||
|
insertTags.Add(tagname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Choose color
|
// Choose color
|
||||||
@ -1055,6 +1059,7 @@ void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos)
|
|||||||
// Generate insert string
|
// Generate insert string
|
||||||
AssColor asscolor(color);
|
AssColor asscolor(color);
|
||||||
insert = tagname + asscolor.GetASSFormatted(false);
|
insert = tagname + asscolor.GetASSFormatted(false);
|
||||||
|
insertTags.Add(tagname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Choose font
|
// Choose font
|
||||||
@ -1071,22 +1076,27 @@ void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos)
|
|||||||
if (font.GetFaceName() != startfont.GetFaceName()) {
|
if (font.GetFaceName() != startfont.GetFaceName()) {
|
||||||
insert = _T("\\fn") + font.GetFaceName();
|
insert = _T("\\fn") + font.GetFaceName();
|
||||||
nInserted++;
|
nInserted++;
|
||||||
|
insertTags.Add(_T("\\fn"));
|
||||||
}
|
}
|
||||||
if (font.GetPointSize() != startfont.GetPointSize()) {
|
if (font.GetPointSize() != startfont.GetPointSize()) {
|
||||||
insert += _T("\\fs") + wxString::Format(_T("%i"),font.GetPointSize());
|
insert += _T("\\fs") + wxString::Format(_T("%i"),font.GetPointSize());
|
||||||
nInserted++;
|
nInserted++;
|
||||||
|
insertTags.Add(_T("\\fs"));
|
||||||
}
|
}
|
||||||
if (font.GetWeight() != startfont.GetWeight()) {
|
if (font.GetWeight() != startfont.GetWeight()) {
|
||||||
insert += _T("\\b") + wxString::Format(_T("%i"),font.GetWeight() == wxFONTWEIGHT_BOLD ? 1 : 0);
|
insert += _T("\\b") + wxString::Format(_T("%i"),font.GetWeight() == wxFONTWEIGHT_BOLD ? 1 : 0);
|
||||||
nInserted++;
|
nInserted++;
|
||||||
|
insertTags.Add(_T("\\b"));
|
||||||
}
|
}
|
||||||
if (font.GetStyle() != startfont.GetStyle()) {
|
if (font.GetStyle() != startfont.GetStyle()) {
|
||||||
insert += _T("\\i") + wxString::Format(_T("%i"),font.GetStyle() == wxFONTSTYLE_ITALIC ? 1 : 0);
|
insert += _T("\\i") + wxString::Format(_T("%i"),font.GetStyle() == wxFONTSTYLE_ITALIC ? 1 : 0);
|
||||||
nInserted++;
|
nInserted++;
|
||||||
|
insertTags.Add(_T("\\i"));
|
||||||
}
|
}
|
||||||
if (font.GetUnderlined() != startfont.GetUnderlined()) {
|
if (font.GetUnderlined() != startfont.GetUnderlined()) {
|
||||||
insert += _T("\\u") + wxString::Format(_T("%i"),font.GetUnderlined() ? 1 : 0);
|
insert += _T("\\u") + wxString::Format(_T("%i"),font.GetUnderlined() ? 1 : 0);
|
||||||
nInserted++;
|
nInserted++;
|
||||||
|
insertTags.Add(_T("\\u"));
|
||||||
}
|
}
|
||||||
if (insert.IsEmpty()) {
|
if (insert.IsEmpty()) {
|
||||||
delete line;
|
delete line;
|
||||||
@ -1097,16 +1107,19 @@ void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos)
|
|||||||
// Generic tag
|
// Generic tag
|
||||||
if (isGeneric) {
|
if (isGeneric) {
|
||||||
insert = tagname + preValue;
|
insert = tagname + preValue;
|
||||||
|
insertTags.Add(tagname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Angle
|
// Angle
|
||||||
if (isAngle) {
|
if (isAngle) {
|
||||||
insert = tagname + preValue;
|
insert = tagname + preValue;
|
||||||
|
insertTags.Add(tagname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale
|
// Scale
|
||||||
if (isScale) {
|
if (isScale) {
|
||||||
insert = tagname + preValue;
|
insert = tagname + preValue;
|
||||||
|
insertTags.Add(tagname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current block as plain or override
|
// Get current block as plain or override
|
||||||
@ -1130,7 +1143,8 @@ void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos)
|
|||||||
|
|
||||||
// Remove old of same
|
// Remove old of same
|
||||||
for (size_t i=0;i<override->Tags.size()-nInserted;i++) {
|
for (size_t i=0;i<override->Tags.size()-nInserted;i++) {
|
||||||
if (insert.Contains(override->Tags.at(i)->Name)) {
|
//if (insert.Contains(override->Tags.at(i)->Name)) {
|
||||||
|
if (insertTags.Index(override->Tags.at(i)->Name) != wxNOT_FOUND) {
|
||||||
shift -= override->Tags.at(i)->ToString().Length();
|
shift -= override->Tags.at(i)->ToString().Length();
|
||||||
override->Tags.erase(override->Tags.begin() + i);
|
override->Tags.erase(override->Tags.begin() + i);
|
||||||
i--;
|
i--;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user