Index: xc/programs/glxgears/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/glxgears/Imakefile,v retrieving revision 1.7 diff -u -2 -0 -r1.7 Imakefile --- xc/programs/glxgears/Imakefile 2 Sep 2004 01:10:29 -0000 1.7 +++ xc/programs/glxgears/Imakefile 2 Sep 2004 05:21:32 -0000 @@ -1,15 +1,19 @@ XCOMM $XConsortium: Imakefile /main/7 1995/12/04 15:10:00 dpw $ XCOMM $XFree86: xc/programs/glxinfo/Imakefile,v 1.3 2001/03/21 20:56:32 dawes Exp $ #include -#if BuildXprintLib && BuildXprintClients - XPRINTLIBS = -lXprintUtil $(XPLIB) - XPRINTDEFINES = -DXPRINT -#endif +#if BuildXprintLib && BuildXprintClients && BuildXaw +# define glxgearsUseXprint YES +#endif /* BuildXprintLib && BuildXprintClients && BuildXaw */ + +#if glxgearsUseXprint + PRINT_LIBS = -lXprintUtil $(XPLIB) + PRINT_DEFINES = -DBUILD_PRINTSUPPORT +#endif /* glxgearsUseXprint */ DEPLIBS = $(DEPGLXLIB) $(DEPXPLIB) $(DEPXLIB) -LOCAL_LIBRARIES = $(GLXLIB) $(XPRINTLIBS) $(XLIB) - DEFINES = $(XPRINTDEFINES) +LOCAL_LIBRARIES = $(GLXLIB) $(PRINT_LIBS) $(XLIB) + DEFINES = $(PRINT_DEFINES) SYS_LIBRARIES = MathLibrary SimpleProgramTarget(glxgears) Index: xc/programs/glxgears/glxgears.c =================================================================== RCS file: /cvs/xorg/xc/programs/glxgears/glxgears.c,v retrieving revision 1.4 diff -u -2 -0 -r1.4 glxgears.c --- xc/programs/glxgears/glxgears.c 16 Aug 2004 16:36:15 -0000 1.4 +++ xc/programs/glxgears/glxgears.c 2 Sep 2004 05:21:32 -0000 @@ -14,43 +14,43 @@ * 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 * BRIAN PAUL 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. */ /* $XFree86: xc/programs/glxgears/glxgears.c,v 1.3tsi Exp $ */ /* * This is a port of the infamous "gears" demo to straight GLX (i.e. no GLUT) * Port by Brian Paul 23 March 2001 * * Command line options: * -info print GL implementation information * */ #include #include -#ifdef XPRINT +#ifdef BUILD_PRINTSUPPORT #include -#endif +#endif /* BUILD_PRINTSUPPORT */ #include #include #include #include #include #include #include #include #include /* XXX this probably isn't very portable */ #include #include #ifndef M_PI #define M_PI 3.14159265 #endif /* !M_PI */ /* Turn a NULL pointer string into an empty string */ #define NULLSTR(x) (((x)!=NULL)?(x):("")) @@ -452,163 +452,163 @@ } else if (code == XK_Down) { view_rotx -= 5.0; } else { (void) XLookupString(&event.xkey, buffer, sizeof(buffer), NULL, NULL); if (buffer[0] == 27) { /* escape */ return; } } } } } } /* next frame */ angle += 2.0; -#ifdef XPRINT +#ifdef BUILD_PRINTSUPPORT if (numPages > 0) { XpStartPage(dpy, win); XpuWaitForPrintNotify(dpy, xp_event_base, XPStartPageNotify); } -#endif +#endif /* BUILD_PRINTSUPPORT */ draw(); glXSwapBuffers(dpy, win); -#ifdef XPRINT +#ifdef BUILD_PRINTSUPPORT if (numPages > 0) { XpEndPage(dpy); XpuWaitForPrintNotify(dpy, xp_event_base, XPEndPageNotify); /* Last page ? */ if( --numPages == 0 ) return; } -#endif +#endif /* BUILD_PRINTSUPPORT */ /* calc framerate */ { static int t0 = -1; static int frames = 0; int t = current_time(); if (t0 < 0) t0 = t; frames++; if (t - t0 >= 5.0) { GLfloat seconds = t - t0; GLfloat fps = frames / seconds; printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps); t0 = t; frames = 0; } } } } int main(int argc, char *argv[]) { Display *dpy; Window win; Screen *screen; GLXContext ctx; char *dpyName = NULL; int i; XRectangle winrect; -#ifdef XPRINT +#ifdef BUILD_PRINTSUPPORT long dpi; XPContext pcontext = None; /* Xprint context */ void *printtofile_handle = NULL; /* "context" when printing to file */ Bool doPrint = FALSE; /* Print to printer ? */ const char *printername = NULL; /* printer to query */ const char *toFile = NULL; /* output file (instead of printer) */ int numPages = 5; /* Numer of pages to print */ XPPrinterList plist = NULL; /* list of printers */ int plist_count; /* number of entries in |plist|-array */ unsigned short dummy; -#endif +#endif /* BUILD_PRINTSUPPORT */ ProgramName = argv[0]; for (i = 1; i < argc; i++) { const char *arg = argv[i]; int len = strlen(arg); if (strcmp(argv[i], "-display") == 0) { if (++i >= argc) usage(); dpyName = argv[i]; } else if (strcmp(argv[i], "-info") == 0) { printInfo = GL_TRUE; } -#ifdef XPRINT +#ifdef BUILD_PRINTSUPPORT else if (strcmp(argv[i], "-print") == 0) { doPrint = True; } else if (!strncmp("-printer", arg, len)) { if (++i >= argc) usage(); printername = argv[i]; doPrint = True; } else if (!strncmp("-printfile", arg, len)) { if (++i >= argc) usage(); toFile = argv[i]; doPrint = True; } else if (!strncmp("-numpages", arg, len)) { if (++i >= argc) usage(); numPages = atoi(argv[i]); doPrint = True; if (numPages <= 0) usage(); } -#endif +#endif /* BUILD_PRINTSUPPORT */ else if (!strncmp("-v", arg, len)) { verbose = True; printInfo = GL_TRUE; } else if (strcmp(argv[i], "-h") == 0) { usage(); } else { fprintf(stderr, "%s: Unsupported option '%s'.\n", ProgramName, argv[i]); usage(); } } -#ifdef XPRINT +#ifdef BUILD_PRINTSUPPORT /* Display and printing at the same time not implemented */ if (doPrint && dpyName) { usage(); } if (doPrint) { plist = XpuGetPrinterList(printername, &plist_count); if (!plist) { fprintf(stderr, "%s: no printers found for printer spec \"%s\".\n", ProgramName, NULLSTR(printername)); return EXIT_FAILURE; } printername = plist[0].name; Log(("Using printer '%s'\n", printername)); if (XpuGetPrinter(printername, &dpy, &pcontext) != 1) { fprintf(stderr, "%s: Cannot open printer '%s'\n", ProgramName, printername); @@ -661,91 +661,91 @@ } else { Log(("starting job.\n")); XpuStartJobToSpooler(dpy); XpuWaitForPrintNotify(dpy, xp_event_base, XPStartJobNotify); } screen = XpGetScreenOfContext(dpy, pcontext); /* Obtain some info about page geometry */ XpGetPageDimensions(dpy, pcontext, &dummy, &dummy, &winrect); /* Center output window on page */ winrect.width /= 2; winrect.height /= 2; winrect.x += winrect.width / 2; winrect.y += winrect.height / 2; } else -#endif +#endif /* BUILD_PRINTSUPPORT */ { dpy = XOpenDisplay(dpyName); if (!dpy) { fprintf(stderr, "%s: Error: couldn't open display '%s'\n", ProgramName, dpyName); return EXIT_FAILURE; } screen = XDefaultScreenOfDisplay(dpy); winrect.x = 0; winrect.y = 0; winrect.width = 300; winrect.height = 300; } Log(("Window x=%d, y=%d, width=%d, height=%d\n", (int)winrect.x, (int)winrect.y, (int)winrect.width, (int)winrect.height)); make_window(dpy, screen, "glxgears", winrect.x, winrect.y, winrect.width, winrect.height, &win, &ctx); reshape(winrect.width, winrect.height); if (printInfo) { printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); } init(); -#ifdef XPRINT +#ifdef BUILD_PRINTSUPPORT event_loop(dpy, win, doPrint?numPages:0); #else event_loop(dpy, win, 0); -#endif +#endif /* BUILD_PRINTSUPPORT */ glXDestroyContext(dpy, ctx); -#ifdef XPRINT +#ifdef BUILD_PRINTSUPPORT if (doPrint) { /* End the print job - the final results are sent by the X print * server to the spooler sub system. */ XpEndJob(dpy); XpuWaitForPrintNotify(dpy, xp_event_base, XPEndJobNotify); Log(("end job.\n")); if (toFile) { if (XpuWaitForPrintFileChild(printtofile_handle) != XPGetDocFinished) { fprintf(stderr, "%s: Error while printing to file.\n", ProgramName); XpuClosePrinterDisplay(dpy, pcontext); return EXIT_FAILURE; } } XDestroyWindow(dpy, win); XpuClosePrinterDisplay(dpy, pcontext); XpuFreePrinterList(plist); } else -#endif +#endif /* BUILD_PRINTSUPPORT */ { XDestroyWindow(dpy, win); XCloseDisplay(dpy); } return EXIT_SUCCESS; } Index: xc/programs/xedit/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/xedit/Imakefile,v retrieving revision 1.5 diff -u -2 -0 -r1.5 Imakefile --- xc/programs/xedit/Imakefile 16 Aug 2004 16:36:15 -0000 1.5 +++ xc/programs/xedit/Imakefile 2 Sep 2004 05:21:43 -0000 @@ -1,51 +1,70 @@ XCOMM $XConsortium: Imakefile,v 1.17 93/08/17 20:49:32 rws Exp $ XCOMM $XFree86: xc/programs/xedit/Imakefile,v 1.25 2003/03/25 04:18:26 dawes Exp $ #include "lisp/lisp.cf" #if BuildSharedLispModules CCOPTIONS = -fpic DLLIB = DlLibrary LOCAL_LDFLAGS = -Xlinker -E #endif #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" +#if BuildXprintLib && BuildXprintClients && BuildXaw +# define XEditUseXprint YES +#endif /* BuildXprintLib && BuildXprintClients && BuildXaw */ + +#ifdef XEditUseXprint + PRINT_LIBS = -lXprintUtil $(XPLIB) + PRINT_DEFS = -DBUILD_PRINTSUPPORT + PRINT_SRCS = printdialog.c print.c + PRINT_OBJS = printdialog.o print.o +#endif /* XEditUseXprint */ + SUBDIRS = lisp LISPLIBS = -Llisp -llisp -Llisp/mp -lmp -Llisp/re -lre LISP_SRC = lisp.c LISP_OBJ = lisp.o DEPLIBS = XawClientDepLibs $(SUBDIRS) -LOCAL_LIBRARIES = $(LISPLIBS) XawClientLibs $(DLLIB) +LOCAL_LIBRARIES = $(LISPLIBS) $(PRINT_LIBS) XawClientLibs $(DLLIB) SYS_LIBRARIES = MathLibrary #if defined(LynxOSArchitecture) || defined(SVR3Architecture) || defined(LinuxArchitecture) RP_SRCS = realpath.c RP_OBJS = realpath.o RP_DEFINES = -DNEED_REALPATH #endif #if !HasStrcasecmp STRCCMP_SRCS = strcasecmp.c STRCCMP_OBJS = strcasecmp.o STRCCMP_DEFINES = -DNEED_STRCASECMP #endif SYS_SRCS = $(RP_SRCS) $(STRCCMP_SRCS) SYS_OBJS = $(RP_OBJS) $(STRCCMP_OBJS) SYS_DEFINES = $(RP_DEFINES) $(STRCCMP_DEFINES) - DEFINES = $(SIGNAL_DEFINES) $(SYS_DEFINES) + DEFINES = $(PRINT_DEFS) $(SIGNAL_DEFINES) $(SYS_DEFINES) INCLUDES = -I. -Ilisp/re $(MISC_INCLUDES) SRCS = xedit.c commands.c util.c $(SYS_SRCS) ispell.c options.c \ - hook.c $(LISP_SRC) + hook.c $(PRINT_SRCS) $(LISP_SRC) OBJS = xedit.o commands.o util.o $(SYS_OBJS) ispell.o options.o \ - hook.o $(LISP_OBJ) + hook.o $(PRINT_OBJS) $(LISP_OBJ) + +#ifdef XEditUseXprint +LinkSourceFile(printdialog.c,../xmore) +LinkSourceFile(printdialog.h,../xmore) +LinkSourceFile(printdialogprivates.h,../xmore) +LinkSourceFile(print.c,../xmore) +LinkSourceFile(print.h,../xmore) +#endif /* XEditUseXprint */ #ifdef IHaveSubdirs ForceSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif ComplexProgramTarget(xedit) InstallAppDefaults(Xedit) InstallAppDefaultsLong(Xedit-color,Xedit-color) Index: xc/programs/xedit/Xedit.ad =================================================================== RCS file: /cvs/xorg/xc/programs/xedit/Xedit.ad,v retrieving revision 1.5 diff -u -2 -0 -r1.5 Xedit.ad --- xc/programs/xedit/Xedit.ad 16 Aug 2004 16:36:15 -0000 1.5 +++ xc/programs/xedit/Xedit.ad 2 Sep 2004 05:21:43 -0000 @@ -1,27 +1,28 @@ ! $XFree86: xc/programs/xedit/Xedit.ad,v 1.23 2002/09/22 07:09:05 paulo Exp $ *geometry: 590x440 *input: TRUE *enableBackups: True *backupNameSuffix: ~ *changedBitmap: xlogo11 +*international: True *hints:\ Use Control-S and Control-R to Search.\n\ Use Control-Shift-_ to Undo. Control-G to switch between Undo and Redo.\n\ Use Control-A to jump to the beginning of the line.\n\ Use Control-E to jump to the end of the line.\n\ Use Control-T to transpose characters.\n\ Use Control-K to cut to the end of the line. Control-Y to paste.\n\ Use Control-Q to escape control characters.\n\ Use Control-U[,] to multiply actions. Control-G to cancel.\n\ Use Control-Z to scroll one line up. Meta-Z to scroll one line down.\n\ Use Meta-Q to format a paragraph.\n\ Use Right-Button to extend selections.\n\ Use Meta-I to insert a file.\n\ Use Control-W to delete a selection, and/or jump to the selection mark.\n\ Use Control-X,Control-F to find a file. Tab for filename completion.\n\ Use Control-X,Control-S to save.\n\ Use Control-X,Control-C to exit.\n\ Use Control-C to paste the selection at CUT_BUFFER0.\n\ Use Control Left-Button to popup the File Menu.\n\ @@ -46,40 +47,42 @@ *formWindow.max: 18 *formWindow.showGrip: False *positionWindow.fromHoriz: labelWindow *positionWindow.horizDistance: 0 *positionWindow.left: chainRight *positionWindow.right: chainRight *positionWindow.width: 90 *positionWindow.label: error *positionWindow.justify: left *labelWindow*justify: center *labelWindow*label: no file yet *labelWindow.left: chainLeft *labelWindow.right: chainRight *quit.label: Quit *quit.tip: Close xedit window *save.label: Save *save.tip: Save current file *load.label: Load *load.tip: Load a new file +*print.label: Print +*print.tip: Print current file *buttons*orientation: horizontal *buttons*showGrip: False *buttons.min: 18 *messageWindow.height: 50 *messageWindow.min: 18 *Paned*Text*allowResize: True *messageWindow.autoFill: False *messageWindow.scrollVertical: Never *editWindow.autoFill: False *editWindow.scrollVertical: Always *editWindow.showGrip: True xedit.textSource*enableUndo: True *bc_label*label: Use Control-S and Control-R to Search. *bc_label*showGrip: False *bc_label.min: 18 @@ -226,40 +229,41 @@ c @Num_Lock:xedit-focus() popup-menu(fileMenu)\n\ c l: xedit-focus() popup-menu(fileMenu)\n\ c: xedit-focus() popup-menu(fileMenu)\n\ c l @Num_Lock:xedit-focus() popup-menu(editMenu)\n\ c @Num_Lock:xedit-focus() popup-menu(editMenu)\n\ c l: xedit-focus() popup-menu(editMenu)\n\ c: xedit-focus() popup-menu(editMenu)\n\ c l @Num_Lock:xedit-focus() popup-menu(optionsMenu)\n\ c @Num_Lock:xedit-focus() popup-menu(optionsMenu)\n\ c l:xedit-focus() popup-menu(optionsMenu)\n\ c: xedit-focus() popup-menu(optionsMenu)\n\ : xedit-focus() select-start() *filename.?.pieceSize: 256 *filename.translations: #override \ cS: no-op(r)\n\ cR: no-op(r)\n\ mI: no-op(r)\n\ cG: cancel-find-file()\n\ Return: load-file()\n\ +P: print-file()\n\ Tab: file-completion(h)\n\ Escape: cancel-find-file()\n\ : no-op()\n\ : no-op()\n\ : set-keyboard-focus() select-start() *ispell.translations: #override \ WM_PROTOCOLS: ispell(end) ! Sample dictionary, word chars and text mode resources setup !*ispell.dictionary: br !*ispell.dictionaries: br american americanmed+ english !*ispell*br.wordChars: áéíóúçÁÉÍÓÚÇàÀâêôÂÊÔüÜãõÃÕ- !*ispell.ispellCommand: /usr/local/bin/ispell -B -m !*ispell*text.skipLines: .# *ispell.geometry: 0x0 *ispell.minWidth: 320 *ispell.minHeight: 245 *ispell*Label.borderWidth: 0 @@ -440,20 +444,116 @@ *columns*ok.fromVert: rightLabel *columns*cancel.fromHoriz: ok *columns*cancel.fromVert: rightLabel *columns*cancel.horizDistance: 12 *columns*Text.?.pieceSize: 8 *columns*Text.translations: #override \ cS: no-op(r)\n\ cR: no-op(r)\n\ mI: no-op(r)\n\ Return: set-columns(ok)\n\ Tab: change-field()\n\ cG: set-columns(cancel)\n\ Escape: set-columns(cancel)\n\ : no-op()\n\ : no-op()\n\ : set-keyboard-focus() select-start() *columns.translations: #override \ WM_PROTOCOLS: set-columns(cancel) + +! Use "white" as background for printing +*printshell*background: white + +! Print dialog +*printdialogshell*geometry: 600x120 +*printdialogshell*title: Print +*printdialogshell*main*ok.fromVert: innerform +*printdialogshell*main*ok.label: Print +*printdialogshell*main*ok.tip: Print +*printdialogshell*main*setup.fromHoriz: ok +*printdialogshell*main*setup.fromVert: innerform +*printdialogshell*main*setup.label: Setup... +*printdialogshell*main*setup.tip: Configure print job options (page size, orientation, etc.) +*printdialogshell*main*cancel.fromHoriz: setup +*printdialogshell*main*cancel.fromVert: innerform +*printdialogshell*main*cancel.label: Cancel +*printdialogshell*main*cancel.tip: Cancel printing +*printdialogshell*main*desclabel.label: Printer Description: +*printdialogshell*main*desclabel.tip: Short description of printer +*printdialogshell*main*desc.fromHoriz: desclabel +*printdialogshell*main*desc.tip: Short description of printer +*printdialogshell*main*info.fromHoriz: desc +*printdialogshell*main*info.label: Printer info... +*printdialogshell*main*info.tip: Display additional information about this printer +*printdialogshell*main*namelabel.fromVert: desclabel +*printdialogshell*main*namelabel.label: Printer Name: +*printdialogshell*main*namelabel.tip: Name of selected printer +*printdialogshell*main*name.fromHoriz: namelabel +*printdialogshell*main*name.fromVert: desclabel +*printdialogshell*main*name.tip: Name of selected printer +*printdialogshell*main*selectprinter.fromHoriz: name +*printdialogshell*main*selectprinter.fromVert: desclabel +*printdialogshell*main*selectprinter.label: Select Printer... +*printdialogshell*main*selectprinter.label: Select Printer... +*printdialogshell*main*selectprinter.tip: Select a different printer +*printdialogshell*main*filenamelabel.fromVert: namelabel +*printdialogshell*main*filenamelabel.label: File Name: +*printdialogshell*main*filenamelabel.tip: File where the output should be stored +*printdialogshell*main*filename.fromHoriz: filenamelabel +*printdialogshell*main*filename.fromVert: namelabel +*printdialogshell*main*filename.tip: File where the output should be stored +*printdialogshell*main*selectfile.fromHoriz: filename +*printdialogshell*main*selectfile.fromVert: namelabel +*printdialogshell*main*selectfile.label: Select File... +*printdialogshell*main*selectfile.tip: Select file where the output should be stored +*printdialogshell*main*printtoprinter.fromVert: filenamelabel +*printdialogshell*main*printtoprinter.label: Print to Printer +*printdialogshell*main*printtoprinter.tip: Send print job to printer +*printdialogshell*main*printtofile.fromVert: filenamelabel +*printdialogshell*main*printtofile.fromHoriz: printtoprinter +*printdialogshell*main*printtofile.label: Print to File +*printdialogshell*main*printtofile.tip: Save print job in a file + +! Print job options dialog +*printdialogshell*setup*geometry: 600x400 +*printdialogshell*setup*title: Print: Print job options +*printdialogshell*setup*ok.fromVert: list +*printdialogshell*setup*ok.label: OK +*printdialogshell*setup*ok.tip: Commit changes +*printdialogshell*setup*cancel.fromHoriz: ok +*printdialogshell*setup*cancel.fromVert: list +*printdialogshell*setup*cancel.label: Cancel +*printdialogshell*setup*cancel.tip: Cancel and reset to defaults +*printdialogshell*setup*paperlist.tip: Select paper size +*printdialogshell*setup*resolutionlist.fromHoriz: paperlist +*printdialogshell*setup*resolutionlist.tip: Select page resolution +*printdialogshell*setup*orientationlist.fromHoriz: resolutionlist +*printdialogshell*setup*orientationlist.tip: Select page orientation +*printdialogshell*setup*plexlist.fromHoriz: orientationlist +*printdialogshell*setup*plexlist.tip: Select page plex mode (simplex, duplex, etc.) +*printdialogshell*setup*jobcopieslabel.fromVert: paperlist +*printdialogshell*setup*jobcopieslabel.tip: Set number of job copies +*printdialogshell*setup*jobcopieslabel.label: Job Copies: +*printdialogshell*setup*jobcopies.fromHoriz: jobcopieslabel +*printdialogshell*setup*jobcopies.fromVert: paperlist +*printdialogshell*setup*jobcopies.tip: Set number of job copies + +! Printer selection +*printdialogshell*printerselection*geometry: 400x150 +*printdialogshell*printerselection*title: Print: Select printer +*printdialogshell*printerselection*ok.fromVert: list +*printdialogshell*printerselection*ok.label: OK +*printdialogshell*printerselection*ok.tip: Switch printer +*printdialogshell*printerselection*cancel.fromHoriz: ok +*printdialogshell*printerselection*cancel.fromVert: list +*printdialogshell*printerselection*cancel.label: Cancel +*printdialogshell*printerselection*cancel.tip: Cancel printer selection +*printdialogshell*printerselection*list.tip: Select printer name from list + +! Select job file +*printdialogshell*selectfile*geometry: 400x80 +*printdialogshell*selectfile*title: Print: Select job file +*printdialogshell*selectfile*dialog.label: Select Filename: + +! EOF. Index: xc/programs/xedit/commands.c =================================================================== RCS file: /cvs/xorg/xc/programs/xedit/commands.c,v retrieving revision 1.4 diff -u -2 -0 -r1.4 commands.c --- xc/programs/xedit/commands.c 16 Aug 2004 16:36:15 -0000 1.4 +++ xc/programs/xedit/commands.c 2 Sep 2004 05:21:43 -0000 @@ -12,52 +12,71 @@ * ANY PURPOSE. IT IS SUPPLIED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. * * IF THE SOFTWARE IS MODIFIED IN A MANNER CREATING DERIVATIVE COPYRIGHT RIGHTS, * APPROPRIATE LEGENDS MAY BE PLACED ON THE DERIVATIVE WORK IN ADDITION TO THAT * SET FORTH ABOVE. * * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Digital Equipment Corporation not be * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ /* $XFree86: xc/programs/xedit/commands.c,v 1.29tsi Exp $ */ #include #include #include "xedit.h" +#ifdef BUILD_PRINTSUPPORT +#include "printdialog.h" +#include "print.h" +#endif /* BUILD_PRINTSUPPORT */ #ifdef CRAY #include #endif #include +#include +#include #include #include #include #include #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; } + +#ifdef BUILD_PRINTSUPPORT +static Widget printdialog_shell = NULL; +static Widget printdialog = NULL; +static char printJobNameBuffer[PATH_MAX+256]; +#endif /* BUILD_PRINTSUPPORT */ + void ResetSourceChanged(xedit_flist_item*); static void ResetDC(Widget, XtPointer, XtPointer); static void AddDoubleClickCallback(Widget, Bool); static Bool ReallyDoLoad(char*, char*); static char *makeBackupName(String, String, unsigned); extern Widget scratch, texts[3], labels[3]; static Boolean double_click = FALSE; #define DC_UNSAVED 1 #define DC_LOADED 2 #define DC_CLOBBER 3 #define DC_KILL 4 #define DC_SAVE 5 static int dc_state; /* Function Name: AddDoubleClickCallback(w) * Description: Adds a callback that will reset the double_click flag * to false when the text is changed. @@ -321,42 +340,42 @@ XmuSnprintf(buf, sizeof(buf), "Saved file: %s\n", name); if (item && item->source != scratch) { XtSetArg(args[0], XtNlabel, filename); XtSetValues(item->sme, args, 1); XtSetArg(args[0], XtNeditType, XawtextEdit); XtSetValues(item->source, args, 1); XtFree(item->name); XtFree(item->filename); item->name = XtNewString(name); item->filename = XtNewString(filename); item->flags = EXISTS_BIT; } else { item = flist.itens[0]; XtRemoveCallback(scratch, XtNcallback, SourceChanged, (XtPointer)item); item->source = scratch = - XtVaCreateWidget("textSource", international ? - multiSrcObjectClass : asciiSrcObjectClass, + XtVaCreateWidget("textSource", + multiSrcObjectClass, topwindow, XtNtype, XawAsciiFile, XtNeditType, XawtextEdit, NULL, NULL); ResetSourceChanged(item); XtAddCallback(scratch, XtNcallback, SourceChanged, (XtPointer)item); item = AddTextSource(source, name, filename, EXISTS_BIT, file_access); XtAddCallback(item->source, XtNcallback, SourceChanged, (XtPointer)item); } item->flags |= EXISTS_BIT; ResetSourceChanged(item); } else { XmuSnprintf(buf, sizeof(buf), "Error saving file: %s\n", name); Feep(); } @@ -459,64 +478,167 @@ default: XmuSnprintf(buf, sizeof(buf), "%s %s", "Internal function MaybeCreateFile()", "returned unexpected value.\n"); XeditPrintf(buf); Feep(); return (False); } XeditPrintf(buf); if (exists) { flags = EXISTS_BIT; XtSetArg(args[num_args], XtNstring, filename); num_args++; } else { flags = 0; XtSetArg(args[num_args], XtNstring, NULL); num_args++; } - source = XtVaCreateWidget("textSource", international ? - multiSrcObjectClass : asciiSrcObjectClass, + source = XtVaCreateWidget("textSource", + multiSrcObjectClass, topwindow, XtNtype, XawAsciiFile, XtNeditType, XawtextEdit, NULL, NULL); XtSetValues(source, args, num_args); item = AddTextSource(source, name, filename, flags, file_access); XtAddCallback(item->source, XtNcallback, SourceChanged, (XtPointer)item); if (exists && file_access == WRITE_OK) { struct stat st; if (stat(filename, &st) == 0) item->mode = st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); } SwitchTextSource(item); ResetSourceChanged(item); } return (True); } +#ifdef BUILD_PRINTSUPPORT +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(textwindow, 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, "Xedit print job"); + + DoPrintTextSource("Xedit", + textsource, topwindow, + 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")); +} + + +/*ARGSUSED*/ +void +PrintFile(Widget w, XEvent *event, String *params, Cardinal *num_params) +{ + DoPrint(w, NULL, NULL); +} + +/*ARGSUSED*/ +void +DoPrint(Widget w, XtPointer client_data, XtPointer call_data) +{ + Dimension width, height; + Position x, y; + Widget parent = topwindow; + Log(("print!\n")); + + if (!printdialog) { + int n; + Arg args[20]; + + n = 0; + XtSetArg(args[n], XtNallowShellResize, True); n++; + printdialog_shell = XtCreatePopupShell("printdialogshell", + transientShellWidgetClass, + topwindow, 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); +} +#endif /* BUILD_PRINTSUPPORT */ + /* Function Name: SourceChanged * Description: A callback routine called when the source has changed. * Arguments: w - the text source that has changed. * client_data - xedit_flist_item associated with text buffer. * call_data - NULL is unchanged * Returns: none. */ /*ARGSUSED*/ void SourceChanged(Widget w, XtPointer client_data, XtPointer call_data) { xedit_flist_item *item = (xedit_flist_item*)client_data; Bool changed = (Bool)(long)call_data; if (changed) { if (item->flags & CHANGED_BIT) return; item->flags |= CHANGED_BIT; } else { Index: xc/programs/xedit/hook.c =================================================================== RCS file: /cvs/xorg/xc/programs/xedit/hook.c,v retrieving revision 1.4 diff -u -2 -0 -r1.4 hook.c --- xc/programs/xedit/hook.c 16 Aug 2004 16:36:15 -0000 1.4 +++ xc/programs/xedit/hook.c 2 Sep 2004 05:21:43 -0000 @@ -371,43 +371,45 @@ } } block.firstPos = 0; block.format = FMT8BIT; if (XawTextReplace(w, auto_replace.left, auto_replace.right + inc, &block) == XawEditDone) XawTextSetInsertionPoint(w, auto_replace.left + block.length); if (block.ptr != buffer) XtFree(block.ptr); } /*ARGUSED*/ void LineEditAction(Widget w, XEvent *event, String *params, Cardinal *num_params) { XawTextBlock block; - if (international) + if (True) { /* XXX FIXME */ + fprintf(stderr, "LineEditAction: Not working in international mode.\n"); return; + } block.firstPos = 0; block.format = FMT8BIT; block.ptr = einfo.command; block.length = strlen(einfo.command); XawTextReplace(filenamewindow, 0, XawTextLastPosition(filenamewindow), &block); XtSetKeyboardFocus(topwindow, filenamewindow); line_edit = True; } #define LSCAN(from, count, include) \ XawTextSourceScan(source, from, XawstEOL, XawsdLeft, count, include) #define RSCAN(from, count, include) \ XawTextSourceScan(source, from, XawstEOL, XawsdRight, count, include) void LineEdit(Widget w) { /* Global usage variables */ Index: xc/programs/xedit/ispell.c =================================================================== RCS file: /cvs/xorg/xc/programs/xedit/ispell.c,v retrieving revision 1.4 diff -u -2 -0 -r1.4 ispell.c --- xc/programs/xedit/ispell.c 16 Aug 2004 16:36:15 -0000 1.4 +++ xc/programs/xedit/ispell.c 2 Sep 2004 05:21:43 -0000 @@ -10,41 +10,41 @@ * * 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 XFREE86 PROJECT 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 XFree86 Project 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 * XFree86 Project. * * Author: Paulo César Pereira de Andrade */ -/* $XdotOrg: xc/programs/xedit/ispell.c,v 1.4 2004/08/16 16:36:15 krh Exp $ */ +/* $XdotOrg: xc/programs/xedit/ispell.c,v 1.3 2004/05/30 22:44:00 gisburn Exp $ */ /* $XFree86: xc/programs/xedit/ispell.c,v 1.19 2002/10/19 20:04:20 herrb Exp $ */ #include "xedit.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #define RECEIVE 1 #define SEND 2 @@ -808,41 +808,41 @@ /* this function is static, so I can do it */ *strchr(++buf, ';') = '\0'; len = strlen(buf); if (len == 0) return ('&'); if (len > 1) { if (strcasecmp(&buf[1], "lt") == 0) ch = '<'; else if (strcasecmp(&buf[1], "gt") == 0) ch = '>'; else if (strcasecmp(&buf[1], "nbsp") == 0) ch = ' '; else if (strcasecmp(&buf[1], "amp") == 0) ch = '&'; else if (strcasecmp(&buf[1], "quot") == 0) ch = '"'; else if (*buf == '#') { char *tmp; - if (len == 1); + if (len == 1) return ('?'); ch = strtol(&buf[1], &tmp, 10); if (*tmp) fprintf(stderr, "Warning: bad html interpreting '&#' mark.\n"); } else if (strcmp(&buf[1], "acute") == 0) { switch (*buf) { case 'a': ch = 'á'; break; case 'e': ch = 'é'; break; case 'i': ch = 'í'; break; case 'o': ch = 'ó'; break; case 'u': ch = 'ú'; break; case 'A': ch = 'Á'; break; case 'E': ch = 'É'; break; case 'I': ch = 'Í'; break; case 'O': ch = 'Ó'; break; case 'U': ch = 'Ú'; break; } } else if (strcmp(&buf[1], "grave") == 0) { @@ -921,44 +921,41 @@ /* skip non word characters */ pos = position = ispell.right; nl = False; while (1) { Bool done = False; char mb[sizeof(wchar_t)]; retry_html_space: position = XawTextSourceRead(ispell.source, position, &block, BUFSIZ); if (block.length == 0) { /* end of file */ ispell.stat = 0; ispell.lock = True; XawTextSetInsertionPoint(ispell.ascii, ispell.right); XawTextUnsetSelection(ispell.ascii); IspellSetSensitive(False); IspellSetStatus(ispell.eof_label); return (-1); } for (i = 0; i < block.length; i++) { - if (international) - wctomb(mb, ((wchar_t*)block.ptr)[i]); - else - *mb = block.ptr[i]; + wctomb(mb, ((wchar_t*)block.ptr)[i]); if (amplen) { if (amplen + 2 >= sizeof(ampbuf)) { if (!ispell.terse_mode) fprintf(stderr, "Warning: error interpreting '&' mark.\n"); amplen = 0; position = pos + 1; goto retry_html_space; } else if ((ampbuf[amplen++] = *mb) == ';') { int ch; ampbuf[amplen] = '\0'; ch = IspellConvertHtmlAmp(ampbuf); amplen = 0; if (isalpha(ch) || (ch && strchr(ispell.wchars, ch))) { /* interpret it again */ ispell.right = pos; i = 0; done = True; @@ -1022,44 +1019,41 @@ /* read a word */ position = ispell.left = ispell.right; while (1) { Bool done = False; char mb[sizeof(wchar_t)]; retry_html_word: position = XawTextSourceRead(ispell.source, position, &block, BUFSIZ); if (block.length == 0 && len == 1) { /* end of file */ ispell.stat = 0; ispell.lock = True; XawTextSetInsertionPoint(ispell.ascii, ispell.right); XawTextUnsetSelection(ispell.ascii); IspellSetSensitive(False); IspellSetStatus(ispell.eof_label); return (-1); } for (i = 0; i < block.length; i++) { - if (international) - wctomb(mb, ((wchar_t*)block.ptr)[i]); - else - *mb = block.ptr[i]; + wctomb(mb, ((wchar_t*)block.ptr)[i]); if (amplen) { if (amplen + 2 >= sizeof(ampbuf)) { if (!ispell.terse_mode) fprintf(stderr, "Warning: error interpreting '&' mark.\n"); amplen = 0; position = pos + 1; if (strchr(ispell.wchars, '&')) { if (len + 1 >= sizeof(ispell.sendbuf) - 1) { done = True; fprintf(stderr, "Warning: word is too large!\n"); break; } ispell.sendbuf[len++] = '&'; goto retry_html_word; } else { ispell.right = position; i = 0; done = True; break; @@ -1549,52 +1543,46 @@ ispell.right += replace.length - search.length; IspellCheckUndo(); ispell.undo_head->undo_str = NULL; ispell.undo_head->undo_pos = pos; ispell.undo_head->undo_count = 1; if (ispell.repeat) { ispell.undo_head->repeat = 2; /* To recognize later it was replaced */ ispell.undo_head->undo_count = ispell.right; ispell.undo_head->undo_str = XtNewString(search.ptr); } if (client_data && !ispell.repeat) { XawTextDisableRedisplay(ispell.ascii); pos = ispell.right; while ((pos = XawTextSourceSearch(ispell.source, pos, XawsdRight, &search)) != XawTextSearchError) { Bool do_replace = True; char mb[sizeof(wchar_t)]; if (XawTextSourceRead(ispell.source, pos - 1, &check, 1) > 0) { - if (international) - wctomb(mb, *(wchar_t*)check.ptr); - else - *mb = *check.ptr; + wctomb(mb, *(wchar_t*)check.ptr); do_replace = !isalpha(*mb) && *mb && !strchr(ispell.wchars, *mb); } if (do_replace && XawTextSourceRead(ispell.source, pos + search.length, &check, 1) > 0) { - if (international) - wctomb(mb, *(wchar_t*)check.ptr); - else - *mb = *check.ptr; + wctomb(mb, *(wchar_t*)check.ptr); do_replace = !isalpha(*mb) && *mb && !strchr(ispell.wchars, *mb); } if (do_replace) { XawTextReplace(ispell.ascii, pos, pos + search.length, &replace); ++ispell.undo_head->undo_count; } pos += search.length; } XawTextEnableRedisplay(ispell.ascii); } (void)IspellReplacedWord(search.ptr, replace.ptr); strncpy(&ispell.sentbuf[1], replace.ptr, sizeof(ispell.sentbuf) - 2); ispell.sentbuf[sizeof(ispell.sentbuf) - 1] = '\0'; } else Feep(); if (ispell.repeat) ispell.right = ispell.left = XawTextGetInsertionPoint(ispell.ascii); Index: xc/programs/xedit/util.c =================================================================== RCS file: /cvs/xorg/xc/programs/xedit/util.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 util.c --- xc/programs/xedit/util.c 23 Apr 2004 19:54:43 -0000 1.2 +++ xc/programs/xedit/util.c 2 Sep 2004 05:21:43 -0000 @@ -66,40 +66,42 @@ XawTextBlock text; XawTextPosition pos = XawTextSourceScan(XawTextGetSource(messwidget), 0, XawstAll, XawsdRight, 1, True); text.length = strlen(str); text.ptr = str; text.firstPos = 0; text.format = FMT8BIT; XawTextReplace(messwidget, pos, pos, &text); XawTextSetInsertionPoint(messwidget, pos + text.length); } Widget MakeCommandButton(Widget box, char *name, XtCallbackProc function) { Widget w = XtCreateManagedWidget(name, commandWidgetClass, box, NULL, ZERO); if (function != NULL) XtAddCallback(w, XtNcallback, function, (caddr_t) NULL); + else + XtVaSetValues(w, XtNsensitive, False, NULL); return w; } Widget MakeStringBox(Widget parent, String name, String string) { Arg args[5]; Cardinal numargs = 0; Widget StringW; XtSetArg(args[numargs], XtNeditType, XawtextEdit); numargs++; XtSetArg(args[numargs], XtNstring, string); numargs++; StringW = XtCreateManagedWidget(name, asciiTextWidgetClass, parent, args, numargs); return(StringW); } /* Function Name: GetString * Description: retrieves the string from a asciiText widget. Index: xc/programs/xedit/xedit.c =================================================================== RCS file: /cvs/xorg/xc/programs/xedit/xedit.c,v retrieving revision 1.4 diff -u -2 -0 -r1.4 xedit.c --- xc/programs/xedit/xedit.c 16 Aug 2004 16:36:15 -0000 1.4 +++ xc/programs/xedit/xedit.c 2 Sep 2004 05:21:43 -0000 @@ -24,118 +24,125 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ /* $XFree86: xc/programs/xedit/xedit.c,v 1.17 2002/09/22 07:09:05 paulo Exp $ */ #include #include "xedit.h" #include #include #include #include #include #define randomize() srand((unsigned)time((time_t*)NULL)) static XtActionsRec actions[] = { {"quit", QuitAction}, {"save-file", SaveFile}, {"load-file", LoadFile}, +#ifdef BUILD_PRINTSUPPORT +{"print-file", PrintFile}, +#endif /* BUILD_PRINTSUPPORT */ {"find-file", FindFile}, {"cancel-find-file", CancelFindFile}, {"file-completion", FileCompletion}, {"popup-menu", PopupMenu}, {"kill-file", KillFile}, {"split-window", SplitWindow}, {"dir-window", DirWindow}, {"delete-window", DeleteWindow}, {"xedit-focus", XeditFocus}, {"other-window", OtherWindow}, {"switch-source", SwitchSource}, #ifndef __UNIXOS2__ {"lisp-eval", XeditLispEval}, {"xedit-print-lisp-eval", XeditPrintLispEval}, {"xedit-keyboard-reset",XeditKeyboardReset}, #endif {"ispell", IspellAction}, {"line-edit", LineEditAction} }; #define DEF_HINT_INTERVAL 300 /* in seconds, 5 minutes */ static Atom wm_delete_window; static Widget hintswindow; static int position_format_mask; static XawTextPositionInfo infos[3]; Widget topwindow, textwindow, messwidget, labelwindow, filenamewindow; Widget scratch, hpane, vpanes[2], labels[3], texts[3], forms[3], positions[3]; Widget options_popup, dirlabel, dirwindow; -Boolean international; Boolean line_edit; XawTextWrapMode wrapmodes[3]; extern void ResetSourceChanged(xedit_flist_item*); static void makeButtonsAndBoxes(Widget); static void HintsTimer(XtPointer, XtIntervalId*); static void PositionChanged(Widget, XtPointer, XtPointer); static void StartFormatPosition(void); static void StartHints(void); Display *CurDpy; struct _app_resources app_resources; struct _xedit_flist flist; #define Offset(field) XtOffsetOf(struct _app_resources, field) static XtResource resources[] = { {"enableBackups", "EnableBackups", XtRBoolean, sizeof(Boolean), Offset(enableBackups), XtRImmediate, FALSE}, {"backupNamePrefix", "BackupNamePrefix", XtRString, sizeof(char *), Offset(backupNamePrefix),XtRString, ""}, {"backupNameSuffix", "BackupNameSuffix", XtRString, sizeof(char *), Offset(backupNameSuffix),XtRString, ".BAK"}, {"hints", "Hint", XtRString, sizeof(char *), Offset(hints.resource), XtRImmediate, NULL}, {"hintsInterval", XtCInterval, XtRInt, sizeof(long), Offset(hints.interval), XtRImmediate, (XtPointer)DEF_HINT_INTERVAL}, {"changedBitmap", XtRBitmap, XtRString, sizeof(char*), Offset(changed_pixmap_name), XtRString, "dot"}, {"positionFormat", "Format", XtRString, sizeof(char*), Offset(position_format), XtRString, "L%l"}, {"autoReplace", "Replace", XtRString, sizeof(char*), Offset(auto_replace), XtRImmediate, NULL}, }; #undef Offset +String fallback_resources[] = { + "*international: True", /* set this globally for ALL widgets to avoid wiered crashes */ + NULL +}; + int main(int argc, char *argv[]) { XtAppContext appcon; unsigned num_loaded = 0; XtSetLanguageProc(NULL, NULL, NULL); - topwindow = XtAppInitialize(&appcon, "Xedit", NULL, 0, &argc, argv, NULL, NULL, 0); + topwindow = XtAppInitialize(&appcon, "Xedit", NULL, 0, &argc, argv, fallback_resources, NULL, 0); XtAppAddActions(appcon, actions, XtNumber(actions)); XtOverrideTranslations (topwindow, XtParseTranslationTable ("WM_PROTOCOLS: quit()")); XtGetApplicationResources(topwindow, (XtPointer) &app_resources, resources, XtNumber(resources), NULL, 0); CurDpy = XtDisplay(topwindow); XawSimpleMenuAddGlobalActions(appcon); XtRegisterGrabAction(PopupMenu, True, ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync); makeButtonsAndBoxes(topwindow); StartHints(); StartFormatPosition(); (void)StartHooks(appcon); if (position_format_mask == 0) { @@ -223,102 +230,102 @@ XmuSnprintf(buf, sizeof(buf), "File %s opened READ ONLY.\n", argv[i]); break; case WRITE_OK: XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++; XmuSnprintf(buf, sizeof(buf), "File %s opened read - write.\n", argv[i]); break; } if (file_access != NO_READ) { int flags; if (exists) { flags = EXISTS_BIT; XtSetArg(args[num_args], XtNstring, filename);num_args++; } else { flags = 0; XtSetArg(args[num_args], XtNstring, NULL); num_args++; } - source = XtVaCreateWidget("textSource", international ? - multiSrcObjectClass - : asciiSrcObjectClass, topwindow, + source = XtVaCreateWidget("textSource", + multiSrcObjectClass, topwindow, XtNtype, XawAsciiFile, XtNeditType, XawtextEdit, NULL, NULL); XtSetValues(source, args, num_args); item = AddTextSource(source, argv[i], filename, flags, file_access); XtAddCallback(item->source, XtNcallback, SourceChanged, (XtPointer)item); if (exists && file_access == WRITE_OK) item->mode = st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); if (!num_loaded) SwitchTextSource(item); ++num_loaded; ResetSourceChanged(item); } XeditPrintf(buf); } } if (!flist.pixmap && strlen(app_resources.changed_pixmap_name)) { XrmValue from, to; from.size = strlen(app_resources.changed_pixmap_name); from.addr = app_resources.changed_pixmap_name; to.size = sizeof(Pixmap); to.addr = (XtPointer)&(flist.pixmap); XtConvertAndStore(flist.popup, XtRString, &from, XtRBitmap, &to); } if (num_loaded == 0) { XtSetKeyboardFocus(topwindow, filenamewindow); XtVaSetValues(textwindow, XtNwrap, XawtextWrapLine, NULL); } else XtSetKeyboardFocus(topwindow, textwindow); XtAppMainLoop(appcon); - exit(0); + return EXIT_SUCCESS; } static void makeButtonsAndBoxes(Widget parent) { Widget outer, b_row, viewport; Arg arglist[10]; Cardinal num_args; xedit_flist_item *item; static char *labelWindow = "labelWindow", *editWindow = "editWindow"; static char *formWindow = "formWindow", *positionWindow = "positionWindow"; outer = XtCreateManagedWidget("paned", panedWidgetClass, parent, NULL, ZERO); b_row = XtCreateManagedWidget("buttons", panedWidgetClass, outer, NULL, ZERO); { MakeCommandButton(b_row, "quit", DoQuit); MakeCommandButton(b_row, "save", DoSave); MakeCommandButton(b_row, "load", DoLoad); + MakeCommandButton(b_row, "print", DoPrint); filenamewindow = MakeStringBox(b_row, "filename", NULL); } hintswindow = XtCreateManagedWidget("bc_label", labelWidgetClass, outer, NULL, ZERO); num_args = 0; XtSetArg(arglist[num_args], XtNeditType, XawtextEdit); ++num_args; messwidget = XtCreateManagedWidget("messageWindow", asciiTextWidgetClass, outer, arglist, num_args); num_args = 0; XtSetArg(arglist[num_args], XtNorientation, XtorientHorizontal); ++num_args; hpane = XtCreateManagedWidget("hpane", panedWidgetClass, outer, arglist, num_args); num_args = 0; XtSetArg(arglist[num_args], XtNorientation, XtorientVertical); ++num_args; vpanes[0] = XtCreateManagedWidget("vpane", panedWidgetClass, hpane, arglist, num_args); XtSetArg(arglist[num_args], XtNheight, 1); ++num_args; @@ -330,49 +337,44 @@ vpanes[0], NULL, 0); labelwindow = XtCreateManagedWidget(labelWindow,labelWidgetClass, forms[0], NULL, 0); labels[0] = labelwindow; positions[0] = XtCreateManagedWidget(positionWindow,labelWidgetClass, forms[0], NULL, 0); forms[2] = XtCreateWidget(formWindow, formWidgetClass, vpanes[1], NULL, 0); labels[2] = XtCreateManagedWidget(labelWindow,labelWidgetClass, forms[2], NULL, 0); positions[2] = XtCreateManagedWidget(positionWindow,labelWidgetClass, forms[2], NULL, 0); num_args = 0; XtSetArg(arglist[num_args], XtNtype, XawAsciiFile); ++num_args; XtSetArg(arglist[num_args], XtNeditType, XawtextEdit); ++num_args; textwindow = XtCreateManagedWidget(editWindow, asciiTextWidgetClass, vpanes[0], arglist, num_args); num_args = 0; - XtSetArg(arglist[num_args], XtNinternational, &international); ++num_args; - XtGetValues(textwindow, arglist, num_args); - - num_args = 0; XtSetArg(arglist[num_args], XtNtype, XawAsciiFile); ++num_args; XtSetArg(arglist[num_args], XtNeditType, XawtextEdit); ++num_args; - scratch = XtVaCreateWidget("textSource", international ? - multiSrcObjectClass - : asciiSrcObjectClass, topwindow, + scratch = XtVaCreateWidget("textSource", + multiSrcObjectClass, topwindow, XtNtype, XawAsciiFile, XtNeditType, XawtextEdit, NULL, NULL); XtSetValues(scratch, arglist, num_args); num_args = 0; XtSetArg(arglist[num_args], XtNtextSource, scratch); ++num_args; XtSetValues(textwindow, arglist, num_args); texts[0] = textwindow; num_args = 0; XtSetArg(arglist[num_args], XtNtextSource, scratch); ++num_args; XtSetArg(arglist[num_args], XtNdisplayCaret, False); ++num_args; texts[2] = XtCreateWidget(editWindow, asciiTextWidgetClass, vpanes[1], arglist, num_args); forms[1] = XtCreateWidget(formWindow, formWidgetClass, vpanes[0], NULL, 0); labels[1] = XtCreateManagedWidget(labelWindow,labelWidgetClass, forms[1], NULL, 0); Index: xc/programs/xedit/xedit.h =================================================================== RCS file: /cvs/xorg/xc/programs/xedit/xedit.h,v retrieving revision 1.4 diff -u -2 -0 -r1.4 xedit.h --- xc/programs/xedit/xedit.h 16 Aug 2004 16:36:15 -0000 1.4 +++ xc/programs/xedit/xedit.h 2 Sep 2004 05:21:43 -0000 @@ -83,75 +83,82 @@ Pixmap pixmap; xedit_flist_item **itens; xedit_flist_item *current, *other; Cardinal num_itens; } flist; extern Widget options_popup; extern struct _app_resources { Boolean enableBackups; char *backupNamePrefix; char *backupNameSuffix; xedit_hints hints; char *changed_pixmap_name; char *position_format; char *auto_replace; } app_resources; extern Widget topwindow, textwindow, labelwindow, filenamewindow, messwidget; extern Widget dirlabel, dirwindow; -extern Boolean international; extern Boolean line_edit; /* externals in xedit.c */ void Feep(void); /* externals in util.c */ void XeditPrintf(char*); Widget MakeCommandButton(Widget, char*, XtCallbackProc); Widget MakeStringBox(Widget, String, String); String GetString(Widget); FileAccess MaybeCreateFile(char*), CheckFilePermissions(char*, Boolean*); xedit_flist_item *AddTextSource(Widget, String, String, int, FileAccess); xedit_flist_item *FindTextSource(Widget, char*); Bool KillTextSource(xedit_flist_item*); char *ResolveName(char*); void DeleteWindow(Widget, XEvent*, String*, Cardinal*); void SplitWindow(Widget, XEvent*, String*, Cardinal*); void SwitchTextSource(xedit_flist_item*); void PopupMenu(Widget, XEvent*, String*, Cardinal*); void OtherWindow(Widget, XEvent*, String*, Cardinal*); void SwitchSource(Widget, XEvent*, String*, Cardinal*); void XeditFocus(Widget, XEvent*, String*, Cardinal*); void SwitchDirWindow(Bool); void DirWindow(Widget, XEvent*, String*, Cardinal*); /* externs in commands.c */ void DoQuit(Widget, XtPointer, XtPointer); void QuitAction(Widget, XEvent*, String*, Cardinal*); void DoSave(Widget, XtPointer, XtPointer); void SaveFile(Widget, XEvent*, String*, Cardinal*); void DoLoad(Widget, XtPointer, XtPointer); +#ifdef BUILD_PRINTSUPPORT +void DoPrint(Widget, XtPointer, XtPointer); +#else +#define DoPrint NULL +#endif /* BUILD_PRINTSUPPORT */ void CancelFindFile(Widget, XEvent*, String*, Cardinal*); void FindFile(Widget, XEvent*, String*, Cardinal*); void LoadFile(Widget, XEvent*, String*, Cardinal*); +#ifdef BUILD_PRINTSUPPORT +void PrintFile(Widget, XEvent*, String*, Cardinal*); +#endif /* BUILD_PRINTSUPPORT */ void FileCompletion(Widget, XEvent*, String*, Cardinal*); void KillFile(Widget, XEvent*, String*, Cardinal*); void DirWindowCB(Widget, XtPointer, XtPointer); void SourceChanged(Widget, XtPointer, XtPointer); /* externs in ispell.c */ void IspellAction(Widget, XEvent*, String*, Cardinal*); void IspellCallback(Widget, XtPointer, XtPointer); /* externs in options.c */ void CreateEditPopup(void); void SetEditMenu(void); void UpdateTextProperties(int); /* externs in hook.c */ Bool StartHooks(XtAppContext); void LineEditAction(Widget, XEvent*, String*, Cardinal*); void LineEdit(Widget); /* externs in lisp.c */ Index: xc/programs/xedit/lisp/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/xedit/lisp/Imakefile,v retrieving revision 1.4 diff -u -2 -0 -r1.4 Imakefile --- xc/programs/xedit/lisp/Imakefile 16 Aug 2004 16:36:15 -0000 1.4 +++ xc/programs/xedit/lisp/Imakefile 2 Sep 2004 05:21:43 -0000 @@ -6,49 +6,49 @@ #define DoNormalLib YES #define DoSharedLib NO #define DoExtraLib NO #define DoDebugLib NO #define DoProfileLib NO #define LibName lisp #define LibInstall NO #define LibHeaders NO #if !HasSnprintf #ifndef UseInstalled LinkSourceFile(snprintf.c, $(LIBSRC)/misc) #endif SNPRINTF_SRCS = snprintf.c SNPRINTF_OBJS = snprintf.o #endif #if defined(LynxOSArchitecture) || defined(SVR3Architecture) || defined(LinuxArchitecture) #ifndef UseInstalled LinkSourceFile(realpath.c, $(TOP)/programs/xedit) -#endif +#endif /* !UseInstalled */ RP_SRCS = realpath.c RP_OBJS = realpath.o RP_DEFINES = -DNEED_REALPATH #endif #if !HasStrcasecmp #ifndef UseInstalled LinkSourceFile(strcasecmp.c, $(TOP)/programs/xedit) -#endif +#endif /* !UseInstalled */ STRCCMP_SRCS = strcasecmp.c STRCCMP_OBJS = strcasecmp.o STRCCMP_DEFINES = -DNEED_STRCASECMP #endif #if !HasSetenv SETENV_SRCS = env.c SETENV_OBJS = env.o SETENV_DEFINES = -DNEED_SETENV #endif SYS_SRCS = $(RP_SRCS) $(STRCCMP_SRCS) $(SETENV_SRCS) $(SNPRINTF_SRCS) SYS_OBJS = $(RP_OBJS) $(STRCCMP_OBJS) $(SETENV_OBJS) $(SNPRINTF_OBJS) SYS_DEFINES = $(RP_DEFINES) $(STRCCMP_DEFINES) $(SETENV_DEFINES) #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" LIB = LibName SAMP = lsp SAMPSRC = lsp.c SAMPOBJ = lsp.o Index: xc/programs/xedit/lisp/lisp.c =================================================================== RCS file: /cvs/xorg/xc/programs/xedit/lisp/lisp.c,v retrieving revision 1.4 diff -u -2 -0 -r1.4 lisp.c --- xc/programs/xedit/lisp/lisp.c 16 Aug 2004 16:36:16 -0000 1.4 +++ xc/programs/xedit/lisp/lisp.c 2 Sep 2004 05:21:51 -0000 @@ -29,41 +29,41 @@ /* $XFree86: xc/programs/xedit/lisp/lisp.c,v 1.87tsi Exp $ */ #include #include #ifdef sun #include #endif #include #include #include #include #include #include #ifndef X_NOT_POSIX #include /* for sysconf(), and getpagesize() */ #endif #if defined(linux) -#include /* for PAGE_SIZE */ +#include /* for PAGE_SIZE */ #define HAS_GETPAGESIZE #define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */ #endif #if defined(CSRG_BASED) #define HAS_GETPAGESIZE #endif #if defined(sun) #define HAS_GETPAGESIZE #endif #if defined(QNX4) #define HAS_GETPAGESIZE #endif #if defined(__QNXNTO__) #define HAS_SC_PAGESIZE #endif Index: xc/programs/xman/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/xman/Imakefile,v retrieving revision 1.5 diff -u -2 -0 -r1.5 Imakefile --- xc/programs/xman/Imakefile 16 Aug 2004 16:36:26 -0000 1.5 +++ xc/programs/xman/Imakefile 2 Sep 2004 05:22:10 -0000 @@ -1,23 +1,27 @@ XCOMM $XConsortium: Imakefile,v 1.22 91/09/09 16:02:18 rws Exp $ XCOMM $XFree86: xc/programs/xman/Imakefile,v 1.9 2003/05/27 20:15:08 tsi Exp $ +#if BuildXprintLib && BuildXprintClients && BuildXaw +# define XmanUseXprint YES +#endif /* BuildXprintLib && BuildXprintClients && BuildXaw */ + #ifdef XmanSearchPath XMANSYSPATH = XmanSearchPath SYSMANPATH = -DSYSMANPATH=\"$(XMANSYSPATH)\" #endif #ifdef XmanLocalSearchPath XMANLOCALPATH = XmanLocalSearchPath LOCALMANPATH = -DLOCALMANPATH=\"$(XMANLOCALPATH)\" #endif MANPATHS = $(SYSMANPATH) $(LOCALMANPATH) HELPFILE = -DHELPFILE=\"$(LIBDIR)$(PATHSEP)xman.help\" #if HasMkstemp MKSTEMP = -DHAS_MKSTEMP #endif XCOMM select internal format of manpath configuration file #if defined(FreeBSDArchitecture) || \ (defined(LinuxDistribution) && (LinuxDistribution == LinuxDebian)) || \ (defined(DarwinArchitecture) && (OSMajorVersion >= 6)) MANCONFIGSTYLE = -DMANCONFIGSTYLE_FreeBSD MANCONF = -DMANCONF=\"/etc/manpath.config\" @@ -30,37 +34,53 @@ # endif #elif defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) || \ defined(DarwinArchitecture) MANCONFIGSTYLE = -DMANCONFIGSTYLE_OpenBSD MANCONF = -DMANCONF=\"/etc/man.conf\" #elif defined(BSDArchitecture) MANCONFIGSTYLE = -DMANCONFIGSTYLE_BSD MANCONF = -DMANCONF=\"/etc/man.conf\" #endif #if HasGroff GROFF = -DHAS_GROFF #endif #if HasSnprintf SNPDEFINES = -DHAS_SNPRINTF #else SNPDEFINES = -Dsnprintf=XmuSnprintf #endif +#ifdef XmanUseXprint + PRINT_LIBS = -lXprintUtil $(XPLIB) + PRINT_DEFS = -DBUILD_PRINTSUPPORT + PRINT_SRCS = printdialog.c print.c + PRINT_OBJS = printdialog.o print.o +#endif /* XmanUseXprint */ + + OSMAJORVERSION = OSMajorVersion OSMINORVERSION = OSMinorVersion DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) \ -DOSMINORVERSION=$(OSMINORVERSION) \ $(SNPDEFINES) $(HELPFILE) $(MANPATHS) $(MKSTEMP) $(GROFF) \ - $(MANCONFIGSTYLE) $(MANCONF) + $(PRINT_DEFS) $(MANCONFIGSTYLE) $(MANCONF) DEPLIBS = XawClientDepLibs -LOCAL_LIBRARIES = XawClientLibs +LOCAL_LIBRARIES = $(PRINT_LIBS) XawClientLibs SRCS = ScrollByL.c handler.c man.c buttons.c help.c \ - search.c globals.c main.c misc.c tkfuncs.c vendor.c + $(PRINT_SRCS) search.c globals.c main.c \ + misc.c tkfuncs.c vendor.c OBJS = ScrollByL.o handler.o man.o buttons.o help.o \ - search.o globals.o main.o misc.o tkfuncs.o vendor.o + $(PRINT_OBJS) search.o globals.o main.o \ + misc.o tkfuncs.o vendor.o + +#ifdef XmanUseXprint +LinkSourceFile(printdialog.c,../xmore) +LinkSourceFile(printdialog.h,../xmore) +LinkSourceFile(printdialogprivates.h,../xmore) +#endif /* XmanUseXprint */ ComplexProgramTarget(xman) InstallNonExecFile(xman.help,$(LIBDIR)) InstallAppDefaults(Xman) Index: xc/programs/xman/ScrollByL.c =================================================================== RCS file: /cvs/xorg/xc/programs/xman/ScrollByL.c,v retrieving revision 1.4 diff -u -2 -0 -r1.4 ScrollByL.c --- xc/programs/xman/ScrollByL.c 16 Aug 2004 16:36:26 -0000 1.4 +++ xc/programs/xman/ScrollByL.c 2 Sep 2004 05:22:10 -0000 @@ -76,51 +76,56 @@ CoreOffset(height), XtRImmediate, (caddr_t) 700}, {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), Offset(foreground), XtRString, "XtDefaultForeground"}, {XtNforceVert, XtCBoolean, XtRBoolean, sizeof(Boolean), Offset(force_vert), XtRImmediate, (caddr_t) FALSE}, {XtNindent, XtCIndent, XtRDimension, sizeof(Dimension), Offset(indent), XtRImmediate, (caddr_t) 15}, {XtNuseRight, XtCBoolean, XtRBoolean, sizeof(Boolean), Offset(use_right), XtRImmediate, (caddr_t) FALSE}, {XtNmanualFontNormal, XtCFont, XtRFontStruct, sizeof(XFontStruct *), Offset(normal_font), XtRString, MANPAGE_NORMAL}, {XtNmanualFontBold, XtCFont, XtRFontStruct, sizeof(XFontStruct *), Offset(bold_font), XtRString, MANPAGE_BOLD}, {XtNmanualFontItalic, XtCFont, XtRFontStruct, sizeof(XFontStruct *), Offset(italic_font), XtRString, MANPAGE_ITALIC}, {XtNmanualFontSymbol, XtCFont, XtRFontStruct, sizeof(XFontStruct *), Offset(symbol_font), XtRString, MANPAGE_SYMBOL}, {XtNfile, XtCFile, XtRFile, sizeof(FILE *), Offset(file), XtRImmediate, (caddr_t) NULL}, + {XtNNumTotalLines, XtCNumTotalLines, XtRInt, sizeof(int), + Offset(lines), XtRImmediate, (caddr_t) 0}, + {XtNNumVisibleLines, XtCNumVisibleLines, XtRInt, sizeof(int), + Offset(num_visible_lines), XtRImmediate, (caddr_t) 0}, }; #undef Offset #undef CoreOffset /**************************************************************** * * Full class record constant * ****************************************************************/ +static void CreateScrollbar(Widget w); static Boolean ScrollVerticalText(Widget w, int new_line, Boolean force_redisp); static void Layout(Widget w); static void LoadFile(Widget w); static void MoveAndClearText(Widget w, int old_y, int height, int new_y); static void PaintText(Widget w, int y_loc, int height); static void PrintText(Widget w, int start_line, int num_lines, int location); static void SetThumbHeight(Widget w); static void VerticalJump(Widget w, XtPointer junk, XtPointer percent_ptr); static void VerticalScroll(Widget w, XtPointer client_data, XtPointer call_data); /* semi - public functions. */ static void Realize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes); static void Initialize(Widget req, Widget new, ArgList args, Cardinal *num_args); static void Destroy(Widget w); static void Redisplay(Widget w, XEvent *event, Region region); static void Page(Widget w, XEvent * event, String * params, Cardinal *num_params); static Boolean SetValuesHook(Widget w, ArgList args, Cardinal *num_args); static XtActionsRec actions[] = { @@ -180,65 +185,69 @@ * Private Routines * ****************************************************************/ /* Function Name: Layout * Description: This function lays out the scroll widget. * Arguments: w - the scroll widget. * key - a boolean: if true then resize the widget to the child * if false the resize children to fit widget. * Returns: TRUE if successful. */ static void Layout(Widget w) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; Dimension width, height; Widget bar; Position bar_bw; + CreateScrollbar(w); + /* * For now always show the bar. */ bar = sblw->scroll.bar; height = sblw->core.height; width = sblw->core.width; bar_bw = bar->core.border_width; /* Move child and v_bar to correct location. */ if (sblw->scroll.use_right) { XtMoveWidget(bar, width - (bar->core.width + bar_bw), - bar_bw); sblw->scroll.offset = 0; } else { XtMoveWidget(bar, - bar_bw, - bar_bw); sblw->scroll.offset = bar->core.width + bar_bw; } /* resize the scrollbar to be the correct height or width. */ XtResizeWidget(bar, bar->core.width, height, bar->core.border_width); SetThumbHeight(w); + + sblw->scroll.num_visible_lines = height / sblw->scroll.font_height + 1; } /* ARGSUSED */ static void GExpose(Widget w, XtPointer junk, XEvent *event, Boolean *cont) { /* * Graphics exposure events are not currently sent to exposure proc. */ if (event->type == GraphicsExpose) Redisplay(w, event, NULL); } /* ChildExpose */ /* * Repaint the widget's child Window Widget. */ @@ -260,56 +269,54 @@ } else { top = event->xgraphicsexpose.y; height = event->xgraphicsexpose.height; } PaintText(w, top, height); } /* redisplay (expose) */ /* Function Name: PaintText * Description: paints the text at the give location for a given height. * Arguments: w - the sbl widget. * y_loc, height - location and size of area to paint. * Returns: none */ static void PaintText(Widget w, int y_loc, int height) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; - int start_line, num_lines, location; + int start_line, location; start_line = y_loc / sblw->scroll.font_height + sblw->scroll.line_pointer; if (start_line >= sblw->scroll.lines) return; - num_lines = height / sblw->scroll.font_height + 1; - /* * Only integer arithmetic makes this possible. */ location = y_loc / sblw->scroll.font_height * sblw->scroll.font_height; - PrintText(w, start_line, num_lines, location); + PrintText(w, start_line, sblw->scroll.num_visible_lines, location); } /* Function Name: Page * Description: This function pages the widget, by the amount it recieves * from the translation Manager. * Arguments: w - the ScrollByLineWidget. * event - the event that caused this return. * params - the parameters passed to it. * num_params - the number of parameters. * Returns: none. */ /* ARGSUSED */ static void Page(Widget w, XEvent * event, String * params, Cardinal *num_params) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; Widget bar = sblw->scroll.bar; if (*num_params < 1) @@ -367,41 +374,41 @@ XtAddCallback(sblw->scroll.bar, XtNscrollProc, VerticalScroll, NULL); XtAddCallback(sblw->scroll.bar, XtNjumpProc, VerticalJump, NULL); } /* Function Name: ScrollVerticalText * Description: This accomplished the actual movement of the text. * Arguments: w - the ScrollByLine Widget. * new_line - the new location for the line pointer * force_redisplay - should we force this window to get * redisplayed? * Returns: True if the thumb needs to be moved. */ static Boolean ScrollVerticalText( Widget w, int new_line, Boolean force_redisp) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; - int num_lines = (int)w->core.height / sblw->scroll.font_height + 1; + int num_lines = sblw->scroll.num_visible_lines; int max_lines, old_line; Boolean move_thumb = FALSE; /* * Do not let the window extend out of bounds. */ if ( new_line < 0) { new_line = 0; move_thumb = TRUE; } else { max_lines = sblw->scroll.lines - (int)w->core.height / sblw->scroll.font_height; AssignMax(max_lines, 0); if ( new_line > max_lines ) { new_line = max_lines; move_thumb = TRUE; } } @@ -581,67 +588,62 @@ * as the vertical scroll bar is moved. * Arguments: w - the scrollbar widget. * junk - not used. * pos - the position of the cursor. * Returns: none. */ /* ARGSUSED */ static void VerticalScroll(Widget w, XtPointer client_data, XtPointer call_data) { int pos = (int)(long) call_data; int new_line; /* The new location for the line pointer. */ ScrollByLineWidget sblw = (ScrollByLineWidget) XtParent(w); new_line = sblw->scroll.line_pointer + (pos / sblw->scroll.font_height); (void) ScrollVerticalText( (Widget) sblw, new_line, FALSE); SetThumb( (Widget) sblw); } -int h_width; /* main font width */ - /* ARGSUSED */ static void Initialize(Widget req, Widget new, ArgList args, Cardinal *num_args) { ScrollByLineWidget sblw = (ScrollByLineWidget) new; unsigned long figWidth; Atom atomNum; sblw->scroll.top_line = NULL; sblw->scroll.line_pointer = 0; LoadFile(new); sblw->scroll.bar = (Widget) NULL; sblw->scroll.font_height = (sblw->scroll.normal_font->max_bounds.ascent + sblw->scroll.normal_font->max_bounds.descent); atomNum = XInternAtom(XtDisplay(req), "FIGURE_WIDTH", False); if (XGetFontProperty(sblw->scroll.normal_font, atomNum, &figWidth)) - h_width = figWidth; + sblw->scroll.h_width = figWidth; else - h_width = XTextWidth(sblw->scroll.normal_font, "$", 1); - - - + sblw->scroll.h_width = XTextWidth(sblw->scroll.normal_font, "$", 1); } /* Initialize. */ /* Function Name: CreateGCs * Description: Creates the graphics contexts that we need. * Arguments: w - the sblw. * Returns: none */ static void CreateGCs(Widget w) { ScrollByLineWidget sblw = (ScrollByLineWidget) w; XtGCMask mask; XGCValues values; values.graphics_exposures = TRUE; sblw->scroll.move_gc = XtGetGC(w, GCGraphicsExposures, &values); mask = GCForeground | GCFont; @@ -704,41 +706,41 @@ ScrollByLineWidget sblw = (ScrollByLineWidget) w; if (sblw->scroll.bar != NULL) XtDestroyWidget(sblw->scroll.bar); /* Destroy scrollbar. */ if (sblw->scroll.file != NULL) fclose(sblw->scroll.file); DestroyGCs(w); } /* * * Set Values * */ /* ARGSUSED */ static Boolean SetValuesHook(Widget w, ArgList args, Cardinal *num_args) { Boolean ret = TRUE; - int i; + Cardinal i; for (i = 0; i < *num_args; i++) { if (strcmp(XtNfile, args[i].name) == 0) { LoadFile(w); ret = TRUE; } } /* * Changing anthing else will have strange effects, I don't need it so * I didn't code it. */ return(ret); } /* Set Values */ /* * A little design philosophy is probabally wise to include at this point. * @@ -802,40 +804,41 @@ */ if (fstat(fileno(file), &fileinfo)) XtAppError(XtWidgetToApplicationContext(w), "SBLW LoadFile: Failure in fstat."); /* * Allocate a space for a list of pointer to the beginning of each line. */ if ( (nlines = fileinfo.st_size/CHAR_PER_LINE) == 0) return; page = XtMalloc(fileinfo.st_size + 1); /* leave space for the NULL */ top_line = line_pointer = (char**) XtMalloc( nlines * sizeof(char *) ); /* * Copy the file into memory. */ + fseek(file, 0L, SEEK_SET); if (fread(page, sizeof(char), fileinfo.st_size, file) == 0) XtAppError(XtWidgetToApplicationContext(w), "SBLW LoadFile: Failure in fread."); /* put NULL at end of buffer. */ *(page + fileinfo.st_size) = '\0'; /* * Go through the file setting a line pointer to the character after each * new line. If we run out of line pointer space then realloc that space * with space for more lines. */ *line_pointer++ = page; /* first line points to first char in buffer.*/ while (*page != '\0') { if ( *page == '\n' ) { *line_pointer++ = page + 1; @@ -1004,62 +1007,62 @@ italicflag = FALSE; x_loc = sblw->scroll.offset + sblw->scroll.indent; h_col = 0; y_loc += sblw->scroll.font_height; break; /* * This tab handling code is not very clever it moves the cursor over * to the next boundry of eight (8) spaces, as calculated in width just * before the printing loop started. */ case '\t': /* TAB */ x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf, WHICH(italicflag, first)); h_col += bufp - buf; bufp = buf; italicflag = FALSE; x_loc = sblw->scroll.offset + sblw->scroll.indent; h_col = h_col + 8 - (h_col%8); - x_loc += h_width * h_col; + x_loc += sblw->scroll.h_width * h_col; break; case ' ': h_c = c + 1; while (*h_c == ' ') h_c++; if (h_c - c < 4) { *bufp++ = *c; break; } x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf, WHICH(italicflag, first)); h_col += bufp - buf; bufp = buf; italicflag = FALSE; x_loc = sblw->scroll.offset + sblw->scroll.indent; h_col += (h_c - c); - x_loc += h_width * h_col; + x_loc += sblw->scroll.h_width * h_col; c = h_c - 1; break; case '\033': /* ignore esc sequences for now */ c++; /* should always be esc-x */ break; /* * Overstrike code supplied by: cs.utexas.edu!ut-emx!clyde@rutgers.edu * Since my manual pages do not have overstrike I couldn't test this. */ case BACKSPACE: /* Backspacing for nroff bolding */ if (c[-1] == c[1] && c[1] != BACKSPACE) { /* overstriking one char */ if (bufp > buf) { bufp--; /* Zap 1st instance of char to bolden */ x_loc = DumpText(w, x_loc, y_loc, buf, bufp - buf, WHICH(italicflag, FALSE)); h_col += bufp - buf; } Index: xc/programs/xman/ScrollByL.h =================================================================== RCS file: /cvs/xorg/xc/programs/xman/ScrollByL.h,v retrieving revision 1.4 diff -u -2 -0 -r1.4 ScrollByL.h --- xc/programs/xman/ScrollByL.h 16 Aug 2004 16:36:26 -0000 1.4 +++ xc/programs/xman/ScrollByL.h 2 Sep 2004 05:22:10 -0000 @@ -43,31 +43,35 @@ */ #ifdef ATHENA #define MANPAGE_NORMAL "fixed" #define MANPAGE_BOLD "helvetica-bold12" #define MANPAGE_ITALIC "helvetica-boldoblique12" #define MANPAGE_SYMBOL "symbol-medium12" #else #define MANPAGE_NORMAL "*-new century schoolbook-medium-r-normal--*-120-*" #define MANPAGE_BOLD "*-new century schoolbook-bold-r-normal--*-120-*" #define MANPAGE_ITALIC "*-new century schoolbook-bold-i-normal--*-120-*" #define MANPAGE_SYMBOL "*-symbol-medium-r-normal--*-120-*" #endif /* ATHENA */ #define XtNindent "indent" #define XtNforceVert "forceVert" #define XtNmanualFontNormal "manualFontNormal" #define XtNmanualFontBold "manualFontBold" #define XtNmanualFontItalic "manualFontItalic" #define XtNmanualFontSymbol "manualFontSymbol" +#define XtNNumTotalLines "numTotalLines" +#define XtNNumVisibleLines "numVisibleLines" #define XtCIndent "Indent" +#define XtCNumTotalLines "NumTotalLines" +#define XtCNumVisibleLines "NumVisibleLines" /* Class record constants */ extern WidgetClass scrollByLineWidgetClass; typedef struct _ScrollByLineClassRec *ScrollByLineWidgetClass; typedef struct _ScrollByLineRec *ScrollByLineWidget; #endif /* _XtScrollByLine_h --- DON'T ADD STUFF AFTER THIS LINE */ Index: xc/programs/xman/ScrollByLP.h =================================================================== RCS file: /cvs/xorg/xc/programs/xman/ScrollByLP.h,v retrieving revision 1.4 diff -u -2 -0 -r1.4 ScrollByLP.h --- xc/programs/xman/ScrollByLP.h 16 Aug 2004 16:36:26 -0000 1.4 +++ xc/programs/xman/ScrollByLP.h 2 Sep 2004 05:22:11 -0000 @@ -51,48 +51,50 @@ /* Full class record declaration */ typedef struct _ScrollByLineClassRec { CoreClassPart core_class; SimpleClassPart simple_class; ScrollByLineClassPart scrolled_widget_class; } ScrollByLineClassRec; extern ScrollByLineClassRec scrollByLineClassRec; /* New fields for the ScrollByLine widget record */ typedef struct _ScrollByLinePart { Pixel foreground; /* The color for the forground of the text. */ Boolean force_vert, /* Must have scrollbar visable */ use_right; /* put scroll bar on right side of window. */ FILE * file; /* The file to display. */ Dimension indent; /* amount to indent the file. */ XFontStruct * bold_font, /* The four fonts. */ * normal_font, * italic_font, * symbol_font; + int h_width; /* Main font width */ /* variables not in resource list. */ Widget bar; /* The scrollbar. */ int font_height; /* the height of the font. */ int line_pointer; /* The line that currently is at the top of the window being displayed. */ Dimension offset; /* Drawing offset because of scrollbar. */ GC move_gc; /* GC to use when moving the text. */ GC bold_gc, normal_gc, italic_gc, symbol_gc; /* gc for drawing. */ char ** top_line; /* The top line of the file. */ - int lines; /* number of line in the file. */ + int lines; /* Total number of line in the file. */ + int num_visible_lines; /* Number of lines visible */ } ScrollByLinePart; /**************************************************************** * * Full instance record declaration * ****************************************************************/ typedef struct _ScrollByLineRec { CorePart core; SimplePart simple; ScrollByLinePart scroll; } ScrollByLineRec; #endif /* _XtScrollByLinePrivate_h --- DON'T ADD STUFF AFTER THIS LINE */ Index: xc/programs/xman/Xman.ad =================================================================== RCS file: /cvs/xorg/xc/programs/xman/Xman.ad,v retrieving revision 1.4 diff -u -2 -0 -r1.4 Xman.ad --- xc/programs/xman/Xman.ad 16 Aug 2004 16:36:26 -0000 1.4 +++ xc/programs/xman/Xman.ad 2 Sep 2004 05:22:11 -0000 @@ -18,115 +18,121 @@ !*SimpleMenu.BackingStore: Always !*SimpleMenu.SaveUnder: Off *horizPane.orientation: horizontal *horizPane*showGrip: False *horizPane.min: 22 *horizPane.max: 22 *topLabel.BorderWidth: 0 *search*label.BorderWidth: 0 *search*dialog*value: Xman !*optionMenu.Label: Options !*sectionMenu.Label: Sections *horizPane*options.Label: Options *horizPane*sections.Label: Sections *helpButton.Label: Help +*helpButton.Tip: Open help browser *quitButton.Label: Quit +*quitButton.Tip: Quit Xman *manpageButton.Label: Manual Page +*manpageButton.Tip: Open new manpage browser *topLabel.Label: Manual Browser !*SimpleMenu*menuLabel*vertSpace: 100 !*SimpleMenu*menuLabel*leftMargin: 20 *displayDirectory.Label: Display Directory *displayManualPage.Label: Display Manual Page *help.Label: Help *help.geometry: 600x600 *search.Label: Search *removeThisManpage.Label: Remove This Manpage *help*removeThisManpage.Label: Remove Help *openNewManpage.Label: Open New Manpage +*printManualPage.Label: Print This Manpage *showVersion.Label: Show Version *quit.Label: Quit *pleaseStandBy*Label: Formatting Manual Page, Please Stand By... *search*dialog.Label: Type string to search for: *search*apropos.Label: Apropos *search*manualPage.Label: Manual Page *search*cancel.Label: Cancel *likeToSave*dialog.Label: Would you like to save this formatted Manual Page? *likeToSave*yes.Label: Yes *likeToSave*no.Label: No *translations: #override \ Ctrlq: Quit() \n\ Ctrlc: Quit() \n\ Ctrln: CreateNewManpage() \n\ Ctrlh: PopupHelp() \n\ Ctrls: PopupSearch() *help*Paned.manualPage.translations:#override \ Ctrl: \ XawPositionSimpleMenu(optionMenu) \ MenuPopup(optionMenu) \n\ Ctrlq: Quit() \n\ Ctrlc: Quit() \n\ Ctrlr: RemoveThisManpage() \n\ Ctrln: CreateNewManpage() \n\ Ctrlh: PopupHelp() \n\ Ctrld: GotoPage(Directory) \n\ Ctrlm: GotoPage(ManualPage) \n\ + Ctrlp: PrintThisManpage() \n\ Ctrlv: ShowVersion() \n\ Prior: Page(Back) \n\ Next : Page(Forward) \n\ Shift,: Page(Line,-1) \n\ Shift,: Page(Line,1) \n\ Ctrl,: Page(Back) \n\ Ctrl,: Page(Forward) \n\ None,: Page(Line,-5) \n\ None,: Page(Line,5) *manualBrowser*manualPage.translations: #override \ Ctrl: \ XawPositionSimpleMenu(optionMenu) \ MenuPopup(optionMenu) \n\ Ctrl: \ XawPositionSimpleMenu(sectionMenu) \ MenuPopup(sectionMenu) \n\ Shift,:GotoPage(Directory)\n\ Ctrlq: Quit() \n\ Ctrlc: Quit() \n\ Ctrlr: RemoveThisManpage() \n\ Ctrln: CreateNewManpage() \n\ Ctrlh: PopupHelp() \n\ Ctrld: GotoPage(Directory) \n\ Ctrlm: GotoPage(ManualPage) \n\ + Ctrlp: PrintThisManpage() \n\ Ctrlv: ShowVersion() \n\ Prior: Page(Back) \n\ Next : Page(Forward) \n\ Shift,: Page(Line,-1) \n\ Shift,: Page(Line,1) \n\ Ctrl,: Page(Back) \n\ Ctrl,: Page(Forward) \n\ None,: Page(Line,-5) \n\ None,: Page(Line,5) \n\ Ctrls: PopupSearch() !*manualBrowser*directory.background: Grey80 *manualBrowser*directory.translations: #override \ Ctrl: \ XawPositionSimpleMenu(optionMenu) \ MenuPopup(optionMenu) \n\ Ctrl: \ XawPositionSimpleMenu(sectionMenu) \ MenuPopup(sectionMenu) \n\ Shift,: GotoPage(Manpage) \n\ @@ -171,20 +177,116 @@ y: SaveFormattedPage(Save) \n\ n: SaveFormattedPage(Cancel) *manualBrowser*likeToSave*no.translations: #override \ ,: SaveFormattedPage(Cancel) reset() \n\ y: SaveFormattedPage(Save) \n\ n: SaveFormattedPage(Cancel) *manualBrowser*likeToSave*translations: #override \ y: SaveFormattedPage(Save) \n\ n: SaveFormattedPage(Cancel) *helpButton.translations: #augment \ ,: PopupHelp() reset() *quitButton.translations: #augment \ ,: Quit() reset() *manpageButton.translations: #augment \ ,: CreateNewManpage() reset() + +! Use "white" as background for printing +*printshell*background: white + +! Print dialog +*printdialogshell*geometry: 600x120 +*printdialogshell*title: Print +*printdialogshell*main*ok.fromVert: innerform +*printdialogshell*main*ok.label: Print +*printdialogshell*main*ok.tip: Print +*printdialogshell*main*setup.fromHoriz: ok +*printdialogshell*main*setup.fromVert: innerform +*printdialogshell*main*setup.label: Setup... +*printdialogshell*main*setup.tip: Configure print job options (page size, orientation, etc.) +*printdialogshell*main*cancel.fromHoriz: setup +*printdialogshell*main*cancel.fromVert: innerform +*printdialogshell*main*cancel.label: Cancel +*printdialogshell*main*cancel.tip: Cancel printing +*printdialogshell*main*desclabel.label: Printer Description: +*printdialogshell*main*desclabel.tip: Short description of printer +*printdialogshell*main*desc.fromHoriz: desclabel +*printdialogshell*main*desc.tip: Short description of printer +*printdialogshell*main*info.fromHoriz: desc +*printdialogshell*main*info.label: Printer info... +*printdialogshell*main*info.tip: Display additional information about this printer +*printdialogshell*main*namelabel.fromVert: desclabel +*printdialogshell*main*namelabel.label: Printer Name: +*printdialogshell*main*namelabel.tip: Name of selected printer +*printdialogshell*main*name.fromHoriz: namelabel +*printdialogshell*main*name.fromVert: desclabel +*printdialogshell*main*name.tip: Name of selected printer +*printdialogshell*main*selectprinter.fromHoriz: name +*printdialogshell*main*selectprinter.fromVert: desclabel +*printdialogshell*main*selectprinter.label: Select Printer... +*printdialogshell*main*selectprinter.label: Select Printer... +*printdialogshell*main*selectprinter.tip: Select a different printer +*printdialogshell*main*filenamelabel.fromVert: namelabel +*printdialogshell*main*filenamelabel.label: File Name: +*printdialogshell*main*filenamelabel.tip: File where the output should be stored +*printdialogshell*main*filename.fromHoriz: filenamelabel +*printdialogshell*main*filename.fromVert: namelabel +*printdialogshell*main*filename.tip: File where the output should be stored +*printdialogshell*main*selectfile.fromHoriz: filename +*printdialogshell*main*selectfile.fromVert: namelabel +*printdialogshell*main*selectfile.label: Select File... +*printdialogshell*main*selectfile.tip: Select file where the output should be stored +*printdialogshell*main*printtoprinter.fromVert: filenamelabel +*printdialogshell*main*printtoprinter.label: Print to Printer +*printdialogshell*main*printtoprinter.tip: Send print job to printer +*printdialogshell*main*printtofile.fromVert: filenamelabel +*printdialogshell*main*printtofile.fromHoriz: printtoprinter +*printdialogshell*main*printtofile.label: Print to File +*printdialogshell*main*printtofile.tip: Save print job in a file + +! Print job options dialog +*printdialogshell*setup*geometry: 600x400 +*printdialogshell*setup*title: Print: Print job options +*printdialogshell*setup*ok.fromVert: list +*printdialogshell*setup*ok.label: OK +*printdialogshell*setup*ok.tip: Commit changes +*printdialogshell*setup*cancel.fromHoriz: ok +*printdialogshell*setup*cancel.fromVert: list +*printdialogshell*setup*cancel.label: Cancel +*printdialogshell*setup*cancel.tip: Cancel and reset to defaults +*printdialogshell*setup*paperlist.tip: Select paper size +*printdialogshell*setup*resolutionlist.fromHoriz: paperlist +*printdialogshell*setup*resolutionlist.tip: Select page resolution +*printdialogshell*setup*orientationlist.fromHoriz: resolutionlist +*printdialogshell*setup*orientationlist.tip: Select page orientation +*printdialogshell*setup*plexlist.fromHoriz: orientationlist +*printdialogshell*setup*plexlist.tip: Select page plex mode (simplex, duplex, etc.) +*printdialogshell*setup*jobcopieslabel.fromVert: paperlist +*printdialogshell*setup*jobcopieslabel.tip: Set number of job copies +*printdialogshell*setup*jobcopieslabel.label: Job Copies: +*printdialogshell*setup*jobcopies.fromHoriz: jobcopieslabel +*printdialogshell*setup*jobcopies.fromVert: paperlist +*printdialogshell*setup*jobcopies.tip: Set number of job copies + +! Printer selection +*printdialogshell*printerselection*geometry: 400x150 +*printdialogshell*printerselection*title: Print: Select printer +*printdialogshell*printerselection*ok.fromVert: list +*printdialogshell*printerselection*ok.label: OK +*printdialogshell*printerselection*ok.tip: Switch printer +*printdialogshell*printerselection*cancel.fromHoriz: ok +*printdialogshell*printerselection*cancel.fromVert: list +*printdialogshell*printerselection*cancel.label: Cancel +*printdialogshell*printerselection*cancel.tip: Cancel printer selection +*printdialogshell*printerselection*list.tip: Select printer name from list + +! Select job file +*printdialogshell*selectfile*geometry: 400x80 +*printdialogshell*selectfile*title: Print: Select job file +*printdialogshell*selectfile*dialog.label: Select Filename: + +! EOF. Index: xc/programs/xman/buttons.c =================================================================== RCS file: /cvs/xorg/xc/programs/xman/buttons.c,v retrieving revision 1.4 diff -u -2 -0 -r1.4 buttons.c --- xc/programs/xman/buttons.c 16 Aug 2004 16:36:26 -0000 1.4 +++ xc/programs/xman/buttons.c 2 Sep 2004 05:22:11 -0000 @@ -104,47 +104,41 @@ arglist, num_args); /* use same vertical as help widget. */ XtSetArg(arglist[num_args], XtNfromHoriz, command); num_args++; command = XtCreateManagedWidget(QUIT_BUTTON, commandWidgetClass, form, arglist, num_args); num_args = 0; XtSetArg(arglist[num_args], XtNfromVert, command); num_args++; command = XtCreateManagedWidget(MANPAGE_BUTTON, commandWidgetClass, form, arglist, num_args); help_widget = NULL; /* We have not seen the help yet. */ FormUpWidgets(form, full_size, half_size); XtRealizeWidget(top); /* add WM_COMMAND property */ XSetCommand(XtDisplay(top), XtWindow(top), saved_argv, saved_argc); - man_globals = (ManpageGlobals*) XtMalloc( (Cardinal) sizeof(ManpageGlobals)); - man_globals->label = NULL; - man_globals->search_widget = NULL; - man_globals->manpagewidgets.directory = NULL; - man_globals->manpagewidgets.manpage = NULL; - man_globals->manpagewidgets.box = NULL; - man_globals->current_directory = 0; + man_globals = (ManpageGlobals*) XtCalloc(ONE, (Cardinal) sizeof(ManpageGlobals)); MakeSearchWidget(man_globals, top); MakeSaveWidgets(man_globals, top); SaveGlobals( (man_globals->This_Manpage = top), man_globals); XtMapWidget(top); AddCursor(top, resources.cursors.top); /* * Set up ICCCM delete window. */ XtOverrideTranslations (top, XtParseTranslationTable ("WM_PROTOCOLS: Quit()")); (void) XSetWMProtocols (XtDisplay(top), XtWindow(top), &wm_delete_window, 1); } /* Function Name: CreateManpage * Description: Creates a new manpage. @@ -266,40 +260,45 @@ mysections = XtCreateManagedWidget("sections", menuButtonWidgetClass, hpane, arglist, num_args); XtSetArg(arglist[0], XtNlabel, SHOW_BOTH); XtSetValues(man_globals->both_screens_entry, arglist, (Cardinal) 1); if (full_instance) { MakeSearchWidget(man_globals, mytop); CreateSectionMenu(man_globals, mytop); MakeSaveWidgets(man_globals, mytop); } else { XtSetSensitive(mysections, FALSE); XtSetArg(arglist[0], XtNsensitive, FALSE); XtSetValues(man_globals->dir_entry, arglist, ONE); XtSetValues(man_globals->manpage_entry, arglist, ONE); XtSetValues(man_globals->help_entry, arglist, ONE); XtSetValues(man_globals->search_entry, arglist, ONE); XtSetValues(man_globals->both_screens_entry, arglist, ONE); } +#ifdef BUILD_PRINTSUPPORT + XtSetArg(arglist[0], XtNsensitive, True); + XtSetValues(man_globals->print_entry, arglist, ONE); +#endif /* BUILD_PRINTSUPPORT */ + man_globals->label = XtCreateManagedWidget("manualTitle", labelWidgetClass, hpane, NULL, (Cardinal) 0); /* Create Directory */ if (full_instance) { num_args = 0; XtSetArg(arglist[num_args], XtNallowVert, TRUE); num_args++; mpw->directory = XtCreateWidget(DIRECTORY_NAME, viewportWidgetClass, pane, arglist, num_args); man_globals->current_directory = INITIAL_DIR; MakeDirectoryBox(man_globals, mpw->directory, mpw->box + man_globals->current_directory, man_globals->current_directory ); XtManageChild(mpw->box[man_globals->current_directory]); } @@ -418,84 +417,91 @@ /* Function Name: CreateOptionMenu * Description: Create the option menu. * Arguments: man_globals - the manual page globals. * parent - the button that activates the menu. * Returns: none. */ static void CreateOptionMenu(ManpageGlobals * man_globals, Widget parent) { Widget menu, entry; int i; static char * option_names[] = { /* Names of the buttons. */ DIRECTORY, MANPAGE, HELP, SEARCH, BOTH_SCREENS, REMOVE_MANPAGE, OPEN_MANPAGE, + PRINT_MANPAGE, SHOW_VERSION, QUIT }; menu = XtCreatePopupShell(OPTION_MENU, simpleMenuWidgetClass, parent, NULL, (Cardinal) 0); man_globals->option_menu = menu; for (i = 0 ; i < NUM_OPTIONS ; i++) { entry = XtCreateManagedWidget(option_names[i], smeBSBObjectClass, menu, NULL, ZERO); XtAddCallback(entry, XtNcallback, OptionCallback, (caddr_t) man_globals); switch (i) { case 0: man_globals->dir_entry = entry; break; case 1: man_globals->manpage_entry = entry; break; case 2: man_globals->help_entry = entry; break; case 3: man_globals->search_entry = entry; break; case 4: man_globals->both_screens_entry = entry; break; case 5: man_globals->remove_entry = entry; break; case 6: man_globals->open_entry = entry; break; case 7: - man_globals->version_entry = entry; + man_globals->print_entry = entry; break; case 8: + man_globals->version_entry = entry; + break; + case 9: man_globals->quit_entry = entry; break; default: + Error(("CreateOptionMenu: Unknown id=%d\n", i)); break; } } + + XtVaSetValues(man_globals->print_entry, XtNsensitive, FALSE, NULL); } /* Function Name: CreateSectionMenu * Description: Create the Section menu. * Arguments: man_globals - the manual page globals. * parent - the button that activates the menu. * Returns: none. */ static void CreateSectionMenu(ManpageGlobals * man_globals, Widget parent) { Widget menu, entry; int i; MenuStruct * menu_struct; Arg args[1]; Cardinal num_args; char entry_name[BUFSIZ]; menu = XtCreatePopupShell(SECTION_MENU, simpleMenuWidgetClass, parent, Index: xc/programs/xman/defs.h =================================================================== RCS file: /cvs/xorg/xc/programs/xman/defs.h,v retrieving revision 1.4 diff -u -2 -0 -r1.4 defs.h --- xc/programs/xman/defs.h 16 Aug 2004 16:36:26 -0000 1.4 +++ xc/programs/xman/defs.h 2 Sep 2004 05:22:11 -0000 @@ -50,49 +50,50 @@ #define DIRECTORY_NORMAL "fixed" /* The default dir font */ #define OPTION_MENU "optionMenu" /* Name of the Option Menu. */ #define SECTION_MENU "sectionMenu" /* Name of the Section Menu. */ #define HELP_BUTTON "helpButton" /* Name of top help button */ #define QUIT_BUTTON "quitButton" /* Name of top quit button */ #define MANPAGE_BUTTON "manpageButton" /* Name of top manpage button */ #define TOPBOXNAME "topBox" /* Name of the Top Box. */ #define MANNAME "manualBrowser" /* name for each manual page widget. */ #define SEARCHNAME "search" /* The name for the search widget. */ #define HELPNAME "help" /* The name of the help widget. */ #define DIRECTORY_NAME "directory" /* name of the directory widget. */ #define MANUALPAGE "manualPage" /* name of the Scrollbyline widget that contains the man page. */ #define DIALOG "dialog" /* Names of the menu buttons */ -#define NUM_OPTIONS 9 /* Number of menu options. */ +#define NUM_OPTIONS 10 /* Number of menu options. */ #define DIRECTORY "displayDirectory" #define MANPAGE "displayManualPage" #define HELP "help" #define SEARCH "search" #define BOTH_SCREENS "showBothScreens" #define REMOVE_MANPAGE "removeThisManpage" #define OPEN_MANPAGE "openNewManpage" +#define PRINT_MANPAGE "printManualPage" #define SHOW_VERSION "showVersion" #define QUIT "quit" /* definitions of string to use for show both and show one. */ #define SHOW_BOTH "Show Both Screens" #define SHOW_ONE "Show One Screen" /* * Things will not look right if you change these names to make * MANUALSEARCH longer APROPOSSEARCH, see search.c for details. */ #define MANUALSEARCH "manualPage" #define APROPOSSEARCH "apropos" #define CANCEL "cancel" #define MANUAL 0 #define APROPOS 1 Index: xc/programs/xman/handler.c =================================================================== RCS file: /cvs/xorg/xc/programs/xman/handler.c,v retrieving revision 1.4 diff -u -2 -0 -r1.4 handler.c --- xc/programs/xman/handler.c 16 Aug 2004 16:36:26 -0000 1.4 +++ xc/programs/xman/handler.c 2 Sep 2004 05:22:12 -0000 @@ -23,79 +23,87 @@ OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium 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 X Consortium. */ /* $XFree86: xc/programs/xman/handler.c,v 1.6 2003/01/19 04:44:45 paulo Exp $ */ /* * xman - X window system manual page display program. * Author: Chris D. Peterson, MIT Project Athena * Created: October 29, 1987 */ #include #include #include "globals.h" #include "vendor.h" +#ifdef BUILD_PRINTSUPPORT +#include "printdialog.h" +#include "print.h" +#endif /* BUILD_PRINTSUPPORT */ static void PutUpManpage(ManpageGlobals * man_globals, FILE * file); static void ToggleBothShownState(ManpageGlobals * man_globals); /* Function Name: OptionCallback * Description: This is the callback function for the callback menu. * Arguments: w - the widget we are calling back from. * globals_pointer - a pointer to the psuedo globals structure * for this manpage. * junk - (call data) not used. * Returns: none. */ /*ARGSUSED*/ void OptionCallback(Widget w, XtPointer pointer, XtPointer junk) { ManpageGlobals * man_globals = (ManpageGlobals *) pointer; String params; Cardinal num_params = 1; if ( w == man_globals->search_entry ) PopupSearch(XtParent(w), NULL, NULL, NULL); else if (w == man_globals->dir_entry) { /* Put Up Directory */ params = "Directory"; GotoPage(XtParent(w), NULL, ¶ms, &num_params); } else if (w == man_globals->manpage_entry ) { /* Put Up Man Page */ params = "ManualPage"; GotoPage(XtParent(w), NULL, ¶ms, &num_params); } else if ( w == man_globals->help_entry ) /* Help */ PopupHelp(XtParent(w), NULL, NULL, NULL); else if ( w == man_globals->both_screens_entry ) /*Toggle Both_Shown State.*/ ToggleBothShownState(man_globals); else if ( w == man_globals->remove_entry) /* Kill the manpage */ RemoveThisManpage(XtParent(w), NULL, NULL, NULL); else if ( w == man_globals->open_entry) /* Open new manpage */ CreateNewManpage(XtParent(w), NULL, NULL, NULL); +#ifdef BUILD_PRINTSUPPORT + else if ( w == man_globals->print_entry) /* Print current manpage */ + PrintThisManpage(XtParent(w), NULL, NULL, NULL); +#endif /* BUILD_PRINTSUPPORT */ else if ( w == man_globals->version_entry) /* Get version */ ShowVersion(XtParent(w), NULL, NULL, NULL); else if ( w == man_globals->quit_entry) /* Quit. */ Quit(XtParent(w), NULL, NULL, NULL); } /* Function Name: ToggleBothShownState; * Description: toggles the state of the both shown feature. * Arguments: man_globals - the man globals structure. * Returns: none. */ /* * I did not have a two state widget, which is the way this * should really be done. 1/22/88 - CDP. */ static void ToggleBothShownState(ManpageGlobals * man_globals) { @@ -198,41 +206,43 @@ /* Function Name: DirectoryHandler * Description: This is the callback function for the directory listings. * Arguments: w - the widget we are calling back from. * global_pointer - the pointer to the psuedo global structure * associated with this manpage. * ret_val - return value from the list widget. * Returns: none. */ void DirectoryHandler(Widget w, XtPointer global_pointer, XtPointer ret_val) { FILE * file; /* The manpage file. */ ManpageGlobals * man_globals = (ManpageGlobals *) global_pointer; XawListReturnStruct * ret_struct = (XawListReturnStruct *) ret_val; file = FindManualFile(man_globals, man_globals->current_directory, ret_struct->list_index); PutUpManpage(man_globals, file); - fclose(file); + if ((file != NULL) && (file != man_globals->curr_file)) { + fclose(file); + } } /* Function Name: DirPopupCallback * Description: This is the callback function for the callback menu. * Arguments: w - the widget we are calling back from. * pointer - a pointer to the psuedo globals structure * for this manpage. * junk - (call data) not used. * Returns: none. */ /*ARGSUSED*/ void DirPopupCallback(Widget w, XtPointer pointer, XtPointer junk) { ManpageGlobals * man_globals; MenuStruct * menu_struct; Widget parent; int number; int current_box; @@ -414,42 +424,41 @@ default: sprintf(error_buf,"%s %s", "Xman - GotoPage: Unknown argument must be", "either Manpage or Directory."); XtAppWarning(XtWidgetToApplicationContext(w), error_buf); return; } } /* Function Name: Quit. * Description: Quits Xman. * Arguments: w - any widget. * event - NOT USED. * params, num_params - NOT USED. * Returns: none. */ /*ARGSUSED*/ void Quit(Widget w, XEvent * event, String * params, Cardinal * num_params) { - XCloseDisplay(XtDisplay(w)); - exit(0); + XtAppSetExitFlag(XtWidgetToApplicationContext(w)); } /* Function Name: PopupHelp * Description: Pops up xman's help. * Arguments: w - NOT USED. * event - NOT USED. * params, num_params - NOT USED. * Returns: none. */ /*ARGSUSED*/ void PopupHelp(Widget w, XEvent * event, String * params, Cardinal * num_params) { if (MakeHelpWidget()) XtPopup(help_widget,XtGrabNone); } /* Function Name: PopupSearch * Description: Pops up this manual pages search widget. @@ -572,39 +581,143 @@ w = CreateManpage(file); man_pages_shown++; /* Put title into new manual page. */ label = man_globals->manpage_title; man_globals = GetGlobals(w); strcpy(man_globals->manpage_title, label); ChangeLabel(man_globals->label, label); } break; default: XtAppWarning(XtWidgetToApplicationContext(w), "Xman - Search: Second parameter unknown."); break; } else { PutUpManpage(man_globals, file); } - if (file != NULL) - fclose(file); + if ((file != NULL) && (file != man_globals->curr_file)) { + fclose(file); + } +} + +#ifdef BUILD_PRINTSUPPORT +static void +printshellDestroyXtProc(Widget w, XtPointer client_data, XtPointer callData) +{ + ManpageGlobals *mg = GetGlobals(w); + XawPrintDialogClosePrinterConnection(mg->printdialog, False); +} + +static void +printOKXtProc(Widget w, XtPointer client_data, XtPointer callData) +{ + XawPrintDialogCallbackStruct *pdcs = (XawPrintDialogCallbackStruct *)callData; + Cardinal n; + Arg args[2]; + ManpageGlobals *mg = GetGlobals(w); + Widget topwindow = mg->This_Manpage; + FILE *file; + + Log(("printOKXtProc: OK.\n")); + + /* Get file object */ + n = 0; + XtSetArg(args[n], XtNfile, &file); n++; + XtGetValues(mg->manpagewidgets.manpage, args, n); + Assertion(file != NULL, (("printOKXtProc: file == NULL.\n"))); + + DoPrintManpage("Xman", + file, topwindow, + pdcs->pdpy, pdcs->pcontext, printshellDestroyXtProc, + mg->manpage_title, + pdcs->printToFile?pdcs->printToFileName:NULL); + + XtPopdown(mg->printdialog_shell); +} + +static void +printCancelXtProc(Widget w, XtPointer client_data, XtPointer callData) +{ + ManpageGlobals * mg = GetGlobals(w); + + Log(("printCancelXtProc: cancel.\n")); + XtPopdown(mg->printdialog_shell); + + Log(("destroying print dialog shell...\n")); + XtDestroyWidget(mg->printdialog_shell); + mg->printdialog_shell = NULL; + mg->printdialog = NULL; + Log(("... done\n")); +} + +/* Function Name: PrintThisManpage + * Description: Print the current manual page. + * Arguments: mg - manpage globals + * Returns: none. + */ + +/*ARGSUSED*/ +void +PrintThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params) +{ + ManpageGlobals *mg = GetGlobals(w); + Dimension width, height; + Position x, y; + Widget parent = mg->This_Manpage; + Widget topwindow = mg->This_Manpage; + Log(("print!\n")); + + if (!mg->printdialog) { + int n; + Arg args[20]; + + n = 0; + XtSetArg(args[n], XtNallowShellResize, True); n++; + mg->printdialog_shell = XtCreatePopupShell("printdialogshell", + transientShellWidgetClass, + topwindow, args, n); + n = 0; + mg->printdialog = XtCreateManagedWidget("printdialog", printDialogWidgetClass, + mg->printdialog_shell, args, n); + XtAddCallback(mg->printdialog, XawNOkCallback, printOKXtProc, NULL); + XtAddCallback(mg->printdialog, XawNCancelCallback, printCancelXtProc, NULL); + + XtRealizeWidget(mg->printdialog_shell); + } + + /* Center dialog */ + XtVaGetValues(mg->printdialog_shell, + XtNwidth, &width, + XtNheight, &height, + NULL); + + x = (Position)(XWidthOfScreen( XtScreen(parent)) - width) / 2; + y = (Position)(XHeightOfScreen(XtScreen(parent)) - height) / 3; + + XtVaSetValues(mg->printdialog_shell, + XtNx, x, + XtNy, y, + NULL); + + XtPopup(mg->printdialog_shell, XtGrabNonexclusive); } +#endif /* BUILD_PRINTSUPPORT */ /* Function Name: ShowVersion * Description: Show current version. * Arguments: w - any widget in the manpage. * event - NOT USED. * params, num_params - NOT USED. * Returns: none. */ /*ARGSUSED*/ void ShowVersion(Widget w, XEvent * event, String * params, Cardinal * num_params) { ManpageGlobals * man_globals = GetGlobals(w); ChangeLabel(man_globals->label, XMAN_VERSION); } Index: xc/programs/xman/main.c =================================================================== RCS file: /cvs/xorg/xc/programs/xman/main.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 main.c --- xc/programs/xman/main.c 23 Apr 2004 19:54:58 -0000 1.2 +++ xc/programs/xman/main.c 2 Sep 2004 05:22:12 -0000 @@ -24,41 +24,41 @@ Except as contained in this notice, the name of the X Consortium 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 X Consortium. */ /* $XFree86: xc/programs/xman/main.c,v 1.3 2000/03/03 23:16:27 dawes Exp $ */ /* * xman - X window system manual page display program. * Author: Chris D. Peterson, MIT Project Athena * Created: October 22, 1987 */ #include "globals.h" #ifndef ZERO #include #endif /* ZERO */ -#if !defined(lint) && !defined(SABER) && 0 +#if !defined(lint) && !defined(SABER) static char version[] = XMAN_VERSION; /* via strings. */ #endif static void ArgError(int argc, char ** argv); static void AdjustDefResources(void); #define Offset(field) (XtOffsetOf(Xman_Resources , field)) static XtResource my_resources[] = { {"directoryFontNormal", XtCFont, XtRFontStruct, sizeof(XFontStruct *), Offset(fonts.directory), XtRString, DIRECTORY_NORMAL}, {"bothShown", XtCBoolean, XtRBoolean, sizeof(Boolean), Offset(both_shown_initial), XtRString, "False"}, {"directoryHeight", "DirectoryHeight", XtRInt, sizeof(int), Offset(directory_height), XtRString, "150"}, {"topCursor", XtCCursor, XtRCursor, sizeof(Cursor), Offset(cursors.top), XtRString, XMAN_CURSOR}, {"helpCursor", XtCCursor, XtRCursor, sizeof(Cursor), Offset(cursors.help), XtRString, HELP_CURSOR}, {"manpageCursor", XtCCursor, XtRCursor, sizeof(Cursor), @@ -108,40 +108,43 @@ {"-geometry", "*topBox.geometry", XrmoptionSepArg, (caddr_t) NULL}, {"-help", "help", XrmoptionNoArg, (caddr_t) "True"}, {"=", "*topBox.geometry", XrmoptionIsArg, (caddr_t) NULL}, {"-pagesize", "*manualBrowser.geometry", XrmoptionSepArg, (caddr_t) NULL}, {"-notopbox", "topBox", XrmoptionNoArg, (caddr_t) "False"}, {"-helpfile", "helpFile", XrmoptionSepArg, (caddr_t) NULL}, {"-bothshown","bothShown", XrmoptionNoArg, (caddr_t) "True"}, {"-title", "title", XrmoptionSepArg, (caddr_t) "xman"}, {"-iconic", "iconic", XrmoptionNoArg, (caddr_t) "True"}, }; XtActionsRec xman_actions[] = { {"GotoPage", GotoPage}, {"Quit", Quit}, {"Search", Search}, {"PopupHelp", PopupHelp}, {"PopupSearch", PopupSearch}, {"CreateNewManpage", CreateNewManpage}, {"RemoveThisManpage", RemoveThisManpage}, {"SaveFormattedPage", SaveFormattedPage}, +#ifdef BUILD_PRINTSUPPORT + {"PrintThisManpage", PrintThisManpage}, +#endif /* BUILD_PRINTSUPPORT */ {"ShowVersion", ShowVersion}, }; char **saved_argv; int saved_argc; /* * This atom is used to make the application ICCCM compliant. */ Atom wm_delete_window; /* Function Name: main * Description: This is the main driver for Xman. * Arguments: argc, argv - the command line arguments. * Returns: return, what return. */ int main(int argc, char ** argv) { XtAppContext app_con; @@ -151,41 +154,41 @@ bcopy(argv, saved_argv, argc * sizeof(char *)); XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL); initial_widget = XtAppInitialize(&app_con, "Xman", xman_options, XtNumber(xman_options), &argc, argv, fallback_resources, NULL, ZERO); wm_delete_window = XInternAtom(XtDisplay(initial_widget), "WM_DELETE_WINDOW", False); manglobals_context = XStringToContext(MANNAME); AdjustDefResources(); XtGetApplicationResources( initial_widget, (caddr_t) &resources, my_resources, XtNumber(my_resources), NULL, (Cardinal) 0); if ( (argc != 1) || (resources.show_help_syntax) ) { ArgError(argc, argv); - exit(1); + return EXIT_FAILURE; } XtAppAddActions(app_con, xman_actions, XtNumber(xman_actions)); if (!resources.fonts.directory) PrintError("Failed to get the directory font."); #ifdef DEBUG printf("debugging mode\n"); #endif /* * Set the default width and height. * I am not real happy with this method, but it will usually do something * reasonable, if not the "right" thing. It is not a real big issue since * it is easy to change the values with resources or command line options. * NOTE: if you are in a 100 dpi display you will lose. */ default_width = DEFAULT_WIDTH; @@ -198,41 +201,41 @@ PrintError("There are no manual sections to display, check your MANPATH."); if (resources.top_box_active) MakeTopBox(); else (void) CreateManpage(NULL); /* * We need to keep track of the number of manual pages that are shown on * the screen so that if this user does not have a top box then when he * removes all his manual pages we can kill off the xman process. * To make things easier we will consider the top box a shown manual page * here, but since you cannot remove it, man_page_shown only goes to zero when * no top box is present. */ man_pages_shown = 1; XtAppMainLoop(app_con); - exit(0); + return EXIT_SUCCESS; } /* Function Name: ArgError * Description: Prints error message about unknow arguments. * Arguments: argc, argv - args not understood. * Returns: none. */ static void ArgError(int argc, char ** argv) { int i; static char **syntax, *syntax_def[] = { "-help", "Print this message", "-helpfile ", "Specifies the helpfile to use.", "-bothshown", "Show both the directory and manpage at once.", "-notopbox", "Starts with manpage rather than topbox.", "-geometery ", "Specifies the geometry of the top box.", "=", "Specifies the geometry of the top box.", @@ -271,26 +274,26 @@ * Description: Changes default resources which contain paths when * XWINHOME is set * Arguments: none * Returns: nothing */ static void AdjustDefResources(void) { char *xwinhome = NULL; int i; if (!(xwinhome = getenv("XWINHOME"))) return; for (i = 0; i < sizeof(my_resources)/sizeof(XtResource); i++) { if (!strcmp(my_resources[i].resource_name, "helpFile")) { if (!(my_resources[i].default_addr = malloc(strlen(xwinhome) + sizeof("/lib/X11/xman.help")))) { fprintf(stderr, "malloc failure\n"); - exit(1); + exit(EXIT_FAILURE); } sprintf(my_resources[i].default_addr, "%s/lib/X11/xman.help", xwinhome); } } } Index: xc/programs/xman/man.h =================================================================== RCS file: /cvs/xorg/xc/programs/xman/man.h,v retrieving revision 1.7 diff -u -2 -0 -r1.7 man.h --- xc/programs/xman/man.h 16 Aug 2004 16:36:26 -0000 1.7 +++ xc/programs/xman/man.h 2 Sep 2004 05:22:13 -0000 @@ -1,22 +1,22 @@ /* $XConsortium: man.h,v 1.31 94/12/16 21:36:53 gildea Exp $ */ -/* $XdotOrg: xc/programs/xman/man.h,v 1.7 2004/08/16 16:36:26 krh Exp $ */ +/* $XdotOrg: xc/programs/xman/man.h,v 1.6 2004/07/29 00:40:35 gisburn Exp $ */ /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 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 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, @@ -26,69 +26,81 @@ Except as contained in this notice, the name of the X Consortium 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 X Consortium. */ /* $XFree86: xc/programs/xman/man.h,v 1.4 2001/07/25 15:05:27 dawes Exp $ */ /* X toolkit header files */ #include #include #include #include /* Std system and C header files */ #include +#include #include #include /* X include files */ #include /* Widget header files. */ #include #include #include #include #include #include #include #include #include #include #include /* program specific header files. */ #include "ScrollByL.h" #include "version.h" #include "defs.h" +/* 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 } } +#ifdef DEBUG +# define Log(x) { if(True) printf x; } +#else +# define Log(x) { if(False) printf x; } +#endif /* DEBUG */ + /* * Assigning values here allows the user of Bitwise Or. */ typedef struct _XmanFonts { XFontStruct * directory; /* The font for the directory. */ } XmanFonts; typedef struct _XmanCursors { Cursor top, /* The top Cursor, default for xman. */ help, /* The top cursor for the help menu. */ manpage, /* The cursor for the Manpage. */ search_entry; /* The cursor for the text widget in the search box.*/ Pixel fg_color; /* foreground color of cursors. */ Pixel bg_color; /* background color of cursors. */ } XmanCursors; typedef struct _ManPageWidgets { Widget manpage, /* The manual page window (scrolled) */ @@ -115,65 +127,73 @@ int nalloc; /* how much space allocated */ int flags; /* suffix, fold */ } Manual; /* psuedo Globals that are specific to each manpage created. */ typedef struct _ManpageGlobals{ int current_directory; /* The directory currently being shown on this manpage. */ Boolean dir_shown, /* True if the directory is then current visable screen */ both_shown; /* If true then both the manpage and the directory are to be shown.*/ Widget label, /* The label widget at the top of the page. */ standby, /* The please standby widget. */ save, /* The "would you like to save?" widget. */ search_widget, /* The search widget popup. */ help_button, /* The help button. */ option_menu, /* The option menu. */ text_widget; /* text widget containing search string. */ - - /* Widgets (Objects really) for the command menu entries. */ - - Widget dir_entry, manpage_entry, help_entry, - search_entry, both_screens_entry, remove_entry, open_entry, - version_entry, quit_entry; + + /* Widgets (Objects really) for the command menu entries. */ + + Widget dir_entry, manpage_entry, help_entry, + search_entry, both_screens_entry, remove_entry, + open_entry, print_entry, version_entry, quit_entry; + +#ifdef BUILD_PRINTSUPPORT + /* Print objects and data */ + Widget printdialog_shell; /* Shell for the print dialog */ + Widget printdialog; /* Print dialog */ +#endif /*BUILD_PRINTSUPPORT */ + /* Misc. */ char manpage_title[80]; /* The label to use for the current manpage. */ char save_file[80]; /* the name of the file to save fomatted page into. */ char tempfile[80]; /* the name of the file to copy the formatted page from. */ Boolean compress; /* Compress file on save? */ Boolean gzip; /* Gzip file on save? */ Boolean deletetempfile; /* Need to delete tempfile when done? */ char ** section_name; /* The name of each of the sections */ ManPageWidgets manpagewidgets; /* The manpage widgets. */ /* Things to remember when cleaning up when killing manpage. */ Widget This_Manpage; /* a pointer to the root of this manpage. */ + FILE *curr_file; /* Current file shown in manpage widget */ } ManpageGlobals; /* Resource manager sets these. */ typedef struct _Xman_Resources { XmanFonts fonts; /* The fonts used for the man pages. */ XmanCursors cursors; /* The cursors for xman. */ Boolean show_help_syntax; /* True if syntax message should be dumped to stdout. */ Boolean both_shown_initial; /* The initial state of the manual pages show two screens or only one. */ Boolean top_box_active; /* Put up the Top Box. */ Boolean clear_search_string; /* clear the search string each time it is popped down? */ int directory_height; /* The default height of directory in both_shown mode. */ char * help_file; /* The name of the help file. */ char * title; /* The title for topBox */ Boolean iconic; /* Should topBox come up in an iconic state */ @@ -204,55 +224,58 @@ void MakeSaveWidgets(ManpageGlobals *man_globals, Widget parent); void MakeTopBox(void); /* handler.c */ void DirPopupCallback(Widget w, XtPointer pointer, XtPointer junk); void DirectoryHandler(Widget w, XtPointer global_pointer, XtPointer ret_val); void OptionCallback(Widget w, XtPointer pointer, XtPointer junk); void Popup(Widget w, XtGrabKind grab_kind); /* Action Routines. */ void CreateNewManpage(Widget w, XEvent * event, String * params, Cardinal * num_params); void GotoPage(Widget w, XEvent * event, String * params, Cardinal * num_params); void PopupHelp(Widget w, XEvent * event, String * params, Cardinal * num_params); void PopupSearch(Widget w, XEvent * event, String * params, Cardinal * num_params); void Quit(Widget w, XEvent * event, String * params, Cardinal * num_params); void RemoveThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params); void SaveFormattedPage(Widget w, XEvent * event, String * params, Cardinal * num_params); void Search(Widget w, XEvent * event, String * params, Cardinal * num_params); +#ifdef BUILD_PRINTSUPPORT +void PrintThisManpage(Widget w, XEvent * event, String * params, Cardinal * num_params); +#endif /* BUILD_PRINTSUPPORT */ void ShowVersion(Widget w, XEvent * event, String * params, Cardinal * num_params); /* help.c */ Boolean MakeHelpWidget(void); Boolean OpenHelpfile(ManpageGlobals * man_globals); /* man.c */ Bool ReadManConfig(char manpath[]); int Man(void); /* misc.c */ -FILE * DoSearch(ManpageGlobals * man_globals, int type); FILE * FindManualFile(ManpageGlobals * man_globals, int section_num, int entry_num); ManpageGlobals * GetGlobals(Widget w); void AddCursor(Widget w, Cursor cursor); void ChangeLabel(Widget w, char * str); void OpenFile(ManpageGlobals * man_globals, FILE * file); void PopupWarning(ManpageGlobals * man_globals, char * string); void PositionCenter(Widget widget, int x, int y, int above, int left, int v_space, int h_space); void PrintError(char * string); void RemoveGlobals(Widget w); void SaveGlobals(Widget w, ManpageGlobals * globals); void ParseEntry(char *entry, char *path, char *sect, char *page); FILE * Format(ManpageGlobals * man_globals, char * entry); /* search */ +FILE * DoSearch(ManpageGlobals * man_globals, int type); void MakeSearchWidget(ManpageGlobals * man_globals, Widget parent); /* tkfunctions.c */ int Width(Widget); int Height(Widget); int BorderWidth(Widget); char * Name(Widget); Index: xc/programs/xman/misc.c =================================================================== RCS file: /cvs/xorg/xc/programs/xman/misc.c,v retrieving revision 1.5 diff -u -2 -0 -r1.5 misc.c --- xc/programs/xman/misc.c 16 Aug 2004 16:36:26 -0000 1.5 +++ xc/programs/xman/misc.c 2 Sep 2004 05:22:13 -0000 @@ -1,22 +1,22 @@ /* $XConsortium: misc.c,v 1.31 94/12/16 21:36:53 gildea Exp $ */ -/* $XdotOrg: xc/programs/xman/misc.c,v 1.5 2004/08/16 16:36:26 krh Exp $ */ +/* $XdotOrg: xc/programs/xman/misc.c,v 1.4 2004/06/08 02:44:35 gisburn Exp $ */ /* Copyright (c) 1987, 1988 X Consortium Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 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 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, @@ -121,57 +121,64 @@ XtSetArg(wargs[0], XtNlabel, buffer); warnDialog = XtCreateManagedWidget("warnDialog", dialogWidgetClass, warnShell, wargs, 1); XawDialogAddButton(warnDialog, "dismiss", PopdownWarning, (XtPointer)warnShell); XtRealizeWidget(warnShell); Popup(warnShell, XtGrabNone); } } /* Function Name: PrintError * Description: This Function prints an error message and exits. * Arguments: string - the specific message. * Returns: none. - exits tho. */ void PrintError(char * string) { fprintf(stderr,"Xman Error: %s\n",string); - exit(1); + exit(EXIT_FAILURE); } /* Function Name: OpenFile * Description: Assignes a file to the manpage. * Arguments: man_globals - global structure. * file - the file pointer. * Returns: none */ void OpenFile(ManpageGlobals * man_globals, FILE * file) { Arg arglist[1]; Cardinal num_args = 0; + + if (man_globals->curr_file) { +#if 0 /* Ownership rules need to be fixed first */ + fclose(man_globals->curr_file); +#endif + } + man_globals->curr_file = file; - XtSetArg(arglist[num_args], XtNfile, file); num_args++; + XtSetArg(arglist[num_args], XtNfile, man_globals->curr_file); num_args++; XtSetValues(man_globals->manpagewidgets.manpage, arglist, num_args); } /* Function Name: FindManualFile * Description: Opens the manual page file given the entry information. * Arguments: man_globals - the globals info for this manpage. * section_num - section number of the man page. * entry_num - entry number of the man page. * Returns: fp - the file pointer * * NOTES: * * If there is a uncompressed section it will look there for uncompresed * manual pages first and then for individually compressed file in the * uncompressed section. * * If there is a compressed directory then it will also look there for * the manual pages. * Index: xc/programs/xman/search.c =================================================================== RCS file: /cvs/xorg/xc/programs/xman/search.c,v retrieving revision 1.4 diff -u -2 -0 -r1.4 search.c --- xc/programs/xman/search.c 16 Aug 2004 16:36:26 -0000 1.4 +++ xc/programs/xman/search.c 2 Sep 2004 05:22:14 -0000 @@ -248,41 +248,41 @@ flag = TRUE; break; } count++; } /* * If the file is less than this number of lines then assume that there is * nothing apropriate found. This does not confuse the apropos filter. */ if (flag) { fclose(file); file = NULL; ChangeLabel(man_globals->label,string_buf); return(NULL); } strcpy(man_globals->manpage_title,label); ChangeLabel(man_globals->label,label); - fseek(file, 0L, 0); /* reset file to point at top. */ + fseek(file, 0L, SEEK_SET); /* reset file to point at top. */ } else { /* MANUAL SEACH */ file = DoManualSearch(man_globals, search_string); if (file == NULL) { sprintf(string_buf,"No manual entry for %s.", search_string); ChangeLabel(man_globals->label, string_buf); if (man_globals->label == NULL) PopupWarning(man_globals, string_buf); return(NULL); } } if (resources.clear_search_string) { Arg arglist[1]; Widget dialog; dialog = XtNameToWidget(man_globals->search_widget, DIALOG); if (dialog == NULL) PopupWarning(man_globals, "Could not clear the search string."); Index: xc/programs/xman/version.h =================================================================== RCS file: /cvs/xorg/xc/programs/xman/version.h,v retrieving revision 1.2 diff -u -2 -0 -r1.2 version.h --- xc/programs/xman/version.h 8 Jun 2004 02:44:35 -0000 1.2 +++ xc/programs/xman/version.h 2 Sep 2004 05:22:14 -0000 @@ -12,21 +12,21 @@ the following conditions: 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 X CONSORTIUM 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 X Consortium 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 X Consortium. */ -#define XMAN_VERSION "Xman Version 3.2.0 - X11R6.7.1" +#define XMAN_VERSION "Xman Version 3.2.0 - X11R6.8" Index: xc/programs/xset/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/xset/Imakefile,v retrieving revision 1.5 diff -u -2 -0 -r1.5 Imakefile --- xc/programs/xset/Imakefile 2 Sep 2004 01:10:30 -0000 1.5 +++ xc/programs/xset/Imakefile 2 Sep 2004 05:22:15 -0000 @@ -1,28 +1,28 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ XCOMM $XFree86: xc/programs/xset/Imakefile,v 3.10 2001/01/17 23:46:27 dawes Exp $ - DEFINES = ExtensionDefines DPMSDefines \ - FontCacheExtensionDefines \ - XkbDefines - DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) $(DEPXF86LIBS) $(DEPFONTLIBS) -LOCAL_LIBRARIES = $(XMUULIB) $(XF86LIBS) $(FONTLIBS) $(XPRINTLIBS) $(XLIB) - #if BuildXF86MiscLibrary DEPXF86LIBS = $(DEPXXF86MISCLIB) XF86LIBS = $(XXF86MISCLIB) #endif #if BuildFontCacheLib DEPFONTLIBS = $(DEPXFONTCACHELIB) FONTLIBS = $(XFONTCACHELIB) #endif #if BuildXprintLib && BuildXprintClients DEPXPRINTLIBS = $(DEPXPRINTLIB) XPRINTLIBS = $(XPLIB) XPRINTDEFINES = -DXPRINT #endif + DEFINES = ExtensionDefines DPMSDefines \ + FontCacheExtensionDefines \ + XkbDefines + DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) $(DEPXF86LIBS) $(DEPFONTLIBS) +LOCAL_LIBRARIES = $(XMUULIB) $(XF86LIBS) $(FONTLIBS) $(XPRINTLIBS) $(XLIB) + SimpleProgramTarget(xset)