From a7f3c4d2662929b7bd35dda2279bf5129a899d58 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sun, 7 Sep 2014 13:43:48 +0200 Subject: [PATCH] Call DoEvents during time-consuming operations Processing of a game file for reading it, searching positions, saving selected games or creating a book from them can take minutes. To keep the application responsive during that time, the main loops of those tasks calls DoEvents(). A possible risk is that the user can now do too much, and will initiate actions that interfere with the tast in progress. --- backend.c | 3 ++- gamelist.c | 2 +- ngamelist.c | 2 +- winboard/wgamelist.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/backend.c b/backend.c index 948081f..36eca33 100644 --- a/backend.c +++ b/backend.c @@ -15851,7 +15851,7 @@ SaveSelected (FILE *g, int dummy, char *dummy2) if(lg->position >= 0) { // selected? LoadGame(f, nItem, "", TRUE); SaveGamePGN2(g); // leaves g open - cnt++; + cnt++; DoEvents(); } lg = (ListGame *) lg->node.succ; } @@ -15890,6 +15890,7 @@ CreateBookEvent () if(lg->position >= 0) { LoadGame(f, nItem, "", TRUE); AddGameToBook(TRUE); + DoEvents(); } lg = (ListGame *) lg->node.succ; } diff --git a/gamelist.c b/gamelist.c index 62b4e83..2055e96 100644 --- a/gamelist.c +++ b/gamelist.c @@ -373,7 +373,7 @@ GameListBuild (FILE *f) } if(gameNumber % 1000 == 0) { snprintf(buf, MSG_SIZ, _("Reading game file (%d)"), gameNumber); - DisplayTitle(buf); + DisplayTitle(buf); DoEvents(); } } while (cm != (ChessMove) 0); diff --git a/ngamelist.c b/ngamelist.c index 43de988..b415d19 100644 --- a/ngamelist.c +++ b/ngamelist.c @@ -190,7 +190,7 @@ GameListPrepare (int byPos, int narrow) if(lg->number % 2000 == 0) { char buf[MSG_SIZ]; snprintf(buf, MSG_SIZ, _("Scanning through games (%d)"), lg->number); - DisplayTitle(buf); + DisplayTitle(buf); DoEvents(); } lg->position = pos; lg = (ListGame *) lg->node.succ; diff --git a/winboard/wgamelist.c b/winboard/wgamelist.c index 196c837..feda2ca 100644 --- a/winboard/wgamelist.c +++ b/winboard/wgamelist.c @@ -95,7 +95,7 @@ static int GameListToListBox( HWND hDlg, BOOL boReset, char * pszFilter, struct if(nItem % 2000 == 0) { snprintf(buf, MSG_SIZ, _("Scanning through games (%d)"), nItem); - SetWindowText(hwndMain, buf); + SetWindowText(hwndMain, buf); DoEvents(); } if(!narrow || lg->position >= 0) { -- 1.7.0.4