X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=ngamelist.c;h=c843d38d17096b8e5aee501226400fdfff544dca;hb=c37d45adc7d98a702a7459ccdc0ac23df01a476e;hp=ae5bf12cda85f6e3a0e885365586d3e7264e9545;hpb=f8c35eb754cb56fb821bb45e87fd7a27e9ccb594;p=xboard.git diff --git a/ngamelist.c b/ngamelist.c index ae5bf12..c843d38 100644 --- a/ngamelist.c +++ b/ngamelist.c @@ -1,7 +1,7 @@ /* * ngamelist.c -- Game list window, Xt-independent front-end code for XBoard * - * Copyright 1995, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. + * Copyright 1995, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. * ------------------------------------------------------------------------ * * GNU XBoard is free software: you can redistribute it and/or modify @@ -82,7 +82,7 @@ static void GameListReplace P((int page)); static void GL_Button P((int n)); static Option gamesOptions[] = { -{ 200, LR|TB, 400, NULL, (void*) list, "", NULL, ListBox, "" }, +{ 200, LR|TB, 400, NULL, (void*) list, NULL, NULL, ListBox, "" }, { 0, 0, 100, NULL, (void*) &filterPtr, "", NULL, TextBox, "" }, { 4, SAME_ROW, 0, NULL, (void*) &GL_Button, NULL, NULL, Button, N_("find position") }, { 2, SAME_ROW, 0, NULL, (void*) &GL_Button, NULL, NULL, Button, N_("narrow") }, // buttons referred to by ID in value (=first) field! @@ -96,7 +96,7 @@ static Option gamesOptions[] = { static void GL_Button (int n) { - int index, j; + int index; n = gamesOptions[n].value; // use marker in option rather than n itself, for more easy adding/deletng of buttons if (n == 6) { // close PopDown(GameListDlg); @@ -151,9 +151,9 @@ static int GameListCreate (char *name) { int new; - if(new = GenericPopUp(gamesOptions, name, GameListDlg, BoardWindow, NONMODAL, 1)) - AddHandler(&gamesOptions[1], 4), - AddHandler(&gamesOptions[0], 5); + if(new = GenericPopUp(gamesOptions, name, GameListDlg, BoardWindow, NONMODAL, appData.topLevel)) + AddHandler(&gamesOptions[1], GameListDlg, 4), + AddHandler(&gamesOptions[0], GameListDlg, 5); FocusOnWidget(&gamesOptions[0], GameListDlg); return new; } @@ -195,7 +195,7 @@ GameListPrepare (int byPos, int narrow) lg->position = pos; lg = (ListGame *) lg->node.succ; } -GetTimeMark(&t2);printf("GameListPrepare %ld msec\n", SubtractTimeMarks(&t2,&t)); + if(appData.debugMode) { GetTimeMark(&t2);printf("GameListPrepare %ld msec\n", SubtractTimeMarks(&t2,&t)); } DisplayTitle("XBoard"); *st = NULL; return listLength; @@ -205,7 +205,7 @@ static void GameListReplace (int page) { // filter: put in separate routine, to make callable from call-back - char buf[MSG_SIZ], *p, **st=list; + char buf[MSG_SIZ], **st=list; int i; if(page) *st++ = _("previous page"); else if(listLength > 1000) *st++ = ""; @@ -214,7 +214,7 @@ GameListReplace (int page) if(page + 1000 <= listLength) *st++ = _("next page"); *st = NULL; - LoadListBox(&gamesOptions[0], _("no games matched your request")); + LoadListBox(&gamesOptions[0], _("no games matched your request"), -1, -1); HighlightWithScroll(&gamesOptions[0], listEnd > 1000, listEnd); snprintf(buf, MSG_SIZ, _("%s - %d/%d games (%d-%d-%d)"), glc->filename, listLength, ((ListGame *) gameList.tailPred)->number, wins, losses, draws); SetDialogTitle(GameListDlg, buf); @@ -223,8 +223,6 @@ GameListReplace (int page) void GameListPopUp (FILE *fp, char *filename) { - char **st; - if (glc == NULL) { glc = (GameListClosure *) calloc(1, sizeof(GameListClosure)); glc->x = glc->y = -1; @@ -246,6 +244,12 @@ GameListPopUp (FILE *fp, char *filename) MarkMenu("View.GameList", GameListDlg); } +FILE * +GameFile () +{ + return glc ? glc->fp : NULL; +} + void GameListDestroy () { @@ -266,9 +270,6 @@ GameListDestroy () void ShowGameListProc () { - Arg args[16]; - int j; - if (glc == NULL) { DisplayError(_("There is no game list"), 0); return; @@ -277,7 +278,7 @@ ShowGameListProc () PopDown(GameListDlg); return; } - GenericPopUp(NULL, NULL, GameListDlg, BoardWindow, NONMODAL, 1); // first two args ignored when shell exists! + GenericPopUp(NULL, NULL, GameListDlg, BoardWindow, NONMODAL, appData.topLevel); // first two args ignored when shell exists! MarkMenu("View.GameList", GameListDlg); GameListHighlight(lastLoadGameNumber); } @@ -357,7 +358,7 @@ SaveGameListAsText (FILE *f) /* Copy the list into the global memory block */ if( f != NULL ) { - + lg = (ListGame *) gameList.head; for (nItem = 0; nItem < ((ListGame *) gameList.tailPred)->number; nItem++){ @@ -374,4 +375,3 @@ SaveGameListAsText (FILE *f) } return False; } -