<property name="visible">True</property>
<property name="label" translatable="yes">Reset Game</property>
<property name="use_underline">True</property>
+ <signal name="activate" handler="ResetProc"/>
</object>
</child>
<child>
<property name="visible">True</property>
<property name="image">image1</property>
<property name="use_stock">False</property>
+ <signal name="activate" handler="LoadGameProc"/>
</object>
</child>
<child>
<property name="visible">True</property>
<property name="label" translatable="yes">Load Next Game</property>
<property name="use_underline">True</property>
+ <signal name="activate" handler="LoadNextGameProc"/>
</object>
</child>
<child>
<property name="visible">True</property>
<property name="label" translatable="yes">Reload Same Game</property>
<property name="use_underline">True</property>
+ <signal name="activate" handler="ReloadGameProc"/>
</object>
</child>
<child>
<property name="visible">True</property>
<property name="label" translatable="yes">_Action</property>
<property name="use_underline">True</property>
+ <child type="submenu">
+ <object class="GtkMenu" id="menu1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkMenuItem" id="menuAction.Accept">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Accept</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuAction.Call Flag">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Call Flag</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuActioin.Decline">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Decline</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="menuActionsep1">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuAction.Rematch">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Rematch</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuAction.Draw">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Draw</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuAction.Adjourn">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Adjourn</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuAction.Resign">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Resign</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuAction.Abort">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Abort</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="menuActionsep2">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuAction.Stop Observing">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Stop Observing</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuAction.Stop Examine">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Stop Examine</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
<child>
<property name="visible">True</property>
<property name="label" translatable="yes">Show Coords</property>
<property name="use_underline">True</property>
+ <signal name="toggled" handler="ShowCoordsProc"/>
</object>
</child>
<child>
<object class="GtkMenu" id="menu3">
<property name="visible">True</property>
<child>
- <object class="GtkImageMenuItem" id="imagemenuitem10">
+ <object class="GtkMenuItem" id="menuHelp.Hint">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Hint</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="menuHelp.Book">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Book</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparatorMenuItem" id="menuHelpsep1">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImageMenuItem" id="menuHelp.about">
<property name="label">gtk-about</property>
<property name="visible">True</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
+ <signal name="activate" handler="AboutProc"/>
</object>
</child>
</object>
<child>
<object class="GtkDrawingArea" id="Board">
<property name="visible">True</property>
+ <property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<signal name="button_press_event" handler="UserMoveProc"/>
<signal name="expose_event" handler="EventProc"/>
<signal name="button_release_event" handler="UserMoveProc"/>
Pixmap xpmPieceBitmap[4][(int)BlackPawn]; /* LL, LD, DL, DD actually used*/
Pixmap xpmPieceBitmap2[4][(int)BlackPawn+4]; /* LL, LD, DL, DD set to select from */
Pixmap xpmLightSquare, xpmDarkSquare, xpmJailSquare;
-int useImages, useImageSqs;
+int useImages=0, useImageSqs;
XImage *ximPieceBitmap[4][(int)BlackPawn+4]; /* LL, LD, DL, DD */
Pixmap ximMaskPm[(int)BlackPawn]; /* clipmasks, used for XIM pieces */
Pixmap ximMaskPm2[(int)BlackPawn+4]; /* clipmasks, used for XIM pieces */
XtGeometryResult gres;
int i;
- if(!formWidget) return;
+ // if(!formWidget) return;
/*
* Enable shell resizing.
// programName, gres, w, h, wr, hr);
// }
}
+ if(!formWidget) return;
// XawFormDoLayout(formWidget, True);
gameInfo.boardHeight = appData.NrRanks > 0 ? appData.NrRanks : 8;
gameInfo.holdingsWidth = appData.holdingsSize > 0 ? 2 : 0;
#endif
-
-
+
+
#ifdef IDSIZE
InitDrawingSizes(-1, 0); // [HGM] initsize: make this into a subroutine
#else
if (isdigit(appData.boardSize[0])) {
- i = sscanf(appData.boardSize, "%d,%d,%d,%d,%d,%d,%d", &squareSize,
- &lineGap, &clockFontPxlSize, &coordFontPxlSize,
- &fontPxlSize, &smallLayout, &tinyLayout);
- if (i == 0) {
- fprintf(stderr, _("%s: bad boardSize syntax %s\n"),
- programName, appData.boardSize);
- exit(2);
- }
- if (i < 7) {
- /* Find some defaults; use the nearest known size */
- SizeDefaults *szd, *nearest;
- int distance = 99999;
- nearest = szd = sizeDefaults;
- while (szd->name != NULL) {
- if (abs(szd->squareSize - squareSize) < distance) {
- nearest = szd;
- distance = abs(szd->squareSize - squareSize);
- if (distance == 0) break;
- }
- szd++;
- }
- if (i < 2) lineGap = nearest->lineGap;
- if (i < 3) clockFontPxlSize = nearest->clockFontPxlSize;
- if (i < 4) coordFontPxlSize = nearest->coordFontPxlSize;
- if (i < 5) fontPxlSize = nearest->fontPxlSize;
- if (i < 6) smallLayout = nearest->smallLayout;
- if (i < 7) tinyLayout = nearest->tinyLayout;
+ i = sscanf(appData.boardSize, "%d,%d,%d,%d,%d,%d,%d", &squareSize,
+ &lineGap, &clockFontPxlSize, &coordFontPxlSize,
+ &fontPxlSize, &smallLayout, &tinyLayout);
+ if (i == 0) {
+ fprintf(stderr, _("%s: bad boardSize syntax %s\n"),
+ programName, appData.boardSize);
+ exit(2);
+ }
+ if (i < 7) {
+ /* Find some defaults; use the nearest known size */
+ SizeDefaults *szd, *nearest;
+ int distance = 99999;
+ nearest = szd = sizeDefaults;
+ while (szd->name != NULL) {
+ if (abs(szd->squareSize - squareSize) < distance) {
+ nearest = szd;
+ distance = abs(szd->squareSize - squareSize);
+ if (distance == 0) break;
+ }
+ szd++;
+ }
+ if (i < 2) lineGap = nearest->lineGap;
+ if (i < 3) clockFontPxlSize = nearest->clockFontPxlSize;
+ if (i < 4) coordFontPxlSize = nearest->coordFontPxlSize;
+ if (i < 5) fontPxlSize = nearest->fontPxlSize;
+ if (i < 6) smallLayout = nearest->smallLayout;
+ if (i < 7) tinyLayout = nearest->tinyLayout;
}
- } else {
+ } else {
SizeDefaults *szd = sizeDefaults;
if (*appData.boardSize == NULLCHAR) {
- while (DisplayWidth(xDisplay, xScreen) < szd->minScreenSize ||
- DisplayHeight(xDisplay, xScreen) < szd->minScreenSize) {
- szd++;
- }
- if (szd->name == NULL) szd--;
+ while (DisplayWidth(xDisplay, xScreen) < szd->minScreenSize ||
+ DisplayHeight(xDisplay, xScreen) < szd->minScreenSize) {
+ szd++;
+ }
+ if (szd->name == NULL) szd--;
} else {
- while (szd->name != NULL &&
- StrCaseCmp(szd->name, appData.boardSize) != 0) szd++;
- if (szd->name == NULL) {
- fprintf(stderr, _("%s: unrecognized boardSize name %s\n"),
- programName, appData.boardSize);
- exit(2);
- }
+ while (szd->name != NULL &&
+ StrCaseCmp(szd->name, appData.boardSize) != 0) szd++;
+ if (szd->name == NULL) {
+ fprintf(stderr, _("%s: unrecognized boardSize name %s\n"),
+ programName, appData.boardSize);
+ exit(2);
+ }
}
squareSize = szd->squareSize;
lineGap = szd->lineGap;
tinyLayout = szd->tinyLayout;
}
- /* Now, using squareSize as a hint, find a good XPM/XIM set size */
- if (strlen(appData.pixmapDirectory) > 0) {
- p = ExpandPathName(appData.pixmapDirectory);
- if (!p) {
- fprintf(stderr, _("Error expanding path name \"%s\"\n"),
- appData.pixmapDirectory);
- exit(1);
- }
- if (appData.debugMode) {
- fprintf(stderr, _("\
-XBoard square size (hint): %d\n\
-%s fulldir:%s:\n"), squareSize, IMAGE_EXT, p);
- }
- squareSize = xpm_closest_to(p, squareSize, IMAGE_EXT);
- if (appData.debugMode) {
- fprintf(stderr, _("Closest %s size: %d\n"), IMAGE_EXT, squareSize);
- }
- }
+ printf("DEBUG::main: squareSize %d\n",squareSize);
- /* [HR] height treated separately (hacked) */
- boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap);
+ boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap);
boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap);
if (appData.showJail == 1) {
/* Jail on top and bottom */
/* 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.\n");
+ printf("DEBUG: created stuff squareSize %d.\n",squareSize);
// XtAugmentTranslations(formWidget,
gdk_cursor_destroy(BoardCursor);
/* end cursor */
- printf("DEBUG: going into main.\n");
+ printf("DEBUG: going into gtk-main.\n");
gtk_main ();
if (lineGap == 0) return;
/* [HR] Split this into 2 loops for non-square boards. */
-
+
for (i = 0; i < BOARD_HEIGHT + 1; i++) {
gridSegments[i].x1 = 0;
gridSegments[i].x2 =
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()
{
- if (appData.monoMode) {
- if (DefaultDepth(xDisplay, xScreen) == 1) {
- return monoDrawPiece_1bit;
- } else {
- return monoDrawPiece;
- }
+ printf("DEBUG::ChooseDrawFunc: appData.monoMode %d useImages %d\n",appData.monoMode,useImages);
+ if (appData.monoMode) {
+ if (DefaultDepth(xDisplay, xScreen) == 1) {
+ return monoDrawPiece_1bit;
} else {
- if (useImages)
- return colorDrawPieceImage;
- else
- return colorDrawPiece;
+ return monoDrawPiece;
}
+ } else {
+ if (useImages)
+ return colorDrawPieceImage;
+ else
+ return colorDrawPiece;
+ }
}
/* [HR] determine square color depending on chess variant. */
XCharStruct overall;
DrawFunc drawfunc;
int flash_delay;
-
+
/* 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) *
(squareSize + lineGap);
square_color = SquareColor(row, column);
- 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)
- || (column == BOARD_RGHT+1 && row >= gameInfo.holdingsSize) ) {
- BlankSquare(x, y, 2, EmptySquare, xBoardWindow);
-
- // [HGM] print piece counts next to holdings
- string[1] = NULLCHAR;
- if (column == (flipView ? BOARD_LEFT-1 : BOARD_RGHT) && piece > 1 ) {
- string[0] = '0' + piece;
- XTextExtents(countFontStruct, string, 1, &direction,
- &font_ascent, &font_descent, &overall);
- if (appData.monoMode) {
- XDrawImageString(xDisplay, xBoardWindow, countGC,
- x + squareSize - overall.width - 2,
- y + font_ascent + 1, string, 1);
- } else {
- XDrawString(xDisplay, xBoardWindow, countGC,
- x + squareSize - overall.width - 2,
- y + font_ascent + 1, string, 1);
- }
- }
- if (column == (flipView ? BOARD_RGHT : BOARD_LEFT-1) && piece > 1) {
- string[0] = '0' + piece;
- XTextExtents(countFontStruct, string, 1, &direction,
- &font_ascent, &font_descent, &overall);
- if (appData.monoMode) {
- XDrawImageString(xDisplay, xBoardWindow, countGC,
- x + 2, y + font_ascent + 1, string, 1);
- } else {
- XDrawString(xDisplay, xBoardWindow, countGC,
- x + 2, y + font_ascent + 1, string, 1);
- }
- }
- } else {
- if (piece == EmptySquare || appData.blindfold) {
- BlankSquare(x, y, square_color, piece, xBoardWindow);
- } else {
- drawfunc = ChooseDrawFunc();
- if (do_flash && appData.flashCount > 0) {
- for (i=0; i<appData.flashCount; ++i) {
-
- drawfunc(piece, square_color, x, y, xBoardWindow);
- XSync(xDisplay, False);
- do_flash_delay(flash_delay);
-
- BlankSquare(x, y, square_color, piece, xBoardWindow);
- XSync(xDisplay, False);
- do_flash_delay(flash_delay);
- }
- }
- drawfunc(piece, square_color, x, y, xBoardWindow);
- }
- }
+ 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);
- string[1] = NULLCHAR;
- if (appData.showCoords && row == (flipView ? BOARD_HEIGHT-1 : 0)
- && column >= BOARD_LEFT && column < BOARD_RGHT) {
- string[0] = 'a' + column - BOARD_LEFT;
- XTextExtents(coordFontStruct, string, 1, &direction,
+ 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)
+ || (column == BOARD_RGHT+1 && row >= gameInfo.holdingsSize) ) {
+ BlankSquare(x, y, 2, EmptySquare, xBoardWindow);
+
+ // [HGM] print piece counts next to holdings
+ string[1] = NULLCHAR;
+ if (column == (flipView ? BOARD_LEFT-1 : BOARD_RGHT) && piece > 1 ) {
+ string[0] = '0' + piece;
+ XTextExtents(countFontStruct, string, 1, &direction,
&font_ascent, &font_descent, &overall);
if (appData.monoMode) {
- XDrawImageString(xDisplay, xBoardWindow, coordGC,
- x + squareSize - overall.width - 2,
- y + squareSize - font_descent - 1, string, 1);
+ XDrawImageString(xDisplay, xBoardWindow, countGC,
+ x + squareSize - overall.width - 2,
+ y + font_ascent + 1, string, 1);
} else {
- XDrawString(xDisplay, xBoardWindow, coordGC,
- x + squareSize - overall.width - 2,
- y + squareSize - font_descent - 1, string, 1);
+ XDrawString(xDisplay, xBoardWindow, countGC,
+ x + squareSize - overall.width - 2,
+ y + font_ascent + 1, string, 1);
}
- }
- if (appData.showCoords && column == (flipView ? BOARD_RGHT-1 : BOARD_LEFT)) {
- string[0] = ONE + row;
- XTextExtents(coordFontStruct, string, 1, &direction,
+ }
+ if (column == (flipView ? BOARD_RGHT : BOARD_LEFT-1) && piece > 1) {
+ string[0] = '0' + piece;
+ XTextExtents(countFontStruct, string, 1, &direction,
&font_ascent, &font_descent, &overall);
if (appData.monoMode) {
- XDrawImageString(xDisplay, xBoardWindow, coordGC,
- x + 2, y + font_ascent + 1, string, 1);
+ XDrawImageString(xDisplay, xBoardWindow, countGC,
+ x + 2, y + font_ascent + 1, string, 1);
} else {
- XDrawString(xDisplay, xBoardWindow, coordGC,
- x + 2, y + font_ascent + 1, string, 1);
+ XDrawString(xDisplay, xBoardWindow, countGC,
+ x + 2, y + font_ascent + 1, string, 1);
}
+ }
+ } else {
+ if (piece == EmptySquare || appData.blindfold) {
+ BlankSquare(x, y, square_color, piece, xBoardWindow);
+ } else {
+ drawfunc = ChooseDrawFunc();
+ if (do_flash && appData.flashCount > 0) {
+ for (i=0; i<appData.flashCount; ++i) {
+
+ drawfunc(piece, square_color, x, y, xBoardWindow);
+ XSync(xDisplay, False);
+ do_flash_delay(flash_delay);
+
+ BlankSquare(x, y, square_color, piece, xBoardWindow);
+ XSync(xDisplay, False);
+ do_flash_delay(flash_delay);
+ }
+ }
+ drawfunc(piece, square_color, x, y, xBoardWindow);
+ }
+ }
+
+ string[1] = NULLCHAR;
+ if (appData.showCoords && row == (flipView ? BOARD_HEIGHT-1 : 0)
+ && column >= BOARD_LEFT && column < BOARD_RGHT) {
+ string[0] = 'a' + column - BOARD_LEFT;
+ XTextExtents(coordFontStruct, string, 1, &direction,
+ &font_ascent, &font_descent, &overall);
+ if (appData.monoMode) {
+ XDrawImageString(xDisplay, xBoardWindow, coordGC,
+ x + squareSize - overall.width - 2,
+ y + squareSize - font_descent - 1, string, 1);
+ } else {
+ XDrawString(xDisplay, xBoardWindow, coordGC,
+ x + squareSize - overall.width - 2,
+ y + squareSize - font_descent - 1, string, 1);
+ }
+ }
+ if (appData.showCoords && column == (flipView ? BOARD_RGHT-1 : BOARD_LEFT)) {
+ string[0] = ONE + row;
+ XTextExtents(coordFontStruct, string, 1, &direction,
+ &font_ascent, &font_descent, &overall);
+ if (appData.monoMode) {
+ XDrawImageString(xDisplay, xBoardWindow, coordGC,
+ x + 2, y + font_ascent + 1, string, 1);
+ } else {
+ XDrawString(xDisplay, xBoardWindow, coordGC,
+ x + 2, y + font_ascent + 1, string, 1);
+ }
}
}
Arg args[16];
int rrow, rcol;
- printf ("DEBUG: in draw position\n");
+ printf ("DEBUG::DrawPosition: start\n");
if (board == NULL) {
* but this causes a very distracting flicker.
*/
- printf ("DEBUG: in draw position 0.1\n");
+ printf ("DEBUG::DrawPosition: in draw position 0.1\n");
+ printf("DEBUG::DrawPosition: squareSize %d\n",squareSize);
if (!repaint && lastBoardValid && lastFlipView == flipView) {
- printf ("DEBUG: in draw position 0.1a\n");
+ 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 */
gdk_draw_segments(GUI_Board->window,gtklineGC,
gridSegments, BOARD_HEIGHT + BOARD_WIDTH + 2 );
}
-
+
+ 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;
}