2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $TOG: printJob.c /main/29 1997/08/01 14:32:04 samborn $ */
24 /**********************************<+>*************************************
25 ***************************************************************************
29 ** Project: HP DT dtpad, a memo maker type editor based on the
32 ** Description: Routines which manipulate the print setup dialog
34 **************************************************************************
35 **********************************<+>*************************************/
37 * Common Desktop Environment
39 * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
40 * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
41 * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
42 * (c) Copyright 1993, 1994, 1995 Novell, Inc.
43 * (c) Copyright 1995 Digital Equipment Corp.
44 * (c) Copyright 1995 Fujitsu Limited
45 * (c) Copyright 1995 Hitachi, Ltd.
48 * RESTRICTED RIGHTS LEGEND
50 *Use, duplication, or disclosure by the U.S. Government is subject to
51 *restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
52 *Technical Data and Computer Software clause in DFARS 252.227-7013. Rights
53 *for non-DOD U.S. Government Departments and Agencies are as set forth in
54 *FAR 52.227-19(c)(1,2).
56 *Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A.
57 *International Business Machines Corp., Route 100, Somers, NY 10589 U.S.A.
58 *Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, CA 94043 U.S.A.
59 *Novell, Inc., 190 River Road, Summit, NJ 07901 U.S.A.
60 *Digital Equipment Corp., 111 Powdermill Road, Maynard, MA 01754, U.S.A.
61 *Fujitsu Limited, 1015, Kamikodanaka Nakahara-Ku, Kawasaki 211, Japan
62 *Hitachi, Ltd., 6, Kanda Surugadai 4-Chome, Chiyoda-ku, Tokyo 101, Japan
70 #include <sys/types.h>
73 #include <X11/Intrinsic.h>
74 #include <X11/Shell.h>
76 #include <Xm/DialogS.h>
80 #include <Dt/Editor.h>
85 static void _pjCreatePrintShell(PrintJob *pJob);
86 static void _pjCreateOutputWidgets(PrintJob *pJob);
87 static void _pjDoPrint(PrintJob*);
88 static void _pjUpdatePageHeaders(
94 static void _pjFinishedPrintToFile(
99 static char * _pjGetPageHeaderString(PrintJob*, PrintStringTypeEnum);
101 static void _pjCancelCB (Widget, XtPointer client_data, XtPointer);
102 static void _pjCloseDisplayCB (Widget, XtPointer client_data, XtPointer);
103 static void _pjPdmSetupCB (Widget, XtPointer client_data, XtPointer);
104 static void _pjPdmNotificationCB (Widget, XtPointer client_data, XtPointer);
105 static void _pjPrintCB (Widget, XtPointer client_data, XtPointer);
106 static void _pjPrintOnePageCB(Widget, XtPointer, XtPointer);
108 static void _pjRegisterActivePrintDisplay(Display*);
109 static void _pjUnregisterActivePrintDisplay(Display*);
111 static Display *_pjErrorPrintDisplay = NULL;
112 static Display **_pjActivePrintDisplay = NULL;
113 static int _pjMaxActivePrintDisplay = 0;
115 /************************************************************************
117 * Creates a new print job for the specified document file.
118 ************************************************************************/
129 pJob = (PrintJob *) XtMalloc( sizeof(PrintJob) );
130 memset(pJob, 0, sizeof(PrintJob));
133 pJob->parentShell = pPad->app_shell;
134 pJob->documentName = strdup(documentName);
135 pJob->tempFileName = strdup(tempFileName);
136 pJob->silent = silent;
138 pJob->pOutput = NULL;
141 pJob->printData = (DtPrintSetupData*) XtMalloc(sizeof(DtPrintSetupData));
142 memset(pJob->printData, 0, sizeof(DtPrintSetupData));
144 pJob->npagesDone = 0;
145 pJob->npagesTotal = 0;
147 pJob->nextpageShell = NULL;
148 pJob->nextpageButton = NULL;
153 /************************************************************************
155 * Destroys the specified PrintJob.
156 ************************************************************************/
158 PrintJobDestroy(PrintJob *pJob)
165 pJob->pPad->numPendingTasks--;
166 ClearStatusMessage(pJob->pPad);
167 XtSetSensitive(pJob->pPad->fileStuff.fileWidgets.printBtn, True);
169 XtSetSensitive(pJob->pPad->fileStuff.fileWidgets.silentPrintBtn, True);
172 if (pJob->documentName != NULL)
174 free((char*) pJob->documentName);
175 pJob->documentName = NULL;
177 if (pJob->tempFileName != NULL)
179 free((char*) pJob->tempFileName);
180 pJob->tempFileName = NULL;
182 if (pJob->pOutput != NULL)
184 PrintOutputDestroy(pJob->pOutput);
185 pJob->pOutput = NULL;
187 if (pJob->pShell != NULL)
189 _pjRegisterActivePrintDisplay(XtDisplay(pJob->pShell));
190 if (XtDisplay(pJob->pShell) == PrintJobGetErrorPrintDisplay())
195 * Need to display an error dialog;
200 "The X Print Server is temporarily out of resources.");
202 Warning(pJob->pPad, (char *) errMsg, XmDIALOG_ERROR);
203 PrintJobSetErrorPrintDisplay(NULL);
206 XtDestroyWidget(pJob->pShell);
209 if (pJob->pSetup != NULL)
211 PrintSetupDestroy(pJob->pSetup);
216 DtPrintFreeSetupData(pJob->printData);
217 XtFree((XtPointer) pJob->printData);
218 pJob->printData = NULL;
220 if (pJob->nextpageShell)
222 XtDestroyWidget(pJob->nextpageShell);
223 pJob->nextpageShell = NULL;
226 XtFree((char *) pJob);
229 /************************************************************************
231 * Executes the specified PrintJob
232 ************************************************************************/
234 PrintJobExecute(PrintJob *pJob)
236 if (pJob == NULL) return;
238 pJob->pSetup = PrintSetupCreate(
241 pJob->pPad->xrdb.wordWrap,
243 (XtCallbackProc) _pjCancelCB, pJob,
244 (XtCallbackProc) _pjCloseDisplayCB, pJob,
245 (XtCallbackProc) _pjPrintCB, pJob,
246 (XtCallbackProc) _pjPdmSetupCB, pJob);
250 * The DtPrintSetupDialog will display itself automatically
251 * along with an error message in the event of an error.
253 if (FALSE == PrintSetupGetDefaultPrintData(
258 _pjCreatePrintShell(pJob);
262 PrintSetupDisplay(pJob->pSetup);
265 /************************************************************************
267 * Cancels and deletes the specified print job.
268 ************************************************************************/
270 PrintJobCancel(PrintJob *pJob)
272 PrintJobDestroy(pJob);
276 /************************************************************************
277 * PrintJobGetErrorPrintDisplay
278 * Returns the last print display on which an error occured.
279 ************************************************************************/
281 PrintJobGetErrorPrintDisplay()
283 return _pjErrorPrintDisplay;
286 /************************************************************************
287 * PrintJobSetErrorPrintDisplay
288 * Save a pointer to the print display on which an error occured.
289 ************************************************************************/
291 PrintJobSetErrorPrintDisplay(Display *display)
293 _pjErrorPrintDisplay = display;
296 /************************************************************************
297 * PrintJobIsActivePrintDisplay
298 * Save a pointer to the print display on which an error occured.
299 ************************************************************************/
301 PrintJobIsActivePrintDisplay(Display *display)
305 for (i = 0; i < _pjMaxActivePrintDisplay; i++)
306 if (display == _pjActivePrintDisplay[i])
312 /************************************************************************
313 * _pjRegisterActivePrintDisplay
314 * Save the Display pointer for an active print display connection
315 ************************************************************************/
317 _pjRegisterActivePrintDisplay(Display *display)
322 if (0 == _pjMaxActivePrintDisplay)
324 _pjMaxActivePrintDisplay = 10;
325 size = _pjMaxActivePrintDisplay * sizeof(Display*);
326 _pjActivePrintDisplay = (Display**) malloc(size);
327 memset((char*) _pjActivePrintDisplay, 0, size);
330 for (i = 0; i < _pjMaxActivePrintDisplay; i++)
332 if (NULL == _pjActivePrintDisplay[i])
334 _pjActivePrintDisplay[i] = display;
339 size = _pjMaxActivePrintDisplay * sizeof(Display*);
340 _pjActivePrintDisplay =
341 (Display**) realloc((void*) _pjActivePrintDisplay, 2*size);
342 memset((char*) (_pjActivePrintDisplay + size), 0, size);
343 _pjActivePrintDisplay[_pjMaxActivePrintDisplay] = display;
344 _pjMaxActivePrintDisplay *= 2;
347 /************************************************************************
348 * _pjUnregisterActivePrintDisplay
349 * Delete the Display pointer for an active print display connection
350 ************************************************************************/
352 _pjUnregisterActivePrintDisplay(Display *display)
356 for (i = 0; i < _pjMaxActivePrintDisplay; i++)
357 if (display == _pjActivePrintDisplay[i])
358 _pjActivePrintDisplay[i] = NULL;
362 /************************************************************************
363 * _pjCreatePrintShell
364 * Creates the print shell (XmPrintShell or XmDialogShell) to control
366 ************************************************************************/
368 _pjCreatePrintShell(PrintJob *pJob)
370 DtPrintSetupData *psd = NULL;
373 pJob->pShell != NULL ||
374 pJob->parentShell == NULL ||
375 pJob->pSetup == NULL) return;
378 * Create the print shell and
379 * the print output widgets
381 #ifdef PRINT_TO_VIDEO
383 * Create a dialog shell widget on the video display.
385 pJob->pShell = XmCreateDialogShell(
392 pJob->nextpageShell = XmCreateDialogShell(
397 xms = XmStringCreateLocalized("Push for Next Page");
398 pJob->nextpageButton = XtVaCreateManagedWidget(
400 xmPushButtonWidgetClass,
409 pJob->nextpageButton,
414 XtManageChild(pJob->nextpageShell);
415 XtRealizeWidget(pJob->nextpageShell);
420 * Create an XmPrintShell widget on the print display.
422 psd = pJob->printData;
424 pJob->pShell = XmPrintSetup(
426 XpGetScreenOfContext(psd->print_display, psd->print_context),
432 XmNpageSetupCallback,
437 XmNpdmNotificationCallback,
438 _pjPdmNotificationCB,
442 if (pJob->pShell == NULL) return;
447 /************************************************************************
448 * _pjCreateOutputWidgets
449 * Actually run the specified PrintJob.
450 * Creates the PrintOutput object to be used for printing.
451 * Initializes the mailbox to iterate through the messages.
452 * Calls spoolOne to send a print job to the Xp server.
453 ************************************************************************/
455 _pjCreateOutputWidgets(PrintJob *pJob)
457 DtEditorErrorCode errorCode;
459 DtPrintSetupData *psd = NULL;
463 * Notify the user that we're printing
465 /* TBD: Is there a status bar on pPad? */
467 if (pJob->pShell == NULL)
469 {/* TBD error dialog */}
470 PrintJobDestroy(pJob);
474 pJob->pOutput = PrintOutputCreate(pJob->pShell);
475 PrintOutputSetWordWrap(pJob->pOutput, PrintSetupUseWordWrap(pJob->pSetup));
476 PrintOutputSetPageMargins(
478 PrintSetupGetMarginSpec(pJob->pSetup, DTPRINT_OPTION_MARGIN_TOP),
479 PrintSetupGetMarginSpec(pJob->pSetup, DTPRINT_OPTION_MARGIN_RIGHT),
480 PrintSetupGetMarginSpec(pJob->pSetup, DTPRINT_OPTION_MARGIN_BOTTOM),
481 PrintSetupGetMarginSpec(pJob->pSetup, DTPRINT_OPTION_MARGIN_LEFT),
487 * Display an error dialog.
488 DtMailGenDialog *genDialog = new DtMailGenDialog(
490 _parent->baseWidget());
495 i18nMsg = GETMESSAGE(
497 "One of the following margin specifiers \n has incorrect syntax: \n %s \n %s \n %s \n %s \nContinue using default margins?"
500 errMsg = (char *) XtMalloc(1024);
504 PrintSetupGetMarginSpec(pJob->pSetup, DTPRINT_OPTION_MARGIN_TOP),
505 PrintSetupGetMarginSpec(pJob->pSetup, DTPRINT_OPTION_MARGIN_RIGHT),
506 PrintSetupGetMarginSpec(pJob->pSetup, DTPRINT_OPTION_MARGIN_BOTTOM),
507 PrintSetupGetMarginSpec(pJob->pSetup, DTPRINT_OPTION_MARGIN_LEFT)
510 Warning(pJob->pPad, (char *) errMsg, XmDIALOG_WARNING);
517 errorCode = PrintOutputLoadFile(pJob->pOutput, pJob->tempFileName);
520 case DtEDITOR_NO_ERRORS:
521 case DtEDITOR_READ_ONLY_FILE:
523 case DtEDITOR_NONEXISTENT_FILE:
526 (char *) GETMESSAGE(14, 2, "File does not exist."),
529 case DtEDITOR_DIRECTORY:
532 (char *) GETMESSAGE(14, 3, "Specified file is a directory."),
535 case DtEDITOR_CHAR_SPECIAL_FILE:
536 case DtEDITOR_BLOCK_MODE_FILE:
539 (char *) GETMESSAGE(14, 4, "File type error."),
542 case DtEDITOR_NULLS_REMOVED:
545 (char *) GETMESSAGE(14, 5, "File contains NULL characters."),
548 case DtEDITOR_INSUFFICIENT_MEMORY:
552 GETMESSAGE(14, 6, "Unable to load file (insufficient memory)."),
555 case DtEDITOR_NO_FILE_ACCESS:
556 case DtEDITOR_UNREADABLE_FILE:
561 GETMESSAGE(14, 7, "File does not have read permissions"),
566 XtRealizeWidget( pJob->pShell );
568 PrintOutputFirstPage(pJob->pOutput);
569 pJob->npagesTotal = PrintOutputGetNumLines(pJob->pOutput) +
570 PrintOutputGetLinesPerPage(pJob->pOutput) - 1;
571 pJob->npagesTotal /= PrintOutputGetLinesPerPage(pJob->pOutput);
572 pJob->npagesDone = 0;
578 /************************************************************************
580 * Actually run the specified PrintJob.
581 * Creates the PrintOutput object to be used for printing.
582 * Initializes the mailbox to iterate through the messages.
583 * Calls spoolOne to send a print job to the Xp server.
584 ************************************************************************/
586 _pjDoPrint(PrintJob *pJob)
588 static char buf[1024];
590 DtPrintSetupData *psd = NULL;
594 * Notify the user that we're printing
596 if (pJob->pPad != NULL) {
597 pJob->pPad->numPendingTasks++;
598 format = GETMESSAGE(14, 21, "Printing %s ...");
599 sprintf(buf, format, pJob->documentName);
600 SetStatusMessage(pJob->pPad, buf);
601 XtSetSensitive(pJob->pPad->fileStuff.fileWidgets.printBtn, False);
604 #ifndef PRINT_TO_VIDEO
605 psd = pJob->printData;
607 if (psd->destination == DtPRINT_TO_FILE)
610 _pjRegisterActivePrintDisplay(XtDisplay(pJob->pShell));
611 XpStartJob(XtDisplay(pJob->pShell), dest);
612 XFlush(XtDisplay(pJob->pShell));
614 if (psd->destination == DtPRINT_TO_FILE)
616 if (FALSE == XmPrintToFile(
617 XtDisplay(pJob->pShell),
619 _pjFinishedPrintToFile,
622 char *fmt = "%s\n%s: %s";
624 char *appmessage = NULL;
625 char *sysmessage = strerror(errno);
627 appmessage = (char *) GETMESSAGE(
629 "'Print to File' was unsuccessful.");
631 if (NULL == sysmessage)
633 message = XtMalloc(strlen(appmessage) + 1);
634 sprintf(message, "%s", appmessage);
641 strlen(psd->dest_info) +
643 sprintf(message, fmt, appmessage, psd->dest_info, sysmessage);
646 Warning(pJob->pPad, message, XmDIALOG_WARNING);
649 XpCancelJob(XtDisplay(pJob->pShell), False);
650 PrintJobDestroy(pJob);
656 /************************************************************************
657 * _pjUpdatePageHeaders
658 * Configures the header and footer string in the PrintOutput.
659 ************************************************************************/
661 _pjUpdatePageHeaders(
663 PrintStringTypeEnum hl_type,
664 PrintStringTypeEnum hr_type,
665 PrintStringTypeEnum fl_type,
666 PrintStringTypeEnum fr_type
674 if (pJob == (PrintJob *) NULL) return;
676 hl_string = _pjGetPageHeaderString(pJob, hl_type);
677 hr_string = _pjGetPageHeaderString(pJob, hr_type);
678 fl_string = _pjGetPageHeaderString(pJob, fl_type);
679 fr_string = _pjGetPageHeaderString(pJob, fr_type);
681 if (PRINT_NONE_STRING_TYPE_ENUM == hl_type &&
682 PRINT_NONE_STRING_TYPE_ENUM == hr_type)
683 PrintOutputHideHeaders(pJob->pOutput);
685 PrintOutputShowHeaders(pJob->pOutput);
687 if (PRINT_NONE_STRING_TYPE_ENUM == fl_type &&
688 PRINT_NONE_STRING_TYPE_ENUM == fr_type)
689 PrintOutputHideFooters(pJob->pOutput);
691 PrintOutputShowFooters(pJob->pOutput);
694 PrintOutputSetHdrFtrStrings(
707 /************************************************************************
708 * _pjGetPageHeaderString
709 * Returns a header and footer string of the specified type.
710 ************************************************************************/
712 _pjGetPageHeaderString(PrintJob *pJob, PrintStringTypeEnum type)
715 *buf = (char *) NULL;
719 case PRINT_NONE_STRING_TYPE_ENUM:
722 case PRINT_DATE_STRING_TYPE_ENUM:
727 clock = time((time_t*) NULL);
728 date = ctime(&clock);
729 /* Strip off the trailing newline. */
730 date[strlen(date)-1] = '\0';
731 format = GETMESSAGE(14, 8, "Date: %s");
732 buf = (char *) malloc(strlen(format) + strlen(date) + 1);
733 if (buf != (char *) NULL)
734 sprintf(buf, format, date);
737 case PRINT_DOCNAME_STRING_TYPE_ENUM:
741 format = GETMESSAGE(14, 9, "Document: %s");
742 buflen = strlen(format) + strlen(pJob->documentName) + 1;
743 buf = (char *) malloc(buflen);
744 if (buf != (char *) NULL)
745 sprintf(buf, format, pJob->documentName);
748 case PRINT_PAGE_NUMBER_STRING_TYPE_ENUM:
750 * Allocate space for the format and the translated page number.
753 format = GETMESSAGE(14, 10, "Page %d of %d");
754 buf = (char *) malloc(strlen(format) + 16);
755 if (buf != (char *) NULL)
756 sprintf(buf, format, pJob->npagesDone, pJob->npagesTotal);
759 case PRINT_USER_NAME_STRING_TYPE_ENUM:
761 * Allocate space for the format and the username.
766 format = GETMESSAGE(14, 11, "Document For: %s");
767 pw = getpwuid(getuid());
768 buf = (char *) malloc(strlen(format) + strlen(pw->pw_name) + 1);
769 if (buf != (char *) NULL)
770 sprintf(buf, format, pw->pw_name);
774 buf = strdup("DEFAULT not impld");
783 * Name: _pjFinishedPrintToFile
787 * App-specific print data holder allocate function.
790 static void _pjFinishedPrintToFile(
793 XPGetDocStatus status,
794 XPointer client_data)
796 char *message = NULL;
797 PrintJob *pJob = (PrintJob *) client_data;
798 Editor *pPad = pJob->pPad;
800 if (status != XPGetDocFinished)
803 message = (char *) GETMESSAGE(
805 "'Print to File' was unsuccessful.");
806 Warning(pPad, message, XmDIALOG_WARNING);
808 else if (display != PrintJobGetErrorPrintDisplay())
811 message = (char *) GETMESSAGE(
813 "'Print to File' completed successfully.");
814 Warning(pPad, message, XmDIALOG_INFORMATION);
816 PrintJobDestroy(pJob);
823 * An XtCallbackProc which can be added to the callback list of
824 * a widget to cancel the print job passed back as client_data.
827 _pjCancelCB (Widget widget, XtPointer client_data, XtPointer call_data)
829 PrintJob *pJob = (PrintJob *) client_data;
831 PrintJobDestroy(pJob);
835 * Name: _pjCloseDisplayCB
837 * An XtCallbackProc which can be added to the callback list of
838 * a widget to cancel the print job passed back as client_data.
841 _pjCloseDisplayCB (Widget widget, XtPointer client_data, XtPointer call_data)
843 PrintJob *pJob = (PrintJob *) client_data;
844 DtPrintSetupCallbackStruct *pbs = (DtPrintSetupCallbackStruct *) call_data;
846 if (pJob->pShell != NULL)
848 XtDestroyWidget(pJob->pShell);
851 DtPrintFreeSetupData(pJob->printData);
857 * An XtCallbackProc which can be added to the callback list of
858 * a widget to execute the print job passed back as client_data.
861 _pjPrintCB (Widget widget, XtPointer client_data, XtPointer call_data)
863 PrintJob *pJob = (PrintJob *) client_data;
864 DtPrintSetupCallbackStruct *pbs = (DtPrintSetupCallbackStruct *) call_data;
866 DtPrintCopySetupData(pJob->printData, pbs->print_data);
867 _pjCreatePrintShell(pJob);
873 * Name: _pjPdmSetupCB
875 * An XtCallbackProc which can be added to the callback list of
876 * a widget to popup the PDM for the print job.
879 _pjPdmSetupCB(Widget print_setup, XtPointer client_data, XtPointer call_data)
881 char *pname = "_pjPdmSetupCB";
882 PrintJob *pJob = (PrintJob *) client_data;
883 DtPrintSetupCallbackStruct
884 *pbs = (DtPrintSetupCallbackStruct *) call_data;
886 DtPrintCopySetupData(pJob->printData, pbs->print_data);
887 _pjCreatePrintShell(pJob);
892 Widget shell = print_setup;
894 while (! (shell == NULL || XtIsShell(shell)) )
895 shell = XtParent(shell);
898 XmPrintPopupPDM(pJob->pShell, shell);
900 fprintf(stderr, "Internal Error %s: Missing XmPrintShell.", pname);
905 /************************************************************************
906 * _pjPdmNotificationCB
907 * XmNpdmNotificationCallback for the XmPrintShell
908 ************************************************************************/
910 _pjPdmNotificationCB (Widget widget, XtPointer client_data, XtPointer call_data)
912 PrintJob *pJob = (PrintJob*) client_data;
913 XmPrintShellCallbackStruct *pscbs = (XmPrintShellCallbackStruct*)call_data;
914 char *message = NULL;
916 switch (pscbs->reason)
920 case XmCR_PDM_START_ERROR:
921 case XmCR_PDM_START_VXAUTH:
922 case XmCR_PDM_START_PXAUTH:
923 message = (char *) GETMESSAGE(
925 "Print Dialog Manager error - setup failed.");
933 Warning( pJob->pPad, message, XmDIALOG_WARNING);
938 /************************************************************************
940 * XmNpageSetupCallback for the XmPrintShell
941 ************************************************************************/
945 XtPointer client_data,
949 PrintJob *pJob = (PrintJob *) client_data;
951 XmPrintShellCallbackStruct *pscbs = (XmPrintShellCallbackStruct*)call_data;
954 if (pJob->pOutput == NULL)
956 Dimension width, height;
965 #if defined(PRINT_TO_VIDEO)
966 printf("PrintShell in _pjPrintOnePageCB: <W %d - H %d>\n",width,height);
969 if (width < 100 || height < 100)
971 width = 2550; height=3250;
983 #if defined(PRINT_TO_VIDEO)
985 "PrintShell in _pjPrintOnePageCB: <W %d - H %d>\n",width,height);
988 _pjCreateOutputWidgets(pJob);
991 #ifdef PRINT_TO_VIDEO
992 if (pJob->npagesDone > 0 && pJob->npagesDone == pJob->npagesTotal)
994 if (pscbs->last_page)
997 DtPrintSetupData *psd = pJob->printData;
1000 * This spool job is done. Clean up.
1001 * If this is a print to file job,
1002 * clean up in the job finished callback.
1004 if (psd->destination != DtPRINT_TO_FILE)
1005 PrintJobDestroy(pJob);
1009 if (pJob->npagesDone > 0 && PrintOutputPageDown(pJob->pOutput) == FALSE)
1011 #ifndef PRINT_TO_VIDEO
1012 pscbs->last_page = TRUE;
1018 * Update header and footer strings.
1021 _pjUpdatePageHeaders(
1023 PrintSetupGetHdrFtrSpec(pJob->pSetup, DTPRINT_OPTION_HEADER_LEFT),
1024 PrintSetupGetHdrFtrSpec(pJob->pSetup, DTPRINT_OPTION_HEADER_RIGHT),
1025 PrintSetupGetHdrFtrSpec(pJob->pSetup, DTPRINT_OPTION_FOOTER_LEFT),
1026 PrintSetupGetHdrFtrSpec(pJob->pSetup, DTPRINT_OPTION_FOOTER_RIGHT)
1030 * Notify the user that we're printing
1032 if (pJob->pPad != NULL)
1034 static char buf[1024];
1037 format = GETMESSAGE(14, 22, "Printing %s: page %d of %d ...");
1038 sprintf(buf, format,
1042 SetStatusMessage(pJob->pPad, buf);
1045 #ifndef PRINT_TO_VIDEO
1046 if (pJob->npagesDone >= pJob->npagesTotal)
1047 pscbs->last_page = TRUE;