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;
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";
121 static GameListClosure *glc = NULL;
124 GameListCreate(name, callback, client_data)
126 XtCallbackProc callback;
127 XtPointer client_data;
130 Widget shell, form, viewport, listwidg, layout, label;
131 Widget b_load, b_loadprev, b_loadnext, b_close, b_filter;
134 GameListClosure *glc = (GameListClosure *) client_data;
137 XtSetArg(args[j], XtNwidth, &fw_width); j++;
138 XtGetValues(formWidget, args, j);
141 XtSetArg(args[j], XtNresizable, True); j++;
142 XtSetArg(args[j], XtNallowShellResize, True); j++;
144 shell = gameListShell =
145 XtCreatePopupShell(name, topLevelShellWidgetClass,
146 shellWidget, args, j);
148 shell = gameListShell =
149 XtCreatePopupShell(name, transientShellWidgetClass,
150 shellWidget, args, j);
153 XtCreateManagedWidget(layoutName, formWidgetClass, shell,
154 layoutArgs, XtNumber(layoutArgs));
156 XtSetArg(args[j], XtNborderWidth, 0); j++;
158 XtCreateManagedWidget("form", formWidgetClass, layout, args, j);
161 XtSetArg(args[j], XtNtop, XtChainTop); j++;
162 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
163 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
164 XtSetArg(args[j], XtNright, XtChainRight); j++;
165 XtSetArg(args[j], XtNresizable, False); j++;
166 XtSetArg(args[j], XtNwidth, fw_width); j++;
167 XtSetArg(args[j], XtNallowVert, True); j++;
169 XtCreateManagedWidget("viewport", viewportWidgetClass, form, args, j);
172 XtSetArg(args[j], XtNlist, glc->strings); j++;
173 XtSetArg(args[j], XtNdefaultColumns, 1); j++;
174 XtSetArg(args[j], XtNforceColumns, True); j++;
175 XtSetArg(args[j], XtNverticalList, True); j++;
177 XtCreateManagedWidget("list", listWidgetClass, viewport, args, j);
178 XawListHighlight(listwidg, 0);
179 XtAugmentTranslations(listwidg,
180 XtParseTranslationTable(gameListTranslations));
183 XtSetArg(args[j], XtNfromVert, viewport); j++;
184 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
185 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
186 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
187 XtSetArg(args[j], XtNright, XtChainLeft); j++;
189 XtCreateManagedWidget(_("load"), commandWidgetClass, form, args, j);
190 XtAddCallback(b_load, XtNcallback, callback, client_data);
193 XtSetArg(args[j], XtNfromVert, viewport); j++;
194 XtSetArg(args[j], XtNfromHoriz, b_load); j++;
195 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
196 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
197 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
198 XtSetArg(args[j], XtNright, XtChainLeft); j++;
200 XtCreateManagedWidget(_("prev"), commandWidgetClass, form, args, j);
201 XtAddCallback(b_loadprev, XtNcallback, callback, client_data);
204 XtSetArg(args[j], XtNfromVert, viewport); j++;
205 XtSetArg(args[j], XtNfromHoriz, b_loadprev); j++;
206 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
207 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
208 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
209 XtSetArg(args[j], XtNright, XtChainLeft); j++;
211 XtCreateManagedWidget(_("next"), commandWidgetClass, form, args, j);
212 XtAddCallback(b_loadnext, XtNcallback, callback, client_data);
215 XtSetArg(args[j], XtNfromVert, viewport); j++;
216 XtSetArg(args[j], XtNfromHoriz, b_loadnext); j++;
217 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
218 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
219 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
220 XtSetArg(args[j], XtNright, XtChainLeft); j++;
222 XtCreateManagedWidget(_("close"), commandWidgetClass, form, args, j);
223 XtAddCallback(b_close, XtNcallback, callback, client_data);
226 XtSetArg(args[j], XtNfromVert, viewport); j++;
227 XtSetArg(args[j], XtNfromHoriz, b_close); j++;
228 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
229 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
230 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
231 XtSetArg(args[j], XtNright, XtChainLeft); j++;
232 XtSetArg(args[j], XtNborderWidth, 0); j++;
234 XtCreateManagedWidget(_("Filter:"), labelWidgetClass, form, args, j);
237 XtSetArg(args[j], XtNfromVert, viewport); j++;
238 XtSetArg(args[j], XtNfromHoriz, label); j++;
239 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
240 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
241 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
242 XtSetArg(args[j], XtNright, XtChainRight); j++;
243 XtSetArg(args[j], XtNwidth, fw_width - 225 - squareSize); j++;
244 XtSetArg(args[j], XtNstring, filterString); j++;
245 XtSetArg(args[j], XtNdisplayCaret, False); j++;
246 XtSetArg(args[j], XtNresizable, True); j++;
247 // XtSetArg(args[j], XtNwidth, bw_width); j++; /*force wider than buttons*/
248 /* !!Work around an apparent bug in XFree86 4.0.1 (X11R6.4.3) */
249 XtSetArg(args[j], XtNeditType, XawtextEdit); j++;
250 XtSetArg(args[j], XtNuseStringInPlace, False); j++;
252 XtCreateManagedWidget(_("filtertext"), asciiTextWidgetClass, form, args, j);
253 XtAddEventHandler(filterText, ButtonPressMask, False, SetFocus, (XtPointer) shell);
254 XtOverrideTranslations(filterText,
255 XtParseTranslationTable(filterTranslations));
258 XtSetArg(args[j], XtNfromVert, viewport); j++;
259 XtSetArg(args[j], XtNfromHoriz, filterText); j++;
260 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
261 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
262 XtSetArg(args[j], XtNleft, XtChainRight); j++;
263 XtSetArg(args[j], XtNright, XtChainRight); j++;
265 XtCreateManagedWidget(_("apply"), commandWidgetClass, form, args, j);
266 XtAddCallback(b_filter, XtNcallback, callback, client_data);
269 if(wpGameList.width > 0) {
270 glc->x = wpGameList.x;
271 glc->y = wpGameList.y;
272 glc->w = wpGameList.width;
273 glc->h = wpGameList.height;
283 XtSetArg(args[j], XtNheight, &h1); j++;
284 XtSetArg(args[j], XtNy, &y1); j++;
285 XtGetValues(boardWidget, args, j);
286 glc->w = fw_width * 3/4;
287 glc->h = squareSize * 3;
289 XSync(xDisplay, False);
291 /* This code seems to tickle an X bug if it is executed too soon
292 after xboard starts up. The coordinates get transformed as if
293 the main window was positioned at (0, 0).
295 XtTranslateCoords(shellWidget, (fw_width - glc->w) / 2,
296 y1 + (h1 - glc->h + appData.borderYoffset) / 2,
299 XTranslateCoordinates(xDisplay, XtWindow(shellWidget),
300 RootWindowOfScreen(XtScreen(shellWidget)),
301 (fw_width - glc->w) / 2,
302 y1 + (h1 - glc->h + appData.borderYoffset) / 2,
307 if (glc->y < 0) glc->y = 0; /*avoid positioning top offscreen*/
310 XtSetArg(args[j], XtNheight, glc->h); j++;
311 XtSetArg(args[j], XtNwidth, glc->w); j++;
312 XtSetArg(args[j], XtNx, glc->x - appData.borderXoffset); j++;
313 XtSetArg(args[j], XtNy, glc->y - appData.borderYoffset); j++;
314 XtSetValues(shell, args, j);
316 XtRealizeWidget(shell);
317 CatchDeleteWindow(shell, "GameListPopDown");
318 XtSetKeyboardFocus(shell, listwidg);
325 { // [HGM] filter: put in separate routine, to make callable from call-back
330 nstrings = ((ListGame *) gameList.tailPred)->number;
331 glc->strings = (char **) malloc((nstrings + 1) * sizeof(char *));
333 lg = (ListGame *) gameList.head;
336 line = GameListLine(lg->number, &lg->gameInfo);
337 if(filterString[0] == NULLCHAR || SearchPattern( line, filterString ) ) {
338 *st++ = line; // [HGM] filter: make adding line conditional
341 lg = (ListGame *) lg->node.succ;
350 // filter: put in separate routine, to make callable from call-back
353 listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
354 XawListChange(listwidg, glc->strings, 0, 0, True);
355 XawListHighlight(listwidg, 0);
359 GameListCallback(w, client_data, call_data)
361 XtPointer client_data, call_data;
367 GameListClosure *glc = (GameListClosure *) client_data;
368 XawListReturnStruct *rs;
372 XtSetArg(args[j], XtNlabel, &name); j++;
373 XtGetValues(w, args, j);
375 if (strcmp(name, _("close")) == 0) {
379 listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
380 rs = XawListShowCurrent(listwidg);
381 if (strcmp(name, _("load")) == 0) {
382 index = rs->list_index;
384 DisplayError(_("No game selected"), 0);
387 } else if (strcmp(name, _("next")) == 0) {
388 index = rs->list_index + 1;
389 if (index >= listLength) {
390 DisplayError(_("Can't go forward any further"), 0);
393 XawListHighlight(listwidg, index);
394 } else if (strcmp(name, _("prev")) == 0) {
395 index = rs->list_index - 1;
397 DisplayError(_("Can't back up any further"), 0);
400 XawListHighlight(listwidg, index);
401 } else if (strcmp(name, _("apply")) == 0) {
404 XtSetArg(args[j], XtNstring, &name); j++;
405 XtGetValues(filterText, args, j);
406 safeStrCpy(filterString, name, sizeof(filterString)/sizeof(filterString[0]));
407 XawListHighlight(listwidg, 0);
408 if(GameListPrepare()) GameListReplace(); // crashes on empty list...
411 index = atoi(glc->strings[index])-1; // [HGM] filter: read true index from sequence nr of line
412 if (cmailMsgLoaded) {
413 CmailLoadGame(glc->fp, index + 1, glc->filename, True);
415 LoadGame(glc->fp, index + 1, glc->filename, True);
420 GameListPopUp(fp, filename)
429 glc = (GameListClosure *) calloc(1, sizeof(GameListClosure));
430 glc->x = glc->y = -1;
433 if (glc->strings != NULL) {
441 GameListPrepare(); // [HGM] filter: code put in separate routine
445 if (glc->filename != NULL) free(glc->filename);
446 glc->filename = StrSave(filename);
449 if (glc->shell == NULL) {
450 glc->shell = GameListCreate(filename, GameListCallback, glc);
452 GameListReplace(); // [HGM] filter: code put in separate routine
454 XtSetArg(args[j], XtNiconName, (XtArgVal) filename); j++;
455 XtSetArg(args[j], XtNtitle, (XtArgVal) filename); j++;
456 XtSetValues(glc->shell, args, j);
459 XtPopup(glc->shell, XtGrabNone);
462 XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++;
463 XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Game List"),
470 if (glc == NULL) return;
472 if (glc->strings != NULL) {
485 ShowGameListProc(w, event, prms, nprms)
495 DisplayError(_("There is no game list"), 0);
502 XtPopup(glc->shell, XtGrabNone);
505 XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++;
506 XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Game List"),
508 GameListHighlight(lastLoadGameNumber);
512 LoadSelectedProc(w, event, prms, nprms)
519 XawListReturnStruct *rs;
520 int index, direction = atoi(prms[0]);
522 if (glc == NULL) return;
523 listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
524 rs = XawListShowCurrent(listwidg);
525 index = rs->list_index;
526 if (index < 0) return;
529 if(direction == -2) index = 0;
530 if(direction == 2) index = listLength-1;
531 if(index < 0 || index >= listLength) return;
532 XawListHighlight(listwidg, index);
535 index = atoi(glc->strings[index])-1; // [HGM] filter: read true index from sequence nr of line
536 if (cmailMsgLoaded) {
537 CmailLoadGame(glc->fp, index + 1, glc->filename, True);
539 LoadGame(glc->fp, index + 1, glc->filename, True);
544 SetFilterProc(w, event, prms, nprms)
554 XtSetArg(args[j], XtNstring, &name); j++;
555 XtGetValues(filterText, args, j);
556 safeStrCpy(filterString, name, sizeof(filterString)/sizeof(filterString[0]));
557 if(GameListPrepare()) GameListReplace(); // crashes on empty list...
558 list = XtNameToWidget(glc->shell, "*form.viewport.list");
559 XawListHighlight(list, 0);
561 XtSetArg(args[j], XtNdisplayCaret, False); j++;
562 XtSetValues(filterText, args, j);
563 XtSetKeyboardFocus(glc->shell, list);
572 if (glc == NULL) return;
574 XtSetArg(args[j], XtNx, &glc->x); j++;
575 XtSetArg(args[j], XtNy, &glc->y); j++;
576 XtSetArg(args[j], XtNheight, &glc->h); j++;
577 XtSetArg(args[j], XtNwidth, &glc->w); j++;
578 XtGetValues(glc->shell, args, j);
579 wpGameList.x = glc->x - 4;
580 wpGameList.y = glc->y - 23;
581 wpGameList.width = glc->w;
582 wpGameList.height = glc->h;
583 XtPopdown(glc->shell);
584 XtSetKeyboardFocus(shellWidget, formWidget);
587 XtSetArg(args[j], XtNleftBitmap, None); j++;
588 XtSetValues(XtNameToWidget(menuBarWidget, "menuView.Show Game List"),
593 GameListHighlight(index)
598 if (glc == NULL || !glc->up) return;
599 listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
601 while(*st && atoi(*st)<index) st++,i++;
602 XawListHighlight(listwidg, i);
608 return glc && glc->up;
611 int SaveGameListAsText(FILE *f)
\r
613 ListGame * lg = (ListGame *) gameList.head;
\r
616 if( !glc || ((ListGame *) gameList.tailPred)->number <= 0 ) {
\r
617 DisplayError("Game list not loaded or empty", 0);
\r
621 /* Copy the list into the global memory block */
\r
624 lg = (ListGame *) gameList.head;
\r
626 for (nItem = 0; nItem < ((ListGame *) gameList.tailPred)->number; nItem++){
\r
627 char * st = GameListLineFull(lg->number, &lg->gameInfo);
\r
628 char *line = GameListLine(lg->number, &lg->gameInfo);
629 if(filterString[0] == NULLCHAR || SearchPattern( line, filterString ) )
630 fprintf( f, "%s\n", st );
631 free(st); free(line);
\r
632 lg = (ListGame *) lg->node.succ;
\r
640 //--------------------------------- Game-List options dialog ------------------------------------------
642 Widget gameListOptShell, listwidg;
653 void GLT_AddToList(char *name)
655 strings[stringPtr++] = name;
656 strings[stringPtr] = NULL;
659 Boolean GLT_GetFromList(int index, char *name)
661 safeStrCpy(name, strings[index], MSG_SIZ);
665 void GLT_DeSelectList()
667 XawListChange(listwidg, strings, 0, 0, True);
668 XawListHighlight(listwidg, 0);
672 GameListOptionsPopDown()
674 if (gameListOptShell == NULL) return;
676 XtPopdown(gameListOptShell);
677 XtDestroyWidget(gameListOptShell);
678 gameListOptShell = 0;
679 XtSetKeyboardFocus(shellWidget, formWidget);
683 GameListOptionsCallback(w, client_data, call_data)
685 XtPointer client_data, call_data;
691 XawListReturnStruct *rs;
696 XtSetArg(args[j], XtNlabel, &name); j++;
697 XtGetValues(w, args, j);
699 if (strcmp(name, _("OK")) == 0) {
701 appData.gameListTags = strdup(lpUserGLT);
702 GameListOptionsPopDown();
705 if (strcmp(name, _("cancel")) == 0) {
706 GameListOptionsPopDown();
709 listwidg = XtNameToWidget(gameListOptShell, "*form.list");
710 rs = XawListShowCurrent(listwidg);
711 index = rs->list_index;
713 DisplayError(_("No tag selected"), 0);
717 if (strcmp(name, _("down")) == 0) {
718 if(index >= strlen(GLT_ALL_TAGS)) return;
719 strings[index] = strings[index+1];
720 strings[++index] = p;
722 if (strcmp(name, _("up")) == 0) {
723 if(index == 0) return;
724 strings[index] = strings[index-1];
725 strings[--index] = p;
727 if (strcmp(name, _("factory")) == 0) {
728 safeStrCpy(lpUserGLT, GLT_DEFAULT_TAGS, LPUSERGLT_SIZE);
729 GLT_TagsToList(lpUserGLT);
732 XawListHighlight(listwidg, index);
736 GameListOptionsCreate()
739 Widget shell, form, viewport, layout;
740 Widget b_load, b_loadprev, b_loadnext, b_close, b_cancel;
742 XtPointer client_data = NULL;
746 XtSetArg(args[j], XtNwidth, &fw_width); j++;
747 XtGetValues(formWidget, args, j);
750 XtSetArg(args[j], XtNresizable, True); j++;
751 XtSetArg(args[j], XtNallowShellResize, True); j++;
752 shell = gameListOptShell =
753 XtCreatePopupShell("Game-list options", transientShellWidgetClass,
754 shellWidget, args, j);
756 XtCreateManagedWidget(layoutName, formWidgetClass, shell,
757 layoutArgs, XtNumber(layoutArgs));
759 XtSetArg(args[j], XtNborderWidth, 0); j++;
761 XtCreateManagedWidget("form", formWidgetClass, layout, args, j);
764 XtSetArg(args[j], XtNdefaultColumns, 1); j++;
765 XtSetArg(args[j], XtNforceColumns, True); j++;
766 XtSetArg(args[j], XtNverticalList, True); j++;
767 listwidg = viewport =
768 XtCreateManagedWidget("list", listWidgetClass, form, args, j);
769 XawListHighlight(listwidg, 0);
770 // XtAugmentTranslations(listwidg,
771 // XtParseTranslationTable(gameListOptTranslations));
774 XtSetArg(args[j], XtNfromVert, viewport); j++;
775 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
776 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
777 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
778 XtSetArg(args[j], XtNright, XtChainLeft); j++;
780 XtCreateManagedWidget(_("factory"), commandWidgetClass, form, args, j);
781 XtAddCallback(b_load, XtNcallback, GameListOptionsCallback, client_data);
784 XtSetArg(args[j], XtNfromVert, viewport); j++;
785 XtSetArg(args[j], XtNfromHoriz, b_load); j++;
786 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
787 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
788 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
789 XtSetArg(args[j], XtNright, XtChainLeft); j++;
791 XtCreateManagedWidget(_("up"), commandWidgetClass, form, args, j);
792 XtAddCallback(b_loadprev, XtNcallback, GameListOptionsCallback, client_data);
795 XtSetArg(args[j], XtNfromVert, viewport); j++;
796 XtSetArg(args[j], XtNfromHoriz, b_loadprev); j++;
797 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
798 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
799 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
800 XtSetArg(args[j], XtNright, XtChainLeft); j++;
802 XtCreateManagedWidget(_("down"), commandWidgetClass, form, args, j);
803 XtAddCallback(b_loadnext, XtNcallback, GameListOptionsCallback, client_data);
806 XtSetArg(args[j], XtNfromVert, viewport); j++;
807 XtSetArg(args[j], XtNfromHoriz, b_loadnext); j++;
808 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
809 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
810 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
811 XtSetArg(args[j], XtNright, XtChainLeft); j++;
813 XtCreateManagedWidget(_("cancel"), commandWidgetClass, form, args, j);
814 XtAddCallback(b_cancel, XtNcallback, GameListOptionsCallback, client_data);
817 XtSetArg(args[j], XtNfromVert, viewport); j++;
818 XtSetArg(args[j], XtNfromHoriz, b_cancel); j++;
819 XtSetArg(args[j], XtNtop, XtChainBottom); j++;
820 XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
821 XtSetArg(args[j], XtNleft, XtChainLeft); j++;
822 XtSetArg(args[j], XtNright, XtChainLeft); j++;
824 XtCreateManagedWidget(_("OK"), commandWidgetClass, form, args, j);
825 XtAddCallback(b_close, XtNcallback, GameListOptionsCallback, client_data);
827 safeStrCpy(lpUserGLT, appData.gameListTags, LPUSERGLT_SIZE);
828 GLT_TagsToList(lpUserGLT);
830 XtRealizeWidget(shell);
831 CatchDeleteWindow(shell, "GameListOptionsPopDown");
837 GameListOptionsPopUp(Widget w, XEvent *event, String *prms, Cardinal *nprms)
839 if (gameListOptShell == NULL)
840 gameListOptShell = GameListOptionsCreate();
842 XtPopup(gameListOptShell, XtGrabNone);