/*
 *	$Source: /u1/X/xman/RCS/xman.h,v $
 *	$Header: xman.h,v 1.3 87/02/03 15:36:44 swick Exp $
 */

#include <stdio.h>
#include <X/Xlib.h>
#include <Sx/sx.h>

#include <sys/types.h>
#include <sys/dir.h>
#include <sys/stat.h>

#include "config.h"
#include "copyright.h"

/*
 * Our name, for errors and defaults (derived from argv[0])
 */
char *prog;

/*
 * How we store each entry such as cat.1, sh.1 etc.
 */
struct entry {
  char *label;
/* I keep thinking I may need something here eventually */
};

/*
 * The manual sections and entries
 */
struct manual {
  char *cat;		/* if we have the cat dir, else NULL */
  char *man;		/* the manx dir */
  struct entry *entries;/* the individual man page file names */
  int nentries;		/* how many */
  int longest;		/* we need to know the longest name for formatting */
  /*
   * All entries are formatted to the screen as equal sized
   * fields so it's easy to use it like a menu.
   */
  short int width, height, startx, starty, ncols, colpad;
} manual[MAXSECT];
int nmanual;		/* how many manual sections we found */

FILE *manfp;		/* current open manual page (NULL if none) */

int section;		/* section they chose from menu */
int manualing;		/* are we displaying a manual page or menu? */
long pagetell[MAXPAGES];	/* stack of page seek offsets */
int curpage;		/* stack index */

Window w;		/* the main working X-window object */
WindowInfo w_info;	/* result of doing a query on w */
Window title;		/* Top title subwindow */
WindowInfo title_info;	/* result of querying title subwindow */

FontInfo *titlefont;	/* font to use on title (see config.h) */
int titleheight;	/* to help offset into text page */

FontInfo *menufont;	/* font to use for pull-downs (see config.h) */

/*
 * The text body fonts for man pages, menus also. See config.h for defaults.
 */
FontInfo *bodynormal, *bodyitalic, *bodybold;

int bodyheight;		/* height for offsetting lines */

Pixmap bg, fg;		/* Background/Foreground for text window */

FILE *errorfp;		/* where to send error msgs (stderr) */

void ReDisplayProc(), SectionsProc(), MyButtonProc();
void IconifyProc();
char *stralloc(), *rindex();

int minrow;		/* where to start writing text (see config.h)*/
int mincol;

Window menubar, sectionMenu;
WindowInfo menubar_info;

/*
 * The manual sections manual is dynamically allocated, see
 * also the sectionName stuff in config.h
 */
Sx_MenuEntry *sections;
int nsections;

/*
 * If we only have the man section (no preformat) we need to
 * put it into a temp file
 */
char mantmp[128];

Cursor xman_cursor, xpage_cursor;
Window xicon;
void ReIconProc();
Cursor xicon_cursor;

/*
 * The options menu
 */
void Apropos(), Finis();
/*
 * The command to invoke for apropos, perhaps 'man -k'? Could
 * just re-write, it's a simple algorithm.
 */
#define APROPOS "apropos"
/*
 * The command to use as a filter to make apropos look paginated
 */
#define APROPOSFILTER "pr -h Apropos"
/*
 * size of type-in window
 */
#define APROPOSLEN 40

extern Sx_MenuEntry options[];	/* in extern.c */
/*
 * Number of elements in options menu
 */
#define NOPTIONS 2
#define NINFO 2

extern Sx_MenuEntry info[];	/* in extern.c */
Window infoMenu;
void Author(), Help();

Window optionsMenu;
char *DialogueBox();

