X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwengineo.c;h=4876a708112b13bb3158f9f6b16ff6eb6164e51d;hb=b4785979256d342c544eaca1a6644a70eb96b2e0;hp=a2d77ed6b2baa16fa7b121b45c023fc48eb840c3;hpb=91d8e5853ca580769cc130aa6ea004869118d171;p=xboard.git diff --git a/winboard/wengineo.c b/winboard/wengineo.c index a2d77ed..4876a70 100644 --- a/winboard/wengineo.c +++ b/winboard/wengineo.c @@ -3,6 +3,8 @@ * * Author: Alessandro Scotti (Dec 2005) * + * Copyright 2005 Alessandro Scotti + * * ------------------------------------------------------------------------ * * GNU XBoard is free software: you can redistribute it and/or modify @@ -32,9 +34,9 @@ #include #include "common.h" -#include "winboard.h" #include "frontend.h" #include "backend.h" +#include "winboard.h" #include "wsnap.h" @@ -59,25 +61,8 @@ HICON icons[8]; // [HGM] this front-end array translates back-end icon indicator HWND outputField[2][7]; // [HGM] front-end array to translate output field to window handle -void EngineOutputPopUp(); -void EngineOutputPopDown(); -int EngineOutputIsUp(); - #define SHOW_PONDERING -/* Imports from backend.c */ -char * SavePart(char *str); -extern int opponentKibitzes; - -/* Imports from winboard.c */ -extern HWND engineOutputDialog; -extern int engineOutputDialogUp; - -extern HINSTANCE hInst; -extern HWND hwndMain; - -extern WindowPlacement wpEngineOutput; - /* Module variables */ #define H_MARGIN 2 #define V_MARGIN 2 @@ -93,12 +78,11 @@ extern WindowPlacement wpEngineOutput; #define STATE_ANALYZING 3 static int windowMode = 1; - static int needInit = TRUE; - static int lastDepth[2] = { -1, -1 }; static int lastForwardMostMove[2] = { -1, -1 }; static int engineState[2] = { -1, -1 }; +static BOOLEAN engineOutputDialogUp = FALSE; typedef struct { // HWND hColorIcon; // [HGM] the output-control handles are no loger passed, @@ -119,9 +103,9 @@ typedef struct { int an_move_count; } EngineOutputData; -static VerifyDisplayMode(); +static void VerifyDisplayMode(); static void UpdateControls( EngineOutputData * ed ); -static SetEngineState( int which, int state, char * state_data ); +static void SetEngineState( int which, int state, char * state_data ); // front end static HICON LoadIconEx( int id ) @@ -248,9 +232,9 @@ static void ResizeWindowControls( HWND hDlg, int mode ) { RECT rc; int headerHeight = GetHeaderHeight(); - int labelHeight = GetControlHeight( hDlg, IDC_EngineLabel1 ); - int labelOffset = H_MARGIN + ICON_SIZE + H_MARGIN; - int labelDeltaY = ICON_SIZE - labelHeight; +// int labelHeight = GetControlHeight( hDlg, IDC_EngineLabel1 ); +// int labelOffset = H_MARGIN + ICON_SIZE + H_MARGIN; +// int labelDeltaY = ICON_SIZE - labelHeight; int clientWidth; int clientHeight; int maxControlWidth; @@ -339,6 +323,10 @@ LRESULT CALLBACK EngineOutputProc( HWND hDlg, UINT message, WPARAM wParam, LPARA ResizeWindowControls( hDlg, windowMode ); + /* Set font */ + SendDlgItemMessage( engineOutputDialog, IDC_EngineMemo1, WM_SETFONT, (WPARAM)font[boardSize][MOVEHISTORY_FONT]->hf, MAKELPARAM(TRUE, 0 )); + SendDlgItemMessage( engineOutputDialog, IDC_EngineMemo2, WM_SETFONT, (WPARAM)font[boardSize][MOVEHISTORY_FONT]->hf, MAKELPARAM(TRUE, 0 )); + SetEngineState( 0, STATE_IDLE, "" ); SetEngineState( 1, STATE_IDLE, "" ); } @@ -448,7 +436,7 @@ void DoClearMemo(int which) // back end, due to front-end wrapper for SetWindowText, and new SetIcon arguments -static SetEngineState( int which, int state, char * state_data ) +static void SetEngineState( int which, int state, char * state_data ) { int x_which = 1 - which; @@ -539,7 +527,7 @@ void EngineOutputUpdate( FrontEndProgramStats * stats ) if( clearMemo ) DoClearMemo(which); /* Update */ - lastDepth[which] = depth; + lastDepth[which] = depth == 1 && ed.nodes == 0 ? 0 : depth; // [HGM] info-line kudge lastForwardMostMove[which] = forwardMostMove; if( ed.pv != 0 && ed.pv[0] == ' ' ) { @@ -581,6 +569,7 @@ char GetEngineColor( int which ) result = cps->twoMachinesColor[0]; result = result == 'w' ? ENGINE_COLOR_WHITE : ENGINE_COLOR_BLACK; break; + default: ; // does not happen, but suppresses pedantic warnings } } @@ -618,6 +607,7 @@ static int IsEnginePondering( int which ) if( GetEngineColor( which ) != GetActiveEngineColor() ) result = TRUE; } break; + default: ; // does not happen, but suppresses pedantic warnings } return result; @@ -634,7 +624,7 @@ static void SetDisplayMode( int mode ) } // pure back end -static VerifyDisplayMode() +static void VerifyDisplayMode() { int mode; @@ -684,7 +674,7 @@ static void SetEngineColorIcon( int which ) // pure back end, now SetWindowText is called via wrapper DoSetWindowText static void UpdateControls( EngineOutputData * ed ) { - int isPondering = FALSE; +// int isPondering = FALSE; char s_label[MAX_NAME_LENGTH + 32]; @@ -727,7 +717,7 @@ static void UpdateControls( EngineOutputData * ed ) SetEngineState( ed->which, STATE_THINKING, "" ); } else if( gameMode == AnalyzeMode || gameMode == AnalyzeFile - || gameMode == IcsObserving && appData.icsEngineAnalyze) { // [HGM] ICS-analyze + || (gameMode == IcsObserving && appData.icsEngineAnalyze)) { // [HGM] ICS-analyze char buf[64]; int time_secs = ed->time / 100; int time_mins = time_secs / 60; @@ -797,7 +787,8 @@ static void UpdateControls( EngineOutputData * ed ) sprintf( s_time, "%d:%02d.%02d", time_secs / 60, time_secs % 60, time_cent ); /* Put all together... */ - sprintf( buf, "%3d\t%s\t%s\t%s\t", ed->depth, s_score, s_nodes, s_time ); + if(ed->nodes == 0 && ed->score == 0 && ed->time == 0) sprintf( buf, "%3d\t", ed->depth ); else + sprintf( buf, "%3d\t%s\t%s\t%s\t", ed->depth, s_score, s_nodes, s_time ); /* Add PV */ buflen = strlen(buf);