2 * xboard.c -- X front end for XBoard
\r
3 * $Id: xboard.c,v 2.2 2003/11/06 07:22:14 mann Exp $
\r
5 * Copyright 1991 by Digital Equipment Corporation, Maynard,
\r
6 * Massachusetts. Enhancements Copyright
\r
7 * 1992-2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software
\r
10 * The following terms apply to Digital Equipment Corporation's copyright
\r
11 * interest in XBoard:
\r
12 * ------------------------------------------------------------------------
\r
13 * All Rights Reserved
\r
15 * Permission to use, copy, modify, and distribute this software and its
\r
16 * documentation for any purpose and without fee is hereby granted,
\r
17 * provided that the above copyright notice appear in all copies and that
\r
18 * both that copyright notice and this permission notice appear in
\r
19 * supporting documentation, and that the name of Digital not be
\r
20 * used in advertising or publicity pertaining to distribution of the
\r
21 * software without specific, written prior permission.
\r
23 * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
\r
24 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
\r
25 * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
\r
26 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
\r
27 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
\r
28 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
\r
30 * ------------------------------------------------------------------------
\r
32 * The following terms apply to the enhanced version of XBoard
\r
33 * distributed by the Free Software Foundation:
\r
34 * ------------------------------------------------------------------------
\r
36 * GNU XBoard is free software: you can redistribute it and/or modify
\r
37 * it under the terms of the GNU General Public License as published by
\r
38 * the Free Software Foundation, either version 3 of the License, or (at
\r
39 * your option) any later version.
\r
41 * GNU XBoard is distributed in the hope that it will be useful, but
\r
42 * WITHOUT ANY WARRANTY; without even the implied warranty of
\r
43 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
44 * General Public License for more details.
\r
46 * You should have received a copy of the GNU General Public License
\r
47 * along with this program. If not, see http://www.gnu.org/licenses/. *
\r
49 *------------------------------------------------------------------------
\r
50 ** See the file ChangeLog for a revision history. */
\r
58 #include <sys/types.h>
\r
59 #include <sys/stat.h>
\r
63 # if HAVE_SYS_SOCKET_H
\r
64 # include <sys/socket.h>
\r
65 # include <netinet/in.h>
\r
67 # else /* not HAVE_SYS_SOCKET_H */
\r
68 # if HAVE_LAN_SOCKET_H
\r
69 # include <lan/socket.h>
\r
70 # include <lan/in.h>
\r
71 # include <lan/netdb.h>
\r
72 # else /* not HAVE_LAN_SOCKET_H */
\r
73 # define OMIT_SOCKETS 1
\r
74 # endif /* not HAVE_LAN_SOCKET_H */
\r
75 # endif /* not HAVE_SYS_SOCKET_H */
\r
76 #endif /* !OMIT_SOCKETS */
\r
79 # include <stdlib.h>
\r
80 # include <string.h>
\r
81 #else /* not STDC_HEADERS */
\r
82 extern char *getenv();
\r
84 # include <string.h>
\r
85 # else /* not HAVE_STRING_H */
\r
86 # include <strings.h>
\r
87 # endif /* not HAVE_STRING_H */
\r
88 #endif /* not STDC_HEADERS */
\r
90 #if HAVE_SYS_FCNTL_H
\r
91 # include <sys/fcntl.h>
\r
92 #else /* not HAVE_SYS_FCNTL_H */
\r
95 # endif /* HAVE_FCNTL_H */
\r
96 #endif /* not HAVE_SYS_FCNTL_H */
\r
98 #if HAVE_SYS_SYSTEMINFO_H
\r
99 # include <sys/systeminfo.h>
\r
100 #endif /* HAVE_SYS_SYSTEMINFO_H */
\r
102 #if TIME_WITH_SYS_TIME
\r
103 # include <sys/time.h>
\r
106 # if HAVE_SYS_TIME_H
\r
107 # include <sys/time.h>
\r
114 # include <unistd.h>
\r
117 #if HAVE_SYS_WAIT_H
\r
118 # include <sys/wait.h>
\r
122 # include <dirent.h>
\r
123 # define NAMLEN(dirent) strlen((dirent)->d_name)
\r
124 # define HAVE_DIR_STRUCT
\r
126 # define dirent direct
\r
127 # define NAMLEN(dirent) (dirent)->d_namlen
\r
128 # if HAVE_SYS_NDIR_H
\r
129 # include <sys/ndir.h>
\r
130 # define HAVE_DIR_STRUCT
\r
132 # if HAVE_SYS_DIR_H
\r
133 # include <sys/dir.h>
\r
134 # define HAVE_DIR_STRUCT
\r
138 # define HAVE_DIR_STRUCT
\r
142 #include <X11/Intrinsic.h>
\r
143 #include <X11/StringDefs.h>
\r
144 #include <X11/Shell.h>
\r
145 #include <X11/cursorfont.h>
\r
146 #include <X11/Xatom.h>
\r
148 #include <X11/Xaw3d/Dialog.h>
\r
149 #include <X11/Xaw3d/Form.h>
\r
150 #include <X11/Xaw3d/List.h>
\r
151 #include <X11/Xaw3d/Label.h>
\r
152 #include <X11/Xaw3d/SimpleMenu.h>
\r
153 #include <X11/Xaw3d/SmeBSB.h>
\r
154 #include <X11/Xaw3d/SmeLine.h>
\r
155 #include <X11/Xaw3d/Box.h>
\r
156 #include <X11/Xaw3d/MenuButton.h>
\r
157 #include <X11/Xaw3d/Text.h>
\r
158 #include <X11/Xaw3d/AsciiText.h>
\r
160 #include <X11/Xaw/Dialog.h>
\r
161 #include <X11/Xaw/Form.h>
\r
162 #include <X11/Xaw/List.h>
\r
163 #include <X11/Xaw/Label.h>
\r
164 #include <X11/Xaw/SimpleMenu.h>
\r
165 #include <X11/Xaw/SmeBSB.h>
\r
166 #include <X11/Xaw/SmeLine.h>
\r
167 #include <X11/Xaw/Box.h>
\r
168 #include <X11/Xaw/MenuButton.h>
\r
169 #include <X11/Xaw/Text.h>
\r
170 #include <X11/Xaw/AsciiText.h>
\r
173 // [HGM] bitmaps: put before incuding the bitmaps / pixmaps, to know how many piece types there are.
\r
174 #include "common.h"
\r
177 #include <X11/xpm.h>
\r
178 #include "pixmaps/pixmaps.h"
\r
179 #define IMAGE_EXT "xpm"
\r
181 #define IMAGE_EXT "xim"
\r
182 #include "bitmaps/bitmaps.h"
\r
185 #include "bitmaps/icon_white.bm"
\r
186 #include "bitmaps/icon_black.bm"
\r
187 #include "bitmaps/checkmark.bm"
\r
189 #include "frontend.h"
\r
190 #include "backend.h"
\r
192 #include "xboard.h"
\r
193 #include "childio.h"
\r
194 #include "xgamelist.h"
\r
195 #include "xhistory.h"
\r
196 #include "xedittags.h"
\r
197 #include "gettext.h"
\r
199 // must be moved to xengineoutput.h
\r
201 void EngineOutputProc P((Widget w, XEvent *event,
\r
202 String *prms, Cardinal *nprms));
\r
204 void EngineOutputPopDown();
\r
208 #ifndef HAVE_USLEEP
\r
209 #define HAVE_USLEEP
\r
211 #define usleep(t) _sleep2(((t)+500)/1000)
\r
215 # define _(s) gettext (s)
\r
216 # define N_(s) gettext_noop (s)
\r
232 int main P((int argc, char **argv));
\r
233 RETSIGTYPE CmailSigHandler P((int sig));
\r
234 RETSIGTYPE IntSigHandler P((int sig));
\r
235 void CreateGCs P((void));
\r
236 void CreateXIMPieces P((void));
\r
237 void CreateXPMPieces P((void));
\r
238 void CreatePieces P((void));
\r
239 void CreatePieceMenus P((void));
\r
240 Widget CreateMenuBar P((Menu *mb));
\r
241 Widget CreateButtonBar P ((MenuItem *mi));
\r
242 char *FindFont P((char *pattern, int targetPxlSize));
\r
243 void PieceMenuPopup P((Widget w, XEvent *event,
\r
244 String *params, Cardinal *num_params));
\r
245 static void PieceMenuSelect P((Widget w, ChessSquare piece, caddr_t junk));
\r
246 static void DropMenuSelect P((Widget w, ChessSquare piece, caddr_t junk));
\r
247 void ReadBitmap P((Pixmap *pm, String name, unsigned char bits[],
\r
248 u_int wreq, u_int hreq));
\r
249 void CreateGrid P((void));
\r
250 int EventToSquare P((int x, int limit));
\r
251 void DrawSquare P((int row, int column, ChessSquare piece, int do_flash));
\r
252 void EventProc P((Widget widget, caddr_t unused, XEvent *event));
\r
253 void HandleUserMove P((Widget w, XEvent *event,
\r
254 String *prms, Cardinal *nprms));
\r
255 void AnimateUserMove P((Widget w, XEvent * event,
\r
256 String * params, Cardinal * nParams));
\r
257 void WhiteClock P((Widget w, XEvent *event,
\r
258 String *prms, Cardinal *nprms));
\r
259 void BlackClock P((Widget w, XEvent *event,
\r
260 String *prms, Cardinal *nprms));
\r
261 void DrawPositionProc P((Widget w, XEvent *event,
\r
262 String *prms, Cardinal *nprms));
\r
263 void XDrawPosition P((Widget w, /*Boolean*/int repaint,
\r
265 void CommentPopUp P((char *title, char *label));
\r
266 void CommentPopDown P((void));
\r
267 void CommentCallback P((Widget w, XtPointer client_data,
\r
268 XtPointer call_data));
\r
269 void ICSInputBoxPopUp P((void));
\r
270 void ICSInputBoxPopDown P((void));
\r
271 void FileNamePopUp P((char *label, char *def,
\r
272 FileProc proc, char *openMode));
\r
273 void FileNamePopDown P((void));
\r
274 void FileNameCallback P((Widget w, XtPointer client_data,
\r
275 XtPointer call_data));
\r
276 void FileNameAction P((Widget w, XEvent *event,
\r
277 String *prms, Cardinal *nprms));
\r
278 void AskQuestionReplyAction P((Widget w, XEvent *event,
\r
279 String *prms, Cardinal *nprms));
\r
280 void AskQuestionProc P((Widget w, XEvent *event,
\r
281 String *prms, Cardinal *nprms));
\r
282 void AskQuestionPopDown P((void));
\r
283 void PromotionPopUp P((void));
\r
284 void PromotionPopDown P((void));
\r
285 void PromotionCallback P((Widget w, XtPointer client_data,
\r
286 XtPointer call_data));
\r
287 void EditCommentPopDown P((void));
\r
288 void EditCommentCallback P((Widget w, XtPointer client_data,
\r
289 XtPointer call_data));
\r
290 void SelectCommand P((Widget w, XtPointer client_data, XtPointer call_data));
\r
291 void ResetProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
292 void LoadGameProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
293 void LoadNextGameProc P((Widget w, XEvent *event, String *prms,
\r
295 void LoadPrevGameProc P((Widget w, XEvent *event, String *prms,
\r
297 void ReloadGameProc P((Widget w, XEvent *event, String *prms,
\r
299 void LoadPositionProc P((Widget w, XEvent *event,
\r
300 String *prms, Cardinal *nprms));
\r
301 void LoadNextPositionProc P((Widget w, XEvent *event, String *prms,
\r
303 void LoadPrevPositionProc P((Widget w, XEvent *event, String *prms,
\r
305 void ReloadPositionProc P((Widget w, XEvent *event, String *prms,
\r
307 void CopyPositionProc P((Widget w, XEvent *event, String *prms,
\r
309 void PastePositionProc P((Widget w, XEvent *event, String *prms,
\r
311 void CopyGameProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
312 void PasteGameProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
313 void SaveGameProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
314 void SavePositionProc P((Widget w, XEvent *event,
\r
315 String *prms, Cardinal *nprms));
\r
316 void MailMoveProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
317 void ReloadCmailMsgProc P((Widget w, XEvent *event, String *prms,
\r
319 void QuitProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
320 void PauseProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
321 void MachineBlackProc P((Widget w, XEvent *event, String *prms,
\r
323 void MachineWhiteProc P((Widget w, XEvent *event,
\r
324 String *prms, Cardinal *nprms));
\r
325 void AnalyzeModeProc P((Widget w, XEvent *event,
\r
326 String *prms, Cardinal *nprms));
\r
327 void AnalyzeFileProc P((Widget w, XEvent *event,
\r
328 String *prms, Cardinal *nprms));
\r
329 void TwoMachinesProc P((Widget w, XEvent *event, String *prms,
\r
331 void IcsClientProc P((Widget w, XEvent *event, String *prms,
\r
333 void EditGameProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
334 void EditPositionProc P((Widget w, XEvent *event,
\r
335 String *prms, Cardinal *nprms));
\r
336 void TrainingProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
337 void EditCommentProc P((Widget w, XEvent *event,
\r
338 String *prms, Cardinal *nprms));
\r
339 void IcsInputBoxProc P((Widget w, XEvent *event,
\r
340 String *prms, Cardinal *nprms));
\r
341 void AcceptProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
342 void DeclineProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
343 void RematchProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
344 void CallFlagProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
345 void DrawProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
346 void AbortProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
347 void AdjournProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
348 void ResignProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
349 void EnterKeyProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
350 void StopObservingProc P((Widget w, XEvent *event, String *prms,
\r
352 void StopExaminingProc P((Widget w, XEvent *event, String *prms,
\r
354 void BackwardProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
355 void ForwardProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
356 void ToStartProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
357 void ToEndProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
358 void RevertProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
359 void TruncateGameProc P((Widget w, XEvent *event, String *prms,
\r
361 void RetractMoveProc P((Widget w, XEvent *event, String *prms,
\r
363 void MoveNowProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
364 void AlwaysQueenProc P((Widget w, XEvent *event, String *prms,
\r
366 void AnimateDraggingProc P((Widget w, XEvent *event, String *prms,
\r
368 void AnimateMovingProc P((Widget w, XEvent *event, String *prms,
\r
370 void AutocommProc P((Widget w, XEvent *event, String *prms,
\r
372 void AutoflagProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
373 void AutoflipProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
374 void AutobsProc P((Widget w, XEvent *event, String *prms,
\r
376 void AutoraiseProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
377 void AutosaveProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
378 void BlindfoldProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
379 void FlashMovesProc P((Widget w, XEvent *event, String *prms,
\r
381 void FlipViewProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
382 void GetMoveListProc P((Widget w, XEvent *event, String *prms,
\r
384 void HighlightDraggingProc P((Widget w, XEvent *event, String *prms,
\r
386 void HighlightLastMoveProc P((Widget w, XEvent *event, String *prms,
\r
388 void MoveSoundProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
389 void IcsAlarmProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
390 void OldSaveStyleProc P((Widget w, XEvent *event, String *prms,
\r
392 void PeriodicUpdatesProc P((Widget w, XEvent *event, String *prms,
\r
394 void PonderNextMoveProc P((Widget w, XEvent *event, String *prms,
\r
396 void PopupMoveErrorsProc P((Widget w, XEvent *event, String *prms,
\r
398 void PopupExitMessageProc P((Widget w, XEvent *event, String *prms,
\r
400 void PremoveProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
401 void QuietPlayProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
402 void ShowCoordsProc P((Widget w, XEvent *event, String *prms,
\r
404 void ShowThinkingProc P((Widget w, XEvent *event, String *prms,
\r
406 void HideThinkingProc P((Widget w, XEvent *event, String *prms,
\r
408 void TestLegalityProc P((Widget w, XEvent *event, String *prms,
\r
410 void InfoProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
411 void ManProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
412 void HintProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
413 void BookProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
414 void AboutGameProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
415 void AboutProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
416 void DebugProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
417 void NothingProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
418 void Iconify P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
419 void DisplayMove P((int moveNumber));
\r
420 void DisplayTitle P((char *title));
\r
421 void ICSInitScript P((void));
\r
422 int LoadGamePopUp P((FILE *f, int gameNumber, char *title));
\r
423 void ErrorPopUp P((char *title, char *text, int modal));
\r
424 void ErrorPopDown P((void));
\r
425 static char *ExpandPathName P((char *path));
\r
426 static void CreateAnimVars P((void));
\r
427 static void DragPieceBegin P((int x, int y));
\r
428 static void DragPieceMove P((int x, int y));
\r
429 static void DragPieceEnd P((int x, int y));
\r
430 static void DrawDragPiece P((void));
\r
431 char *ModeToWidgetName P((GameMode mode));
\r
432 void EngineOutputUpdate( FrontEndProgramStats * stats );
\r
433 void ShuffleMenuProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
434 void EngineMenuProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
435 void UciMenuProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
436 void TimeControlProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
437 void NewVariantProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
438 void FirstSettingsProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
439 void SecondSettingsProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
\r
440 void ShufflePopDown P(());
\r
441 void EnginePopDown P(());
\r
442 void UciPopDown P(());
\r
443 void TimeControlPopDown P(());
\r
444 void NewVariantPopDown P(());
\r
445 void SettingsPopDown P(());
\r
447 * XBoard depends on Xt R4 or higher
\r
449 int xtVersion = XtSpecificationRelease;
\r
453 Window xBoardWindow;
\r
454 Pixel lightSquareColor, darkSquareColor, whitePieceColor, blackPieceColor,
\r
455 jailSquareColor, highlightSquareColor, premoveHighlightColor;
\r
456 GC lightSquareGC, darkSquareGC, jailSquareGC, lineGC, wdPieceGC, wlPieceGC,
\r
457 bdPieceGC, blPieceGC, wbPieceGC, bwPieceGC, coordGC, highlineGC,
\r
458 wjPieceGC, bjPieceGC, prelineGC, countGC;
\r
459 Pixmap iconPixmap, wIconPixmap, bIconPixmap, xMarkPixmap;
\r
460 Widget shellWidget, layoutWidget, formWidget, boardWidget, messageWidget,
\r
461 whiteTimerWidget, blackTimerWidget, titleWidget, widgetList[16],
\r
462 commentShell, promotionShell, whitePieceMenu, blackPieceMenu, dropMenu,
\r
463 menuBarWidget, buttonBarWidget, editShell, errorShell, analysisShell,
\r
464 ICSInputShell, fileNameShell, askQuestionShell;
\r
465 XSegment gridSegments[(BOARD_SIZE + 1) * 2];
\r
466 XSegment jailGridSegments[(BOARD_SIZE + 3) * 2];
\r
467 Font clockFontID, coordFontID, countFontID;
\r
468 XFontStruct *clockFontStruct, *coordFontStruct, *countFontStruct;
\r
469 XtAppContext appContext;
\r
471 char *oldICSInteractionTitle;
\r
474 char *fileOpenMode;
\r
475 char installDir[] = "."; // [HGM] UCI: needed for UCI; probably needs run-time initializtion
\r
477 Position commentX = -1, commentY = -1;
\r
478 Dimension commentW, commentH;
\r
480 int squareSize, smallLayout = 0, tinyLayout = 0,
\r
481 marginW, marginH, // [HGM] for run-time resizing
\r
482 fromX = -1, fromY = -1, toX, toY, commentUp = False, analysisUp = False,
\r
483 ICSInputBoxUp = False, askQuestionUp = False,
\r
484 filenameUp = False, promotionUp = False, pmFromX = -1, pmFromY = -1,
\r
485 editUp = False, errorUp = False, errorExitStatus = -1, lineGap;
\r
486 Pixel timerForegroundPixel, timerBackgroundPixel;
\r
487 Pixel buttonForegroundPixel, buttonBackgroundPixel;
\r
488 char *chessDir, *programName, *programVersion,
\r
489 *gameCopyFilename, *gamePasteFilename;
\r
493 Pixmap pieceBitmap[2][(int)BlackPawn];
\r
494 Pixmap xpmPieceBitmap[4][(int)BlackPawn]; /* LL, LD, DL, DD */
\r
495 Pixmap xpmLightSquare, xpmDarkSquare, xpmJailSquare;
\r
496 int useImages, useImageSqs;
\r
497 XImage *ximPieceBitmap[4][(int)BlackPawn]; /* LL, LD, DL, DD */
\r
498 Pixmap ximMaskPm[(int)BlackPawn]; /* clipmasks, used for XIM pieces */
\r
499 XImage *ximLightSquare, *ximDarkSquare;
\r
502 #define pieceToSolid(piece) &pieceBitmap[SOLID][((int)(piece)) % (int)BlackPawn]
\r
503 #define pieceToOutline(piece) &pieceBitmap[OUTLINE][((int)(piece)) % (int)BlackPawn]
\r
505 #define White(piece) ((int)(piece) < (int)BlackPawn)
\r
507 /* Variables for doing smooth animation. This whole thing
\r
508 would be much easier if the board was double-buffered,
\r
509 but that would require a fairly major rewrite. */
\r
514 GC blitGC, pieceGC, outlineGC;
\r
515 XPoint startSquare, prevFrame, mouseDelta;
\r
518 Boolean dragActive;
\r
519 int startBoardX, startBoardY;
\r
522 /* There can be two pieces being animated at once: a player
\r
523 can begin dragging a piece before the remote opponent has moved. */
\r
525 static AnimState game, player;
\r
527 /* Bitmaps for use as masks when drawing XPM pieces.
\r
528 Need one for each black and white piece. */
\r
529 static Pixmap xpmMask[BlackKing + 1];
\r
531 /* This magic number is the number of intermediate frames used
\r
532 in each half of the animation. For short moves it's reduced
\r
533 by 1. The total number of frames will be factor * 2 + 1. */
\r
536 SizeDefaults sizeDefaults[] = SIZE_DEFAULTS;
\r
538 MenuItem fileMenu[] = {
\r
539 {N_("New Game"), ResetProc},
\r
540 {N_("New Shuffle Game ..."), ShuffleMenuProc},
\r
541 {N_("New Variant ..."), NewVariantProc}, // [HGM] variant: not functional yet
\r
542 {"----", NothingProc},
\r
543 {N_("Load Game"), LoadGameProc},
\r
544 {N_("Load Next Game"), LoadNextGameProc},
\r
545 {N_("Load Previous Game"), LoadPrevGameProc},
\r
546 {N_("Reload Same Game"), ReloadGameProc},
\r
547 {N_("Save Game"), SaveGameProc},
\r
548 {"----", NothingProc},
\r
549 {N_("Copy Game"), CopyGameProc},
\r
550 {N_("Paste Game"), PasteGameProc},
\r
551 {"----", NothingProc},
\r
552 {N_("Load Position"), LoadPositionProc},
\r
553 {N_("Load Next Position"), LoadNextPositionProc},
\r
554 {N_("Load Previous Position"), LoadPrevPositionProc},
\r
555 {N_("Reload Same Position"), ReloadPositionProc},
\r
556 {N_("Save Position"), SavePositionProc},
\r
557 {"----", NothingProc},
\r
558 {N_("Copy Position"), CopyPositionProc},
\r
559 {N_("Paste Position"), PastePositionProc},
\r
560 {"----", NothingProc},
\r
561 {N_("Mail Move"), MailMoveProc},
\r
562 {N_("Reload CMail Message"), ReloadCmailMsgProc},
\r
563 {"----", NothingProc},
\r
564 {N_("Exit"), QuitProc},
\r
568 MenuItem modeMenu[] = {
\r
569 {N_("Machine White"), MachineWhiteProc},
\r
570 {N_("Machine Black"), MachineBlackProc},
\r
571 {N_("Two Machines"), TwoMachinesProc},
\r
572 {N_("Analysis Mode"), AnalyzeModeProc},
\r
573 {N_("Analyze File"), AnalyzeFileProc },
\r
574 {N_("ICS Client"), IcsClientProc},
\r
575 {N_("Edit Game"), EditGameProc},
\r
576 {N_("Edit Position"), EditPositionProc},
\r
577 {N_("Training"), TrainingProc},
\r
578 {"----", NothingProc},
\r
579 {N_("Show Engine Output"), EngineOutputProc},
\r
580 {N_("Show Evaluation Graph"), NothingProc}, // [HGM] evalgr: not functional yet
\r
581 {N_("Show Game List"), ShowGameListProc},
\r
582 {"Show Move History", HistoryShowProc}, // [HGM] hist: activate 4.2.7 code
\r
583 {"----", NothingProc},
\r
584 {N_("Edit Tags"), EditTagsProc},
\r
585 {N_("Edit Comment"), EditCommentProc},
\r
586 {N_("ICS Input Box"), IcsInputBoxProc},
\r
587 {N_("Pause"), PauseProc},
\r
591 MenuItem actionMenu[] = {
\r
592 {N_("Accept"), AcceptProc},
\r
593 {N_("Decline"), DeclineProc},
\r
594 {N_("Rematch"), RematchProc},
\r
595 {"----", NothingProc},
\r
596 {N_("Call Flag"), CallFlagProc},
\r
597 {N_("Draw"), DrawProc},
\r
598 {N_("Adjourn"), AdjournProc},
\r
599 {N_("Abort"), AbortProc},
\r
600 {N_("Resign"), ResignProc},
\r
601 {"----", NothingProc},
\r
602 {N_("Stop Observing"), StopObservingProc},
\r
603 {N_("Stop Examining"), StopExaminingProc},
\r
607 MenuItem stepMenu[] = {
\r
608 {N_("Backward"), BackwardProc},
\r
609 {N_("Forward"), ForwardProc},
\r
610 {N_("Back to Start"), ToStartProc},
\r
611 {N_("Forward to End"), ToEndProc},
\r
612 {N_("Revert"), RevertProc},
\r
613 {N_("Truncate Game"), TruncateGameProc},
\r
614 {"----", NothingProc},
\r
615 {N_("Move Now"), MoveNowProc},
\r
616 {N_("Retract Move"), RetractMoveProc},
\r
620 MenuItem optionsMenu[] = {
\r
621 {N_("Flip View"), FlipViewProc},
\r
622 {"----", NothingProc},
\r
623 {N_("Adjudications ..."), EngineMenuProc},
\r
624 {N_("General Settings ..."), UciMenuProc},
\r
625 {N_("Engine #1 Settings ..."), FirstSettingsProc},
\r
626 {N_("Engine #2 Settings ..."), SecondSettingsProc},
\r
627 {N_("Time Control ..."), TimeControlProc},
\r
628 {"----", NothingProc},
\r
629 {N_("Always Queen"), AlwaysQueenProc},
\r
630 {N_("Animate Dragging"), AnimateDraggingProc},
\r
631 {N_("Animate Moving"), AnimateMovingProc},
\r
632 {N_("Auto Comment"), AutocommProc},
\r
633 {N_("Auto Flag"), AutoflagProc},
\r
634 {N_("Auto Flip View"), AutoflipProc},
\r
635 {N_("Auto Observe"), AutobsProc},
\r
636 {N_("Auto Raise Board"), AutoraiseProc},
\r
637 {N_("Auto Save"), AutosaveProc},
\r
638 {N_("Blindfold"), BlindfoldProc},
\r
639 {N_("Flash Moves"), FlashMovesProc},
\r
640 {N_("Get Move List"), GetMoveListProc},
\r
642 {N_("Highlight Dragging"), HighlightDraggingProc},
\r
644 {N_("Highlight Last Move"), HighlightLastMoveProc},
\r
645 {N_("Move Sound"), MoveSoundProc},
\r
646 {N_("ICS Alarm"), IcsAlarmProc},
\r
647 {N_("Old Save Style"), OldSaveStyleProc},
\r
648 {N_("Periodic Updates"), PeriodicUpdatesProc},
\r
649 {N_("Ponder Next Move"), PonderNextMoveProc},
\r
650 {N_("Popup Exit Message"), PopupExitMessageProc},
\r
651 {N_("Popup Move Errors"), PopupMoveErrorsProc},
\r
652 {N_("Premove"), PremoveProc},
\r
653 {N_("Quiet Play"), QuietPlayProc},
\r
654 {N_("Show Coords"), ShowCoordsProc},
\r
655 {N_("Hide Thinking"), HideThinkingProc},
\r
656 {N_("Test Legality"), TestLegalityProc},
\r
660 MenuItem helpMenu[] = {
\r
661 {N_("Info XBoard"), InfoProc},
\r
662 {N_("Man XBoard"), ManProc},
\r
663 {"----", NothingProc},
\r
664 {N_("Hint"), HintProc},
\r
665 {N_("Book"), BookProc},
\r
666 {"----", NothingProc},
\r
667 {N_("About XBoard"), AboutProc},
\r
672 {N_("File"), fileMenu},
\r
673 {N_("Mode"), modeMenu},
\r
674 {N_("Action"), actionMenu},
\r
675 {N_("Step"), stepMenu},
\r
676 {N_("Options"), optionsMenu},
\r
677 {N_("Help"), helpMenu},
\r
681 #define PAUSE_BUTTON N_("P")
\r
682 MenuItem buttonBar[] = {
\r
683 {"<<", ToStartProc},
\r
684 {"<", BackwardProc},
\r
685 {PAUSE_BUTTON, PauseProc},
\r
686 {">", ForwardProc},
\r
691 #define PIECE_MENU_SIZE 11
\r
692 String pieceMenuStrings[2][PIECE_MENU_SIZE] = {
\r
693 { N_("White"), "----", N_("Pawn"), N_("Knight"), N_("Bishop"), N_("Rook"),
\r
694 N_("Queen"), N_("King"), "----", N_("Empty square"), N_("Clear board") },
\r
695 { N_("Black"), "----", N_("Pawn"), N_("Knight"), N_("Bishop"), N_("Rook"),
\r
696 N_("Queen"), N_("King"), "----", N_("Empty square"), N_("Clear board") },
\r
698 /* must be in same order as PieceMenuStrings! */
\r
699 ChessSquare pieceMenuTranslation[2][PIECE_MENU_SIZE] = {
\r
700 { WhitePlay, (ChessSquare) 0, WhitePawn, WhiteKnight, WhiteBishop,
\r
701 WhiteRook, WhiteQueen, WhiteKing,
\r
702 (ChessSquare) 0, EmptySquare, ClearBoard },
\r
703 { BlackPlay, (ChessSquare) 0, BlackPawn, BlackKnight, BlackBishop,
\r
704 BlackRook, BlackQueen, BlackKing,
\r
705 (ChessSquare) 0, EmptySquare, ClearBoard },
\r
708 #define DROP_MENU_SIZE 6
\r
709 String dropMenuStrings[DROP_MENU_SIZE] = {
\r
710 "----", N_("Pawn"), N_("Knight"), N_("Bishop"), N_("Rook"), N_("Queen")
\r
712 /* must be in same order as PieceMenuStrings! */
\r
713 ChessSquare dropMenuTranslation[DROP_MENU_SIZE] = {
\r
714 (ChessSquare) 0, WhitePawn, WhiteKnight, WhiteBishop,
\r
715 WhiteRook, WhiteQueen
\r
723 DropMenuEnables dmEnables[] = {
\r
731 Arg shellArgs[] = {
\r
734 { XtNminWidth, 0 },
\r
735 { XtNminHeight, 0 },
\r
736 { XtNmaxWidth, 0 },
\r
737 { XtNmaxHeight, 0 }
\r
740 Arg layoutArgs[] = {
\r
741 { XtNborderWidth, 0 },
\r
742 { XtNdefaultDistance, 0 },
\r
746 { XtNborderWidth, 0 },
\r
747 { XtNresizable, (XtArgVal) True },
\r
750 Arg boardArgs[] = {
\r
751 { XtNborderWidth, 0 },
\r
756 Arg titleArgs[] = {
\r
757 { XtNjustify, (XtArgVal) XtJustifyRight },
\r
758 { XtNlabel, (XtArgVal) "..." },
\r
759 { XtNresizable, (XtArgVal) True },
\r
760 { XtNresize, (XtArgVal) False }
\r
763 Arg messageArgs[] = {
\r
764 { XtNjustify, (XtArgVal) XtJustifyLeft },
\r
765 { XtNlabel, (XtArgVal) "..." },
\r
766 { XtNresizable, (XtArgVal) True },
\r
767 { XtNresize, (XtArgVal) False }
\r
770 Arg timerArgs[] = {
\r
771 { XtNborderWidth, 0 },
\r
772 { XtNjustify, (XtArgVal) XtJustifyLeft }
\r
775 XtResource clientResources[] = {
\r
776 { "whitePieceColor", "whitePieceColor", XtRString, sizeof(String),
\r
777 XtOffset(AppDataPtr, whitePieceColor), XtRString,
\r
778 WHITE_PIECE_COLOR },
\r
779 { "blackPieceColor", "blackPieceColor", XtRString, sizeof(String),
\r
780 XtOffset(AppDataPtr, blackPieceColor), XtRString,
\r
781 BLACK_PIECE_COLOR },
\r
782 { "lightSquareColor", "lightSquareColor", XtRString,
\r
783 sizeof(String), XtOffset(AppDataPtr, lightSquareColor),
\r
784 XtRString, LIGHT_SQUARE_COLOR },
\r
785 { "darkSquareColor", "darkSquareColor", XtRString, sizeof(String),
\r
786 XtOffset(AppDataPtr, darkSquareColor), XtRString,
\r
787 DARK_SQUARE_COLOR },
\r
788 { "highlightSquareColor", "highlightSquareColor", XtRString,
\r
789 sizeof(String), XtOffset(AppDataPtr, highlightSquareColor),
\r
790 XtRString, HIGHLIGHT_SQUARE_COLOR },
\r
791 { "premoveHighlightColor", "premoveHighlightColor", XtRString,
\r
792 sizeof(String), XtOffset(AppDataPtr, premoveHighlightColor),
\r
793 XtRString, PREMOVE_HIGHLIGHT_COLOR },
\r
794 { "movesPerSession", "movesPerSession", XtRInt, sizeof(int),
\r
795 XtOffset(AppDataPtr, movesPerSession), XtRImmediate,
\r
796 (XtPointer) MOVES_PER_SESSION },
\r
797 { "timeIncrement", "timeIncrement", XtRInt, sizeof(int),
\r
798 XtOffset(AppDataPtr, timeIncrement), XtRImmediate,
\r
799 (XtPointer) TIME_INCREMENT },
\r
800 { "initString", "initString", XtRString, sizeof(String),
\r
801 XtOffset(AppDataPtr, initString), XtRString, INIT_STRING },
\r
802 { "secondInitString", "secondInitString", XtRString, sizeof(String),
\r
803 XtOffset(AppDataPtr, secondInitString), XtRString, INIT_STRING },
\r
804 { "firstComputerString", "firstComputerString", XtRString,
\r
805 sizeof(String), XtOffset(AppDataPtr, firstComputerString), XtRString,
\r
807 { "secondComputerString", "secondComputerString", XtRString,
\r
808 sizeof(String), XtOffset(AppDataPtr, secondComputerString), XtRString,
\r
810 { "firstChessProgram", "firstChessProgram", XtRString,
\r
811 sizeof(String), XtOffset(AppDataPtr, firstChessProgram),
\r
812 XtRString, FIRST_CHESS_PROGRAM },
\r
813 { "secondChessProgram", "secondChessProgram", XtRString,
\r
814 sizeof(String), XtOffset(AppDataPtr, secondChessProgram),
\r
815 XtRString, SECOND_CHESS_PROGRAM },
\r
816 { "firstPlaysBlack", "firstPlaysBlack", XtRBoolean,
\r
817 sizeof(Boolean), XtOffset(AppDataPtr, firstPlaysBlack),
\r
818 XtRImmediate, (XtPointer) False },
\r
819 { "noChessProgram", "noChessProgram", XtRBoolean,
\r
820 sizeof(Boolean), XtOffset(AppDataPtr, noChessProgram),
\r
821 XtRImmediate, (XtPointer) False },
\r
822 { "firstHost", "firstHost", XtRString, sizeof(String),
\r
823 XtOffset(AppDataPtr, firstHost), XtRString, FIRST_HOST },
\r
824 { "secondHost", "secondHost", XtRString, sizeof(String),
\r
825 XtOffset(AppDataPtr, secondHost), XtRString, SECOND_HOST },
\r
826 { "firstDirectory", "firstDirectory", XtRString, sizeof(String),
\r
827 XtOffset(AppDataPtr, firstDirectory), XtRString, "." },
\r
828 { "secondDirectory", "secondDirectory", XtRString, sizeof(String),
\r
829 XtOffset(AppDataPtr, secondDirectory), XtRString, "." },
\r
830 { "bitmapDirectory", "bitmapDirectory", XtRString,
\r
831 sizeof(String), XtOffset(AppDataPtr, bitmapDirectory),
\r
833 { "remoteShell", "remoteShell", XtRString, sizeof(String),
\r
834 XtOffset(AppDataPtr, remoteShell), XtRString, REMOTE_SHELL },
\r
835 { "remoteUser", "remoteUser", XtRString, sizeof(String),
\r
836 XtOffset(AppDataPtr, remoteUser), XtRString, "" },
\r
837 { "timeDelay", "timeDelay", XtRFloat, sizeof(float),
\r
838 XtOffset(AppDataPtr, timeDelay), XtRString,
\r
839 (XtPointer) TIME_DELAY_QUOTE },
\r
840 { "timeControl", "timeControl", XtRString, sizeof(String),
\r
841 XtOffset(AppDataPtr, timeControl), XtRString,
\r
842 (XtPointer) TIME_CONTROL },
\r
843 { "internetChessServerMode", "internetChessServerMode",
\r
844 XtRBoolean, sizeof(Boolean),
\r
845 XtOffset(AppDataPtr, icsActive), XtRImmediate,
\r
846 (XtPointer) False },
\r
847 { "internetChessServerHost", "internetChessServerHost",
\r
848 XtRString, sizeof(String),
\r
849 XtOffset(AppDataPtr, icsHost),
\r
850 XtRString, (XtPointer) ICS_HOST },
\r
851 { "internetChessServerPort", "internetChessServerPort",
\r
852 XtRString, sizeof(String),
\r
853 XtOffset(AppDataPtr, icsPort), XtRString,
\r
854 (XtPointer) ICS_PORT },
\r
855 { "internetChessServerCommPort", "internetChessServerCommPort",
\r
856 XtRString, sizeof(String),
\r
857 XtOffset(AppDataPtr, icsCommPort), XtRString,
\r
859 { "internetChessServerLogonScript", "internetChessServerLogonScript",
\r
860 XtRString, sizeof(String),
\r
861 XtOffset(AppDataPtr, icsLogon), XtRString,
\r
863 { "internetChessServerHelper", "internetChessServerHelper",
\r
864 XtRString, sizeof(String),
\r
865 XtOffset(AppDataPtr, icsHelper), XtRString, "" },
\r
866 { "internetChessServerInputBox", "internetChessServerInputBox",
\r
867 XtRBoolean, sizeof(Boolean),
\r
868 XtOffset(AppDataPtr, icsInputBox), XtRImmediate,
\r
869 (XtPointer) False },
\r
870 { "icsAlarm", "icsAlarm",
\r
871 XtRBoolean, sizeof(Boolean),
\r
872 XtOffset(AppDataPtr, icsAlarm), XtRImmediate,
\r
873 (XtPointer) True },
\r
874 { "icsAlarmTime", "icsAlarmTime",
\r
875 XtRInt, sizeof(int),
\r
876 XtOffset(AppDataPtr, icsAlarmTime), XtRImmediate,
\r
877 (XtPointer) 5000 },
\r
878 { "useTelnet", "useTelnet", XtRBoolean, sizeof(Boolean),
\r
879 XtOffset(AppDataPtr, useTelnet), XtRImmediate,
\r
880 (XtPointer) False },
\r
881 { "telnetProgram", "telnetProgram", XtRString, sizeof(String),
\r
882 XtOffset(AppDataPtr, telnetProgram), XtRString, TELNET_PROGRAM },
\r
883 { "gateway", "gateway", XtRString, sizeof(String),
\r
884 XtOffset(AppDataPtr, gateway), XtRString, "" },
\r
885 { "loadGameFile", "loadGameFile", XtRString, sizeof(String),
\r
886 XtOffset(AppDataPtr, loadGameFile), XtRString, "" },
\r
887 { "loadGameIndex", "loadGameIndex",
\r
888 XtRInt, sizeof(int),
\r
889 XtOffset(AppDataPtr, loadGameIndex), XtRImmediate,
\r
891 { "saveGameFile", "saveGameFile", XtRString, sizeof(String),
\r
892 XtOffset(AppDataPtr, saveGameFile), XtRString, "" },
\r
893 { "autoRaiseBoard", "autoRaiseBoard", XtRBoolean,
\r
894 sizeof(Boolean), XtOffset(AppDataPtr, autoRaiseBoard),
\r
895 XtRImmediate, (XtPointer) True },
\r
896 { "autoSaveGames", "autoSaveGames", XtRBoolean,
\r
897 sizeof(Boolean), XtOffset(AppDataPtr, autoSaveGames),
\r
898 XtRImmediate, (XtPointer) False },
\r
899 { "blindfold", "blindfold", XtRBoolean,
\r
900 sizeof(Boolean), XtOffset(AppDataPtr, blindfold),
\r
901 XtRImmediate, (XtPointer) False },
\r
902 { "loadPositionFile", "loadPositionFile", XtRString,
\r
903 sizeof(String), XtOffset(AppDataPtr, loadPositionFile),
\r
905 { "loadPositionIndex", "loadPositionIndex",
\r
906 XtRInt, sizeof(int),
\r
907 XtOffset(AppDataPtr, loadPositionIndex), XtRImmediate,
\r
909 { "savePositionFile", "savePositionFile", XtRString,
\r
910 sizeof(String), XtOffset(AppDataPtr, savePositionFile),
\r
912 { "matchMode", "matchMode", XtRBoolean, sizeof(Boolean),
\r
913 XtOffset(AppDataPtr, matchMode), XtRImmediate, (XtPointer) False },
\r
914 { "matchGames", "matchGames", XtRInt, sizeof(int),
\r
915 XtOffset(AppDataPtr, matchGames), XtRImmediate,
\r
917 { "monoMode", "monoMode", XtRBoolean, sizeof(Boolean),
\r
918 XtOffset(AppDataPtr, monoMode), XtRImmediate,
\r
919 (XtPointer) False },
\r
920 { "debugMode", "debugMode", XtRBoolean, sizeof(Boolean),
\r
921 XtOffset(AppDataPtr, debugMode), XtRImmediate,
\r
922 (XtPointer) False },
\r
923 { "clockMode", "clockMode", XtRBoolean, sizeof(Boolean),
\r
924 XtOffset(AppDataPtr, clockMode), XtRImmediate,
\r
925 (XtPointer) True },
\r
926 { "boardSize", "boardSize", XtRString, sizeof(String),
\r
927 XtOffset(AppDataPtr, boardSize), XtRString, "" },
\r
928 { "searchTime", "searchTime", XtRString, sizeof(String),
\r
929 XtOffset(AppDataPtr, searchTime), XtRString,
\r
931 { "searchDepth", "searchDepth", XtRInt, sizeof(int),
\r
932 XtOffset(AppDataPtr, searchDepth), XtRImmediate,
\r
934 { "showCoords", "showCoords", XtRBoolean, sizeof(Boolean),
\r
935 XtOffset(AppDataPtr, showCoords), XtRImmediate,
\r
936 (XtPointer) False },
\r
937 { "showJail", "showJail", XtRInt, sizeof(int),
\r
938 XtOffset(AppDataPtr, showJail), XtRImmediate,
\r
940 { "showThinking", "showThinking", XtRBoolean, sizeof(Boolean),
\r
941 XtOffset(AppDataPtr, showThinking), XtRImmediate,
\r
942 (XtPointer) True },
\r
943 { "ponderNextMove", "ponderNextMove", XtRBoolean, sizeof(Boolean),
\r
944 XtOffset(AppDataPtr, ponderNextMove), XtRImmediate,
\r
945 (XtPointer) True },
\r
946 { "periodicUpdates", "periodicUpdates", XtRBoolean, sizeof(Boolean),
\r
947 XtOffset(AppDataPtr, periodicUpdates), XtRImmediate,
\r
948 (XtPointer) True },
\r
949 { "clockFont", "clockFont", XtRString, sizeof(String),
\r
950 XtOffset(AppDataPtr, clockFont), XtRString, CLOCK_FONT },
\r
951 { "coordFont", "coordFont", XtRString, sizeof(String),
\r
952 XtOffset(AppDataPtr, coordFont), XtRString, COORD_FONT },
\r
953 { "font", "font", XtRString, sizeof(String),
\r
954 XtOffset(AppDataPtr, font), XtRString, DEFAULT_FONT },
\r
955 { "ringBellAfterMoves", "ringBellAfterMoves",
\r
956 XtRBoolean, sizeof(Boolean),
\r
957 XtOffset(AppDataPtr, ringBellAfterMoves),
\r
958 XtRImmediate, (XtPointer) False },
\r
959 { "autoCallFlag", "autoCallFlag", XtRBoolean,
\r
960 sizeof(Boolean), XtOffset(AppDataPtr, autoCallFlag),
\r
961 XtRImmediate, (XtPointer) False },
\r
962 { "autoFlipView", "autoFlipView", XtRBoolean,
\r
963 sizeof(Boolean), XtOffset(AppDataPtr, autoFlipView),
\r
964 XtRImmediate, (XtPointer) True },
\r
965 { "autoObserve", "autoObserve", XtRBoolean,
\r
966 sizeof(Boolean), XtOffset(AppDataPtr, autoObserve),
\r
967 XtRImmediate, (XtPointer) False },
\r
968 { "autoComment", "autoComment", XtRBoolean,
\r
969 sizeof(Boolean), XtOffset(AppDataPtr, autoComment),
\r
970 XtRImmediate, (XtPointer) False },
\r
971 { "getMoveList", "getMoveList", XtRBoolean,
\r
972 sizeof(Boolean), XtOffset(AppDataPtr, getMoveList),
\r
973 XtRImmediate, (XtPointer) True },
\r
975 { "highlightDragging", "highlightDragging", XtRBoolean,
\r
976 sizeof(Boolean), XtOffset(AppDataPtr, highlightDragging),
\r
977 XtRImmediate, (XtPointer) False },
\r
979 { "highlightLastMove", "highlightLastMove", XtRBoolean,
\r
980 sizeof(Boolean), XtOffset(AppDataPtr, highlightLastMove),
\r
981 XtRImmediate, (XtPointer) False },
\r
982 { "premove", "premove", XtRBoolean,
\r
983 sizeof(Boolean), XtOffset(AppDataPtr, premove),
\r
984 XtRImmediate, (XtPointer) True },
\r
985 { "testLegality", "testLegality", XtRBoolean,
\r
986 sizeof(Boolean), XtOffset(AppDataPtr, testLegality),
\r
987 XtRImmediate, (XtPointer) True },
\r
988 { "flipView", "flipView", XtRBoolean,
\r
989 sizeof(Boolean), XtOffset(AppDataPtr, flipView),
\r
990 XtRImmediate, (XtPointer) False },
\r
991 { "cmail", "cmailGameName", XtRString, sizeof(String),
\r
992 XtOffset(AppDataPtr, cmailGameName), XtRString, "" },
\r
993 { "alwaysPromoteToQueen", "alwaysPromoteToQueen", XtRBoolean,
\r
994 sizeof(Boolean), XtOffset(AppDataPtr, alwaysPromoteToQueen),
\r
995 XtRImmediate, (XtPointer) False },
\r
996 { "oldSaveStyle", "oldSaveStyle", XtRBoolean,
\r
997 sizeof(Boolean), XtOffset(AppDataPtr, oldSaveStyle),
\r
998 XtRImmediate, (XtPointer) False },
\r
999 { "quietPlay", "quietPlay", XtRBoolean,
\r
1000 sizeof(Boolean), XtOffset(AppDataPtr, quietPlay),
\r
1001 XtRImmediate, (XtPointer) False },
\r
1002 { "titleInWindow", "titleInWindow", XtRBoolean,
\r
1003 sizeof(Boolean), XtOffset(AppDataPtr, titleInWindow),
\r
1004 XtRImmediate, (XtPointer) False },
\r
1005 { "localLineEditing", "localLineEditing", XtRBoolean,
\r
1006 sizeof(Boolean), XtOffset(AppDataPtr, localLineEditing),
\r
1007 XtRImmediate, (XtPointer) True }, /* not implemented, must be True */
\r
1009 { "zippyTalk", "zippyTalk", XtRBoolean,
\r
1010 sizeof(Boolean), XtOffset(AppDataPtr, zippyTalk),
\r
1011 XtRImmediate, (XtPointer) ZIPPY_TALK },
\r
1012 { "zippyPlay", "zippyPlay", XtRBoolean,
\r
1013 sizeof(Boolean), XtOffset(AppDataPtr, zippyPlay),
\r
1014 XtRImmediate, (XtPointer) ZIPPY_PLAY },
\r
1015 { "zippyLines", "zippyLines", XtRString, sizeof(String),
\r
1016 XtOffset(AppDataPtr, zippyLines), XtRString, ZIPPY_LINES },
\r
1017 { "zippyPinhead", "zippyPinhead", XtRString, sizeof(String),
\r
1018 XtOffset(AppDataPtr, zippyPinhead), XtRString, ZIPPY_PINHEAD },
\r
1019 { "zippyPassword", "zippyPassword", XtRString, sizeof(String),
\r
1020 XtOffset(AppDataPtr, zippyPassword), XtRString, ZIPPY_PASSWORD },
\r
1021 { "zippyPassword2", "zippyPassword2", XtRString, sizeof(String),
\r
1022 XtOffset(AppDataPtr, zippyPassword2), XtRString, ZIPPY_PASSWORD2 },
\r
1023 { "zippyWrongPassword", "zippyWrongPassword", XtRString, sizeof(String),
\r
1024 XtOffset(AppDataPtr, zippyWrongPassword), XtRString,
\r
1025 ZIPPY_WRONG_PASSWORD },
\r
1026 { "zippyAcceptOnly", "zippyAcceptOnly", XtRString, sizeof(String),
\r
1027 XtOffset(AppDataPtr, zippyAcceptOnly), XtRString, ZIPPY_ACCEPT_ONLY },
\r
1028 { "zippyUseI", "zippyUseI", XtRBoolean,
\r
1029 sizeof(Boolean), XtOffset(AppDataPtr, zippyUseI),
\r
1030 XtRImmediate, (XtPointer) ZIPPY_USE_I },
\r
1031 { "zippyBughouse", "zippyBughouse", XtRInt,
\r
1032 sizeof(int), XtOffset(AppDataPtr, zippyBughouse),
\r
1033 XtRImmediate, (XtPointer) ZIPPY_BUGHOUSE },
\r
1034 { "zippyNoplayCrafty", "zippyNoplayCrafty", XtRBoolean,
\r
1035 sizeof(Boolean), XtOffset(AppDataPtr, zippyNoplayCrafty),
\r
1036 XtRImmediate, (XtPointer) ZIPPY_NOPLAY_CRAFTY },
\r
1037 { "zippyGameEnd", "zippyGameEnd", XtRString, sizeof(String),
\r
1038 XtOffset(AppDataPtr, zippyGameEnd), XtRString, ZIPPY_GAME_END },
\r
1039 { "zippyGameStart", "zippyGameStart", XtRString, sizeof(String),
\r
1040 XtOffset(AppDataPtr, zippyGameStart), XtRString, ZIPPY_GAME_START },
\r
1041 { "zippyAdjourn", "zippyAdjourn", XtRBoolean,
\r
1042 sizeof(Boolean), XtOffset(AppDataPtr, zippyAdjourn),
\r
1043 XtRImmediate, (XtPointer) ZIPPY_ADJOURN },
\r
1044 { "zippyAbort", "zippyAbort", XtRBoolean,
\r
1045 sizeof(Boolean), XtOffset(AppDataPtr, zippyAbort),
\r
1046 XtRImmediate, (XtPointer) ZIPPY_ABORT },
\r
1047 { "zippyVariants", "zippyVariants", XtRString, sizeof(String),
\r
1048 XtOffset(AppDataPtr, zippyVariants), XtRString, ZIPPY_VARIANTS },
\r
1049 { "zippyMaxGames", "zippyMaxGames", XtRInt, sizeof(int),
\r
1050 XtOffset(AppDataPtr, zippyMaxGames), XtRImmediate,
\r
1051 (XtPointer) ZIPPY_MAX_GAMES },
\r
1052 { "zippyReplayTimeout", "zippyReplayTimeout", XtRInt, sizeof(int),
\r
1053 XtOffset(AppDataPtr, zippyReplayTimeout), XtRImmediate,
\r
1054 (XtPointer) ZIPPY_REPLAY_TIMEOUT },
\r
1056 { "flashCount", "flashCount", XtRInt, sizeof(int),
\r
1057 XtOffset(AppDataPtr, flashCount), XtRImmediate,
\r
1058 (XtPointer) FLASH_COUNT },
\r
1059 { "flashRate", "flashRate", XtRInt, sizeof(int),
\r
1060 XtOffset(AppDataPtr, flashRate), XtRImmediate,
\r
1061 (XtPointer) FLASH_RATE },
\r
1062 { "pixmapDirectory", "pixmapDirectory", XtRString,
\r
1063 sizeof(String), XtOffset(AppDataPtr, pixmapDirectory),
\r
1065 { "msLoginDelay", "msLoginDelay", XtRInt, sizeof(int),
\r
1066 XtOffset(AppDataPtr, msLoginDelay), XtRImmediate,
\r
1067 (XtPointer) MS_LOGIN_DELAY },
\r
1068 { "colorizeMessages", "colorizeMessages", XtRBoolean,
\r
1069 sizeof(Boolean), XtOffset(AppDataPtr, colorize),
\r
1070 XtRImmediate, (XtPointer) False },
\r
1071 { "colorShout", "colorShout", XtRString,
\r
1072 sizeof(String), XtOffset(AppDataPtr, colorShout),
\r
1073 XtRString, COLOR_SHOUT },
\r
1074 { "colorSShout", "colorSShout", XtRString,
\r
1075 sizeof(String), XtOffset(AppDataPtr, colorSShout),
\r
1076 XtRString, COLOR_SSHOUT },
\r
1077 { "colorChannel1", "colorChannel1", XtRString,
\r
1078 sizeof(String), XtOffset(AppDataPtr, colorChannel1),
\r
1079 XtRString, COLOR_CHANNEL1 },
\r
1080 { "colorChannel", "colorChannel", XtRString,
\r
1081 sizeof(String), XtOffset(AppDataPtr, colorChannel),
\r
1082 XtRString, COLOR_CHANNEL },
\r
1083 { "colorKibitz", "colorKibitz", XtRString,
\r
1084 sizeof(String), XtOffset(AppDataPtr, colorKibitz),
\r
1085 XtRString, COLOR_KIBITZ },
\r
1086 { "colorTell", "colorTell", XtRString,
\r
1087 sizeof(String), XtOffset(AppDataPtr, colorTell),
\r
1088 XtRString, COLOR_TELL },
\r
1089 { "colorChallenge", "colorChallenge", XtRString,
\r
1090 sizeof(String), XtOffset(AppDataPtr, colorChallenge),
\r
1091 XtRString, COLOR_CHALLENGE },
\r
1092 { "colorRequest", "colorRequest", XtRString,
\r
1093 sizeof(String), XtOffset(AppDataPtr, colorRequest),
\r
1094 XtRString, COLOR_REQUEST },
\r
1095 { "colorSeek", "colorSeek", XtRString,
\r
1096 sizeof(String), XtOffset(AppDataPtr, colorSeek),
\r
1097 XtRString, COLOR_SEEK },
\r
1098 { "colorNormal", "colorNormal", XtRString,
\r
1099 sizeof(String), XtOffset(AppDataPtr, colorNormal),
\r
1100 XtRString, COLOR_NORMAL },
\r
1101 { "soundProgram", "soundProgram", XtRString,
\r
1102 sizeof(String), XtOffset(AppDataPtr, soundProgram),
\r
1103 XtRString, "play" },
\r
1104 { "soundShout", "soundShout", XtRString,
\r
1105 sizeof(String), XtOffset(AppDataPtr, soundShout),
\r
1107 { "soundSShout", "soundSShout", XtRString,
\r
1108 sizeof(String), XtOffset(AppDataPtr, soundSShout),
\r
1110 { "soundChannel1", "soundChannel1", XtRString,
\r
1111 sizeof(String), XtOffset(AppDataPtr, soundChannel1),
\r
1113 { "soundChannel", "soundChannel", XtRString,
\r
1114 sizeof(String), XtOffset(AppDataPtr, soundChannel),
\r
1116 { "soundKibitz", "soundKibitz", XtRString,
\r
1117 sizeof(String), XtOffset(AppDataPtr, soundKibitz),
\r
1119 { "soundTell", "soundTell", XtRString,
\r
1120 sizeof(String), XtOffset(AppDataPtr, soundTell),
\r
1122 { "soundChallenge", "soundChallenge", XtRString,
\r
1123 sizeof(String), XtOffset(AppDataPtr, soundChallenge),
\r
1125 { "soundRequest", "soundRequest", XtRString,
\r
1126 sizeof(String), XtOffset(AppDataPtr, soundRequest),
\r
1128 { "soundSeek", "soundSeek", XtRString,
\r
1129 sizeof(String), XtOffset(AppDataPtr, soundSeek),
\r
1131 { "soundMove", "soundMove", XtRString,
\r
1132 sizeof(String), XtOffset(AppDataPtr, soundMove),
\r
1134 { "soundIcsWin", "soundIcsWin", XtRString,
\r
1135 sizeof(String), XtOffset(AppDataPtr, soundIcsWin),
\r
1137 { "soundIcsLoss", "soundIcsLoss", XtRString,
\r
1138 sizeof(String), XtOffset(AppDataPtr, soundIcsLoss),
\r
1140 { "soundIcsDraw", "soundIcsDraw", XtRString,
\r
1141 sizeof(String), XtOffset(AppDataPtr, soundIcsDraw),
\r
1143 { "soundIcsUnfinished", "soundIcsUnfinished", XtRString,
\r
1144 sizeof(String), XtOffset(AppDataPtr, soundIcsUnfinished),
\r
1146 { "soundIcsAlarm", "soundIcsAlarm", XtRString,
\r
1147 sizeof(String), XtOffset(AppDataPtr, soundIcsAlarm),
\r
1149 { "reuseFirst", "reuseFirst", XtRBoolean,
\r
1150 sizeof(Boolean), XtOffset(AppDataPtr, reuseFirst),
\r
1151 XtRImmediate, (XtPointer) True },
\r
1152 { "reuseSecond", "reuseSecond", XtRBoolean,
\r
1153 sizeof(Boolean), XtOffset(AppDataPtr, reuseSecond),
\r
1154 XtRImmediate, (XtPointer) True },
\r
1155 { "animateDragging", "animateDragging", XtRBoolean,
\r
1156 sizeof(Boolean), XtOffset(AppDataPtr, animateDragging),
\r
1157 XtRImmediate, (XtPointer) True },
\r
1158 { "animateMoving", "animateMoving", XtRBoolean,
\r
1159 sizeof(Boolean), XtOffset(AppDataPtr, animate),
\r
1160 XtRImmediate, (XtPointer) True },
\r
1161 { "animateSpeed", "animateSpeed", XtRInt,
\r
1162 sizeof(int), XtOffset(AppDataPtr, animSpeed),
\r
1163 XtRImmediate, (XtPointer)10 },
\r
1164 { "popupExitMessage", "popupExitMessage", XtRBoolean,
\r
1165 sizeof(Boolean), XtOffset(AppDataPtr, popupExitMessage),
\r
1166 XtRImmediate, (XtPointer) True },
\r
1167 { "popupMoveErrors", "popupMoveErrors", XtRBoolean,
\r
1168 sizeof(Boolean), XtOffset(AppDataPtr, popupMoveErrors),
\r
1169 XtRImmediate, (XtPointer) False },
\r
1170 { "fontSizeTolerance", "fontSizeTolerance", XtRInt,
\r
1171 sizeof(int), XtOffset(AppDataPtr, fontSizeTolerance),
\r
1172 XtRImmediate, (XtPointer)4 },
\r
1173 { "initialMode", "initialMode", XtRString,
\r
1174 sizeof(String), XtOffset(AppDataPtr, initialMode),
\r
1175 XtRImmediate, (XtPointer) "" },
\r
1176 { "variant", "variant", XtRString,
\r
1177 sizeof(String), XtOffset(AppDataPtr, variant),
\r
1178 XtRImmediate, (XtPointer) "normal" },
\r
1179 { "firstProtocolVersion", "firstProtocolVersion", XtRInt,
\r
1180 sizeof(int), XtOffset(AppDataPtr, firstProtocolVersion),
\r
1181 XtRImmediate, (XtPointer)PROTOVER },
\r
1182 { "secondProtocolVersion", "secondProtocolVersion", XtRInt,
\r
1183 sizeof(int), XtOffset(AppDataPtr, secondProtocolVersion),
\r
1184 XtRImmediate, (XtPointer)PROTOVER },
\r
1185 { "showButtonBar", "showButtonBar", XtRBoolean,
\r
1186 sizeof(Boolean), XtOffset(AppDataPtr, showButtonBar),
\r
1187 XtRImmediate, (XtPointer) True },
\r
1188 {"icsEngineAnalyze", "icsEngineAnalyze", XtRBoolean, /* [DM] icsEngineAnalyze */
\r
1189 sizeof(Boolean), XtOffset(AppDataPtr, icsEngineAnalyze),
\r
1190 XtRImmediate, (XtPointer) False },
\r
1191 { "firstScoreAbs", "firstScoreAbs", XtRBoolean,
\r
1192 sizeof(Boolean), XtOffset(AppDataPtr, firstScoreIsAbsolute),
\r
1193 XtRImmediate, (XtPointer) False },
\r
1194 { "secondScoreAbs", "secondScoreAbs", XtRBoolean,
\r
1195 sizeof(Boolean), XtOffset(AppDataPtr, secondScoreIsAbsolute),
\r
1196 XtRImmediate, (XtPointer) False },
\r
1197 { "pgnExtendedInfo", "pgnExtendedInfo", XtRBoolean,
\r
1198 sizeof(Boolean), XtOffset(AppDataPtr, saveExtendedInfoInPGN),
\r
1199 XtRImmediate, (XtPointer) False },
\r
1200 { "hideThinkingFromHuman", "hideThinkingFromHuman", XtRBoolean,
\r
1201 sizeof(Boolean), XtOffset(AppDataPtr, hideThinkingFromHuman),
\r
1202 XtRImmediate, (XtPointer) True },
\r
1203 { "adjudicateLossThreshold", "adjudicateLossThreshold", XtRInt,
\r
1204 sizeof(int), XtOffset(AppDataPtr, adjudicateLossThreshold),
\r
1205 XtRImmediate, (XtPointer) 0},
\r
1206 { "pgnEventHeader", "pgnEventHeader", XtRString,
\r
1207 sizeof(String), XtOffset(AppDataPtr, pgnEventHeader),
\r
1208 XtRImmediate, (XtPointer) "Computer Chess Game" },
\r
1209 { "defaultFrcPosition", "defaultFrcPositon", XtRInt,
\r
1210 sizeof(int), XtOffset(AppDataPtr, defaultFrcPosition),
\r
1211 XtRImmediate, (XtPointer) -1},
\r
1213 // [HGM] 4.3.xx options
\r
1214 { "boardWidth", "boardWidth", XtRInt,
\r
1215 sizeof(int), XtOffset(AppDataPtr, NrFiles),
\r
1216 XtRImmediate, (XtPointer) -1},
\r
1217 { "boardHeight", "boardHeight", XtRInt,
\r
1218 sizeof(int), XtOffset(AppDataPtr, NrRanks),
\r
1219 XtRImmediate, (XtPointer) -1},
\r
1220 { "matchPause", "matchPause", XtRInt,
\r
1221 sizeof(int), XtOffset(AppDataPtr, matchPause),
\r
1222 XtRImmediate, (XtPointer) 10000},
\r
1223 { "holdingsSize", "holdingsSize", XtRInt,
\r
1224 sizeof(int), XtOffset(AppDataPtr, holdingsSize),
\r
1225 XtRImmediate, (XtPointer) -1},
\r
1226 { "flipBlack", "flipBlack", XtRBoolean,
\r
1227 sizeof(Boolean), XtOffset(AppDataPtr, upsideDown),
\r
1228 XtRImmediate, (XtPointer) False},
\r
1229 { "allWhite", "allWhite", XtRBoolean,
\r
1230 sizeof(Boolean), XtOffset(AppDataPtr, allWhite),
\r
1231 XtRImmediate, (XtPointer) False},
\r
1232 { "pieceToCharTable", "pieceToCharTable", XtRString,
\r
1233 sizeof(String), XtOffset(AppDataPtr, pieceToCharTable),
\r
1234 XtRImmediate, (XtPointer) 0},
\r
1235 { "alphaRank", "alphaRank", XtRBoolean,
\r
1236 sizeof(Boolean), XtOffset(AppDataPtr, alphaRank),
\r
1237 XtRImmediate, (XtPointer) False},
\r
1238 { "testClaims", "testClaims", XtRBoolean,
\r
1239 sizeof(Boolean), XtOffset(AppDataPtr, testClaims),
\r
1240 XtRImmediate, (XtPointer) True},
\r
1241 { "checkMates", "checkMates", XtRBoolean,
\r
1242 sizeof(Boolean), XtOffset(AppDataPtr, checkMates),
\r
1243 XtRImmediate, (XtPointer) True},
\r
1244 { "materialDraws", "materialDraws", XtRBoolean,
\r
1245 sizeof(Boolean), XtOffset(AppDataPtr, materialDraws),
\r
1246 XtRImmediate, (XtPointer) True},
\r
1247 { "trivialDraws", "trivialDraws", XtRBoolean,
\r
1248 sizeof(Boolean), XtOffset(AppDataPtr, trivialDraws),
\r
1249 XtRImmediate, (XtPointer) False},
\r
1250 { "ruleMoves", "ruleMoves", XtRInt,
\r
1251 sizeof(int), XtOffset(AppDataPtr, ruleMoves),
\r
1252 XtRImmediate, (XtPointer) 51},
\r
1253 { "repeatsToDraw", "repeatsToDraw", XtRInt,
\r
1254 sizeof(int), XtOffset(AppDataPtr, drawRepeats),
\r
1255 XtRImmediate, (XtPointer) 6},
\r
1256 { "engineDebugOutput", "engineDebugOutput", XtRInt,
\r
1257 sizeof(int), XtOffset(AppDataPtr, engineComments),
\r
1258 XtRImmediate, (XtPointer) 1},
\r
1259 { "userName", "userName", XtRString,
\r
1260 sizeof(int), XtOffset(AppDataPtr, userName),
\r
1261 XtRImmediate, (XtPointer) 0},
\r
1262 { "autoKibitz", "autoKibitz", XtRBoolean,
\r
1263 sizeof(Boolean), XtOffset(AppDataPtr, autoKibitz),
\r
1264 XtRImmediate, (XtPointer) False},
\r
1265 { "firstTimeOdds", "firstTimeOdds", XtRInt,
\r
1266 sizeof(int), XtOffset(AppDataPtr, firstTimeOdds),
\r
1267 XtRImmediate, (XtPointer) 1},
\r
1268 { "secondTimeOdds", "secondTimeOdds", XtRInt,
\r
1269 sizeof(int), XtOffset(AppDataPtr, secondTimeOdds),
\r
1270 XtRImmediate, (XtPointer) 1},
\r
1271 { "timeOddsMode", "timeOddsMode", XtRInt,
\r
1272 sizeof(int), XtOffset(AppDataPtr, timeOddsMode),
\r
1273 XtRImmediate, (XtPointer) 0},
\r
1274 { "firstAccumulateTC", "firstAccumulateTC", XtRInt,
\r
1275 sizeof(int), XtOffset(AppDataPtr, firstAccumulateTC),
\r
1276 XtRImmediate, (XtPointer) 1},
\r
1277 { "secondAccumulateTC", "secondAccumulateTC", XtRInt,
\r
1278 sizeof(int), XtOffset(AppDataPtr, secondAccumulateTC),
\r
1279 XtRImmediate, (XtPointer) 1},
\r
1280 { "firstNPS", "firstNPS", XtRInt,
\r
1281 sizeof(int), XtOffset(AppDataPtr, firstNPS),
\r
1282 XtRImmediate, (XtPointer) -1},
\r
1283 { "secondNPS", "secondNPS", XtRInt,
\r
1284 sizeof(int), XtOffset(AppDataPtr, secondNPS),
\r
1285 XtRImmediate, (XtPointer) -1},
\r
1286 { "serverMoves", "serverMoves", XtRString,
\r
1287 sizeof(String), XtOffset(AppDataPtr, serverMovesName),
\r
1288 XtRImmediate, (XtPointer) 0},
\r
1289 { "serverPause", "serverPause", XtRInt,
\r
1290 sizeof(int), XtOffset(AppDataPtr, serverPause),
\r
1291 XtRImmediate, (XtPointer) 0},
\r
1292 { "suppressLoadMoves", "suppressLoadMoves", XtRBoolean,
\r
1293 sizeof(Boolean), XtOffset(AppDataPtr, suppressLoadMoves),
\r
1294 XtRImmediate, (XtPointer) False},
\r
1295 { "userName", "userName", XtRString,
\r
1296 sizeof(String), XtOffset(AppDataPtr, userName),
\r
1297 XtRImmediate, (XtPointer) 0},
\r
1298 { "egtFormats", "egtFormats", XtRString,
\r
1299 sizeof(String), XtOffset(AppDataPtr, egtFormats),
\r
1300 XtRImmediate, (XtPointer) 0},
\r
1301 { "rewindIndex", "rewindIndex", XtRInt,
\r
1302 sizeof(int), XtOffset(AppDataPtr, rewindIndex),
\r
1303 XtRImmediate, (XtPointer) 0},
\r
1304 { "sameColorGames", "sameColorGames", XtRInt,
\r
1305 sizeof(int), XtOffset(AppDataPtr, sameColorGames),
\r
1306 XtRImmediate, (XtPointer) 0},
\r
1307 { "smpCores", "smpCores", XtRInt,
\r
1308 sizeof(int), XtOffset(AppDataPtr, smpCores),
\r
1309 XtRImmediate, (XtPointer) 1},
\r
1310 { "niceEngines", "niceEngines", XtRInt,
\r
1311 sizeof(int), XtOffset(AppDataPtr, niceEngines),
\r
1312 XtRImmediate, (XtPointer) 0},
\r
1313 { "nameOfDebugFile", "nameOfDebugFile", XtRString,
\r
1314 sizeof(String), XtOffset(AppDataPtr, nameOfDebugFile),
\r
1315 XtRImmediate, (XtPointer) "xboard.debug"},
\r
1316 { "noGUI", "noGUI", XtRBoolean,
\r
1317 sizeof(Boolean), XtOffset(AppDataPtr, noGUI),
\r
1318 XtRImmediate, (XtPointer) 0},
\r
1319 { "firstOptions", "firstOptions", XtRString,
\r
1320 sizeof(String), XtOffset(AppDataPtr, firstOptions),
\r
1321 XtRImmediate, (XtPointer) "" },
\r
1322 { "secondOptions", "secondOptions", XtRString,
\r
1323 sizeof(String), XtOffset(AppDataPtr, secondOptions),
\r
1324 XtRImmediate, (XtPointer) "" },
\r
1326 // [HGM] Winboard_x UCI options
\r
1327 { "firstIsUCI", "firstIsUCI", XtRBoolean,
\r
1328 sizeof(Boolean), XtOffset(AppDataPtr, firstIsUCI),
\r
1329 XtRImmediate, (XtPointer) False},
\r
1330 { "secondIsUCI", "secondIsUCI", XtRBoolean,
\r
1331 sizeof(Boolean), XtOffset(AppDataPtr, secondIsUCI),
\r
1332 XtRImmediate, (XtPointer) False},
\r
1333 { "firstHasOwnBookUCI", "firstHasOwnBookUCI", XtRBoolean,
\r
1334 sizeof(Boolean), XtOffset(AppDataPtr, firstHasOwnBookUCI),
\r
1335 XtRImmediate, (XtPointer) True},
\r
1336 { "secondHasOwnBookUCI", "secondHasOwnBookUCI", XtRBoolean,
\r
1337 sizeof(Boolean), XtOffset(AppDataPtr, secondHasOwnBookUCI),
\r
1338 XtRImmediate, (XtPointer) True},
\r
1339 { "usePolyglotBook", "usePolyglotBook", XtRBoolean,
\r
1340 sizeof(Boolean), XtOffset(AppDataPtr, usePolyglotBook),
\r
1341 XtRImmediate, (XtPointer) False},
\r
1342 { "defaultHashSize", "defaultHashSize", XtRInt,
\r
1343 sizeof(int), XtOffset(AppDataPtr, defaultHashSize),
\r
1344 XtRImmediate, (XtPointer) 64},
\r
1345 { "defaultCacheSizeEGTB", "defaultCacheSizeEGTB", XtRInt,
\r
1346 sizeof(int), XtOffset(AppDataPtr, defaultCacheSizeEGTB),
\r
1347 XtRImmediate, (XtPointer) 4},
\r
1348 { "polyglotDir", "polyglotDir", XtRString,
\r
1349 sizeof(String), XtOffset(AppDataPtr, polyglotDir),
\r
1350 XtRImmediate, (XtPointer) "." },
\r
1351 { "polyglotBook", "polyglotBook", XtRString,
\r
1352 sizeof(String), XtOffset(AppDataPtr, polyglotBook),
\r
1353 XtRImmediate, (XtPointer) "" },
\r
1354 { "defaultPathEGTB", "defaultPathEGTB", XtRString,
\r
1355 sizeof(String), XtOffset(AppDataPtr, defaultPathEGTB),
\r
1356 XtRImmediate, (XtPointer) "/usr/local/share/egtb"},
\r
1357 { "delayBeforeQuit", "delayBeforeQuit", XtRInt,
\r
1358 sizeof(int), XtOffset(AppDataPtr, delayBeforeQuit),
\r
1359 XtRImmediate, (XtPointer) 0},
\r
1360 { "delayAfterQuit", "delayAfterQuit", XtRInt,
\r
1361 sizeof(int), XtOffset(AppDataPtr, delayAfterQuit),
\r
1362 XtRImmediate, (XtPointer) 0},
\r
1365 XrmOptionDescRec shellOptions[] = {
\r
1366 { "-whitePieceColor", "whitePieceColor", XrmoptionSepArg, NULL },
\r
1367 { "-blackPieceColor", "blackPieceColor", XrmoptionSepArg, NULL },
\r
1368 { "-lightSquareColor", "lightSquareColor", XrmoptionSepArg, NULL },
\r
1369 { "-darkSquareColor", "darkSquareColor", XrmoptionSepArg, NULL },
\r
1370 { "-highlightSquareColor", "highlightSquareColor", XrmoptionSepArg, NULL },
\r
1371 { "-premoveHighlightColor", "premoveHighlightColor", XrmoptionSepArg,NULL},
\r
1372 { "-movesPerSession", "movesPerSession", XrmoptionSepArg, NULL },
\r
1373 { "-mps", "movesPerSession", XrmoptionSepArg, NULL },
\r
1374 { "-timeIncrement", "timeIncrement", XrmoptionSepArg, NULL },
\r
1375 { "-inc", "timeIncrement", XrmoptionSepArg, NULL },
\r
1376 { "-initString", "initString", XrmoptionSepArg, NULL },
\r
1377 { "-firstInitString", "initString", XrmoptionSepArg, NULL },
\r
1378 { "-secondInitString", "secondInitString", XrmoptionSepArg, NULL },
\r
1379 { "-firstComputerString", "firstComputerString", XrmoptionSepArg, NULL },
\r
1380 { "-secondComputerString", "secondComputerString", XrmoptionSepArg, NULL },
\r
1381 { "-firstChessProgram", "firstChessProgram", XrmoptionSepArg, NULL },
\r
1382 { "-fcp", "firstChessProgram", XrmoptionSepArg, NULL },
\r
1383 { "-secondChessProgram", "secondChessProgram", XrmoptionSepArg, NULL },
\r
1384 { "-scp", "secondChessProgram", XrmoptionSepArg, NULL },
\r
1385 { "-firstPlaysBlack", "firstPlaysBlack", XrmoptionSepArg, NULL },
\r
1386 { "-fb", "firstPlaysBlack", XrmoptionNoArg, "True" },
\r
1387 { "-xfb", "firstPlaysBlack", XrmoptionNoArg, "False" },
\r
1388 { "-noChessProgram", "noChessProgram", XrmoptionSepArg, NULL },
\r
1389 { "-ncp", "noChessProgram", XrmoptionNoArg, "True" },
\r
1390 { "-xncp", "noChessProgram", XrmoptionNoArg, "False" },
\r
1391 { "-firstHost", "firstHost", XrmoptionSepArg, NULL },
\r
1392 { "-fh", "firstHost", XrmoptionSepArg, NULL },
\r
1393 { "-secondHost", "secondHost", XrmoptionSepArg, NULL },
\r
1394 { "-sh", "secondHost", XrmoptionSepArg, NULL },
\r
1395 { "-firstDirectory", "firstDirectory", XrmoptionSepArg, NULL },
\r
1396 { "-fd", "firstDirectory", XrmoptionSepArg, NULL },
\r
1397 { "-secondDirectory", "secondDirectory", XrmoptionSepArg, NULL },
\r
1398 { "-sd", "secondDirectory", XrmoptionSepArg, NULL },
\r
1399 { "-bitmapDirectory", "bitmapDirectory", XrmoptionSepArg, NULL },
\r
1400 { "-bm", "bitmapDirectory", XrmoptionSepArg, NULL },
\r
1401 { "-remoteShell", "remoteShell", XrmoptionSepArg, NULL },
\r
1402 { "-rsh", "remoteShell", XrmoptionSepArg, NULL },
\r
1403 { "-remoteUser", "remoteUser", XrmoptionSepArg, NULL },
\r
1404 { "-ruser", "remoteUser", XrmoptionSepArg, NULL },
\r
1405 { "-timeDelay", "timeDelay", XrmoptionSepArg, NULL },
\r
1406 { "-td", "timeDelay", XrmoptionSepArg, NULL },
\r
1407 { "-timeControl", "timeControl", XrmoptionSepArg, NULL },
\r
1408 { "-tc", "timeControl", XrmoptionSepArg, NULL },
\r
1409 { "-internetChessServerMode", "internetChessServerMode",
\r
1410 XrmoptionSepArg, NULL },
\r
1411 { "-ics", "internetChessServerMode", XrmoptionNoArg, "True" },
\r
1412 { "-xics", "internetChessServerMode", XrmoptionNoArg, "False" },
\r
1413 { "-internetChessServerHost", "internetChessServerHost",
\r
1414 XrmoptionSepArg, NULL },
\r
1415 { "-icshost", "internetChessServerHost", XrmoptionSepArg, NULL },
\r
1416 { "-internetChessServerPort", "internetChessServerPort",
\r
1417 XrmoptionSepArg, NULL },
\r
1418 { "-icsport", "internetChessServerPort", XrmoptionSepArg, NULL },
\r
1419 { "-internetChessServerCommPort", "internetChessServerCommPort",
\r
1420 XrmoptionSepArg, NULL },
\r
1421 { "-icscomm", "internetChessServerCommPort", XrmoptionSepArg, NULL },
\r
1422 { "-internetChessServerLogonScript", "internetChessServerLogonScript",
\r
1423 XrmoptionSepArg, NULL },
\r
1424 { "-icslogon", "internetChessServerLogonScript", XrmoptionSepArg, NULL },
\r
1425 { "-internetChessServerHelper", "internetChessServerHelper",
\r
1426 XrmoptionSepArg, NULL },
\r
1427 { "-icshelper", "internetChessServerHelper", XrmoptionSepArg, NULL },
\r
1428 { "-internetChessServerInputBox", "internetChessServerInputBox",
\r
1429 XrmoptionSepArg, NULL },
\r
1430 { "-icsinput", "internetChessServerInputBox", XrmoptionNoArg, "True" },
\r
1431 { "-xicsinput", "internetChessServerInputBox", XrmoptionNoArg, "False" },
\r
1432 { "-icsAlarm", "icsAlarm", XrmoptionSepArg, NULL },
\r
1433 { "-alarm", "icsAlarm", XrmoptionNoArg, "True" },
\r
1434 { "-xalarm", "icsAlarm", XrmoptionNoArg, "False" },
\r
1435 { "-icsAlarmTime", "icsAlarmTime", XrmoptionSepArg, NULL },
\r
1436 { "-useTelnet", "useTelnet", XrmoptionSepArg, NULL },
\r
1437 { "-telnet", "useTelnet", XrmoptionNoArg, "True" },
\r
1438 { "-xtelnet", "useTelnet", XrmoptionNoArg, "False" },
\r
1439 { "-telnetProgram", "telnetProgram", XrmoptionSepArg, NULL },
\r
1440 { "-gateway", "gateway", XrmoptionSepArg, NULL },
\r
1441 { "-loadGameFile", "loadGameFile", XrmoptionSepArg, NULL },
\r
1442 { "-lgf", "loadGameFile", XrmoptionSepArg, NULL },
\r
1443 { "-loadGameIndex", "loadGameIndex", XrmoptionSepArg, NULL },
\r
1444 { "-lgi", "loadGameIndex", XrmoptionSepArg, NULL },
\r
1445 { "-saveGameFile", "saveGameFile", XrmoptionSepArg, NULL },
\r
1446 { "-sgf", "saveGameFile", XrmoptionSepArg, NULL },
\r
1447 { "-autoSaveGames", "autoSaveGames", XrmoptionSepArg, NULL },
\r
1448 { "-autosave", "autoSaveGames", XrmoptionNoArg, "True" },
\r
1449 { "-xautosave", "autoSaveGames", XrmoptionNoArg, "False" },
\r
1450 { "-autoRaiseBoard", "autoRaiseBoard", XrmoptionSepArg, NULL },
\r
1451 { "-autoraise", "autoRaiseBoard", XrmoptionNoArg, "True" },
\r
1452 { "-xautoraise", "autoRaiseBoard", XrmoptionNoArg, "False" },
\r
1453 { "-blindfold", "blindfold", XrmoptionSepArg, NULL },
\r
1454 { "-blind", "blindfold", XrmoptionNoArg, "True" },
\r
1455 { "-xblind", "blindfold", XrmoptionNoArg, "False" },
\r
1456 { "-loadPositionFile", "loadPositionFile", XrmoptionSepArg, NULL },
\r
1457 { "-lpf", "loadPositionFile", XrmoptionSepArg, NULL },
\r
1458 { "-loadPositionIndex", "loadPositionIndex", XrmoptionSepArg, NULL },
\r
1459 { "-lpi", "loadPositionIndex", XrmoptionSepArg, NULL },
\r
1460 { "-savePositionFile", "savePositionFile", XrmoptionSepArg, NULL },
\r
1461 { "-spf", "savePositionFile", XrmoptionSepArg, NULL },
\r
1462 { "-matchMode", "matchMode", XrmoptionSepArg, NULL },
\r
1463 { "-mm", "matchMode", XrmoptionNoArg, "True" },
\r
1464 { "-xmm", "matchMode", XrmoptionNoArg, "False" },
\r
1465 { "-matchGames", "matchGames", XrmoptionSepArg, NULL },
\r
1466 { "-mg", "matchGames", XrmoptionSepArg, NULL },
\r
1467 { "-monoMode", "monoMode", XrmoptionSepArg, NULL },
\r
1468 { "-mono", "monoMode", XrmoptionNoArg, "True" },
\r
1469 { "-xmono", "monoMode", XrmoptionNoArg, "False" },
\r
1470 { "-debugMode", "debugMode", XrmoptionSepArg, NULL },
\r
1471 { "-debug", "debugMode", XrmoptionNoArg, "True" },
\r
1472 { "-xdebug", "debugMode", XrmoptionNoArg, "False" },
\r
1473 { "-clockMode", "clockMode", XrmoptionSepArg, NULL },
\r
1474 { "-clock", "clockMode", XrmoptionNoArg, "True" },
\r
1475 { "-xclock", "clockMode", XrmoptionNoArg, "False" },
\r
1476 { "-boardSize", "boardSize", XrmoptionSepArg, NULL },
\r
1477 { "-size", "boardSize", XrmoptionSepArg, NULL },
\r
1478 { "-searchTime", "searchTime", XrmoptionSepArg, NULL },
\r
1479 { "-st", "searchTime", XrmoptionSepArg, NULL },
\r
1480 { "-searchDepth", "searchDepth", XrmoptionSepArg, NULL },
\r
1481 { "-depth", "searchDepth", XrmoptionSepArg, NULL },
\r
1482 { "-showCoords", "showCoords", XrmoptionSepArg, NULL },
\r
1483 { "-coords", "showCoords", XrmoptionNoArg, "True" },
\r
1484 { "-xcoords", "showCoords", XrmoptionNoArg, "False" },
\r
1486 { "-showJail", "showJail", XrmoptionSepArg, NULL },
\r
1487 { "-jail", "showJail", XrmoptionNoArg, "1" },
\r
1488 { "-sidejail", "showJail", XrmoptionNoArg, "2" },
\r
1489 { "-xjail", "showJail", XrmoptionNoArg, "0" },
\r
1491 { "-showThinking", "showThinking", XrmoptionSepArg, NULL },
\r
1492 { "-thinking", "showThinking", XrmoptionNoArg, "True" },
\r
1493 { "-xthinking", "showThinking", XrmoptionNoArg, "False" },
\r
1494 { "-ponderNextMove", "ponderNextMove", XrmoptionSepArg, NULL },
\r
1495 { "-ponder", "ponderNextMove", XrmoptionNoArg, "True" },
\r
1496 { "-xponder", "ponderNextMove", XrmoptionNoArg, "False" },
\r
1497 { "-periodicUpdates", "periodicUpdates", XrmoptionSepArg, NULL },
\r
1498 { "-periodic", "periodicUpdates", XrmoptionNoArg, "True" },
\r
1499 { "-xperiodic", "periodicUpdates", XrmoptionNoArg, "False" },
\r
1500 { "-clockFont", "clockFont", XrmoptionSepArg, NULL },
\r
1501 { "-coordFont", "coordFont", XrmoptionSepArg, NULL },
\r
1502 { "-font", "font", XrmoptionSepArg, NULL },
\r
1503 { "-ringBellAfterMoves", "ringBellAfterMoves", XrmoptionSepArg, NULL },
\r
1504 { "-bell", "ringBellAfterMoves", XrmoptionNoArg, "True" },
\r
1505 { "-xbell", "ringBellAfterMoves", XrmoptionNoArg, "False" },
\r
1506 { "-movesound", "ringBellAfterMoves", XrmoptionNoArg, "True" },
\r
1507 { "-xmovesound", "ringBellAfterMoves", XrmoptionNoArg, "False" },
\r
1508 { "-autoCallFlag", "autoCallFlag", XrmoptionSepArg, NULL },
\r
1509 { "-autoflag", "autoCallFlag", XrmoptionNoArg, "True" },
\r
1510 { "-xautoflag", "autoCallFlag", XrmoptionNoArg, "False" },
\r
1511 { "-autoFlipView", "autoFlipView", XrmoptionSepArg, NULL },
\r
1512 { "-autoflip", "autoFlipView", XrmoptionNoArg, "True" },
\r
1513 { "-xautoflip", "autoFlipView", XrmoptionNoArg, "False" },
\r
1514 { "-autoObserve", "autoObserve", XrmoptionSepArg, NULL },
\r
1515 { "-autobs", "autoObserve", XrmoptionNoArg, "True" },
\r
1516 { "-xautobs", "autoObserve", XrmoptionNoArg, "False" },
\r
1517 { "-autoComment", "autoComment", XrmoptionSepArg, NULL },
\r
1518 { "-autocomm", "autoComment", XrmoptionNoArg, "True" },
\r
1519 { "-xautocomm", "autoComment", XrmoptionNoArg, "False" },
\r
1520 { "-getMoveList", "getMoveList", XrmoptionSepArg, NULL },
\r
1521 { "-moves", "getMoveList", XrmoptionNoArg, "True" },
\r
1522 { "-xmoves", "getMoveList", XrmoptionNoArg, "False" },
\r
1524 { "-highlightDragging", "highlightDragging", XrmoptionSepArg, NULL },
\r
1525 { "-highdrag", "highlightDragging", XrmoptionNoArg, "True" },
\r
1526 { "-xhighdrag", "highlightDragging", XrmoptionNoArg, "False" },
\r
1528 { "-highlightLastMove", "highlightLastMove", XrmoptionSepArg, NULL },
\r
1529 { "-highlight", "highlightLastMove", XrmoptionNoArg, "True" },
\r
1530 { "-xhighlight", "highlightLastMove", XrmoptionNoArg, "False" },
\r
1531 { "-premove", "premove", XrmoptionSepArg, NULL },
\r
1532 { "-pre", "premove", XrmoptionNoArg, "True" },
\r
1533 { "-xpre", "premove", XrmoptionNoArg, "False" },
\r
1534 { "-testLegality", "testLegality", XrmoptionSepArg, NULL },
\r
1535 { "-legal", "testLegality", XrmoptionNoArg, "True" },
\r
1536 { "-xlegal", "testLegality", XrmoptionNoArg, "False" },
\r
1537 { "-flipView", "flipView", XrmoptionSepArg, NULL },
\r
1538 { "-flip", "flipView", XrmoptionNoArg, "True" },
\r
1539 { "-xflip", "flipView", XrmoptionNoArg, "False" },
\r
1540 { "-cmail", "cmailGameName", XrmoptionSepArg, NULL },
\r
1541 { "-alwaysPromoteToQueen", "alwaysPromoteToQueen",
\r
1542 XrmoptionSepArg, NULL },
\r
1543 { "-queen", "alwaysPromoteToQueen", XrmoptionNoArg, "True" },
\r
1544 { "-xqueen", "alwaysPromoteToQueen", XrmoptionNoArg, "False" },
\r
1545 { "-oldSaveStyle", "oldSaveStyle", XrmoptionSepArg, NULL },
\r
1546 { "-oldsave", "oldSaveStyle", XrmoptionNoArg, "True" },
\r
1547 { "-xoldsave", "oldSaveStyle", XrmoptionNoArg, "False" },
\r
1548 { "-quietPlay", "quietPlay", XrmoptionSepArg, NULL },
\r
1549 { "-quiet", "quietPlay", XrmoptionNoArg, "True" },
\r
1550 { "-xquiet", "quietPlay", XrmoptionNoArg, "False" },
\r
1551 { "-titleInWindow", "titleInWindow", XrmoptionSepArg, NULL },
\r
1552 { "-title", "titleInWindow", XrmoptionNoArg, "True" },
\r
1553 { "-xtitle", "titleInWindow", XrmoptionNoArg, "False" },
\r
1555 { "-zippyTalk", "zippyTalk", XrmoptionSepArg, NULL },
\r
1556 { "-zt", "zippyTalk", XrmoptionNoArg, "True" },
\r
1557 { "-xzt", "zippyTalk", XrmoptionNoArg, "False" },
\r
1558 { "-zippyPlay", "zippyPlay", XrmoptionSepArg, NULL },
\r
1559 { "-zp", "zippyPlay", XrmoptionNoArg, "True" },
\r
1560 { "-xzp", "zippyPlay", XrmoptionNoArg, "False" },
\r
1561 { "-zippyLines", "zippyLines", XrmoptionSepArg, NULL },
\r
1562 { "-zippyPinhead", "zippyPinhead", XrmoptionSepArg, NULL },
\r
1563 { "-zippyPassword", "zippyPassword", XrmoptionSepArg, NULL },
\r
1564 { "-zippyPassword2", "zippyPassword2", XrmoptionSepArg, NULL },
\r
1565 { "-zippyWrongPassword", "zippyWrongPassword", XrmoptionSepArg, NULL },
\r
1566 { "-zippyAcceptOnly", "zippyAcceptOnly", XrmoptionSepArg, NULL },
\r
1567 { "-zippyUseI", "zippyUseI", XrmoptionSepArg, NULL },
\r
1568 { "-zui", "zippyUseI", XrmoptionNoArg, "True" },
\r
1569 { "-xzui", "zippyUseI", XrmoptionNoArg, "False" },
\r
1570 { "-zippyBughouse", "zippyBughouse", XrmoptionSepArg, NULL },
\r
1571 { "-zippyNoplayCrafty", "zippyNoplayCrafty", XrmoptionSepArg, NULL },
\r
1572 { "-znc", "zippyNoplayCrafty", XrmoptionNoArg, "True" },
\r
1573 { "-xznc", "zippyNoplayCrafty", XrmoptionNoArg, "False" },
\r
1574 { "-zippyGameEnd", "zippyGameEnd", XrmoptionSepArg, NULL },
\r
1575 { "-zippyGameStart", "zippyGameStart", XrmoptionSepArg, NULL },
\r
1576 { "-zippyAdjourn", "zippyAdjourn", XrmoptionSepArg, NULL },
\r
1577 { "-zadj", "zippyAdjourn", XrmoptionNoArg, "True" },
\r
1578 { "-xzadj", "zippyAdjourn", XrmoptionNoArg, "False" },
\r
1579 { "-zippyAbort", "zippyAbort", XrmoptionSepArg, NULL },
\r
1580 { "-zab", "zippyAbort", XrmoptionNoArg, "True" },
\r
1581 { "-xzab", "zippyAbort", XrmoptionNoArg, "False" },
\r
1582 { "-zippyVariants", "zippyVariants", XrmoptionSepArg, NULL },
\r
1583 { "-zippyMaxGames", "zippyMaxGames", XrmoptionSepArg, NULL },
\r
1584 { "-zippyReplayTimeout", "zippyReplayTimeout", XrmoptionSepArg, NULL },
\r
1586 { "-flashCount", "flashCount", XrmoptionSepArg, NULL },
\r
1587 { "-flash", "flashCount", XrmoptionNoArg, "3" },
\r
1588 { "-xflash", "flashCount", XrmoptionNoArg, "0" },
\r
1589 { "-flashRate", "flashRate", XrmoptionSepArg, NULL },
\r
1590 { "-pixmapDirectory", "pixmapDirectory", XrmoptionSepArg, NULL },
\r
1591 { "-msLoginDelay", "msLoginDelay", XrmoptionSepArg, NULL },
\r
1592 { "-pixmap", "pixmapDirectory", XrmoptionSepArg, NULL },
\r
1593 { "-colorizeMessages", "colorizeMessages", XrmoptionSepArg, NULL },
\r
1594 { "-colorize", "colorizeMessages", XrmoptionNoArg, "True" },
\r
1595 { "-xcolorize", "colorizeMessages", XrmoptionNoArg, "False" },
\r
1596 { "-colorShout", "colorShout", XrmoptionSepArg, NULL },
\r
1597 { "-colorSShout", "colorSShout", XrmoptionSepArg, NULL },
\r
1598 { "-colorCShout", "colorSShout", XrmoptionSepArg, NULL }, /*FICS name*/
\r
1599 { "-colorChannel1", "colorChannel1", XrmoptionSepArg, NULL },
\r
1600 { "-colorChannel", "colorChannel", XrmoptionSepArg, NULL },
\r
1601 { "-colorKibitz", "colorKibitz", XrmoptionSepArg, NULL },
\r
1602 { "-colorTell", "colorTell", XrmoptionSepArg, NULL },
\r
1603 { "-colorChallenge", "colorChallenge", XrmoptionSepArg, NULL },
\r
1604 { "-colorRequest", "colorRequest", XrmoptionSepArg, NULL },
\r
1605 { "-colorSeek", "colorSeek", XrmoptionSepArg, NULL },
\r
1606 { "-colorNormal", "colorNormal", XrmoptionSepArg, NULL },
\r
1607 { "-soundProgram", "soundProgram", XrmoptionSepArg, NULL },
\r
1608 { "-soundShout", "soundShout", XrmoptionSepArg, NULL },
\r
1609 { "-soundSShout", "soundSShout", XrmoptionSepArg, NULL },
\r
1610 { "-soundCShout", "soundSShout", XrmoptionSepArg, NULL }, /*FICS name*/
\r
1611 { "-soundChannel1", "soundChannel1", XrmoptionSepArg, NULL },
\r
1612 { "-soundChannel", "soundChannel", XrmoptionSepArg, NULL },
\r
1613 { "-soundKibitz", "soundKibitz", XrmoptionSepArg, NULL },
\r
1614 { "-soundTell", "soundTell", XrmoptionSepArg, NULL },
\r
1615 { "-soundChallenge", "soundChallenge", XrmoptionSepArg, NULL },
\r
1616 { "-soundRequest", "soundRequest", XrmoptionSepArg, NULL },
\r
1617 { "-soundSeek", "soundSeek", XrmoptionSepArg, NULL },
\r
1618 { "-soundMove", "soundMove", XrmoptionSepArg, NULL },
\r
1619 { "-soundIcsWin", "soundIcsWin", XrmoptionSepArg, NULL },
\r
1620 { "-soundIcsLoss", "soundIcsLoss", XrmoptionSepArg, NULL },
\r
1621 { "-soundIcsDraw", "soundIcsDraw", XrmoptionSepArg, NULL },
\r
1622 { "-soundIcsUnfinished", "soundIcsUnfinished", XrmoptionSepArg, NULL },
\r
1623 { "-soundIcsAlarm", "soundIcsAlarm", XrmoptionSepArg, NULL },
\r
1624 { "-reuseFirst", "reuseFirst", XrmoptionSepArg, NULL },
\r
1625 { "-reuseChessPrograms", "reuseFirst", XrmoptionSepArg, NULL }, /*compat*/
\r
1626 { "-reuse", "reuseFirst", XrmoptionNoArg, "True" },
\r
1627 { "-xreuse", "reuseFirst", XrmoptionNoArg, "False" },
\r
1628 { "-reuseSecond", "reuseSecond", XrmoptionSepArg, NULL },
\r
1629 { "-reuse2", "reuseSecond", XrmoptionNoArg, "True" },
\r
1630 { "-xreuse2", "reuseSecond", XrmoptionNoArg, "False" },
\r
1631 { "-animateMoving", "animateMoving", XrmoptionSepArg, NULL },
\r
1632 { "-animate", "animateMoving", XrmoptionNoArg, "True" },
\r
1633 { "-xanimate", "animateMoving", XrmoptionNoArg, "False" },
\r
1634 { "-animateDragging", "animateDragging", XrmoptionSepArg, NULL },
\r
1635 { "-drag", "animateDragging", XrmoptionNoArg, "True" },
\r
1636 { "-xdrag", "animateDragging", XrmoptionNoArg, "False" },
\r
1637 { "-animateSpeed", "animateSpeed", XrmoptionSepArg, NULL },
\r
1638 { "-popupExitMessage", "popupExitMessage", XrmoptionSepArg, NULL },
\r
1639 { "-exit", "popupExitMessage", XrmoptionNoArg, "True" },
\r
1640 { "-xexit", "popupExitMessage", XrmoptionNoArg, "False" },
\r
1641 { "-popupMoveErrors", "popupMoveErrors", XrmoptionSepArg, NULL },
\r
1642 { "-popup", "popupMoveErrors", XrmoptionNoArg, "True" },
\r
1643 { "-xpopup", "popupMoveErrors", XrmoptionNoArg, "False" },
\r
1644 { "-fontSizeTolerance", "fontSizeTolerance", XrmoptionSepArg, NULL },
\r
1645 { "-initialMode", "initialMode", XrmoptionSepArg, NULL },
\r
1646 { "-mode", "initialMode", XrmoptionSepArg, NULL },
\r
1647 { "-variant", "variant", XrmoptionSepArg, NULL },
\r
1648 { "-firstProtocolVersion", "firstProtocolVersion", XrmoptionSepArg, NULL },
\r
1649 { "-secondProtocolVersion","secondProtocolVersion",XrmoptionSepArg, NULL },
\r
1650 { "-showButtonBar", "showButtonBar", XrmoptionSepArg, NULL },
\r
1651 { "-buttons", "showButtonBar", XrmoptionNoArg, "True" },
\r
1652 { "-xbuttons", "showButtonBar", XrmoptionNoArg, "False" },
\r
1653 /* [AS,HR] New features */
\r
1654 { "-firstScoreAbs", "firstScoreAbs", XrmoptionSepArg, NULL },
\r
1655 { "-secondScoreAbs", "secondScoreAbs", XrmoptionSepArg, NULL },
\r
1656 { "-pgnExtendedInfo", "pgnExtendedInfo", XrmoptionSepArg, NULL },
\r
1657 { "-hideThinkingFromHuman", "hideThinkingFromHuman", XrmoptionSepArg, NULL },
\r
1658 { "-adjudicateLossThreshold", "adjudicateLossThreshold", XrmoptionSepArg, NULL },
\r
1659 { "-pgnEventHeader", "pgnEventHeader", XrmoptionSepArg, NULL },
\r
1660 { "-firstIsUCI", "firstIsUCI", XrmoptionSepArg, NULL },
\r
1661 { "-secondIsUCI", "secondIsUCI", XrmoptionSepArg, NULL },
\r
1662 { "-fUCI", "firstIsUCI", XrmoptionNoArg, "True" },
\r
1663 { "-sUCI", "secondIsUCI", XrmoptionNoArg, "True" },
\r
1664 { "-firstHasOwnBookUCI", "firstHasOwnBookUCI", XrmoptionSepArg, NULL },
\r
1665 { "-secondHasOwnBookUCI", "secondHasOwnBookUCI", XrmoptionSepArg, NULL },
\r
1666 { "-fNoOwnBookUCI", "firstHasOwnBookUCI", XrmoptionNoArg, "False" },
\r
1667 { "-sNoOwnBookUCI", "secondHasOwnBookUCI", XrmoptionNoArg, "False" },
\r
1668 { "-firstXBook", "firstHasOwnBookUCI", XrmoptionNoArg, "False" },
\r
1669 { "-secondXBook", "secondHasOwnBookUCI", XrmoptionNoArg, "False" },
\r
1670 { "-polyglotDir", "polyglotDir", XrmoptionSepArg, NULL },
\r
1671 { "-usePolyglotBook", "usePolyglotBook", XrmoptionSepArg, NULL },
\r
1672 { "-polyglotBook", "polyglotBook", XrmoptionSepArg, NULL },
\r
1673 { "-defaultHashSize", "defaultHashSize", XrmoptionSepArg, NULL },
\r
1674 { "-defaultCacheSizeEGTB", "defaultCacheSizeEGTB", XrmoptionSepArg, NULL },
\r
1675 { "-defaultPathEGTB", "defaultPathEGTB", XrmoptionSepArg, NULL },
\r
1676 { "-defaultFrcPosition", "defaultFrcPosition", XrmoptionSepArg, NULL },
\r
1677 // [HGM] I am sure AS added many more options, but we have to fish them out, from the list in winboard.c
\r
1679 /* [HGM,HR] User-selectable board size */
\r
1680 { "-boardWidth", "boardWidth", XrmoptionSepArg, NULL },
\r
1681 { "-boardHeight", "boardHeight", XrmoptionSepArg, NULL },
\r
1682 { "-matchPause", "matchPause", XrmoptionSepArg, NULL },
\r
1684 /* [HGM] new arguments of 4.3.xx. All except first three are back-end options, which should work immediately */
\r
1685 { "-holdingsSize", "holdingsSize", XrmoptionSepArg, NULL }, // requires extensive front-end changes to work
\r
1686 { "-flipBlack", "flipBlack", XrmoptionSepArg, NULL }, // requires front-end changes to work
\r
1687 { "-allWhite", "allWhite", XrmoptionSepArg, NULL }, // requires front-end changes to work
\r
1688 { "-pieceToCharTable", "pieceToCharTable", XrmoptionSepArg, NULL },
\r
1689 { "-alphaRank", "alphaRank", XrmoptionSepArg, NULL },
\r
1690 { "-testClaims", "testClaims", XrmoptionSepArg, NULL },
\r
1691 { "-checkMates", "checkMates", XrmoptionSepArg, NULL },
\r
1692 { "-materialDraws", "materialDraws", XrmoptionSepArg, NULL },
\r
1693 { "-trivialDraws", "trivialDraws", XrmoptionSepArg, NULL },
\r
1694 { "-ruleMoves", "ruleMoves", XrmoptionSepArg, NULL },
\r
1695 { "-repeatsToDraw", "repeatsToDraw", XrmoptionSepArg, NULL },
\r
1696 { "-engineDebugOutput", "engineDebugOutput", XrmoptionSepArg, NULL },
\r
1697 { "-userName", "userName", XrmoptionSepArg, NULL },
\r
1698 { "-autoKibitz", "autoKibitz", XrmoptionNoArg, "True" },
\r
1699 { "-firstTimeOdds", "firstTimeOdds", XrmoptionSepArg, NULL },
\r
1700 { "-secondTimeOdds", "secondTimeOdds", XrmoptionSepArg, NULL },
\r
1701 { "-timeOddsMode", "timeOddsMode", XrmoptionSepArg, NULL },
\r
1702 { "-firstAccumulateTC", "firstAccumulateTC", XrmoptionSepArg, NULL },
\r
1703 { "-secondAccumulateTC", "secondAccumulateTC", XrmoptionSepArg, NULL },
\r
1704 { "-firstNPS", "firstNPS", XrmoptionSepArg, NULL },
\r
1705 { "-secondNPS", "secondNPS", XrmoptionSepArg, NULL },
\r
1706 { "-serverMoves", "serverMoves", XrmoptionSepArg, NULL },
\r
1707 { "-serverPause", "serverPause", XrmoptionSepArg, NULL },
\r
1708 { "-suppressLoadMoves", "suppressLoadMoves", XrmoptionSepArg, NULL },
\r
1709 { "-egtFormats", "egtFormats", XrmoptionSepArg, NULL },
\r
1710 { "-userName", "userName", XrmoptionSepArg, NULL },
\r
1711 { "-smpCores", "smpCores", XrmoptionSepArg, NULL },
\r
1712 { "-sameColorGames", "sameColorGames", XrmoptionSepArg, NULL },
\r
1713 { "-rewindIndex", "rewindIndex", XrmoptionSepArg, NULL },
\r
1714 { "-niceEngines", "niceEngines", XrmoptionSepArg, NULL },
\r
1715 { "-delayBeforeQuit", "delayBeforeQuit", XrmoptionSepArg, NULL },
\r
1716 { "-delayAfterQuit", "delayAfterQuit", XrmoptionSepArg, NULL },
\r
1717 { "-nameOfDebugFile", "nameOfDebugFile", XrmoptionSepArg, NULL },
\r
1718 { "-noGUI", "noGUI", XrmoptionNoArg, "True" },
\r
1719 { "-firstOptions", "firstOptions", XrmoptionSepArg, NULL },
\r
1720 { "-secondOptions", "secondOptions", XrmoptionSepArg, NULL },
\r
1724 XtActionsRec boardActions[] = {
\r
1725 { "DrawPosition", DrawPositionProc },
\r
1726 { "HandleUserMove", HandleUserMove },
\r
1727 { "AnimateUserMove", AnimateUserMove },
\r
1728 { "FileNameAction", FileNameAction },
\r
1729 { "AskQuestionProc", AskQuestionProc },
\r
1730 { "AskQuestionReplyAction", AskQuestionReplyAction },
\r
1731 { "PieceMenuPopup", PieceMenuPopup },
\r
1732 { "WhiteClock", WhiteClock },
\r
1733 { "BlackClock", BlackClock },
\r
1734 { "Iconify", Iconify },
\r
1735 { "ResetProc", ResetProc },
\r
1736 { "LoadGameProc", LoadGameProc },
\r
1737 { "LoadNextGameProc", LoadNextGameProc },
\r
1738 { "LoadPrevGameProc", LoadPrevGameProc },
\r
1739 { "LoadSelectedProc", LoadSelectedProc },
\r
1740 { "ReloadGameProc", ReloadGameProc },
\r
1741 { "LoadPositionProc", LoadPositionProc },
\r
1742 { "LoadNextPositionProc", LoadNextPositionProc },
\r
1743 { "LoadPrevPositionProc", LoadPrevPositionProc },
\r
1744 { "ReloadPositionProc", ReloadPositionProc },
\r
1745 { "CopyPositionProc", CopyPositionProc },
\r
1746 { "PastePositionProc", PastePositionProc },
\r
1747 { "CopyGameProc", CopyGameProc },
\r
1748 { "PasteGameProc", PasteGameProc },
\r
1749 { "SaveGameProc", SaveGameProc },
\r
1750 { "SavePositionProc", SavePositionProc },
\r
1751 { "MailMoveProc", MailMoveProc },
\r
1752 { "ReloadCmailMsgProc", ReloadCmailMsgProc },
\r
1753 { "QuitProc", QuitProc },
\r
1754 { "MachineWhiteProc", MachineWhiteProc },
\r
1755 { "MachineBlackProc", MachineBlackProc },
\r
1756 { "AnalysisModeProc", AnalyzeModeProc },
\r
1757 { "AnalyzeFileProc", AnalyzeFileProc },
\r
1758 { "TwoMachinesProc", TwoMachinesProc },
\r
1759 { "IcsClientProc", IcsClientProc },
\r
1760 { "EditGameProc", EditGameProc },
\r
1761 { "EditPositionProc", EditPositionProc },
\r
1762 { "TrainingProc", EditPositionProc },
\r
1763 { "EngineOutputProc", EngineOutputProc}, // [HGM] Winboard_x engine-output window
\r
1764 { "ShowGameListProc", ShowGameListProc },
\r
1765 { "ShowMoveListProc", HistoryShowProc},
\r
1766 { "EditTagsProc", EditCommentProc },
\r
1767 { "EditCommentProc", EditCommentProc },
\r
1768 { "IcsAlarmProc", IcsAlarmProc },
\r
1769 { "IcsInputBoxProc", IcsInputBoxProc },
\r
1770 { "PauseProc", PauseProc },
\r
1771 { "AcceptProc", AcceptProc },
\r
1772 { "DeclineProc", DeclineProc },
\r
1773 { "RematchProc", RematchProc },
\r
1774 { "CallFlagProc", CallFlagProc },
\r
1775 { "DrawProc", DrawProc },
\r
1776 { "AdjournProc", AdjournProc },
\r
1777 { "AbortProc", AbortProc },
\r
1778 { "ResignProc", ResignProc },
\r
1779 { "EnterKeyProc", EnterKeyProc },
\r
1780 { "StopObservingProc", StopObservingProc },
\r
1781 { "StopExaminingProc", StopExaminingProc },
\r
1782 { "BackwardProc", BackwardProc },
\r
1783 { "ForwardProc", ForwardProc },
\r
1784 { "ToStartProc", ToStartProc },
\r
1785 { "ToEndProc", ToEndProc },
\r
1786 { "RevertProc", RevertProc },
\r
1787 { "TruncateGameProc", TruncateGameProc },
\r
1788 { "MoveNowProc", MoveNowProc },
\r
1789 { "RetractMoveProc", RetractMoveProc },
\r
1790 { "AlwaysQueenProc", AlwaysQueenProc },
\r
1791 { "AnimateDraggingProc", AnimateDraggingProc },
\r
1792 { "AnimateMovingProc", AnimateMovingProc },
\r
1793 { "AutoflagProc", AutoflagProc },
\r
1794 { "AutoflipProc", AutoflipProc },
\r
1795 { "AutobsProc", AutobsProc },
\r
1796 { "AutoraiseProc", AutoraiseProc },
\r
1797 { "AutosaveProc", AutosaveProc },
\r
1798 { "BlindfoldProc", BlindfoldProc },
\r
1799 { "FlashMovesProc", FlashMovesProc },
\r
1800 { "FlipViewProc", FlipViewProc },
\r
1801 { "GetMoveListProc", GetMoveListProc },
\r
1803 { "HighlightDraggingProc", HighlightDraggingProc },
\r
1805 { "HighlightLastMoveProc", HighlightLastMoveProc },
\r
1806 { "IcsAlarmProc", IcsAlarmProc },
\r
1807 { "MoveSoundProc", MoveSoundProc },
\r
1808 { "OldSaveStyleProc", OldSaveStyleProc },
\r
1809 { "PeriodicUpdatesProc", PeriodicUpdatesProc },
\r
1810 { "PonderNextMoveProc", PonderNextMoveProc },
\r
1811 { "PopupExitMessageProc", PopupExitMessageProc },
\r
1812 { "PopupMoveErrorsProc", PopupMoveErrorsProc },
\r
1813 { "PremoveProc", PremoveProc },
\r
1814 { "QuietPlayProc", QuietPlayProc },
\r
1815 { "ShowCoordsProc", ShowCoordsProc },
\r
1816 { "ShowThinkingProc", ShowThinkingProc },
\r
1817 { "HideThinkingProc", HideThinkingProc },
\r
1818 { "TestLegalityProc", TestLegalityProc },
\r
1819 { "InfoProc", InfoProc },
\r
1820 { "ManProc", ManProc },
\r
1821 { "HintProc", HintProc },
\r
1822 { "BookProc", BookProc },
\r
1823 { "AboutGameProc", AboutGameProc },
\r
1824 { "AboutProc", AboutProc },
\r
1825 { "DebugProc", DebugProc },
\r
1826 { "NothingProc", NothingProc },
\r
1827 { "CommentPopDown", (XtActionProc) CommentPopDown },
\r
1828 { "EditCommentPopDown", (XtActionProc) EditCommentPopDown },
\r
1829 { "TagsPopDown", (XtActionProc) TagsPopDown },
\r
1830 { "ErrorPopDown", (XtActionProc) ErrorPopDown },
\r
1831 { "ICSInputBoxPopDown", (XtActionProc) ICSInputBoxPopDown },
\r
1832 { "AnalysisPopDown", (XtActionProc) AnalysisPopDown },
\r
1833 { "FileNamePopDown", (XtActionProc) FileNamePopDown },
\r
1834 { "AskQuestionPopDown", (XtActionProc) AskQuestionPopDown },
\r
1835 { "GameListPopDown", (XtActionProc) GameListPopDown },
\r
1836 { "PromotionPopDown", (XtActionProc) PromotionPopDown },
\r
1837 { "HistoryPopDown", (XtActionProc) HistoryPopDown },
\r
1838 { "EngineOutputPopDown", (XtActionProc) EngineOutputPopDown },
\r
1839 { "ShufflePopDown", (XtActionProc) ShufflePopDown },
\r
1840 { "EnginePopDown", (XtActionProc) EnginePopDown },
\r
1841 { "UciPopDown", (XtActionProc) UciPopDown },
\r
1842 { "TimeControlPopDown", (XtActionProc) TimeControlPopDown },
\r
1843 { "NewVariantPopDown", (XtActionProc) NewVariantPopDown },
\r
1844 { "SettingsPopDown", (XtActionProc) SettingsPopDown },
\r
1847 char globalTranslations[] =
\r
1848 ":<Key>R: ResignProc() \n \
\r
1849 :<Key>r: ResetProc() \n \
\r
1850 :<Key>g: LoadGameProc() \n \
\r
1851 :<Key>N: LoadNextGameProc() \n \
\r
1852 :<Key>P: LoadPrevGameProc() \n \
\r
1853 :<Key>Q: QuitProc() \n \
\r
1854 :<Key>F: ToEndProc() \n \
\r
1855 :<Key>f: ForwardProc() \n \
\r
1856 :<Key>B: ToStartProc() \n \
\r
1857 :<Key>b: BackwardProc() \n \
\r
1858 :<Key>p: PauseProc() \n \
\r
1859 :<Key>d: DrawProc() \n \
\r
1860 :<Key>t: CallFlagProc() \n \
\r
1861 :<Key>i: Iconify() \n \
\r
1862 :<Key>c: Iconify() \n \
\r
1863 :<Key>v: FlipViewProc() \n \
\r
1864 <KeyDown>Control_L: BackwardProc() \n \
\r
1865 <KeyUp>Control_L: ForwardProc() \n \
\r
1866 <KeyDown>Control_R: BackwardProc() \n \
\r
1867 <KeyUp>Control_R: ForwardProc() \n \
\r
1868 Shift<Key>1: AskQuestionProc(\"Direct command\",\
\r
1869 \"Send to chess program:\",,1) \n \
\r
1870 Shift<Key>2: AskQuestionProc(\"Direct command\",\
\r
1871 \"Send to second chess program:\",,2) \n";
\r
1873 char boardTranslations[] =
\r
1874 "<Btn1Down>: HandleUserMove() \n \
\r
1875 <Btn1Up>: HandleUserMove() \n \
\r
1876 <Btn1Motion>: AnimateUserMove() \n \
\r
1877 Shift<Btn2Down>: XawPositionSimpleMenu(menuB) XawPositionSimpleMenu(menuD)\
\r
1878 PieceMenuPopup(menuB) \n \
\r
1879 Any<Btn2Down>: XawPositionSimpleMenu(menuW) XawPositionSimpleMenu(menuD) \
\r
1880 PieceMenuPopup(menuW) \n \
\r
1881 Shift<Btn3Down>: XawPositionSimpleMenu(menuW) XawPositionSimpleMenu(menuD)\
\r
1882 PieceMenuPopup(menuW) \n \
\r
1883 Any<Btn3Down>: XawPositionSimpleMenu(menuB) XawPositionSimpleMenu(menuD) \
\r
1884 PieceMenuPopup(menuB) \n";
\r
1886 char whiteTranslations[] = "<BtnDown>: WhiteClock()\n";
\r
1887 char blackTranslations[] = "<BtnDown>: BlackClock()\n";
\r
1889 char ICSInputTranslations[] =
\r
1890 "<Key>Return: EnterKeyProc() \n";
\r
1892 String xboardResources[] = {
\r
1893 "*fileName*value.translations: #override\\n <Key>Return: FileNameAction()",
\r
1894 "*question*value.translations: #override\\n <Key>Return: AskQuestionReplyAction()",
\r
1895 "*errorpopup*translations: #override\\n <Key>Return: ErrorPopDown()",
\r
1900 /* Max possible square size */
\r
1901 #define MAXSQSIZE 256
\r
1903 static int xpm_avail[MAXSQSIZE];
\r
1905 #ifdef HAVE_DIR_STRUCT
\r
1907 /* Extract piece size from filename */
\r
1909 xpm_getsize(name, len, ext)
\r
1920 if ((p=strchr(name, '.')) == NULL ||
\r
1921 StrCaseCmp(p+1, ext) != 0)
\r
1927 while (*p && isdigit(*p))
\r
1934 /* Setup xpm_avail */
\r
1936 xpm_getavail(dirname, ext)
\r
1941 struct dirent *ent;
\r
1944 for (i=0; i<MAXSQSIZE; ++i)
\r
1947 if (appData.debugMode)
\r
1948 fprintf(stderr, "XPM dir:%s:ext:%s:\n", dirname, ext);
\r
1950 dir = opendir(dirname);
\r
1953 fprintf(stderr, _("%s: Can't access XPM directory %s\n"),
\r
1954 programName, dirname);
\r
1958 while ((ent=readdir(dir)) != NULL) {
\r
1959 i = xpm_getsize(ent->d_name, NAMLEN(ent), ext);
\r
1960 if (i > 0 && i < MAXSQSIZE)
\r
1970 xpm_print_avail(fp, ext)
\r
1976 fprintf(fp, _("Available `%s' sizes:\n"), ext);
\r
1977 for (i=1; i<MAXSQSIZE; ++i) {
\r
1979 printf("%d\n", i);
\r
1983 /* Return XPM piecesize closest to size */
\r
1985 xpm_closest_to(dirname, size, ext)
\r
1991 int sm_diff = MAXSQSIZE;
\r
1995 xpm_getavail(dirname, ext);
\r
1997 if (appData.debugMode)
\r
1998 xpm_print_avail(stderr, ext);
\r
2000 for (i=1; i<MAXSQSIZE; ++i) {
\r
2001 if (xpm_avail[i]) {
\r
2003 diff = (diff<0) ? -diff : diff;
\r
2004 if (diff < sm_diff) {
\r
2012 fprintf(stderr, _("Error: No `%s' files!\n"), ext);
\r
2018 #else /* !HAVE_DIR_STRUCT */
\r
2019 /* If we are on a system without a DIR struct, we can't
\r
2020 read the directory, so we can't collect a list of
\r
2021 filenames, etc., so we can't do any size-fitting. */
\r
2023 xpm_closest_to(dirname, size, ext)
\r
2028 fprintf(stderr, _("\
\r
2029 Warning: No DIR structure found on this system --\n\
\r
2030 Unable to autosize for XPM/XIM pieces.\n\
\r
2031 Please report this error to frankm@hiwaay.net.\n\
\r
2032 Include system type & operating system in message.\n"));
\r
2035 #endif /* HAVE_DIR_STRUCT */
\r
2037 static char *cnames[9] = { "black", "red", "green", "yellow", "blue",
\r
2038 "magenta", "cyan", "white" };
\r
2042 TextColors textColors[(int)NColorClasses];
\r
2044 /* String is: "fg, bg, attr". Which is 0, 1, 2 */
\r
2046 parse_color(str, which)
\r
2050 char *p, buf[100], *d;
\r
2053 if (strlen(str) > 99) /* watch bounds on buf */
\r
2058 for (i=0; i<which; ++i) {
\r
2059 p = strchr(p, ',');
\r
2065 /* Could be looking at something like:
\r
2067 .. in which case we want to stop on a comma also */
\r
2068 while (*p && *p != ',' && !isalpha(*p) && !isdigit(*p))
\r
2072 return -1; /* Use default for empty field */
\r
2075 if (which == 2 || isdigit(*p))
\r
2078 while (*p && isalpha(*p))
\r
2083 for (i=0; i<8; ++i) {
\r
2084 if (!StrCaseCmp(buf, cnames[i]))
\r
2085 return which? (i+40) : (i+30);
\r
2087 if (!StrCaseCmp(buf, "default")) return -1;
\r
2089 fprintf(stderr, _("%s: unrecognized color %s\n"), programName, buf);
\r
2094 parse_cpair(cc, str)
\r
2098 if ((textColors[(int)cc].fg=parse_color(str, 0)) == -2) {
\r
2099 fprintf(stderr, _("%s: can't parse foreground color in `%s'\n"),
\r
2100 programName, str);
\r
2104 /* bg and attr are optional */
\r
2105 textColors[(int)cc].bg = parse_color(str, 1);
\r
2106 if ((textColors[(int)cc].attr = parse_color(str, 2)) < 0) {
\r
2107 textColors[(int)cc].attr = 0;
\r
2113 /* Arrange to catch delete-window events */
\r
2114 Atom wm_delete_window;
\r
2116 CatchDeleteWindow(Widget w, String procname)
\r
2118 char buf[MSG_SIZ];
\r
2119 XSetWMProtocols(xDisplay, XtWindow(w), &wm_delete_window, 1);
\r
2120 sprintf(buf, "<Message>WM_PROTOCOLS: %s() \n", procname);
\r
2121 XtAugmentTranslations(w, XtParseTranslationTable(buf));
\r
2128 XtSetArg(args[0], XtNiconic, False);
\r
2129 XtSetValues(shellWidget, args, 1);
\r
2131 XtPopup(shellWidget, XtGrabNone); /* Raise if lowered */
\r
2135 // eventually, all layout determining code should go into a subroutine, but until then IDSIZE remains undefined
\r
2137 #define BoardSize int
\r
2138 void InitDrawingSizes(BoardSize boardSize, int flags)
\r
2139 { // [HGM] resize is functional now, but for board format changes only (nr of ranks, files)
\r
2140 Dimension timerWidth, boardWidth, boardHeight, w, h, sep, bor, wr, hr;
\r
2142 XtGeometryResult gres;
\r
2145 if(!formWidget) return;
\r
2148 * Enable shell resizing.
\r
2150 shellArgs[0].value = (XtArgVal) &w;
\r
2151 shellArgs[1].value = (XtArgVal) &h;
\r
2152 XtGetValues(shellWidget, shellArgs, 2);
\r
2154 shellArgs[4].value = 2*w; shellArgs[2].value = 10;
\r
2155 shellArgs[5].value = 2*h; shellArgs[3].value = 10;
\r
2156 XtSetValues(shellWidget, &shellArgs[2], 4);
\r
2158 XtSetArg(args[0], XtNdefaultDistance, &sep);
\r
2159 XtGetValues(formWidget, args, 1);
\r
2161 boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap);
\r
2162 boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap);
\r
2165 XtSetArg(args[0], XtNwidth, boardWidth);
\r
2166 XtSetArg(args[1], XtNheight, boardHeight);
\r
2167 XtSetValues(boardWidget, args, 2);
\r
2169 timerWidth = (boardWidth - sep) / 2;
\r
2170 XtSetArg(args[0], XtNwidth, timerWidth);
\r
2171 XtSetValues(whiteTimerWidget, args, 1);
\r
2172 XtSetValues(blackTimerWidget, args, 1);
\r
2174 XawFormDoLayout(formWidget, False);
\r
2176 if (appData.titleInWindow) {
\r
2178 XtSetArg(args[i], XtNborderWidth, &bor); i++;
\r
2179 XtSetArg(args[i], XtNheight, &h); i++;
\r
2180 XtGetValues(titleWidget, args, i);
\r
2181 if (smallLayout) {
\r
2182 w = boardWidth - 2*bor;
\r
2184 XtSetArg(args[0], XtNwidth, &w);
\r
2185 XtGetValues(menuBarWidget, args, 1);
\r
2186 w = boardWidth - w - sep - 2*bor - 2; // WIDTH_FUDGE
\r
2189 gres = XtMakeResizeRequest(titleWidget, w, h, &wr, &hr);
\r
2190 if (gres != XtGeometryYes && appData.debugMode) {
\r
2192 _("%s: titleWidget geometry error %d %d %d %d %d\n"),
\r
2193 programName, gres, w, h, wr, hr);
\r
2197 XawFormDoLayout(formWidget, True);
\r
2200 * Inhibit shell resizing.
\r
2202 shellArgs[0].value = w = (XtArgVal) boardWidth + marginW;
\r
2203 shellArgs[1].value = h = (XtArgVal) boardHeight + marginH;
\r
2204 shellArgs[4].value = shellArgs[2].value = w;
\r
2205 shellArgs[5].value = shellArgs[3].value = h;
\r
2206 XtSetValues(shellWidget, &shellArgs[0], 6);
\r
2215 int i, j, clockFontPxlSize, coordFontPxlSize, fontPxlSize;
\r
2216 XSetWindowAttributes window_attributes;
\r
2218 Dimension timerWidth, boardWidth, boardHeight, w, h, sep, bor, wr, hr;
\r
2219 XrmValue vFrom, vTo;
\r
2220 XtGeometryResult gres;
\r
2223 int forceMono = False;
\r
2224 #define INDIRECTION
\r
2225 #ifdef INDIRECTION
\r
2226 // [HGM] before anything else, expand any indirection files amongst options
\r
2227 char *argvCopy[1000]; // 1000 seems enough
\r
2228 char newArgs[10000]; // holds actual characters
\r
2231 srandom(time(0)); // [HGM] book: make random truly random
\r
2234 for(i=0; i<argc; i++) {
\r
2235 if(j >= 1000-2) { printf(_("too many arguments\n")); exit(-1); }
\r
2236 //fprintf(stderr, "arg %s\n", argv[i]);
\r
2237 if(argv[i][0] != '@') argvCopy[j++] = argv[i]; else {
\r
2239 FILE *f = fopen(argv[i]+1, "rb");
\r
2240 if(f == NULL) { fprintf(stderr, _("ignore %s\n"), argv[i]); continue; } // do not expand non-existing
\r
2241 argvCopy[j++] = newArgs + k; // get ready for first argument from file
\r
2242 while((c = fgetc(f)) != EOF) { // each line of file inserts 1 argument in the list
\r
2244 if(j >= 1000-2) { printf(_("too many arguments\n")); exit(-1); }
\r
2245 newArgs[k++] = 0; // terminate current arg
\r
2246 if(k >= 10000-1) { printf(_("too long arguments\n")); exit(-1); }
\r
2247 argvCopy[j++] = newArgs + k; // get ready for next
\r
2249 if(k >= 10000-1) { printf(_("too long arguments\n")); exit(-1); }
\r
2258 argvCopy[j] = NULL;
\r
2262 if(appData.debugMode,1) { // OK, appData is not initialized here yet...
\r
2263 for(i=0; i<argc; i++) fprintf(stderr, "argv[%2d] = '%s'\n", i, argv[i]);
\r
2269 setbuf(stdout, NULL);
\r
2270 setbuf(stderr, NULL);
\r
2273 programName = strrchr(argv[0], '/');
\r
2274 if (programName == NULL)
\r
2275 programName = argv[0];
\r
2280 XtSetLanguageProc(NULL, NULL, NULL);
\r
2281 bindtextdomain(PRODUCT, LOCALEDIR);
\r
2282 textdomain(PRODUCT);
\r
2286 XtAppInitialize(&appContext, "XBoard", shellOptions,
\r
2287 XtNumber(shellOptions),
\r
2288 &argc, argv, xboardResources, NULL, 0);
\r
2290 fprintf(stderr, _("%s: unrecognized argument %s\n"),
\r
2291 programName, argv[1]);
\r
2295 if ((chessDir = (char *) getenv("CHESSDIR")) == NULL) {
\r
2298 if (chdir(chessDir) != 0) {
\r
2299 fprintf(stderr, _("%s: can't cd to CHESSDIR: "), programName);
\r
2305 p = getenv("HOME");
\r
2306 if (p == NULL) p = "/tmp";
\r
2307 i = strlen(p) + strlen("/.xboardXXXXXx.pgn") + 1;
\r
2308 gameCopyFilename = (char*) malloc(i);
\r
2309 gamePasteFilename = (char*) malloc(i);
\r
2310 sprintf(gameCopyFilename, "%s/.xboard%05uc.pgn", p, getpid());
\r
2311 sprintf(gamePasteFilename, "%s/.xboard%05up.pgn", p, getpid());
\r
2313 XtGetApplicationResources(shellWidget, (XtPointer) &appData,
\r
2314 clientResources, XtNumber(clientResources),
\r
2317 if (appData.debugMode && appData.nameOfDebugFile && strcmp(appData.nameOfDebugFile, "stderr")) {
\r
2318 /* [DM] debug info to file [HGM] make the filename a command-line option, and allow it to remain stderr */
\r
2319 if ((debugFP = fopen(appData.nameOfDebugFile, "w")) == NULL) {
\r
2320 printf(_("Failed to open file '%s'\n"), appData.nameOfDebugFile);
\r
2323 setbuf(debugFP, NULL);
\r
2326 /* [HGM,HR] make sure board size is acceptable */
\r
2327 if(appData.NrFiles > BOARD_SIZE ||
\r
2328 appData.NrRanks > BOARD_SIZE )
\r
2329 DisplayFatalError(_("Recompile with BOARD_SIZE > 12, to support this size"), 0, 2);
\r
2332 /* This feature does not work; animation needs a rewrite */
\r
2333 appData.highlightDragging = FALSE;
\r
2337 xDisplay = XtDisplay(shellWidget);
\r
2338 xScreen = DefaultScreen(xDisplay);
\r
2339 wm_delete_window = XInternAtom(xDisplay, "WM_DELETE_WINDOW", True);
\r
2341 gameInfo.variant = StringToVariant(appData.variant);
\r
2342 InitPosition(FALSE);
\r
2345 * Determine boardSize
\r
2347 gameInfo.boardWidth = gameInfo.boardHeight = 8; // [HGM] boardsize: make sure we start as 8x8
\r
2350 // [HGM] as long as we have not created the possibility to change size while running, start with requested size
\r
2351 gameInfo.boardWidth = appData.NrFiles > 0 ? appData.NrFiles : 8;
\r
2352 gameInfo.boardHeight = appData.NrRanks > 0 ? appData.NrRanks : 8;
\r
2353 gameInfo.holdingsWidth = appData.holdingsSize > 0 ? 2 : 0;
\r
2358 InitDrawingSizes(-1, 0); // [HGM] initsize: make this into a subroutine
\r
2360 if (isdigit(appData.boardSize[0])) {
\r
2361 i = sscanf(appData.boardSize, "%d,%d,%d,%d,%d,%d,%d", &squareSize,
\r
2362 &lineGap, &clockFontPxlSize, &coordFontPxlSize,
\r
2363 &fontPxlSize, &smallLayout, &tinyLayout);
\r
2365 fprintf(stderr, _("%s: bad boardSize syntax %s\n"),
\r
2366 programName, appData.boardSize);
\r
2370 /* Find some defaults; use the nearest known size */
\r
2371 SizeDefaults *szd, *nearest;
\r
2372 int distance = 99999;
\r
2373 nearest = szd = sizeDefaults;
\r
2374 while (szd->name != NULL) {
\r
2375 if (abs(szd->squareSize - squareSize) < distance) {
\r
2377 distance = abs(szd->squareSize - squareSize);
\r
2378 if (distance == 0) break;
\r
2382 if (i < 2) lineGap = nearest->lineGap;
\r
2383 if (i < 3) clockFontPxlSize = nearest->clockFontPxlSize;
\r
2384 if (i < 4) coordFontPxlSize = nearest->coordFontPxlSize;
\r
2385 if (i < 5) fontPxlSize = nearest->fontPxlSize;
\r
2386 if (i < 6) smallLayout = nearest->smallLayout;
\r
2387 if (i < 7) tinyLayout = nearest->tinyLayout;
\r
2390 SizeDefaults *szd = sizeDefaults;
\r
2391 if (*appData.boardSize == NULLCHAR) {
\r
2392 while (DisplayWidth(xDisplay, xScreen) < szd->minScreenSize ||
\r
2393 DisplayHeight(xDisplay, xScreen) < szd->minScreenSize) {
\r
2396 if (szd->name == NULL) szd--;
\r
2398 while (szd->name != NULL &&
\r
2399 StrCaseCmp(szd->name, appData.boardSize) != 0) szd++;
\r
2400 if (szd->name == NULL) {
\r
2401 fprintf(stderr, _("%s: unrecognized boardSize name %s\n"),
\r
2402 programName, appData.boardSize);
\r
2406 squareSize = szd->squareSize;
\r
2407 lineGap = szd->lineGap;
\r
2408 clockFontPxlSize = szd->clockFontPxlSize;
\r
2409 coordFontPxlSize = szd->coordFontPxlSize;
\r
2410 fontPxlSize = szd->fontPxlSize;
\r
2411 smallLayout = szd->smallLayout;
\r
2412 tinyLayout = szd->tinyLayout;
\r
2415 /* Now, using squareSize as a hint, find a good XPM/XIM set size */
\r
2416 if (strlen(appData.pixmapDirectory) > 0) {
\r
2417 p = ExpandPathName(appData.pixmapDirectory);
\r
2419 fprintf(stderr, _("Error expanding path name \"%s\"\n"),
\r
2420 appData.pixmapDirectory);
\r
2423 if (appData.debugMode) {
\r
2424 fprintf(stderr, _("\
\r
2425 XBoard square size (hint): %d\n\
\r
2426 %s fulldir:%s:\n"), squareSize, IMAGE_EXT, p);
\r
2428 squareSize = xpm_closest_to(p, squareSize, IMAGE_EXT);
\r
2429 if (appData.debugMode) {
\r
2430 fprintf(stderr, _("Closest %s size: %d\n"), IMAGE_EXT, squareSize);
\r
2434 /* [HR] height treated separately (hacked) */
\r
2435 boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap);
\r
2436 boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap);
\r
2437 if (appData.showJail == 1) {
\r
2438 /* Jail on top and bottom */
\r
2439 XtSetArg(boardArgs[1], XtNwidth, boardWidth);
\r
2440 XtSetArg(boardArgs[2], XtNheight,
\r
2441 boardHeight + 2*(lineGap + squareSize));
\r
2442 } else if (appData.showJail == 2) {
\r
2443 /* Jail on sides */
\r
2444 XtSetArg(boardArgs[1], XtNwidth,
\r
2445 boardWidth + 2*(lineGap + squareSize));
\r
2446 XtSetArg(boardArgs[2], XtNheight, boardHeight);
\r
2449 XtSetArg(boardArgs[1], XtNwidth, boardWidth);
\r
2450 XtSetArg(boardArgs[2], XtNheight, boardHeight);
\r
2454 * Determine what fonts to use.
\r
2456 appData.clockFont = FindFont(appData.clockFont, clockFontPxlSize);
\r
2457 clockFontID = XLoadFont(xDisplay, appData.clockFont);
\r
2458 clockFontStruct = XQueryFont(xDisplay, clockFontID);
\r
2459 appData.coordFont = FindFont(appData.coordFont, coordFontPxlSize);
\r
2460 coordFontID = XLoadFont(xDisplay, appData.coordFont);
\r
2461 coordFontStruct = XQueryFont(xDisplay, coordFontID);
\r
2462 appData.font = FindFont(appData.font, fontPxlSize);
\r
2463 countFontID = XLoadFont(xDisplay, appData.coordFont); // [HGM] holdings
\r
2464 countFontStruct = XQueryFont(xDisplay, countFontID);
\r
2465 // appData.font = FindFont(appData.font, fontPxlSize);
\r
2467 xdb = XtDatabase(xDisplay);
\r
2468 XrmPutStringResource(&xdb, "*font", appData.font);
\r
2471 * Detect if there are not enough colors available and adapt.
\r
2473 if (DefaultDepth(xDisplay, xScreen) <= 2) {
\r
2474 appData.monoMode = True;
\r
2477 if (!appData.monoMode) {
\r
2478 vFrom.addr = (caddr_t) appData.lightSquareColor;
\r
2479 vFrom.size = strlen(appData.lightSquareColor);
\r
2480 XtConvert(shellWidget, XtRString, &vFrom, XtRPixel, &vTo);
\r
2481 if (vTo.addr == NULL) {
\r
2482 appData.monoMode = True;
\r
2485 lightSquareColor = *(Pixel *) vTo.addr;
\r
2488 if (!appData.monoMode) {
\r
2489 vFrom.addr = (caddr_t) appData.darkSquareColor;
\r
2490 vFrom.size = strlen(appData.darkSquareColor);
\r
2491 XtConvert(shellWidget, XtRString, &vFrom, XtRPixel, &vTo);
\r
2492 if (vTo.addr == NULL) {
\r
2493 appData.monoMode = True;
\r
2496 darkSquareColor = *(Pixel *) vTo.addr;
\r
2499 if (!appData.monoMode) {
\r
2500 vFrom.addr = (caddr_t) appData.whitePieceColor;
\r
2501 vFrom.size = strlen(appData.whitePieceColor);
\r
2502 XtConvert(shellWidget, XtRString, &vFrom, XtRPixel, &vTo);
\r
2503 if (vTo.addr == NULL) {
\r
2504 appData.monoMode = True;
\r
2507 whitePieceColor = *(Pixel *) vTo.addr;
\r
2510 if (!appData.monoMode) {
\r
2511 vFrom.addr = (caddr_t) appData.blackPieceColor;
\r
2512 vFrom.size = strlen(appData.blackPieceColor);
\r
2513 XtConvert(shellWidget, XtRString, &vFrom, XtRPixel, &vTo);
\r
2514 if (vTo.addr == NULL) {
\r
2515 appData.monoMode = True;
\r
2518 blackPieceColor = *(Pixel *) vTo.addr;
\r
2522 if (!appData.monoMode) {
\r
2523 vFrom.addr = (caddr_t) appData.highlightSquareColor;
\r
2524 vFrom.size = strlen(appData.highlightSquareColor);
\r
2525 XtConvert(shellWidget, XtRString, &vFrom, XtRPixel, &vTo);
\r
2526 if (vTo.addr == NULL) {
\r
2527 appData.monoMode = True;
\r
2530 highlightSquareColor = *(Pixel *) vTo.addr;
\r
2534 if (!appData.monoMode) {
\r
2535 vFrom.addr = (caddr_t) appData.premoveHighlightColor;
\r
2536 vFrom.size = strlen(appData.premoveHighlightColor);
\r
2537 XtConvert(shellWidget, XtRString, &vFrom, XtRPixel, &vTo);
\r
2538 if (vTo.addr == NULL) {
\r
2539 appData.monoMode = True;
\r
2542 premoveHighlightColor = *(Pixel *) vTo.addr;
\r
2547 fprintf(stderr, _("%s: too few colors available; trying monochrome mode\n"),
\r
2551 if (appData.monoMode && appData.debugMode) {
\r
2552 fprintf(stderr, _("white pixel = 0x%lx, black pixel = 0x%lx\n"),
\r
2553 (unsigned long) XWhitePixel(xDisplay, xScreen),
\r
2554 (unsigned long) XBlackPixel(xDisplay, xScreen));
\r
2557 if (parse_cpair(ColorShout, appData.colorShout) < 0 ||
\r
2558 parse_cpair(ColorSShout, appData.colorSShout) < 0 ||
\r
2559 parse_cpair(ColorChannel1, appData.colorChannel1) < 0 ||
\r
2560 parse_cpair(ColorChannel, appData.colorChannel) < 0 ||
\r
2561 parse_cpair(ColorKibitz, appData.colorKibitz) < 0 ||
\r
2562 parse_cpair(ColorTell, appData.colorTell) < 0 ||
\r
2563 parse_cpair(ColorChallenge, appData.colorChallenge) < 0 ||
\r
2564 parse_cpair(ColorRequest, appData.colorRequest) < 0 ||
\r
2565 parse_cpair(ColorSeek, appData.colorSeek) < 0 ||
\r
2566 parse_cpair(ColorNormal, appData.colorNormal) < 0)
\r
2568 if (appData.colorize) {
\r
2570 _("%s: can't parse color names; disabling colorization\n"),
\r
2573 appData.colorize = FALSE;
\r
2575 textColors[ColorNone].fg = textColors[ColorNone].bg = -1;
\r
2576 textColors[ColorNone].attr = 0;
\r
2578 XtAppAddActions(appContext, boardActions, XtNumber(boardActions));
\r
2581 * widget hierarchy
\r
2584 layoutName = "tinyLayout";
\r
2585 } else if (smallLayout) {
\r
2586 layoutName = "smallLayout";
\r
2588 layoutName = "normalLayout";
\r
2590 /* Outer layoutWidget is there only to provide a name for use in
\r
2591 resources that depend on the layout style */
\r
2593 XtCreateManagedWidget(layoutName, formWidgetClass, shellWidget,
\r
2594 layoutArgs, XtNumber(layoutArgs));
\r
2596 XtCreateManagedWidget("form", formWidgetClass, layoutWidget,
\r
2597 formArgs, XtNumber(formArgs));
\r
2598 XtSetArg(args[0], XtNdefaultDistance, &sep);
\r
2599 XtGetValues(formWidget, args, 1);
\r
2602 widgetList[j++] = menuBarWidget = CreateMenuBar(menuBar);
\r
2603 XtSetArg(args[0], XtNtop, XtChainTop);
\r
2604 XtSetArg(args[1], XtNbottom, XtChainTop);
\r
2605 XtSetValues(menuBarWidget, args, 2);
\r
2607 widgetList[j++] = whiteTimerWidget =
\r
2608 XtCreateWidget("whiteTime", labelWidgetClass,
\r
2609 formWidget, timerArgs, XtNumber(timerArgs));
\r
2610 XtSetArg(args[0], XtNfont, clockFontStruct);
\r
2611 XtSetArg(args[1], XtNtop, XtChainTop);
\r
2612 XtSetArg(args[2], XtNbottom, XtChainTop);
\r
2613 XtSetValues(whiteTimerWidget, args, 3);
\r
2615 widgetList[j++] = blackTimerWidget =
\r
2616 XtCreateWidget("blackTime", labelWidgetClass,
\r
2617 formWidget, timerArgs, XtNumber(timerArgs));
\r
2618 XtSetArg(args[0], XtNfont, clockFontStruct);
\r
2619 XtSetArg(args[1], XtNtop, XtChainTop);
\r
2620 XtSetArg(args[2], XtNbottom, XtChainTop);
\r
2621 XtSetValues(blackTimerWidget, args, 3);
\r
2623 if (appData.titleInWindow) {
\r
2624 widgetList[j++] = titleWidget =
\r
2625 XtCreateWidget("title", labelWidgetClass, formWidget,
\r
2626 titleArgs, XtNumber(titleArgs));
\r
2627 XtSetArg(args[0], XtNtop, XtChainTop);
\r
2628 XtSetArg(args[1], XtNbottom, XtChainTop);
\r
2629 XtSetValues(titleWidget, args, 2);
\r
2632 if (appData.showButtonBar) {
\r
2633 widgetList[j++] = buttonBarWidget = CreateButtonBar(buttonBar);
\r
2634 XtSetArg(args[0], XtNleft, XtChainRight); // [HGM] glue to right window edge
\r
2635 XtSetArg(args[1], XtNright, XtChainRight); // for good run-time sizing
\r
2636 XtSetArg(args[2], XtNtop, XtChainTop);
\r
2637 XtSetArg(args[3], XtNbottom, XtChainTop);
\r
2638 XtSetValues(buttonBarWidget, args, 4);
\r
2641 widgetList[j++] = messageWidget =
\r
2642 XtCreateWidget("message", labelWidgetClass, formWidget,
\r
2643 messageArgs, XtNumber(messageArgs));
\r
2644 XtSetArg(args[0], XtNtop, XtChainTop);
\r
2645 XtSetArg(args[1], XtNbottom, XtChainTop);
\r
2646 XtSetValues(messageWidget, args, 2);
\r
2648 widgetList[j++] = boardWidget =
\r
2649 XtCreateWidget("board", widgetClass, formWidget, boardArgs,
\r
2650 XtNumber(boardArgs));
\r
2652 XtManageChildren(widgetList, j);
\r
2654 timerWidth = (boardWidth - sep) / 2;
\r
2655 XtSetArg(args[0], XtNwidth, timerWidth);
\r
2656 XtSetValues(whiteTimerWidget, args, 1);
\r
2657 XtSetValues(blackTimerWidget, args, 1);
\r
2659 XtSetArg(args[0], XtNbackground, &timerBackgroundPixel);
\r
2660 XtSetArg(args[1], XtNforeground, &timerForegroundPixel);
\r
2661 XtGetValues(whiteTimerWidget, args, 2);
\r
2663 if (appData.showButtonBar) {
\r
2664 XtSetArg(args[0], XtNbackground, &buttonBackgroundPixel);
\r
2665 XtSetArg(args[1], XtNforeground, &buttonForegroundPixel);
\r
2666 XtGetValues(XtNameToWidget(buttonBarWidget, PAUSE_BUTTON), args, 2);
\r
2670 * formWidget uses these constraints but they are stored
\r
2671 * in the children.
\r
2674 XtSetArg(args[i], XtNfromHoriz, 0); i++;
\r
2675 XtSetValues(menuBarWidget, args, i);
\r
2676 if (appData.titleInWindow) {
\r
2677 if (smallLayout) {
\r
2679 XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
\r
2680 XtSetValues(whiteTimerWidget, args, i);
\r
2682 XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
\r
2683 XtSetArg(args[i], XtNfromHoriz, whiteTimerWidget); i++;
\r
2684 XtSetValues(blackTimerWidget, args, i);
\r
2686 XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
\r
2687 XtSetArg(args[i], XtNjustify, XtJustifyLeft); i++;
\r
2688 XtSetValues(titleWidget, args, i);
\r
2690 XtSetArg(args[i], XtNfromVert, titleWidget); i++;
\r
2691 XtSetArg(args[i], XtNresizable, (XtArgVal) True); i++;
\r
2692 XtSetValues(messageWidget, args, i);
\r
2693 if (appData.showButtonBar) {
\r
2695 XtSetArg(args[i], XtNfromVert, titleWidget); i++;
\r
2696 XtSetArg(args[i], XtNfromHoriz, messageWidget); i++;
\r
2697 XtSetValues(buttonBarWidget, args, i);
\r
2701 XtSetArg(args[i], XtNfromVert, titleWidget); i++;
\r
2702 XtSetValues(whiteTimerWidget, args, i);
\r
2704 XtSetArg(args[i], XtNfromVert, titleWidget); i++;
\r
2705 XtSetArg(args[i], XtNfromHoriz, whiteTimerWidget); i++;
\r
2706 XtSetValues(blackTimerWidget, args, i);
\r
2708 XtSetArg(args[i], XtNfromHoriz, menuBarWidget); i++;
\r
2709 XtSetValues(titleWidget, args, i);
\r
2711 XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
\r
2712 XtSetArg(args[i], XtNresizable, (XtArgVal) True); i++;
\r
2713 XtSetValues(messageWidget, args, i);
\r
2714 if (appData.showButtonBar) {
\r
2716 XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
\r
2717 XtSetArg(args[i], XtNfromHoriz, messageWidget); i++;
\r
2718 XtSetValues(buttonBarWidget, args, i);
\r
2723 XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
\r
2724 XtSetValues(whiteTimerWidget, args, i);
\r
2726 XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
\r
2727 XtSetArg(args[i], XtNfromHoriz, whiteTimerWidget); i++;
\r
2728 XtSetValues(blackTimerWidget, args, i);
\r
2730 XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
\r
2731 XtSetArg(args[i], XtNresizable, (XtArgVal) True); i++;
\r
2732 XtSetValues(messageWidget, args, i);
\r
2733 if (appData.showButtonBar) {
\r
2735 XtSetArg(args[i], XtNfromVert, whiteTimerWidget); i++;
\r
2736 XtSetArg(args[i], XtNfromHoriz, messageWidget); i++;
\r
2737 XtSetValues(buttonBarWidget, args, i);
\r
2741 XtSetArg(args[0], XtNfromVert, messageWidget);
\r
2742 XtSetArg(args[1], XtNtop, XtChainTop);
\r
2743 XtSetArg(args[2], XtNbottom, XtChainBottom);
\r
2744 XtSetArg(args[3], XtNleft, XtChainLeft);
\r
2745 XtSetArg(args[4], XtNright, XtChainRight);
\r
2746 XtSetValues(boardWidget, args, 5);
\r
2748 XtRealizeWidget(shellWidget);
\r
2751 * Correct the width of the message and title widgets.
\r
2752 * It is not known why some systems need the extra fudge term.
\r
2753 * The value "2" is probably larger than needed.
\r
2755 XawFormDoLayout(formWidget, False);
\r
2757 #define WIDTH_FUDGE 2
\r
2759 XtSetArg(args[i], XtNborderWidth, &bor); i++;
\r
2760 XtSetArg(args[i], XtNheight, &h); i++;
\r
2761 XtGetValues(messageWidget, args, i);
\r
2762 if (appData.showButtonBar) {
\r
2764 XtSetArg(args[i], XtNwidth, &w); i++;
\r
2765 XtGetValues(buttonBarWidget, args, i);
\r
2766 w = boardWidth - w - sep - 2*bor - WIDTH_FUDGE;
\r
2768 w = boardWidth - 2*bor + 1; /*!! +1 compensates for kludge below */
\r
2771 gres = XtMakeResizeRequest(messageWidget, w, h, &wr, &hr);
\r
2772 if (gres != XtGeometryYes && appData.debugMode) {
\r
2773 fprintf(stderr, _("%s: messageWidget geometry error %d %d %d %d %d\n"),
\r
2774 programName, gres, w, h, wr, hr);
\r
2777 /* !! Horrible hack to work around bug in XFree86 4.0.1 (X11R6.4.3) */
\r
2778 /* The size used for the child widget in layout lags one resize behind
\r
2779 its true size, so we resize a second time, 1 pixel smaller. Yeech! */
\r
2781 gres = XtMakeResizeRequest(messageWidget, w, h, &wr, &hr);
\r
2782 if (gres != XtGeometryYes && appData.debugMode) {
\r
2783 fprintf(stderr, _("%s: messageWidget geometry error %d %d %d %d %d\n"),
\r
2784 programName, gres, w, h, wr, hr);
\r
2787 XtSetArg(args[0], XtNleft, XtChainLeft); // [HGM] glue ends for good run-time sizing
\r
2788 XtSetArg(args[1], XtNright, XtChainRight);
\r
2789 XtSetValues(messageWidget, args, 2);
\r
2791 if (appData.titleInWindow) {
\r
2793 XtSetArg(args[i], XtNborderWidth, &bor); i++;
\r
2794 XtSetArg(args[i], XtNheight, &h); i++;
\r
2795 XtGetValues(titleWidget, args, i);
\r
2796 if (smallLayout) {
\r
2797 w = boardWidth - 2*bor;
\r
2799 XtSetArg(args[0], XtNwidth, &w);
\r
2800 XtGetValues(menuBarWidget, args, 1);
\r
2801 w = boardWidth - w - sep - 2*bor - WIDTH_FUDGE;
\r
2804 gres = XtMakeResizeRequest(titleWidget, w, h, &wr, &hr);
\r
2805 if (gres != XtGeometryYes && appData.debugMode) {
\r
2807 _("%s: titleWidget geometry error %d %d %d %d %d\n"),
\r
2808 programName, gres, w, h, wr, hr);
\r
2811 XawFormDoLayout(formWidget, True);
\r
2813 xBoardWindow = XtWindow(boardWidget);
\r
2815 // [HGM] it seems the layout code ends here, but perhaps the color stuff is size independent and would
\r
2816 // not need to go into InitDrawingSizes().
\r
2820 * Create X checkmark bitmap and initialize option menu checks.
\r
2822 ReadBitmap(&xMarkPixmap, "checkmark.bm",
\r
2823 checkmark_bits, checkmark_width, checkmark_height);
\r
2824 XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);
\r
2825 if (appData.alwaysPromoteToQueen) {
\r
2826 XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Always Queen"),
\r
2829 if (appData.animateDragging) {
\r
2830 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2831 "menuOptions.Animate Dragging"),
\r
2834 if (appData.animate) {
\r
2835 XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Animate Moving"),
\r
2838 if (appData.autoComment) {
\r
2839 XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Auto Comment"),
\r
2842 if (appData.autoCallFlag) {
\r
2843 XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Auto Flag"),
\r
2846 if (appData.autoFlipView) {
\r
2847 XtSetValues(XtNameToWidget(menuBarWidget,"menuOptions.Auto Flip View"),
\r
2850 if (appData.autoObserve) {
\r
2851 XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Auto Observe"),
\r
2854 if (appData.autoRaiseBoard) {
\r
2855 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2856 "menuOptions.Auto Raise Board"), args, 1);
\r
2858 if (appData.autoSaveGames) {
\r
2859 XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Auto Save"),
\r
2862 if (appData.saveGameFile[0] != NULLCHAR) {
\r
2863 /* Can't turn this off from menu */
\r
2864 XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Auto Save"),
\r
2866 XtSetSensitive(XtNameToWidget(menuBarWidget, "menuOptions.Auto Save"),
\r
2870 if (appData.blindfold) {
\r
2871 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2872 "menuOptions.Blindfold"), args, 1);
\r
2874 if (appData.flashCount > 0) {
\r
2875 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2876 "menuOptions.Flash Moves"),
\r
2879 if (appData.getMoveList) {
\r
2880 XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Get Move List"),
\r
2884 if (appData.highlightDragging) {
\r
2885 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2886 "menuOptions.Highlight Dragging"),
\r
2890 if (appData.highlightLastMove) {
\r
2891 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2892 "menuOptions.Highlight Last Move"),
\r
2895 if (appData.icsAlarm) {
\r
2896 XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.ICS Alarm"),
\r
2899 if (appData.ringBellAfterMoves) {
\r
2900 XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Move Sound"),
\r
2903 if (appData.oldSaveStyle) {
\r
2904 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2905 "menuOptions.Old Save Style"), args, 1);
\r
2907 if (appData.periodicUpdates) {
\r
2908 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2909 "menuOptions.Periodic Updates"), args, 1);
\r
2911 if (appData.ponderNextMove) {
\r
2912 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2913 "menuOptions.Ponder Next Move"), args, 1);
\r
2915 if (appData.popupExitMessage) {
\r
2916 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2917 "menuOptions.Popup Exit Message"), args, 1);
\r
2919 if (appData.popupMoveErrors) {
\r
2920 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2921 "menuOptions.Popup Move Errors"), args, 1);
\r
2923 if (appData.premove) {
\r
2924 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2925 "menuOptions.Premove"), args, 1);
\r
2927 if (appData.quietPlay) {
\r
2928 XtSetValues(XtNameToWidget(menuBarWidget,
\r
2929 "menuOptions.Quiet Play"), args, 1);
\r
2931 if (appData.showCoords) {
\r
2932 XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Show Coords"),
\r
2935 if (appData.hideThinkingFromHuman) {
\r
2936 XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Hide Thinking"),
\r
2939 if (appData.testLegality) {
\r
2940 XtSetValues(XtNameToWidget(menuBarWidget,"menuOptions.Test Legality"),
\r
2947 ReadBitmap(&wIconPixmap, "icon_white.bm",
\r
2948 icon_white_bits, icon_white_width, icon_white_height);
\r
2949 ReadBitmap(&bIconPixmap, "icon_black.bm",
\r
2950 icon_black_bits, icon_black_width, icon_black_height);
\r
2951 iconPixmap = wIconPixmap;
\r
2953 XtSetArg(args[i], XtNiconPixmap, iconPixmap); i++;
\r
2954 XtSetValues(shellWidget, args, i);
\r
2957 * Create a cursor for the board widget.
\r
2959 window_attributes.cursor = XCreateFontCursor(xDisplay, XC_hand2);
\r
2960 XChangeWindowAttributes(xDisplay, xBoardWindow,
\r
2961 CWCursor, &window_attributes);
\r
2964 * Inhibit shell resizing.
\r
2966 shellArgs[0].value = (XtArgVal) &w;
\r
2967 shellArgs[1].value = (XtArgVal) &h;
\r
2968 XtGetValues(shellWidget, shellArgs, 2);
\r
2969 shellArgs[4].value = shellArgs[2].value = w;
\r
2970 shellArgs[5].value = shellArgs[3].value = h;
\r
2971 XtSetValues(shellWidget, &shellArgs[2], 4);
\r
2972 marginW = w - boardWidth; // [HGM] needed to set new shellWidget size when we resize board
\r
2973 marginH = h - boardHeight;
\r
2975 CatchDeleteWindow(shellWidget, "QuitProc");
\r
2980 if (appData.bitmapDirectory[0] != NULLCHAR) {
\r
2983 CreateXPMPieces();
\r
2986 CreateXIMPieces();
\r
2987 /* Create regular pieces */
\r
2988 if (!useImages) CreatePieces();
\r
2991 CreatePieceMenus();
\r
2993 if (appData.animate || appData.animateDragging)
\r
2996 XtAugmentTranslations(formWidget,
\r
2997 XtParseTranslationTable(globalTranslations));
\r
2998 XtAugmentTranslations(boardWidget,
\r
2999 XtParseTranslationTable(boardTranslations));
\r
3000 XtAugmentTranslations(whiteTimerWidget,
\r
3001 XtParseTranslationTable(whiteTranslations));
\r
3002 XtAugmentTranslations(blackTimerWidget,
\r
3003 XtParseTranslationTable(blackTranslations));
\r
3005 /* Why is the following needed on some versions of X instead
\r
3006 * of a translation? */
\r
3007 XtAddEventHandler(boardWidget, ExposureMask, False,
\r
3008 (XtEventHandler) EventProc, NULL);
\r
3013 if (errorExitStatus == -1) {
\r
3014 if (appData.icsActive) {
\r
3015 /* We now wait until we see "login:" from the ICS before
\r
3016 sending the logon script (problems with timestamp otherwise) */
\r
3017 /*ICSInitScript();*/
\r
3018 if (appData.icsInputBox) ICSInputBoxPopUp();
\r
3021 signal(SIGINT, IntSigHandler);
\r
3022 signal(SIGTERM, IntSigHandler);
\r
3023 if (*appData.cmailGameName != NULLCHAR) {
\r
3024 signal(SIGUSR1, CmailSigHandler);
\r
3027 InitPosition(TRUE);
\r
3029 XtAppMainLoop(appContext);
\r
3030 if (appData.debugMode) fclose(debugFP); // [DM] debug
\r
3035 ShutDownFrontEnd()
\r
3037 if (appData.icsActive && oldICSInteractionTitle != NULL) {
\r
3038 DisplayIcsInteractionTitle(oldICSInteractionTitle);
\r
3040 unlink(gameCopyFilename);
\r
3041 unlink(gamePasteFilename);
\r
3045 IntSigHandler(sig)
\r
3052 CmailSigHandler(sig)
\r
3058 signal(SIGUSR1, SIG_IGN); /* suspend handler */
\r
3060 /* Activate call-back function CmailSigHandlerCallBack() */
\r
3061 OutputToProcess(cmailPR, (char *)(&dummy), sizeof(int), &error);
\r
3063 signal(SIGUSR1, CmailSigHandler); /* re-activate handler */
\r
3067 CmailSigHandlerCallBack(isr, closure, message, count, error)
\r
3068 InputSourceRef isr;
\r
3075 ReloadCmailMsgEvent(TRUE); /* Reload cmail msg */
\r
3077 /**** end signal code ****/
\r
3084 char buf[MSG_SIZ];
\r
3087 f = fopen(appData.icsLogon, "r");
\r
3089 p = getenv("HOME");
\r
3093 strcat(buf, appData.icsLogon);
\r
3094 f = fopen(buf, "r");
\r
3098 ProcessICSInitScript(f);
\r
3105 EditCommentPopDown();
\r
3116 SetMenuEnables(enab)
\r
3120 if (!menuBarWidget) return;
\r
3121 while (enab->name != NULL) {
\r
3122 w = XtNameToWidget(menuBarWidget, enab->name);
\r
3124 DisplayError(enab->name, 0);
\r
3126 XtSetSensitive(w, enab->value);
\r
3132 Enables icsEnables[] = {
\r
3133 { "menuFile.Mail Move", False },
\r
3134 { "menuFile.Reload CMail Message", False },
\r
3135 { "menuMode.Machine Black", False },
\r
3136 { "menuMode.Machine White", False },
\r
3137 { "menuMode.Analysis Mode", False },
\r
3138 { "menuMode.Analyze File", False },
\r
3139 { "menuMode.Two Machines", False },
\r
3141 { "menuHelp.Hint", False },
\r
3142 { "menuHelp.Book", False },
\r
3143 { "menuStep.Move Now", False },
\r
3144 { "menuOptions.Periodic Updates", False },
\r
3145 { "menuOptions.Hide Thinking", False },
\r
3146 { "menuOptions.Ponder Next Move", False },
\r
3151 Enables ncpEnables[] = {
\r
3152 { "menuFile.Mail Move", False },
\r
3153 { "menuFile.Reload CMail Message", False },
\r
3154 { "menuMode.Machine White", False },
\r
3155 { "menuMode.Machine Black", False },
\r
3156 { "menuMode.Analysis Mode", False },
\r
3157 { "menuMode.Analyze File", False },
\r
3158 { "menuMode.Two Machines", False },
\r
3159 { "menuMode.ICS Client", False },
\r
3160 { "menuMode.ICS Input Box", False },
\r
3161 { "Action", False },
\r
3162 { "menuStep.Revert", False },
\r
3163 { "menuStep.Move Now", False },
\r
3164 { "menuStep.Retract Move", False },
\r
3165 { "menuOptions.Auto Comment", False },
\r
3166 { "menuOptions.Auto Flag", False },
\r
3167 { "menuOptions.Auto Flip View", False },
\r
3168 { "menuOptions.Auto Observe", False },
\r
3169 { "menuOptions.Auto Raise Board", False },
\r
3170 { "menuOptions.Get Move List", False },
\r
3171 { "menuOptions.ICS Alarm", False },
\r
3172 { "menuOptions.Move Sound", False },
\r
3173 { "menuOptions.Quiet Play", False },
\r
3174 { "menuOptions.Hide Thinking", False },
\r
3175 { "menuOptions.Periodic Updates", False },
\r
3176 { "menuOptions.Ponder Next Move", False },
\r
3177 { "menuHelp.Hint", False },
\r
3178 { "menuHelp.Book", False },
\r
3182 Enables gnuEnables[] = {
\r
3183 { "menuMode.ICS Client", False },
\r
3184 { "menuMode.ICS Input Box", False },
\r
3185 { "menuAction.Accept", False },
\r
3186 { "menuAction.Decline", False },
\r
3187 { "menuAction.Rematch", False },
\r
3188 { "menuAction.Adjourn", False },
\r
3189 { "menuAction.Stop Examining", False },
\r
3190 { "menuAction.Stop Observing", False },
\r
3191 { "menuStep.Revert", False },
\r
3192 { "menuOptions.Auto Comment", False },
\r
3193 { "menuOptions.Auto Observe", False },
\r
3194 { "menuOptions.Auto Raise Board", False },
\r
3195 { "menuOptions.Get Move List", False },
\r
3196 { "menuOptions.Premove", False },
\r
3197 { "menuOptions.Quiet Play", False },
\r
3199 /* The next two options rely on SetCmailMode being called *after* */
\r
3200 /* SetGNUMode so that when GNU is being used to give hints these */
\r
3201 /* menu options are still available */
\r
3203 { "menuFile.Mail Move", False },
\r
3204 { "menuFile.Reload CMail Message", False },
\r
3208 Enables cmailEnables[] = {
\r
3209 { "Action", True },
\r
3210 { "menuAction.Call Flag", False },
\r
3211 { "menuAction.Draw", True },
\r
3212 { "menuAction.Adjourn", False },
\r
3213 { "menuAction.Abort", False },
\r
3214 { "menuAction.Stop Observing", False },
\r
3215 { "menuAction.Stop Examining", False },
\r
3216 { "menuFile.Mail Move", True },
\r
3217 { "menuFile.Reload CMail Message", True },
\r
3221 Enables trainingOnEnables[] = {
\r
3222 { "menuMode.Edit Comment", False },
\r
3223 { "menuMode.Pause", False },
\r
3224 { "menuStep.Forward", False },
\r
3225 { "menuStep.Backward", False },
\r
3226 { "menuStep.Forward to End", False },
\r
3227 { "menuStep.Back to Start", False },
\r
3228 { "menuStep.Move Now", False },
\r
3229 { "menuStep.Truncate Game", False },
\r
3233 Enables trainingOffEnables[] = {
\r
3234 { "menuMode.Edit Comment", True },
\r
3235 { "menuMode.Pause", True },
\r
3236 { "menuStep.Forward", True },
\r
3237 { "menuStep.Backward", True },
\r
3238 { "menuStep.Forward to End", True },
\r
3239 { "menuStep.Back to Start", True },
\r
3240 { "menuStep.Move Now", True },
\r
3241 { "menuStep.Truncate Game", True },
\r
3245 Enables machineThinkingEnables[] = {
\r
3246 { "menuFile.Load Game", False },
\r
3247 { "menuFile.Load Next Game", False },
\r
3248 { "menuFile.Load Previous Game", False },
\r
3249 { "menuFile.Reload Same Game", False },
\r
3250 { "menuFile.Paste Game", False },
\r
3251 { "menuFile.Load Position", False },
\r
3252 { "menuFile.Load Next Position", False },
\r
3253 { "menuFile.Load Previous Position", False },
\r
3254 { "menuFile.Reload Same Position", False },
\r
3255 { "menuFile.Paste Position", False },
\r
3256 { "menuMode.Machine White", False },
\r
3257 { "menuMode.Machine Black", False },
\r
3258 { "menuMode.Two Machines", False },
\r
3259 { "menuStep.Retract Move", False },
\r
3263 Enables userThinkingEnables[] = {
\r
3264 { "menuFile.Load Game", True },
\r
3265 { "menuFile.Load Next Game", True },
\r
3266 { "menuFile.Load Previous Game", True },
\r
3267 { "menuFile.Reload Same Game", True },
\r
3268 { "menuFile.Paste Game", True },
\r
3269 { "menuFile.Load Position", True },
\r
3270 { "menuFile.Load Next Position", True },
\r
3271 { "menuFile.Load Previous Position", True },
\r
3272 { "menuFile.Reload Same Position", True },
\r
3273 { "menuFile.Paste Position", True },
\r
3274 { "menuMode.Machine White", True },
\r
3275 { "menuMode.Machine Black", True },
\r
3276 { "menuMode.Two Machines", True },
\r
3277 { "menuStep.Retract Move", True },
\r
3283 SetMenuEnables(icsEnables);
\r
3286 if (appData.zippyPlay && !appData.noChessProgram) /* [DM] icsEngineAnalyze */
\r
3287 XtSetSensitive(XtNameToWidget(menuBarWidget, "menuMode.Analysis Mode"), True);
\r
3294 SetMenuEnables(ncpEnables);
\r
3300 SetMenuEnables(gnuEnables);
\r
3306 SetMenuEnables(cmailEnables);
\r
3310 SetTrainingModeOn()
\r
3312 SetMenuEnables(trainingOnEnables);
\r
3313 if (appData.showButtonBar) {
\r
3314 XtSetSensitive(buttonBarWidget, False);
\r
3320 SetTrainingModeOff()
\r
3322 SetMenuEnables(trainingOffEnables);
\r
3323 if (appData.showButtonBar) {
\r
3324 XtSetSensitive(buttonBarWidget, True);
\r
3329 SetUserThinkingEnables()
\r
3331 if (appData.noChessProgram) return;
\r
3332 SetMenuEnables(userThinkingEnables);
\r
3336 SetMachineThinkingEnables()
\r
3338 if (appData.noChessProgram) return;
\r
3339 SetMenuEnables(machineThinkingEnables);
\r
3340 switch (gameMode) {
\r
3341 case MachinePlaysBlack:
\r
3342 case MachinePlaysWhite:
\r
3343 case TwoMachinesPlay:
\r
3344 XtSetSensitive(XtNameToWidget(menuBarWidget,
\r
3345 ModeToWidgetName(gameMode)), True);
\r
3352 #define Abs(n) ((n)<0 ? -(n) : (n))
\r
3355 * Find a font that matches "pattern" that is as close as
\r
3356 * possible to the targetPxlSize. Prefer fonts that are k
\r
3357 * pixels smaller to fonts that are k pixels larger. The
\r
3358 * pattern must be in the X Consortium standard format,
\r
3359 * e.g. "-*-helvetica-bold-r-normal--*-*-*-*-*-*-*-*".
\r
3360 * The return value should be freed with XtFree when no
\r
3363 char *FindFont(pattern, targetPxlSize)
\r
3365 int targetPxlSize;
\r
3367 char **fonts, *p, *best, *scalable, *scalableTail;
\r
3368 int i, j, nfonts, minerr, err, pxlSize;
\r
3371 char **missing_list;
\r
3372 int missing_count;
\r
3373 char *def_string, *base_fnt_lst, strInt[3];
\r
3375 XFontStruct **fnt_list;
\r
3377 base_fnt_lst = calloc(1, strlen(pattern) + 3);
\r
3378 sprintf(strInt, "%d", targetPxlSize);
\r
3379 p = strstr(pattern, "--");
\r
3380 strncpy(base_fnt_lst, pattern, p - pattern + 2);
\r
3381 strcat(base_fnt_lst, strInt);
\r
3382 strcat(base_fnt_lst, strchr(p + 2, '-'));
\r
3384 if ((fntSet = XCreateFontSet(xDisplay,
\r
3388 &def_string)) == NULL) {
\r
3390 fprintf(stderr, _("Unable to create font set.\n"));
\r
3394 nfonts = XFontsOfFontSet(fntSet, &fnt_list, &fonts);
\r
3396 fonts = XListFonts(xDisplay, pattern, 999999, &nfonts);
\r
3398 fprintf(stderr, _("%s: no fonts match pattern %s\n"),
\r
3399 programName, pattern);
\r
3407 for (i=0; i<nfonts; i++) {
\r
3410 if (*p != '-') continue;
\r
3412 if (*p == NULLCHAR) break;
\r
3413 if (*p++ == '-') j++;
\r
3415 if (j < 7) continue;
\r
3416 pxlSize = atoi(p);
\r
3417 if (pxlSize == 0) {
\r
3418 scalable = fonts[i];
\r
3421 err = pxlSize - targetPxlSize;
\r
3422 if (Abs(err) < Abs(minerr) ||
\r
3423 (minerr > 0 && err < 0 && -err == minerr)) {
\r
3429 if (scalable && Abs(minerr) > appData.fontSizeTolerance) {
\r
3430 /* If the error is too big and there is a scalable font,
\r
3431 use the scalable font. */
\r
3432 int headlen = scalableTail - scalable;
\r
3433 p = (char *) XtMalloc(strlen(scalable) + 10);
\r
3434 while (isdigit(*scalableTail)) scalableTail++;
\r
3435 sprintf(p, "%.*s%d%s", headlen, scalable, targetPxlSize, scalableTail);
\r
3437 p = (char *) XtMalloc(strlen(best) + 1);
\r
3440 if (appData.debugMode) {
\r
3441 fprintf(debugFP, _("resolved %s at pixel size %d\n to %s\n"),
\r
3442 pattern, targetPxlSize, p);
\r
3445 if (missing_count > 0)
\r
3446 XFreeStringList(missing_list);
\r
3447 XFreeFontSet(xDisplay, fntSet);
\r
3449 XFreeFontNames(fonts);
\r
3456 XtGCMask value_mask = GCLineWidth | GCLineStyle | GCForeground
\r
3457 | GCBackground | GCFunction | GCPlaneMask;
\r
3458 XGCValues gc_values;
\r
3459 GC copyInvertedGC;
\r
3461 gc_values.plane_mask = AllPlanes;
\r
3462 gc_values.line_width = lineGap;
\r
3463 gc_values.line_style = LineSolid;
\r
3464 gc_values.function = GXcopy;
\r
3466 gc_values.foreground = XBlackPixel(xDisplay, xScreen);
\r
3467 gc_values.background = XBlackPixel(xDisplay, xScreen);
\r
3468 lineGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3470 gc_values.foreground = XBlackPixel(xDisplay, xScreen);
\r
3471 gc_values.background = XWhitePixel(xDisplay, xScreen);
\r
3472 coordGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3473 XSetFont(xDisplay, coordGC, coordFontID);
\r
3475 // [HGM] make font for holdings counts (white on black0
\r
3476 gc_values.foreground = XWhitePixel(xDisplay, xScreen);
\r
3477 gc_values.background = XBlackPixel(xDisplay, xScreen);
\r
3478 countGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3479 XSetFont(xDisplay, countGC, countFontID);
\r
3481 if (appData.monoMode) {
\r
3482 gc_values.foreground = XWhitePixel(xDisplay, xScreen);
\r
3483 gc_values.background = XWhitePixel(xDisplay, xScreen);
\r
3484 highlineGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3486 gc_values.foreground = XWhitePixel(xDisplay, xScreen);
\r
3487 gc_values.background = XBlackPixel(xDisplay, xScreen);
\r
3488 lightSquareGC = wbPieceGC
\r
3489 = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3491 gc_values.foreground = XBlackPixel(xDisplay, xScreen);
\r
3492 gc_values.background = XWhitePixel(xDisplay, xScreen);
\r
3493 darkSquareGC = bwPieceGC
\r
3494 = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3496 if (DefaultDepth(xDisplay, xScreen) == 1) {
\r
3497 /* Avoid XCopyPlane on 1-bit screens to work around Sun bug */
\r
3498 gc_values.function = GXcopyInverted;
\r
3499 copyInvertedGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3500 gc_values.function = GXcopy;
\r
3501 if (XBlackPixel(xDisplay, xScreen) == 1) {
\r
3502 bwPieceGC = darkSquareGC;
\r
3503 wbPieceGC = copyInvertedGC;
\r
3505 bwPieceGC = copyInvertedGC;
\r
3506 wbPieceGC = lightSquareGC;
\r
3510 gc_values.foreground = highlightSquareColor;
\r
3511 gc_values.background = highlightSquareColor;
\r
3512 highlineGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3514 gc_values.foreground = premoveHighlightColor;
\r
3515 gc_values.background = premoveHighlightColor;
\r
3516 prelineGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3518 gc_values.foreground = lightSquareColor;
\r
3519 gc_values.background = darkSquareColor;
\r
3520 lightSquareGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3522 gc_values.foreground = darkSquareColor;
\r
3523 gc_values.background = lightSquareColor;
\r
3524 darkSquareGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3526 gc_values.foreground = jailSquareColor;
\r
3527 gc_values.background = jailSquareColor;
\r
3528 jailSquareGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3530 gc_values.foreground = whitePieceColor;
\r
3531 gc_values.background = darkSquareColor;
\r
3532 wdPieceGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3534 gc_values.foreground = whitePieceColor;
\r
3535 gc_values.background = lightSquareColor;
\r
3536 wlPieceGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3538 gc_values.foreground = whitePieceColor;
\r
3539 gc_values.background = jailSquareColor;
\r
3540 wjPieceGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3542 gc_values.foreground = blackPieceColor;
\r
3543 gc_values.background = darkSquareColor;
\r
3544 bdPieceGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3546 gc_values.foreground = blackPieceColor;
\r
3547 gc_values.background = lightSquareColor;
\r
3548 blPieceGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3550 gc_values.foreground = blackPieceColor;
\r
3551 gc_values.background = jailSquareColor;
\r
3552 bjPieceGC = XtGetGC(shellWidget, value_mask, &gc_values);
\r
3556 void loadXIM(xim, xmask, filename, dest, mask)
\r
3563 int x, y, w, h, p;
\r
3569 fp = fopen(filename, "rb");
\r
3571 fprintf(stderr, _("%s: error loading XIM!\n"), programName);
\r
3578 for (y=0; y<h; ++y) {
\r
3579 for (x=0; x<h; ++x) {
\r
3584 XPutPixel(xim, x, y, blackPieceColor);
\r
3586 XPutPixel(xmask, x, y, WhitePixel(xDisplay,xScreen));
\r
3589 XPutPixel(xim, x, y, darkSquareColor);
\r
3591 XPutPixel(xmask, x, y, BlackPixel(xDisplay,xScreen));
\r
3594 XPutPixel(xim, x, y, whitePieceColor);
\r
3596 XPutPixel(xmask, x, y, WhitePixel(xDisplay,xScreen));
\r
3599 XPutPixel(xim, x, y, lightSquareColor);
\r
3601 XPutPixel(xmask, x, y, BlackPixel(xDisplay,xScreen));
\r
3607 /* create Pixmap of piece */
\r
3608 *dest = XCreatePixmap(xDisplay, DefaultRootWindow(xDisplay),
\r
3609 w, h, xim->depth);
\r
3610 XPutImage(xDisplay, *dest, lightSquareGC, xim,
\r
3611 0, 0, 0, 0, w, h);
\r
3613 /* create Pixmap of clipmask
\r
3614 Note: We assume the white/black pieces have the same
\r
3615 outline, so we make only 6 masks. This is okay
\r
3616 since the XPM clipmask routines do the same. */
\r
3618 temp = XCreatePixmap(xDisplay, DefaultRootWindow(xDisplay),
\r
3619 w, h, xim->depth);
\r
3620 XPutImage(xDisplay, temp, lightSquareGC, xmask,
\r
3621 0, 0, 0, 0, w, h);
\r
3623 /* now create the 1-bit version */
\r
3624 *mask = XCreatePixmap(xDisplay, DefaultRootWindow(xDisplay),
\r
3627 values.foreground = 1;
\r
3628 values.background = 0;
\r
3630 /* Don't use XtGetGC, not read only */
\r
3631 maskGC = XCreateGC(xDisplay, *mask,
\r
3632 GCForeground | GCBackground, &values);
\r
3633 XCopyPlane(xDisplay, temp, *mask, maskGC,
\r
3634 0, 0, squareSize, squareSize, 0, 0, 1);
\r
3635 XFreePixmap(xDisplay, temp);
\r
3639 void CreateXIMPieces()
\r
3642 char buf[MSG_SIZ];
\r
3644 static char *ximkind[] = { "ll", "ld", "dl", "dd" };
\r
3649 /* The XSynchronize calls were copied from CreatePieces.
\r
3650 Not sure if needed, but can't hurt */
\r
3651 XSynchronize(xDisplay, True); /* Work-around for xlib/xt
\r
3654 /* temp needed by loadXIM() */
\r
3655 ximtemp = XGetImage(xDisplay, DefaultRootWindow(xDisplay),
\r
3656 0, 0, ss, ss, AllPlanes, XYPixmap);
\r
3658 if (strlen(appData.pixmapDirectory) == 0) {
\r
3662 if (appData.monoMode) {
\r
3663 DisplayFatalError(_("XIM pieces cannot be used in monochrome mode"),
\r
3667 fprintf(stderr, _("\nLoading XIMs...\n"));
\r
3669 for (piece = (int) WhitePawn; piece <= (int) WhiteKing; piece++) {
\r
3670 fprintf(stderr, "%d", piece+1);
\r
3671 for (kind=0; kind<4; kind++) {
\r
3672 fprintf(stderr, ".");
\r
3673 sprintf(buf, "%s/%c%s%u.xim",
\r
3674 ExpandPathName(appData.pixmapDirectory),
\r
3675 ToLower(PieceToChar((ChessSquare)piece)),
\r
3676 ximkind[kind], ss);
\r
3677 ximPieceBitmap[kind][piece] =
\r
3678 XGetImage(xDisplay, DefaultRootWindow(xDisplay),
\r
3679 0, 0, ss, ss, AllPlanes, XYPixmap);
\r
3680 if (appData.debugMode)
\r
3681 fprintf(stderr, _("(File:%s:) "), buf);
\r
3682 loadXIM(ximPieceBitmap[kind][piece],
\r
3684 &(xpmPieceBitmap[kind][piece]),
\r
3685 &(ximMaskPm[piece%(int)BlackPawn]));
\r
3687 fprintf(stderr," ");
\r
3689 /* Load light and dark squares */
\r
3690 /* If the LSQ and DSQ pieces don't exist, we will
\r
3691 draw them with solid squares. */
\r
3692 sprintf(buf, "%s/lsq%u.xim", ExpandPathName(appData.pixmapDirectory), ss);
\r
3693 if (access(buf, 0) != 0) {
\r