2 * xgamelist.c -- Game list window, part of X front end for XBoard
4 * Copyright 1995, 2009, 2010, 2011 Free Software Foundation, Inc.
5 * ------------------------------------------------------------------------
7 * GNU XBoard is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or (at
10 * your option) any later version.
12 * GNU XBoard is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see http://www.gnu.org/licenses/. *
20 *------------------------------------------------------------------------
21 ** See the file ChangeLog for a revision history. */
28 #include <sys/types.h>
33 #else /* not STDC_HEADERS */
34 extern char *getenv();
37 # else /* not HAVE_STRING_H */
39 # endif /* not HAVE_STRING_H */
40 #endif /* not STDC_HEADERS */
46 #include <X11/Intrinsic.h>
47 #include <X11/StringDefs.h>
48 #include <X11/Shell.h>
49 #include <X11/cursorfont.h>
51 #include <X11/Xaw3d/Dialog.h>
52 #include <X11/Xaw3d/Form.h>
53 #include <X11/Xaw3d/List.h>
54 #include <X11/Xaw3d/Label.h>
55 #include <X11/Xaw3d/SimpleMenu.h>
56 #include <X11/Xaw3d/SmeBSB.h>
57 #include <X11/Xaw3d/SmeLine.h>
58 #include <X11/Xaw3d/Box.h>
59 #include <X11/Xaw3d/MenuButton.h>
60 #include <X11/Xaw3d/Text.h>
61 #include <X11/Xaw3d/AsciiText.h>
62 #include <X11/Xaw3d/Viewport.h>
64 #include <X11/Xaw/Dialog.h>
65 #include <X11/Xaw/Form.h>
66 #include <X11/Xaw/List.h>
67 #include <X11/Xaw/Label.h>
68 #include <X11/Xaw/SimpleMenu.h>
69 #include <X11/Xaw/SmeBSB.h>
70 #include <X11/Xaw/SmeLine.h>
71 #include <X11/Xaw/Box.h>
72 #include <X11/Xaw/MenuButton.h>
73 #include <X11/Xaw/Text.h>
74 #include <X11/Xaw/AsciiText.h>
75 #include <X11/Xaw/Viewport.h>
82 #include "xgamelist.h"
86 # define _(s) gettext (s)
87 # define N_(s) gettext_noop (s)
94 void SetFocus P((Widget w, XtPointer data, XEvent *event, Boolean *b));
96 static Widget filterText;
97 static char filterString[MSG_SIZ];
98 static int listLength, wins, losses, draws, page;
100 char gameListTranslations[] =
101 "<Btn1Up>(2): LoadSelectedProc(0) \n \
102 <Key>Home: LoadSelectedProc(-2) \n \
103 <Key>End: LoadSelectedProc(2) \n \
104 <Key>Up: LoadSelectedProc(-1) \n \
105 <Key>Down: LoadSelectedProc(1) \n \
106 <Key>Left: LoadSelectedProc(-1) \n \
107 <Key>Right: LoadSelectedProc(1) \n \
108 <Key>Return: LoadSelectedProc(0) \n";
109 char filterTranslations[] =
110 "<Key>Return: SetFilterProc() \n";
112 char *dummyList[] = { N_("no games matched your request"), NULL };
123 static GameListClosure *glc = NULL;
126 GameListCreate(name, callback, client_data)
128 XtCallbackProc callback;
129 XtPointer client_data;
132 Widget shell, form, viewport, listwidg, layout, label;
133 Widget b_load, b_loadprev, b_loadnext, b_close, b_filter;
136 GameListClosure *glc = (GameListClosure *) client_data;
139 XtSetArg(args[j], XtNwidth, &fw_width); j++;
140 XtGetValues(formWidget, args, j);
143 XtSetArg(args[j], XtNresizable, True); j++;
144 XtSetArg(args[j], XtNallowShellResize, True); j++;
146 shell = gameListShell =
147 XtCreatePopupShell(name, topLevelShellWidgetClass,
148 shellWidget, args, j);
150 shell = gameListShell =
151 XtCreatePopupShell(name, transientShellWidgetClass,
152 shellWidget, args, j);
155 XtCreateManagedWidget(layoutName, formWidgetClass, shell,
156 layoutArgs, XtNumber(layoutArgs));
158 XtSetArg(args[j], XtNborderWidth, 0); j++;
160 XtCreateManagedWidget("form", formWidgetClass, layout, args, j);
163 XtSetArg(args[j], XtNtop, XtChainTop); j++;
164 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
165 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
166 XtSetArg(args[j], XtNright, XtChainRight); j++;
167 XtSetArg(args[j], XtNresizable, False); j++;
168 XtSetArg(args[j], XtNwidth, fw_width); j++;
169 XtSetArg(args[j], XtNallowVert, True); j++;
171 XtCreateManagedWidget("viewport", viewportWidgetClass, form, args, j);
174 // XtSetArg(args[j], XtNlist, glc->strings); j++;
175 XtSetArg(args[j], XtNdefaultColumns, 1); j++;
176 XtSetArg(args[j], XtNforceColumns, True); j++;
177 XtSetArg(args[j], XtNverticalList, True); j++;
179 XtCreateManagedWidget("list", listWidgetClass, viewport, args, j);
180 XawListHighlight(listwidg, 0);
181 XtAugmentTranslations(listwidg,
182 XtParseTranslationTable(gameListTranslations));
185 XtSetArg(args[j], XtNfromVert, viewport); j++;
186 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
187 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
188 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
189 XtSetArg(args[j], XtNright, XtChainLeft); j++;
191 XtCreateManagedWidget(_("thresholds"), commandWidgetClass, form, args, j);
192 XtAddCallback(b_load, XtNcallback, callback, client_data);
195 XtSetArg(args[j], XtNfromVert, viewport); j++;
196 XtSetArg(args[j], XtNfromHoriz, b_load); j++;
197 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
198 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
199 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
200 XtSetArg(args[j], XtNright, XtChainLeft); j++;
202 XtCreateManagedWidget(_("find position"), commandWidgetClass, form, args, j);
203 XtAddCallback(b_loadprev, XtNcallback, callback, client_data);
206 XtSetArg(args[j], XtNfromVert, viewport); j++;
207 XtSetArg(args[j], XtNfromHoriz, b_loadprev); j++;
208 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
209 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
210 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
211 XtSetArg(args[j], XtNright, XtChainLeft); j++;
213 XtCreateManagedWidget(_("next"), commandWidgetClass, form, args, j);
214 XtAddCallback(b_loadnext, XtNcallback, callback, client_data);
216 b_loadnext = b_loadprev;
219 XtSetArg(args[j], XtNfromVert, viewport); j++;
220 XtSetArg(args[j], XtNfromHoriz, b_loadnext); j++;
221 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
222 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
223 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
224 XtSetArg(args[j], XtNright, XtChainLeft); j++;
226 XtCreateManagedWidget(_("close"), commandWidgetClass, form, args, j);
227 XtAddCallback(b_close, XtNcallback, callback, client_data);
230 XtSetArg(args[j], XtNfromVert, viewport); j++;
231 XtSetArg(args[j], XtNfromHoriz, b_close); j++;
232 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
233 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
234 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
235 XtSetArg(args[j], XtNright, XtChainLeft); j++;
236 XtSetArg(args[j], XtNborderWidth, 0); j++;
238 XtCreateManagedWidget(_("Filter:"), labelWidgetClass, form, args, j);
241 XtSetArg(args[j], XtNfromVert, viewport); j++;
242 XtSetArg(args[j], XtNfromHoriz, label); j++;
243 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
244 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
245 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
246 XtSetArg(args[j], XtNright, XtChainRight); j++;
247 XtSetArg(args[j], XtNwidth, fw_width - 275 - squareSize); j++;
248 XtSetArg(args[j], XtNstring, filterString); j++;
249 XtSetArg(args[j], XtNdisplayCaret, False); j++;
250 XtSetArg(args[j], XtNresizable, True); j++;
251 // XtSetArg(args[j], XtNwidth, bw_width); j++; /*force wider than buttons*/
252 /* !!Work around an apparent bug in XFree86 4.0.1 (X11R6.4.3) */
253 XtSetArg(args[j], XtNeditType, XawtextEdit); j++;
254 XtSetArg(args[j], XtNuseStringInPlace, False); j++;
256 XtCreateManagedWidget(_("filtertext"), asciiTextWidgetClass, form, args, j);
257 XtAddEventHandler(filterText, ButtonPressMask, False, SetFocus, (XtPointer) shell);
258 XtOverrideTranslations(filterText,
259 XtParseTranslationTable(filterTranslations));
262 XtSetArg(args[j], XtNfromVert, viewport); j++;
263 XtSetArg(args[j], XtNfromHoriz, filterText); j++;
264 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
265 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
266 XtSetArg(args[j], XtNleft, XtChainRight); j++;
267 XtSetArg(args[j], XtNright, XtChainRight); j++;
269 XtCreateManagedWidget(_("apply"), commandWidgetClass, form, args, j);
270 XtAddCallback(b_filter, XtNcallback, callback, client_data);
273 if(wpGameList.width > 0) {
274 glc->x = wpGameList.x;
275 glc->y = wpGameList.y;
276 glc->w = wpGameList.width;
277 glc->h = wpGameList.height;
287 XtSetArg(args[j], XtNheight, &h1); j++;
288 XtSetArg(args[j], XtNy, &y1); j++;
289 XtGetValues(boardWidget, args, j);
290 glc->w = fw_width * 3/4;
291 glc->h = squareSize * 3;
293 XSync(xDisplay, False);
295 /* This code seems to tickle an X bug if it is executed too soon
296 after xboard starts up. The coordinates get transformed as if
297 the main window was positioned at (0, 0).
299 XtTranslateCoords(shellWidget, (fw_width - glc->w) / 2,
300 y1 + (h1 - glc->h + appData.borderYoffset) / 2,
303 XTranslateCoordinates(xDisplay, XtWindow(shellWidget),
304 RootWindowOfScreen(XtScreen(shellWidget)),
305 (fw_width - glc->w) / 2,
306 y1 + (h1 - glc->h + appData.borderYoffset) / 2,
311 if (glc->y < 0) glc->y = 0; /*avoid positioning top offscreen*/
314 XtSetArg(args[j], XtNheight, glc->h); j++;
315 XtSetArg(args[j], XtNwidth, glc->w); j++;
316 XtSetArg(args[j], XtNx, glc->x - appData.borderXoffset); j++;
317 XtSetArg(args[j], XtNy, glc->y - appData.borderYoffset); j++;
318 XtSetValues(shell, args, j);
320 XtRealizeWidget(shell);
321 CatchDeleteWindow(shell, "GameListPopDown");
322 XtSetKeyboardFocus(shell, listwidg);
328 GameListPrepare(int byPos)
329 { // [HGM] filter: put in separate routine, to make callable from call-back
334 if(st = glc->strings) while(*st) free(*st++);
335 nstrings = ((ListGame *) gameList.tailPred)->number;
336 glc->strings = (char **) malloc((nstrings + 1) * sizeof(char *));
338 lg = (ListGame *) gameList.head;
339 listLength = wins = losses = draws = 0;
342 line = GameListLine(lg->number, &lg->gameInfo);
343 if((filterString[0] == NULLCHAR || SearchPattern( line, filterString )) && (!byPos || (pos=GameContainsPosition(glc->fp, lg)) >= 0) ) {
344 *st++ = line; // [HGM] filter: make adding line conditional.
346 if( lg->gameInfo.result == WhiteWins ) wins++; else
347 if( lg->gameInfo.result == BlackWins ) losses++; else
348 if( lg->gameInfo.result == GameIsDrawn ) draws++;
350 if(lg->number % 2000 == 0) {
352 snprintf(buf, MSG_SIZ, _("Scanning through games (%d)"), lg->number);
356 lg = (ListGame *) lg->node.succ;
358 DisplayTitle("XBoard");
363 static char *list[1003];
366 GameListReplace(int page)
368 // filter: put in separate routine, to make callable from call-back
371 char buf[MSG_SIZ], *p, **st=list;
374 if(page) *st++ = _("previous page"); else if(listLength > 1000) *st++ = "";
375 for(i=0; i<1000; i++) if( !(*st++ = glc->strings[page+i]) ) break;
376 if(page + 1000 <= listLength) *st++ = _("next page");
379 listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
380 XtSetArg(arg, XtNlist, listLength ? list : dummyList); // empty list displays message
381 XawListChange(listwidg, list, 0, 0, True);
382 XtSetValues(listwidg, &arg, 1);
383 XawListHighlight(listwidg, 0);
384 snprintf(buf, MSG_SIZ, "%s- %d/%d games (%d-%d-%d)", glc->filename, listLength, ((ListGame *) gameList.tailPred)->number, wins, losses, draws);
385 XtSetArg(arg, XtNtitle, buf);
386 XtSetValues(glc->shell, &arg, 1);
390 GameListCallback(w, client_data, call_data)
392 XtPointer client_data, call_data;
398 GameListClosure *glc = (GameListClosure *) client_data;
399 XawListReturnStruct *rs;
403 XtSetArg(args[j], XtNlabel, &name); j++;
404 XtGetValues(w, args, j);
406 if (strcmp(name, _("close")) == 0) {
410 if (strcmp(name, _("thresholds")) == 0) {
414 listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
415 rs = XawListShowCurrent(listwidg);
416 if (strcmp(name, _("load")) == 0) {
417 index = rs->list_index;
419 DisplayError(_("No game selected"), 0);
422 } else if (strcmp(name, _("next")) == 0) {
423 index = rs->list_index + 1;
424 if (index >= listLength || !list[index]) {
425 DisplayError(_("Can't go forward any further"), 0);
428 XawListHighlight(listwidg, index);
429 } else if (strcmp(name, _("prev")) == 0) {
430 index = rs->list_index - 1;
432 DisplayError(_("Can't back up any further"), 0);
435 XawListHighlight(listwidg, index);
436 } else if (strcmp(name, _("apply")) == 0 ||
437 strcmp(name, _("find position")) == 0) {
440 XtSetArg(args[j], XtNstring, &text); j++;
441 XtGetValues(filterText, args, j);
442 safeStrCpy(filterString, text, sizeof(filterString)/sizeof(filterString[0]));
443 XawListHighlight(listwidg, 0);
444 GameListPrepare(strcmp(name, _("find position")) == 0); GameListReplace(0);
448 index = atoi(list[index])-1; // [HGM] filter: read true index from sequence nr of line
449 if (cmailMsgLoaded) {
450 CmailLoadGame(glc->fp, index + 1, glc->filename, True);
452 LoadGame(glc->fp, index + 1, glc->filename, True);
455 printf("This code should have been unreachable. Please report bug!\n");
460 GameListPopUp(fp, filename)
469 glc = (GameListClosure *) calloc(1, sizeof(GameListClosure));
470 glc->x = glc->y = -1;
473 GameListPrepare(False); // [HGM] filter: code put in separate routine
477 if (glc->filename != NULL) free(glc->filename);
478 glc->filename = StrSave(filename);
481 if (glc->shell == NULL) {
482 glc->shell = GameListCreate(filename, GameListCallback, glc);
485 XtSetArg(args[j], XtNiconName, (XtArgVal) filename); j++;
486 // XtSetArg(args[j], XtNtitle, (XtArgVal) filename); j++;
487 XtSetValues(glc->shell, args, j);
490 GameListReplace(0); // [HGM] filter: code put in separate routine, and also called to set title
492 XtPopup(glc->shell, XtGrabNone);
495 XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++;
496 XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Game List"),
503 if (glc == NULL) return;
505 if (glc->strings != NULL) {
518 ShowGameListProc(w, event, prms, nprms)
528 DisplayError(_("There is no game list"), 0);
535 XtPopup(glc->shell, XtGrabNone);
538 XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++;
539 XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Game List"),
541 GameListHighlight(lastLoadGameNumber);
545 LoadSelectedProc(w, event, prms, nprms)
552 XawListReturnStruct *rs;
553 int index, direction = atoi(prms[0]);
555 if (glc == NULL || listLength == 0) return;
556 listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
557 rs = XawListShowCurrent(listwidg);
558 index = rs->list_index;
559 if (index < 0) return;
560 if(page && index == 0) {
562 if(page < 0) page = 0; // safety
563 GameListReplace(page);
568 GameListReplace(page);
574 if(direction == -2) index = 0;
575 if(direction == 2) index = listLength-1;
576 if(index < 0 || index >= listLength) return;
577 XawListHighlight(listwidg, index);
580 index = atoi(list[index])-1; // [HGM] filter: read true index from sequence nr of line
581 if (cmailMsgLoaded) {
582 CmailLoadGame(glc->fp, index + 1, glc->filename, True);
584 LoadGame(glc->fp, index + 1, glc->filename, True);
589 SetFilterProc(w, event, prms, nprms)
599 XtSetArg(args[j], XtNstring, &name); j++;
600 XtGetValues(filterText, args, j);
601 safeStrCpy(filterString, name, sizeof(filterString)/sizeof(filterString[0]));
602 GameListPrepare(False); GameListReplace(0);
603 list = XtNameToWidget(glc->shell, "*form.viewport.list");
604 XawListHighlight(list, 0);
606 XtSetArg(args[j], XtNdisplayCaret, False); j++;
607 XtSetValues(filterText, args, j);
608 XtSetKeyboardFocus(glc->shell, list);
617 if (glc == NULL) return;
619 XtSetArg(args[j], XtNx, &glc->x); j++;
620 XtSetArg(args[j], XtNy, &glc->y); j++;
621 XtSetArg(args[j], XtNheight, &glc->h); j++;
622 XtSetArg(args[j], XtNwidth, &glc->w); j++;
623 XtGetValues(glc->shell, args, j);
624 wpGameList.x = glc->x - 4;
625 wpGameList.y = glc->y - 23;
626 wpGameList.width = glc->w;
627 wpGameList.height = glc->h;
628 XtPopdown(glc->shell);
629 XtSetKeyboardFocus(shellWidget, formWidget);
632 XtSetArg(args[j], XtNleftBitmap, None); j++;
633 XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Game List"),
638 GameListHighlight(index)
643 if (glc == NULL || !glc->up) return;
644 listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
646 while(*st && atoi(*st)<index) st++,i++;
647 XawListHighlight(listwidg, i);
653 return glc && glc->up;
656 int SaveGameListAsText(FILE *f)
658 ListGame * lg = (ListGame *) gameList.head;
661 if( !glc || ((ListGame *) gameList.tailPred)->number <= 0 ) {
662 DisplayError("Game list not loaded or empty", 0);
666 /* Copy the list into the global memory block */
669 lg = (ListGame *) gameList.head;
671 for (nItem = 0; nItem < ((ListGame *) gameList.tailPred)->number; nItem++){
672 char * st = GameListLineFull(lg->number, &lg->gameInfo);
673 char *line = GameListLine(lg->number, &lg->gameInfo);
674 if(filterString[0] == NULLCHAR || SearchPattern( line, filterString ) )
675 fprintf( f, "%s\n", st );
676 free(st); free(line);
677 lg = (ListGame *) lg->node.succ;
685 //--------------------------------- Game-List options dialog ------------------------------------------
687 Widget gameListOptShell, listwidg;
698 void GLT_AddToList(char *name)
700 strings[stringPtr++] = name;
701 strings[stringPtr] = NULL;
704 Boolean GLT_GetFromList(int index, char *name)
706 safeStrCpy(name, strings[index], MSG_SIZ);
710 void GLT_DeSelectList()
712 XawListChange(listwidg, strings, 0, 0, True);
713 XawListHighlight(listwidg, 0);
717 GameListOptionsPopDown()
719 if (gameListOptShell == NULL) return;
721 XtPopdown(gameListOptShell);
722 XtDestroyWidget(gameListOptShell);
723 gameListOptShell = 0;
724 XtSetKeyboardFocus(shellWidget, formWidget);
728 GameListOptionsCallback(w, client_data, call_data)
730 XtPointer client_data, call_data;
736 XawListReturnStruct *rs;
741 XtSetArg(args[j], XtNlabel, &name); j++;
742 XtGetValues(w, args, j);
744 if (strcmp(name, _("OK")) == 0) {
746 appData.gameListTags = strdup(lpUserGLT);
747 GameListOptionsPopDown();
750 if (strcmp(name, _("cancel")) == 0) {
751 GameListOptionsPopDown();
754 listwidg = XtNameToWidget(gameListOptShell, "*form.list");
755 rs = XawListShowCurrent(listwidg);
756 index = rs->list_index;
758 DisplayError(_("No tag selected"), 0);
762 if (strcmp(name, _("down")) == 0) {
763 if(index >= strlen(GLT_ALL_TAGS)) return;
764 strings[index] = strings[index+1];
765 strings[++index] = p;
767 if (strcmp(name, _("up")) == 0) {
768 if(index == 0) return;
769 strings[index] = strings[index-1];
770 strings[--index] = p;
772 if (strcmp(name, _("factory")) == 0) {
773 safeStrCpy(lpUserGLT, GLT_DEFAULT_TAGS, LPUSERGLT_SIZE);
774 GLT_TagsToList(lpUserGLT);
777 XawListHighlight(listwidg, index);
781 GameListOptionsCreate()
784 Widget shell, form, viewport, layout;
785 Widget b_load, b_loadprev, b_loadnext, b_close, b_cancel;
787 XtPointer client_data = NULL;
791 XtSetArg(args[j], XtNwidth, &fw_width); j++;
792 XtGetValues(formWidget, args, j);
795 XtSetArg(args[j], XtNresizable, True); j++;
796 XtSetArg(args[j], XtNallowShellResize, True); j++;
797 shell = gameListOptShell =
798 XtCreatePopupShell("Game-list options", transientShellWidgetClass,
799 shellWidget, args, j);
801 XtCreateManagedWidget(layoutName, formWidgetClass, shell,
802 layoutArgs, XtNumber(layoutArgs));
804 XtSetArg(args[j], XtNborderWidth, 0); j++;
806 XtCreateManagedWidget("form", formWidgetClass, layout, args, j);
809 XtSetArg(args[j], XtNdefaultColumns, 1); j++;
810 XtSetArg(args[j], XtNforceColumns, True); j++;
811 XtSetArg(args[j], XtNverticalList, True); j++;
812 listwidg = viewport =
813 XtCreateManagedWidget("list", listWidgetClass, form, args, j);
814 XawListHighlight(listwidg, 0);
815 // XtAugmentTranslations(listwidg,
816 // XtParseTranslationTable(gameListOptTranslations));
819 XtSetArg(args[j], XtNfromVert, viewport); j++;
820 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
821 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
822 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
823 XtSetArg(args[j], XtNright, XtChainLeft); j++;
825 XtCreateManagedWidget(_("factory"), commandWidgetClass, form, args, j);
826 XtAddCallback(b_load, XtNcallback, GameListOptionsCallback, client_data);
829 XtSetArg(args[j], XtNfromVert, viewport); j++;
830 XtSetArg(args[j], XtNfromHoriz, b_load); j++;
831 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
832 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
833 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
834 XtSetArg(args[j], XtNright, XtChainLeft); j++;
836 XtCreateManagedWidget(_("up"), commandWidgetClass, form, args, j);
837 XtAddCallback(b_loadprev, XtNcallback, GameListOptionsCallback, client_data);
840 XtSetArg(args[j], XtNfromVert, viewport); j++;
841 XtSetArg(args[j], XtNfromHoriz, b_loadprev); j++;
842 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
843 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
844 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
845 XtSetArg(args[j], XtNright, XtChainLeft); j++;
847 XtCreateManagedWidget(_("down"), commandWidgetClass, form, args, j);
848 XtAddCallback(b_loadnext, XtNcallback, GameListOptionsCallback, client_data);
851 XtSetArg(args[j], XtNfromVert, viewport); j++;
852 XtSetArg(args[j], XtNfromHoriz, b_loadnext); j++;
853 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
854 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
855 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
856 XtSetArg(args[j], XtNright, XtChainLeft); j++;
858 XtCreateManagedWidget(_("cancel"), commandWidgetClass, form, args, j);
859 XtAddCallback(b_cancel, XtNcallback, GameListOptionsCallback, client_data);
862 XtSetArg(args[j], XtNfromVert, viewport); j++;
863 XtSetArg(args[j], XtNfromHoriz, b_cancel); j++;
864 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
865 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
866 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
867 XtSetArg(args[j], XtNright, XtChainLeft); j++;
869 XtCreateManagedWidget(_("OK"), commandWidgetClass, form, args, j);
870 XtAddCallback(b_close, XtNcallback, GameListOptionsCallback, client_data);
872 safeStrCpy(lpUserGLT, appData.gameListTags, LPUSERGLT_SIZE);
873 GLT_TagsToList(lpUserGLT);
875 XtRealizeWidget(shell);
876 CatchDeleteWindow(shell, "GameListOptionsPopDown");
882 GameListOptionsPopUp(Widget w, XEvent *event, String *prms, Cardinal *nprms)
884 if (gameListOptShell == NULL)
885 gameListOptShell = GameListOptionsCreate();
887 XtPopup(gameListOptShell, XtGrabNone);