*------------------------------------------------------------------------
** See the file ChangeLog for a revision history. */
+#define HIGHDRAG 1
+
#include "config.h"
#include <stdio.h>
// must be moved to xengineoutput.h
void EngineOutputProc P((Widget w, XEvent *event,
- String *prms, Cardinal *nprms));
+ String *prms, Cardinal *nprms));
+void EvalGraphProc P((Widget w, XEvent *event,
+ String *prms, Cardinal *nprms));
#ifdef __EMX__
String *prms, Cardinal *nprms));
void AnimateUserMove P((Widget w, XEvent * event,
String * params, Cardinal * nParams));
+void HandlePV P((Widget w, XEvent * event,
+ String * params, Cardinal * nParams));
void WhiteClock P((Widget w, XEvent *event,
String *prms, Cardinal *nprms));
void BlackClock P((Widget w, XEvent *event,
void SettingsPopDown P(());
void update_ics_width P(());
int get_term_width P(());
+int CopyMemoProc P(());
/*
* XBoard depends on Xt R4 or higher
*/
{N_("Training"), TrainingProc},
{"----", NothingProc},
{N_("Show Engine Output"), EngineOutputProc},
- {N_("Show Evaluation Graph"), NothingProc}, // [HGM] evalgr: not functional yet
+ {N_("Show Evaluation Graph"), EvalGraphProc},
{N_("Show Game List"), ShowGameListProc},
- {"Show Move History", HistoryShowProc}, // [HGM] hist: activate 4.2.7 code
+ {N_("Show Move History"), HistoryShowProc}, // [HGM] hist: activate 4.2.7 code
{"----", NothingProc},
{N_("Edit Tags"), EditTagsProc},
{N_("Edit Comment"), EditCommentProc},
{ "DrawPosition", DrawPositionProc },
{ "HandleUserMove", HandleUserMove },
{ "AnimateUserMove", AnimateUserMove },
+ { "HandlePV", HandlePV },
+ { "UnLoadPV", UnLoadPV },
{ "FileNameAction", FileNameAction },
{ "AskQuestionProc", AskQuestionProc },
{ "AskQuestionReplyAction", AskQuestionReplyAction },
{ "LoadNextGameProc", LoadNextGameProc },
{ "LoadPrevGameProc", LoadPrevGameProc },
{ "LoadSelectedProc", LoadSelectedProc },
+ { "SetFilterProc", SetFilterProc },
{ "ReloadGameProc", ReloadGameProc },
{ "LoadPositionProc", LoadPositionProc },
{ "LoadNextPositionProc", LoadNextPositionProc },
{ "EditPositionProc", EditPositionProc },
{ "TrainingProc", EditPositionProc },
{ "EngineOutputProc", EngineOutputProc}, // [HGM] Winboard_x engine-output window
+ { "EvalGraphProc", EvalGraphProc}, // [HGM] Winboard_x avaluation graph window
{ "ShowGameListProc", ShowGameListProc },
{ "ShowMoveListProc", HistoryShowProc},
{ "EditTagsProc", EditCommentProc },
{ "PromotionPopDown", (XtActionProc) PromotionPopDown },
{ "HistoryPopDown", (XtActionProc) HistoryPopDown },
{ "EngineOutputPopDown", (XtActionProc) EngineOutputPopDown },
+ { "EvalGraphPopDown", (XtActionProc) EvalGraphPopDown },
{ "ShufflePopDown", (XtActionProc) ShufflePopDown },
{ "EnginePopDown", (XtActionProc) EnginePopDown },
{ "UciPopDown", (XtActionProc) UciPopDown },
{ "TimeControlPopDown", (XtActionProc) TimeControlPopDown },
{ "NewVariantPopDown", (XtActionProc) NewVariantPopDown },
{ "SettingsPopDown", (XtActionProc) SettingsPopDown },
+ { "CopyMemoProc", (XtActionProc) CopyMemoProc },
};
char globalTranslations[] =
"<Btn1Down>: HandleUserMove() \n \
<Btn1Up>: HandleUserMove() \n \
<Btn1Motion>: AnimateUserMove() \n \
+ <Btn3Motion>: HandlePV() \n \
+ <Btn3Up>: UnLoadPV() \n \
Shift<Btn2Down>: XawPositionSimpleMenu(menuB) XawPositionSimpleMenu(menuD)\
PieceMenuPopup(menuB) \n \
Any<Btn2Down>: XawPositionSimpleMenu(menuW) XawPositionSimpleMenu(menuD) \
#define JAWS_ARGS
#define CW_USEDEFAULT (1<<31)
#define ICS_TEXT_MENU_SIZE 90
+#define DEBUG_FILE "xboard.debug"
#define SetCurrentDirectory chdir
#define GetCurrentDirectory(SIZE, NAME) getcwd(NAME, SIZE)
#define OPTCHAR "-"
#define SEPCHAR " "
// these two must some day move to frontend.h, when they are implemented
-Boolean EvalGraphIsUp();
-Boolean MoveHistoryIsUp();
Boolean GameListIsUp();
// The option definition and parsing code common to XBoard and WinBoard is collected in this file
// front-end part of option handling
// [HGM] This platform-dependent table provides the location for storing the color info
+extern char *crWhite, * crBlack;
+
void *
colorVariable[] = {
&appData.whitePieceColor,
&appData.darkSquareColor,
&appData.highlightSquareColor,
&appData.premoveHighlightColor,
+ &appData.lowTimeWarningColor,
NULL,
NULL,
NULL,
NULL,
NULL,
- NULL,
- NULL,
- NULL,
+ &crWhite,
+ &crBlack,
NULL
};
default:
return;
}
- fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName, name);
+// Do not save fonts for now, as the saved font would be board-size specific
+// and not suitable for a re-start at another board size
+// fprintf(f, OPTCHAR "%s" SEPCHAR "%s\n", ad->argName, name);
}
void
GetActualPlacement(shellWidget, &wpMain);
if(EngineOutputIsUp()) GetActualPlacement(engineOutputShell, &wpEngineOutput); else
if(MoveHistoryIsUp()) GetActualPlacement(historyShell, &wpMoveHistory);
+ if(EvalGraphIsUp()) GetActualPlacement(evalGraphShell, &wpEvalGraph);
if(GameListIsUp()) GetActualPlacement(gameListShell, &wpGameList);
if(commentShell) GetActualPlacement(commentShell, &wpComment);
else GetActualPlacement(editShell, &wpComment);
if(tagsShell) GetActualPlacement(tagsShell, &wpTags);
else GetActualPlacement(editTagsShell, &wpTags);
-#if 0
- GetActualPlacement(hwndConsole, &wpConsole);
- GetActualPlacement(evalGraphDialog, &wpEvalGraph);
-#endif
}
void
return;
}
-Boolean
-EvalGraphIsUp()
-{
- return False;
-}
-
int
MainWindowUp()
{ // [HGM] args: allows testing if main window is realized from back-end
char *p;
XrmDatabase xdb;
int forceMono = False;
-//define INDIRECTION
-#ifdef INDIRECTION
- // [HGM] before anything else, expand any indirection files amongst options
- char *argvCopy[1000]; // 1000 seems enough
- char newArgs[10000]; // holds actual characters
- int k = 0;
srandom(time(0)); // [HGM] book: make random truly random
- j = 0;
- for(i=0; i<argc; i++) {
- if(j >= 1000-2) { printf(_("too many arguments\n")); exit(-1); }
-//fprintf(stderr, "arg %s\n", argv[i]);
- if(argv[i][0] != '@') argvCopy[j++] = argv[i]; else {
- char c;
- FILE *f = fopen(argv[i]+1, "rb");
- if(f == NULL) { fprintf(stderr, _("ignore %s\n"), argv[i]); continue; } // do not expand non-existing
- argvCopy[j++] = newArgs + k; // get ready for first argument from file
- while((c = fgetc(f)) != EOF) { // each line of file inserts 1 argument in the list
- if(c == '\n') {
- if(j >= 1000-2) { printf(_("too many arguments\n")); exit(-1); }
- newArgs[k++] = 0; // terminate current arg
- if(k >= 10000-1) { printf(_("too long arguments\n")); exit(-1); }
- argvCopy[j++] = newArgs + k; // get ready for next
- } else {
- if(k >= 10000-1) { printf(_("too long arguments\n")); exit(-1); }
- newArgs[k++] = c;
- }
- }
- newArgs[k] = 0;
- j--;
- fclose(f);
- }
- }
- argvCopy[j] = NULL;
- argv = argvCopy;
- argc = j;
-#endif
-
setbuf(stdout, NULL);
setbuf(stderr, NULL);
debugFP = stderr;
+ if(argc > 1 && (!strcmp(argv[1], "-v" ) || !strcmp(argv[1], "--version" ))) {
+ printf("%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION);
+ exit(0);
+ }
+
programName = strrchr(argv[0], '/');
if (programName == NULL)
programName = argv[0];
HistoryPopUp();
}
-// if( wpEvalGraph.visible ) {
-// EvalGraphPopUp();
-// }
-
+ if( wpEvalGraph.visible )
+ {
+ EvalGraphPopUp();
+ };
+
if( wpEngineOutput.visible ) {
EngineOutputPopUp();
}
Cardinal *num_params;
{
String whichMenu;
+
+ if (event->type == ButtonRelease) UnLoadPV(); // [HGM] pv
if (event->type != ButtonPress) return;
if (errorUp) ErrorPopDown();
switch (gameMode) {
case IcsExamining:
whichMenu = params[0];
break;
+ case IcsObserving:
+ if(!appData.icsEngineAnalyze) return;
case IcsPlayingWhite:
case IcsPlayingBlack:
- case EditGame:
+ if(!appData.zippyPlay) goto noZip;
+ case AnalyzeMode:
+ case AnalyzeFile:
case MachinePlaysWhite:
case MachinePlaysBlack:
- if (appData.testLegality &&
+ case TwoMachinesPlay: // [HGM] pv: use for showing PV
+ if (!appData.dropMenu) {
+ LoadPV(event->xbutton.x, event->xbutton.y);
+ return;
+ }
+ if(gameMode == TwoMachinesPlay || gameMode == AnalyzeMode ||
+ gameMode == AnalyzeFile || gameMode == IcsObserving) return;
+ case EditGame:
+ noZip:
+ if (!appData.dropMenu || appData.testLegality &&
gameInfo.variant != VariantBughouse &&
gameInfo.variant != VariantCrazyhouse) return;
SetupDropMenu();
x + 2, y + font_ascent + 1, string, 1);
}
}
+ if(marker[row][column]) {
+ XFillArc(xDisplay, xBoardWindow, marker[row][column] == 2 ? prelineGC : highlineGC,
+ x + squareSize/4, y+squareSize/4, squareSize/2, squareSize/2, 0, 64*360);
+ }
}
DragPieceMove(event->xmotion.x, event->xmotion.y);
}
+void HandlePV (Widget w, XEvent * event,
+ String * params, Cardinal * nParams)
+{ // [HGM] pv: walk PV
+ MovePV(event->xmotion.x, event->xmotion.y, lineGap + BOARD_HEIGHT * (squareSize + lineGap));
+}
+
Widget CommentCreate(name, text, mutable, callback, lines)
char *name, *text;
int /*Boolean*/ mutable;
}
/* this variable is shared between CopyPositionProc and SendPositionSelection */
-static char *selected_fen_position=NULL;
+char *selected_fen_position=NULL;
-static Boolean
+Boolean
SendPositionSelection(Widget w, Atom *selection, Atom *target,
Atom *type_return, XtPointer *value_return,
unsigned long *length_return, int *format_return)
* have a notion of a position that is selected but not copied.
* See http://www.freedesktop.org/wiki/Specifications/ClipboardsWiki
*/
+ if(gameMode == EditPosition) EditPositionDone(TRUE);
if (selected_fen_position) free(selected_fen_position);
selected_fen_position = (char *)PositionToFEN(currentMove, NULL);
if (!selected_fen_position) return;
strcpy(buf, cmdLine);
p = buf;
for (;;) {
+ while(*p == ' ') p++;
argv[i++] = p;
- p = strchr(p, ' ');
+ if(*p == '"' || *p == '\'')
+ p = strchr(++argv[i-1], *p);
+ else p = strchr(p, ' ');
if (p == NULL) break;
*p++ = NULLCHAR;
}
corner.x = x - player.mouseDelta.x;
corner.y = y - player.mouseDelta.y;
AnimationFrame(&player, &corner, player.dragPiece);
-#if HIGHDRAG
+#if HIGHDRAG*0
if (appData.highlightDragging) {
int boardX, boardY;
BoardSquare(x, y, &boardX, &boardY);