1 #ifndef EL__DOCUMENT_OPTIONS_H
2 #define EL__DOCUMENT_OPTIONS_H
4 #include "terminal/color.h"
5 #include "util/color.h"
10 /* Active link coloring options */
11 struct active_link_options
{
13 unsigned int underline
:1;
15 unsigned int invert
:1;
20 /* This mostly acts as a option cache so rendering will be faster. However it
21 * is also used to validate and invalidate documents in the format cache as to
22 * whether they satisfy the current state of the document options. */
23 struct document_options
{
24 enum color_mode color_mode
;
25 int cp
, assume_cp
, hard_assume
;
28 int use_document_colors
;
29 int meta_link_display
;
30 int default_form_input_size
;
32 /* The default (fallback) colors. */
36 color_T default_vlink
;
37 #ifdef CONFIG_BOOKMARKS
38 color_T default_bookmark_link
;
40 color_T default_image_link
;
42 /* Color model/optimizations */
43 enum color_flags color_flags
;
45 /* XXX: Keep boolean options grouped to save padding */
48 unsigned int css_enable
:1;
49 unsigned int css_import
:1;
53 unsigned int tables
:1;
54 unsigned int table_order
:1;
55 unsigned int frames
:1;
56 unsigned int images
:1;
58 unsigned int display_subs
:1;
59 unsigned int display_sups
:1;
60 unsigned int underline_links
:1;
62 unsigned int wrap_nbsp
:1;
64 /* Plain rendering stuff */
65 unsigned int plain_display_links
:1;
66 unsigned int plain_compress_empty_lines
:1;
69 unsigned int links_numbering
:1;
70 unsigned int use_tabindex
:1;
76 /* XXX: Everything past this comment is specialy handled by compare_opt() */
77 unsigned char *framename
;
79 /* The position of the window (box.x and box.y)
81 * This is not compared at all since it doesn't make any
82 * difference what position the document will fit into a frameset
85 * The width of the window (box.width)
87 * This controls how wide tables can be rendered and so on. It is
88 * thus also to blame for the extra memory consumption when
89 * resizing because all documents has to be rerendered. We only
90 * need to compare it if not @plain.
92 * The height of the window (box.height)
94 * Only documents containing textarea or frames uses it and we
95 * only compare it if @needs_height is set.
98 unsigned int needs_height
:1;
99 unsigned int needs_width
:1;
101 /* Internal flag for rerendering */
102 unsigned int no_cache
:1;
103 unsigned int gradual_rerendering
:1;
105 /* Active link coloring */
106 /* This is mostly here to make use of this option cache so link
107 * drawing is faster. --jonas */
108 struct active_link_options active_link
;
110 /* Options related with IMG tag */
112 unsigned char *prefix
;
113 unsigned char *suffix
;
118 unsigned int show_any_as_links
:1;
122 /* Fills the structure with values from the option system. */
123 void init_document_options(struct document_options
*doo
);
125 /* Free allocated document options. */
126 void done_document_options(struct document_options
*options
);
128 /* Copies the values of one struct @from to the other @to.
129 * Note that the framename is dynamically allocated. */
130 void copy_opt(struct document_options
*to
, struct document_options
*from
);
132 /* Compares comparable values from the two structures according to
133 * the comparable members described in the struct definition. */
134 int compare_opt(struct document_options
*o1
, struct document_options
*o2
);
136 #define use_document_fg_colors(o) \
137 ((o)->color_mode != COLOR_MODE_MONO && (o)->use_document_colors >= 1)
139 #define use_document_bg_colors(o) \
140 ((o)->color_mode != COLOR_MODE_MONO && (o)->use_document_colors == 2)
142 /* Increments the numeric value of the option identified by option_name,
143 * resetting it to the minimum value when it is already at the maximum value,
144 * and redraws the document. */
145 void toggle_document_option(struct session
*ses
, unsigned char *option_name
);