From 2eff6e6600cef28c3b915205dbd75e63b3cd641e Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 7 Jul 2011 18:50:56 +0200 Subject: [PATCH] Display score/depth in Eval Graph title No longer print it in the comment window. --- backend.c | 10 ---------- evalgraph.c | 13 +++++++++++++ evalgraph.h | 1 + winboard/wevalgraph.c | 1 + xevalgraph.c | 4 +++- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/backend.c b/backend.c index eaaa87a..21562ab 100644 --- a/backend.c +++ b/backend.c @@ -15211,8 +15211,6 @@ DisplayComment(moveNumber, text) char *text; { char title[MSG_SIZ]; - char buf[8000]; // comment can be long! - int score, depth; if (moveNumber < 0 || parseList[moveNumber][0] == NULLCHAR) { safeStrCpy(title, "Comment", sizeof(title)/sizeof(title[0])); @@ -15221,14 +15219,6 @@ DisplayComment(moveNumber, text) WhiteOnMove(moveNumber) ? " " : ".. ", parseList[moveNumber]); } - // [HGM] PV info: display PV info together with (or as) comment - if(moveNumber >= 0 && (depth = pvInfoList[moveNumber].depth) > 0) { - if(text == NULL) text = ""; - score = pvInfoList[moveNumber].score; - snprintf(buf,sizeof(buf)/sizeof(buf[0]), "%s%.2f/%d %d\n%s", score>0 ? "+" : "", score/100., - depth, (pvInfoList[moveNumber].time+50)/100, text); - text = buf; - } if (text != NULL && (appData.autoDisplayComment || commentUp)) CommentPopUp(title, text); } diff --git a/evalgraph.c b/evalgraph.c index 501d2fb..1380276 100644 --- a/evalgraph.c +++ b/evalgraph.c @@ -85,6 +85,19 @@ static int GetPvScore( int index ) return score; } +char* MakeEvalTitle( char * title) +{ + int score = currPvInfo[ currCurrent ].score; + int depth = currPvInfo[ currCurrent ].depth; + static char buf[MSG_SIZ]; + + if( depth <=0 ) return title; + if( currCurrent & 1 ) score = -score; /* Flip score for black */ + snprintf(buf, MSG_SIZ, "%s {%s%.2f/%-2d %d}", title, score>0 ? "+" : " ", score/100., depth, (currPvInfo[currCurrent].time+50)/100); + + return buf; +} + // back-end /* For a centipawn value, this function returns the height of the corresponding diff --git a/evalgraph.h b/evalgraph.h index cb82885..bffc1ca 100644 --- a/evalgraph.h +++ b/evalgraph.h @@ -57,4 +57,5 @@ void DrawEvalText(char *buf, int cbBuf, int y); // calls of front-end part into back-end part extern int GetMoveIndexFromPoint( int x, int y ); extern void PaintEvalGraph( void ); +extern char *MakeEvalTitle( char *title ); diff --git a/winboard/wevalgraph.c b/winboard/wevalgraph.c index bca5b95..315be9f 100644 --- a/winboard/wevalgraph.c +++ b/winboard/wevalgraph.c @@ -154,6 +154,7 @@ static VOID DisplayEvalGraph( HWND hWnd, HDC hDC ) // back-end painting; calls back front-end primitives for lines, rectangles and text PaintEvalGraph(); + SetWindowText(hWnd, MakeEvalTitle(T_("Evaluation Graph"))); /* Copy bitmap into destination DC */ BitBlt( hDC, 0, 0, nWidthPB, nHeightPB, hdcPB, 0, 0, SRCCOPY ); diff --git a/xevalgraph.c b/xevalgraph.c index 79e38d6..cb7dbe3 100644 --- a/xevalgraph.c +++ b/xevalgraph.c @@ -92,6 +92,7 @@ extern char *getenv(); Pixmap icons[8]; // [HGM] this front-end array translates back-end icon indicator to handle Widget outputField[2][7]; // [HGM] front-end array to translate output field to window handle +static char *title = N_("Evaluation graph"); //extern WindowPlacement wpEvalGraph; @@ -198,6 +199,8 @@ static void DisplayEvalGraph() // back-end painting; calls back front-end primitives for lines, rectangles and text PaintEvalGraph(); + XtSetArg(args[0], XtNtitle, MakeEvalTitle(_(title))); j++; + XtSetValues(evalGraphShell, args, 1); XSync(yDisplay, False); } @@ -343,7 +346,6 @@ EvalGraphPopUp() Arg args[16]; int j; static int needInit = TRUE; - static char *title = N_("Evaluation graph"); if (evalGraphShell == NULL) { -- 1.7.0.4