pspresent-1.3/0000700000353100035310000000000010400303676015035 5ustar matthewcmatthewc00000000000000pspresent-1.3/ps.c0000600000353100035310000001140407731051143015627 0ustar matthewcmatthewc00000000000000/* pspresent: PostScript presentation tool ps.c: Parsing of PostScript Document Structuring Convention Copyright (C) Matthew Chapman 2001-2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "pspresent.h" #include #define DSC_END_COMMENTS "%%EndComments" #define DSC_BOUNDING_BOX "%%BoundingBox: " #define DSC_ORIENTATION "%%Orientation: " #define DSC_PAGES "%%Pages: " #define DSC_PAGE "%%Page: " #define DSC_BEGIN_DOCUMENT "%%BeginDocument" #define DSC_END_DOCUMENT "%%EndDocument" #define DSC_TRAILER "%%Trailer" #define LEN(str) (sizeof(str)-1) static char *PSGetLine(char **p, char *end) { char *next = *p; if (next != NULL) { *p = memchr(next, '\n', end-next); if (*p != NULL) (*p)++; } return next; } static Bool PSGetBoundingBox(char *string, int bounds[4]) { char *p; bounds[0] = strtol(string, &p, 10); if (*p != ' ') return False; bounds[1] = strtol(p+1, &p, 10); if (*p != ' ') return False; bounds[2] = strtol(p+1, &p, 10); if (*p != ' ') return False; bounds[3] = strtol(p+1, &p, 10); if ((*p != '\n') && (*p != 0)) return False; return True; } Bool PSGetOrientation(char *string, int *orientation) { if (!strncmp(string, "Portrait", 8)) *orientation = Portrait; else if (!strncmp(string, "Landscape", 9)) *orientation = Landscape; else if (!strncmp(string, "Upside-Down", 11)) *orientation = UpsideDown; else if (!strncmp(string, "Seascape", 8)) *orientation = Seascape; else return False; return True; } Bool PSScanDocument(char *start, char *end, int bounds[4], int *orientation, int *num_pages, struct pspage **ret_pages, int *num_real_pages, int **ret_real_pages) { char *line; Bool gotBB = False, gotOR = False; int pages_size = 0, page = 0, real_page = 0; int eps_level = 0, this_page, last_page = 0; struct pspage *pages; int *real_pages; if ((start[0] != '%') || (start[1] != '!')) { fprintf(stderr, "ERROR: Not a PostScript file\n"); return False; } while ((line = PSGetLine(&start, end)) != NULL) { if ((line[0] != '%') || !strncmp(line, DSC_END_COMMENTS, LEN(DSC_END_COMMENTS))) { break; } else if (!strncmp(line, DSC_BOUNDING_BOX, LEN(DSC_BOUNDING_BOX))) { gotBB = PSGetBoundingBox(line + LEN(DSC_BOUNDING_BOX), bounds); } else if (!strncmp(line, DSC_ORIENTATION, LEN(DSC_ORIENTATION))) { gotOR = PSGetOrientation(line + LEN(DSC_ORIENTATION), orientation); } else if (!strncmp(line, DSC_PAGES, LEN(DSC_PAGES))) { pages_size = atoi(line + LEN(DSC_PAGES)) + 1; } } if (!gotBB) { fprintf(stderr, "ERROR: No bounding box information found\n"); return False; } if (!gotOR) *orientation = Portrait; if (pages_size == 0) pages_size = 100; pages = malloc(pages_size * sizeof(struct pspage)); real_pages = malloc(pages_size * sizeof(int)); while ((line = PSGetLine(&start, end)) != NULL) { if (line[0] != '%') { } else if (!strncmp(line, DSC_BEGIN_DOCUMENT, LEN(DSC_BEGIN_DOCUMENT))) { eps_level++; } else if (!strncmp(line, DSC_END_DOCUMENT, LEN(DSC_END_DOCUMENT))) { eps_level--; } else if (!strncmp(line, DSC_PAGE, LEN(DSC_PAGE)) && (eps_level == 0)) { this_page = atoi(line + LEN(DSC_PAGE)); if ((page != 0) && (this_page != last_page)) { pages[page-1].is_last = 1; real_pages[real_page++] = page-1; } last_page = this_page; pages[page].data = line; pages[page].is_last = 0; if (++page == pages_size) { pages_size += 100; pages = realloc(pages, pages_size * sizeof(struct pspage)); real_pages = realloc(real_pages, pages_size * sizeof(int)); } } else if (!strncmp(line, DSC_TRAILER, LEN(DSC_TRAILER)) && (eps_level == 0)) { if (page != 0) { pages[page-1].is_last = 1; real_pages[real_page++] = page-1; } pages[page].data = line; pages[page].is_last = 0; break; } } if (page == 0) { fprintf(stderr, "ERROR: Document does not follow PostScript structuring convention\n"); free(pages); free(real_pages); return False; } *num_pages = page; *ret_pages = pages; *num_real_pages = real_page; *ret_real_pages = real_pages; return True; } pspresent-1.3/gs.c0000600000353100035310000000730607731047646015641 0ustar matthewcmatthewc00000000000000/* pspresent: PostScript presentation tool gs.c: Interface to Ghostscript Copyright (C) Matthew Chapman 2001-2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "pspresent.h" #include #include #include #include #include #include extern Display *display; extern Screen *screen; static Window gs_wnd; static pid_t gs_pid; static Atom next, page, done; static void GSExec(int gs_stdin, Window wnd) { char *args[] = { "gs", "-sDEVICE=x11alpha", "-q", "-dNOPAUSE", "-dSAFER", "-", NULL }; char ghostview[32]; snprintf(ghostview, sizeof(ghostview)-1, "GHOSTVIEW=%ld", (unsigned long)wnd); putenv(ghostview); dup2(gs_stdin, STDIN_FILENO); execvp(args[0], args); perror(args[0]); } /* set Ghostscript-related properties on a window */ int GSStart(Window draw_wnd, Pixmap draw_pix, int wnd_width, int wnd_height, int bounds[4], int orientation) { Atom gv, gv_colors; unsigned long fg, bg; float xdpi, ydpi; int xsize, ysize; char prop[64]; int fds[2]; int flags, len, gs_fd; fg = BlackPixelOfScreen(screen); bg = WhitePixelOfScreen(screen); if (orientation % 180 == 0) { xsize = bounds[2]-bounds[0]; ysize = bounds[3]-bounds[1]; } else { xsize = bounds[3]-bounds[1]; ysize = bounds[2]-bounds[0]; } xdpi = 72.0*wnd_width/xsize; ydpi = 72.0*wnd_height/ysize; gv = XInternAtom(display, "GHOSTVIEW", False); len = snprintf(prop, sizeof(prop)-1, "%ld %d %d %d %d %d %g %g %d %d %d %d", draw_pix, orientation, bounds[0], bounds[1], bounds[2], bounds[3], xdpi, ydpi, 0, 0, 0, 0); XChangeProperty(display, draw_wnd, gv, XA_STRING, 8, PropModeReplace, prop, len); gv_colors = XInternAtom(display, "GHOSTVIEW_COLORS", False); len = snprintf(prop, sizeof(prop)-1, "Color %ld %ld", fg, bg); XChangeProperty(display, draw_wnd, gv_colors, XA_STRING, 8, PropModeReplace, prop, len); next = XInternAtom(display, "NEXT", False); page = XInternAtom(display, "PAGE", False); done = XInternAtom(display, "DONE", False); pipe(fds); switch (gs_pid = fork()) { case -1: /* failure */ perror("fork"); return -1; case 0: /* child */ GSExec(fds[0], draw_wnd); exit(1); } flags = fcntl(fds[1], F_GETFL); fcntl(fds[1], F_SETFL, flags | O_NONBLOCK); gs_fd = fds[1]; return gs_fd; } char *GSWrite(int gs_fd, char *start, char *end) { int length; while (start < end) { length = end - start; length = write(gs_fd, start, length); if (length == -1) { if (errno != EWOULDBLOCK) perror("write"); break; } start += length; } return start; } void GSStop(int gs_fd) { int status; close(gs_fd); kill(gs_pid, SIGTERM); waitpid(gs_pid, &status, 0); } void GSNextPage(void) { XEvent event; event.xclient.type = ClientMessage; event.xclient.display = display; event.xclient.window = gs_wnd; event.xclient.message_type = next; event.xclient.format = 32; XSendEvent(display, gs_wnd, False, 0, &event); XFlush(display); } Bool GSProcessMessage(XClientMessageEvent *message) { gs_wnd = (Window)message->data.l[0]; return (message->message_type == page); } pspresent-1.3/Makefile0000600000353100035310000000116507731047663016520 0ustar matthewcmatthewc00000000000000# # pspresent: PostScript presentation tool # Copyright (C) Matthew Chapman 2001-2003 # # You may need to change these paths X11_CFLAGS=-I/usr/X11R6/include X11_LDLIBS=-L/usr/X11R6/lib -lX11 # Remove the following two lines to disable XINERAMA support XINERAMA_CFLAGS=-DHAVE_LIBXINERAMA XINERAMA_LDLIBS=-lXext -lXinerama CC = gcc CFLAGS = -Wall -O2 $(X11_CFLAGS) $(XINERAMA_CFLAGS) LDLIBS = $(X11_LDLIBS) $(XINERAMA_LDLIBS) TARGET = pspresent OBJS = pspresent.o gs.o ps.o $(TARGET): $(OBJS) $(CC) -o $(TARGET) $(OBJS) $(LDLIBS) clean: rm $(TARGET) $(OBJS) .SUFFIXES: .SUFFIXES: .c .o .c.o: $(CC) $(CFLAGS) -o $@ -c $< pspresent-1.3/pspresent.c0000600000353100035310000002633410400303620017223 0ustar matthewcmatthewc00000000000000/* pspresent: PostScript presentation tool Copyright (C) Matthew Chapman 2001-2003 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "pspresent.h" #include #include #include #include #include #ifdef HAVE_LIBXINERAMA # include #endif Display *display; Screen *screen; static unsigned int width, height; static Window draw_wnd, display_wnd; static Pixmap draw_pix, current_pix, prev_pix; static GC gc; static int num_pages, num_real_pages; static struct pspage *pages; static int *real_pages; static char *page_start; static char *page_end; static Bool gs_ready = False; static Bool skip_overlays_mode = False; static int current_dir = +1; /* current direction */ static int current_page = -1; /* page displayed on screen */ static int prev_page = -1; /* last page displayed on screen */ static int gs_page = 0; /* page being rendered by gs */ static int requested_page = 0; /* page that user wants displayed */ static int warp_page; static void UpdateWindow(void) { XCopyArea(display, current_pix, display_wnd, gc, 0, 0, width, height, 0, 0); } static void RenderPage(int page) { page_start = pages[page].data; page_end = pages[page+1].data; gs_page = page; gs_ready = False; GSNextPage(); } static int GetNextPage(void) { int new_page; if (skip_overlays_mode) { new_page = current_page; do { new_page += current_dir; if ((new_page >= num_pages) || (new_page < 0)) return -1; } while (!pages[new_page].is_last); } else { new_page = current_page + current_dir; if ((new_page >= num_pages) || (new_page < 0)) return -1; } return new_page; } static void GotoPage(int page) { int next_page; requested_page = page; if (!gs_ready) return; if (page == prev_page) { /* Still have this page cached */ XCopyArea(display, prev_pix, draw_pix, gc, 0, 0, width, height, 0, 0); } else if (page == gs_page) { /* Excellent - the page that GhostScript just rendered is * the one the user wants */ } else { RenderPage(page); return; } requested_page = -1; prev_page = current_page; current_page = page; XCopyArea(display, current_pix, prev_pix, gc, 0, 0, width, height, 0, 0); XCopyArea(display, draw_pix, current_pix, gc, 0, 0, width, height, 0, 0); UpdateWindow(); /* Prefetch the next page */ next_page = GetNextPage(); if (next_page != -1) RenderPage(next_page); } static void NextPage(int dir, Bool skip_overlays) { int next_page; /* Assume user will keep going in that direction */ current_dir = dir; skip_overlays_mode = skip_overlays; next_page = GetNextPage(); if (next_page != -1) GotoPage(next_page); } static void WarpPage(int page) { current_dir = (page == num_pages-1) ? -1 : +1; skip_overlays_mode = False; GotoPage(page); } static Bool ProcessEvents(void) { XEvent event; KeySym key; while (XPending(display) > 0) { XNextEvent(display, &event); switch (event.type) { case ClientMessage: /* message from Ghostscript */ if (!GSProcessMessage(&event.xclient)) return False; gs_ready = True; if (requested_page != -1) GotoPage(requested_page); break; case Expose: UpdateWindow(); break; case KeyPress: key = XKeycodeToKeysym(display, event.xkey.keycode, 0); switch (key) { case XK_space: case XK_Next: case XK_KP_Next: case XK_Right: case XK_KP_Right: case XK_Down: case XK_KP_Down: NextPage(+1, event.xkey.state & ShiftMask); break; case XK_BackSpace: case XK_Prior: case XK_KP_Prior: case XK_Left: case XK_KP_Left: case XK_Up: case XK_KP_Up: NextPage(-1, event.xkey.state & ShiftMask); break; case XK_Home: case XK_KP_Home: WarpPage(0); break; case XK_End: case XK_KP_End: WarpPage(num_pages-1); break; case XK_0 ... XK_9: warp_page *= 10; warp_page += key - XK_0; break; case XK_KP_0 ... XK_KP_9: warp_page *= 10; warp_page += key - XK_KP_0; break; case XK_Return: case XK_KP_Enter: warp_page--; /* pages start at 0 */ if ((warp_page >= 0) && (warp_page < num_real_pages)) WarpPage(real_pages[warp_page]); else XBell(display, 0); warp_page = 0; break; case XK_Escape: case XK_q: return False; } break; case ButtonPress: switch (event.xbutton.button) { case Button1: NextPage(+1, event.xbutton.state & ShiftMask); break; case Button3: NextPage(-1, event.xbutton.state & ShiftMask); break; } break; case ButtonRelease: /* We don't exit until the ButtonRelease to prevent another * application getting the ButtonRelease and pasting */ switch (event.xbutton.button) { case Button2: return False; } break; } } return True; } static void MainLoop(int gs_fd) { fd_set readset; fd_set writeset; int x_fd = ConnectionNumber(display); int max_fd = (gs_fd > x_fd) ? gs_fd : x_fd; FD_ZERO(&readset); FD_ZERO(&writeset); while (True) { if (!ProcessEvents()) return; FD_SET(x_fd, &readset); if (page_start == page_end) FD_CLR(gs_fd, &writeset); else FD_SET(gs_fd, &writeset); if (select(max_fd+1, &readset, &writeset, NULL, NULL) == -1) { perror("select"); return; } if (FD_ISSET(gs_fd, &writeset)) page_start = GSWrite(gs_fd, page_start, page_end); } } /* try to hide decorations using MWM hints */ static void HideDecorations(Window wnd) { PropMotifWmHints motif_hints; Atom atom; atom = XInternAtom(display, "_MOTIF_WM_HINTS", False); if (!atom) return; motif_hints.flags = MWM_HINTS_DECORATIONS; motif_hints.decorations = 0; XChangeProperty(display, wnd, atom, atom, 32, PropModeReplace, (unsigned char *) &motif_hints, sizeof(motif_hints)/4); } static size_t MapFile(char *filename, char **ptr) { struct stat st; size_t size, pagesize; int fd; fd = open(filename, O_RDONLY); if (fd == -1) return -1; if (fstat(fd, &st) == -1) { close(fd); return -1; } /* round size up to page size */ pagesize = getpagesize(); size = (st.st_size + pagesize-1) & ~(pagesize-1); *ptr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); if (*ptr == MAP_FAILED) size = -1; close(fd); return size; } static void usage(char *program) { fprintf(stderr, "pspresent: PostScript presentation tool\n" "Version " VERSION ". Copyright (C) 2001-2006 Matt Chapman.\n\n" "Usage: %s [options] psfile\n" " -h: Display this usage message\n" " -o: Do not override window manager\n" #ifdef HAVE_LIBXINERAMA " -s: Use only head n of a XINERAMA display\n" #endif " -O: Override orientation (Portrait|Landscape|Upside-Down|Seascape)\n" , program); } int main(int argc, char *argv[]) { XSetWindowAttributes attribs; Bool override_redirect = True, force_orientation = False; char *filename, *document; int gs_fd, depth, c; int orientation, arg_orientation; int bounds[4]; size_t size; int x, y, head = -1; #ifdef HAVE_LIBXINERAMA XineramaScreenInfo *head_info; int heads; #endif while ((c = getopt(argc, argv, "os:O:hv?")) != -1) { switch (c) { case 'o': override_redirect = False; break; case 's': head = atoi(optarg); break; case 'O': if (!PSGetOrientation(optarg, &arg_orientation)) { fprintf(stderr, "ERROR: orientation should be one of Portrait|Landscape|Upside-Down|Seascape\n"); return EXIT_FAILURE; } force_orientation = True; break; default: usage(argv[0]); return EXIT_FAILURE; } } if (argc - optind != 1) { usage(argv[0]); return EXIT_FAILURE; } filename = argv[optind]; size = MapFile(filename, &document); if (size == -1) { perror(filename); return EXIT_FAILURE; } if (!PSScanDocument(document, document+size, bounds, &orientation, &num_pages, &pages, &num_real_pages, &real_pages)) { return EXIT_FAILURE; } if (force_orientation) orientation = arg_orientation; display = XOpenDisplay(NULL); if (display == NULL) { fprintf(stderr, "ERROR: Failed to open display: %s\n", XDisplayName(NULL)); return EXIT_FAILURE; } screen = DefaultScreenOfDisplay(display); depth = DefaultDepthOfScreen(screen); if (head != -1) { /* user wants a specific screen head */ #ifdef HAVE_LIBXINERAMA head_info = XineramaQueryScreens(display, &heads); if (head_info == NULL) { fprintf(stderr, "ERROR: XINERAMA not available\n"); return EXIT_FAILURE; } if ((head > heads) || (heads < 0)) { fprintf(stderr, "ERROR: Head %d requested, but only %d heads available\n", head, heads); return EXIT_FAILURE; } x = (int) head_info[head].x_org; y = (int) head_info[head].y_org; width = (unsigned int) head_info[head].width; height = (unsigned int) head_info[head].height; #else fprintf(stderr, "ERROR: XINERAMA support not compiled in\n"); return EXIT_FAILURE; #endif } else { x = 0; y = 0; width = WidthOfScreen(screen); height = HeightOfScreen(screen); } /* create the real window */ attribs.override_redirect = override_redirect; display_wnd = XCreateWindow(display, DefaultRootWindow(display), x, y, width, height, 0, depth, InputOutput, DefaultVisualOfScreen(screen), CWOverrideRedirect, &attribs); /* create the drawing window */ draw_wnd = XCreateWindow(display, DefaultRootWindow(display), 0, 0, width, height, 0, depth, InputOutput, DefaultVisualOfScreen(screen), 0, NULL); /* create the drawing pixmap */ draw_pix = XCreatePixmap(display, draw_wnd, width, height, depth); /* create a pixmap for saving current slide */ current_pix = XCreatePixmap(display, draw_wnd, width, height, depth); /* create a pixmap for saving previous slide */ prev_pix = XCreatePixmap(display, draw_wnd, width, height, depth); gc = XCreateGC(display, display_wnd, 0, NULL); HideDecorations(display_wnd); XStoreName(display, display_wnd, filename); XMapWindow(display, display_wnd); XSelectInput(display, display_wnd, KeyPressMask | ButtonPressMask | ButtonReleaseMask | ExposureMask); ProcessEvents(); if (override_redirect) XSetInputFocus(display, display_wnd, RevertToParent, CurrentTime); else XMoveWindow(display, display_wnd, 0, 0); gs_fd = GSStart(draw_wnd, draw_pix, width, height, bounds, orientation); /* start off with prologue and page 1 */ page_start = document; page_end = pages[1].data; MainLoop(gs_fd); GSStop(gs_fd); /* clean up */ XFreeGC(display, gc); XFreePixmap(display, prev_pix); XFreePixmap(display, current_pix); XFreePixmap(display, draw_pix); XDestroyWindow(display, draw_wnd); XDestroyWindow(display, display_wnd); XCloseDisplay(display); munmap(document, size); return EXIT_SUCCESS; } pspresent-1.3/pspresent.h0000600000353100035310000000336610405773657017262 0ustar matthewcmatthewc00000000000000/* pspresent: PostScript presentation tool Copyright (C) Matthew Chapman 2001-2004 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #define VERSION "1.3" struct pspage { char *data; int is_last; /* Last in a series of overlays */ }; enum Orientation { Portrait = 0, Landscape = 90, UpsideDown = 180, Seascape = 270 }; #define MWM_HINTS_DECORATIONS (1L << 1) typedef struct { unsigned long flags; unsigned long functions; unsigned long decorations; long inputMode; unsigned long status; } PropMotifWmHints; /* ps.c */ Bool PSScanDocument(char *start, char *end, int bounds[4], int *orientation, int *num_pages, struct pspage **page_offsets, int *num_real_pages, int **real_page_offsets); Bool PSGetOrientation(char *string, int *orientation); /* gs.c */ int GSStart(Window draw_wnd, Pixmap draw_pix, int wnd_width, int wnd_height, int bounds[4], int orientation); char *GSWrite(int gs_fd, char *start, char *end); void GSStop(int gs_fd); void GSNextPage(void); Bool GSProcessMessage(XClientMessageEvent *message); pspresent-1.3/COPYING0000600000353100035310000004307607666403454016123 0ustar matthewcmatthewc00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. pspresent-1.3/pspresent.10000600000353100035310000000543207666601424017164 0ustar matthewcmatthewc00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH PSPRESENT 1 "June 2, 2003" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME pspresent \- fullscreen PostScript presentation tool .SH SYNOPSIS .B pspresent .RI [ options ] " file.ps" .SH DESCRIPTION .B pspresent is a tool that displays PostScript slides in fullscreen, for giving presentations. Navigation is simple, and the display is double-buffered for seamless transitions between slides. The actual rendering is done in the background using Ghostscript. .SH OPTIONS .TP .B \-h Show summary of options. .TP .B \-o Do not override window manager. .B pspresent will attempt to disable decorations and resize itself to the size of the screen, but will otherwise co-operate with your window manager (which may mean that it is not truly fullscreen). .TP .B \-s Limit .B pspresent to only use the given head on a XINERAMA display. .TP .BI "\-O " Portrait | Landscape | Upside-Down | Seascape Override orientation. .SH COMMANDS The following keys can be used from within .B pspresent to navigate the slides. If Shift is depressed, then only the last page of each series of overlays is shown (an overlay set is identified as a series of pages with the same logical page number). .TP .B spacebar .TP .B page down .TP .B right arrow .TP .B down arrow Move to the next slide. If Shift is depressed, skips overlays. .TP .B backspace .TP .B page up .TP .B left arrow .TP .B up arrow Move to the previous slide. If Shift is depressed, skips overlays. .TP .B home Warp to the start of the presentation. .TP .B end Warp to the end of the preesentation. .TP .I number .B enter Warp to slide .IR number . .TP .B escape .TP .B q Quit the program. .PP The mouse buttons can also be used to navigate through a presentation. .TP .B left button Move to the next slide. .TP .B middle button Quit the program. .TP .B right button Move to the previous slide. .LP If Shift is used together together with the navigation keys or buttons, then only the last page of each series of overlays is shown (an overlay set is identified as a series of pages with the same logical page number). .SH AUTHOR .B pspresent was written by Matt Chapman This manual page was originally written by Jamie Wilkinson .