Disable GUI updates while running a script
This commit is contained in:
parent
7f66d171d6
commit
4475065928
|
@ -520,6 +520,10 @@ static DWORD WINAPI scriptLoadSyncThread(LPVOID filename)
|
||||||
|
|
||||||
bool scriptRunSync(int destline, bool silentRet)
|
bool scriptRunSync(int destline, bool silentRet)
|
||||||
{
|
{
|
||||||
|
// disable GUI updates
|
||||||
|
auto guiUpdateWasDisabled = GuiIsUpdateDisabled();
|
||||||
|
if(!guiUpdateWasDisabled)
|
||||||
|
GuiUpdateDisable();
|
||||||
if(!destline || destline > (int)linemap.size()) //invalid line
|
if(!destline || destline > (int)linemap.size()) //invalid line
|
||||||
destline = 0;
|
destline = 0;
|
||||||
if(destline)
|
if(destline)
|
||||||
|
@ -556,6 +560,9 @@ bool scriptRunSync(int destline, bool silentRet)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bIsRunning = false; //not running anymore
|
bIsRunning = false; //not running anymore
|
||||||
|
// re-enable GUI updates when appropriate
|
||||||
|
if(!guiUpdateWasDisabled)
|
||||||
|
GuiUpdateEnable(true);
|
||||||
GuiScriptSetIp(scriptIp);
|
GuiScriptSetIp(scriptIp);
|
||||||
// the script fully executed (which means scriptIp is reset to the first line), without any errors
|
// the script fully executed (which means scriptIp is reset to the first line), without any errors
|
||||||
return scriptIp == scriptinternalstep(0) && (scriptLastError == STATUS_EXIT || scriptLastError == STATUS_CONTINUE);
|
return scriptIp == scriptinternalstep(0) && (scriptLastError == STATUS_EXIT || scriptLastError == STATUS_CONTINUE);
|
||||||
|
|
Loading…
Reference in New Issue