xedittags.c xedittags.h \
engineoutput.c engineoutput.h \
xengineoutput.c \
- evalgraph.c evalgraph.h xevalgraph.c \
+ evalgraph.c evalgraph.h xevalgraph.c xevalgraph.h\
xgamelist.c xgamelist.h\
xhistory.c xhistory.h \
xoptions.c \
while(*p==' ') p++;
if( gameInfo.holdingsWidth && p[-1] == '/' || *p == '[') {
if(*p == '[') p++;
- if(*p == '-' ) *p++; /* empty holdings */ else {
+ if(*p == '-' ) p++; /* empty holdings */ else {
if( !gameInfo.holdingsWidth ) return FALSE; /* no room to put holdings! */
/* if we would allow FEN reading to set board size, we would */
/* have to add holdings and shift the board read so far here */
while( (piece = CharToPiece(*p) ) != EmptySquare ) {
- *p++;
+ p++;
if((int) piece >= (int) BlackPawn ) {
i = (int)piece - (int)BlackPawn;
i = PieceToNumber((ChessSquare)i);
}
}
}
- if(*p == ']') *p++;
+ if(*p == ']') p++;
}
while(*p == ' ') p++;
char c = *p++ - AAA;
if(c < BOARD_LEFT || c >= BOARD_RGHT) return TRUE;
- if(*p >= '0' && *p <='9') *p++;
+ if(*p >= '0' && *p <='9') p++;
board[EP_STATUS] = c;
}
}
if(annotate) {
int cnt = 10;
if(!WhiteOnMove(currentMove))
- snprintf(buf, sizeof(buf)/sizeof(buf[0]),"(%d...", currentMove+2>>1);
+ snprintf(buf, sizeof(buf)/sizeof(buf[0]),"(%d...", (currentMove+2)>>1);
else safeStrCpy(buf, "(", sizeof(buf)/sizeof(buf[0]));
for(i=currentMove; i<forwardMostMove; i++) {
if(WhiteOnMove(i))
- snprintf(moveBuf, sizeof(moveBuf)/sizeof(moveBuf[0]), " %d. %s", i+2>>1, SavePart(parseList[i]));
+ snprintf(moveBuf, sizeof(moveBuf)/sizeof(moveBuf[0]), " %d. %s", (i+2)>>1, SavePart(parseList[i]));
else snprintf(moveBuf, sizeof(moveBuf)/sizeof(moveBuf[0])," %s", SavePart(parseList[i]));
strcat(buf, moveBuf);
if(commentList[i]) { strcat(buf, " "); strcat(buf, commentList[i]); }
void EvalGraphPopDown P((void));
Boolean EvalGraphIsUp P((void));
int EvalGraphDialogExists P((void));
+
+/* these are in xhistory.c */
Boolean MoveHistoryIsUp P((void));
+void HistoryPopUp P((void));
#endif
#include "frontend.h"
#include "backend.h"
+#include "backendz.h"
#include "moves.h"
#include "xboard.h"
#include "childio.h"
void
SaveFontArg(FILE *f, ArgDescriptor *ad)
{
- char *name, buf[MSG_SIZ];
+ char *name;
int i, n = (int)ad->argLoc;
switch(n) {
case 0: // CLOCK_FONT
FileProc proc;
char *openMode;
{
- Arg args[16];
- Widget popup, layout, dialog, edit;
- Window root, child;
- int x, y, i;
- int win_x, win_y;
- unsigned int mask;
-
fileProc = proc; /* I can't see a way not */
fileOpenMode = openMode; /* to use globals here */
{ // [HGM] use file-selector dialog stolen from Ghostview
int index; // this is not supported yet
FILE *f;
if(f = XsraSelFile(shellWidget, label, NULL, NULL, "could not open: ",
- def, openMode, NULL, &name))
- (void) (*fileProc)(f, index=0, name);
+ def, openMode, NULL, &name))
+ (void) (*fileProc)(f, index=0, name);
}
}
return default_width;
}
-void update_ics_width()
+void
+update_ics_width()
{
- static int old_width = 0;
- int new_width = get_term_width();
+ static int old_width = 0;
+ int new_width = get_term_width();
- if (old_width != new_width)
- ics_printf("set width %d\n", new_width);
- old_width = new_width;
+ if (old_width != new_width)
+ ics_printf("set width %d\n", new_width);
+ old_width = new_width;
}
void NotifyFrontendLogin()
&(icons[iconNr]),
NULL, NULL /*&attr*/)) != 0) {
fprintf(stderr, _("Error %d loading icon image\n"), r);
- exit(1);
- }
+ exit(1);
+ }
}
static void InitializeEngineOutput()
-{ int i;
-
+{
ReadIcon(WHITE_14, nColorWhite);
ReadIcon(BLACK_14, nColorBlack);
ReadIcon(UNKNOWN_14, nColorUnknown);
}
void DoSetWindowText(int which, int field, char *s_label)
-{
+{
Arg arg;
XtSetArg(arg, XtNlabel, (XtArgVal) s_label);
void InsertIntoMemo( int which, char * text, int where )
{
- Arg arg; XawTextBlock t; Widget edit;
+ XawTextBlock t;
+ Widget edit;
- /* the backend adds \r\n, which is needed for winboard,
+ /* the backend adds \r\n, which is needed for winboard,
* for xboard we delete them again over here */
if(t.ptr = strchr(text, '\r')) *t.ptr = ' ';
}
void DoClearMemo(int which)
-{
- Arg args[16];
- int j;
+{
Widget edit;
- edit = XtNameToWidget(engineOutputShell, which ? "*form2.text" : "*form.text");
- XtCallActionProc(edit, "select-all", NULL, NULL, 0);
- XtCallActionProc(edit, "kill-selection", NULL, NULL, 0);
+ edit = XtNameToWidget(engineOutputShell, which ? "*form2.text" : "*form.text");
+ XtCallActionProc(edit, "select-all", NULL, NULL, 0);
+ XtCallActionProc(edit, "kill-selection", NULL, NULL, 0);
}
// cloned from CopyPositionProc. Abuse selected_fen_position to hold selection
SelectPV (Widget w, XEvent * event, String * params, Cardinal * nParams)
{ // [HGM] pv: translate click to PV line, and load it for display
String val;
- int start, end, memo, j;
+ int start, end;
XawTextPosition index, dummy;
int x, y;
Arg arg;
{
if(appData.pasteSelection) return;
if (selected_fen_position) free(selected_fen_position);
- XtGetSelectionValue(menuBarWidget,
+ XtGetSelectionValue(menuBarWidget,
XA_PRIMARY, XA_STRING,
/* (XtSelectionCallbackProc) */ MemoCB,
NULL, /* client_data passed to PastePositionCB */
char *name, *text;
{
Arg args[16];
- Widget shell, layout, form, form2, edit;
+ Widget shell, layout, form, form2;
Dimension bw_width, bw_height;
int j;
j = 0;
XtSetArg(args[j], XtNresizable, True); j++;
shell =
-#if TOPLEVEL
+#if TOPLEVEL
XtCreatePopupShell(name, topLevelShellWidgetClass,
#else
XtCreatePopupShell(name, transientShellWidgetClass,
if (engineOutputX == -1) {
int xx, yy;
Window junk;
- Dimension pw_height;
- Dimension ew_height;
+
engineOutputH = bw_height/2;
engineOutputW = bw_width-16;
XtSetArg(args[j], XtNx, engineOutputX); j++;
XtSetArg(args[j], XtNy, engineOutputY); j++;
XtSetValues(shell, args, j);
-// XtSetKeyboardFocus(shell, edit);
return shell;
}
}
}
-void
+void
EngineOutputPopUp()
{
Arg args[16];
#include <X11/xpm.h>
-// [HGM] pixmaps of some ICONS used in the engine-outut window
-#include "pixmaps/WHITE_14.xpm"
-#include "pixmaps/BLACK_14.xpm"
-#include "pixmaps/CLEAR_14.xpm"
-#include "pixmaps/UNKNOWN_14.xpm"
-#include "pixmaps/THINKING_14.xpm"
-#include "pixmaps/PONDER_14.xpm"
-#include "pixmaps/ANALYZING_14.xpm"
-
#ifdef SNAP
#include "wsnap.h"
#endif
static HBITMAP hbmPB = NULL;
#endif
-// [HGM] front-end, added as wrapper to avoid use of LineTo and MoveToEx in other routines (so they can be back-end)
+// [HGM] front-end, added as wrapper to avoid use of LineTo and MoveToEx in other routines (so they can be back-end)
void DrawSegment( int x, int y, int *lastX, int *lastY, int penType )
{
-static curX, curY;
- if(penType != PEN_NONE)
- XDrawLine(yDisplay, eGraphWindow, pens[penType], curX, curY, x, y);
- if(lastX != NULL) { *lastX = curX; *lastY = curY; }
- curX = x; curY = y;
+ static int curX, curY;
+
+ if(penType != PEN_NONE)
+ XDrawLine(yDisplay, eGraphWindow, pens[penType], curX, curY, x, y);
+ if(lastX != NULL) { *lastX = curX; *lastY = curY; }
+ curX = x; curY = y;
}
// front-end wrapper for drawing functions to do rectangles
}
static void InitializeEvalGraph()
-{ int i; XtGCMask value_mask = GCLineWidth | GCLineStyle | GCForeground
- | GCBackground | GCFunction | GCPlaneMask;
- XGCValues gc_values;
-// GC copyInvertedGC;
-
- pens[PEN_BLACK] = CreateGC(1, "black", "black", LineSolid);
- pens[PEN_DOTTED] = CreateGC(1, "#A0A0A0", "#A0A0A0", LineOnOffDash);
- pens[PEN_BLUEDOTTED] = CreateGC(1, "#0000FF", "#0000FF", LineOnOffDash);
- pens[PEN_BOLD] = CreateGC(3, crWhite, crWhite, LineSolid);
- pens[PEN_BOLD+1] = CreateGC(3, crBlack, crBlack, LineSolid);
- hbrHist[0] = CreateGC(3, crWhite, crWhite, LineSolid);
- hbrHist[1] = CreateGC(3, crBlack, crBlack, LineSolid);
- hbrHist[2] = CreateGC(3, "#E0E0F0", "#E0E0F0", LineSolid);; // background (a bit blueish, for contrst with yellow curve)
+{
+ pens[PEN_BLACK] = CreateGC(1, "black", "black", LineSolid);
+ pens[PEN_DOTTED] = CreateGC(1, "#A0A0A0", "#A0A0A0", LineOnOffDash);
+ pens[PEN_BLUEDOTTED] = CreateGC(1, "#0000FF", "#0000FF", LineOnOffDash);
+ pens[PEN_BOLD] = CreateGC(3, crWhite, crWhite, LineSolid);
+ pens[PEN_BOLD+1] = CreateGC(3, crBlack, crBlack, LineSolid);
+ hbrHist[0] = CreateGC(3, crWhite, crWhite, LineSolid);
+ hbrHist[1] = CreateGC(3, crBlack, crBlack, LineSolid);
+ hbrHist[2] = CreateGC(3, "#E0E0F0", "#E0E0F0", LineSolid);; // background (a bit blueish, for contrst with yellow curve)
}
void EvalClick(widget, unused, event)
char *name;
{
Arg args[16];
- Widget shell, layout, form, form2, edit;
+ Widget shell, layout, form;
Dimension bw_width, bw_height;
int j;
j = 0;
XtSetArg(args[j], XtNresizable, True); j++;
shell =
-#if TOPLEVEL
+#if TOPLEVEL
XtCreatePopupShell(name, topLevelShellWidgetClass,
#else
XtCreatePopupShell(name, transientShellWidgetClass,
if (evalGraphX == -1) {
int xx, yy;
Window junk;
- Dimension pw_height;
- Dimension ew_height;
evalGraphH = bw_height/4;
evalGraphW = bw_width-16;
XtSetArg(args[j], XtNx, evalGraphX); j++;
XtSetArg(args[j], XtNy, evalGraphY); j++;
XtSetValues(shell, args, j);
-// XtSetKeyboardFocus(shell, edit);
yDisplay = XtDisplay(shell);
eGraphWindow = XtWindow(form);
return shell;
}
-void
+void
EvalGraphPopUp()
{
Arg args[16];
int j;
- Widget edit;
static int needInit = TRUE;
static char *title = _("Evaluation graph");
--- /dev/null
+/*
+ * xevalgraph.h
+ *
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * ------------------------------------------------------------------------
+ *
+ * GNU XBoard is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * GNU XBoard is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/. *
+ *
+ *------------------------------------------------------------------------
+ ** See the file ChangeLog for a revision history. */
+
+#ifndef _XEVALGRAPH_H
+#define _XEVALGRAPH_H 1
+
+void EvalGraphSet P(( int first, int last, int current, ChessProgramStats_Move * pvInfo ));
+
+#endif
XtSetArg(args[j], XtNdefaultColumns, 1); j++;
XtSetArg(args[j], XtNforceColumns, True); j++;
XtSetArg(args[j], XtNverticalList, True); j++;
- listwidg =
+ listwidg =
XtCreateManagedWidget("list", listWidgetClass, viewport, args, j);
XawListHighlight(listwidg, 0);
XtAugmentTranslations(listwidg,
static void
GameListReplace()
-{ // [HGM] filter: put in separate routine, to make callable from call-back
- Arg args[16];
- int j;
- Widget listwidg;
+{
+ // filter: put in separate routine, to make callable from call-back
+ Widget listwidg;
- listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
- XawListChange(listwidg, glc->strings, 0, 0, True);
- XawListHighlight(listwidg, 0);
+ listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
+ XawListChange(listwidg, glc->strings, 0, 0, True);
+ XawListHighlight(listwidg, 0);
}
void
char *filename;
{
Arg args[16];
- int j, nstrings;
- Widget listwidg;
- ListGame *lg;
+ int j;
char **st;
if (glc == NULL) {
if (glc->shell == NULL) {
- glc->shell = GameListCreate(filename, GameListCallback, glc);
+ glc->shell = GameListCreate(filename, GameListCallback, glc);
} else {
GameListReplace(); // [HGM] filter: code put in separate routine
j = 0;
index = rs->list_index;
if (index < 0) return;
if(direction != 0) {
- index += direction;
+ index += direction;
if(direction == -2) index = 0;
if(direction == 2) index = listLength-1;
if(index < 0 || index >= listLength) return;
void
GameListOptionsPopDown()
{
- Arg args[16];
- int j;
+ if (gameListOptShell == NULL) return;
- if (gameListOptShell == NULL) return;
- XtPopdown(gameListOptShell);
- XtDestroyWidget(gameListOptShell);
- gameListOptShell = 0;
- XtSetKeyboardFocus(shellWidget, formWidget);
+ XtPopdown(gameListOptShell);
+ XtDestroyWidget(gameListOptShell);
+ gameListOptShell = 0;
+ XtSetKeyboardFocus(shellWidget, formWidget);
}
void
void
GameListOptionsPopUp(Widget w, XEvent *event, String *prms, Cardinal *nprms)
{
- Arg args[16];
- int j, nstrings;
- Widget listwidg;
-
- if (gameListOptShell == NULL) {
- gameListOptShell = GameListOptionsCreate();
- }
+ if (gameListOptShell == NULL)
+ gameListOptShell = GameListOptionsCreate();
- XtPopup(gameListOptShell, XtGrabNone);
+ XtPopup(gameListOptShell, XtGrabNone);
}
#include "xboard.h"
#include "xhistory.h"
#include "gettext.h"
+#include "xevalgraph.h"
#ifdef ENABLE_NLS
# define _(s) gettext (s)
XtPointer client_data, call_data;
{
String name, txt;
- Widget w2;
Arg args[16];
char buf[MSG_SIZ];
int j;
return;
}
if (strcmp(name, _(" OK ")) == 0) {
- int inc, mps, tc, ok;
+ int inc, mps, ok;
XtSetArg(args[0], XtNstring, &txt);
XtGetValues(tcData, args, 1);
switch(tcInc) {
void TimeControlPopUp()
{
Arg args[16];
- Widget popup, layout, form, edit, b_ok, b_cancel, b_clas, b_inc, mess;
+ Widget popup, layout, form, b_ok, b_cancel, b_clas, b_inc, mess;
Window root, child;
int x, y, i, j;
int win_x, win_y;
XtPointer client_data, call_data;
{
String name;
- Widget s2;
Arg args[16];
- char buf[80];
int j;
XtSetArg(args[0], XtNlabel, &name);
void EnginePopUp()
{
Arg args[16];
- Widget popup, layout, form, edit, b_ok, b_cancel, b_clas, b_inc, s1;
+ Widget popup, layout, form, b_ok, b_cancel, s1;
Window root, child;
int x, y, i, j, width;
int win_x, win_y;
XtPointer client_data, call_data;
{
String name;
- Widget w2;
Arg args[16];
- char buf[MSG_SIZ];
VariantClass v;
XtSetArg(args[0], XtNlabel, &name);
void NewVariantPopUp()
{
Arg args[16];
- Widget popup, layout, dialog, edit, form, last = NULL, b_ok, b_cancel;
+ Widget popup, layout, form, last = NULL, b_ok, b_cancel;
Window root, child;
int x, y, i, j;
int win_x, win_y;
unsigned int mask;
- char def[80];
XrmValue vFrom, vTo;
i = 0;
{
String name;
Arg args[16];
- char buf[80];
int oldCores = appData.smpCores, ponder = 0;
XtSetArg(args[0], XtNlabel, &name);
XtGetValues(w, args, 1);
if (strcmp(name, _("OK")) == 0) {
- int nr, i, j; String name;
+ int i, j; String name;
for(i=0; i<6; i++) {
XtSetArg(args[0], XtNstring, &name);
XtGetValues(controlDesc[i].handle, args, 1);
void UciPopUp()
{
Arg args[16];
- Widget popup, layout, dialog, edit, form, b_ok, b_cancel, last = NULL, new, upperLeft;
+ Widget popup, layout, form, b_ok, b_cancel, last = NULL, new, upperLeft;
Window root, child;
int x, y, i, j;
int win_x, win_y;
XtPointer client_data, call_data;
{
String name, val;
- Widget w2;
Arg args[16];
char buf[MSG_SIZ];
- int i, j;
+ int j;
int data = (intptr_t) client_data;
XtSetArg(args[0], XtNlabel, &name);
XtPointer client_data, call_data;
{
String name, val;
- Widget w2;
Arg args[16];
char buf[MSG_SIZ];
int i, j;
return;
}
if (strcmp(name, _("OK")) == 0 || data) { // save buttons imply OK
- int nr;
-
for(i=0; i<currentCps->nrOptions; i++) { // send all options that had to be OK-ed to engine
switch(currentCps->option[i].type) {
case TextBox:
SendToProgram(buf, currentCps);
}
break;
+ default:
+ if( appData.debugMode )
+ fprintf(debugFP, "SettingsPopUp: unexpected case in switch.\n");
+ break;
}
}
if(data) { // send save-button command to engine
}
}
-void SettingsPopUp(ChessProgramState *cps)
+void
+SettingsPopUp(ChessProgramState *cps)
{
Arg args[16];
- Widget popup, layout, dialog, edit=NULL, form, oldform, last, b_ok, b_cancel, leftMargin = NULL, textField = NULL;
+ Widget popup, layout, dialog, edit=NULL, form, last, b_ok, b_cancel, leftMargin = NULL, textField = NULL;
Window root, child;
int x, y, i, j, height, width, h, c;
int win_x, win_y, maxWidth, maxTextWidth;
unsigned int mask;
- char def[MSG_SIZ], *p, *q;
+ char def[MSG_SIZ];
static char pane[6] = "paneX";
Widget texts[100], forelast = NULL, anchor, widest;
CreateComboPopup(last, cps->option[i].name, i, (char **) cps->option[i].textValue);
values[i] = cps->option[i].value;
break;
+ default:
+ if( appData.debugMode )
+ fprintf(debugFP, "SettingsPopUp: unexpected case in switch.\n");
+ break;
}
}