1 /* $TOG: DmxPrintJob.C /main/30 1998/07/23 18:11:50 mgreess $ */
8 * RESTRICTED CONFIDENTIAL INFORMATION:
10 * The information in this document is subject to special
11 * restrictions in a confidential disclosure agreement between
12 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
13 * document outside HP, IBM, Sun, USL, SCO, or Univel without
14 * Sun's specific written approval. This document and all copies
15 * and derivative works thereof must be returned or destroyed at
18 * Copyright 1994 Sun Microsystems, Inc. All rights reserved.
23 * Common Desktop Environment
25 * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
26 * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
27 * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
28 * (c) Copyright 1993, 1994, 1995 Novell, Inc.
29 * (c) Copyright 1995 Digital Equipment Corp.
30 * (c) Copyright 1995 Fujitsu Limited
31 * (c) Copyright 1995 Hitachi, Ltd.
34 * RESTRICTED RIGHTS LEGEND
36 *Use, duplication, or disclosure by the U.S. Government is subject to
37 *restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
38 *Technical Data and Computer Software clause in DFARS 252.227-7013. Rights
39 *for non-DOD U.S. Government Departments and Agencies are as set forth in
40 *FAR 52.227-19(c)(1,2).
42 *Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A.
43 *International Business Machines Corp., Route 100, Somers, NY 10589 U.S.A.
44 *Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, CA 94043 U.S.A.
45 *Novell, Inc., 190 River Road, Summit, NJ 07901 U.S.A.
46 *Digital Equipment Corp., 111 Powdermill Road, Maynard, MA 01754, U.S.A.
47 *Fujitsu Limited, 1015, Kamikodanaka Nakahara-Ku, Kawasaki 211, Japan
48 *Hitachi, Ltd., 6, Kanda Surugadai 4-Chome, Chiyoda-ku, Tokyo 101, Japan
58 #include <sys/param.h>
59 #include <X11/Intrinsic.h>
60 #include <X11/Shell.h>
65 #include "DmxPrintJob.h"
66 #include "DmxPrintOptions.h"
67 #include "DmxPrintOutput.h"
68 #include "DmxPrintSetup.h"
69 #include "DtMailGenDialog.hh"
70 #include "DtMailDialogCallbackData.hh"
77 // Public class methods
80 DmxPrintJob::DmxPrintJob(
84 ) : UIComponent( "PrintJob" )
86 _next_msg = (DmxMsg *) NULL;
87 _filename = strdup(filename);
88 _mailbox = (DmxMailbox *) NULL;
90 _print_output = (DmxPrintOutput *) NULL;
91 _print_setup = (DmxPrintSetup *) NULL;
92 _print_data = (DtPrintSetupData *) XtMalloc(sizeof(DtPrintSetupData));
93 memset((void*) _print_data, 0, sizeof(DtPrintSetupData));
94 _pshell = (Widget) NULL;
97 _spool_msg_info = (DmxMsgInfo *) NULL;
98 _spool_nmsgs_done = 0;
99 _spool_nmsgs_total = 0;
100 _spool_npages_done = 0;
101 _spool_npages_total = 0;
102 _w = XtCreateWidget(_name, coreWidgetClass, _parent->baseWidget(), NULL, 0);
103 installDestroyHandler();
105 _nextpage_shell = NULL;
106 _nextpage_button = NULL;
109 DmxPrintJob::~DmxPrintJob (void)
112 // Unregister the fact that we have a print job running so
113 // dtmail can terminate.
116 _parent->unregisterPendingTask();
130 XtFree((char*) _spool_msg_info);
131 _spool_msg_info = NULL;
135 delete _print_output;
136 _print_output = NULL;
145 XtDestroyWidget(_pshell);
150 DtPrintFreeSetupData(_print_data);
151 XtFree((char *) _print_data);
156 XtDestroyWidget(_nextpage_shell);
157 _nextpage_shell = NULL;
162 // Do not destroy this widget.
163 // BasicComponent takes care of this for us.
169 * Name: DmxPrintJob::cancel
171 * Public method used to cancel the print job.
174 DmxPrintJob::cancel(void)
177 _parent->clearStatus();
181 Display *display = XtDisplay(_pshell);
183 theRoamApp.unregisterActivePrintDisplay(display);
184 if (display == theRoamApp.getErrorPrintDisplay())
187 // Need to display an error dialog;
189 DtMailGenDialog *genDialog = new DtMailGenDialog(
191 _parent->baseWidget());
195 "The X Print Server is temporarily out of resources.");
197 genDialog->setToErrorDialog(GETMSG(DT_catd, 1, 6, "Mailer"),
199 genDialog->post_and_return(GETMSG(DT_catd, 3, 9, "OK"), NULL);
202 theRoamApp.setErrorPrintDisplay(NULL);
209 * Name: DmxPrintJob::execute
211 * Public method used to execute the print job.
214 DmxPrintJob::execute (void)
216 theRoamApp.busyAllWindows();
217 _print_setup = new DmxPrintSetup(
218 _parent->baseWidget(),
219 &DmxPrintJob::printCB, (XtPointer) this,
220 &DmxPrintJob::cancelCB, (XtPointer) this,
221 &DmxPrintJob::closeDisplayCB, (XtPointer) this,
222 &DmxPrintJob::pdmSetupCB, (XtPointer) this);
225 // load in the messages
227 _mailbox = new DmxMailbox(_filename);
228 _mailbox->loadMessages();
229 _next_msg = _mailbox->firstMessage();
231 if (_mailbox->numMessages() == 1)
234 char *orig_subject = _next_msg->getMessageHeader(DMXSUBJ);
235 int orig_len = strlen(orig_subject);
236 char *subject = (char*) malloc(orig_len+1);
237 char *filename = (char*) malloc(MAXPATHLEN+1);
240 for (i=0,j=0,last_space=0; i<orig_len; i++)
242 if (isspace(orig_subject[i]))
244 if (last_space < i-1)
248 else if (orig_subject[i] == '/')
251 subject[j++] = orig_subject[i];
254 sprintf(filename, "%s/%s.ps", getenv("HOME"), subject);
256 _print_setup->setPrintToFileName(filename);
261 theRoamApp.unbusyAllWindows();
264 if (DTM_TRUE != _print_setup->getDefaultPrintData(_print_data))
266 // DtPrintSetupDialog is popped up automatically.
273 _print_setup->display();
280 // Private class methods
284 * Name: DmxPrintJob::createPrintShell
286 * Creates the XmPrint Shell widget.
289 DmxPrintJob::createPrintShell (void)
292 DtMail::Session *d_session = theRoamApp.session()->session();
294 if (_pshell != NULL) return;
297 // Create the print shell and
298 // the print output widgets
300 #ifdef PRINT_TO_VIDEO
304 * Create a dialog shell widget on the video display.
306 _pshell = XmCreateDialogShell(_parent->baseWidget(), "PrintVideo", NULL, 0);
308 _nextpage_shell = XtVaCreateWidget(
310 topLevelShellWidgetClass,
311 _parent->baseWidget(),
316 xms = XmStringCreateLocalized("Push for Next Page");
317 _nextpage_button = XtVaCreateManagedWidget(
319 xmPushButtonWidgetClass,
330 &DmxPrintJob::printOnePageCB,
333 XtRealizeWidget(_nextpage_shell);
334 XtManageChild(_nextpage_shell);
337 * Create an XmPrintShell widget on the video display.
339 _pshell = XmPrintSetup(
340 _parent->baseWidget(),
341 XpGetScreenOfContext(
342 _print_data->print_display,
343 _print_data->print_context),
349 XmNpageSetupCallback,
350 &DmxPrintJob::printOnePageCB,
354 XmNpdmNotificationCallback,
355 &DmxPrintJob::pdmNotificationCB,
362 * Name: DmxPrintJob::createOutputWidgets
364 * Creates the DmxPrintOutput object to be used for printing.
367 DmxPrintJob::createOutputWidgets (void)
370 DtMail::Session *d_session = theRoamApp.session()->session();
371 DtMailBoolean parse_error = DTM_FALSE;
377 _print_output = new DmxPrintOutput( _pshell );
378 _print_output->setWrapToFit(_print_setup->useWordWrap());
379 top = DmxPrintOptions::getMarginSpec(DTPRINT_OPTION_MARGIN_TOP);
380 right = DmxPrintOptions::getMarginSpec(DTPRINT_OPTION_MARGIN_RIGHT);
381 bottom = DmxPrintOptions::getMarginSpec(DTPRINT_OPTION_MARGIN_BOTTOM);
382 left = DmxPrintOptions::getMarginSpec(DTPRINT_OPTION_MARGIN_LEFT);
383 _print_output->setPageMargins(top, right, bottom, left, &parse_error);
386 DtMailGenDialog *genDialog = new DtMailGenDialog(
388 _parent->baseWidget());
389 char *errMsg = (char *) XtMalloc(1024);
394 "One of the following margin specifiers \n has incorrect syntax: \n %s \n %s \n %s \n %s \nContinue using default margins?"
397 sprintf(errMsg, i18nMsg, top, right, bottom, left);
398 genDialog->setToErrorDialog(
399 GETMSG(DT_catd, 21, 3, "Mailer"),
403 genDialog->post_and_return(
404 GETMSG(DT_catd, 21, 4, "OK"),
409 XtRealizeWidget( _pshell );
416 free((void*) bottom);
422 ok_cb(DtMailGenDialog *genDialog)
428 * Name: DmxPrintJob::doPrint
430 * Creates a DmxMailbox and loads the contents of the message file.
431 * Initializes the mailbox to iterate through the messages.
432 * Calls XmPrintToFile or XpStartJob to initiate printing.
435 DmxPrintJob::doPrint (void)
438 DtMail::Session *d_session = theRoamApp.session()->session();
439 XPSaveData dest = XPSpool;
442 // Notify the user that we're printing
444 if (_parent != NULL) {
445 char *buf = new char[1024];
446 char *msg = GETMSG(DT_catd, 21, 1, "Printing %s ...");
447 sprintf(buf, msg, _filename);
448 _parent->setStatus(buf);
451 // Register the fact that we have a print job running so
452 // dtmail will not terminate in the middle.
454 _parent->registerPendingTask();
459 // load in the messages
461 // Moved to DmxPrintJob::execute
463 //_mailbox = new DmxMailbox(_filename);
464 //_mailbox->loadMessages();
465 //_next_msg = _mailbox->firstMessage();
468 _spool_msg_info = (DmxMsgInfo *) XtCalloc(
469 _mailbox->numMessages(),
472 #ifndef PRINT_TO_VIDEO
473 if (_print_data == NULL) return;
475 if (_print_data->destination == DtPRINT_TO_FILE)
478 theRoamApp.registerActivePrintDisplay(XtDisplay(_pshell));
479 XpStartJob(XtDisplay(_pshell), dest);
480 XFlush(XtDisplay(_pshell));
482 if (_print_data->destination == DtPRINT_TO_FILE)
484 if (FALSE == XmPrintToFile(
486 _print_data->dest_info,
487 (XPFinishProc) &DmxPrintJob::finishedPrintToFile,
490 char *fmt = "%s\n%s: %s";
491 DtMailGenDialog *genDialog;
492 char *appmessage = NULL;
493 char *message = NULL;
494 char *sysmessage = strerror(errno);
495 Widget w = (Widget) this->_parent->baseWidget();
497 XpCancelJob(XtDisplay(_pshell), False);
498 XFlush(XtDisplay(_pshell));
500 genDialog = new DtMailGenDialog("Dialog", w);
501 appmessage = (char *) GETMSG(
503 "'Print to File' was unsuccessful.");
505 if (NULL == sysmessage)
507 message = XtMalloc(strlen(appmessage) + 1);
508 sprintf(message, "%s", appmessage);
515 strlen(_print_data->dest_info) +
519 appmessage, _print_data->dest_info, sysmessage);
522 genDialog->setToErrorDialog(
523 GETMSG(DT_catd, 21, 3, "Mailer"),
526 genDialog->post_and_return(
527 GETMSG(DT_catd, 21, 4, "OK"),
531 genDialog->post((void*) genDialog, (DialogCallback) ok_cb);
544 DmxPrintJob::loadOutputWidgets(void)
549 _print_output->clearContents();
550 _spool_nmsgs_done = 0;
551 _spool_nmsgs_total = 0;
552 _spool_npages_done = 0;
553 _spool_npages_total = 0;
559 DmxPrintOptions::getPrintedHeaders(),
560 (DmxMsg::DmxPrintOutputProc) fprintf,
564 DmxPrintOptions::getPrintedHeaders(),
565 &DmxPrintOutput::appendContents,
566 (XtPointer) _print_output);
568 switch (DmxPrintOptions::getMessageSeparator())
570 case DMX_SEPARATOR_BLANK_LINE:
571 _print_output->appendNewLine();
572 _print_output->appendNewLine();
574 case DMX_SEPARATOR_CHARACTER_LINE:
576 #define DMXPJ_MAX_SEPARATOR_LENGTH 100
578 const char *separator_string;
581 separator_string = DmxPrintOptions::getSeparatorString();
582 len = strlen(separator_string);
583 nchars = _print_output->getCharactersPerLine() - 5;
584 #ifdef PRINT_TO_VIDEO
585 fprintf(stderr, "getCharactersPerLine: <%d>\n", nchars);
587 nchars = (nchars < DMXPJ_MAX_SEPARATOR_LENGTH) ?
588 nchars : DMXPJ_MAX_SEPARATOR_LENGTH;
589 buffer = XtMalloc(nchars+len+1);
591 for (int i=0; i<nchars-1; i+=len)
593 int nbytes = (len < nchars-i) ? len : nchars-i;
594 strncat(buffer, separator_string, nbytes);
596 buffer[nchars-1] = '\0';
598 _print_output->appendNewLine();
599 _print_output->appendContents((void*) _print_output, buffer);
600 _print_output->appendNewLine();
601 _print_output->appendNewLine();
604 if (NULL != separator_string)
605 free((void*) separator_string);
609 case DMX_SEPARATOR_PAGE_BREAK:
610 case DMX_SEPARATOR_NEW_JOB:
611 _print_output->appendPageBreak();
613 case DMX_SEPARATOR_NEW_LINE:
615 _print_output->appendNewLine();
619 assert(_spool_nmsgs_total < _mailbox->numMessages());
620 _spool_msg_info[_spool_nmsgs_total].msg = _next_msg;
621 _spool_msg_info[_spool_nmsgs_total].end_position =
622 _print_output->getLastPosition();
624 _spool_nmsgs_total++;
626 } while ( ( (_next_msg = _mailbox->nextMessage()) != (DmxMsg *) NULL ) &&
627 ( (! _print_setup->printSeparately()) ||
628 (_print_data->destination == DtPRINT_TO_FILE ) )
632 _print_output->setTopPosition(0);
633 _spool_npages_total = _print_output->getNumLines() +
634 _print_output->getLinesPerPage() - 1;
635 _spool_npages_total /= _print_output->getLinesPerPage();
641 DmxPrintJob::printOnePageCB(
643 XtPointer client_data,
646 DmxPrintJob *thisJob = (DmxPrintJob *) client_data;
648 XmPrintShellCallbackStruct *pscbs = (XmPrintShellCallbackStruct*)call_data;
652 if (thisJob->_print_output == NULL)
655 Dimension width, height;
664 printf("PrintShell in PrintOnePageCB: <W %d - H %d>\n", width, height);
667 if (width < 100 || height < 100)
669 width = 2550; height=3250;
683 printf("PrintShell in PrintOnePageCB: <W %d - H %d>\n",
688 thisJob->createOutputWidgets();
689 if (! thisJob->loadOutputWidgets())
696 #ifndef PRINT_TO_VIDEO
697 if (pscbs->last_page)
699 if (thisJob->_spool_npages_done == thisJob->_spool_npages_total)
705 // This spool job is done.
706 // Try spooling the next one.
708 if (! thisJob->loadOutputWidgets())
710 if (thisJob->_print_data->destination != DtPRINT_TO_FILE)
716 // Register a work proc to print one page at a time
718 #ifndef PRINT_TO_VIDEO
719 if (thisJob->_print_data->destination == DtPRINT_TO_FILE)
722 XpStartJob(XtDisplay(thisJob->_pshell), dest);
723 XFlush(XtDisplay(thisJob->_pshell));
725 if (thisJob->_print_data->destination == DtPRINT_TO_FILE)
727 XtDisplay(thisJob->_pshell),
728 thisJob->_print_data->dest_info,
729 (XPFinishProc) &DmxPrintJob::finishedPrintToFile,
736 if (thisJob->_spool_npages_done == 0)
738 thisJob->_print_output->setTopPosition(0);
740 else if (! thisJob->_print_output->pageDown())
742 #ifndef PRINT_TO_VIDEO
743 pscbs->last_page = TRUE;
749 int top = thisJob->_print_output->getTopPosition();
750 int currmsg_i = thisJob->_spool_nmsgs_done;
753 // Find the index into the ._spool_msg_info array of the
754 // message which will begin the next page. This message
755 // will be used to set the header and footer strings.
757 while (top > thisJob->_spool_msg_info[currmsg_i].end_position &&
758 currmsg_i < thisJob->_spool_nmsgs_total)
761 assert(top <= thisJob->_spool_msg_info[currmsg_i].end_position);
762 thisJob->_spool_nmsgs_done = currmsg_i;
765 currmsg = thisJob->_spool_msg_info[thisJob->_spool_nmsgs_done].msg;
766 assert(currmsg != (DmxMsg *) NULL);
767 if (currmsg == (DmxMsg *) NULL)
769 #ifndef PRINT_TO_VIDEO
770 pscbs->last_page = TRUE;
776 // Update header and footer strings.
778 thisJob->_spool_npages_done++;
779 thisJob->updatePageHeaders(
781 DmxPrintOptions::getHdrFtrSpec(DTPRINT_OPTION_HEADER_LEFT),
782 DmxPrintOptions::getHdrFtrSpec(DTPRINT_OPTION_HEADER_RIGHT),
783 DmxPrintOptions::getHdrFtrSpec(DTPRINT_OPTION_FOOTER_LEFT),
784 DmxPrintOptions::getHdrFtrSpec(DTPRINT_OPTION_FOOTER_RIGHT)
787 #ifndef PRINT_TO_VIDEO
788 if (thisJob->_spool_npages_done >= thisJob->_spool_npages_total)
789 pscbs->last_page = TRUE;
795 DmxPrintJob::updatePageHeaders(
797 DmxStringTypeEnum hl_type,
798 DmxStringTypeEnum hr_type,
799 DmxStringTypeEnum fl_type,
800 DmxStringTypeEnum fr_type
808 if (msg == (DmxMsg *) NULL)
811 hl_string = getPageHeaderString(msg, hl_type);
812 hr_string = getPageHeaderString(msg, hr_type);
813 fl_string = getPageHeaderString(msg, fl_type);
814 fr_string = getPageHeaderString(msg, fr_type);
816 _print_output->setHdrFtrStrings(
822 if (DMX_NONE_STRING == hl_type && DMX_NONE_STRING == hr_type)
823 _print_output->hideHeaders();
825 _print_output->showHeaders();
827 if (DMX_NONE_STRING == fl_type && DMX_NONE_STRING == fr_type)
828 _print_output->hideFooters();
830 _print_output->showFooters();
839 DmxPrintJob::getPageHeaderString(
841 DmxStringTypeEnum type
845 *buf = (char *) NULL;
848 if (msg == (DmxMsg *) NULL)
853 case DMX_NONE_STRING:
856 case DMX_CC_HEADER_STRING:
858 char *hdrstr = msg->getMessageHeader(DMXCC);
860 format = GETMSG(DT_catd, 21, 5, "Cc: %s");
861 buf = (char *) malloc(strlen(format) + strlen(hdrstr) + 1);
862 if (buf != (char *) NULL)
863 sprintf(buf, format, hdrstr);
868 case DMX_DATE_HEADER_STRING:
870 char *hdrstr = msg->getMessageHeader(DMXDATE);
872 format = GETMSG(DT_catd, 21, 6, "Date: %s");
873 buf = (char *) malloc(strlen(format) + strlen(hdrstr) + 1);
874 if (buf != (char *) NULL)
875 sprintf(buf, format, hdrstr);
880 case DMX_FROM_HEADER_STRING:
882 char *hdrstr = msg->getMessageHeader(DMXFROM);
884 format = GETMSG(DT_catd, 21, 7, "From: %s");
885 buf = (char *) malloc(strlen(format) + strlen(hdrstr) + 1);
886 if (buf != (char *) NULL)
887 sprintf(buf, format, hdrstr);
892 case DMX_SUBJECT_HEADER_STRING:
894 char *hdrstr = msg->getMessageHeader(DMXSUBJ);
896 format = GETMSG(DT_catd, 21, 8, "Subject: %s");
897 buf = (char *) malloc(strlen(format) + strlen(hdrstr) + 1);
898 if (buf != (char *) NULL)
899 sprintf(buf, format, hdrstr);
904 case DMX_TO_HEADER_STRING:
906 char *hdrstr = msg->getMessageHeader(DMXTO);
908 format = GETMSG(DT_catd, 21, 9, "To: %s");
909 buf = (char *) malloc(strlen(format) + strlen(hdrstr) + 1);
910 if (buf != (char *) NULL)
911 sprintf(buf, format, hdrstr);
916 case DMX_PAGE_NUMBER_STRING:
918 // Allocate space for the format and the translated page number.
921 format = GETMSG(DT_catd, 21, 10, "Page %d of %d");
922 buf = (char *) malloc(strlen(format) + 16);
923 if (buf != (char *) NULL)
924 sprintf(buf, format, _spool_npages_done, _spool_npages_total);
927 case DMX_USER_NAME_STRING:
929 // Allocate space for the format and the username.
934 format = GETMSG(DT_catd, 21, 11, "Mail For: %s");
935 pw = getpwuid(getuid());
936 buf = (char *) malloc(strlen(format) + strlen(pw->pw_name) + 1);
937 if (buf != (char *) NULL)
938 sprintf(buf, format, pw->pw_name);
942 buf = strdup("DEFAULT not impld");
949 * Name: DmxPrintJob::finishedPrintToFile
953 DmxPrintJob::finishedPrintToFile(
956 XPGetDocStatus status,
957 XPointer client_data)
960 DmxPrintJob *thisJob = (DmxPrintJob*) client_data;
961 Widget w = (Widget) thisJob->_parent->baseWidget();
962 char *message = NULL;
964 if (status != XPGetDocFinished)
966 DtMailGenDialog *genDialog = new DtMailGenDialog("Dialog", w);
968 message = (char *) GETMSG(
970 "'Print to File' was unsuccessful.");
971 genDialog->setToErrorDialog(
972 GETMSG(DT_catd, 21, 3, "Mailer"),
974 genDialog->post_and_return(
975 GETMSG(DT_catd, 21, 4, "OK"),
979 else if (display != theRoamApp.getErrorPrintDisplay())
981 DtMailGenDialog *genDialog = new DtMailGenDialog("Dialog", w);
983 message = (char *) GETMSG(
985 "'Print to File' completed successfully");
987 genDialog->setToWarningDialog(
988 GETMSG(DT_catd, 21, 3, "Mailer"),
990 genDialog->post_and_return(
991 GETMSG(DT_catd, 21, 4, "OK"),
999 * Name: DmxPrintJob::cancelCB
1001 * An XtCallbackProc which can be added to the callback list of
1002 * a widget to cancel the print job passed back as client_data.
1005 DmxPrintJob::cancelCB (Widget, XtPointer client_data, XtPointer)
1007 DmxPrintJob *thisJob = (DmxPrintJob *) client_data;
1013 * Name: DmxPrintJob::closeDisplayCB
1015 * An XtCallbackProc which can be added to the callback list of
1016 * a widget to react to the print setup closing the display.
1019 DmxPrintJob::closeDisplayCB (Widget, XtPointer client_data, XtPointer call_data)
1021 DmxPrintJob *thisJob = (DmxPrintJob *) client_data;
1022 DtPrintSetupCallbackStruct *pbs = (DtPrintSetupCallbackStruct *) call_data;
1024 if (thisJob->_pshell != NULL)
1026 XtDestroyWidget(thisJob->_pshell);
1027 thisJob->_pshell = NULL;
1029 DtPrintFreeSetupData(thisJob->_print_data);
1033 * Name: DmxPrintJob::pdmNotificationCB
1035 * XmNpdmNotificationCallback for the XmPrintShell
1038 DmxPrintJob::pdmNotificationCB(
1040 XtPointer client_data,
1041 XtPointer call_data)
1043 DmxPrintJob *thisJob = (DmxPrintJob *) client_data;
1044 XmPrintShellCallbackStruct *pscbs = (XmPrintShellCallbackStruct*)call_data;
1045 char *message = NULL;
1047 switch (pscbs->reason)
1051 case XmCR_PDM_START_ERROR:
1052 case XmCR_PDM_START_VXAUTH:
1053 case XmCR_PDM_START_PXAUTH:
1054 message = (char *) GETMSG(
1056 "Print Dialog Manager error - setup failed.");
1063 if (message != NULL)
1065 DtMailGenDialog *genDialog = new DtMailGenDialog(
1067 thisJob->_parent->baseWidget());
1068 genDialog->setToErrorDialog(
1069 GETMSG(DT_catd, 21, 3, "Mailer"),
1071 genDialog->post_and_return(
1072 GETMSG(DT_catd, 21, 25, "Continue"),
1079 * Name: DmxPrintJob::pdmSetupCB
1081 * An XtCallbackProc which can be added to the callback list of
1082 * a widget to execute the print job passed back as client_data.
1085 DmxPrintJob::pdmSetupCB(
1087 XtPointer client_data,
1088 XtPointer call_data)
1090 DmxPrintJob *thisJob = (DmxPrintJob *) client_data;
1091 DtPrintSetupCallbackStruct *pbs = (DtPrintSetupCallbackStruct *) call_data;
1093 DtPrintCopySetupData(thisJob->_print_data, pbs->print_data);
1094 thisJob->createPrintShell();
1096 if (thisJob->_pshell)
1098 Widget shell = print_setup;
1100 while (! (shell == NULL || XtIsShell(shell)) )
1101 shell = XtParent(shell);
1104 XmPrintPopupPDM(thisJob->_pshell, shell);
1106 fprintf(stderr, "Internal Error %s: Missing XmPrintShell\n");
1111 * Name: DmxPrintJob::printCB
1113 * An XtCallbackProc which can be added to the callback list of
1114 * a widget to execute the print job passed back as client_data.
1117 DmxPrintJob::printCB (Widget, XtPointer client_data, XtPointer call_data)
1119 DmxPrintJob *thisJob = (DmxPrintJob *) client_data;
1120 DtPrintSetupCallbackStruct *pbs = (DtPrintSetupCallbackStruct *) call_data;
1122 /* TBD: Save options??? */
1124 DtPrintCopySetupData(thisJob->_print_data, pbs->print_data);
1125 thisJob->createPrintShell();