return dst;
}
-#if 0
-//[HGM] for future use? Conditioned out for now to suppress warning.
-static char * safeStrCat( char * dst, const char * src, size_t count )
-{
- size_t dst_len;
-
- assert( dst != NULL );
- assert( src != NULL );
- assert( count > 0 );
-
- dst_len = strlen(dst);
-
- assert( count > dst_len ); /* Buffer size must be greater than current length */
-
- safeStrCpy( dst + dst_len, src, count - dst_len );
-
- return dst;
-}
-#endif
-
/* Some compiler can't cast u64 to double
* This function do the job for us:
programVersion = (char*) malloc(5 + strlen(PACKAGE_STRING));
sprintf(programVersion, "%s", PACKAGE_STRING);
} else {
-#if 0
- char *p, *q;
- q = first.program;
- while (*q != ' ' && *q != NULLCHAR) q++;
- p = q;
- while (p > first.program && *(p-1) != '/' && *(p-1) != '\\') p--; /* [HGM] backslash added */
- programVersion = (char*) malloc(8 + strlen(PACKAGE_STRING + (q - p));
- sprintf(programVersion, "%s + ", PACKAGE_STRING);
- strncat(programVersion, p, q - p);
-#else
- /* [HGM] tidy: use tidy name, in stead of full pathname (which was probably a bug due to / vs \ ) */
- programVersion = (char*) malloc(8 + strlen(PACKAGE_STRING) + strlen(first.tidy));
- sprintf(programVersion, "%s + %s", PACKAGE_STRING, first.tidy);
-#endif
+ /* [HGM] tidy: use tidy name, in stead of full pathname (which was probably a bug due to / vs \ ) */
+ programVersion = (char*) malloc(8 + strlen(PACKAGE_STRING) + strlen(first.tidy));
+ sprintf(programVersion, "%s + %s", PACKAGE_STRING, first.tidy);
}
if (!appData.icsActive) {
int ti;
int mps;
{
-#if 0
- int matched, min, sec;
-
- matched = sscanf(tc, "%d:%d", &min, &sec);
- if (matched == 1) {
- timeControl = min * 60 * 1000;
- } else if (matched == 2) {
- timeControl = (min * 60 + sec) * 1000;
- } else {
- return FALSE;
- }
-#else
- long tc1;
- long tc2;
- char buf[MSG_SIZ];
-
- if(ti >= 0 && !strchr(tc, '+') && !strchr(tc, '/') ) mps = 0;
- if(ti > 0) {
- if(mps)
- sprintf(buf, "+%d/%s+%d", mps, tc, ti);
- else sprintf(buf, "+%s+%d", tc, ti);
- } else {
- if(mps)
+ long tc1;
+ long tc2;
+ char buf[MSG_SIZ];
+
+ if(ti >= 0 && !strchr(tc, '+') && !strchr(tc, '/') ) mps = 0;
+ if(ti > 0) {
+ if(mps)
+ sprintf(buf, "+%d/%s+%d", mps, tc, ti);
+ else sprintf(buf, "+%s+%d", tc, ti);
+ } else {
+ if(mps)
sprintf(buf, "+%d/%s", mps, tc);
- else sprintf(buf, "+%s", tc);
- }
- fullTimeControlString = StrSave(buf);
-
- if( NextTimeControlFromString( &tc, &tc1 ) != 0 ) {
- return FALSE;
- }
-
- if( *tc == '/' ) {
- /* Parse second time control */
- tc++;
-
- if( NextTimeControlFromString( &tc, &tc2 ) != 0 ) {
- return FALSE;
- }
-
- if( tc2 == 0 ) {
- return FALSE;
- }
-
- timeControl_2 = tc2 * 1000;
- }
- else {
- timeControl_2 = 0;
- }
-
- if( tc1 == 0 ) {
- return FALSE;
+ else sprintf(buf, "+%s", tc);
+ }
+ fullTimeControlString = StrSave(buf);
+
+ if( NextTimeControlFromString( &tc, &tc1 ) != 0 ) {
+ return FALSE;
+ }
+
+ if( *tc == '/' ) {
+ /* Parse second time control */
+ tc++;
+
+ if( NextTimeControlFromString( &tc, &tc2 ) != 0 ) {
+ return FALSE;
}
-
- timeControl = tc1 * 1000;
-#endif
-
- if (ti >= 0) {
- timeIncrement = ti * 1000; /* convert to ms */
- movesPerSession = 0;
- } else {
- timeIncrement = 0;
- movesPerSession = mps;
+
+ if( tc2 == 0 ) {
+ return FALSE;
}
- return TRUE;
+
+ timeControl_2 = tc2 * 1000;
+ }
+ else {
+ timeControl_2 = 0;
+ }
+
+ if( tc1 == 0 ) {
+ return FALSE;
+ }
+
+ timeControl = tc1 * 1000;
+
+ if (ti >= 0) {
+ timeIncrement = ti * 1000; /* convert to ms */
+ movesPerSession = 0;
+ } else {
+ timeIncrement = 0;
+ movesPerSession = mps;
+ }
+ return TRUE;
}
void
InitDrawingSizes(-2, 0);
/* [HGM] The following should definitely be solved in a better way */
-#if 0
- CopyBoard(board, tempBoard); /* save position in case it is board[0] */
- for(i=0; i<BOARD_SIZE; i++) saveCastling[i] = castlingRights[0][i];
- saveEP = epStatus[0];
-#endif
InitPosition(FALSE); /* this sets up board[0], but also other stuff */
-#if 0
- epStatus[0] = saveEP;
- for(i=0; i<BOARD_SIZE; i++) castlingRights[0][i] = saveCastling[i];
- CopyBoard(tempBoard, board); /* restore position received from ICS */
-#endif
} else { gameInfo.variant = newVariant; InitPosition(FALSE); }
forwardMostMove = oldForwardMostMove;
}
SendTimeRemaining(&first, TRUE);
}
-#if 0
- if (first.useColors) {
- SendToProgram("white\ngo\n", &first);
- } else {
- SendToProgram("go\n", &first);
- }
-#else
if (first.useColors) {
SendToProgram("white\n", &first); // [HGM] book: made sending of "go\n" book dependent
}
bookHit = SendMoveToBookUser(forwardMostMove-1, &first, TRUE); // [HGM] book: probe book for initial pos
-#endif
first.maybeThinking = TRUE;
} else {
if (first.usePlayother) {
}
SendTimeRemaining(&first, FALSE);
}
-#if 0
- if (first.useColors) {
- SendToProgram("black\ngo\n", &first);
- } else {
- SendToProgram("go\n", &first);
- }
-#else
if (first.useColors) {
SendToProgram("black\n", &first);
}
bookHit = SendMoveToBookUser(forwardMostMove-1, &first, TRUE);
-#endif
first.maybeThinking = TRUE;
} else {
if (first.usePlayother) {
fprintf(debugFP, "Illegal move from ICS '%s'\n", move_str);
fprintf(debugFP, "board L=%d, R=%d, H=%d, holdings=%d\n", BOARD_LEFT, BOARD_RGHT, BOARD_HEIGHT, gameInfo.holdingsWidth);
}
-#if 0
- if (appData.testLegality && appData.debugMode) {
- sprintf(str, "Illegal move \"%s\" from ICS", move_str);
- DisplayError(str, 0);
- }
-#endif
strcpy(parseList[moveNum - 1], move_str);
strcat(parseList[moveNum - 1], " ");
strcat(parseList[moveNum - 1], elapsed_time);
initialPosition[BOARD_HEIGHT-1-PieceToNumber(WhiteMan)][0] = BlackMan;
initialPosition[BOARD_HEIGHT-1-PieceToNumber(WhiteMan)][1] = 9;
}
-#if 0
- if(gameInfo.variant == VariantFischeRandom) {
- if( appData.defaultFrcPosition < 0 ) {
- ShuffleFRC( initialPosition );
- }
- else {
- SetupFRC( initialPosition, appData.defaultFrcPosition );
- }
- startedFromSetupPosition = TRUE;
- } else
-#else
if (appData.debugMode) {
fprintf(debugFP, "shuffleOpenings = %d\n", shuffleOpenings);
}
SetUpShuffle(initialPosition, appData.defaultFrcPosition);
startedFromSetupPosition = TRUE;
}
-#endif
if(startedFromPositionFile) {
/* [HGM] loadPos: use PositionFile for every new game */
CopyBoard(initialPosition, filePosition);
epStatus[k+2] <= EP_NONE && epStatus[k+1] <= EP_NONE;
k-=2)
{ int rights=0;
-#if 0
- if (appData.debugMode) {
- fprintf(debugFP, " loop\n");
- }
-#endif
if(CompareBoards(boards[k], boards[forwardMostMove])) {
-#if 0
- if (appData.debugMode) {
- fprintf(debugFP, "match\n");
- }
-#endif
/* compare castling rights */
if( castlingRights[forwardMostMove][2] != castlingRights[k][2] &&
(castlingRights[k][0] >= 0 || castlingRights[k][1] >= 0) )
castlingRights[forwardMostMove][4] != castlingRights[k][4] )
rights++;
}
-#if 0
- if (appData.debugMode) {
- for(i=0; i<nrCastlingRights; i++)
- fprintf(debugFP, " (%d,%d)", castlingRights[forwardMostMove][i], castlingRights[k][i]);
- }
-
- if (appData.debugMode) {
- fprintf(debugFP, " %d %d\n", rights, k);
- }
-#endif
if( rights == 0 && ++count > appData.drawRepeats-2
&& appData.drawRepeats > 1) {
/* adjudicate after user-specified nr of repeats */
if (gameMode == BeginningOfGame || gameMode == EndOfGame ||
gameMode == IcsIdle) return;
if (forwardMostMove <= backwardMostMove) return;
-#if 0
- /* Following removed: it caused a bug where a real illegal move
- message in analyze mored would be ignored. */
- if (cps == &first && programStats.ok_to_send == 0) {
- /* Bogus message from Crafty responding to "." This filtering
- can miss some of the bad messages, but fortunately the bug
- is fixed in current Crafty versions, so it doesn't matter. */
- return;
- }
-#endif
if (pausing) PauseEvent();
if(appData.forceIllegal) {
// [HGM] illegal: machine refused move; force position after move into it
/* [HGM] in two-machine mode we delay relaying draw offer */
/* until after we also have move, to see if it is really claim */
}
-#if 0
- else {
- if (cps->other->sendDrawOffers) {
- SendToProgram("draw\n", cps->other);
- }
- }
-#endif
} else if (gameMode == MachinePlaysWhite ||
gameMode == MachinePlaysBlack) {
if (userOfferedDraw) {
DisplayError(_("Position not found in file"), 0);
return FALSE;
}
-#if 0
- switch (line[0]) {
- case '#': case 'x':
- default:
- fenMode = FALSE;
- break;
- case 'p': case 'n': case 'b': case 'r': case 'q': case 'k':
- case 'P': case 'N': case 'B': case 'R': case 'Q': case 'K':
- case '1': case '2': case '3': case '4': case '5': case '6':
- case '7': case '8': case '9':
- case 'H': case 'A': case 'M': case 'h': case 'a': case 'm':
- case 'E': case 'F': case 'G': case 'e': case 'f': case 'g':
- case 'C': case 'W': case 'c': case 'w':
- fenMode = TRUE;
- break;
- }
-#else
// [HGM] FEN can begin with digit, any piece letter valid in this variant, or a + for Shogi promoted pieces
fenMode = line[0] >= '0' && line[0] <= '9' || line[0] == '+' || CharToPiece(line[0]) != EmptySquare;
-#endif
if (pn >= 2) {
if (fenMode || line[0] == '#') pn--;
/* Get move */
strcpy(move_buffer, SavePart(parseList[i])); // [HGM] pgn: print move via buffer, so it can be edited
movelen = strlen(move_buffer); /* [HGM] pgn: line-break point before move */
-#if 0
- // SavePart already does this!
- if( i >= 0 && appData.saveExtendedInfoInPGN && pvInfoList[i].depth > 0 ) {
- int p = movelen - 1;
- if(move_buffer[p] == ' ') p--;
- if(move_buffer[p] == ')') { // [HGM] pgn: strip off ICS time if we have extended info
- while(p && move_buffer[--p] != '(');
- if(p && move_buffer[p-1] == ' ') move_buffer[movelen=p-1] = 0;
- }
- }
-#endif
+
/* Print move */
blank = linelen > 0 && movelen > 0;
if (linelen + (blank ? 1 : 0) + movelen > PGN_MAX_LINE) {
if (icsPR != NoProc) {
DestroyChildProcess(icsPR, TRUE);
}
-#if 0
- /* Save game if resource set and not already saved by GameEnds() */
- if ((gameInfo.resultDetails == NULL || errorExitFlag )
- && forwardMostMove > 0) {
- if (*appData.saveGameFile != NULLCHAR) {
- SaveGameToFile(appData.saveGameFile, TRUE);
- } else if (appData.autoSaveGames) {
- AutoSaveGame();
- }
- if (*appData.savePositionFile != NULLCHAR) {
- SavePositionToFile(appData.savePositionFile);
- }
- }
- GameEnds((ChessMove) 0, NULL, GE_PLAYER);
-#else
+
/* [HGM] crash: leave writing PGN and position entirely to GameEnds() */
GameEnds(gameInfo.result, gameInfo.resultDetails==NULL ? "xboard exit" : gameInfo.resultDetails, GE_PLAYER);
-#endif
+
/* [HGM] crash: the above GameEnds() is a dud if another one was running */
/* make sure this other one finishes before killing it! */
if(endingGame) { int count = 0;
/* [HGM] Shogi promotions. '=' means defer */
if(closure->rfIn != DROP_RANK && closure->kind == NormalMove) {
ChessSquare piece = closure->piece;
-#if 0
- if (appData.debugMode) {
- fprintf(debugFP, "Disambiguate A: %d(%d,%d)-(%d,%d) = %d (%c)\n",
- closure->pieceIn,closure->ffIn,closure->rfIn,closure->ftIn,closure->rtIn,
- closure->promoCharIn,closure->promoCharIn);
- }
-#endif
if(c != NULLCHAR && c != 'x' && c != '+' && c != '=' &&
ToUpper(PieceToChar(PROMOTED piece)) != ToUpper(c) )
closure->kind = IllegalMove;
else if(flags & F_WHITE_ON_MOVE) {
-#if 0
- if (appData.debugMode) {
- fprintf(debugFP, "Disambiguate B: %d(%d,%d)-(%d,%d) = %d (%c)\n",
- closure->pieceIn,closure->ffIn,closure->rfIn,closure->ftIn,closure->rtIn,
- closure->promoCharIn,closure->promoCharIn);
- }
-#endif
if( (int) piece < (int) WhiteWazir &&
(closure->rf > BOARD_HEIGHT-4 || closure->rt > BOARD_HEIGHT-4) ) {
if( (piece == WhitePawn || piece == WhiteQueen) && closure->rt > BOARD_HEIGHT-2 ||
closure->kind = IllegalMove;
}
}
-#if 0
- if (appData.debugMode) {
- fprintf(debugFP, "Disambiguate C: %d(%d,%d)-(%d,%d) = %d (%c)\n",
- closure->pieceIn,closure->ffIn,closure->rfIn,closure->ftIn,closure->rtIn,
- closure->promoCharIn,closure->promoCharIn);
- }
-#endif
/* [HGM] returns 'q' for optional promotion, 'n' for mandatory */
if(closure->promoCharIn != '=')
closure->promoChar = ToLower(closure->promoCharIn);
\r
extern long whiteTimeRemaining, blackTimeRemaining, timeControl, timeIncrement;\r
\r
-#if 0\r
-// from moves.h, but no longer needed, as the new routines are all moved to winboard.c\r
-\r
-extern char* PieceToName P((ChessSquare p, int i));\r
-extern char* SquareToChar P((int Xpos)); \r
-extern char* SquareToNum P((int Ypos));\r
-extern int CoordToNum P((char c));\r
-\r
-#endif\r
-\r
// from moves.c, added WinBoard_F piece types and ranks / files\r
\r
char *squareToChar[] = { "ay", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l" };\r
int clientHeight;\r
int maxControlWidth;\r
int buttonWidth, buttonHeight;\r
-#if 0\r
-}\r
-#else\r
+\r
/* Initialize variables */\r
GetClientRect( hDlg, &rc );\r
\r
// InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo1), NULL, FALSE );\r
// InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo2), NULL, FALSE );\r
}\r
-#endif\r
\r
// front end. Actual printing of PV lines into the output field\r
static void InsertIntoMemo( HANDLE hDlg, char * text )\r
return;\r
}\r
\r
-#if 0\r
- tmp = buf;\r
- while( *tmp == ' ' || *tmp == '\t' || *tmp == '\r' || *tmp == '\n' ) {\r
- tmp++;\r
- }\r
-\r
- if( *tmp == '[' ) {\r
-#else\r
// [HGM] paste any: make still smarter, to allow pasting of games without tags, recognize FEN in stead\r
if(!ParseFEN(dummyBoard, &dummy, buf) ) {\r
-#endif\r
PasteGameFromString( buf );\r
}\r
else {\r
break;\r
\r
/* Support for captionless window */\r
-#if 0\r
- case WM_NCLBUTTONDBLCLK:\r
- if( wParam == HTCAPTION ) {\r
- int index;\r
- POINT mouse_xy;\r
- POINTS pts = MAKEPOINTS(lParam);\r
-\r
- mouse_xy.x = pts.x;\r
- mouse_xy.y = pts.y;\r
- ScreenToClient( hDlg, &mouse_xy );\r
-\r
- index = GetMoveIndexFromPoint( mouse_xy.x, mouse_xy.y );\r
-\r
- if( index >= 0 && index < currLast ) {\r
- ToNrEvent( index + 1 );\r
- }\r
- }\r
- break;\r
-\r
- case WM_NCHITTEST:\r
- {\r
- LRESULT res = DefWindowProc( hDlg, message, wParam, lParam );\r
-\r
- if( res == HTCLIENT ) res = HTCAPTION;\r
-\r
- SetWindowLong( hDlg, DWL_MSGRESULT, res );\r
-\r
- return TRUE;\r
- }\r
- break;\r
-#endif\r
-\r
case WM_CLOSE:\r
EvalGraphPopDown();\r
break;\r
{ "autoraise", ArgTrue, (LPVOID) &appData.autoRaiseBoard, FALSE },\r
{ "xautoraise", ArgFalse, (LPVOID) &appData.autoRaiseBoard, FALSE },\r
{ "-autoraise", ArgFalse, (LPVOID) &appData.autoRaiseBoard, FALSE },\r
-#if 0\r
- { "cmailGameName", ArgString, (LPVOID) &appData.cmailGameName, FALSE },\r
- { "cmail", ArgString, (LPVOID) &appData.cmailGameName, FALSE },\r
-#endif\r
{ "alwaysPromoteToQueen", ArgBoolean, (LPVOID) &appData.alwaysPromoteToQueen, TRUE },\r
{ "queen", ArgTrue, (LPVOID) &appData.alwaysPromoteToQueen, FALSE },\r
{ "xqueen", ArgFalse, (LPVOID) &appData.alwaysPromoteToQueen, FALSE },\r
\r
/* Create bitmaps */\r
hfont_old = SelectObject( hdc, hPieceFont );\r
-#if 0\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WP );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WN );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WB );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WR );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WQ );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WK );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BP );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BN );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BB );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BR );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BQ );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BK );\r
-\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WA );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WC );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WF );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WH );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WE );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WW );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WU );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WO );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WG );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WM );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WSG );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WV );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WAB );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WD );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WL );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_WS );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BA );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BC );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BF );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BH );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BE );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BW );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BU );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BO );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BG );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BM );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BSG );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BV );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BAB );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BD );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BL );\r
- CreatePieceMaskFromFont( hdc_window, hdc, PM_BS );\r
-#else\r
for(i=(int)WhitePawn; i<(int)EmptySquare; i++) /* [HGM] made a loop for this */\r
if(PieceToChar((ChessSquare)i) != '.') /* skip unused pieces */\r
CreatePieceMaskFromFont( hdc_window, hdc, i );\r
-#endif\r
+\r
SelectObject( hdc, hfont_old );\r
\r
fontBitmapSquareSize = squareSize;\r
StretchBlt(hdc, x+tmpSize, y+tmpSize, -tmpSize, -tmpSize, tmphdc, 0, 0, tmpSize, tmpSize, 0x00B8074A);\r
else\r
BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A);\r
-#if 0\r
- /* Use black piece color for outline of white pieces */\r
- /* Not sure this looks really good (though xboard does it).\r
- Maybe better to have another selectable color, default black */\r
- SelectObject(hdc, blackPieceBrush); /* could have own brush */\r
- SelectObject(tmphdc, PieceBitmap(piece, OUTLINE_PIECE));\r
- BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A);\r
-#else\r
/* Use black for outline of white pieces */\r
SelectObject(tmphdc, PieceBitmap(piece, OUTLINE_PIECE));\r
if(appData.upsideDown && color==flipView)\r
StretchBlt(hdc, x+tmpSize, y+tmpSize, -tmpSize, -tmpSize, tmphdc, 0, 0, tmpSize, tmpSize, SRCAND);\r
else\r
BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, SRCAND);\r
-#endif\r
} else {\r
-#if 0\r
- /* Use white piece color for details of black pieces */\r
- /* Requires filled-in solid bitmaps (BLACK_PIECE class); the\r
- WHITE_PIECE ones aren't always the right shape. */\r
- /* Not sure this looks really good (though xboard does it).\r
- Maybe better to have another selectable color, default medium gray? */\r
- oldBitmap = SelectObject(tmphdc, PieceBitmap(piece, BLACK_PIECE));\r
- oldBrush = SelectObject(hdc, whitePieceBrush); /* could have own brush */\r
- BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A);\r
- SelectObject(tmphdc, PieceBitmap(piece, SOLID_PIECE));\r
- SelectObject(hdc, blackPieceBrush);\r
- BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A);\r
-#else\r
/* Use square color for details of black pieces */\r
oldBitmap = SelectObject(tmphdc, PieceBitmap(piece, SOLID_PIECE));\r
oldBrush = SelectObject(hdc, blackPieceBrush);\r
StretchBlt(hdc, x+tmpSize, y+tmpSize, -tmpSize, -tmpSize, tmphdc, 0, 0, tmpSize, tmpSize, 0x00B8074A);\r
else\r
BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A);\r
-#endif\r
}\r
SelectObject(hdc, oldBrush);\r
SelectObject(tmphdc, oldBitmap);\r
fullrepaint = TRUE;\r
}\r
\r
-#if 0\r
- if( fullrepaint ) {\r
- static int repaint_count = 0;\r
- char buf[128];\r
-\r
- repaint_count++;\r
- sprintf( buf, "FULL repaint: %d\n", repaint_count );\r
- OutputDebugString( buf );\r
- }\r
-#endif\r
-\r
if (board == NULL) {\r
if (!lastReqValid) {\r
return;\r
releaseDC = FALSE;\r
}\r
\r
-#if 0\r
- fprintf(debugFP, "*******************************\n"\r
- "repaint = %s\n"\r
- "dragInfo.from (%d,%d)\n"\r
- "dragInfo.start (%d,%d)\n"\r
- "dragInfo.pos (%d,%d)\n"\r
- "dragInfo.lastpos (%d,%d)\n", \r
- repaint ? "TRUE" : "FALSE",\r
- dragInfo.from.x, dragInfo.from.y, \r
- dragInfo.start.x, dragInfo.start.y,\r
- dragInfo.pos.x, dragInfo.pos.y,\r
- dragInfo.lastpos.x, dragInfo.lastpos.y);\r
- fprintf(debugFP, "prev: ");\r
- for (row = 0; row < BOARD_HEIGHT; row++) {\r
- for (column = 0; column < BOARD_WIDTH; column++) {\r
- fprintf(debugFP, "%d ", lastDrawn[row][column]);\r
- }\r
- }\r
- fprintf(debugFP, "\n");\r
- fprintf(debugFP, "board: ");\r
- for (row = 0; row < BOARD_HEIGHT; row++) {\r
- for (column = 0; column < BOARD_WIDTH; column++) {\r
- fprintf(debugFP, "%d ", board[row][column]);\r
- }\r
- }\r
- fprintf(debugFP, "\n");\r
- fflush(debugFP);\r
-#endif\r
-\r
/* Create some work-DCs */\r
hdcmem = CreateCompatibleDC(hdc);\r
tmphdc = CreateCompatibleDC(hdc);\r
else\r
MenuPopup(hwnd, pt, LoadMenu(hInst, "WhitePieceMenu"), -1);\r
} else { /* message == WM_RBUTTONDOWN */\r
-#if 0\r
- if (buttonCount == 3) {\r
- if (wParam & MK_SHIFT) \r
- MenuPopup(hwnd, pt, LoadMenu(hInst, "WhitePieceMenu"), -1);\r
- else\r
- MenuPopup(hwnd, pt, LoadMenu(hInst, "BlackPieceMenu"), -1);\r
- } else {\r
- MenuPopup(hwnd, pt, LoadMenu(hInst, "PieceMenu"), -1);\r
- }\r
-#else\r
/* Just have one menu, on the right button. Windows users don't\r
think to try the middle one, and sometimes other software steals\r
it, or it doesn't really exist. */\r
MenuPopup(hwnd, pt, LoadMenu(hInst, "PieceMenu"), -1);\r
else\r
MenuPopup(hwnd, pt, LoadMenu(hInst, "ShogiPieceMenu"), -1);\r
-#endif\r
}\r
break;\r
case IcsPlayingWhite:\r
nnew = RealizePalette(hdc);\r
if (nnew > 0) {\r
paletteChanged = TRUE;\r
-#if 0\r
- UpdateColors(hdc);\r
-#else\r
- InvalidateRect(hwnd, &boardRect, FALSE);/*faster!*/\r
-#endif\r
+ InvalidateRect(hwnd, &boardRect, FALSE);\r
}\r
ReleaseDC(hwnd, hdc);\r
}\r
/* Don't print an error: this can happen innocently if the sound driver\r
is busy; for instance, if another instance of WinBoard is playing\r
a sound at about the same time. */\r
-#if 0\r
- if (!ok) {\r
- char buf[MSG_SIZ];\r
- sprintf(buf, "Error playing sound %s", ms->name);\r
- DisplayError(buf, GetLastError());\r
- }\r
-#endif\r
return ok;\r
}\r
\r
void\r
HistorySet( char movelist[][2*MOVE_LEN], int first, int last, int current )\r
{\r
-#if 0\r
- char buf[256];\r
-\r
- sprintf( buf, "HistorySet: first=%d, last=%d, current=%d (%s)\n",\r
- first, last, current, current >= 0 ? movelist[current] : "n/a" );\r
-\r
- OutputDebugString( buf );\r
-#endif\r
-\r
MoveHistorySet( movelist, first, last, current, pvInfoList );\r
\r
EvalGraphSet( first, last, current, pvInfoList );\r
\r
void SetProgramStats( FrontEndProgramStats * stats )\r
{\r
-#if 0\r
- char buf[1024];\r
-\r
- sprintf( buf, "SetStats for %d: depth=%d, nodes=%lu, score=%5.2f, time=%5.2f, pv=%s\n",\r
- stats->which, stats->depth, stats->nodes, stats->score / 100.0, stats->time / 100.0, stats->pv == 0 ? "n/a" : stats->pv );\r
-\r
- OutputDebugString( buf );\r
-#endif\r
-\r
EngineOutputUpdate( stats );\r
}\r
appData.saveExtendedInfoInPGN= IS_CHECKED(OPT_SaveExtPGN);
appData.hideThinkingFromHuman= IS_CHECKED(OPT_HideThinkFromHuman);
appData.showEvalInMoveHistory= IS_CHECKED(OPT_ExtraInfoInMoveHistory);
-#if 0
- ShowThinkingEvent( IS_CHECKED(OPT_ShowThinking));
-#else
appData.showThinking = IS_CHECKED(OPT_ShowThinking);
ShowThinkingEvent(); // [HGM] thinking: tests four options
-#endif
appData.testLegality = IS_CHECKED(OPT_TestLegality);
appData.highlightMoveWithArrow=IS_CHECKED(OPT_HighlightMoveArrow);
oldBrushPiece = SelectObject(hdcMem, brushPiece);
BitBlt(hdcMem, x, y, SAMPLE_SQ_SIZE, SAMPLE_SQ_SIZE,
hdcTemp, 0, 0, 0x00B8074A);
-#if 0
- /* Use pieceDetailColor for outline of white pieces */
- SelectObject(hdcTemp, pieces[OUTLINE]);
- SelectObject(hdcMem, brushPieceDetail);
- BitBlt(hdcMem, x, y, SAMPLE_SQ_SIZE, SAMPLE_SQ_SIZE,
- hdcTemp, 0, 0, 0x00B8074A);
-#else
/* Use black for outline of white pieces */
SelectObject(hdcTemp, pieces[OUTLINE]);
BitBlt(hdcMem, x, y, SAMPLE_SQ_SIZE, SAMPLE_SQ_SIZE,
hdcTemp, 0, 0, SRCAND);
-#endif
} else {
-#if 0
- /* Use pieceDetailColor for details of black pieces */
- /* Requires filled-in solid bitmaps (BLACK_PIECE class); the
- WHITE_PIECE ones aren't always the right shape. */
- oldBitmapTemp = SelectObject(hdcTemp, pieces[BLACK]);
- oldBrushPiece = SelectObject(hdcMem, brushPieceDetail);
- BitBlt(hdcMem, x, y, SAMPLE_SQ_SIZE, SAMPLE_SQ_SIZE,
- hdcTemp, 0, 0, 0x00B8074A);
- SelectObject(hdcTemp, pieces[SOLID]);
- SelectObject(hdcMem, brushPiece);
- BitBlt(hdcMem, x, y, SAMPLE_SQ_SIZE, SAMPLE_SQ_SIZE,
- hdcTemp, 0, 0, 0x00B8074A);
-#else
/* Use square color for details of black pieces */
oldBitmapTemp = SelectObject(hdcTemp, pieces[SOLID]);
oldBrushPiece = SelectObject(hdcMem, brushPiece);
BitBlt(hdcMem, x, y, SAMPLE_SQ_SIZE, SAMPLE_SQ_SIZE,
hdcTemp, 0, 0, 0x00B8074A);
-#endif
}
SelectObject(hdcMem, oldBrushPiece);
SelectObject(hdcTemp, oldBitmapTemp);
rectFormat.left = center.x - (size.cx / 2) - 1;
rectFormat.right = center.x + (size.cx / 2) + 1;
-#if 0
- fprintf(debugFP, "\nfont: %s\n"
- "center.x %d, centerY %d\n"
- "size.cx %d, size.cy %d\n"
- "client.top %d, bottom %d, left %d, right %d\n"
- "format.top %d, bottom %d, left %d, right %d\n",
- buf,
- center.x, center.y,
- size.cx, size.cy,
- rectClient.top, rectClient.bottom, rectClient.left,
- rectClient.right,
- rectFormat.top, rectFormat.bottom, rectFormat.left,
- rectFormat.right);
-#endif
-
cf.cbSize = sizeof(CHARFORMAT);
cf.dwMask = CFM_FACE|CFM_SIZE|CFM_CHARSET|CFM_BOLD|CFM_ITALIC;
cf.dwEffects = 0;
PeriodicUpdatesEvent( IS_CHECKED(IDC_EpPeriodicUpdates));
PonderNextMoveEvent( IS_CHECKED(IDC_EpPonder));
appData.hideThinkingFromHuman= IS_CHECKED(IDC_EpHideThinkingHuman); // [HGM] thinking: moved up
-#if 0
- ShowThinkingEvent( IS_CHECKED(IDC_EpShowThinking));
-#else
appData.showThinking = IS_CHECKED(IDC_EpShowThinking);
ShowThinkingEvent(); // [HGM] thinking: tests all options that need thinking output
-#endif
appData.testClaims = IS_CHECKED(IDC_TestClaims);
appData.checkMates = IS_CHECKED(IDC_DetectMates);
appData.materialDraws = IS_CHECKED(IDC_MaterialDraws);
LayoutOptions(k, k+groupSize, buf, cps->option); // flush the group\r
boxList[groups++] = layout; // group end in odd entries\r
k = n = k + groupSize;\r
-#if 0\r
- } else {\r
- // try to recognize "two-column groups" based on option suffix\r
- int j = 1;\r
- while((p = EndMatch(cps->option[k].name, EndMatch(cps->option[k+2*j].name)) &&\r
- (q = EndMatch(cps->option[k+1].name, EndMatch(cps->option[k+2*j+1].name)) ) j++;\r
-#endif\r
} else k += groupSize; // small groups are grouped with the solitary options\r
}\r
if(n != k) LayoutOptions(n, k, "", cps->option); // flush remaining solitary options\r
return FALSE;\r
}\r
\r
-#if 0\r
-// example copied from MS docs\r
-#define ID_HELP 150\r
-#define ID_TEXT 200\r
-\r
-LPWORD lpwAlign(LPWORD lpIn)\r
-{\r
- ULONG ul;\r
-\r
- ul = (ULONG)lpIn;\r
- ul ++;\r
- ul >>=1;\r
- ul <<=1;\r
- return (LPWORD)ul;\r
-}\r
-\r
-LRESULT DisplayMyMessage(HINSTANCE hinst, HWND hwndOwner, LPSTR lpszMessage)\r
-{\r
- HGLOBAL hgbl;\r
- LPDLGTEMPLATE lpdt;\r
- LPDLGITEMTEMPLATE lpdit;\r
- LPWORD lpw;\r
- LPWSTR lpwsz;\r
- LRESULT ret;\r
- int nchar;\r
-\r
- hgbl = GlobalAlloc(GMEM_ZEROINIT, 1024);\r
- if (!hgbl)\r
- return -1;\r
- \r
- lpdt = (LPDLGTEMPLATE)GlobalLock(hgbl);\r
- \r
- // Define a dialog box.\r
- \r
- lpdt->style = WS_POPUP | WS_BORDER | WS_SYSMENU | DS_MODALFRAME | WS_CAPTION;\r
-// WS_POPUP | WS_SYSMENU | DS_MODALFRAME | WS_CAPTION | DS_SETFONT\r
- lpdt->cdit = 3; // Number of controls\r
- lpdt->x = 10; lpdt->y = 10;\r
- lpdt->cx = 100; lpdt->cy = 100;\r
-\r
- lpw = (LPWORD)(lpdt + 1);\r
- *lpw++ = 0; // No menu\r
- *lpw++ = 0; // Predefined dialog box class (by default)\r
-\r
- lpwsz = (LPWSTR)lpw;\r
- nchar = 1 + MultiByteToWideChar(CP_ACP, 0, "My Dialog", -1, lpwsz, 50);\r
- lpw += nchar;\r
-\r
- //-----------------------\r
- // Define an OK button.\r
- //-----------------------\r
- lpw = lpwAlign(lpw); // Align DLGITEMTEMPLATE on DWORD boundary\r
- lpdit = (LPDLGITEMTEMPLATE)lpw;\r
- lpdit->x = 10; lpdit->y = 70;\r
- lpdit->cx = 80; lpdit->cy = 20;\r
- lpdit->id = IDOK; // OK button identifier\r
- lpdit->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON;\r
-\r
- lpw = (LPWORD)(lpdit + 1);\r
- *lpw++ = 0xFFFF;\r
- *lpw++ = 0x0080; // Button class\r
-\r
- lpwsz = (LPWSTR)lpw;\r
- nchar = 1 + MultiByteToWideChar(CP_ACP, 0, "OK", -1, lpwsz, 50);\r
- lpw += nchar;\r
- lpw = lpwAlign(lpw); // Align creation data on DWORD boundary\r
- *lpw++ = 0; // No creation data\r
-\r
- //-----------------------\r
- // Define a Help button.\r
- //-----------------------\r
- lpw = lpwAlign(lpw); // Align DLGITEMTEMPLATE on DWORD boundary\r
- lpdit = (LPDLGITEMTEMPLATE)lpw;\r
- lpdit->x = 55; lpdit->y = 10;\r
- lpdit->cx = 40; lpdit->cy = 20;\r
- lpdit->id = ID_HELP; // Help button identifier\r
- lpdit->style = WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON;\r
-\r
- lpw = (LPWORD)(lpdit + 1);\r
- *lpw++ = 0xFFFF;\r
- *lpw++ = 0x0080; // Button class atom\r
-\r
- lpwsz = (LPWSTR)lpw;\r
- nchar = 1 + MultiByteToWideChar(CP_ACP, 0, "Help", -1, lpwsz, 50);\r
- lpw += nchar;\r
- lpw = lpwAlign(lpw); // Align creation data on DWORD boundary\r
- *lpw++ = 0; // No creation data\r
-\r
- //-----------------------\r
- // Define a static text control.\r
- //-----------------------\r
- lpw = lpwAlign(lpw); // Align DLGITEMTEMPLATE on DWORD boundary\r
- lpdit = (LPDLGITEMTEMPLATE)lpw;\r
- lpdit->x = 10; lpdit->y = 10;\r
- lpdit->cx = 40; lpdit->cy = 20;\r
- lpdit->id = ID_TEXT; // Text identifier\r
- lpdit->style = WS_CHILD | WS_VISIBLE | SS_LEFT;\r
-\r
- lpw = (LPWORD)(lpdit + 1);\r
- *lpw++ = 0xFFFF;\r
- *lpw++ = 0x0082; // Static class\r
-\r
- for (lpwsz = (LPWSTR)lpw; *lpwsz++ = (WCHAR)*lpszMessage++;);\r
- lpw = (LPWORD)lpwsz;\r
- lpw = lpwAlign(lpw); // Align creation data on DWORD boundary\r
- *lpw++ = 0; // No creation data\r
-\r
- GlobalUnlock(hgbl); \r
- ret = DialogBoxIndirect(hinst, \r
- (LPDLGTEMPLATE)hgbl, \r
- hwndOwner, \r
- (DLGPROC)DialogProc); \r
- GlobalFree(hgbl); \r
- return ret; \r
-}\r
-#endif\r
-\r
void AddControl(int x, int y, int w, int h, int type, int style, int n)\r
{\r
int i;\r
template.title[8] = cps == &first ? '1' : '2';\r
template.header.cy = y += 18*buttonRows+2;\r
template.header.style &= ~WS_VSCROLL;\r
-#if 0\r
- if(y > 300) {\r
- template.header.cx = 295;\r
- template.header.cy = 300;\r
- template.header.style |= WS_VSCROLL;\r
- }\r
-#endif\r
}\r
\r
void \r
argvCopy[j] = NULL;
argv = argvCopy;
argc = j;
-#if 0
- if(appData.debugMode,1) { // OK, appData is not initialized here yet...
- for(i=0; i<argc; i++) fprintf(stderr, "argv[%2d] = '%s'\n", i, argv[i]);
- }
-#endif
#endif
setbuf(stdout, NULL);
gameInfo.variant = StringToVariant(appData.variant);
InitPosition(FALSE);
-#if 0
- /*
- * Determine boardSize
- */
- gameInfo.boardWidth = gameInfo.boardHeight = 8; // [HGM] boardsize: make sure we start as 8x8
-
-//#ifndef IDSIZE
- // [HGM] as long as we have not created the possibility to change size while running, start with requested size
- gameInfo.boardWidth = appData.NrFiles > 0 ? appData.NrFiles : 8;
- 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
static char *xpmkind[] = { "ll", "ld", "dl", "dd" };
XpmColorSymbol symbols[4];
-#if 0
- /* Apparently some versions of Xpm don't define XpmFormat at all --tpm */
- if (appData.debugMode) {
- fprintf(stderr, "XPM Library Version: %d.%d%c\n",
- XpmFormat, XpmVersion, (char)('a' + XpmRevision - 1));
- }
-#endif
-
/* The XSynchronize calls were copied from CreatePieces.
Not sure if needed, but can't hurt */
XSynchronize(xDisplay, True); /* Work-around for xlib/xt buffering bug */
return;
}
}
- if (bits == NULL) {
-#if 0
- fprintf(stderr, _("%s: No built-in bitmap for %s; giving up\n"),
- programName, name);
- exit(1);
-#endif
- ; // [HGM] bitmaps: make it non-fatal if we have no bitmap;
- } else {
+ if (bits != NULL) {
*pm = XCreateBitmapFromData(xDisplay, xBoardWindow, (char *) bits,
wreq, hreq);
}
XtSetArg(args[j], XtNright, XtChainRight); j++;
XtSetArg(args[j], XtNresizable, True); j++;
XtSetArg(args[j], XtNwidth, bw_width); j++; /*force wider than buttons*/
-#if 0
- XtSetArg(args[j], XtNscrollVertical, XawtextScrollWhenNeeded); j++;
-#else
/* !!Work around an apparent bug in XFree86 4.0.1 (X11R6.4.3) */
XtSetArg(args[j], XtNscrollVertical, XawtextScrollAlways); j++;
-#endif
XtSetArg(args[j], XtNautoFill, True); j++;
XtSetArg(args[j], XtNwrap, XawtextWrapWord); j++;
edit =
XtSetArg(args[j], XtNleft, XtChainLeft); j++;
XtSetArg(args[j], XtNright, XtChainRight); j++;
XtSetArg(args[j], XtNresizable, True); j++;
-#if 0
- XtSetArg(args[j], XtNscrollVertical, XawtextScrollWhenNeeded); j++;
-#else
/* !!Work around an apparent bug in XFree86 4.0.1 (X11R6.4.3) */
XtSetArg(args[j], XtNscrollVertical, XawtextScrollAlways); j++;
-#endif
XtSetArg(args[j], XtNautoFill, True); j++;
XtSetArg(args[j], XtNwrap, XawtextWrapWord); j++;
edit =
args, 1);
if (appData.showButtonBar) {
-#if 0
- if (pausing) {
- XtSetArg(args[0], XtNbackground, buttonForegroundPixel);
- XtSetArg(args[1], XtNforeground, buttonBackgroundPixel);
- } else {
- XtSetArg(args[0], XtNbackground, buttonBackgroundPixel);
- XtSetArg(args[1], XtNforeground, buttonForegroundPixel);
- }
-#else
/* Always toggle, don't set. Previous code messes up when
invoked while the button is pressed, as releasing it
toggles the state again. */
XtSetArg(args[0], XtNbackground, oldfg);
XtSetArg(args[1], XtNforeground, oldbg);
}
-#endif
XtSetValues(XtNameToWidget(buttonBarWidget, PAUSE_BUTTON), args, 2);
}
}
appData.showThinking = !appData.showThinking; // [HGM] thinking: tken out of ShowThinkingEvent
ShowThinkingEvent();
-#if 0
- // [HGM] thinking: currently no suc menu item; replaced by Hide Thinking (From Human)
- if (appData.showThinking) {
- XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);
- } else {
- XtSetArg(args[0], XtNleftBitmap, None);
- }
- XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Show Thinking"),
- args, 1);
-#endif
}
void HideThinkingProc(w, event, prms, nprms)
delay.it_interval.tv_usec =
delay.it_value.tv_usec = (time % 1000) * 1000;
setitimer(ITIMER_REAL, &delay, NULL);
-#if 0
- /* Ugh -- busy-wait! --tpm */
- while (frameWaiting);
-#else
while (frameWaiting) pause();
-#endif
delay.it_interval.tv_sec = delay.it_value.tv_sec = 0;
delay.it_interval.tv_usec = delay.it_value.tv_usec = 0;
setitimer(ITIMER_REAL, &delay, NULL);
ScreenSquare(boardX, boardY, &corner, &color);
player.startSquare = corner;
player.startColor = color;
-#if 0
- /* Start from exactly where the piece is. This can be confusing
- if you start dragging far from the center of the square; most
- or all of the piece can be over a different square from the one
- the mouse pointer is in. */
- player.mouseDelta.x = x - corner.x;
- player.mouseDelta.y = y - corner.y;
-#else
/* As soon as we start dragging, the piece will jump slightly to
be centered over the mouse pointer. */
player.mouseDelta.x = squareSize/2;
player.mouseDelta.y = squareSize/2;
-#endif
/* Initialise animation */
player.dragPiece = PieceForSquare(boardX, boardY);
/* Sanity check */
XtSetArg(args[j], XtNresizable, True); j++;
XtSetArg(args[j], XtNwidth, bw_width/2); j++;
XtSetArg(args[j], XtNheight, bw_width/3); j++;
-#if 0
- XtSetArg(args[j], XtNscrollVertical, XawtextScrollWhenNeeded); j++;
-#else
/* !!Work around an apparent bug in XFree86 4.0.1 (X11R6.4.3) */
XtSetArg(args[j], XtNscrollVertical, XawtextScrollAlways); j++;
-#endif
XtSetArg(args[j], XtNautoFill, False); j++;
textw =
XtCreateManagedWidget("text", asciiTextWidgetClass, form, args, j);
XtCreateManagedWidget(_("cancel"), commandWidgetClass, form, args, j);
XtAddCallback(b_cancel, XtNcallback, callback, (XtPointer) 0);
-#if 0
- j = 0;
- XtSetArg(args[j], XtNfromVert, msgw); j++;
- XtSetArg(args[j], XtNfromHoriz, b); j++;
- XtSetArg(args[j], XtNtop, XtChainBottom); j++;
- XtSetArg(args[j], XtNbottom, XtChainBottom); j++;
- XtSetArg(args[j], XtNleft, XtChainLeft); j++;
- XtSetArg(args[j], XtNright, XtChainLeft); j++;
- b_clear = b =
- XtCreateManagedWidget("clear", commandWidgetClass, form, args, j);
- XtAddCallback(b_clear, XtNcallback, callback, (XtPointer) 0);
-#endif
} else {
j = 0;
XtSetArg(args[j], XtNfromVert, msgw); j++;
XtSetArg(args[j], XtNright, XtChainRight); j++;
XtSetArg(args[j], XtNresizable, True); j++;
XtSetArg(args[j], XtNwidth, bw_width); j++; /*force wider than buttons*/
-#if 0
- XtSetArg(args[j], XtNscrollVertical, XawtextScrollWhenNeeded); j++;
-#else
/* !!Work around an apparent bug in XFree86 4.0.1 (X11R6.4.3) */
XtSetArg(args[j], XtNscrollVertical, XawtextScrollAlways); j++;
XtSetArg(args[j], XtNscrollHorizontal, XawtextScrollWhenNeeded); j++;
-#endif
// XtSetArg(args[j], XtNautoFill, True); j++;
// XtSetArg(args[j], XtNwrap, XawtextWrapWord); j++;
outputField[which][nMemo] = edit =
Window junk;
Dimension pw_height;
Dimension ew_height;
-#if 0
- j = 0;
- XtSetArg(args[j], XtNheight, &ew_height); j++;
- XtGetValues(edit, args, j);
-
- j = 0;
- XtSetArg(args[j], XtNheight, &pw_height); j++;
- XtGetValues(shell, args, j);
- engineOutputH = pw_height + (lines - 1) * ew_height;
- engineOutputW = bw_width - 16;
-#else
engineOutputH = bw_height/2;
engineOutputW = bw_width-16;
-#endif
XSync(xDisplay, False);
#ifdef NOTDEF
return; // dummy
}
-//--------------------------- General Popup for Cloning ----------------------------------
-#if 0
-int XXXUp;
-Widget XXXShell;
-
-void XXXPopDown()
-{
- if (!XXXUp) return;
- XtPopdown(XXXShell);
- XtDestroyWidget(XXXShell);
- XXXUp = False;
- ModeHighlight();
-}
-
-void XXXCallback(w, client_data, call_data)
- Widget w;
- XtPointer client_data, call_data;
-{
- String name;
- Widget w2;
- Arg args[16];
- char buf[80];
-
- XtSetArg(args[0], XtNlabel, &name);
- XtGetValues(w, args, 1);
-
- if (strcmp(name, _("cancel")) == 0) {
- XXXPopDown();
- return;
- }
- if (strcmp(name, _("ok")) == 0) {
- int nr; String name;
- name = XawDialogGetValueString(w2 = XtParent(w));
- if(sscanf(name ,"%d",&nr) != 1) {
- sprintf(buf, "%d", appData.defaultFrcPosition);
- XtSetArg(args[0],XtNvalue, buf); // erase bad (non-numeric) value
- XtSetValues(w2, args, 1);
- return;
- }
- XXXPopDown();
- return;
- }
-}
-
-void XXXPopUp()
-{
- Arg args[16];
- Widget popup, layout, dialog, edit;
- Window root, child;
- int x, y, i;
- int win_x, win_y;
- unsigned int mask;
- char def[80];
-
- i = 0;
- XtSetArg(args[i], XtNresizable, True); i++;
- XtSetArg(args[i], XtNwidth, DIALOG_SIZE); i++;
- XXXShell = popup =
- XtCreatePopupShell(_("XXX Menu"), transientShellWidgetClass,
- shellWidget, args, i);
-
- layout =
- XtCreateManagedWidget(layoutName, formWidgetClass, popup,
- layoutArgs, XtNumber(layoutArgs));
-
- sprintf(def, "%d\n", appData.defaultFrcPosition);
- i = 0;
- XtSetArg(args[i], XtNlabel, ""); i++;
- XtSetArg(args[i], XtNvalue, def); i++;
- XtSetArg(args[i], XtNborderWidth, 0); i++;
- dialog = XtCreateManagedWidget("XXX", dialogWidgetClass,
- layout, args, i);
-
- XawDialogAddButton(dialog, _("ok"), XXXCallback, (XtPointer) dialog);
- XawDialogAddButton(dialog, _("cancel"), XXXCallback, (XtPointer) dialog);
-
- XtRealizeWidget(popup);
- CatchDeleteWindow(popup, "XXXPopDown");
-
- XQueryPointer(xDisplay, xBoardWindow, &root, &child,
- &x, &y, &win_x, &win_y, &mask);
-
- XtSetArg(args[0], XtNx, x - 10);
- XtSetArg(args[1], XtNy, y - 30);
- XtSetValues(popup, args, 2);
-
- XtPopup(popup, XtGrabExclusive);
- XXXUp = True;
-
- edit = XtNameToWidget(dialog, "*value");
-
- previous = NULL;
- SetFocus(engThreshold, popup, (XEvent*) NULL, False);
-}
-
-void XXXMenuProc(w, event, prms, nprms)
- Widget w;
- XEvent *event;
- String *prms;
- Cardinal *nprms;
-{
- XXXPopUp();
-}
-#endif
channel++;
}
channel[strlen(channel)-1] = NULLCHAR;
-#if 0
- /* Always tell to the channel (probability 90%) */
- if (strcmp(player, ics_handle) != 0 &&
- ((unsigned) random() % 10) < 9) {
- Speak("tell", channel);
- }
-#else
+
/* Tell to the channel only if someone mentions our name */
if (ZippyCalled(star_match[2])) {
Speak("tell", channel);
}
-#endif
ColorizeEx( atoi(channel) == 1 ? ColorChannel1 : ColorChannel, FALSE );
}