<Btn1Up>: HandleUserMove(0) \n \
<Btn1Motion>: AnimateUserMove() \n \
<Btn3Motion>: HandlePV() \n \
+ <Btn2Motion>: HandlePV() \n \
<Btn3Up>: PieceMenuPopup(menuB) \n \
+ <Btn2Up>: PieceMenuPopup(menuB) \n \
Shift<Btn2Down>: XawPositionSimpleMenu(menuB) XawPositionSimpleMenu(menuD)\
PieceMenuPopup(menuB) \n \
Any<Btn2Down>: XawPositionSimpleMenu(menuW) XawPositionSimpleMenu(menuD) \
}
}
}
+ oldMono = -10; // kludge to force recreation of animation masks
}
#if HAVE_LIBXPM
if(appData.monoMode != oldMono)
/* For the coordFont, use the 0th font of the fontset. */
XFontSet coordFontSet = CreateFontSet(appData.coordFont);
XFontStruct **font_struct_list;
+ XFontSetExtents *fontSize;
char **font_name_list;
XFontsOfFontSet(coordFontSet, &font_struct_list, &font_name_list);
coordFontID = XLoadFont(xDisplay, font_name_list[0]);
coordFontStruct = XQueryFont(xDisplay, coordFontID);
+ fontSize = XExtentsOfFontSet(fontSet); // [HGM] figure out how much vertical space font takes
+ textHeight = fontSize->max_logical_extent.height + 5; // add borderWidth
}
#else
appData.font = FindFont(appData.font, fontPxlSize);
messageArgs, XtNumber(messageArgs));
XtSetArg(args[0], XtNtop, XtChainTop);
XtSetArg(args[1], XtNbottom, XtChainTop);
- XtSetValues(messageWidget, args, 3);
+ XtSetValues(messageWidget, args, 2);
widgetList[j++] = boardWidget =
XtCreateWidget("board", widgetClass, formWidget, boardArgs,
fprintf(stderr, _("%s: messageWidget geometry error %d %d %d %d %d\n"),
programName, gres, w, h, wr, hr);
}
- textHeight = hr; // [HGM] save height for use in generic popup
/* !! end hack */
+ if(!textHeight) textHeight = hr; // [HGM] if !NLS textHeight is still undefined, and we grab it from here
XtSetArg(args[0], XtNleft, XtChainLeft); // [HGM] glue ends for good run-time sizing
XtSetArg(args[1], XtNright, XtChainRight);
XtSetValues(messageWidget, args, 2);
(proc)(NULL, NULL, NULL, NULL);
}
+static void
+MenuEngineSelect (Widget w, caddr_t addr, caddr_t index)
+{
+ RecentEngineEvent((int) addr);
+}
+
+void
+AppendEnginesToMenu (Widget menu, char *list)
+{
+ int i=0, j;
+ Widget entry;
+ MenuItem *mi;
+ Arg args[16];
+ char *p;
+
+ if(appData.recentEngines <= 0) return;
+ recentEngines = strdup(list);
+ j = 0;
+ XtSetArg(args[j], XtNleftMargin, 20); j++;
+ XtSetArg(args[j], XtNrightMargin, 20); j++;
+ while (*list) {
+ p = strchr(list, '\n'); if(p == NULL) break;
+ if(i == 0) XtCreateManagedWidget(_("----"), smeLineObjectClass, menu, args, j); // at least one valid item to add
+ *p = 0;
+ XtSetArg(args[j], XtNlabel, XtNewString(list));
+ entry = XtCreateManagedWidget("engine", smeBSBObjectClass, menu, args, j+1);
+ XtAddCallback(entry, XtNcallback,
+ (XtCallbackProc) MenuEngineSelect,
+ (caddr_t) i);
+ i++; *p = '\n'; list = p + 1;
+ }
+}
+
void
CreateMenuBarPopup (Widget parent, String name, Menu *mb)
{
}
mi++;
}
+ if(!strcmp(mb->name, "Engine")) AppendEnginesToMenu(menu, appData.recentEngineList);
}
Widget
whitePieceMenu = CreatePieceMenu("menuW", 0);
blackPieceMenu = CreatePieceMenu("menuB", 1);
+ if(appData.pieceMenu) // [HGM] sweep: no idea what this was good for, but it stopped reporting button events outside the window
XtRegisterGrabAction(PieceMenuPopup, True,
(unsigned)(ButtonPressMask|ButtonReleaseMask),
GrabModeAsync, GrabModeAsync);
void
ErrorCallback (Widget w, XtPointer client_data, XtPointer call_data)
{
- errorUp = False;
+ dialogError = errorUp = False;
XtPopdown(w = XtParent(XtParent(XtParent(w))));
XtDestroyWidget(w);
if (errorExitStatus != -1) ExitEvent(errorExitStatus);
ErrorPopDown ()
{
if (!errorUp) return;
- errorUp = False;
+ dialogError = errorUp = False;
XtPopdown(errorShell);
XtDestroyWidget(errorShell);
if (errorExitStatus != -1) ExitEvent(errorExitStatus);
XtSetArg(args[i], XtNtitle, title); i++;
errorShell =
XtCreatePopupShell("errorpopup", transientShellWidgetClass,
- shellWidget, args, i);
+ shellUp[0] ? (dialogError = modal = TRUE, shells[0]) : shellWidget, args, i);
layout =
XtCreateManagedWidget(layoutName, formWidgetClass, errorShell,
layoutArgs, XtNumber(layoutArgs));
NULL/* transfer_done_proc */);
}
+void
+CopyFENToClipboard ()
+{ // wrapper to make call from back-end possible
+ CopyPositionProc(NULL, NULL, NULL, NULL);
+}
+
/* function called when the data to Paste is ready */
static void
PastePositionCB (Widget w, XtPointer client_data, Atom *selection,
snprintf(buf, sizeof(buf),
_("%s%s\n\n"
"Copyright 1991 Digital Equipment Corporation\n"
-"Enhancements Copyright 1992-2009 Free Software Foundation\n"
+"Enhancements Copyright 1992-2012 Free Software Foundation\n"
"Enhancements Copyright 2005 Alessandro Scotti\n\n"
"%s is free software and carries NO WARRANTY;"
"see the file COPYING for more information."),
char buf[MSG_SIZ];
if (appData.debugMode) {
- fprintf(stderr, "StartChildProcess (dir=\"%s\") %s\n",dir, cmdLine);
+ fprintf(debugFP, "StartChildProcess (dir=\"%s\") %s\n",dir, cmdLine);
}
/* We do NOT feed the cmdLine to the shell; we just
hop = abs(fromX-toX) == 1 && abs(fromY-toY) == 2 || abs(fromX-toX) == 2 && abs(fromY-toY) == 1;
#endif
- if (appData.debugMode) {
- fprintf(debugFP, hop ? _("AnimateMove: piece %d hops from %d,%d to %d,%d \n") :
- _("AnimateMove: piece %d slides from %d,%d to %d,%d \n"),
- piece, fromX, fromY, toX, toY); }
-
ScreenSquare(fromX, fromY, &start, &startColor);
ScreenSquare(toX, toY, &finish, &endColor);