/*   Cataract - Static web photo gallery generator
 *   Copyright (C) 2008 Tomas Bzatek <tbzatek@users.sourceforge.net>
 *
 *   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 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
#ifndef __CGG__SETUP_H__
#define __CGG__SETUP_H__

#include <glib.h>

G_BEGIN_DECLS


/*  Directory names  */
#define DEFAULT_THUMBNAIL_DIR "_thumb"
#define DEFAULT_IMG_BIG_DIR "_big"
#define DEFAULT_IMG_ORIG_DIR "_orig"
#define DEFAULT_THUMBNAIL_NAME_FORMAT "thn_%d_%s"

#define SETUP_XML "setup.xml"
#define DEFAULT_INDEX_FILENAME "index.html"


typedef enum {
  THUMBNAIL_SQUARE_TYPE_NONE,
  THUMBNAIL_SQUARE_TYPE_SIMPLE
} ThumbnailSquareType;


/*  Global gallery setup  */
typedef struct {
  gboolean verbose;
  gboolean update_mode;
  gchar *real_templates_dir;

  gchar *setup_xml_path;

  gchar *templates_path;
  gchar *template_index;
  gchar *template_album;
  gchar *template_photo;
  gchar **template_files;
  gboolean support_files_use_common_root;
  gchar *index_file_name;
  gchar *thumbnail_dir;
  gchar *img_big_dir;
  gchar *img_orig_dir;
  gchar *thumbnail_name_format;
  ThumbnailSquareType squared_thumbnail_type;

  gchar *footer;
  gchar *meta_author;
  gchar *meta_author_email;
  gchar *meta_description;
  gchar *meta_keywords;
  gboolean use_title_as_meta;

  int thumbnail_quality;
  unsigned long thumbnail_landscape_width;
  unsigned long thumbnail_landscape_height;
  unsigned long thumbnail_portrait_width;
  unsigned long thumbnail_portrait_height;
  unsigned long thumbnail_square_size;

  int preview_quality;
  unsigned long preview_landscape_width;
  unsigned long preview_landscape_height;
  unsigned long preview_portrait_width;
  unsigned long preview_portrait_height;

  gchar *border_style;
  gboolean nofullsize;
  gboolean override_nofullsize;

  gboolean preload;
  gboolean use_iptc_exif;
  gboolean erase_exif_thumbnail;

  gchar *site_title;
  gchar *add_copyright;
  gboolean use_inpage_links;
  gboolean show_go_up;
  gboolean show_exif_table;

  gchar *favicon_file;
  gchar *favicon_type;

  gboolean feed_enabled;
  gchar *feed_filename;
  gchar *feed_title;
  gchar *feed_base_url;
} TGallerySetup;



/*
 *   find_setup_xml: try to find setup.xml in standard paths
 */
TGallerySetup * find_setup_xml ();

/*
 *   parse_setup_xml: XML parser for setup.xml file
 */
TGallerySetup * parse_setup_xml (const gchar *filename);

/*
 *   free_setup_data: free allocated setup data
 */
void free_setup_data (TGallerySetup *setup);

/*
 *   find_templates_directory: absolute/relative path checks, trying to find templates directory
 *                             - returned string should be freed
 */
gchar * find_templates_directory (TGallerySetup *setup);


G_END_DECLS

#endif /* __CGG__SETUP_H__ */
