static int listLength;
char gameListTranslations[] =
- "<Btn1Up>(2): LoadSelectedProc() \n \
- <Key>Return: LoadSelectedProc() \n";
+ "<Btn1Up>(2): LoadSelectedProc(0) \n \
+ <Key>Home: LoadSelectedProc(-2) \n \
+ <Key>End: LoadSelectedProc(2) \n \
+ <Key>Up: LoadSelectedProc(-1) \n \
+ <Key>Down: LoadSelectedProc(1) \n \
+ <Key>Left: LoadSelectedProc(-1) \n \
+ <Key>Right: LoadSelectedProc(1) \n \
+ <Key>Return: LoadSelectedProc(0) \n";
+char filterTranslations[] =
+ "<Key>Return: SetFilterProc() \n";
typedef struct {
Widget shell;
XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
XtSetArg(args[j], XtNleft, XtChainLeft); j++;
XtSetArg(args[j], XtNright, XtChainRight); j++;
- XtSetArg(args[j], XtNwidth, 173); j++;
+ XtSetArg(args[j], XtNwidth, fw_width - 225 - squareSize); j++;
XtSetArg(args[j], XtNstring, filterString); j++;
XtSetArg(args[j], XtNdisplayCaret, False); j++;
XtSetArg(args[j], XtNresizable, True); j++;
filterText =
XtCreateManagedWidget(_("filtertext"), asciiTextWidgetClass, form, args, j);
XtAddEventHandler(filterText, ButtonPressMask, False, SetFocus, (XtPointer) shell);
+ XtOverrideTranslations(filterText,
+ XtParseTranslationTable(filterTranslations));
j = 0;
XtSetArg(args[j], XtNfromVert, viewport); j++;
XtRealizeWidget(shell);
CatchDeleteWindow(shell, "GameListPopDown");
+ XtSetKeyboardFocus(shell, listwidg);
return shell;
}
{
Widget listwidg;
XawListReturnStruct *rs;
- int index;
+ int index, direction = atoi(prms[0]);
if (glc == NULL) return;
listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
rs = XawListShowCurrent(listwidg);
index = rs->list_index;
if (index < 0) return;
+ if(direction != 0) {
+ index += direction;
+ if(direction == -2) index = 0;
+ if(direction == 2) index = listLength-1;
+ if(index < 0 || index >= listLength) return;
+ XawListHighlight(listwidg, index);
+ return;
+ }
index = atoi(glc->strings[index])-1; // [HGM] filter: read true index from sequence nr of line
if (cmailMsgLoaded) {
CmailLoadGame(glc->fp, index + 1, glc->filename, True);
}
void
+SetFilterProc(w, event, prms, nprms)
+ Widget w;
+ XEvent *event;
+ String *prms;
+ Cardinal *nprms;
+{
+ Arg args[16];
+ String name;
+ Widget list;
+ int j = 0;
+ XtSetArg(args[j], XtNstring, &name); j++;
+ XtGetValues(filterText, args, j);
+ strcpy(filterString, name);
+ if(GameListPrepare()) GameListReplace(); // crashes on empty list...
+ list = XtNameToWidget(glc->shell, "*form.viewport.list");
+ XawListHighlight(list, 0);
+ j = 0;
+ XtSetArg(args[j], XtNdisplayCaret, False); j++;
+ XtSetValues(filterText, args, j);
+ XtSetKeyboardFocus(glc->shell, list);
+}
+
+void
GameListPopDown()
{
Arg args[16];