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 libraries 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: DmxPrintJob.C /main/30 1998/07/23 18:11:50 mgreess $ */
30 * RESTRICTED CONFIDENTIAL INFORMATION:
32 * The information in this document is subject to special
33 * restrictions in a confidential disclosure agreement between
34 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
35 * document outside HP, IBM, Sun, USL, SCO, or Univel without
36 * Sun's specific written approval. This document and all copies
37 * and derivative works thereof must be returned or destroyed at
40 * Copyright 1994 Sun Microsystems, Inc. All rights reserved.
45 * Common Desktop Environment
47 * (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
48 * (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
49 * (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
50 * (c) Copyright 1993, 1994, 1995 Novell, Inc.
51 * (c) Copyright 1995 Digital Equipment Corp.
52 * (c) Copyright 1995 Fujitsu Limited
53 * (c) Copyright 1995 Hitachi, Ltd.
56 * RESTRICTED RIGHTS LEGEND
58 *Use, duplication, or disclosure by the U.S. Government is subject to
59 *restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
60 *Technical Data and Computer Software clause in DFARS 252.227-7013. Rights
61 *for non-DOD U.S. Government Departments and Agencies are as set forth in
62 *FAR 52.227-19(c)(1,2).
64 *Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A.
65 *International Business Machines Corp., Route 100, Somers, NY 10589 U.S.A.
66 *Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, CA 94043 U.S.A.
67 *Novell, Inc., 190 River Road, Summit, NJ 07901 U.S.A.
68 *Digital Equipment Corp., 111 Powdermill Road, Maynard, MA 01754, U.S.A.
69 *Fujitsu Limited, 1015, Kamikodanaka Nakahara-Ku, Kawasaki 211, Japan
70 *Hitachi, Ltd., 6, Kanda Surugadai 4-Chome, Chiyoda-ku, Tokyo 101, Japan
80 #include <sys/param.h>
81 #include <X11/Intrinsic.h>
82 #include <X11/Shell.h>
85 #if 0 && defined(PRINTING_SUPPORTED)
87 #endif /* PRINTING_SUPPORTED */
89 #include "DmxPrintJob.h"
90 #include "DmxPrintOptions.h"
91 #include "DmxPrintOutput.h"
92 #include "DmxPrintSetup.h"
93 #include "DtMailGenDialog.hh"
94 #include "DtMailDialogCallbackData.hh"
101 // Public class methods
104 DmxPrintJob::DmxPrintJob(
106 DtMailBoolean silent,
108 ) : UIComponent( "PrintJob" )
110 _next_msg = (DmxMsg *) NULL;
111 _filename = strdup(filename);
112 _mailbox = (DmxMailbox *) NULL;
114 _print_output = (DmxPrintOutput *) NULL;
115 _print_setup = (DmxPrintSetup *) NULL;
116 _print_data = (DtPrintSetupData *) XtMalloc(sizeof(DtPrintSetupData));
117 memset((void*) _print_data, 0, sizeof(DtPrintSetupData));
118 _pshell = (Widget) NULL;
121 _spool_msg_info = (DmxMsgInfo *) NULL;
122 _spool_nmsgs_done = 0;
123 _spool_nmsgs_total = 0;
124 _spool_npages_done = 0;
125 _spool_npages_total = 0;
126 _w = XtCreateWidget(_name, coreWidgetClass, _parent->baseWidget(), NULL, 0);
127 installDestroyHandler();
129 _nextpage_shell = NULL;
130 _nextpage_button = NULL;
133 DmxPrintJob::~DmxPrintJob (void)
136 // Unregister the fact that we have a print job running so
137 // dtmail can terminate.
140 _parent->unregisterPendingTask();
154 XtFree((char*) _spool_msg_info);
155 _spool_msg_info = NULL;
159 delete _print_output;
160 _print_output = NULL;
169 XtDestroyWidget(_pshell);
174 DtPrintFreeSetupData(_print_data);
175 XtFree((char *) _print_data);
180 XtDestroyWidget(_nextpage_shell);
181 _nextpage_shell = NULL;
186 // Do not destroy this widget.
187 // BasicComponent takes care of this for us.
193 * Name: DmxPrintJob::cancel
195 * Public method used to cancel the print job.
198 DmxPrintJob::cancel(void)
201 _parent->clearStatus();
205 Display *display = XtDisplay(_pshell);
207 theRoamApp.unregisterActivePrintDisplay(display);
208 if (display == theRoamApp.getErrorPrintDisplay())
211 // Need to display an error dialog;
213 DtMailGenDialog *genDialog = new DtMailGenDialog(
215 _parent->baseWidget());
219 "The X Print Server is temporarily out of resources.");
221 genDialog->setToErrorDialog(GETMSG(DT_catd, 1, 6, "Mailer"),
223 genDialog->post_and_return(GETMSG(DT_catd, 3, 9, "OK"), NULL);
226 theRoamApp.setErrorPrintDisplay(NULL);
233 * Name: DmxPrintJob::execute
235 * Public method used to execute the print job.
238 DmxPrintJob::execute (void)
240 theRoamApp.busyAllWindows();
241 _print_setup = new DmxPrintSetup(
242 _parent->baseWidget(),
243 &DmxPrintJob::printCB, (XtPointer) this,
244 &DmxPrintJob::cancelCB, (XtPointer) this,
245 &DmxPrintJob::closeDisplayCB, (XtPointer) this,
246 &DmxPrintJob::pdmSetupCB, (XtPointer) this);
249 // load in the messages
251 _mailbox = new DmxMailbox(_filename);
252 _mailbox->loadMessages();
253 _next_msg = _mailbox->firstMessage();
255 if (_mailbox->numMessages() == 1)
258 char *orig_subject = _next_msg->getMessageHeader(DMXSUBJ);
259 int orig_len = strlen(orig_subject);
260 char *subject = (char*) malloc(orig_len+1);
261 char *filename = (char*) malloc(MAXPATHLEN+1);
264 for (i=0,j=0,last_space=0; i<orig_len; i++)
266 if (isspace(orig_subject[i]))
268 if (last_space < i-1)
272 else if (orig_subject[i] == '/')
275 subject[j++] = orig_subject[i];
278 sprintf(filename, "%s/%s.ps", getenv("HOME"), subject);
280 _print_setup->setPrintToFileName(filename);
285 theRoamApp.unbusyAllWindows();
288 if (DTM_TRUE != _print_setup->getDefaultPrintData(_print_data))
290 // DtPrintSetupDialog is popped up automatically.
297 _print_setup->display();
304 // Private class methods
308 * Name: DmxPrintJob::createPrintShell
310 * Creates the XmPrint Shell widget.
313 DmxPrintJob::createPrintShell (void)
315 #if 0 && defined(PRINTING_SUPPORTED)
317 DtMail::Session *d_session = theRoamApp.session()->session();
319 if (_pshell != NULL) return;
322 // Create the print shell and
323 // the print output widgets
325 #ifdef PRINT_TO_VIDEO
329 * Create a dialog shell widget on the video display.
331 _pshell = XmCreateDialogShell(_parent->baseWidget(), "PrintVideo", NULL, 0);
333 _nextpage_shell = XtVaCreateWidget(
335 topLevelShellWidgetClass,
336 _parent->baseWidget(),
341 xms = XmStringCreateLocalized("Push for Next Page");
342 _nextpage_button = XtVaCreateManagedWidget(
344 xmPushButtonWidgetClass,
355 &DmxPrintJob::printOnePageCB,
358 XtRealizeWidget(_nextpage_shell);
359 XtManageChild(_nextpage_shell);
362 * Create an XmPrintShell widget on the video display.
364 _pshell = XmPrintSetup(
365 _parent->baseWidget(),
366 XpGetScreenOfContext(
367 _print_data->print_display,
368 _print_data->print_context),
374 XmNpageSetupCallback,
375 &DmxPrintJob::printOnePageCB,
379 XmNpdmNotificationCallback,
380 &DmxPrintJob::pdmNotificationCB,
384 #endif /* PRINTING_SUPPORTED */
389 * Name: DmxPrintJob::createOutputWidgets
391 * Creates the DmxPrintOutput object to be used for printing.
394 DmxPrintJob::createOutputWidgets (void)
397 DtMail::Session *d_session = theRoamApp.session()->session();
398 DtMailBoolean parse_error = DTM_FALSE;
404 _print_output = new DmxPrintOutput( _pshell );
405 _print_output->setWrapToFit(_print_setup->useWordWrap());
406 top = DmxPrintOptions::getMarginSpec(DTPRINT_OPTION_MARGIN_TOP);
407 right = DmxPrintOptions::getMarginSpec(DTPRINT_OPTION_MARGIN_RIGHT);
408 bottom = DmxPrintOptions::getMarginSpec(DTPRINT_OPTION_MARGIN_BOTTOM);
409 left = DmxPrintOptions::getMarginSpec(DTPRINT_OPTION_MARGIN_LEFT);
410 _print_output->setPageMargins(top, right, bottom, left, &parse_error);
413 DtMailGenDialog *genDialog = new DtMailGenDialog(
415 _parent->baseWidget());
416 char *errMsg = (char *) XtMalloc(1024);
421 "One of the following margin specifiers \n has incorrect syntax: \n %s \n %s \n %s \n %s \nContinue using default margins?"
424 sprintf(errMsg, i18nMsg, top, right, bottom, left);
425 genDialog->setToErrorDialog(
426 GETMSG(DT_catd, 21, 3, "Mailer"),
430 genDialog->post_and_return(
431 GETMSG(DT_catd, 21, 4, "OK"),
436 XtRealizeWidget( _pshell );
443 free((void*) bottom);
449 ok_cb(DtMailGenDialog *genDialog)
455 * Name: DmxPrintJob::doPrint
457 * Creates a DmxMailbox and loads the contents of the message file.
458 * Initializes the mailbox to iterate through the messages.
459 * Calls XmPrintToFile or XpStartJob to initiate printing.
462 DmxPrintJob::doPrint (void)
464 #if 0 && defined(PRINTING_SUPPORTED)
466 DtMail::Session *d_session = theRoamApp.session()->session();
467 XPSaveData dest = XPSpool;
470 // Notify the user that we're printing
472 if (_parent != NULL) {
473 char *buf = new char[1024];
474 char *msg = GETMSG(DT_catd, 21, 1, "Printing %s ...");
475 sprintf(buf, msg, _filename);
476 _parent->setStatus(buf);
479 // Register the fact that we have a print job running so
480 // dtmail will not terminate in the middle.
482 _parent->registerPendingTask();
487 // load in the messages
489 // Moved to DmxPrintJob::execute
491 //_mailbox = new DmxMailbox(_filename);
492 //_mailbox->loadMessages();
493 //_next_msg = _mailbox->firstMessage();
496 _spool_msg_info = (DmxMsgInfo *) XtCalloc(
497 _mailbox->numMessages(),
500 #ifndef PRINT_TO_VIDEO
501 if (_print_data == NULL) return;
503 if (_print_data->destination == DtPRINT_TO_FILE)
506 theRoamApp.registerActivePrintDisplay(XtDisplay(_pshell));
507 XpStartJob(XtDisplay(_pshell), dest);
508 XFlush(XtDisplay(_pshell));
510 if (_print_data->destination == DtPRINT_TO_FILE)
512 if (FALSE == XmPrintToFile(
514 _print_data->dest_info,
515 (XPFinishProc) &DmxPrintJob::finishedPrintToFile,
518 char *fmt = "%s\n%s: %s";
519 DtMailGenDialog *genDialog;
520 char *appmessage = NULL;
521 char *message = NULL;
522 char *sysmessage = strerror(errno);
523 Widget w = (Widget) this->_parent->baseWidget();
525 XpCancelJob(XtDisplay(_pshell), False);
526 XFlush(XtDisplay(_pshell));
528 genDialog = new DtMailGenDialog("Dialog", w);
529 appmessage = (char *) GETMSG(
531 "'Print to File' was unsuccessful.");
533 if (NULL == sysmessage)
535 message = XtMalloc(strlen(appmessage) + 1);
536 sprintf(message, "%s", appmessage);
543 strlen(_print_data->dest_info) +
547 appmessage, _print_data->dest_info, sysmessage);
550 genDialog->setToErrorDialog(
551 GETMSG(DT_catd, 21, 3, "Mailer"),
554 genDialog->post_and_return(
555 GETMSG(DT_catd, 21, 4, "OK"),
559 genDialog->post((void*) genDialog, (DialogCallback) ok_cb);
567 #endif /* PRINTING_SUPPORTED */
573 DmxPrintJob::loadOutputWidgets(void)
578 _print_output->clearContents();
579 _spool_nmsgs_done = 0;
580 _spool_nmsgs_total = 0;
581 _spool_npages_done = 0;
582 _spool_npages_total = 0;
588 DmxPrintOptions::getPrintedHeaders(),
589 (DmxMsg::DmxPrintOutputProc) fprintf,
593 DmxPrintOptions::getPrintedHeaders(),
594 &DmxPrintOutput::appendContents,
595 (XtPointer) _print_output);
597 switch (DmxPrintOptions::getMessageSeparator())
599 case DMX_SEPARATOR_BLANK_LINE:
600 _print_output->appendNewLine();
601 _print_output->appendNewLine();
603 case DMX_SEPARATOR_CHARACTER_LINE:
605 #define DMXPJ_MAX_SEPARATOR_LENGTH 100
607 const char *separator_string;
610 separator_string = DmxPrintOptions::getSeparatorString();
611 len = strlen(separator_string);
612 nchars = _print_output->getCharactersPerLine() - 5;
613 #ifdef PRINT_TO_VIDEO
614 fprintf(stderr, "getCharactersPerLine: <%d>\n", nchars);
616 nchars = (nchars < DMXPJ_MAX_SEPARATOR_LENGTH) ?
617 nchars : DMXPJ_MAX_SEPARATOR_LENGTH;
618 buffer = XtMalloc(nchars+len+1);
620 for (int i=0; i<nchars-1; i+=len)
622 int nbytes = (len < nchars-i) ? len : nchars-i;
623 strncat(buffer, separator_string, nbytes);
625 buffer[nchars-1] = '\0';
627 _print_output->appendNewLine();
628 _print_output->appendContents((void*) _print_output, buffer);
629 _print_output->appendNewLine();
630 _print_output->appendNewLine();
633 free((void*) separator_string);
637 case DMX_SEPARATOR_PAGE_BREAK:
638 case DMX_SEPARATOR_NEW_JOB:
639 _print_output->appendPageBreak();
641 case DMX_SEPARATOR_NEW_LINE:
643 _print_output->appendNewLine();
647 assert(_spool_nmsgs_total < _mailbox->numMessages());
648 _spool_msg_info[_spool_nmsgs_total].msg = _next_msg;
649 _spool_msg_info[_spool_nmsgs_total].end_position =
650 _print_output->getLastPosition();
652 _spool_nmsgs_total++;
654 } while ( ( (_next_msg = _mailbox->nextMessage()) != (DmxMsg *) NULL ) &&
655 ( (! _print_setup->printSeparately()) ||
656 (_print_data->destination == DtPRINT_TO_FILE ) )
660 _print_output->setTopPosition(0);
661 _spool_npages_total = _print_output->getNumLines() +
662 _print_output->getLinesPerPage() - 1;
663 _spool_npages_total /= _print_output->getLinesPerPage();
669 DmxPrintJob::printOnePageCB(
671 XtPointer client_data,
674 #if 0 && defined(PRINTING_SUPPORTED)
675 DmxPrintJob *thisJob = (DmxPrintJob *) client_data;
677 XmPrintShellCallbackStruct *pscbs = (XmPrintShellCallbackStruct*)call_data;
681 if (thisJob->_print_output == NULL)
684 XtArgVal /* Dimension */ width, height;
693 printf("PrintShell in PrintOnePageCB: <W %d - H %d>\n", width, height);
696 if (width < 100 || height < 100)
698 width = 2550; height=3250;
712 printf("PrintShell in PrintOnePageCB: <W %d - H %d>\n",
717 thisJob->createOutputWidgets();
718 if (! thisJob->loadOutputWidgets())
725 #ifndef PRINT_TO_VIDEO
726 if (pscbs->last_page)
728 if (thisJob->_spool_npages_done == thisJob->_spool_npages_total)
734 // This spool job is done.
735 // Try spooling the next one.
737 if (! thisJob->loadOutputWidgets())
739 if (thisJob->_print_data->destination != DtPRINT_TO_FILE)
745 // Register a work proc to print one page at a time
747 #ifndef PRINT_TO_VIDEO
748 if (thisJob->_print_data->destination == DtPRINT_TO_FILE)
751 XpStartJob(XtDisplay(thisJob->_pshell), dest);
752 XFlush(XtDisplay(thisJob->_pshell));
754 if (thisJob->_print_data->destination == DtPRINT_TO_FILE)
756 XtDisplay(thisJob->_pshell),
757 thisJob->_print_data->dest_info,
758 (XPFinishProc) &DmxPrintJob::finishedPrintToFile,
765 if (thisJob->_spool_npages_done == 0)
767 thisJob->_print_output->setTopPosition(0);
769 else if (! thisJob->_print_output->pageDown())
771 #ifndef PRINT_TO_VIDEO
772 pscbs->last_page = TRUE;
778 int top = thisJob->_print_output->getTopPosition();
779 int currmsg_i = thisJob->_spool_nmsgs_done;
782 // Find the index into the ._spool_msg_info array of the
783 // message which will begin the next page. This message
784 // will be used to set the header and footer strings.
786 while (top > thisJob->_spool_msg_info[currmsg_i].end_position &&
787 currmsg_i < thisJob->_spool_nmsgs_total)
790 assert(top <= thisJob->_spool_msg_info[currmsg_i].end_position);
791 thisJob->_spool_nmsgs_done = currmsg_i;
794 currmsg = thisJob->_spool_msg_info[thisJob->_spool_nmsgs_done].msg;
795 assert(currmsg != (DmxMsg *) NULL);
796 if (currmsg == (DmxMsg *) NULL)
798 #ifndef PRINT_TO_VIDEO
799 pscbs->last_page = TRUE;
805 // Update header and footer strings.
807 thisJob->_spool_npages_done++;
808 thisJob->updatePageHeaders(
810 DmxPrintOptions::getHdrFtrSpec(DTPRINT_OPTION_HEADER_LEFT),
811 DmxPrintOptions::getHdrFtrSpec(DTPRINT_OPTION_HEADER_RIGHT),
812 DmxPrintOptions::getHdrFtrSpec(DTPRINT_OPTION_FOOTER_LEFT),
813 DmxPrintOptions::getHdrFtrSpec(DTPRINT_OPTION_FOOTER_RIGHT)
816 #ifndef PRINT_TO_VIDEO
817 if (thisJob->_spool_npages_done >= thisJob->_spool_npages_total)
818 pscbs->last_page = TRUE;
820 #endif /* PRINTING_SUPPORTED */
825 DmxPrintJob::updatePageHeaders(
827 DmxStringTypeEnum hl_type,
828 DmxStringTypeEnum hr_type,
829 DmxStringTypeEnum fl_type,
830 DmxStringTypeEnum fr_type
838 if (msg == (DmxMsg *) NULL)
841 hl_string = getPageHeaderString(msg, hl_type);
842 hr_string = getPageHeaderString(msg, hr_type);
843 fl_string = getPageHeaderString(msg, fl_type);
844 fr_string = getPageHeaderString(msg, fr_type);
846 _print_output->setHdrFtrStrings(
852 if (DMX_NONE_STRING == hl_type && DMX_NONE_STRING == hr_type)
853 _print_output->hideHeaders();
855 _print_output->showHeaders();
857 if (DMX_NONE_STRING == fl_type && DMX_NONE_STRING == fr_type)
858 _print_output->hideFooters();
860 _print_output->showFooters();
869 DmxPrintJob::getPageHeaderString(
871 DmxStringTypeEnum type
875 *buf = (char *) NULL;
878 if (msg == (DmxMsg *) NULL)
883 case DMX_NONE_STRING:
886 case DMX_CC_HEADER_STRING:
888 char *hdrstr = msg->getMessageHeader(DMXCC);
890 format = GETMSG(DT_catd, 21, 5, "Cc: %s");
891 buf = (char *) malloc(strlen(format) + strlen(hdrstr) + 1);
892 if (buf != (char *) NULL)
893 sprintf(buf, format, hdrstr);
898 case DMX_DATE_HEADER_STRING:
900 char *hdrstr = msg->getMessageHeader(DMXDATE);
902 format = GETMSG(DT_catd, 21, 6, "Date: %s");
903 buf = (char *) malloc(strlen(format) + strlen(hdrstr) + 1);
904 if (buf != (char *) NULL)
905 sprintf(buf, format, hdrstr);
910 case DMX_FROM_HEADER_STRING:
912 char *hdrstr = msg->getMessageHeader(DMXFROM);
914 format = GETMSG(DT_catd, 21, 7, "From: %s");
915 buf = (char *) malloc(strlen(format) + strlen(hdrstr) + 1);
916 if (buf != (char *) NULL)
917 sprintf(buf, format, hdrstr);
922 case DMX_SUBJECT_HEADER_STRING:
924 char *hdrstr = msg->getMessageHeader(DMXSUBJ);
926 format = GETMSG(DT_catd, 21, 8, "Subject: %s");
927 buf = (char *) malloc(strlen(format) + strlen(hdrstr) + 1);
928 if (buf != (char *) NULL)
929 sprintf(buf, format, hdrstr);
934 case DMX_TO_HEADER_STRING:
936 char *hdrstr = msg->getMessageHeader(DMXTO);
938 format = GETMSG(DT_catd, 21, 9, "To: %s");
939 buf = (char *) malloc(strlen(format) + strlen(hdrstr) + 1);
940 if (buf != (char *) NULL)
941 sprintf(buf, format, hdrstr);
946 case DMX_PAGE_NUMBER_STRING:
948 // Allocate space for the format and the translated page number.
951 format = GETMSG(DT_catd, 21, 10, "Page %d of %d");
952 buf = (char *) malloc(strlen(format) + 16);
953 if (buf != (char *) NULL)
954 sprintf(buf, format, _spool_npages_done, _spool_npages_total);
957 case DMX_USER_NAME_STRING:
959 // Allocate space for the format and the username.
964 format = GETMSG(DT_catd, 21, 11, "Mail For: %s");
965 pw = getpwuid(getuid());
966 buf = (char *) malloc(strlen(format) + strlen(pw->pw_name) + 1);
967 if (buf != (char *) NULL)
968 sprintf(buf, format, pw->pw_name);
972 buf = strdup("DEFAULT not impld");
979 * Name: DmxPrintJob::finishedPrintToFile
982 #if 0 && defined(PRINTING_SUPPORTED)
984 DmxPrintJob::finishedPrintToFile(
987 XPGetDocStatus status,
988 XPointer client_data)
991 DmxPrintJob *thisJob = (DmxPrintJob*) client_data;
992 Widget w = (Widget) thisJob->_parent->baseWidget();
993 char *message = NULL;
995 if (status != XPGetDocFinished)
997 DtMailGenDialog *genDialog = new DtMailGenDialog("Dialog", w);
999 message = (char *) GETMSG(
1001 "'Print to File' was unsuccessful.");
1002 genDialog->setToErrorDialog(
1003 GETMSG(DT_catd, 21, 3, "Mailer"),
1005 genDialog->post_and_return(
1006 GETMSG(DT_catd, 21, 4, "OK"),
1010 else if (display != theRoamApp.getErrorPrintDisplay())
1012 DtMailGenDialog *genDialog = new DtMailGenDialog("Dialog", w);
1014 message = (char *) GETMSG(
1016 "'Print to File' completed successfully");
1018 genDialog->setToWarningDialog(
1019 GETMSG(DT_catd, 21, 3, "Mailer"),
1021 genDialog->post_and_return(
1022 GETMSG(DT_catd, 21, 4, "OK"),
1028 #endif /* PRINTING_SUPPORTED */
1031 * Name: DmxPrintJob::cancelCB
1033 * An XtCallbackProc which can be added to the callback list of
1034 * a widget to cancel the print job passed back as client_data.
1037 DmxPrintJob::cancelCB (Widget, XtPointer client_data, XtPointer)
1039 DmxPrintJob *thisJob = (DmxPrintJob *) client_data;
1045 * Name: DmxPrintJob::closeDisplayCB
1047 * An XtCallbackProc which can be added to the callback list of
1048 * a widget to react to the print setup closing the display.
1051 DmxPrintJob::closeDisplayCB (Widget, XtPointer client_data, XtPointer call_data)
1053 DmxPrintJob *thisJob = (DmxPrintJob *) client_data;
1054 DtPrintSetupCallbackStruct *pbs = (DtPrintSetupCallbackStruct *) call_data;
1056 if (thisJob->_pshell != NULL)
1058 XtDestroyWidget(thisJob->_pshell);
1059 thisJob->_pshell = NULL;
1061 DtPrintFreeSetupData(thisJob->_print_data);
1065 * Name: DmxPrintJob::pdmNotificationCB
1067 * XmNpdmNotificationCallback for the XmPrintShell
1070 DmxPrintJob::pdmNotificationCB(
1072 XtPointer client_data,
1073 XtPointer call_data)
1075 #if 0 && defined(PRINTING_SUPPORTED)
1076 DmxPrintJob *thisJob = (DmxPrintJob *) client_data;
1077 XmPrintShellCallbackStruct *pscbs = (XmPrintShellCallbackStruct*)call_data;
1078 char *message = NULL;
1080 switch (pscbs->reason)
1084 case XmCR_PDM_START_ERROR:
1085 case XmCR_PDM_START_VXAUTH:
1086 case XmCR_PDM_START_PXAUTH:
1087 message = (char *) GETMSG(
1089 "Print Dialog Manager error - setup failed.");
1096 if (message != NULL)
1098 DtMailGenDialog *genDialog = new DtMailGenDialog(
1100 thisJob->_parent->baseWidget());
1101 genDialog->setToErrorDialog(
1102 GETMSG(DT_catd, 21, 3, "Mailer"),
1104 genDialog->post_and_return(
1105 GETMSG(DT_catd, 21, 25, "Continue"),
1109 #endif /* PRINTING_SUPPORTED */
1113 * Name: DmxPrintJob::pdmSetupCB
1115 * An XtCallbackProc which can be added to the callback list of
1116 * a widget to execute the print job passed back as client_data.
1119 DmxPrintJob::pdmSetupCB(
1121 XtPointer client_data,
1122 XtPointer call_data)
1124 #if 0 && defined(PRINTING_SUPPORTED)
1125 DmxPrintJob *thisJob = (DmxPrintJob *) client_data;
1126 DtPrintSetupCallbackStruct *pbs = (DtPrintSetupCallbackStruct *) call_data;
1128 DtPrintCopySetupData(thisJob->_print_data, pbs->print_data);
1129 thisJob->createPrintShell();
1131 if (thisJob->_pshell)
1133 Widget shell = print_setup;
1135 while (! (shell == NULL || XtIsShell(shell)) )
1136 shell = XtParent(shell);
1139 XmPrintPopupPDM(thisJob->_pshell, shell);
1141 fprintf(stderr, "Internal Error: Missing XmPrintShell\n");
1143 #endif /* PRINTING_SUPPORTED */
1147 * Name: DmxPrintJob::printCB
1149 * An XtCallbackProc which can be added to the callback list of
1150 * a widget to execute the print job passed back as client_data.
1153 DmxPrintJob::printCB (Widget, XtPointer client_data, XtPointer call_data)
1155 DmxPrintJob *thisJob = (DmxPrintJob *) client_data;
1156 DtPrintSetupCallbackStruct *pbs = (DtPrintSetupCallbackStruct *) call_data;
1158 /* TBD: Save options??? */
1160 DtPrintCopySetupData(thisJob->_print_data, pbs->print_data);
1161 thisJob->createPrintShell();