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 Ctrl<Key>Up: LoadSelectedProc(-3) \n \
105 Ctrl<Key>Down: LoadSelectedProc(3) \n \
106 <Key>Up: LoadSelectedProc(-1) \n \
107 <Key>Down: LoadSelectedProc(1) \n \
108 <Key>Left: LoadSelectedProc(-1) \n \
109 <Key>Right: LoadSelectedProc(1) \n \
110 <Key>Return: LoadSelectedProc(0) \n";
111 char filterTranslations[] =
112 "<Key>Return: SetFilterProc() \n";
114 char *dummyList[] = { N_("no games matched your request"), NULL };
125 static GameListClosure *glc = NULL;
128 GameListCreate(name, callback, client_data)
130 XtCallbackProc callback;
131 XtPointer client_data;
134 Widget shell, form, viewport, listwidg, layout, label;
135 Widget b_load, b_loadprev, b_loadnext, b_close, b_filter;
138 GameListClosure *glc = (GameListClosure *) client_data;
141 XtSetArg(args[j], XtNwidth, &fw_width); j++;
142 XtGetValues(formWidget, args, j);
145 XtSetArg(args[j], XtNresizable, True); j++;
146 XtSetArg(args[j], XtNallowShellResize, True); j++;
148 shell = gameListShell =
149 XtCreatePopupShell(name, topLevelShellWidgetClass,
150 shellWidget, args, j);
152 shell = gameListShell =
153 XtCreatePopupShell(name, transientShellWidgetClass,
154 shellWidget, args, j);
157 XtCreateManagedWidget(layoutName, formWidgetClass, shell,
158 layoutArgs, XtNumber(layoutArgs));
160 XtSetArg(args[j], XtNborderWidth, 0); j++;
162 XtCreateManagedWidget("form", formWidgetClass, layout, args, j);
165 XtSetArg(args[j], XtNtop, XtChainTop); j++;
166 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
167 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
168 XtSetArg(args[j], XtNright, XtChainRight); j++;
169 XtSetArg(args[j], XtNresizable, False); j++;
170 XtSetArg(args[j], XtNwidth, fw_width); j++;
171 XtSetArg(args[j], XtNallowVert, True); j++;
173 XtCreateManagedWidget("viewport", viewportWidgetClass, form, args, j);
176 // XtSetArg(args[j], XtNlist, glc->strings); j++;
177 XtSetArg(args[j], XtNdefaultColumns, 1); j++;
178 XtSetArg(args[j], XtNforceColumns, True); j++;
179 XtSetArg(args[j], XtNverticalList, True); j++;
181 XtCreateManagedWidget("list", listWidgetClass, viewport, args, j);
182 XawListHighlight(listwidg, 0);
183 XtAugmentTranslations(listwidg,
184 XtParseTranslationTable(gameListTranslations));
187 XtSetArg(args[j], XtNfromVert, viewport); j++;
188 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
189 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
190 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
191 XtSetArg(args[j], XtNright, XtChainLeft); j++;
193 XtCreateManagedWidget(_("thresholds"), commandWidgetClass, form, args, j);
194 XtAddCallback(b_load, XtNcallback, callback, client_data);
197 XtSetArg(args[j], XtNfromVert, viewport); j++;
198 XtSetArg(args[j], XtNfromHoriz, b_load); j++;
199 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
200 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
201 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
202 XtSetArg(args[j], XtNright, XtChainLeft); j++;
204 XtCreateManagedWidget(_("find position"), commandWidgetClass, form, args, j);
205 XtAddCallback(b_loadprev, XtNcallback, callback, client_data);
208 XtSetArg(args[j], XtNfromVert, viewport); j++;
209 XtSetArg(args[j], XtNfromHoriz, b_loadprev); j++;
210 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
211 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
212 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
213 XtSetArg(args[j], XtNright, XtChainLeft); j++;
215 XtCreateManagedWidget(_("next"), commandWidgetClass, form, args, j);
216 XtAddCallback(b_loadnext, XtNcallback, callback, client_data);
218 b_loadnext = b_loadprev;
221 XtSetArg(args[j], XtNfromVert, viewport); j++;
222 XtSetArg(args[j], XtNfromHoriz, b_loadnext); j++;
223 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
224 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
225 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
226 XtSetArg(args[j], XtNright, XtChainLeft); j++;
228 XtCreateManagedWidget(_("close"), commandWidgetClass, form, args, j);
229 XtAddCallback(b_close, XtNcallback, callback, client_data);
232 XtSetArg(args[j], XtNfromVert, viewport); j++;
233 XtSetArg(args[j], XtNfromHoriz, b_close); j++;
234 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
235 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
236 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
237 XtSetArg(args[j], XtNright, XtChainLeft); j++;
238 XtSetArg(args[j], XtNborderWidth, 0); j++;
240 XtCreateManagedWidget(_("Filter:"), labelWidgetClass, form, args, j);
243 XtSetArg(args[j], XtNfromVert, viewport); j++;
244 XtSetArg(args[j], XtNfromHoriz, label); j++;
245 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
246 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
247 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
248 XtSetArg(args[j], XtNright, XtChainRight); j++;
249 XtSetArg(args[j], XtNwidth, fw_width - 275 - squareSize); j++;
250 XtSetArg(args[j], XtNstring, filterString); j++;
251 XtSetArg(args[j], XtNdisplayCaret, False); j++;
252 XtSetArg(args[j], XtNresizable, True); j++;
253 // XtSetArg(args[j], XtNwidth, bw_width); j++; /*force wider than buttons*/
254 /* !!Work around an apparent bug in XFree86 4.0.1 (X11R6.4.3) */
255 XtSetArg(args[j], XtNeditType, XawtextEdit); j++;
256 XtSetArg(args[j], XtNuseStringInPlace, False); j++;
258 XtCreateManagedWidget(_("filtertext"), asciiTextWidgetClass, form, args, j);
259 XtAddEventHandler(filterText, ButtonPressMask, False, SetFocus, (XtPointer) shell);
260 XtOverrideTranslations(filterText,
261 XtParseTranslationTable(filterTranslations));
264 XtSetArg(args[j], XtNfromVert, viewport); j++;
265 XtSetArg(args[j], XtNfromHoriz, filterText); j++;
266 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
267 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
268 XtSetArg(args[j], XtNleft, XtChainRight); j++;
269 XtSetArg(args[j], XtNright, XtChainRight); j++;
271 XtCreateManagedWidget(_("apply"), commandWidgetClass, form, args, j);
272 XtAddCallback(b_filter, XtNcallback, callback, client_data);
275 if(wpGameList.width > 0) {
276 glc->x = wpGameList.x;
277 glc->y = wpGameList.y;
278 glc->w = wpGameList.width;
279 glc->h = wpGameList.height;
289 XtSetArg(args[j], XtNheight, &h1); j++;
290 XtSetArg(args[j], XtNy, &y1); j++;
291 XtGetValues(boardWidget, args, j);
292 glc->w = fw_width * 3/4;
293 glc->h = squareSize * 3;
295 XSync(xDisplay, False);
297 /* This code seems to tickle an X bug if it is executed too soon
298 after xboard starts up. The coordinates get transformed as if
299 the main window was positioned at (0, 0).
301 XtTranslateCoords(shellWidget, (fw_width - glc->w) / 2,
302 y1 + (h1 - glc->h + appData.borderYoffset) / 2,
305 XTranslateCoordinates(xDisplay, XtWindow(shellWidget),
306 RootWindowOfScreen(XtScreen(shellWidget)),
307 (fw_width - glc->w) / 2,
308 y1 + (h1 - glc->h + appData.borderYoffset) / 2,
313 if (glc->y < 0) glc->y = 0; /*avoid positioning top offscreen*/
316 XtSetArg(args[j], XtNheight, glc->h); j++;
317 XtSetArg(args[j], XtNwidth, glc->w); j++;
318 XtSetArg(args[j], XtNx, glc->x - appData.borderXoffset); j++;
319 XtSetArg(args[j], XtNy, glc->y - appData.borderYoffset); j++;
320 XtSetValues(shell, args, j);
322 XtRealizeWidget(shell);
323 CatchDeleteWindow(shell, "GameListPopDown");
324 XtSetKeyboardFocus(shell, listwidg);
330 GameListPrepare(int byPos)
331 { // [HGM] filter: put in separate routine, to make callable from call-back
336 if(st = glc->strings) while(*st) free(*st++);
337 nstrings = ((ListGame *) gameList.tailPred)->number;
338 glc->strings = (char **) malloc((nstrings + 1) * sizeof(char *));
340 lg = (ListGame *) gameList.head;
341 listLength = wins = losses = draws = 0;
344 line = GameListLine(lg->number, &lg->gameInfo);
345 if((filterString[0] == NULLCHAR || SearchPattern( line, filterString )) && (!byPos || (pos=GameContainsPosition(glc->fp, lg)) >= 0) ) {
346 *st++ = line; // [HGM] filter: make adding line conditional.
348 if( lg->gameInfo.result == WhiteWins ) wins++; else
349 if( lg->gameInfo.result == BlackWins ) losses++; else
350 if( lg->gameInfo.result == GameIsDrawn ) draws++;
352 if(lg->number % 2000 == 0) {
354 snprintf(buf, MSG_SIZ, _("Scanning through games (%d)"), lg->number);
358 lg = (ListGame *) lg->node.succ;
360 DisplayTitle("XBoard");
365 static char *list[1003];
369 GameListReplace(int page)
371 // filter: put in separate routine, to make callable from call-back
374 char buf[MSG_SIZ], *p, **st=list;
377 if(page) *st++ = _("previous page"); else if(listLength > 1000) *st++ = "";
378 for(i=0; i<1000; i++) if( !(*st++ = glc->strings[page+i]) ) { st--; break; }
380 if(page + 1000 <= listLength) *st++ = _("next page");
383 listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
384 XtSetArg(arg, XtNlist, listLength ? list : dummyList); // empty list displays message
385 XawListChange(listwidg, list, 0, 0, True);
386 XtSetValues(listwidg, &arg, 1);
387 XawListHighlight(listwidg, 0);
388 snprintf(buf, MSG_SIZ, "%s- %d/%d games (%d-%d-%d)", glc->filename, listLength, ((ListGame *) gameList.tailPred)->number, wins, losses, draws);
389 XtSetArg(arg, XtNtitle, buf);
390 XtSetValues(glc->shell, &arg, 1);
394 GameListCallback(w, client_data, call_data)
396 XtPointer client_data, call_data;
402 GameListClosure *glc = (GameListClosure *) client_data;
403 XawListReturnStruct *rs;
407 XtSetArg(args[j], XtNlabel, &name); j++;
408 XtGetValues(w, args, j);
410 if (strcmp(name, _("close")) == 0) {
414 if (strcmp(name, _("thresholds")) == 0) {
418 listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
419 rs = XawListShowCurrent(listwidg);
420 if (strcmp(name, _("load")) == 0) {
421 index = rs->list_index;
423 DisplayError(_("No game selected"), 0);
426 } else if (strcmp(name, _("next")) == 0) {
427 index = rs->list_index + 1;
428 if (index >= listLength || !list[index]) {
429 DisplayError(_("Can't go forward any further"), 0);
432 XawListHighlight(listwidg, index);
433 } else if (strcmp(name, _("prev")) == 0) {
434 index = rs->list_index - 1;
436 DisplayError(_("Can't back up any further"), 0);
439 XawListHighlight(listwidg, index);
440 } else if (strcmp(name, _("apply")) == 0 ||
441 strcmp(name, _("find position")) == 0) {
444 XtSetArg(args[j], XtNstring, &text); j++;
445 XtGetValues(filterText, args, j);
446 safeStrCpy(filterString, text, sizeof(filterString)/sizeof(filterString[0]));
447 XawListHighlight(listwidg, 0);
448 GameListPrepare(strcmp(name, _("find position")) == 0); GameListReplace(0);
452 index = atoi(list[index])-1; // [HGM] filter: read true index from sequence nr of line
453 if (cmailMsgLoaded) {
454 CmailLoadGame(glc->fp, index + 1, glc->filename, True);
456 LoadGame(glc->fp, index + 1, glc->filename, True);
459 printf("This code should have been unreachable. Please report bug!\n");
464 GameListPopUp(fp, filename)
473 glc = (GameListClosure *) calloc(1, sizeof(GameListClosure));
474 glc->x = glc->y = -1;
477 GameListPrepare(False); // [HGM] filter: code put in separate routine
481 if (glc->filename != NULL) free(glc->filename);
482 glc->filename = StrSave(filename);
485 if (glc->shell == NULL) {
486 glc->shell = GameListCreate(filename, GameListCallback, glc);
489 XtSetArg(args[j], XtNiconName, (XtArgVal) filename); j++;
490 // XtSetArg(args[j], XtNtitle, (XtArgVal) filename); j++;
491 XtSetValues(glc->shell, args, j);
494 GameListReplace(0); // [HGM] filter: code put in separate routine, and also called to set title
496 XtPopup(glc->shell, XtGrabNone);
499 XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++;
500 XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Game List"),
507 if (glc == NULL) return;
509 if (glc->strings != NULL) {
522 ShowGameListProc(w, event, prms, nprms)
532 DisplayError(_("There is no game list"), 0);
539 XtPopup(glc->shell, XtGrabNone);
542 XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++;
543 XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Game List"),
545 GameListHighlight(lastLoadGameNumber);
549 LoadSelectedProc(w, event, prms, nprms)
556 XawListReturnStruct *rs;
557 int index, direction = atoi(prms[0]);
559 if (glc == NULL || listLength == 0) return;
560 listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
561 rs = XawListShowCurrent(listwidg);
562 index = rs->list_index;
563 if (index < 0) return;
564 if(page && index == 0) {
566 if(page < 0) page = 0; // safety
567 GameListReplace(page);
572 GameListReplace(page);
577 int doLoad = abs(direction) > 2;
578 if(doLoad) direction /= 3;
580 if(direction == -2) index = 0;
581 if(direction == 2) index = listEnd-1;
582 if(index < 0 || index >= listEnd) return;
583 XawListHighlight(listwidg, index);
586 index = atoi(list[index])-1; // [HGM] filter: read true index from sequence nr of line
587 if (cmailMsgLoaded) {
588 CmailLoadGame(glc->fp, index + 1, glc->filename, True);
590 LoadGame(glc->fp, index + 1, glc->filename, True);
591 XSync(xDisplay, False);
592 XSetInputFocus(xDisplay, XtWindow(boardWidget), RevertToPointerRoot, CurrentTime);
597 SetFilterProc(w, event, prms, nprms)
607 XtSetArg(args[j], XtNstring, &name); j++;
608 XtGetValues(filterText, args, j);
609 safeStrCpy(filterString, name, sizeof(filterString)/sizeof(filterString[0]));
610 GameListPrepare(False); GameListReplace(0);
611 list = XtNameToWidget(glc->shell, "*form.viewport.list");
612 XawListHighlight(list, 0);
614 XtSetArg(args[j], XtNdisplayCaret, False); j++;
615 XtSetValues(filterText, args, j);
616 XtSetKeyboardFocus(glc->shell, list);
625 if (glc == NULL) return;
627 XtSetArg(args[j], XtNx, &glc->x); j++;
628 XtSetArg(args[j], XtNy, &glc->y); j++;
629 XtSetArg(args[j], XtNheight, &glc->h); j++;
630 XtSetArg(args[j], XtNwidth, &glc->w); j++;
631 XtGetValues(glc->shell, args, j);
632 wpGameList.x = glc->x - 4;
633 wpGameList.y = glc->y - 23;
634 wpGameList.width = glc->w;
635 wpGameList.height = glc->h;
636 XtPopdown(glc->shell);
637 XtSetKeyboardFocus(shellWidget, formWidget);
640 XtSetArg(args[j], XtNleftBitmap, None); j++;
641 XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Game List"),
646 GameListHighlight(index)
651 if (glc == NULL || !glc->up) return;
652 listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
654 while(*st && atoi(*st)<index) st++,i++;
655 XawListHighlight(listwidg, i);
661 return glc && glc->up;
664 int SaveGameListAsText(FILE *f)
666 ListGame * lg = (ListGame *) gameList.head;
669 if( !glc || ((ListGame *) gameList.tailPred)->number <= 0 ) {
670 DisplayError("Game list not loaded or empty", 0);
674 /* Copy the list into the global memory block */
677 lg = (ListGame *) gameList.head;
679 for (nItem = 0; nItem < ((ListGame *) gameList.tailPred)->number; nItem++){
680 char * st = GameListLineFull(lg->number, &lg->gameInfo);
681 char *line = GameListLine(lg->number, &lg->gameInfo);
682 if(filterString[0] == NULLCHAR || SearchPattern( line, filterString ) )
683 fprintf( f, "%s\n", st );
684 free(st); free(line);
685 lg = (ListGame *) lg->node.succ;
693 //--------------------------------- Game-List options dialog ------------------------------------------
695 Widget gameListOptShell, listwidg;
706 void GLT_AddToList(char *name)
708 strings[stringPtr++] = name;
709 strings[stringPtr] = NULL;
712 Boolean GLT_GetFromList(int index, char *name)
714 safeStrCpy(name, strings[index], MSG_SIZ);
718 void GLT_DeSelectList()
720 XawListChange(listwidg, strings, 0, 0, True);
721 XawListHighlight(listwidg, 0);
725 GameListOptionsPopDown()
727 if (gameListOptShell == NULL) return;
729 XtPopdown(gameListOptShell);
730 XtDestroyWidget(gameListOptShell);
731 gameListOptShell = 0;
732 XtSetKeyboardFocus(shellWidget, formWidget);
736 GameListOptionsCallback(w, client_data, call_data)
738 XtPointer client_data, call_data;
744 XawListReturnStruct *rs;
749 XtSetArg(args[j], XtNlabel, &name); j++;
750 XtGetValues(w, args, j);
752 if (strcmp(name, _("OK")) == 0) {
754 appData.gameListTags = strdup(lpUserGLT);
755 GameListOptionsPopDown();
758 if (strcmp(name, _("cancel")) == 0) {
759 GameListOptionsPopDown();
762 listwidg = XtNameToWidget(gameListOptShell, "*form.list");
763 rs = XawListShowCurrent(listwidg);
764 index = rs->list_index;
766 DisplayError(_("No tag selected"), 0);
770 if (strcmp(name, _("down")) == 0) {
771 if(index >= strlen(GLT_ALL_TAGS)) return;
772 strings[index] = strings[index+1];
773 strings[++index] = p;
775 if (strcmp(name, _("up")) == 0) {
776 if(index == 0) return;
777 strings[index] = strings[index-1];
778 strings[--index] = p;
780 if (strcmp(name, _("factory")) == 0) {
781 safeStrCpy(lpUserGLT, GLT_DEFAULT_TAGS, LPUSERGLT_SIZE);
782 GLT_TagsToList(lpUserGLT);
785 XawListHighlight(listwidg, index);
789 GameListOptionsCreate()
792 Widget shell, form, viewport, layout;
793 Widget b_load, b_loadprev, b_loadnext, b_close, b_cancel;
795 XtPointer client_data = NULL;
799 XtSetArg(args[j], XtNwidth, &fw_width); j++;
800 XtGetValues(formWidget, args, j);
803 XtSetArg(args[j], XtNresizable, True); j++;
804 XtSetArg(args[j], XtNallowShellResize, True); j++;
805 shell = gameListOptShell =
806 XtCreatePopupShell("Game-list options", transientShellWidgetClass,
807 shellWidget, args, j);
809 XtCreateManagedWidget(layoutName, formWidgetClass, shell,
810 layoutArgs, XtNumber(layoutArgs));
812 XtSetArg(args[j], XtNborderWidth, 0); j++;
814 XtCreateManagedWidget("form", formWidgetClass, layout, args, j);
817 XtSetArg(args[j], XtNdefaultColumns, 1); j++;
818 XtSetArg(args[j], XtNforceColumns, True); j++;
819 XtSetArg(args[j], XtNverticalList, True); j++;
820 listwidg = viewport =
821 XtCreateManagedWidget("list", listWidgetClass, form, args, j);
822 XawListHighlight(listwidg, 0);
823 // XtAugmentTranslations(listwidg,
824 // XtParseTranslationTable(gameListOptTranslations));
827 XtSetArg(args[j], XtNfromVert, viewport); j++;
828 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
829 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
830 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
831 XtSetArg(args[j], XtNright, XtChainLeft); j++;
833 XtCreateManagedWidget(_("factory"), commandWidgetClass, form, args, j);
834 XtAddCallback(b_load, XtNcallback, GameListOptionsCallback, client_data);
837 XtSetArg(args[j], XtNfromVert, viewport); j++;
838 XtSetArg(args[j], XtNfromHoriz, b_load); j++;
839 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
840 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
841 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
842 XtSetArg(args[j], XtNright, XtChainLeft); j++;
844 XtCreateManagedWidget(_("up"), commandWidgetClass, form, args, j);
845 XtAddCallback(b_loadprev, XtNcallback, GameListOptionsCallback, client_data);
848 XtSetArg(args[j], XtNfromVert, viewport); j++;
849 XtSetArg(args[j], XtNfromHoriz, b_loadprev); j++;
850 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
851 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
852 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
853 XtSetArg(args[j], XtNright, XtChainLeft); j++;
855 XtCreateManagedWidget(_("down"), commandWidgetClass, form, args, j);
856 XtAddCallback(b_loadnext, XtNcallback, GameListOptionsCallback, client_data);
859 XtSetArg(args[j], XtNfromVert, viewport); j++;
860 XtSetArg(args[j], XtNfromHoriz, b_loadnext); j++;
861 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
862 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
863 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
864 XtSetArg(args[j], XtNright, XtChainLeft); j++;
866 XtCreateManagedWidget(_("cancel"), commandWidgetClass, form, args, j);
867 XtAddCallback(b_cancel, XtNcallback, GameListOptionsCallback, client_data);
870 XtSetArg(args[j], XtNfromVert, viewport); j++;
871 XtSetArg(args[j], XtNfromHoriz, b_cancel); j++;
872 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
873 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
874 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
875 XtSetArg(args[j], XtNright, XtChainLeft); j++;
877 XtCreateManagedWidget(_("OK"), commandWidgetClass, form, args, j);
878 XtAddCallback(b_close, XtNcallback, GameListOptionsCallback, client_data);
880 safeStrCpy(lpUserGLT, appData.gameListTags, LPUSERGLT_SIZE);
881 GLT_TagsToList(lpUserGLT);
883 XtRealizeWidget(shell);
884 CatchDeleteWindow(shell, "GameListOptionsPopDown");
890 GameListOptionsPopUp(Widget w, XEvent *event, String *prms, Cardinal *nprms)
892 if (gameListOptShell == NULL)
893 gameListOptShell = GameListOptionsCreate();
895 XtPopup(gameListOptShell, XtGrabNone);