Index: xc/ChangeLog =================================================================== RCS file: /cvs/xorg/xc/ChangeLog,v retrieving revision 1.52 diff -u -2 -0 -r1.52 ChangeLog --- a/xc/ChangeLog 29 May 2004 19:33:22 -0000 1.52 +++ b/xc/ChangeLog 30 May 2004 00:48:41 -0000 @@ -1,20 +1,31 @@ +2004-05-30 Roland Mainz + * xc/programs/xmore/XMore.ad + * xc/programs/xmore/print.c + * xc/programs/xmore/print.h + * xc/programs/xmore/printdialog.c + * xc/programs/xmore/printdialog.h + * xc/programs/xmore/xmore.c + * xc/programs/xmore/xmore.h + Bugzilla #693: XMore and XawPrintDialog work-in-progress, fixing + various problems and adding framework for i18n. + 2004-05-29 Alan Coopersmith * programs/xkbcomp/rules/Imakefile: Bugzilla #531: missing xfree86.lst (Grzegorz DÄ…browski ) 2004-05-29 Eric Anholt * config/cf/FreeBSD.cf: * config/cf/OpenBSD.cf: * config/cf/OpenBSDLib.tmpl: * config/cf/X11.tmpl: * config/cf/os2.cf: * config/cf/os2Lib.tmpl: * lib/GL/GL/Imakefile: * lib/Imakefile: * lib/X11/Imakefile: * lib/XThrStub/Imakefile: * lib/XThrStub/UIThrStubs.c: Bugzilla #640: Eliminate the XThrStub library and clean up/fix threading defines on FreeBSD/OpenBSD. Includes removal of lib/XThrStub/UIThrStubs.c after repocopy to Index: xc/programs/xmore/XMore.ad =================================================================== RCS file: xc/programs/xmore/XMore.ad diff -N xc/programs/xmore/XMore.ad --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ b/xc/programs/xmore/XMore.ad 30 May 2004 00:48:53 -0000 @@ -0,0 +1,60 @@ +! XMore.ad + +! keyboard translations +*text.Translations: #override\n\ + CtrlS: no-op(RingBell)\n\ + CtrlR: no-op(RingBell)\n\ + space: next-page()\n\ + F: next-page()\n\ + CtrlB: previous-page()\n\ + B: previous-page()\n\ + K: scroll-one-line-down()\n\ + Y: scroll-one-line-down()\n\ + Return: scroll-one-line-up()\n\ + J: scroll-one-line-up()\n\ + E: scroll-one-line-up()\n\ + p: print()\n\ + q: quit()\n +*text.baseTranslations: #override\n\ + space: next-page()\n\ + F: next-page()\n\ + CtrlB: previous-page()\n\ + K: scroll-one-line-down()\n\ + Y: scroll-one-line-down()\n\ + Return: scroll-one-line-up()\n\ + J: scroll-one-line-up()\n\ + E: scroll-one-line-up()\n\ + p: print()\n\ + q: quit()\n + +! tip messages +*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 +! EOF. Index: xc/programs/xmore/print.c =================================================================== RCS file: /cvs/xorg/xc/programs/xmore/print.c,v retrieving revision 1.1 diff -u -2 -0 -r1.1 print.c --- a/xc/programs/xmore/print.c 24 May 2004 03:17:44 -0000 1.1 +++ b/xc/programs/xmore/print.c 30 May 2004 00:48:53 -0000 @@ -15,41 +15,40 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ /* Turn a NULL pointer string into an empty string */ #define NULLSTR(x) (((x)!=NULL)?(x):("")) #define Error(x) { printf x ; exit(EXIT_FAILURE); } #define Assertion(expr, msg) { if (!(expr)) { Error msg } } #define Log(x) { if(True) printf x; } -#include "xmore.h" #include "print.h" #include #include #include #include #include #define PRINT_PAGEHEADER 1 static Widget CreatePrintShell(Widget videoshell, Screen *pscreen, String printshell_name, ArgList args, Cardinal numargs) { String videoname, videoclass; Widget pappshell, printshell; @@ -68,55 +67,57 @@ pappshell = XtVaAppCreateShell(videoname, videoclass, applicationShellWidgetClass, pdpy, XtNscreen, pscreen, NULL); printshell = XtCreatePopupShell(printshell_name, xawPrintShellWidgetClass, pappshell, args, numargs); /* we're mapping/unmapping at start/end page time */ XtSetMappedWhenManaged(printshell, False); /* We realise the widget when we're done with building the widget tree... */ return printshell; } typedef struct { - Widget toplevel; - Bool isPrinting; - Widget printshell; + const char *programname; + Widget toplevel; + Bool isPrinting; + Widget printshell; struct { - Widget form; - Widget pageheaderlabel; - Widget text; + Widget form; + Widget pageheaderlabel; + Widget text; } content; /* content to print */ - int numpages; - Display *pdpy; - Screen *pscreen; - XPContext pcontext; - void *printtofile_handle; - const char *jobtitle; + int numpages; + Display *pdpy; + Screen *pscreen; + XPContext pcontext; + XtCallbackProc pdpyDestroyCallback; + void *printtofile_handle; + const char *jobtitle; } AppPrintData; static AppPrintData apdx; static AppPrintData *apd = &apdx; /* Count pages in a text widget * WARNING: This will reset the current position of the text widget * back to the beginning */ static long CountPages(Widget textWidget) { long numpages = 0; XawTextPosition prevpagepos = -1, currpos = 0; /* Move to the top of the file... */ XtCallActionProc(textWidget, "beginning-of-file", NULL, NULL, 0); /* ... count pages ...*/ @@ -165,189 +166,231 @@ XtVaSetValues(apd->content.pageheaderlabel, XtNlabel, buffer, NULL); #endif /* PRINT_PAGEHEADER */ /* Note: XawPrintShell's pagecount starts with '1' * (=first page is page no. '1') */ if (currpage > 1) { Log(("pagedown %d\n", currpage)); XtCallActionProc(p->content.text, "next-page", NULL, NULL, 0); } else { Log(("first page\n")); } if (currpage >= p->numpages) { psp->last_page_in_job = True; } } } +static void FinishPrinting(AppPrintData *p) { if (p->printtofile_handle) { if (XpuWaitForPrintFileChild(p->printtofile_handle) != XPGetDocFinished) { - fprintf(stderr, "%s: Error while printing to file.\n", ProgramName); + fprintf(stderr, "%s: Error while printing to file.\n", apd->programname); } p->printtofile_handle = NULL; } if (p->printshell) { XtDestroyWidget(p->printshell); p->printshell = NULL; } - /* |p->pdpy| and |p->pcontext| are destroyed when th - * print dialog widget gets destroyed. */ + /* Two issues here: + * 1. The print display connection is owned by the print dialog + * To avoid any problems with that use a callback back to the main + * application which calls + * |XawPrintDialogClosePrinterConnection(w, False)| to ask the + * print dialog widget to close all print display resources and + * disown the object. + * 2. We have to use XpDestroyContext() and XtCloseDisplay() + * instead of XpuClosePrinterDisplay() to make libXt happy... + * + * Call callback... */ + (*apd->pdpyDestroyCallback)(NULL, NULL, NULL); /* HACK! */ + + /* ... and then get rid of the display */ + if (p->pcontext != None) { + XpDestroyContext(p->pdpy, p->pcontext); + } + XtCloseDisplay(p->pdpy); p->toplevel = NULL; p->isPrinting = False; p->pdpy = NULL; p->pscreen = NULL; p->pcontext = None; } static void PrintEndJobCB(Widget pshell, XtPointer client_data, XtPointer call_data) { AppPrintData *p = (AppPrintData *)client_data; Log(("--> PrintEndJobCB\n")); /* Finish printing and destroy print shell (it's legal to destroy Xt * widgets from within it's own callbacks) */ FinishPrinting(p); } -XFontStruct *GetPrintTextFont(Display *pdpy, long dpi) +static +XFontSet GetPrintTextFontSet(const char *appname, Display *pdpy, long dpi) { - XFontStruct *font; + XFontSet fontset; char fontname[1024]; + char **missing_charset_list_return; + int missing_charset_count_return; + char *def_string_return; + int i; + long font_size; + + /* Scale font size with DPI */ + font_size = (40L * dpi) / 300L; - sprintf(fontname, "-adobe-courier-medium-r-normal--40-*-%ld-%ld-*-*-iso8859-1", dpi, dpi); - font = XLoadQueryFont(pdpy, fontname); - if (!font) { - sprintf(fontname, "-*-*-*-*-*-*-*-160-%ld-%ld-*-*-iso8859-1", dpi, dpi); - font = XLoadQueryFont(pdpy, fontname); + sprintf(fontname, "-adobe-courier-medium-r-normal--%ld-*-%ld-%ld-*-*," + "-*-*-*-*-*-*-%ld-*-%ld-%ld-*-*", + font_size, dpi, dpi, + font_size, dpi, dpi); + fontset = XCreateFontSet(pdpy, fontname, + &missing_charset_list_return, + &missing_charset_count_return, + &def_string_return); + + for( i=0 ; i < missing_charset_count_return ; i++ ) { + fprintf(stderr, "%s: warning: font for charset %s is lacking.\n", + appname, missing_charset_list_return[i]); } - if (!font) - Error(("XLoadQueryFont failure.\n")); - return font; + + if (!fontset) + Error(("XCreateFontSet() failure.\n")); + return fontset; } -void DoPrint(Widget toplevel, Display *pdpy, XPContext pcontext, +void DoPrint(const char *programname, + Widget textsource, Widget toplevel, + Display *pdpy, XPContext pcontext, + XtCallbackProc pdpyDestroyCB, const char *jobtitle, const char *toFile) { - long dpi = 0; - int n; - Arg args[20]; - XFontStruct *textfont = NULL; + long dpi = 0; + int n; + Arg args[20]; + XFontSet textfontset = NULL; + XFontSetExtents *font_extents; + + apd->programname = programname; + apd->pdpyDestroyCallback = pdpyDestroyCB; if (apd->isPrinting) { - fprintf(stderr, "%s: Already busy with printing.\n", ProgramName); + fprintf(stderr, "%s: Already busy with printing.\n", apd->programname); return; } /* Configure the print context (paper size, title etc.) * We must do this before creating any Xt widgets - otherwise they will * make wrong assuptions about fonts, resultions etc. ... */ XpuSetJobTitle(pdpy, pcontext, jobtitle); /* Configuration done, set the context */ XpSetContext(pdpy, pcontext); /* Get default printer resolution */ if (XpuGetResolution(pdpy, pcontext, &dpi) != 1) { - fprintf(stderr, "%s: No default resolution for printer.\n", ProgramName); + fprintf(stderr, "%s: No default resolution for printer.\n", apd->programname); XpuClosePrinterDisplay(pdpy, pcontext); return; } apd->toplevel = toplevel; apd->pdpy = pdpy; apd->pcontext = pcontext; apd->pscreen = XpGetScreenOfContext(pdpy, pcontext); apd->jobtitle = jobtitle; n = 0; XtSetArg(args[n], XawNlayoutMode, XawPrintLAYOUTMODE_DRAWABLEAREA); n++; - apd->printshell = CreatePrintShell(toplevel, apd->pscreen, "Print", args, n); + apd->printshell = CreatePrintShell(toplevel, apd->pscreen, "print", args, n); n = 0; XtSetArg(args[n], XtNresizable, True); n++; XtSetArg(args[n], XtNright, XtChainRight); n++; apd->content.form = XtCreateManagedWidget("form", formWidgetClass, apd->printshell, args, n); - textfont = GetPrintTextFont(pdpy, dpi); + textfontset = GetPrintTextFontSet(apd->programname, pdpy, dpi); #ifdef PRINT_PAGEHEADER n = 0; XtSetArg(args[n], XtNfromHoriz, NULL); n++; XtSetArg(args[n], XtNfromVert, NULL); n++; XtSetArg(args[n], XtNtop, XtChainTop); n++; XtSetArg(args[n], XtNright, XtChainRight); n++; XtSetArg(args[n], XtNresizable, True); n++; - XtSetArg(args[n], XtNfont, textfont); n++; /* fontset would be better */ + XtSetArg(args[n], XtNfontSet, textfontset); n++; XtSetArg(args[n], XtNlabel, "Page: n/n"); n++; XtSetArg(args[n], XtNjustify, XtJustifyRight); n++; apd->content.pageheaderlabel = XtCreateManagedWidget("pageinfo", labelWidgetClass, apd->content.form, args, n); #endif /* PRINT_PAGEHEADER */ n = 0; - XtSetArg(args[n], XtNtype, XawAsciiFile); n++; - XtSetArg(args[n], XtNstring, viewFileName); 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 * text widget squishes itself into the bottom half of the page and only occupies * 1/2 of the page's with... ;-(( */ #define WORKAROUND_FOR_SOMETHING_IS_WRONG 1 #ifdef WORKAROUND_FOR_SOMETHING_IS_WRONG XtSetArg(args[n], XtNtop, XtChainTop); n++; XtSetArg(args[n], XtNright, XtChainRight); n++; - XtSetArg(args[n], XtNvertDistance, (textfont->ascent+textfont->descent+2)*2); n++; + XtSetArg(args[n], XtNvertDistance, (font_extents->max_logical_extent.height+2)*2); n++; #else XtSetArg(args[n], XtNfromHoriz, NULL); n++; XtSetArg(args[n], XtNfromVert, apd->content.pageheaderlabel); n++; #endif - XtSetArg(args[n], XtNfont, textfont); n++; /* fontset would be better */ + 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); XtAddCallback(apd->printshell, XawNpageSetupCallback, PageSetupCB, (XtPointer)apd); XtAddCallback(apd->printshell, XawNendJobCallback, PrintEndJobCB, (XtPointer)apd); /* Realise print shell (which will set position+size of the child * widgets based on the current page size) */ XtRealizeWidget(apd->printshell); /* Count number of pages in the text widget */ apd->numpages = CountPages(apd->content.text); /* Make sure that the Xt machinery is really using the right screen (assertion) */ if (XpGetScreenOfContext(XtDisplay(apd->printshell), apd->pcontext) != XtScreen(apd->printshell)) Error(("Widget's screen != print screen. BAD.\n")); apd->isPrinting = True; if (toFile) { - printf("%s: Printing to file '%s'...\n", ProgramName, toFile); + printf("%s: Printing to file '%s'...\n", apd->programname, toFile); apd->printtofile_handle = XpuStartJobToFile(pdpy, pcontext, toFile); if (!apd->printtofile_handle) { perror("XpuStartJobToFile failure"); apd->isPrinting = False; return; } } else { - printf("%s: Printing to printer...\n", ProgramName); + printf("%s: Printing to printer...\n", apd->programname); XpuStartJobToSpooler(pdpy); } } Index: xc/programs/xmore/print.h =================================================================== RCS file: /cvs/xorg/xc/programs/xmore/print.h,v retrieving revision 1.1 diff -u -2 -0 -r1.1 print.h --- a/xc/programs/xmore/print.h 24 May 2004 03:17:44 -0000 1.1 +++ b/xc/programs/xmore/print.h 30 May 2004 00:48:53 -0000 @@ -19,26 +19,29 @@ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ #ifndef XMORE_PRINT_H #define XMORE_PRINT_H 1 #include #include #include #include #include #include /* Prototypes */ -void DoPrint(Widget toplevel, +void DoPrint(const char *programname, + Widget textsource, + Widget toplevel, Display *pdpy, XPContext pcontext, + XtCallbackProc printDisplayDestroyCallback, const char *jobTitle, const char *toFile); #endif /* !XMORE_PRINT_H */ Index: xc/programs/xmore/printdialog.c =================================================================== RCS file: /cvs/xorg/xc/programs/xmore/printdialog.c,v retrieving revision 1.1 diff -u -2 -0 -r1.1 printdialog.c --- a/xc/programs/xmore/printdialog.c 24 May 2004 03:17:44 -0000 1.1 +++ b/xc/programs/xmore/printdialog.c 30 May 2004 00:48:53 -0000 @@ -52,41 +52,41 @@ #define NULLSTR(x) (((x)!=NULL)?(x):("")) #define Error(x) { printf x ; exit(EXIT_FAILURE); } #define Assertion(expr, msg) { if (!(expr)) { Error msg } } #define Log(x) { if(True) printf x; } /* Local prototypes */ static void do_beep(PrintDialogWidget pdw); static void center_popup(Widget parent, Widget popup); static void updateWidgetStates(PrintDialogWidget pdw); static void printSetupClose(PrintDialogWidget pdw); static void printSetupOKXtProc(Widget w, XtPointer client_data, XtPointer callData); static void printSetupCancelXtProc(Widget w, XtPointer client_data, XtPointer callData); static void printSetupJobCopiesXtProc(Widget w, XtPointer client_data, XtPointer callData); static void printDialogDestXtProc(Widget w, XtPointer client_data, XtPointer callData); static void printSelectFileXtProc(Widget w, XtPointer client_data, XtPointer callData); static void printOKXtProc(Widget w, XtPointer client_data, XtPointer callData); static void printSetupXtProc(Widget w, XtPointer client_data, XtPointer callData); static void printFileSelectedXtProc(Widget w, XtPointer client_data, XtPointer callData); static void buildFileDialog(PrintDialogWidget pdw); -static void closePrinterConnection(PrintDialogWidget pdw); +static void closePrinterConnection(PrintDialogWidget pdw, Bool closeDisplay); static Bool openPrinterConnection(PrintDialogWidget pdw); static void destroyPrintSetupDialog(PrintDialogWidget pdw); static Widget buildPrintSetupDialog(PrintDialogWidget pdw); static String *xpprinterlist_to_widget_printerlist(XPPrinterList printerlist, int num_printers); static String *xppaperlist_to_widget_paperlist(XpuMediumSourceSizeList paperlist, int num_papers); static String *xpresolutionlist_to_widget_resolutionlist(XpuResolutionList reslist, int num_resolutions); static String *xporientationlist_to_widget_orientationlist(XpuOrientationList orientationlist, int num_orientations); static String *xpplexlist_to_widget_plexlist(XpuPlexList plexlist, int num_plex); static void printerSelectionPrinterSelectedXtProc(Widget w, XtPointer client_data, XtPointer callData); static void printSelectPrinterXtProc(Widget w, XtPointer client_data, XtPointer callData); static void printerSelectionClose(PrintDialogWidget pdw); static void printerSelectionOKXtProc(Widget w, XtPointer client_data, XtPointer callData); static void printerSelectionCancelXtProc(Widget w, XtPointer client_data, XtPointer callData); static Bool buildPrinterSelectionDialog(PrintDialogWidget pdw); static void destroyPrinterSelectionDialog(PrintDialogWidget pdw); static void createprintdialogchildren(Widget w); static void do_beep(PrintDialogWidget pdw) { @@ -174,48 +174,47 @@ XtVaSetValues(pdp->main.ok, XtNsensitive, pdp->canReallyPrint, NULL); XtVaSetValues(pdp->main.setup, XtNsensitive, pdp->canPrint, NULL); } static void printSetupClose(PrintDialogWidget pdw) { PrintDialogPart *pdp = &pdw->printdialog; if (pdp->setup.popup) { XtPopdown(pdp->setup.popup); } } static void printSetupOKXtProc(Widget w, XtPointer client_data, XtPointer callData) { PrintDialogWidget pdw = (PrintDialogWidget)client_data; PrintDialogPart *pdp = &pdw->printdialog; char *s; - int c; XawListReturnStruct *lrs; Log(("## printSetupOK: closing print setup!\n")); /* Set copy count (if the value is invalid beep and return to the user ) */ XtVaGetValues(pdp->setup.jobcopies, XtNstring, &s, NULL); if (s) { - c = atoi(s); + int c = atoi(s); if (c < 1 || c > 999) { do_beep(pdw); XtVaSetValues(pdp->setup.jobcopies, XtNstring, "1", NULL); Log(("## printSetupOKXtProc: not a valid copy count value\n")); return; } /* Fix me: We should set the number of _job_ copies here, not _doc_ copies */ XpuSetDocumentCopies(pdp->pdpy, pdp->pcontext, c); } /* Set paper size */ lrs = XawListShowCurrent(pdp->setup.paperlist); if (lrs->list_index != XAW_LIST_NONE) { Log(("selected paper is '%s'/'%d'\n", lrs->string, lrs->list_index)); Assertion(lrs->list_index < pdp->num_papers, (("Error: lrs->list_index < pdp->num_papers\n"))); XpuSetDocMediumSourceSize(pdp->pdpy, pdp->pcontext, &pdp->paperlist[lrs->list_index]); } XtFree((char *)lrs); @@ -254,54 +253,54 @@ { PrintDialogWidget pdw = (PrintDialogWidget)client_data; Log(("## printSetupCancel: closing print setup!\n")); printSetupClose(pdw); } static void printSetupJobCopiesXtProc(Widget w, XtPointer client_data, XtPointer callData) { PrintDialogWidget pdw = (PrintDialogWidget)client_data; PrintDialogPart *pdp = &pdw->printdialog; char *string = NULL; Log(("## printSetupJobCopiesXtProc!\n")); /* Check whether the input is a valid number - and in the case of invalid input reset the value */ XtVaGetValues(pdp->setup.jobcopies, XtNstring, &string, NULL); if (string) { char *s; - int c; + int i; Bool isValidNumber = True; /* First check for invalid characters... */ - for( s = string ; (c = *s++) != '\0' ; s++ ) { - if (!isdigit(c)) { + for( s = string ; *s != '\0' ; s++ ) { + if (!isdigit(*s)) { isValidNumber = False; break; } } /* .. and the do a range check... */ - c = atoi(string); - if (c < 1 || c > 999) { + i = atoi(string); + if (i < 1 || i > 999) { isValidNumber = False; } if (!isValidNumber) { do_beep(pdw); XtVaSetValues(pdp->setup.jobcopies, XtNstring, "1", NULL); Log(("## printSetupJobCopiesXtProc: not a valid number\n")); } } } static void printCancelXtProc(Widget w, XtPointer client_data, XtPointer callData) { PrintDialogWidget pdw = (PrintDialogWidget)client_data; PrintDialogPart *pdp = &pdw->printdialog; printSetupClose(pdw); if (pdp->cancel_callback) { @@ -409,55 +408,55 @@ Log(("printFileSelectedXtProc: User selected file.\n")); filename = XawDialogGetValueString(pdp->selectFile.dialog); if (pdp->filename) free(pdp->filename); pdp->filename = strdup(filename); XtPopdown(pdp->selectFile.shell); updateWidgetStates(pdw); } static void buildFileDialog(PrintDialogWidget pdw) { PrintDialogPart *pdp = &pdw->printdialog; int n; Arg args[20]; - pdp->selectFile.shell = XtCreatePopupShell("shell", + pdp->selectFile.shell = XtCreatePopupShell("selectfile", transientShellWidgetClass, (Widget)pdw, NULL, 0); n = 0; XtSetArg(args[n], XtNvalue, pdp->filename?pdp->filename:""); n++; XtSetArg(args[n], XtNlabel, "Select Filename:"); n++; pdp->selectFile.dialog = XtCreateManagedWidget("dialog", dialogWidgetClass, pdp->selectFile.shell, args, n); XawDialogAddButton(pdp->selectFile.dialog, "Accept", printFileSelectedXtProc, pdw); XtRealizeWidget(pdp->selectFile.shell); } static -void closePrinterConnection(PrintDialogWidget pdw) +void closePrinterConnection(PrintDialogWidget pdw, Bool closeDisplay) { PrintDialogPart *pdp = &pdw->printdialog; Log(("# closePrinterConnection\n")); destroyPrintSetupDialog(pdw); if (pdp->paperlist) { XpuFreeMediumSourceSizeList(pdp->paperlist); pdp->paperlist = NULL; } if (pdp->widget_paperlist) { free(pdp->widget_paperlist); pdp->widget_paperlist = NULL; } if (pdp->resolutionlist) { XpuFreeResolutionList(pdp->resolutionlist); pdp->resolutionlist = NULL; @@ -473,57 +472,59 @@ XpuFreeOrientationList(pdp->orientationlist); pdp->orientationlist = NULL; } if (pdp->widget_orientationlist) { free(pdp->widget_orientationlist); pdp->widget_orientationlist = NULL; } if (pdp->plexlist) { XpuFreePlexList(pdp->plexlist); pdp->plexlist = NULL; } if (pdp->widget_plexlist) { free(pdp->widget_plexlist); pdp->widget_plexlist = NULL; } if (pdp->pdpy) { - XpuClosePrinterDisplay(pdp->pdpy, pdp->pcontext); + if (closeDisplay) { + XpuClosePrinterDisplay(pdp->pdpy, pdp->pcontext); + } pdp->pdpy = NULL; pdp->pcontext = None; } updateWidgetStates(pdw); } static -Bool openPrinterConnection(PrintDialogWidget pdw) +Bool openPrinterConnection(PrintDialogWidget pdw) { PrintDialogPart *pdp = &pdw->printdialog; Log(("# openPrinterConnection\n")); /* Close any outstanding connection first... */ - closePrinterConnection(pdw); + closePrinterConnection(pdw, True); if (!pdp->printer_name) { Log(("# error: openPrinterConnection: No printer name.\n")); return False; } if (XpuGetPrinter(pdp->printer_name, &pdp->pdpy, &pdp->pcontext) == False) { Log(("openPrinterConnection: could not open printer.\n")); return False; } pdp->paperlist = XpuGetMediumSourceSizeList(pdp->pdpy, pdp->pcontext, &pdp->num_papers); pdp->resolutionlist = XpuGetResolutionList(pdp->pdpy, pdp->pcontext, &pdp->num_resolutions); pdp->orientationlist = XpuGetOrientationList(pdp->pdpy, pdp->pcontext, &pdp->num_orientations); pdp->plexlist = XpuGetPlexList(pdp->pdpy, pdp->pcontext, &pdp->num_plex); pdp->widget_paperlist = xppaperlist_to_widget_paperlist(pdp->paperlist, pdp->num_papers); pdp->widget_resolutionlist = xpresolutionlist_to_widget_resolutionlist(pdp->resolutionlist, pdp->num_resolutions); pdp->widget_orientationlist = xporientationlist_to_widget_orientationlist(pdp->orientationlist, pdp->num_orientations); pdp->widget_plexlist = xpplexlist_to_widget_plexlist(pdp->plexlist, pdp->num_plex); @@ -579,41 +580,41 @@ openPrinterConnection(pdw); if (!pdp->pdpy) { Log(("buildPrintSetupDialog: still no printer connection - BAD.\n")); do_beep(pdw); return NULL; } } /* Get flags which types of attributes can be modified */ jobflags = XpuGetSupportedDocAttributes(pdp->pdpy, pdp->pcontext); docflags = XpuGetSupportedDocAttributes(pdp->pdpy, pdp->pcontext); canChangeJobCopies = (jobflags & XPUATTRIBUTESUPPORTED_COPY_COUNT) == XPUATTRIBUTESUPPORTED_COPY_COUNT; canChangePaperSize = (docflags & XPUATTRIBUTESUPPORTED_DEFAULT_MEDIUM) == XPUATTRIBUTESUPPORTED_DEFAULT_MEDIUM; canChangeResolution = (docflags & XPUATTRIBUTESUPPORTED_DEFAULT_PRINTER_RESOLUTION) == XPUATTRIBUTESUPPORTED_DEFAULT_PRINTER_RESOLUTION; canChangeOrientation = (docflags & XPUATTRIBUTESUPPORTED_CONTENT_ORIENTATION) == XPUATTRIBUTESUPPORTED_CONTENT_ORIENTATION; canChangePlex = (docflags & XPUATTRIBUTESUPPORTED_PLEX) == XPUATTRIBUTESUPPORTED_PLEX; n = 0; XtSetArg(args[n], XtNallowShellResize, True); n++; - pdp->setup.popup = XtCreatePopupShell("popup", transientShellWidgetClass, (Widget)pdw, args, n); + pdp->setup.popup = XtCreatePopupShell("setup", transientShellWidgetClass, (Widget)pdw, args, n); n = 0; pdp->setup.form = XtCreateManagedWidget("form", formWidgetClass, pdp->setup.popup, args, n); n = 0; listform = XtCreateManagedWidget("list", formWidgetClass, pdp->setup.form, args, n); n = 0; XtSetArg(args[n], XtNresizable, True); n++; XtSetArg(args[n], XtNforceColumns, True); n++; XtSetArg(args[n], XtNdefaultColumns, 1); n++; XtSetArg(args[n], XtNfromHoriz, NULL); n++; XtSetArg(args[n], XtNfromVert, NULL); n++; XtSetArg(args[n], XtNsensitive, canChangePaperSize); n++; XtSetArg(args[n], XtNlist, pdp->widget_paperlist); n++; XtSetArg(args[n], XtNwidth, DEFAULT_WIDTH); n++; pdp->setup.paperlist = XtCreateManagedWidget("paperlist", listWidgetClass, listform, args, n); n = 0; XtSetArg(args[n], XtNresizable, True); n++; @@ -862,67 +863,67 @@ return; } list_index = lrs->list_index; if (lrs->list_index == XAW_LIST_NONE) { Log(("printerSelectionOKXtProc: rs->list_index == XAW_LIST_NONE\n")); XtFree((char *)lrs); return; } /* Set printer name and description in main dialog */ XtVaSetValues(pdp->main.name, XtNlabel, NULLSTR(pdp->printerlist[list_index].name), NULL); XtVaSetValues(pdp->main.desc, XtNlabel, NULLSTR(pdp->printerlist[list_index].desc), NULL); if (pdp->printer_name) free(pdp->printer_name); pdp->printer_name = strdup(lrs->string); /* Close any outstanding printer connection since user has selected * a different printer */ - closePrinterConnection(pdw); + closePrinterConnection(pdw, True); printerSelectionClose(pdw); XtFree((char *)lrs); } static void printerSelectionCancelXtProc(Widget w, XtPointer client_data, XtPointer callData) { PrintDialogWidget pdw = (PrintDialogWidget)client_data; Log(("## printerSelectionCancelXtProc: closing printer selection!\n")); printerSelectionClose(pdw); } static Bool buildPrinterSelectionDialog(PrintDialogWidget pdw) { PrintDialogPart *pdp = &pdw->printdialog; int n; Arg args[20]; n = 0; XtSetArg(args[n], XtNallowShellResize, True); n++; - pdp->selectPrinter.popup = XtCreatePopupShell("popup", transientShellWidgetClass, (Widget)pdw, args, n); + pdp->selectPrinter.popup = XtCreatePopupShell("printerselection", transientShellWidgetClass, (Widget)pdw, args, n); n = 0; pdp->selectPrinter.form = XtCreateManagedWidget("form", formWidgetClass, pdp->selectPrinter.popup, args, n); n = 0; XtSetArg(args[n], XtNresizable, True); n++; XtSetArg(args[n], XtNforceColumns, True); n++; XtSetArg(args[n], XtNdefaultColumns, 1); n++; XtSetArg(args[n], XtNfromHoriz, NULL); n++; XtSetArg(args[n], XtNfromVert, NULL); n++; XtSetArg(args[n], XtNlist, pdp->widget_printerlist); n++; XtSetArg(args[n], XtNwidth, DEFAULT_WIDTH); n++; pdp->selectPrinter.list = XtCreateManagedWidget("list", listWidgetClass, pdp->selectPrinter.form, args, n); XtAddCallback(pdp->selectPrinter.list, XtNcallback, printerSelectionPrinterSelectedXtProc, pdw); n = 0; XtSetArg(args[n], XtNfromHoriz, NULL); n++; XtSetArg(args[n], XtNfromVert, pdp->selectPrinter.list); n++; XtSetArg(args[n], XtNlabel, "OK"); n++; XtSetArg(args[n], XtNsensitive, False); n++; @@ -981,41 +982,41 @@ PrintDialogPart *pdp = &pdw->printdialog; const char *default_printername = NULL, *default_printerdesc = NULL; Bool has_default_printer = False; pdp->printerlist = XpuGetPrinterList(NULL, &pdp->num_printers); pdp->widget_printerlist = xpprinterlist_to_widget_printerlist(pdp->printerlist, pdp->num_printers); if (pdp->num_printers > 0) { if (pdp->printerlist[0].name && strlen(pdp->printerlist[0].name)) { /* XprintUtils moves the default printer to the top */ default_printername = pdp->printerlist[0].name; default_printerdesc = pdp->printerlist[0].desc; pdp->printer_name = strdup(pdp->printerlist[0].name); has_default_printer = True; } } n = 0; XtSetArg(args[n], XtNborderWidth, 0); n++; - pdp->main.form = XtCreateManagedWidget("form", formWidgetClass, (Widget)pdw, args, n); + pdp->main.form = XtCreateManagedWidget("main", formWidgetClass, (Widget)pdw, args, n); n = 0; pdp->main.innerform = XtCreateManagedWidget("innerform", formWidgetClass, pdp->main.form, args, n); n = 0; XtSetArg(args[n], XtNfromHoriz, NULL); n++; XtSetArg(args[n], XtNfromVert, NULL); n++; XtSetArg(args[n], XtNborderWidth, 0); n++; XtSetArg(args[n], XtNresizable, False); n++; XtSetArg(args[n], XtNjustify, XtJustifyRight); n++; XtSetArg(args[n], XtNwidth, DEFAULT_WIDTH); n++; XtSetArg(args[n], XtNlabel, "Printer Description:"); n++; pdp->main.desclabel = XtCreateManagedWidget("desclabel", labelWidgetClass, pdp->main.innerform, args, n); n = 0; XtSetArg(args[n], XtNfromHoriz, pdp->main.desclabel); n++; XtSetArg(args[n], XtNfromVert, NULL); n++; XtSetArg(args[n], XtNborderWidth, 0); n++; XtSetArg(args[n], XtNresizable, False); n++; XtSetArg(args[n], XtNjustify, XtJustifyLeft); n++; @@ -1348,28 +1349,53 @@ * args - argument list * num_args - number of args * * Description: * This is a get values hook routine that gets the values in the dialog. */ static void XawPrintDialogGetValuesHook(Widget w, ArgList args, Cardinal *num_args) { /* NO-OP for now */ } static void XawPrintDialogDestroy(Widget w) { PrintDialogWidget pdw = (PrintDialogWidget)w; Log(("# XawPrintDialogDestroy: start.\n")); destroyPrintSetupDialog(pdw); destroyPrinterSelectionDialog(pdw); - closePrinterConnection(pdw); + closePrinterConnection(pdw, True); Log(("# XawPrintDialogDestroy: done.\n")); } - - +/* + * Function: + * XawPrintDialogClosePrinterConnection + * + * Parameters: + * w - Print Dialog Widget + * closeDisplay - Boolean which decides whether |Display *| + * and |XPContext| should be disposed, too. + * + * Description: + * The print display connection is owned by the print dialog + * by default. + * If the application wishes to close the display connection + * to the print server, either to close it itself or force + * a disconnection for other reasons this function can be used. + * + * Notes + * 1. PUBLIC API + * 2. After this function returns all resources returned by the + * print dialog which are related to the status of the printer + * connection are stale. + */ +void +XawPrintDialogClosePrinterConnection(Widget w, Bool closeDisplay) +{ + closePrinterConnection((PrintDialogWidget)w, closeDisplay); +} Index: xc/programs/xmore/printdialog.h =================================================================== RCS file: /cvs/xorg/xc/programs/xmore/printdialog.h,v retrieving revision 1.1 diff -u -2 -0 -r1.1 printdialog.h --- a/xc/programs/xmore/printdialog.h 24 May 2004 03:17:44 -0000 1.1 +++ b/xc/programs/xmore/printdialog.h 30 May 2004 00:49:02 -0000 @@ -61,24 +61,25 @@ #define XawNOkCallback "XawNOkCallback" #define XawNCancelCallback "XawNCancelCallback" typedef struct { Display *pdpy; XPContext pcontext; const char *printToFileName; Boolean printToFile; } XawPrintDialogCallbackStruct; typedef struct _PrintDialogClassRec *PrintDialogWidgetClass; typedef struct _PrintDialogRec *PrintDialogWidget; extern WidgetClass printDialogWidgetClass; _XFUNCPROTOBEGIN /* Prototypes */ +void XawPrintDialogClosePrinterConnection(Widget w, Bool closeDisplay); _XFUNCPROTOEND #endif /* _XawDialog_h */ Index: xc/programs/xmore/xmore.c =================================================================== RCS file: /cvs/xorg/xc/programs/xmore/xmore.c,v retrieving revision 1.1 diff -u -2 -0 -r1.1 xmore.c --- a/xc/programs/xmore/xmore.c 24 May 2004 03:17:44 -0000 1.1 +++ b/xc/programs/xmore/xmore.c 30 May 2004 00:49:02 -0000 @@ -27,168 +27,271 @@ /* Force ANSI C prototypes from X11 headers */ #ifndef FUNCPROTO #define FUNCPROTO 15 #endif /* !FUNCPROTO */ #include #include #include #include #include #include #include #include "xmore.h" #include "printdialog.h" #include "print.h" #include #include +#include /* Turn a NULL pointer string into an empty string */ #define NULLSTR(x) (((x)!=NULL)?(x):("")) #define Error(x) { printf x ; exit(EXIT_FAILURE); } #define Assertion(expr, msg) { if (!(expr)) { Error msg } } -#define Log(x) { if(True) printf x; } +#define Log(x) { if (userOptions.verbose) printf x; } /* Global vars */ -XtAppContext app; -Widget printdialog_shell = NULL; -Widget printdialog = NULL; -Widget toplevel; -const char *ProgramName; /* program name (from argv[0]) */ -const char *viewFileName; /* file to browse (from argv[1]) */ -char printJobNameBuffer[1024]; +static Widget printdialog_shell = NULL; +static Widget printdialog = NULL; +static Widget toplevel = NULL; +static Widget text = NULL; +static char printJobNameBuffer[PATH_MAX+256]; +static const char *ProgramName; /* program name (from argv[0]) */ +static const char *viewFileName; /* file to browse (from argv[1]) */ + +/* prototypes */ +static void quitAction(Widget w, XEvent *event, String *params, Cardinal *num_params); +static void quitXtProc(Widget w, XtPointer client_data, XtPointer callData); +static void printAction(Widget w, XEvent *event, String *params, Cardinal *num_params); +static void printXtProc(Widget w, XtPointer client_data, XtPointer callData); + +static XrmOptionDescRec options[] = { +{ + "-v", "*verbose", XrmoptionNoArg, (XPointer) "on" }, +}; + + +static XtActionsRec actions[] = { + { "quit", quitAction }, + { "print", printAction } +}; + +/* See xmore.h */ +XMoreResourceData userOptions; + +#define Offset(field) XtOffsetOf(XMoreResourceData, field) + +XtResource resources[] = { + {"verbose", "Verbose", XtRBoolean, sizeof(Boolean), Offset(verbose), XtRImmediate, (XtPointer)False}, + {"textfont", XtCFont, XtRFontSet, sizeof(XFontSet), Offset(textfont), XtRString, STANDARDFONT}, +}; + + +String fallback_resources[] = { +#ifdef NOTYET + "*iconPixmap: xmore32", + "*iconMask: xmore32", +#endif /* NOTYET */ + "*textfont: " STANDARDFONT, + "*international: True", /* set this globally for ALL widgets to avoid wiered crashes */ + "*text.Translations: #override \\n\\" + "\tCtrlS: no-op(RingBell)\\n\\" + "\tCtrlR: no-op(RingBell)\\n\\" + "\tspace: next-page()\\n\\" + "\tF: next-page()\\n\\" + "\tCtrlB: previous-page()\\n\\" + "\tB: previous-page()\\n\\" + "\tK: scroll-one-line-down()\\n\\" + "\tY: scroll-one-line-down()\\n\\" + "\tReturn: scroll-one-line-up()\\n\\" + "\tJ: scroll-one-line-up()\\n\\" + "\tE: scroll-one-line-up()\\n\\" + "\tp: print()\\n\\" + "\tq: quit()\\n", + "*text.baseTranslations: #override \\n\\" + "\tspace: next-page()\\n\\" + "\tF: next-page()\\n\\" + "\tCtrlB: previous-page()\\n\\" + "\tK: scroll-one-line-down()\\n\\" + "\tY: scroll-one-line-down()\\n\\" + "\tReturn: scroll-one-line-up()\\n\\" + "\tJ: scroll-one-line-up()\\n\\" + "\tE: scroll-one-line-up()\\n\\" + "\tp: print()\\n\\" + "\tq: quit()\\n", + NULL, +}; + +static void +quitAction(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + XtAppSetExitFlag(XtWidgetToApplicationContext(w)); +} static void quitXtProc(Widget w, XtPointer client_data, XtPointer callData) { - XtAppSetExitFlag(app); + XtCallActionProc(w, "quit", NULL, NULL, 0); +} + +static void +printshellDestroyXtProc(Widget w, XtPointer client_data, XtPointer callData) +{ + XawPrintDialogClosePrinterConnection(printdialog, False); } static void printOKXtProc(Widget w, XtPointer client_data, XtPointer callData) { XawPrintDialogCallbackStruct *pdcs = (XawPrintDialogCallbackStruct *)callData; + Cardinal n; + Arg args[2]; + Widget textsource; Log(("printOKXtProc: OK.\n")); + /* Get TextSource object */ + n = 0; + XtSetArg(args[n], XtNtextSource, &textsource); n++; + XtGetValues(text, args, n); + + Assertion(textsource != NULL, (("printOKXtProc: textsource == NULL.\n"))); + /* ||printJobNameBuffer| must live as long the print job prints * because it is used for the job title AND the page headers... */ sprintf(printJobNameBuffer, "XMore print job %s", viewFileName); - DoPrint(toplevel, pdcs->pdpy, pdcs->pcontext, + DoPrint(ProgramName, + textsource, toplevel, + pdcs->pdpy, pdcs->pcontext, printshellDestroyXtProc, printJobNameBuffer, pdcs->printToFile?pdcs->printToFileName:NULL); XtPopdown(printdialog_shell); } static void printCancelXtProc(Widget w, XtPointer client_data, XtPointer callData) { Log(("printCancelXtProc: cancel.\n")); XtPopdown(printdialog_shell); Log(("destroying print dialog shell...\n")); XtDestroyWidget(printdialog_shell); printdialog_shell = NULL; printdialog = NULL; Log(("... done\n")); } static void printXtProc(Widget w, XtPointer client_data, XtPointer callData) { + XtCallActionProc(toplevel, "print", NULL, NULL, 0); +} + +static void +printAction(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ Dimension width, height; - Position x, y; - Widget parent = toplevel; - puts("print!"); + Position x, y; + Widget parent = toplevel; + Log(("print!\n")); if (!printdialog) { int n; Arg args[20]; n = 0; XtSetArg(args[n], XtNallowShellResize, True); n++; - printdialog_shell = XtCreatePopupShell("shell", + printdialog_shell = XtCreatePopupShell("printdialogshell", transientShellWidgetClass, toplevel, args, n); n = 0; printdialog = XtCreateManagedWidget("printdialog", printDialogWidgetClass, printdialog_shell, args, n); XtAddCallback(printdialog, XawNOkCallback, printOKXtProc, NULL); XtAddCallback(printdialog, XawNCancelCallback, printCancelXtProc, NULL); XtRealizeWidget(printdialog_shell); } /* Center dialog */ XtVaGetValues(printdialog_shell, XtNwidth, &width, XtNheight, &height, NULL); x = (Position)(XWidthOfScreen( XtScreen(parent)) - width) / 2; y = (Position)(XHeightOfScreen(XtScreen(parent)) - height) / 3; XtVaSetValues(printdialog_shell, XtNx, x, XtNy, y, NULL); XtPopup(printdialog_shell, XtGrabNonexclusive); } int main( int argc, char *argv[] ) { + XtAppContext app; Widget form; - Widget text; Widget printbutton; Widget quitbutton; int n; Arg args[8]; ProgramName = argv[0]; - toplevel = XtAppInitialize(&app, "XMore", NULL, 0, &argc, argv, NULL, NULL, 0); + toplevel = XtOpenApplication(&app, "XMore", + options, XtNumber(options), + &argc, argv, fallback_resources, + sessionShellWidgetClass, NULL, ZERO); if (argc != 2) { printf("usage: %s [ x options ] filename\n", argv[0]); exit(EXIT_FAILURE); } + XtGetApplicationResources(toplevel, (XtPointer)&userOptions, resources, + XtNumber(resources), NULL, 0); + + XtAppAddActions(app, actions, XtNumber(actions)); + viewFileName = argv[1]; form = XtCreateManagedWidget("form", formWidgetClass, toplevel, NULL, 0); n = 0; XtSetArg(args[n], XtNtype, XawAsciiFile); n++; XtSetArg(args[n], XtNstring, viewFileName); n++; - XtSetArg(args[n], XtNwidth, 500); n++; - XtSetArg(args[n], XtNheight, 600); n++; - XtSetArg(args[n], XtNscrollHorizontal, XawtextScrollWhenNeeded); n++; + XtSetArg(args[n], XtNwidth, 700); n++; + XtSetArg(args[n], XtNheight, 300); n++; + XtSetArg(args[n], XtNscrollHorizontal, XawtextScrollAlways); n++; XtSetArg(args[n], XtNscrollVertical, XawtextScrollAlways); n++; + XtSetArg(args[n], XtNfontSet, userOptions.textfont); n++; text = XtCreateManagedWidget("text", asciiTextWidgetClass, form, args, n); n = 0; XtSetArg(args[n], XtNfromHoriz, NULL); n++; XtSetArg(args[n], XtNfromVert, text); n++; XtSetArg(args[n], XtNlabel, "Print..."); n++; printbutton = XtCreateManagedWidget("print", commandWidgetClass, form, args, n); XtAddCallback(printbutton, XtNcallback, printXtProc, 0); n = 0; XtSetArg(args[n], XtNfromHoriz, printbutton); n++; XtSetArg(args[n], XtNfromVert, text); n++; XtSetArg(args[n], XtNlabel, "Quit"); n++; quitbutton = XtCreateManagedWidget("quit", commandWidgetClass, form, args, n); XtAddCallback(quitbutton, XtNcallback, quitXtProc, 0); printdialog_shell = NULL; printdialog = NULL; XtRealizeWidget(toplevel); Index: xc/programs/xmore/xmore.h =================================================================== RCS file: /cvs/xorg/xc/programs/xmore/xmore.h,v retrieving revision 1.1 diff -u -2 -0 -r1.1 xmore.h --- a/xc/programs/xmore/xmore.h 24 May 2004 03:17:44 -0000 1.1 +++ b/xc/programs/xmore/xmore.h 30 May 2004 00:49:02 -0000 @@ -11,25 +11,31 @@ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ #ifndef XMORE_XMORE_H #define XMORE_XMORE_H 1 -/* Global vars */ -extern const char *ProgramName; /* program name (from argv[0]) */ -extern const char *viewFileName; /* file to browse (from argv[1]) */ +#include + +typedef struct { + Boolean verbose; + XFontSet textfont; +} XMoreResourceData, *XMoreResourceDataPtr; + +#define STANDARDFONT "-adobe-courier-medium-r-normal--12-*-*-*-*-*," \ + "-*-*-*-*-*-*-12-*-*-*-*-*" #endif /* !XMORE_XMORE_H */