mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
AGS: Fixed GUI textual controls not redrawn when translation changes
From upstream 618d2e38a118f47389aaf7e57972b2520b81fc1b
This commit is contained in:
parent
4e9e0fcf15
commit
0c936b888d
@ -665,6 +665,7 @@ int Game_ChangeTranslation(const char *newFilename) {
|
||||
if ((newFilename == nullptr) || (newFilename[0] == 0)) { // switch back to default translation
|
||||
close_translation();
|
||||
_GP(usetup).translation = "";
|
||||
GUI::MarkForTranslationUpdate();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -673,6 +674,7 @@ int Game_ChangeTranslation(const char *newFilename) {
|
||||
return 0; // failed, kept previous translation
|
||||
|
||||
_GP(usetup).translation = newFilename;
|
||||
GUI::MarkForTranslationUpdate();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -689,6 +689,21 @@ void MarkAllGUIForUpdate() {
|
||||
}
|
||||
}
|
||||
|
||||
void MarkForTranslationUpdate() {
|
||||
for (auto &btn : _GP(guibuts)) {
|
||||
if (btn.IsTranslated())
|
||||
btn.MarkChanged();
|
||||
}
|
||||
for (auto &lbl : _GP(guilabels)) {
|
||||
if (lbl.IsTranslated())
|
||||
lbl.MarkChanged();
|
||||
}
|
||||
for (auto &list : _GP(guilist)) {
|
||||
if (list.IsTranslated())
|
||||
list.MarkChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void MarkForFontUpdate(int font) {
|
||||
for (auto &btn : _GP(guibuts)) {
|
||||
if (btn.Font == font)
|
||||
|
@ -229,6 +229,8 @@ void DrawTextAlignedHor(Bitmap *ds, const char *text, int font, color_t text_col
|
||||
|
||||
// Mark all existing GUI for redraw
|
||||
void MarkAllGUIForUpdate();
|
||||
// Mark all translatable GUI controls for redraw
|
||||
void MarkForTranslationUpdate();
|
||||
// Mark all GUI which use the given font for redraw
|
||||
void MarkForFontUpdate(int font);
|
||||
// Mark labels that acts as special text placeholders for redraw
|
||||
|
Loading…
Reference in New Issue
Block a user