From 18c97517acda747ffe9d9177c61c9bf5b1195bb6 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Sat, 10 Oct 2009 08:55:21 -0700 Subject: [PATCH] cleanup: removed "#if 0" from source a bit of cleanup of the source code --- backend.c | 277 ++++++++++--------------------------------------- moves.c | 21 ---- winboard/jaws.c | 10 -- winboard/wchat.c | 5 +- winboard/wclipbrd.c | 9 -- winboard/wevalgraph.c | 32 ------ winboard/winboard.c | 158 +--------------------------- winboard/woptions.c | 45 -------- winboard/wsettings.c | 131 ----------------------- xboard.c | 77 +-------------- xedittags.c | 16 --- xengineoutput.c | 16 --- xoptions.c | 104 ------------------ zippy.c | 9 +-- 14 files changed, 60 insertions(+), 850 deletions(-) diff --git a/backend.c b/backend.c index a612db1..a17d11d 100644 --- a/backend.c +++ b/backend.c @@ -299,26 +299,6 @@ static char * safeStrCpy( char * dst, const char * src, size_t count ) 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: @@ -831,20 +811,9 @@ InitBackEnd1() 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) { @@ -1010,71 +979,58 @@ ParseTimeControl(tc, ti, mps) 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 @@ -2029,17 +1985,7 @@ VariantSwitch(Board board, VariantClass newVariant) 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= 0 || castlingRights[k][1] >= 0) ) @@ -6005,16 +5907,6 @@ if(appData.debugMode) fprintf(debugFP, "nodes = %d, %lld\n", (int) programStats. castlingRights[forwardMostMove][4] != castlingRights[k][4] ) rights++; } -#if 0 - if (appData.debugMode) { - for(i=0; i appData.drawRepeats-2 && appData.drawRepeats > 1) { /* adjudicate after user-specified nr of repeats */ @@ -6366,16 +6258,6 @@ if(appData.debugMode) fprintf(debugFP, "nodes = %d, %lld\n", (int) programStats. 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 @@ -6636,13 +6518,6 @@ if(appData.debugMode) fprintf(debugFP, "nodes = %d, %lld\n", (int) programStats. /* [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) { @@ -9380,26 +9255,8 @@ LoadPosition(f, positionNumber, title) 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--; @@ -9718,17 +9575,7 @@ SaveGamePGN(f) /* 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) { @@ -10307,24 +10154,10 @@ ExitEvent(status) 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; diff --git a/moves.c b/moves.c index b4572fe..59700b7 100644 --- a/moves.c +++ b/moves.c @@ -1252,24 +1252,10 @@ void Disambiguate(board, flags, epfile, closure) /* [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 || @@ -1303,13 +1289,6 @@ void Disambiguate(board, flags, epfile, closure) 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); diff --git a/winboard/jaws.c b/winboard/jaws.c index 9d8ec9c..8aad901 100644 --- a/winboard/jaws.c +++ b/winboard/jaws.c @@ -83,16 +83,6 @@ extern long whiteTimeRemaining, blackTimeRemaining, timeControl, timeIncrement; -#if 0 -// from moves.h, but no longer needed, as the new routines are all moved to winboard.c - -extern char* PieceToName P((ChessSquare p, int i)); -extern char* SquareToChar P((int Xpos)); -extern char* SquareToNum P((int Ypos)); -extern int CoordToNum P((char c)); - -#endif - // from moves.c, added WinBoard_F piece types and ranks / files char *squareToChar[] = { "ay", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l" }; diff --git a/winboard/wchat.c b/winboard/wchat.c index a837a86..db9ebf1 100644 --- a/winboard/wchat.c +++ b/winboard/wchat.c @@ -99,9 +99,7 @@ static void ResizeWindowControls( HWND hDlg ) int clientHeight; int maxControlWidth; int buttonWidth, buttonHeight; -#if 0 -} -#else + /* Initialize variables */ GetClientRect( hDlg, &rc ); @@ -121,7 +119,6 @@ static void ResizeWindowControls( HWND hDlg ) // InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo1), NULL, FALSE ); // InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo2), NULL, FALSE ); } -#endif // front end. Actual printing of PV lines into the output field static void InsertIntoMemo( HANDLE hDlg, char * text ) diff --git a/winboard/wclipbrd.c b/winboard/wclipbrd.c index 4d0fac9..b9514bb 100644 --- a/winboard/wclipbrd.c +++ b/winboard/wclipbrd.c @@ -300,17 +300,8 @@ VOID PasteGameOrFENFromClipboard() return; } -#if 0 - tmp = buf; - while( *tmp == ' ' || *tmp == '\t' || *tmp == '\r' || *tmp == '\n' ) { - tmp++; - } - - if( *tmp == '[' ) { -#else // [HGM] paste any: make still smarter, to allow pasting of games without tags, recognize FEN in stead if(!ParseFEN(dummyBoard, &dummy, buf) ) { -#endif PasteGameFromString( buf ); } else { diff --git a/winboard/wevalgraph.c b/winboard/wevalgraph.c index 420e798..be51991 100644 --- a/winboard/wevalgraph.c +++ b/winboard/wevalgraph.c @@ -565,38 +565,6 @@ LRESULT CALLBACK EvalGraphProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM l break; /* Support for captionless window */ -#if 0 - case WM_NCLBUTTONDBLCLK: - if( wParam == HTCAPTION ) { - int index; - POINT mouse_xy; - POINTS pts = MAKEPOINTS(lParam); - - mouse_xy.x = pts.x; - mouse_xy.y = pts.y; - ScreenToClient( hDlg, &mouse_xy ); - - index = GetMoveIndexFromPoint( mouse_xy.x, mouse_xy.y ); - - if( index >= 0 && index < currLast ) { - ToNrEvent( index + 1 ); - } - } - break; - - case WM_NCHITTEST: - { - LRESULT res = DefWindowProc( hDlg, message, wParam, lParam ); - - if( res == HTCLIENT ) res = HTCAPTION; - - SetWindowLong( hDlg, DWL_MSGRESULT, res ); - - return TRUE; - } - break; -#endif - case WM_CLOSE: EvalGraphPopDown(); break; diff --git a/winboard/winboard.c b/winboard/winboard.c index 99f95ba..c7aebcf 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -1105,10 +1105,6 @@ ArgDescriptor argDescriptors[] = { { "autoraise", ArgTrue, (LPVOID) &appData.autoRaiseBoard, FALSE }, { "xautoraise", ArgFalse, (LPVOID) &appData.autoRaiseBoard, FALSE }, { "-autoraise", ArgFalse, (LPVOID) &appData.autoRaiseBoard, FALSE }, -#if 0 - { "cmailGameName", ArgString, (LPVOID) &appData.cmailGameName, FALSE }, - { "cmail", ArgString, (LPVOID) &appData.cmailGameName, FALSE }, -#endif { "alwaysPromoteToQueen", ArgBoolean, (LPVOID) &appData.alwaysPromoteToQueen, TRUE }, { "queen", ArgTrue, (LPVOID) &appData.alwaysPromoteToQueen, FALSE }, { "xqueen", ArgFalse, (LPVOID) &appData.alwaysPromoteToQueen, FALSE }, @@ -3040,57 +3036,10 @@ void CreatePiecesFromFont() /* Create bitmaps */ hfont_old = SelectObject( hdc, hPieceFont ); -#if 0 - CreatePieceMaskFromFont( hdc_window, hdc, PM_WP ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WN ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WB ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WR ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WQ ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WK ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BP ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BN ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BB ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BR ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BQ ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BK ); - - CreatePieceMaskFromFont( hdc_window, hdc, PM_WA ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WC ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WF ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WH ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WE ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WW ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WU ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WO ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WG ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WM ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WSG ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WV ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WAB ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WD ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WL ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_WS ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BA ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BC ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BF ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BH ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BE ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BW ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BU ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BO ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BG ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BM ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BSG ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BV ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BAB ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BD ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BL ); - CreatePieceMaskFromFont( hdc_window, hdc, PM_BS ); -#else for(i=(int)WhitePawn; i<(int)EmptySquare; i++) /* [HGM] made a loop for this */ if(PieceToChar((ChessSquare)i) != '.') /* skip unused pieces */ CreatePieceMaskFromFont( hdc_window, hdc, i ); -#endif + SelectObject( hdc, hfont_old ); fontBitmapSquareSize = squareSize; @@ -3886,35 +3835,13 @@ DrawPieceOnDC(HDC hdc, ChessSquare piece, int color, int sqcolor, int x, int y, StretchBlt(hdc, x+tmpSize, y+tmpSize, -tmpSize, -tmpSize, tmphdc, 0, 0, tmpSize, tmpSize, 0x00B8074A); else BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A); -#if 0 - /* Use black piece color for outline of white pieces */ - /* Not sure this looks really good (though xboard does it). - Maybe better to have another selectable color, default black */ - SelectObject(hdc, blackPieceBrush); /* could have own brush */ - SelectObject(tmphdc, PieceBitmap(piece, OUTLINE_PIECE)); - BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A); -#else /* Use black for outline of white pieces */ SelectObject(tmphdc, PieceBitmap(piece, OUTLINE_PIECE)); if(appData.upsideDown && color==flipView) StretchBlt(hdc, x+tmpSize, y+tmpSize, -tmpSize, -tmpSize, tmphdc, 0, 0, tmpSize, tmpSize, SRCAND); else BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, SRCAND); -#endif } else { -#if 0 - /* Use white piece color for details of black pieces */ - /* Requires filled-in solid bitmaps (BLACK_PIECE class); the - WHITE_PIECE ones aren't always the right shape. */ - /* Not sure this looks really good (though xboard does it). - Maybe better to have another selectable color, default medium gray? */ - oldBitmap = SelectObject(tmphdc, PieceBitmap(piece, BLACK_PIECE)); - oldBrush = SelectObject(hdc, whitePieceBrush); /* could have own brush */ - BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A); - SelectObject(tmphdc, PieceBitmap(piece, SOLID_PIECE)); - SelectObject(hdc, blackPieceBrush); - BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A); -#else /* Use square color for details of black pieces */ oldBitmap = SelectObject(tmphdc, PieceBitmap(piece, SOLID_PIECE)); oldBrush = SelectObject(hdc, blackPieceBrush); @@ -3922,7 +3849,6 @@ DrawPieceOnDC(HDC hdc, ChessSquare piece, int color, int sqcolor, int x, int y, StretchBlt(hdc, x+tmpSize, y+tmpSize, -tmpSize, -tmpSize, tmphdc, 0, 0, tmpSize, tmpSize, 0x00B8074A); else BitBlt(hdc, x, y, tmpSize, tmpSize, tmphdc, 0, 0, 0x00B8074A); -#endif } SelectObject(hdc, oldBrush); SelectObject(tmphdc, oldBitmap); @@ -4459,17 +4385,6 @@ HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board) fullrepaint = TRUE; } -#if 0 - if( fullrepaint ) { - static int repaint_count = 0; - char buf[128]; - - repaint_count++; - sprintf( buf, "FULL repaint: %d\n", repaint_count ); - OutputDebugString( buf ); - } -#endif - if (board == NULL) { if (!lastReqValid) { return; @@ -4499,35 +4414,6 @@ HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board) releaseDC = FALSE; } -#if 0 - fprintf(debugFP, "*******************************\n" - "repaint = %s\n" - "dragInfo.from (%d,%d)\n" - "dragInfo.start (%d,%d)\n" - "dragInfo.pos (%d,%d)\n" - "dragInfo.lastpos (%d,%d)\n", - repaint ? "TRUE" : "FALSE", - dragInfo.from.x, dragInfo.from.y, - dragInfo.start.x, dragInfo.start.y, - dragInfo.pos.x, dragInfo.pos.y, - dragInfo.lastpos.x, dragInfo.lastpos.y); - fprintf(debugFP, "prev: "); - for (row = 0; row < BOARD_HEIGHT; row++) { - for (column = 0; column < BOARD_WIDTH; column++) { - fprintf(debugFP, "%d ", lastDrawn[row][column]); - } - } - fprintf(debugFP, "\n"); - fprintf(debugFP, "board: "); - for (row = 0; row < BOARD_HEIGHT; row++) { - for (column = 0; column < BOARD_WIDTH; column++) { - fprintf(debugFP, "%d ", board[row][column]); - } - } - fprintf(debugFP, "\n"); - fflush(debugFP); -#endif - /* Create some work-DCs */ hdcmem = CreateCompatibleDC(hdc); tmphdc = CreateCompatibleDC(hdc); @@ -5356,16 +5242,6 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) else MenuPopup(hwnd, pt, LoadMenu(hInst, "WhitePieceMenu"), -1); } else { /* message == WM_RBUTTONDOWN */ -#if 0 - if (buttonCount == 3) { - if (wParam & MK_SHIFT) - MenuPopup(hwnd, pt, LoadMenu(hInst, "WhitePieceMenu"), -1); - else - MenuPopup(hwnd, pt, LoadMenu(hInst, "BlackPieceMenu"), -1); - } else { - MenuPopup(hwnd, pt, LoadMenu(hInst, "PieceMenu"), -1); - } -#else /* Just have one menu, on the right button. Windows users don't think to try the middle one, and sometimes other software steals it, or it doesn't really exist. */ @@ -5373,7 +5249,6 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) MenuPopup(hwnd, pt, LoadMenu(hInst, "PieceMenu"), -1); else MenuPopup(hwnd, pt, LoadMenu(hInst, "ShogiPieceMenu"), -1); -#endif } break; case IcsPlayingWhite: @@ -5698,11 +5573,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) nnew = RealizePalette(hdc); if (nnew > 0) { paletteChanged = TRUE; -#if 0 - UpdateColors(hdc); -#else - InvalidateRect(hwnd, &boardRect, FALSE);/*faster!*/ -#endif + InvalidateRect(hwnd, &boardRect, FALSE); } ReleaseDC(hwnd, hdc); } @@ -6739,13 +6610,6 @@ MyPlaySound(MySound *ms) /* Don't print an error: this can happen innocently if the sound driver is busy; for instance, if another instance of WinBoard is playing a sound at about the same time. */ -#if 0 - if (!ok) { - char buf[MSG_SIZ]; - sprintf(buf, "Error playing sound %s", ms->name); - DisplayError(buf, GetLastError()); - } -#endif return ok; } @@ -11036,15 +10900,6 @@ Tween(start, mid, finish, factor, frames, nFrames) void HistorySet( char movelist[][2*MOVE_LEN], int first, int last, int current ) { -#if 0 - char buf[256]; - - sprintf( buf, "HistorySet: first=%d, last=%d, current=%d (%s)\n", - first, last, current, current >= 0 ? movelist[current] : "n/a" ); - - OutputDebugString( buf ); -#endif - MoveHistorySet( movelist, first, last, current, pvInfoList ); EvalGraphSet( first, last, current, pvInfoList ); @@ -11052,14 +10907,5 @@ HistorySet( char movelist[][2*MOVE_LEN], int first, int last, int current ) void SetProgramStats( FrontEndProgramStats * stats ) { -#if 0 - char buf[1024]; - - sprintf( buf, "SetStats for %d: depth=%d, nodes=%lu, score=%5.2f, time=%5.2f, pv=%s\n", - stats->which, stats->depth, stats->nodes, stats->score / 100.0, stats->time / 100.0, stats->pv == 0 ? "n/a" : stats->pv ); - - OutputDebugString( buf ); -#endif - EngineOutputUpdate( stats ); } diff --git a/winboard/woptions.c b/winboard/woptions.c index 60b8fd1..46f0e4b 100644 --- a/winboard/woptions.c +++ b/winboard/woptions.c @@ -223,12 +223,8 @@ GeneralOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) 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); @@ -373,38 +369,16 @@ PaintSampleSquare( 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); @@ -1490,21 +1464,6 @@ SetSampleFontText(HWND hwnd, int id, const MyFont *mf) 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; @@ -2795,12 +2754,8 @@ LRESULT CALLBACK EnginePlayOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, 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); diff --git a/winboard/wsettings.c b/winboard/wsettings.c index 257fcd2..2992165 100644 --- a/winboard/wsettings.c +++ b/winboard/wsettings.c @@ -195,13 +195,6 @@ DesignOptionDialog(ChessProgramState *cps) LayoutOptions(k, k+groupSize, buf, cps->option); // flush the group boxList[groups++] = layout; // group end in odd entries k = n = k + groupSize; -#if 0 - } else { - // try to recognize "two-column groups" based on option suffix - int j = 1; - while((p = EndMatch(cps->option[k].name, EndMatch(cps->option[k+2*j].name)) && - (q = EndMatch(cps->option[k+1].name, EndMatch(cps->option[k+2*j+1].name)) ) j++; -#endif } else k += groupSize; // small groups are grouped with the solitary options } if(n != k) LayoutOptions(n, k, "", cps->option); // flush remaining solitary options @@ -433,123 +426,6 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa return FALSE; } -#if 0 -// example copied from MS docs -#define ID_HELP 150 -#define ID_TEXT 200 - -LPWORD lpwAlign(LPWORD lpIn) -{ - ULONG ul; - - ul = (ULONG)lpIn; - ul ++; - ul >>=1; - ul <<=1; - return (LPWORD)ul; -} - -LRESULT DisplayMyMessage(HINSTANCE hinst, HWND hwndOwner, LPSTR lpszMessage) -{ - HGLOBAL hgbl; - LPDLGTEMPLATE lpdt; - LPDLGITEMTEMPLATE lpdit; - LPWORD lpw; - LPWSTR lpwsz; - LRESULT ret; - int nchar; - - hgbl = GlobalAlloc(GMEM_ZEROINIT, 1024); - if (!hgbl) - return -1; - - lpdt = (LPDLGTEMPLATE)GlobalLock(hgbl); - - // Define a dialog box. - - lpdt->style = WS_POPUP | WS_BORDER | WS_SYSMENU | DS_MODALFRAME | WS_CAPTION; -// WS_POPUP | WS_SYSMENU | DS_MODALFRAME | WS_CAPTION | DS_SETFONT - lpdt->cdit = 3; // Number of controls - lpdt->x = 10; lpdt->y = 10; - lpdt->cx = 100; lpdt->cy = 100; - - lpw = (LPWORD)(lpdt + 1); - *lpw++ = 0; // No menu - *lpw++ = 0; // Predefined dialog box class (by default) - - lpwsz = (LPWSTR)lpw; - nchar = 1 + MultiByteToWideChar(CP_ACP, 0, "My Dialog", -1, lpwsz, 50); - lpw += nchar; - - //----------------------- - // Define an OK button. - //----------------------- - lpw = lpwAlign(lpw); // Align DLGITEMTEMPLATE on DWORD boundary - lpdit = (LPDLGITEMTEMPLATE)lpw; - lpdit->x = 10; lpdit->y = 70; - lpdit->cx = 80; lpdit->cy = 20; - lpdit->id = IDOK; // OK button identifier - lpdit->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON; - - lpw = (LPWORD)(lpdit + 1); - *lpw++ = 0xFFFF; - *lpw++ = 0x0080; // Button class - - lpwsz = (LPWSTR)lpw; - nchar = 1 + MultiByteToWideChar(CP_ACP, 0, "OK", -1, lpwsz, 50); - lpw += nchar; - lpw = lpwAlign(lpw); // Align creation data on DWORD boundary - *lpw++ = 0; // No creation data - - //----------------------- - // Define a Help button. - //----------------------- - lpw = lpwAlign(lpw); // Align DLGITEMTEMPLATE on DWORD boundary - lpdit = (LPDLGITEMTEMPLATE)lpw; - lpdit->x = 55; lpdit->y = 10; - lpdit->cx = 40; lpdit->cy = 20; - lpdit->id = ID_HELP; // Help button identifier - lpdit->style = WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON; - - lpw = (LPWORD)(lpdit + 1); - *lpw++ = 0xFFFF; - *lpw++ = 0x0080; // Button class atom - - lpwsz = (LPWSTR)lpw; - nchar = 1 + MultiByteToWideChar(CP_ACP, 0, "Help", -1, lpwsz, 50); - lpw += nchar; - lpw = lpwAlign(lpw); // Align creation data on DWORD boundary - *lpw++ = 0; // No creation data - - //----------------------- - // Define a static text control. - //----------------------- - lpw = lpwAlign(lpw); // Align DLGITEMTEMPLATE on DWORD boundary - lpdit = (LPDLGITEMTEMPLATE)lpw; - lpdit->x = 10; lpdit->y = 10; - lpdit->cx = 40; lpdit->cy = 20; - lpdit->id = ID_TEXT; // Text identifier - lpdit->style = WS_CHILD | WS_VISIBLE | SS_LEFT; - - lpw = (LPWORD)(lpdit + 1); - *lpw++ = 0xFFFF; - *lpw++ = 0x0082; // Static class - - for (lpwsz = (LPWSTR)lpw; *lpwsz++ = (WCHAR)*lpszMessage++;); - lpw = (LPWORD)lpwsz; - lpw = lpwAlign(lpw); // Align creation data on DWORD boundary - *lpw++ = 0; // No creation data - - GlobalUnlock(hgbl); - ret = DialogBoxIndirect(hinst, - (LPDLGTEMPLATE)hgbl, - hwndOwner, - (DLGPROC)DialogProc); - GlobalFree(hgbl); - return ret; -} -#endif - void AddControl(int x, int y, int w, int h, int type, int style, int n) { int i; @@ -648,13 +524,6 @@ CreateDialogTemplate(int *layoutList, int nr, ChessProgramState *cps) template.title[8] = cps == &first ? '1' : '2'; template.header.cy = y += 18*buttonRows+2; template.header.style &= ~WS_VSCROLL; -#if 0 - if(y > 300) { - template.header.cx = 295; - template.header.cy = 300; - template.header.style |= WS_VSCROLL; - } -#endif } void diff --git a/xboard.c b/xboard.c index 79b61a2..3fbb9c4 100644 --- a/xboard.c +++ b/xboard.c @@ -2392,11 +2392,6 @@ main(argc, argv) argvCopy[j] = NULL; argv = argvCopy; argc = j; -#if 0 - if(appData.debugMode,1) { // OK, appData is not initialized here yet... - for(i=0; i 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 @@ -3918,14 +3900,6 @@ void CreateXPMPieces() 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 */ @@ -4155,14 +4129,7 @@ void ReadBitmap(pm, name, bits, wreq, hreq) 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); } @@ -5377,12 +5344,8 @@ Widget CommentCreate(name, text, mutable, callback, lines) 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 = @@ -5535,12 +5498,8 @@ Widget MiscCreate(name, text, mutable, callback, lines) 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 = @@ -6279,15 +6238,6 @@ void ModeHighlight() 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. */ @@ -6300,7 +6250,6 @@ void ModeHighlight() XtSetArg(args[0], XtNbackground, oldfg); XtSetArg(args[1], XtNforeground, oldbg); } -#endif XtSetValues(XtNameToWidget(buttonBarWidget, PAUSE_BUTTON), args, 2); } } @@ -7545,16 +7494,6 @@ void ShowThinkingProc(w, event, prms, nprms) 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) @@ -8985,12 +8924,7 @@ FrameDelay (time) 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); @@ -9439,19 +9373,10 @@ DragPieceBegin(x, y) 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 */ diff --git a/xedittags.c b/xedittags.c index d4c3dbe..63be84e 100644 --- a/xedittags.c +++ b/xedittags.c @@ -205,12 +205,8 @@ Widget TagsCreate(name, text, msg, mutable, callback) 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); @@ -252,18 +248,6 @@ Widget TagsCreate(name, text, msg, mutable, callback) 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++; diff --git a/xengineoutput.c b/xengineoutput.c index 6c640ea..455453d 100644 --- a/xengineoutput.c +++ b/xengineoutput.c @@ -349,13 +349,9 @@ void PositionControlSet(which, form, bw_width) 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 = @@ -417,20 +413,8 @@ Widget EngineOutputCreate(name, text) 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 diff --git a/xoptions.c b/xoptions.c index 9bbd805..969a97d 100644 --- a/xoptions.c +++ b/xoptions.c @@ -1655,107 +1655,3 @@ void OutputChatMessage(int partner, char *mess) 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 diff --git a/zippy.c b/zippy.c index 5626092..2900a24 100644 --- a/zippy.c +++ b/zippy.c @@ -680,18 +680,11 @@ int ZippyConverse(buf, i) 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 ); } -- 1.7.0.4