diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-05-22 13:06:19 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2021-05-22 13:06:19 (GMT) |
commit | eb776d13e306b28c75b2fa7ae71b75ec690e79eb (patch) | |
tree | fae677155f645a5ccbb3b4e0e069c60c9a10a7b4 /win | |
parent | 31dee897d0a63e144a8d8076521a899d0e1589e7 (diff) | |
parent | 57b99249e67918f2283225a4e3beadb841fdb881 (diff) | |
download | tk-eb776d13e306b28c75b2fa7ae71b75ec690e79eb.zip tk-eb776d13e306b28c75b2fa7ae71b75ec690e79eb.tar.gz tk-eb776d13e306b28c75b2fa7ae71b75ec690e79eb.tar.bz2 |
Merge 8.7. end-of-line spacing
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinGDI.c | 112 | ||||
-rw-r--r-- | win/tkWinInit.c | 2 | ||||
-rw-r--r-- | win/tkWinPrint.c | 70 |
3 files changed, 92 insertions, 92 deletions
diff --git a/win/tkWinGDI.c b/win/tkWinGDI.c index 8bc98a4..ca22303 100644 --- a/win/tkWinGDI.c +++ b/win/tkWinGDI.c @@ -732,8 +732,8 @@ static int GdiLine( /* Verrrrrry simple for now.... */ if (argc >= 5) { - - hDC = printDC; + + hDC = printDC; if ( (polypoints = (POINT *)Tcl_Alloc(argc * sizeof(POINT))) == 0 ) { @@ -1049,7 +1049,7 @@ static int GdiOval( /* Verrrrrry simple for now.... */ if (argc >= 5) { - + hDC = printDC; @@ -1179,7 +1179,7 @@ static int GdiPolygon( if (argc >= 5) { hDC = printDC; - + if ( (polypoints = (POINT *)Tcl_Alloc(argc * sizeof(POINT))) == 0 ) { Tcl_AppendResult(interp, "Out of memory in GdiLine", NULL); @@ -1354,7 +1354,7 @@ static int GdiRectangle( /* Verrrrrry simple for now.... */ if (argc >= 5) { - + hDC = printDC; x1 = atol(argv[1]); @@ -1465,7 +1465,7 @@ static int GdiCharWidths( * Array name is GdiCharWidths if not specified. * Widths should be in the same measures as all other values (1/1000 inch). */ - + HDC hDC; LOGFONT lf; HFONT hfont, oldfont; @@ -1482,7 +1482,7 @@ static int GdiCharWidths( } hDC = printDC; - + argc--; argv++; @@ -1519,7 +1519,7 @@ static int GdiCharWidths( { retval = GetCharWidth (hDC, 0, 255, widths ); } - + /* * Retval should be 1 (TRUE) if the function succeeded. If the function fails, * get the "extended" error code and return. Be sure to deallocate the font if @@ -1619,7 +1619,7 @@ int GdiText( if ( argc >= 4 ) { /* Parse the command. */ - + hDC = printDC; x = atol(argv[1]); @@ -2043,7 +2043,7 @@ static int GdiMap( /* Required parameter: HDC for printer. */ if ( argc >= 1 ) { - + hdc = printDC; if ( (mapmode = GdiGetHdcInfo(hdc, &worigin, &wextent, &vorigin, &vextent)) == 0 ) @@ -4576,11 +4576,11 @@ static int PalEntriesOnDevice(HDC hDC) * *-------------------------------------------------------------- */ - + int Gdi_Init(Tcl_Interp *interp) { - Tcl_CreateCommand(interp, "::tk::print::_gdi", TkWinGDI, + Tcl_CreateCommand(interp, "::tk::print::_gdi", TkWinGDI, (ClientData)0, (Tcl_CmdDeleteProc *)0); return TCL_OK; } @@ -4604,8 +4604,8 @@ int Winprint_Init(Tcl_Interp * interp) Tcl_CreateObjCommand(interp, "::tk::print::_openprinter", PrintOpenPrinter, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::print::_closeprinter", PrintClosePrinter, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::print::_opendoc", PrintOpenDoc, NULL, NULL); - Tcl_CreateObjCommand(interp, "::tk::print::_closedoc", PrintCloseDoc, NULL, NULL); - Tcl_CreateObjCommand(interp, "::tk::print::_openpage", PrintOpenPage, NULL, NULL); + Tcl_CreateObjCommand(interp, "::tk::print::_closedoc", PrintCloseDoc, NULL, NULL); + Tcl_CreateObjCommand(interp, "::tk::print::_openpage", PrintOpenPage, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::print::_closepage", PrintClosePage, NULL, NULL); return TCL_OK; } @@ -4924,31 +4924,31 @@ static int PrintSelectPrinter(ClientData clientData, Tcl_Interp *interp, int arg pd.lStructSize = sizeof(pd); pd.hwndOwner = GetDesktopWindow(); pd.Flags = PD_HIDEPRINTTOFILE | PD_DISABLEPRINTTOFILE | PD_NOSELECTION; - + if (PrintDlg(&pd) == TRUE) { - + /*Get document info.*/ ZeroMemory( &di, sizeof(di)); di.cbSize = sizeof(di); di.lpszDocName = "Tk Print Output"; - - /* Copy print attributes to local structure. */ + + /* Copy print attributes to local structure. */ returnedDevmode = (PDEVMODE)GlobalLock(pd.hDevMode); devnames = (LPDEVNAMES)GlobalLock(pd.hDevNames); printerName = (LPCTSTR)devnames + devnames->wDeviceOffset; driver = (LPCTSTR)devnames + devnames->wDriverOffset; output = (LPCTSTR)devnames + devnames->wOutputOffset; - localDevmode = (LPDEVMODE)HeapAlloc(GetProcessHeap(), - HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, + localDevmode = (LPDEVMODE)HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, returnedDevmode->dmSize); - - if (localDevmode !=NULL) + + if (localDevmode !=NULL) { memcpy((LPVOID)localDevmode, - (LPVOID)returnedDevmode, + (LPVOID)returnedDevmode, returnedDevmode->dmSize); - + /* Get values from user-set and built-in properties. */ localPrinterName = (char*) localDevmode->dmDeviceName; dpi_y = localDevmode->dmYResolution; @@ -4958,7 +4958,7 @@ static int PrintSelectPrinter(ClientData clientData, Tcl_Interp *interp, int arg copies = pd.nCopies; /*Set device context here for all GDI printing operations.*/ printDC = CreateDC( - "WINSPOOL", + "WINSPOOL", printerName, NULL, localDevmode); @@ -4968,28 +4968,28 @@ static int PrintSelectPrinter(ClientData clientData, Tcl_Interp *interp, int arg localDevmode = NULL; } } - if (pd.hDevMode !=NULL) + if (pd.hDevMode !=NULL) { GlobalFree(pd.hDevMode); } - - /* - * Store print properties and link variables + + /* + * Store print properties and link variables * so they can be accessed from script level. */ - + char *varlink1 = Tcl_Alloc(100 * sizeof(char)); char **varlink2 = (char **)Tcl_Alloc(sizeof(char *)); *varlink2 = varlink1; - strcpy (varlink1, localPrinterName); - + strcpy (varlink1, localPrinterName); + Tcl_LinkVar(interp, "::tk::print::printer_name", (char*)varlink2, TCL_LINK_STRING | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::copies", (char *)&copies, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::dpi_x", (char *)&dpi_x, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::dpi_y", (char *)&dpi_y, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::paper_width", (char *)&paper_width, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::paper_height", (char *)&paper_height, TCL_LINK_INT | TCL_LINK_READ_ONLY); - + return TCL_OK; } @@ -5009,32 +5009,32 @@ static int PrintSelectPrinter(ClientData clientData, Tcl_Interp *interp, int arg int PrintOpenPrinter(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *const objv[]) { (void) clientData; - + if (argc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "printer"); return TCL_ERROR; } - + int len = 0; - + /*Start an individual page.*/ if ( StartPage(printDC) <= 0) { - + return TCL_ERROR; } char *printer = Tcl_GetStringFromObj(objv[1], &len); - + if (printDC == NULL) { Tcl_AppendResult(interp, "unable to establish device context", NULL); return TCL_ERROR; } - + if ((OpenPrinter(printer, &printDC, NULL)) == FALSE) { Tcl_AppendResult(interp, "unable to open printer", NULL); return TCL_ERROR; } - + return TCL_OK; } @@ -5056,12 +5056,12 @@ int PrintClosePrinter(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_O (void) clientData; (void) argc; (void) objv; - + if (printDC == NULL) { Tcl_AppendResult(interp, "unable to establish device context", NULL); return TCL_ERROR; } - + ClosePrinter(printDC); return TCL_OK; } @@ -5092,16 +5092,16 @@ int PrintOpenDoc(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *c Tcl_AppendResult(interp, "unable to establish device context", NULL); return TCL_ERROR; } - - /* - * Start printing. + + /* + * Start printing. */ output = StartDoc(printDC, &di); if (output <= 0) { Tcl_AppendResult(interp, "unable to start document", NULL); - return TCL_ERROR; - } - + return TCL_ERROR; + } + return TCL_OK; } @@ -5130,8 +5130,8 @@ int PrintCloseDoc(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj * Tcl_AppendResult(interp, "unable to establish device context", NULL); return TCL_ERROR; } - - + + if ( EndDoc(printDC) <= 0) { Tcl_AppendResult(interp, "unable to establish close document", NULL); return TCL_ERROR; @@ -5159,19 +5159,19 @@ int PrintOpenPage(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj * (void) clientData; (void) argc; (void) objv; - + if (printDC == NULL) { Tcl_AppendResult(interp, "unable to establish device context", NULL); return TCL_ERROR; } - + /*Start an individual page.*/ if ( StartPage(printDC) <= 0) { Tcl_AppendResult(interp, "unable to start page", NULL); return TCL_ERROR; } - + return TCL_OK; } @@ -5194,13 +5194,13 @@ int PrintClosePage(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj (void) clientData; (void) argc; (void) objv; - + if (printDC == NULL) { Tcl_AppendResult(interp, "unable to establish device context", NULL); return TCL_ERROR; } - - + + if ( EndPage(printDC) <= 0) { Tcl_AppendResult(interp, "unable to close page", NULL); return TCL_ERROR; diff --git a/win/tkWinInit.c b/win/tkWinInit.c index 7060d0f..d7e1dce 100644 --- a/win/tkWinInit.c +++ b/win/tkWinInit.c @@ -44,7 +44,7 @@ TkpInit( WinIcoInit(interp); Winprint_Init(interp); - Gdi_Init(interp); + Gdi_Init(interp); TkWinXInit(Tk_GetHINSTANCE()); return TCL_OK; } diff --git a/win/tkWinPrint.c b/win/tkWinPrint.c index 4c35233..ed193f4 100644 --- a/win/tkWinPrint.c +++ b/win/tkWinPrint.c @@ -81,32 +81,32 @@ static int PrintSelectPrinter(ClientData clientData, Tcl_Interp *interp, int arg pd.lStructSize = sizeof(pd); pd.hwndOwner = GetDesktopWindow(); pd.Flags = PD_RETURNDC | PD_HIDEPRINTTOFILE | PD_DISABLEPRINTTOFILE | PD_NOSELECTION; - + if (PrintDlg(&pd) == TRUE) { hDC = pd.hDC; if (hDC = NULL) { Tcl_AppendResult(interp, "can't allocate printer DC", NULL); return TCL_ERROR; - } + } /*Get document info.*/ ZeroMemory( &di, sizeof(di)); di.cbSize = sizeof(di); di.lpszDocName = "Tk Print Output"; - - /* Copy print attributes to local structure. */ - returnedDevmode = (PDEVMODE)GlobalLock(pd.hDevMode); - localDevmode = (LPDEVMODE)HeapAlloc(GetProcessHeap(), - HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, + + /* Copy print attributes to local structure. */ + returnedDevmode = (PDEVMODE)GlobalLock(pd.hDevMode); + localDevmode = (LPDEVMODE)HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, returnedDevmode->dmSize); - - if (localDevmode !=NULL) + + if (localDevmode !=NULL) { memcpy((LPVOID)localDevmode, - (LPVOID)returnedDevmode, + (LPVOID)returnedDevmode, returnedDevmode->dmSize); - + /* Get values from user-set and built-in properties. */ localPrinterName = (char*) localDevmode->dmDeviceName; dpi_y = localDevmode->dmYResolution; @@ -119,30 +119,30 @@ static int PrintSelectPrinter(ClientData clientData, Tcl_Interp *interp, int arg { localDevmode = NULL; } - if (pd.hDevMode !=NULL) + if (pd.hDevMode !=NULL) { GlobalFree(pd.hDevMode); } } - - /* - * Store print properties and link variables + + /* + * Store print properties and link variables * so they can be accessed from script level. */ - + char *varlink1 = Tcl_Alloc(100 * sizeof(char)); char **varlink2 = (char **)Tcl_Alloc(sizeof(char *)); *varlink2 = varlink1; - strcpy (varlink1, localPrinterName); - + strcpy (varlink1, localPrinterName); + Tcl_LinkVar(interp, "::tk::print::printer_name", (char*)varlink2, TCL_LINK_STRING | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::copies", (char *)&copies, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::dpi_x", (char *)&dpi_x, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::dpi_y", (char *)&dpi_y, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::paper_width", (char *)&paper_width, TCL_LINK_INT | TCL_LINK_READ_ONLY); Tcl_LinkVar(interp, "::tk::print::paper_height", (char *)&paper_height, TCL_LINK_INT | TCL_LINK_READ_ONLY); - + return TCL_OK; } @@ -162,7 +162,7 @@ static int PrintSelectPrinter(ClientData clientData, Tcl_Interp *interp, int arg int PrintOpenPrinter(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *const objv[]) { (void) clientData; - + if (argc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "printer"); return TCL_ERROR; @@ -194,7 +194,7 @@ int PrintClosePrinter(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_O (void) clientData; (void) argc; (void) objv; - + ClosePrinter(hDC); return TCL_OK; } @@ -225,15 +225,15 @@ int PrintOpenDoc(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *c return TCL_ERROR; } - /* - * Start printing. + /* + * Start printing. */ output = StartDoc(hDC, &di); if (output <= 0) { Tcl_AppendResult(interp, "unable to start document", NULL); - return TCL_ERROR; - } - + return TCL_ERROR; + } + return TCL_OK; } @@ -257,7 +257,7 @@ int PrintCloseDoc(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj * (void) clientData; (void) argc; (void) objv; - + if ( EndDoc(hDC) <= 0) { return TCL_ERROR; } @@ -289,7 +289,7 @@ int PrintOpenPage(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj * Tcl_AppendResult(interp, "unable to start page", NULL); return TCL_ERROR; } - + return TCL_OK; } @@ -312,7 +312,7 @@ int PrintClosePage(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj (void) clientData; (void) argc; (void) objv; - + if ( EndPage(hDC) <= 0) { return TCL_ERROR; } @@ -340,7 +340,7 @@ int PrintGetHDC(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *co (void) argc; (void) objv; - + if ( hDC == NULL) { return TCL_ERROR; } @@ -364,7 +364,7 @@ int PrintGetHDC(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *co HDC get_hdc(void) { - + return hDC; } @@ -388,10 +388,10 @@ int Winprint_Init(Tcl_Interp * interp) Tcl_CreateObjCommand(interp, "::tk::print::_openprinter", PrintOpenPrinter, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::print::_closeprinter", PrintClosePrinter, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::print::_opendoc", PrintOpenDoc, NULL, NULL); - Tcl_CreateObjCommand(interp, "::tk::print::_closedoc", PrintCloseDoc, NULL, NULL); - Tcl_CreateObjCommand(interp, "::tk::print::_openpage", PrintOpenPage, NULL, NULL); + Tcl_CreateObjCommand(interp, "::tk::print::_closedoc", PrintCloseDoc, NULL, NULL); + Tcl_CreateObjCommand(interp, "::tk::print::_openpage", PrintOpenPage, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::print::_closepage", PrintClosePage, NULL, NULL); - Tcl_CreateObjCommand(interp, "::tk::print::_gethdc", PrintGetHDC, NULL, NULL); + Tcl_CreateObjCommand(interp, "::tk::print::_gethdc", PrintGetHDC, NULL, NULL); return TCL_OK; } @@ -401,4 +401,4 @@ int Winprint_Init(Tcl_Interp * interp) * c-basic-offset: 4 * fill-column: 78 * End: - */ + */ |