From b041343bcf05fdf5ce4234655c869251b3f8fafa Mon Sep 17 00:00:00 2001 From: Roland Mainz Date: Sun, 30 May 2004 22:44:01 +0000 Subject: Fix for http://freedesktop.org/bugzilla/show_bug.cgi?id=695 - Add print support to Xedit --- XMore.ad | 58 ++++++++++++++++++++++++++++++++-------------------------- print.c | 21 ++++++++++++--------- print.h | 14 +++++++------- xmore.c | 11 ++++++----- 4 files changed, 57 insertions(+), 47 deletions(-) diff --git a/XMore.ad b/XMore.ad index 1392d46..114316f 100644 --- a/XMore.ad +++ b/XMore.ad @@ -31,30 +31,36 @@ *quit.tip: Quit application *print.tip: Print file -! tip messages for print dialog -*printdialog*main*ok.tip: Print -*printdialog*main*cancel.tip: Cancel printing -*printdialog*main*setup.tip: Configure printer options (page size, orientation, etc.) -*printdialog*main*desclabel.tip: Short description of printer -*printdialog*main*desc.tip: Short description of printer -*printdialog*main*info.tip: Display additional information about this printer -*printdialog*main*namelabel.tip: Name of selected printer -*printdialog*main*name.tip: Name of selected printer -*printdialog*main*selectprinter.tip: Select a different printer -*printdialog*main*filenamelabel.tip: File where the output should be stored -*printdialog*main*filename.tip: File where the output should be stored -*printdialog*main*selectfile.tip: Select file where the output should be stored -*printdialog*main*printtoprinter.tip: Send print job to printer -*printdialog*main*printtofile.tip: Save print job in a file -*printdialog*setup*ok.tip: Commit changes -*printdialog*setup*cancel.tip: Cancel and reset to defaults -*printdialog*setup*paperlist.tip: Select paper size -*printdialog*setup*resolutionlist.tip: Select page resolution -*printdialog*setup*orientationlist.tip: Select page orientation -*printdialog*setup*plexlist.tip: Select page plex mode (simplex, duplex, etc.) -*printdialog*setup*jobcopieslabel.tip: Set number of job copies -*printdialog*setup*jobcopies.tip: Set number of job copies -*printdialog*printerselection*ok.tip: Switch printer -*printdialog*printerselection*cancel.tip: Cancel printer selection -*printdialog*printerselection*list.tip: Select printer name from list +! Use "white" as background for printing +*printshell*background: white + +! Print dialog +*printdialogshell*geometry: 600x120 +*printdialogshell*setup*geometry: 600x400 +*printdialogshell*printerselection*geometry: 400x150 +*printdialog*main*ok.tip: Print +*printdialog*main*cancel.tip: Cancel printing +*printdialog*main*setup.tip: Configure printer options (page size, orientation, etc.) +*printdialog*main*desclabel.tip: Short description of printer +*printdialog*main*desc.tip: Short description of printer +*printdialog*main*info.tip: Display additional information about this printer +*printdialog*main*namelabel.tip: Name of selected printer +*printdialog*main*name.tip: Name of selected printer +*printdialog*main*selectprinter.tip: Select a different printer +*printdialog*main*filenamelabel.tip: File where the output should be stored +*printdialog*main*filename.tip: File where the output should be stored +*printdialog*main*selectfile.tip: Select file where the output should be stored +*printdialog*main*printtoprinter.tip: Send print job to printer +*printdialog*main*printtofile.tip: Save print job in a file +*printdialog*setup*ok.tip: Commit changes +*printdialog*setup*cancel.tip: Cancel and reset to defaults +*printdialog*setup*paperlist.tip: Select paper size +*printdialog*setup*resolutionlist.tip: Select page resolution +*printdialog*setup*orientationlist.tip: Select page orientation +*printdialog*setup*plexlist.tip: Select page plex mode (simplex, duplex, etc.) +*printdialog*setup*jobcopieslabel.tip: Set number of job copies +*printdialog*setup*jobcopies.tip: Set number of job copies +*printdialog*printerselection*ok.tip: Switch printer +*printdialog*printerselection*cancel.tip: Cancel printer selection +*printdialog*printerselection*list.tip: Select printer name from list ! EOF. diff --git a/print.c b/print.c index d44b97e..73dcd0a 100644 --- a/print.c +++ b/print.c @@ -265,15 +265,15 @@ XFontSet GetPrintTextFontSet(const char *appname, Display *pdpy, long dpi) } if (!fontset) - Error(("XCreateFontSet() failure.\n")); + Error(("GetPrintTextFontSet: XCreateFontSet() failure.\n")); return fontset; } -void DoPrint(const char *programname, - Widget textsource, Widget toplevel, - Display *pdpy, XPContext pcontext, - XtCallbackProc pdpyDestroyCB, - const char *jobtitle, const char *toFile) +void DoPrintTextSource(const char *programname, + Widget textsource, Widget toplevel, + Display *pdpy, XPContext pcontext, + XtCallbackProc pdpyDestroyCB, + const char *jobtitle, const char *toFile) { long dpi = 0; int n; @@ -313,7 +313,7 @@ void DoPrint(const char *programname, n = 0; XtSetArg(args[n], XawNlayoutMode, XawPrintLAYOUTMODE_DRAWABLEAREA); n++; - apd->printshell = CreatePrintShell(toplevel, apd->pscreen, "print", args, n); + apd->printshell = CreatePrintShell(toplevel, apd->pscreen, "printshell", args, n); n = 0; XtSetArg(args[n], XtNresizable, True); n++; @@ -324,6 +324,7 @@ void DoPrint(const char *programname, #ifdef PRINT_PAGEHEADER n = 0; + XtSetArg(args[n], XtNinternational, True); n++; XtSetArg(args[n], XtNfromHoriz, NULL); n++; XtSetArg(args[n], XtNfromVert, NULL); n++; XtSetArg(args[n], XtNtop, XtChainTop); n++; @@ -335,13 +336,14 @@ void DoPrint(const char *programname, apd->content.pageheaderlabel = XtCreateManagedWidget("pageinfo", labelWidgetClass, apd->content.form, args, n); #endif /* PRINT_PAGEHEADER */ + font_extents = XExtentsOfFontSet(textfontset); + n = 0; + XtSetArg(args[n], XtNinternational, True); n++; XtSetArg(args[n], XtNtextSource, textsource); n++; XtSetArg(args[n], XtNscrollHorizontal, XawtextScrollNever); n++; XtSetArg(args[n], XtNscrollVertical, XawtextScrollNever); n++; - font_extents = XExtentsOfFontSet(textfontset); - /* Usually I would expect that using |XtNfromVert, apd->content.pageheaderlabel| * would be the correct way to place the text widget with the main content below * the page header widget - but for an unknown reason this doesn not work: The @@ -358,6 +360,7 @@ void DoPrint(const char *programname, #endif XtSetArg(args[n], XtNfontSet, textfontset); n++; apd->content.text = XtCreateManagedWidget("text", asciiTextWidgetClass, apd->content.form, args, n); + /* Disable the caret - that is not needed for printing */ XawTextDisplayCaret(apd->content.text, False); diff --git a/print.h b/print.h index e098531..69321a1 100644 --- a/print.h +++ b/print.h @@ -36,12 +36,12 @@ in this Software without prior written authorization from The Open Group. #include /* Prototypes */ -void DoPrint(const char *programname, - Widget textsource, - Widget toplevel, - Display *pdpy, XPContext pcontext, - XtCallbackProc printDisplayDestroyCallback, - const char *jobTitle, - const char *toFile); +void DoPrintTextSource(const char *programname, + Widget textsource, + Widget toplevel, + Display *pdpy, XPContext pcontext, + XtCallbackProc printDisplayDestroyCallback, + const char *jobTitle, + const char *toFile); #endif /* !XMORE_PRINT_H */ diff --git a/xmore.c b/xmore.c index b9812b3..78a63d4 100644 --- a/xmore.c +++ b/xmore.c @@ -164,11 +164,11 @@ printOKXtProc(Widget w, XtPointer client_data, XtPointer callData) * because it is used for the job title AND the page headers... */ sprintf(printJobNameBuffer, "XMore print job %s", viewFileName); - DoPrint(ProgramName, - textsource, toplevel, - pdcs->pdpy, pdcs->pcontext, printshellDestroyXtProc, - printJobNameBuffer, - pdcs->printToFile?pdcs->printToFileName:NULL); + DoPrintTextSource(ProgramName, + textsource, toplevel, + pdcs->pdpy, pdcs->pcontext, printshellDestroyXtProc, + printJobNameBuffer, + pdcs->printToFile?pdcs->printToFileName:NULL); XtPopdown(printdialog_shell); } @@ -247,6 +247,7 @@ int main( int argc, char *argv[] ) ProgramName = argv[0]; + XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtOpenApplication(&app, "XMore", options, XtNumber(options), &argc, argv, fallback_resources, -- cgit v1.2.3