Improved the speed of grid drawing with tags hidden.

Originally committed to SVN as r478.
This commit is contained in:
Rodrigo Braz Monteiro 2006-07-08 22:33:21 +00:00
parent 3e9d9b79d6
commit b02de858a2

View file

@ -440,21 +440,19 @@ void BaseGrid::DrawImage(wxDC &dc) {
// Hidden overrides
if (mode == 1 || mode == 2) {
wxString replaceWith = Options.AsText(_T("Grid hide overrides char"));
curDiag->ParseASSTags();
size_t n = curDiag->Blocks.size();
for (size_t i=0;i<n;i++) {
AssDialogueBlock *block = curDiag->Blocks.at(i);
AssDialogueBlockPlain *plain = AssDialogueBlock::GetAsPlain(block);
if (plain) {
value += plain->GetText();
}
else {
if (mode == 1) {
value += replaceWith;
}
int textlen = curDiag->Text.Length();
int depth = 0;
wxChar curChar;
for (int i=0;i<textlen;i++) {
curChar = curDiag->Text[i];
if (curChar == _T('{')) depth = 1;
else if (curChar == _T('}')) {
depth--;
if (depth == 0 && mode == 1) value += replaceWith;
if (depth < 0) depth = 0;
}
else if (depth != 1) value += curChar;
}
curDiag->ClearBlocks();
}
// Show overrides