From 55d82733a8c6a6e29280bb6413fb2037cbcd381b Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sat, 9 Jul 2011 13:28:08 +0200 Subject: [PATCH] Improve Eval Graph with -evalZoom and -evalThreshold The score range between -1 and +1 can now be blown up by a factor specified through -evalZoom. The threshold below which histogram bars are no longer printed (wich used to e hard-coded 25 centi-Pawn) can now be set through the -evalThreshold option. --- args.h | 2 ++ common.h | 2 ++ evalgraph.c | 8 +++++--- xoptions.c | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/args.h b/args.h index fbf2651..61da040 100644 --- a/args.h +++ b/args.h @@ -623,6 +623,8 @@ ArgDescriptor argDescriptors[] = { { "sn", ArgString, (void *) &appData.pgnName[1], FALSE, INVALID }, { "absoluteAnalysisScores", ArgBoolean, (void *) &appData.whitePOV, TRUE, FALSE }, { "scoreWhite", ArgBoolean, (void *) &appData.scoreWhite, TRUE, FALSE }, + { "evalZoom", ArgInt, (void *) &appData.zoom, TRUE, (ArgIniType) 1 }, + { "evalThreshold", ArgInt, (void *) &appData.evalThreshold, TRUE, (ArgIniType) 25 }, { "fSAN", ArgTrue, (void *) &appData.pvSAN[0], FALSE, FALSE }, { "sSAN", ArgTrue, (void *) &appData.pvSAN[1], FALSE, FALSE }, { "pairingEngine", ArgFilename, (void *) &appData.pairingEngine, TRUE, "" }, diff --git a/common.h b/common.h index 17feddb..2b5b684 100644 --- a/common.h +++ b/common.h @@ -645,6 +645,8 @@ typedef struct { Boolean useInternalWrap; /* use internal wrapping -- noJoin usurps this if set */ Boolean pasteSelection; /* paste X selection instead of clipboard */ int nrVariations; /* [HGM] multivar */ + int zoom; /* [HGM] evalGraph */ + int evalThreshold; /* [HGM] evalGraph */ Boolean dropMenu; /* [HGM] pv */ Boolean markers; /* [HGM] markers */ Boolean pieceMenu; diff --git a/evalgraph.c b/evalgraph.c index 1380276..a24ba02 100644 --- a/evalgraph.c +++ b/evalgraph.c @@ -109,8 +109,10 @@ static int GetValueY( int value ) { if( value < -range*700 ) value = -range*700; if( value > +range*700 ) value = +range*700; - - return (nHeightPB / 2) - (int)(value * (nHeightPB - 2*MarginH) / (1400.*range)); + if(value > 100*range) value += appData.zoom * 100 - 100*range; else + if(value < -100*range) value -= appData.zoom * 100 - 100*range; else + value *= appData.zoom; + return (nHeightPB / 2) - (int)(value * (nHeightPB - 2*MarginH) / ((1200. + 200.*appData.zoom)*range)); } // the brush selection is made part of the DrawLine, by passing a style argument @@ -159,7 +161,7 @@ static void DrawHistogram( int x, int y, int width, int value, int side ) { int left, top, right, bottom; - if( value > -25 && value < +25 ) return; + if( value > -appData.evalThreshold*range && value < +appData.evalThreshold*range ) return; left = x; right = left + width + 1; diff --git a/xoptions.c b/xoptions.c index cd761d4..7e7eed8 100644 --- a/xoptions.c +++ b/xoptions.c @@ -390,6 +390,7 @@ Option generalOptions[] = { { 0, 0, 10, NULL, (void*) &appData.flashCount, "", NULL, Spin, N_("Flash Moves (0 = no flashing):") }, { 0, 1, 10, NULL, (void*) &appData.flashRate, "", NULL, Spin, N_("Flash Rate (high = fast):") }, { 0, 5, 100,NULL, (void*) &appData.animSpeed, "", NULL, Spin, N_("Animation Speed (high = slow):") }, +{ 0, 1, 5, NULL, (void*) &appData.zoom, "", NULL, Spin, N_("Zoom factor in Evaluation Graph:") }, { 0, 0, 0, NULL, (void*) &GeneralOptionsOK, "", NULL, EndMark , "" } }; -- 1.7.0.4