/******************************************************************************
 * Steve Rider - stever@transmission23.com
 * QuickPics
 *   Image galleries for the web made easy
 *
 * qp.h - main header
 *
 *****************************************************************************/
/* 17 February 98 */

#ifndef QP_H
#define QP_H

#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif

#if defined(__hpux)
#define _HPUX_SOURCE 1
#endif

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include <math.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>

#define True 1
#define False 0

#ifndef u_short
#define u_short unsigned short
#endif
#ifndef u_char
#define u_char unsigned char
#endif
#ifndef u_int
#define u_int unsigned int
#endif
#ifndef u_long
#define u_long unsigned long
#endif

#define DEFAULTCONFIGFILE "qp.rc"
#define MAXTEXTLEN 2048
#define MAXFILENAMELEN 256
#define ReadBinaryType "rb"
#define WriteBinaryType "wb"
#define DOTSPERLINE 40

/* Type defines */
typedef struct dirrec_node dirrec;
typedef struct imgrec_node imgrec;

/* Let all files who need QuickPics have access to the QuickPics object */
extern struct QP_object QP;



/*****************************************************************************/
/* object QP declaration */
typedef struct QP_object {

	/* Config entries */
	int	quiet_level;
	int	prompt_for_description;
	int	prompt_for_date;
	int	prompt_for_thumbnail_creation;
	int	write_thumbnails;

	/* Footer */
	char	footer[MAXTEXTLEN];
	int	footersize;
	char	footerfont[256];
	char	footercolor[256];
	int	footerbold;
	int	footeritalic;

	/* Filename properties */
	char	index_html[MAXFILENAMELEN];
	char	folder_configfile[MAXFILENAMELEN];
	char	thumbnail_identifier[40];
	char	description_extension[40];

	/* Global thumbnail settings */
	int	thumbnailsize;
	int	max_width;
	int	quality;
	char	page_width[40];
	int	picture_width;
	int	prev_next_thumbnails;


	/* Root properties */
	int	root_write_toolbar;

	char	root_bgcolor[40];
	char	root_textcolor[40];
	char	root_linkcolor[40];
	char	root_vlinkcolor[40];
	char	root_alinkcolor[40];

	/* Root title */
	int	root_titlesize;
	char	root_titlefont[256];
	char	root_titlecolor[256];
	int	root_titlebold;
	int	root_titleitalic;

	/* Root description */
	int	root_headingsize;
	char	root_headingfont[256];
	char	root_headingcolor[256];
	int	root_headingbold;
	int	root_headingitalic;

	/* Root folder properties */
	int	root_propertiessize;
	char	root_propertiesfont[256];
	char	root_propertiescolor[256];
	int	root_propertiesbold;
	int	root_propertiesitalic;

	/* Root foldername */
	int	root_foldernamesize;
	char	root_foldernamefont[256];
	char	root_foldernamecolor[256];
	int	root_foldernamebold;
	int	root_foldernameitalic;

	/* Root table properties */
	int	root_border;
	int	root_cols;
	int	root_pictureborder;

	/* Root thumbnail descriptions */
	int	root_descsize;
	char	root_descfont[256];
	char	root_desccolor[256];
	int	root_descbold;
	int	root_descitalic;


	/* Index properties */
	int	index_write_toolbar;

	char	index_bgcolor[40];
	char	index_textcolor[40];
	char	index_linkcolor[40];
	char	index_vlinkcolor[40];
	char	index_alinkcolor[40];

	/* Index title */
	int	index_titlesize;
	char	index_titlefont[256];
	char	index_titlecolor[256];
	int	index_titlebold;
	int	index_titleitalic;

	/* Index folder description */
	int	index_headingsize;
	char	index_headingfont[256];
	char	index_headingcolor[256];
	int	index_headingbold;
	int	index_headingitalic;

	/* Index folder properties */
	int	index_propertiessize;
	char	index_propertiesfont[256];
	char	index_propertiescolor[256];
	int	index_propertiesbold;
	int	index_propertiesitalic;

	/* Index table properties */
	int	index_border;
	int	index_cols;
	int	index_pictureborder;

	/* Index thumbnail descriptions */
	int	index_descsize;
	char	index_descfont[256];
	char	index_desccolor[256];
	int	index_descbold;
	int	index_descitalic;


	/* Pic properties */
	int	pic_write_toolbar;

	char	pic_bgcolor[40];
	char	pic_textcolor[40];
	char	pic_linkcolor[40];
	char	pic_vlinkcolor[40];
	char	pic_alinkcolor[40];
	
	/* Pic title */
	int	pic_titlesize;
	char	pic_titlefont[256];
	char	pic_titlecolor[256];
	int	pic_titlebold;
	int	pic_titleitalic;

	/* Pic image descriptions */
	int	pic_descsize;
	char	pic_descfont[256];
	char	pic_desccolor[256];
	int	pic_descbold;
	int	pic_descitalic;



	/* Internal settings */
	int	write_new_config;
	int	override_quiet;
	int	override_description;
	int	override_date;
	int	override_thumbnail;
	char	rootdir[MAXFILENAMELEN];
	char	configfile[MAXFILENAMELEN];
	char	copyright[256];
	char	build[25];

} QP_ob;

/*****************************************************************************/
/* Config read routines */
void	QP_Init();
int	QP_ReadConfig();
int	QP_SetVar(int line, char *n, char *v);
void	QP_WriteConfig();


#endif /* QP_H */
