void
InitBackEnd2()
{
- printf ("DEBUG: in init backend 2\n");
-
- if (appData.debugMode) {
- fprintf(debugFP, "%s\n", programVersion);
- }
-
- if (appData.matchGames > 0) {
- appData.matchMode = TRUE;
- } else if (appData.matchMode) {
- appData.matchGames = 1;
- }
- if(appData.matchMode && appData.sameColorGames > 0) /* [HGM] alternate: overrule matchGames */
- appData.matchGames = appData.sameColorGames;
- if(appData.rewindIndex > 1) { /* [HGM] autoinc: rewind implies auto-increment and overrules given index */
- if(appData.loadPositionIndex >= 0) appData.loadPositionIndex = -1;
- if(appData.loadGameIndex >= 0) appData.loadGameIndex = -1;
- }
- printf ("DEBUG: before reset\n");
- Reset(TRUE, FALSE);
- printf ("DEBUG: after reset\n");
- if (appData.noChessProgram || first.protocolVersion == 1) {
- printf ("DEBUG: first if\n");
- InitBackEnd3();
- } else {
- printf ("DEBUG: second if 0\n");
- /* kludge: allow timeout for initial "feature" commands */
- FreezeUI();
- printf ("DEBUG: second if 1\n");
- DisplayMessage("", _("Starting chess program"));
- printf ("DEBUG: second if 2\n");
- ScheduleDelayedEvent(InitBackEnd3, FEATURE_TIMEOUT);
- printf ("DEBUG: second if 3\n"); }
- printf ("DEBUG: end of init2\n");
+ if (appData.debugMode) {
+ fprintf(debugFP, "%s\n", programVersion);
+ }
+
+ if (appData.matchGames > 0) {
+ appData.matchMode = TRUE;
+ } else if (appData.matchMode) {
+ appData.matchGames = 1;
+ }
+ if(appData.matchMode && appData.sameColorGames > 0) /* [HGM] alternate: overrule matchGames */
+ appData.matchGames = appData.sameColorGames;
+ if(appData.rewindIndex > 1) { /* [HGM] autoinc: rewind implies auto-increment and overrules given index */
+ if(appData.loadPositionIndex >= 0) appData.loadPositionIndex = -1;
+ if(appData.loadGameIndex >= 0) appData.loadGameIndex = -1;
+ }
+ Reset(TRUE, FALSE);
+ if (appData.noChessProgram || first.protocolVersion == 1) {
+ InitBackEnd3();
+ } else {
+ /* kludge: allow timeout for initial "feature" commands */
+ FreezeUI();
+ DisplayMessage("", _("Starting chess program"));
+ ScheduleDelayedEvent(InitBackEnd3, FEATURE_TIMEOUT);
+ }
}
void
oldh = gameInfo.holdingsWidth,
oldv = gameInfo.variant;
- printf ("DEBUG: in init position\n");
-
currentMove = forwardMostMove = backwardMostMove = 0;
if(appData.icsActive) shuffleOpenings = FALSE; // [HGM] shuffle: in ICS mode, only shuffle on ICS request
shuffleOpenings = 1;
break;
}
- printf ("DEBUG: in init position 1\n");
overrule = 0;
if(appData.NrFiles >= 0) {
initialPosition[BOARD_HEIGHT-2][j] = BlackBishop;
}
- printf ("DEBUG: in init position 2\n");
-
-
if( nrCastlingRights == -1) {
/* [HGM] Build normal castling rights (must be done after board sizing!) */
/* This sets default castling rights from none to normal corners */
startedFromSetupPosition = TRUE;
}
- printf ("DEBUG: in init position 3\n");
-
-
CopyBoard(boards[0], initialPosition);
- printf ("DEBUG: in init position 3.1\n");
if(oldx != gameInfo.boardWidth ||
oldy != gameInfo.boardHeight ||
oldh != gameInfo.holdingsWidth
#endif
)
{
- printf ("DEBUG: in init position 3.2\n");
InitDrawingSizes(-2 ,0);
}
- printf ("DEBUG: init position 99\n");
if (redraw)
DrawPosition(TRUE, boards[currentMove]);
- printf ("DEBUG: end init position\n");
}
void
int redraw, init;
{
int i;
- printf ("DEBUG: in reset\n");
if (appData.debugMode) {
fprintf(debugFP, "Reset(%d, %d) from gameMode %d\n",
white_holding[0] = black_holding[0] = NULLCHAR;
ClearProgramStats();
opponentKibitzes = FALSE; // [HGM] kibitz: do not reserve space in engine-output window in zippy mode
-
- printf ("DEBUG: in reset 1\n");
-
ResetFrontEnd();
ClearHighlights();
gotPremove = FALSE;
alarmSounded = FALSE;
- printf ("DEBUG: in reset 2\n");
-
-
GameEnds((ChessMove) 0, NULL, GE_PLAYER);
- printf ("DEBUG: in reset2.1\n");
if(appData.serverMovesName != NULL) {
/* [HGM] prepare to make moves file for broadcasting */
clock_t t = clock();
serverMoves = fopen(appData.serverMovesName, "w");
}
- printf ("DEBUG: in reset 3\n");
-
ExitAnalyzeMode();
gameMode = BeginningOfGame;
ModeHighlight();
- printf ("DEBUG: in reset 3.0.1\n");
if(appData.icsActive) gameInfo.variant = VariantNormal;
InitPosition(redraw);
- printf ("DEBUG: in reset 3.0.1.1\n");
for (i = 0; i < MAX_MOVES; i++) {
if (commentList[i] != NULL) {
free(commentList[i]);
commentList[i] = NULL;
}
}
- printf ("DEBUG: in reset 3.1\n");
ResetClocks();
timeRemaining[0][0] = whiteTimeRemaining;
InitChessProgram(&first, startedFromSetupPosition);
}
- printf ("DEBUG: in reset 4\n");
-
-
GUI_DisplayTitle("");
- printf ("DEBUG: in reset 5\n");
DisplayMessage("", "");
- printf ("DEBUG: in reset 6\n");
HistorySet(parseList, backwardMostMove, forwardMostMove, currentMove-1);
- printf ("DEBUG: end reset \n");
}
void
{
// todo this toggling of the pause button doesn't seem to work?
// e.g. select pause from buttonbar doesn't activate menumode.pause
- // fprintf(stderr,"DEBUG: in pause\n");
- // fflush(stderr);
PauseEvent();
}
if (flipView && x >= 0) {
x = BOARD_WIDTH - 1 - x;
}
- printf("DEBUG::UserMoveProc: x %d y %d\n",x,y);
if (fromX == -1) {
if (event->type == ButtonPress) {
fromX = x;
fromY = y;
second = 0;
- printf("DEBUG::UserMoveProc: a\n");
DragPieceBegin(event->button.x, event->button.y);
if (appData.highlightDragging) {
SetHighlights(x, y, -1, -1);
/* Check if clicking again on the same color piece */
fromP = boards[currentMove][fromY][fromX];
toP = boards[currentMove][y][x];
- printf("DEBUG::UserMoveProc: b\n");
if ((WhitePawn <= fromP && fromP <= WhiteKing &&
WhitePawn <= toP && toP <= WhiteKing) ||
(BlackPawn <= fromP && fromP <= BlackKing &&
}
if (event->type == GDK_BUTTON_RELEASE && x == fromX && y == fromY) {
- printf("DEBUG::UserMoveProc: c\n");
DragPieceEnd(event->button.x, event->button.y);
if (appData.animateDragging) {
/* Undo animation damage if any */
toX = x;
toY = y;
saveAnimate = appData.animate;
- printf("DEBUG::UserMoveProc: d\n");
if (event->type == GDK_BUTTON_PRESS) {
- printf("DEBUG::UserMoveProc: e\n");
/* Finish clickclick move */
if (appData.animate || appData.highlightLastMove) {
SetHighlights(fromX, fromY, toX, toY);
/* Don't animate move and drag both */
appData.animate = FALSE;
}
- printf("DEBUG::UserMoveProc: f\n");
if (IsPromotion(fromX, fromY, toX, toY)) {
- printf("DEBUG::UserMoveProc: f1\n");
if (appData.alwaysPromoteToQueen) {
UserMoveEvent(fromX, fromY, toX, toY, 'q');
if (!appData.highlightLastMove || gotPremove) ClearHighlights();
PromotionPopUp();
}
} else {
- printf("DEBUG::UserMoveProc: f2\n");
UserMoveEvent(fromX, fromY, toX, toY, NULLCHAR);
- printf("DEBUG::UserMoveProc: f3\n");
if (!appData.highlightLastMove || gotPremove) ClearHighlights();
if (gotPremove) SetPremoveHighlights(fromX, fromY, toX, toY);
fromX = fromY = -1;
}
appData.animate = saveAnimate;
- printf("DEBUG::UserMoveProc: g\n");
if (appData.animate || appData.animateDragging) {
/* Undo animation damage if needed */
DrawPosition(FALSE, NULL);
GdkGeometry hints;
extern GtkWidget *GUI_Window;
- hints.min_aspect = hints.max_aspect = ratio;
+ hints.min_aspect = ratio;
+ hints.max_aspect = ratio;
gtk_window_set_geometry_hints (GTK_WINDOW (GUI_Window),
GTK_WIDGET (GUI_Window),
// don't unref the builder, since we use it to get references to widgets
// g_object_unref (G_OBJECT (builder));
- printf("DEBUG:finished building gtk\n");
/* end parse glade file */
if (argc > 1) {
tinyLayout = szd->tinyLayout;
}
- printf("DEBUG::main: squareSize %d\n",squareSize);
-
boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap);
boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap);
if (appData.showJail == 1) {
textColors[ColorNone].fg = textColors[ColorNone].bg = -1;
textColors[ColorNone].attr = 0;
- printf("DEBUG: I'm here 0\n");
-
// XtAppAddActions(appContext, boardActions, XtNumber(boardActions));
/*
XtSetArg(args[1], XtNtop, XtChainTop);
XtSetArg(args[2], XtNbottom, XtChainTop);
XtSetValues(blackTimerWidget, args, 3);
- printf("DEBUG: I'm here 1\n");
if (appData.titleInWindow) {
widgetList[j++] = titleWidget =
/* end gtk set properties of widgets */
- printf("DEBUG: made it.\n");
-
/*
* formWidget uses these constraints but they are stored
* in the children.
// XtSetValues(menuBarWidget, args, i);
// if (appData.titleInWindow) {
// if (smallLayout) {
-// printf("DEBUG: made it a.\n");
// i = 0;
// XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
// XtSetValues(whiteTimerWidget, args, i);
// XtSetValues(buttonBarWidget, args, i);
// }
// } else {
-// printf("DEBUG: made it b.\n");
// i = 0;
// XtSetArg(args[i], XtNfromVert, titleWidget); i++;
// XtSetValues(whiteTimerWidget, args, i);
// XtSetValues(buttonBarWidget, args, i);
// }
// }
-// } else { printf("DEBUG: made it c.\n");
+// } else {
//
// i = 0;
// XtSetArg(args[i], XtNfromVert, menuBarWidget); i++;
// XtSetValues(buttonBarWidget, args, i);
// }
// }
-// printf("DEBUG: made it 1.\n");
// i = 0;
// XtSetArg(args[0], XtNfromVert, messageWidget);
// XtSetArg(args[1], XtNtop, XtChainTop);
//
// XtRealizeWidget(shellWidget);
//
- printf("DEBUG: made it 2.\n");
/*
* Correct the width of the message and title widgets.
// XtSetValues(shellWidget, args, i);
//
- printf("DEBUG: creating svgs.\n");
-
/* load square colors */
SVGLightSquare = load_pixbuf("svg/LightSquare.svg",squareSize);
SVGDarkSquare = load_pixbuf("svg/DarkSquare.svg",squareSize);
/* realize window */
gtk_widget_show (GUI_Window);
- printf("DEBUG: before created stuff squareSize %d.\n",squareSize);
-
CreateGCs();
CreateGrid();
CreatePieces();
if (appData.animate || appData.animateDragging)
CreateAnimVars();
- printf("DEBUG: created stuff squareSize %d.\n",squareSize);
-
-
// XtAugmentTranslations(formWidget,
// XtParseTranslationTable(globalTranslations));
// XtAugmentTranslations(boardWidget,
//
InitBackEnd2();
- printf("DEBUG: back end initiated.\n");
-
if (errorExitStatus == -1) {
if (appData.icsActive) {
/* We now wait until we see "login:" from the ICS before
gdk_cursor_destroy(BoardCursor);
/* end cursor */
- printf("DEBUG: going into gtk-main.\n");
-
gtk_main ();
if (appData.debugMode) fclose(debugFP); // [DM] debug
int square_color, x, y;
Drawable dest;
{
- printf("DEBUG::colorDrawPiece: piece %d square_color %d x %d y %d \n",piece,square_color,x,y);
gdk_draw_pixbuf(GDK_WINDOW(GUI_Board->window),NULL,GDK_PIXBUF(SVGpieces[piece]),0,0,x,y,-1,-1, GDK_RGB_DITHER_NORMAL, 0, 0);
return ;
DrawFunc ChooseDrawFunc()
{
- printf("DEBUG::ChooseDrawFunc: appData.monoMode %d useImages %d\n",appData.monoMode,useImages);
if (appData.monoMode) {
if (DefaultDepth(xDisplay, xScreen) == 1) {
return monoDrawPiece_1bit;
/* Calculate delay in milliseconds (2-delays per complete flash) */
flash_delay = 500 / appData.flashRate;
- printf("DEBUG: linegap %d squareSize %d \n",lineGap,squareSize);
-
/* calculate x and y coordinates from row and column */
if (flipView) {
x = lineGap + ((BOARD_WIDTH-1)-column) *
square_color = SquareColor(row, column);
- printf("DEBUG::DrawSquare: row %d column %d piece %d do_flash %d square_color %d x %d y %d\n",row,column,piece,do_flash,square_color,x,y);
-
if ( // [HGM] holdings: blank out area between board and holdings
column == BOARD_LEFT-1 || column == BOARD_RGHT
|| (column == BOARD_LEFT-2 && row < BOARD_HEIGHT-gameInfo.holdingsSize)
Arg args[16];
int rrow, rcol;
- printf ("DEBUG::DrawPosition: start\n");
-
-
if (board == NULL) {
if (!lastBoardValid) return;
board = lastBoard;
* but this causes a very distracting flicker.
*/
- printf ("DEBUG::DrawPosition: in draw position 0.1\n");
- printf("DEBUG::DrawPosition: squareSize %d\n",squareSize);
-
-
if (!repaint && lastBoardValid && lastFlipView == flipView) {
-
- printf ("DEBUG::DrawPosition: in draw position 0.1a\n");
/* If too much changes (begin observing new game, etc.), don't
do flashing */
do_flash = too_many_diffs(board, lastBoard) ? 0 : 1;
DrawSquare(i, j, board[i][j], do_flash);
}
} else {
- printf("DEBUG::DrawPosition: in else linegap %d squareSize %d\n",lineGap,squareSize);
if (lineGap > 0)
{
/* todo move GC to setupgc */
squareSize=108;
for (i = 0; i < BOARD_HEIGHT; i++)
for (j = 0; j < BOARD_WIDTH; j++) {
- printf("DEBUG::DrawPosition: squareSize %d\n",squareSize);
DrawSquare(i, j, board[i][j], 0);
damage[i][j] = False;
}
{
GtkWidget *dialog;
- printf ("DEBUG: error %s %s\n\n",title,label);
-
dialog = gtk_message_dialog_new(GTK_WINDOW(GUI_Window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
// todo this toggling of the pause button doesn't seem to work?
// e.g. select pause from buttonbar doesn't activate menumode.pause
- // fprintf(stderr,"DEBUG: oldmode %d newmode %d oldpause %d newpause %d\n",oldmode,gameMode,oldPausing,pausing);
- //fflush(stderr);
-
// if (!boardWidget || !XtIsRealized(boardWidget)) return;
if (pausing != oldPausing) {
message = extMessage;
}
}
-
- printf("TODO: message %s\n",message);
gtk_label_set_text( GTK_LABEL(gtk_builder_get_object (builder, "Messages")),message);
}