// front-end. Create pens, device context and buffer bitmap for global use, copy result to display // The back-end part n the middle has been taken out and moed to PainEvalGraph() static void DisplayEvalGraph() { int j; int width; int height; Dimension w, h; Arg args[6]; /* Get client area */ j = 0; XtSetArg(args[j], XtNwidth, &w); j++; XtSetArg(args[j], XtNheight, &h); j++; XtGetValues(evalGraphShell, args, j); width = w; height = h; /* Create or recreate paint box if needed */ if( width != nWidthPB || height != nHeightPB ) { nWidthPB = width; nHeightPB = height; } // back-end painting; calls back front-end primitives for lines, rectangles and text PaintEvalGraph(); XSync(yDisplay, False); }
static void DisplayEvalGraph () { // back-end painting; calls back front-end primitives for lines, rectangles and text char *t = MakeEvalTitle(_(title)); nWidthPB = disp->max; nHeightPB = disp->value; if(t != title && nWidthPB < 340) t = MakeEvalTitle(nWidthPB < 240 ? "" : _("Eval")); PaintEvalGraph(); GraphExpose(graphOptions, 0, 0, nWidthPB, nHeightPB); SetDialogTitle(EvalGraphDlg, t); }
// front-end. Create pens, device context and buffer bitmap for global use, copy result to display // The back-end part n the middle has been taken out and moed to PainEvalGraph() static VOID DisplayEvalGraph( HWND hWnd, HDC hDC ) { RECT rcClient; int width; int height; /* Get client area */ GetClientRect( hWnd, &rcClient ); width = rcClient.right - rcClient.left; height = rcClient.bottom - rcClient.top; /* Create or recreate paint box if needed */ if( hbmPB == NULL || width != nWidthPB || height != nHeightPB ) { if( pens[PEN_DOTTED] == NULL ) { pens[PEN_BLACK] = GetStockObject(BLACK_PEN); pens[PEN_DOTTED] = CreatePen( PS_DOT, 0, RGB(0xA0,0xA0,0xA0) ); pens[PEN_BLUEDOTTED] = CreatePen( PS_DOT, 0, RGB(0x00,0x00,0xFF) ); pens[PEN_BOLDWHITE] = CreatePen( PS_SOLID, 2, crWhite ); pens[PEN_BOLDBLACK] = CreatePen( PS_SOLID, 2, crBlack ); hbrHist[0] = CreateBrush( BS_SOLID, crWhite ); hbrHist[1] = CreateBrush( BS_SOLID, crBlack ); hbrHist[2] = CreateBrush( BS_SOLID, GetSysColor( COLOR_3DFACE ) ); // background } if( hdcPB != NULL ) { DeleteDC( hdcPB ); hdcPB = NULL; } if( hbmPB != NULL ) { DeleteObject( hbmPB ); hbmPB = NULL; } hdcPB = CreateCompatibleDC( hDC ); nWidthPB = width; nHeightPB = height; hbmPB = CreateCompatibleBitmap( hDC, nWidthPB, nHeightPB ); SelectObject( hdcPB, hbmPB ); } // 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 ); }