diff options
author | joye <joye> | 2013-08-29 18:26:59 (GMT) |
---|---|---|
committer | joye <joye> | 2013-08-29 18:26:59 (GMT) |
commit | 9e6f4b6793af33a76866561fbaecee4d2723fd8f (patch) | |
tree | 573eeeda02b2b61edcec76eead35cbf77ac88dd8 /src | |
parent | 7b2ea9219107a8ec42ae046fe52e0fe629c3c095 (diff) | |
download | blt-9e6f4b6793af33a76866561fbaecee4d2723fd8f.zip blt-9e6f4b6793af33a76866561fbaecee4d2723fd8f.tar.gz blt-9e6f4b6793af33a76866561fbaecee4d2723fd8f.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r-- | src/bltGraph.C | 203 | ||||
-rw-r--r-- | src/bltInt.C | 3 |
2 files changed, 0 insertions, 206 deletions
diff --git a/src/bltGraph.C b/src/bltGraph.C index 8402dae..f6ff88a 100644 --- a/src/bltGraph.C +++ b/src/bltGraph.C @@ -1247,205 +1247,6 @@ TransformOp(Graph *graphPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) return TCL_OK; } -#ifndef NO_PRINTER - -/* - *--------------------------------------------------------------------------- - * - * Print1Op -- - * - * Prints the equivalent of a screen snapshot of the graph to the - * designated printer. - * - * Results: - * Returns a standard TCL result. If an error occurred TCL_ERROR is - * returned and interp->result will contain an error message. - * - *--------------------------------------------------------------------------- - */ -/*ARGSUSED*/ -static int -Print1Op(Graph *graphPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) -{ - BITMAPINFO info; - void *data; - TkWinDCState state; - TkWinBitmap bd; - DIBSECTION ds; - Drawable drawable; - HBITMAP hBitmap; - HDC hDC; - DOCINFO di; - double pageWidth, pageHeight; - int result; - double scale, sx, sy; - int jobId; - - graphPtr->width = Tk_Width(graphPtr->tkwin); - graphPtr->height = Tk_Height(graphPtr->tkwin); - if ((graphPtr->width < 2) && (graphPtr->reqWidth > 0)) { - graphPtr->width = graphPtr->reqWidth; - } - if ((graphPtr->height < 2) && (graphPtr->reqHeight > 0)) { - graphPtr->height = graphPtr->reqHeight; - } - if (objc == 2) { - result = Blt_PrintDialog(interp, &drawable); - if (result == TCL_ERROR) { - return TCL_ERROR; - } - if (result == TCL_RETURN) { - return TCL_OK; - } - } else { - if (Blt_GetOpenPrinter(interp, Tcl_GetString(objv[2]), &drawable) - != TCL_OK) { - return TCL_ERROR; - } - } - /* - * This is a taken from Blt_SnapPhoto. The difference is that here we're - * using the DIBSection directly, without converting the section into a - * Picture. - */ - ZeroMemory(&info, sizeof(info)); - info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - info.bmiHeader.biWidth = graphPtr->width; - info.bmiHeader.biHeight = graphPtr->height; - info.bmiHeader.biPlanes = 1; - info.bmiHeader.biBitCount = 32; - info.bmiHeader.biCompression = BI_RGB; - hDC = TkWinGetDrawableDC(graphPtr->display, Tk_WindowId(graphPtr->tkwin), - &state); - hBitmap = CreateDIBSection(hDC, &info, DIB_RGB_COLORS, &data, NULL, 0); - TkWinReleaseDrawableDC(Tk_WindowId(graphPtr->tkwin), hDC, &state); - - /* - * Create our own drawable by hand using the DIB we just created. We'll - * then draw into it using the standard drawing functions. - */ - bd.type = TWD_BITMAP; - bd.handle = hBitmap; - bd.colormap = DefaultColormap(graphPtr->display, - DefaultScreen(graphPtr->display)); - bd.depth = Tk_Depth(graphPtr->tkwin); - - graphPtr->flags |= RESET_WORLD; - Blt_DrawGraph(graphPtr, (Drawable)&bd); - - /* - * Now that the DIB contains the image of the graph, get the the data bits - * and write them to the printer device, stretching the image to the fit - * the printer's resolution. - */ - result = TCL_ERROR; - if (GetObject(hBitmap, sizeof(DIBSECTION), &ds) == 0) { - Tcl_AppendResult(interp, "can't get object: ", Blt_LastError(), - (char *)NULL); - goto done; - } - hDC = ((TkWinDC *) drawable)->hdc; - /* Get the resolution of the printer device. */ - sx = (double)GetDeviceCaps(hDC, HORZRES) / (double)graphPtr->width; - sy = (double)GetDeviceCaps(hDC, VERTRES) / (double)graphPtr->height; - scale = MIN(sx, sy); - pageWidth = scale * graphPtr->width; - pageHeight = scale * graphPtr->height; - - ZeroMemory(&di, sizeof(di)); - di.cbSize = sizeof(di); - di.lpszDocName = "Graph Contents"; - jobId = StartDoc(hDC, &di); - if (jobId <= 0) { - Tcl_AppendResult(interp, "can't start document: ", Blt_LastError(), - (char *)NULL); - goto done; - } - if (StartPage(hDC) <= 0) { - Tcl_AppendResult(interp, "error starting page: ", Blt_LastError(), - (char *)NULL); - goto done; - } - StretchDIBits(hDC, 0, 0, ROUND(pageWidth), ROUND(pageHeight), 0, 0, - graphPtr->width, graphPtr->height, ds.dsBm.bmBits, - (LPBITMAPINFO)&ds.dsBmih, DIB_RGB_COLORS, SRCCOPY); - EndPage(hDC); - EndDoc(hDC); - result = TCL_OK; - done: - DeleteBitmap(hBitmap); - return result; -} - -/* - *--------------------------------------------------------------------------- - * - * Print2Op -- - * - * Prints directly to the designated printer device. - * - * Results: - * Returns a standard TCL result. If an error occurred, TCL_ERROR is - * returned and interp->result will contain an error message. - * - *--------------------------------------------------------------------------- - */ -static int -Print2Op(Graph *graphPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv) -{ - Drawable drawable; - int result; - - graphPtr->width = Tk_Width(graphPtr->tkwin); - graphPtr->height = Tk_Height(graphPtr->tkwin); - if ((graphPtr->width < 2) && (graphPtr->reqWidth > 0)) { - graphPtr->width = graphPtr->reqWidth; - } - if ((graphPtr->height < 2) && (graphPtr->reqHeight > 0)) { - graphPtr->height = graphPtr->reqHeight; - } - if (objc == 2) { - result = Blt_PrintDialog(interp, &drawable); - if (result == TCL_ERROR) { - return TCL_ERROR; - } - if (result == TCL_RETURN) { - return TCL_OK; - } - } else { - result = Blt_GetOpenPrinter(interp, Tcl_GetString(objv[2]), &drawable); - } - if (result == TCL_OK) { - int oldMode; - HDC hDC; - double xRatio, yRatio; - TkWinDC *drawPtr; - int w, h; - - drawPtr = (TkWinDC *) drawable; - hDC = drawPtr->hdc; - Blt_GetPrinterScale(hDC, &xRatio, &yRatio); - oldMode = SetMapMode(hDC, MM_ISOTROPIC); - if (oldMode == 0) { - Tcl_AppendResult(interp, "can't set mode for printer DC: ", - Blt_LastError(), (char *)NULL); - return TCL_ERROR; - } - w = (int)round(graphPtr->width * xRatio); - h = (int)round(graphPtr->height * yRatio); - SetViewportExtEx(hDC, w, h, NULL); - SetWindowExtEx(hDC, graphPtr->width, graphPtr->height, NULL); - - Blt_StartPrintJob(interp, drawable); - graphPtr->flags |= RESET_WORLD; - Blt_DrawGraph(graphPtr, drawable); - Blt_EndPrintJob(interp, drawable); - } - return result; -} - -#endif /* NO_PRINTER */ - /* *--------------------------------------------------------------------------- * @@ -1782,10 +1583,6 @@ static Blt_OpSpec graphOps[] = {"marker", 2, Blt_MarkerOp, 2, 0, "oper ?args?",}, {"pen", 2, Blt_PenOp, 2, 0, "oper ?args?",}, {"postscript", 2, Blt_PostScriptOp, 2, 0, "oper ?args?",}, -#ifndef NO_PRINTER - {"print1", 2, Print1Op, 2, 3, "?printerName?",}, - {"print2", 2, Print2Op, 2, 3, "?printerName?",}, -#endif /*NO_PRINTER*/ {"snap", 1, SnapOp, 3, 0, "?switches? name",}, {"transform", 1, TransformOp, 4, 4, "x y",}, {"x2axis", 2, X2AxisOp, 2, 0, "oper ?args?",}, diff --git a/src/bltInt.C b/src/bltInt.C index 9c600b2..fcbefc2 100644 --- a/src/bltInt.C +++ b/src/bltInt.C @@ -143,9 +143,6 @@ static Tcl_AppInitProc *cmdProcs[] = #ifndef NO_DATATABLE Blt_TableCmdInitProc, #endif -#ifndef NO_DDE - Blt_DdeCmdInitProc, -#endif #ifndef NO_DEBUG Blt_DebugCmdInitProc, #endif |