2005-09-15 09:58:31 -04:00
|
|
|
#ifndef EL__DOCUMENT_OPTIONS_H
|
|
|
|
#define EL__DOCUMENT_OPTIONS_H
|
|
|
|
|
2007-08-28 15:16:44 -04:00
|
|
|
#include "document/format.h"
|
2005-09-15 09:58:31 -04:00
|
|
|
#include "terminal/color.h"
|
|
|
|
#include "util/color.h"
|
|
|
|
#include "util/box.h"
|
|
|
|
|
|
|
|
struct session;
|
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** Active link coloring options */
|
2007-10-12 06:37:28 -04:00
|
|
|
struct active_link_options_colors {
|
|
|
|
color_T foreground;
|
|
|
|
color_T background;
|
|
|
|
};
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
struct active_link_options {
|
2007-10-12 06:19:27 -04:00
|
|
|
unsigned int enable_color:1;
|
2005-09-15 09:58:31 -04:00
|
|
|
unsigned int underline:1;
|
|
|
|
unsigned int bold:1;
|
|
|
|
unsigned int invert:1;
|
2007-10-12 06:37:28 -04:00
|
|
|
struct active_link_options_colors color;
|
2005-09-15 09:58:31 -04:00
|
|
|
};
|
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** This mostly acts as a option cache so rendering will be faster. However it
|
2005-09-15 09:58:31 -04:00
|
|
|
* is also used to validate and invalidate documents in the format cache as to
|
|
|
|
* whether they satisfy the current state of the document options. */
|
2007-10-12 06:37:28 -04:00
|
|
|
struct document_options_colors {
|
|
|
|
color_T link;
|
|
|
|
color_T vlink;
|
|
|
|
#ifdef CONFIG_BOOKMARKS
|
|
|
|
color_T bookmark_link;
|
|
|
|
#endif
|
|
|
|
color_T image_link;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct document_options_image_link {
|
|
|
|
unsigned char *prefix;
|
|
|
|
unsigned char *suffix;
|
|
|
|
int filename_maxlen;
|
|
|
|
int label_maxlen;
|
|
|
|
int display_style;
|
|
|
|
int tagging;
|
|
|
|
unsigned int show_any_as_links:1;
|
|
|
|
};
|
|
|
|
|
2005-09-15 09:58:31 -04:00
|
|
|
struct document_options {
|
|
|
|
enum color_mode color_mode;
|
2007-07-27 12:45:02 -04:00
|
|
|
/** cp is the codepage for which the document is being formatted;
|
2007-04-29 14:28:40 -04:00
|
|
|
* typically it is the codepage of a terminal. It is set in
|
2007-07-27 12:45:02 -04:00
|
|
|
* render_document_frames(). */
|
2005-09-15 09:58:31 -04:00
|
|
|
int cp, assume_cp, hard_assume;
|
|
|
|
int margin;
|
|
|
|
int num_links_key;
|
|
|
|
int use_document_colors;
|
|
|
|
int meta_link_display;
|
|
|
|
int default_form_input_size;
|
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** @name The default (fallback) colors.
|
|
|
|
* @{ */
|
2007-08-28 15:16:44 -04:00
|
|
|
struct text_style default_style;
|
2007-10-12 06:37:28 -04:00
|
|
|
struct document_options_colors default_color;
|
2007-07-27 12:45:02 -04:00
|
|
|
/** @} */
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** Color model/optimizations */
|
2005-09-15 09:58:31 -04:00
|
|
|
enum color_flags color_flags;
|
|
|
|
|
|
|
|
/* XXX: Keep boolean options grouped to save padding */
|
|
|
|
#ifdef CONFIG_CSS
|
2007-07-27 12:45:02 -04:00
|
|
|
/** @name CSS stuff
|
|
|
|
* @{ */
|
2005-09-15 09:58:31 -04:00
|
|
|
unsigned int css_enable:1;
|
|
|
|
unsigned int css_import:1;
|
2007-07-27 12:45:02 -04:00
|
|
|
/** @} */
|
2005-09-15 09:58:31 -04:00
|
|
|
#endif
|
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** @name HTML stuff
|
|
|
|
* @{ */
|
2005-09-15 09:58:31 -04:00
|
|
|
unsigned int tables:1;
|
|
|
|
unsigned int table_order:1;
|
|
|
|
unsigned int frames:1;
|
|
|
|
unsigned int images:1;
|
|
|
|
|
|
|
|
unsigned int display_subs:1;
|
|
|
|
unsigned int display_sups:1;
|
|
|
|
unsigned int underline_links:1;
|
|
|
|
|
|
|
|
unsigned int wrap_nbsp:1;
|
2007-07-27 12:45:02 -04:00
|
|
|
/** @} */
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** @name Plain rendering stuff
|
|
|
|
* @{ */
|
2005-09-15 09:58:31 -04:00
|
|
|
unsigned int plain_display_links:1;
|
|
|
|
unsigned int plain_compress_empty_lines:1;
|
2007-07-27 12:45:02 -04:00
|
|
|
/** @} */
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** @name Link navigation
|
|
|
|
* @{ */
|
2005-09-15 09:58:31 -04:00
|
|
|
unsigned int links_numbering:1;
|
|
|
|
unsigned int use_tabindex:1;
|
2007-07-27 12:45:02 -04:00
|
|
|
/** @} */
|
2005-09-15 09:58:31 -04:00
|
|
|
|
|
|
|
unsigned int plain:1;
|
|
|
|
unsigned int wrap:1;
|
|
|
|
|
|
|
|
/* XXX: Everything past this comment is specialy handled by compare_opt() */
|
|
|
|
unsigned char *framename;
|
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** The location of the window in which the document is rendered.
|
2005-09-15 09:58:31 -04:00
|
|
|
*
|
2007-07-27 12:45:02 -04:00
|
|
|
* <dl>
|
|
|
|
* <dt>The position of the window (box.x and box.y)
|
|
|
|
*
|
|
|
|
* <dd>This is not compared at all since it doesn't make any
|
2005-09-15 09:58:31 -04:00
|
|
|
* difference what position the document will fit into a frameset
|
|
|
|
* or so.
|
|
|
|
*
|
2007-07-27 12:45:02 -04:00
|
|
|
* <dt>The width of the window (box.width)
|
2005-09-15 09:58:31 -04:00
|
|
|
*
|
2007-07-27 12:45:02 -04:00
|
|
|
* <dd>This controls how wide tables can be rendered and so on. It is
|
2005-09-15 09:58:31 -04:00
|
|
|
* thus also to blame for the extra memory consumption when
|
|
|
|
* resizing because all documents has to be rerendered. We only
|
2007-07-27 12:45:02 -04:00
|
|
|
* need to compare it if not #plain.
|
2005-09-15 09:58:31 -04:00
|
|
|
*
|
2007-07-27 12:45:02 -04:00
|
|
|
* <dt>The height of the window (box.height)
|
2005-09-15 09:58:31 -04:00
|
|
|
*
|
2007-07-27 12:45:02 -04:00
|
|
|
* <dd>Only documents containing textarea or frames uses it and we
|
|
|
|
* only compare it if #needs_height is set.
|
|
|
|
* </dl> */
|
2005-09-15 09:58:31 -04:00
|
|
|
struct box box;
|
|
|
|
unsigned int needs_height:1;
|
|
|
|
unsigned int needs_width:1;
|
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** Internal flag for rerendering */
|
2005-09-15 09:58:31 -04:00
|
|
|
unsigned int no_cache:1;
|
|
|
|
unsigned int gradual_rerendering:1;
|
|
|
|
|
2006-09-17 09:12:47 -04:00
|
|
|
#ifdef CONFIG_UTF8
|
2006-07-19 20:03:25 -04:00
|
|
|
unsigned int utf8:1;
|
2006-09-17 09:12:47 -04:00
|
|
|
#endif /* CONFIG_UTF8 */
|
2007-07-27 12:45:02 -04:00
|
|
|
/** Active link coloring.
|
|
|
|
* This is mostly here to make use of this option cache so
|
|
|
|
* link drawing is faster. --jonas */
|
2005-09-15 09:58:31 -04:00
|
|
|
struct active_link_options active_link;
|
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** Options related with IMG tag */
|
2007-10-12 06:37:28 -04:00
|
|
|
struct document_options_image_link image_link;
|
2005-09-15 09:58:31 -04:00
|
|
|
};
|
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** Fills the structure with values from the option system.
|
|
|
|
* @relates document_options */
|
2007-08-28 12:41:18 -04:00
|
|
|
void init_document_options(struct session *ses, struct document_options *doo);
|
2005-09-15 09:58:31 -04:00
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** Free allocated document options.
|
|
|
|
* @relates document_options */
|
2005-09-15 09:58:31 -04:00
|
|
|
void done_document_options(struct document_options *options);
|
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** Copies the values of one struct @a from to the other @a to.
|
|
|
|
* Note that the document_options.framename is dynamically allocated.
|
|
|
|
* @relates document_options */
|
2005-09-15 09:58:31 -04:00
|
|
|
void copy_opt(struct document_options *to, struct document_options *from);
|
|
|
|
|
|
|
|
/* Compares comparable values from the two structures according to
|
2007-07-27 12:45:02 -04:00
|
|
|
* the comparable members described in the struct definition.
|
|
|
|
* @relates document_options */
|
2005-09-15 09:58:31 -04:00
|
|
|
int compare_opt(struct document_options *o1, struct document_options *o2);
|
|
|
|
|
|
|
|
#define use_document_fg_colors(o) \
|
|
|
|
((o)->color_mode != COLOR_MODE_MONO && (o)->use_document_colors >= 1)
|
|
|
|
|
|
|
|
#define use_document_bg_colors(o) \
|
|
|
|
((o)->color_mode != COLOR_MODE_MONO && (o)->use_document_colors == 2)
|
|
|
|
|
2007-07-27 12:45:02 -04:00
|
|
|
/** Increments the numeric value of the option identified by @a option_name,
|
2005-09-15 09:58:31 -04:00
|
|
|
* resetting it to the minimum value when it is already at the maximum value,
|
|
|
|
* and redraws the document. */
|
|
|
|
void toggle_document_option(struct session *ses, unsigned char *option_name);
|
|
|
|
|
|
|
|
#endif
|