forked from mia/Aegisub
Fixed bug with \fn button
Originally committed to SVN as r488.
This commit is contained in:
parent
f076fe4eb4
commit
2b158480dc
2 changed files with 27 additions and 9 deletions
|
@ -696,6 +696,7 @@ void FrameMain::SetDisplayMode(int mode) {
|
||||||
videoBox->VideoSizer->Layout();
|
videoBox->VideoSizer->Layout();
|
||||||
MainSizer->Layout();
|
MainSizer->Layout();
|
||||||
Layout();
|
Layout();
|
||||||
|
Show(true);
|
||||||
//int cw,ch;
|
//int cw,ch;
|
||||||
//GetSize(&cw,&ch);
|
//GetSize(&cw,&ch);
|
||||||
//SetSize(cw-1,ch-1);
|
//SetSize(cw-1,ch-1);
|
||||||
|
|
|
@ -1047,6 +1047,7 @@ void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos)
|
||||||
wxString insert;
|
wxString insert;
|
||||||
wxString insert2;
|
wxString insert2;
|
||||||
int shift;
|
int shift;
|
||||||
|
int nInserted = 1;
|
||||||
|
|
||||||
// Default value
|
// Default value
|
||||||
wxColour startcolor;
|
wxColour startcolor;
|
||||||
|
@ -1159,11 +1160,27 @@ void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos)
|
||||||
if (!font.Ok()) return;
|
if (!font.Ok()) return;
|
||||||
|
|
||||||
// Generate insert string
|
// Generate insert string
|
||||||
if (font.GetFaceName() != startfont.GetFaceName()) insert = _T("\\fn") + font.GetFaceName();
|
nInserted = 0;
|
||||||
if (font.GetPointSize() != startfont.GetPointSize()) insert += _T("\\fs") + wxString::Format(_T("%i"),font.GetPointSize());
|
if (font.GetFaceName() != startfont.GetFaceName()) {
|
||||||
if (font.GetWeight() != startfont.GetWeight()) insert += _T("\\b") + wxString::Format(_T("%i"),font.GetWeight() == wxFONTWEIGHT_BOLD ? 1 : 0);
|
insert = _T("\\fn") + font.GetFaceName();
|
||||||
if (font.GetStyle() != startfont.GetStyle()) insert += _T("\\i") + wxString::Format(_T("%i"),font.GetStyle() == wxFONTSTYLE_ITALIC ? 1 : 0);
|
nInserted++;
|
||||||
if (font.GetUnderlined() != startfont.GetUnderlined()) insert += _T("\\u") + wxString::Format(_T("%i"),font.GetUnderlined() ? 1 : 0);
|
}
|
||||||
|
if (font.GetPointSize() != startfont.GetPointSize()) {
|
||||||
|
insert += _T("\\fs") + wxString::Format(_T("%i"),font.GetPointSize());
|
||||||
|
nInserted++;
|
||||||
|
}
|
||||||
|
if (font.GetWeight() != startfont.GetWeight()) {
|
||||||
|
insert += _T("\\b") + wxString::Format(_T("%i"),font.GetWeight() == wxFONTWEIGHT_BOLD ? 1 : 0);
|
||||||
|
nInserted++;
|
||||||
|
}
|
||||||
|
if (font.GetStyle() != startfont.GetStyle()) {
|
||||||
|
insert += _T("\\i") + wxString::Format(_T("%i"),font.GetStyle() == wxFONTSTYLE_ITALIC ? 1 : 0);
|
||||||
|
nInserted++;
|
||||||
|
}
|
||||||
|
if (font.GetUnderlined() != startfont.GetUnderlined()) {
|
||||||
|
insert += _T("\\u") + wxString::Format(_T("%i"),font.GetUnderlined() ? 1 : 0);
|
||||||
|
nInserted++;
|
||||||
|
}
|
||||||
if (insert.IsEmpty()) return;
|
if (insert.IsEmpty()) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1192,8 +1209,8 @@ void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos)
|
||||||
shift = insert.Length();
|
shift = insert.Length();
|
||||||
|
|
||||||
// Remove old of same
|
// Remove old of same
|
||||||
for (size_t i=0;i<override->Tags.size()-1;i++) {
|
for (size_t i=0;i<override->Tags.size()-nInserted;i++) {
|
||||||
if (override->Tags.at(i)->Name == tagname) {
|
if (insert.Contains(override->Tags.at(i)->Name)) {
|
||||||
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--;
|
||||||
|
@ -1229,8 +1246,8 @@ void SubsEditBox::SetOverride (wxString tagname,wxString preValue,int forcePos)
|
||||||
override->ParseTags();
|
override->ParseTags();
|
||||||
|
|
||||||
// Remove old of same
|
// Remove old of same
|
||||||
for (size_t i=0;i<override->Tags.size()-1;i++) {
|
for (size_t i=0;i<override->Tags.size()-nInserted;i++) {
|
||||||
if (override->Tags.at(i)->Name == tagname) {
|
if (insert.Contains(override->Tags.at(i)->Name)) {
|
||||||
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…
Reference in a new issue