int currLast = 0;
int currCurrent = -1;
int range = 1;
+int differentialView;
int nWidthPB = 0;
int nHeightPB = 0;
{
int score = currPvInfo[ index ].score;
+ if(differentialView) score = index < currLast-1 ? -currPvInfo[ index+1 ].score - score : 0;
if( index & 1 ) score = -score; /* Flip score for black */
return score;
DrawHistograms ()
{
VisualizationData vd;
+ int i; double step = 1;
if( InitVisualization( &vd ) ) {
if( vd.hist_width < MIN_HIST_WIDTH ) {
DrawHistogramAsDiagram( vd.cy, vd.paint_width, vd.hist_count );
+ step = 0.5*vd.paint_width / (((vd.hist_count | 7) + 1)/2 + 1.);
}
else {
- DrawHistogramFull( vd.cy, vd.hist_width, vd.hist_count );
+ DrawHistogramFull( vd.cy, step = vd.hist_width, vd.hist_count );
}
}
+ if(!differentialView) return;
+ differentialView = 0;
+ DrawSegment( MarginX + MarginW, vd.cy, NULL, NULL, PEN_NONE );
+ for( i=0; i<vd.hist_count; i++ ) {
+ int index = currFirst + i;
+ int x = MarginX + MarginW + index * step + step/2;
+ DrawSegment((int) x, GetValueY( GetPvScore(index) ), NULL, NULL, PEN_ANY );
+ }
+ differentialView = 1;
}
// back-end
#define MIN_HIST_WIDTH 4
#define MAX_HIST_WIDTH 10
-typedef enum { PEN_NONE, PEN_BLACK, PEN_DOTTED, PEN_BLUEDOTTED, PEN_BOLDWHITE, PEN_BOLDBLACK, PEN_BACKGD } PenType;
+typedef enum { PEN_NONE, PEN_BLACK, PEN_DOTTED, PEN_BLUEDOTTED, PEN_BOLDWHITE, PEN_BOLDBLACK, PEN_BACKGD, PEN_ANY } PenType;
#define FILLED 1
#define OPEN 0
extern int currFirst;
extern int currLast;
extern int currCurrent;
+extern int differentialView;
extern int nWidthPB;
extern int nHeightPB;
# define N_(s) s
#endif
-static char *title = N_("Evaluation graph");
+static char *title[2] = { N_("Evaluation graph"), N_("Blunder graph") };
Option *disp;
/* Module variables */
static void
DisplayEvalGraph ()
{ // back-end painting; calls back front-end primitives for lines, rectangles and text
- char *t = MakeEvalTitle(_(title));
+ char *t = MakeEvalTitle(_(title[differentialView]));
nWidthPB = disp->max; nHeightPB = disp->value;
- if(t != title && nWidthPB < 340) t = MakeEvalTitle(nWidthPB < 240 ? "" : _("Eval"));
+ if(t != title[differentialView] && nWidthPB < 340)
+ t = MakeEvalTitle(nWidthPB < 240 ? "" : differentialView ? _("Blunder") : _("Eval"));
PaintEvalGraph();
GraphExpose(graphOptions, 0, 0, nWidthPB, nHeightPB);
SetDialogTitle(EvalGraphDlg, t);
static Option *
EvalCallback (int button, int x, int y)
{
+ int dir = appData.zoom + 1;
if(!initDone) return NULL;
switch(button) {
+ case 3: dir = 0; differentialView = !differentialView;
+ case 4: dir -= 2;
+ case 5: if(dir > 0) appData.zoom = dir;
case 10: // expose event
/* Create or recreate paint box if needed */
if(x != nWidthPB || y != nHeightPB) {
void
EvalGraphPopUp ()
{
- if (GenericPopUp(graphOptions, _(title), EvalGraphDlg, BoardWindow, NONMODAL, appData.topLevel)) {
+ if (GenericPopUp(graphOptions, _(title[differentialView]), EvalGraphDlg, BoardWindow, NONMODAL, appData.topLevel)) {
InitializeEvalGraph(&graphOptions[0], wpEvalGraph.width, wpEvalGraph.height); // first time: add callbacks and initialize pens
disp = graphOptions;
} else {
- SetDialogTitle(EvalGraphDlg, _(title));
- SetIconName(EvalGraphDlg, _(title));
+ SetDialogTitle(EvalGraphDlg, _(title[differentialView]));
+ SetIconName(EvalGraphDlg, _(title[differentialView]));
}
MarkMenu("View.EvaluationGraph", EvalGraphDlg);
\r
static HDC hdcPB = NULL;\r
static HBITMAP hbmPB = NULL;\r
-static HPEN pens[6]; // [HGM] put all pens in one array\r
+static HPEN pens[PEN_ANY+1]; // [HGM] put all pens in one array\r
static HBRUSH hbrHist[3] = { NULL, NULL, NULL };\r
\r
Boolean EvalGraphIsUp()\r
\r
// back-end painting; calls back front-end primitives for lines, rectangles and text\r
PaintEvalGraph();\r
- SetWindowText(hWnd, MakeEvalTitle(T_("Evaluation Graph")));\r
+ SetWindowText(hWnd, MakeEvalTitle(differentialView ? T_("Blunder Graph") : T_("Evaluation Graph")));\r
\r
/* Copy bitmap into destination DC */\r
BitBlt( hDC, 0, 0, nWidthPB, nHeightPB, hdcPB, 0, 0, SRCCOPY );\r
EndPaint( hDlg, &stPS );\r
break;\r
\r
+ case WM_MOUSEWHEEL:\r
+ if((short)HIWORD(wParam) < 0) appData.zoom++;\r
+ if((short)HIWORD(wParam) > 0 && appData.zoom > 1) appData.zoom--;\r
+ goto paint;\r
+ case WM_RBUTTONDOWN:\r
+ differentialView = !differentialView;\r
case WM_REFRESH_GRAPH:\r
+ paint:\r
hDC = GetDC( hDlg );\r
DisplayEvalGraph( hDlg, hDC );\r
ReleaseDC( hDlg, hDC );\r