Fix Makefile.am for correct run 'make dist' command
[midnight-commander.git] / edit / edit-widget.h
blob327a2dca2fd68b0c6efed67bf7f80441a915173f
2 /** \file
3 * \brief Header: editor widget WEdit
4 */
6 #ifndef MC_EDIT_WIDGET_H
7 #define MC_EDIT_WIDGET_H
9 #include "../src/dialog.h" /* Widget */
10 #include "../src/search/search.h" /* mc_search_t */
12 #include "edit-impl.h"
13 #include "../src/keybind.h"
16 #define MAX_MACRO_LENGTH 1024
17 #define N_LINE_CACHES 32
19 #define BOOK_MARK_COLOR ((25 << 8) | 5)
20 #define BOOK_MARK_FOUND_COLOR ((26 << 8) | 4)
22 struct _book_mark {
23 int line; /* line number */
24 int c; /* color */
25 struct _book_mark *next;
26 struct _book_mark *prev;
29 struct syntax_rule {
30 unsigned short keyword;
31 unsigned char end;
32 unsigned char context;
33 unsigned char _context;
34 unsigned char border;
37 struct WEdit {
38 Widget widget;
40 int num_widget_lines;
41 int num_widget_columns;
43 char *filename; /* Name of the file */
44 char *dir; /* NULL if filename is absolute */
46 /* dynamic buffers and cursor position for editor: */
47 long curs1; /* position of the cursor from the beginning of the file. */
48 long curs2; /* position from the end of the file */
49 unsigned char *buffers1[MAXBUFF + 1]; /* all data up to curs1 */
50 unsigned char *buffers2[MAXBUFF + 1]; /* all data from end of file down to curs2 */
52 /* UTF8 */
53 char charbuf[4 + 1];
54 int charpoint;
55 /* search variables */
56 mc_search_t *search;
58 unsigned int search_type;
59 int replace_mode;
60 int replace_backwards;
61 int replace_case;
62 int only_in_selection;
63 int whole_words;
64 int all_codepages;
66 long search_start; /* First character to start searching from */
67 int found_len; /* Length of found string or 0 if none was found */
68 long found_start; /* the found word from a search - start position */
70 /* display information */
71 long last_byte; /* Last byte of file */
72 long start_display; /* First char displayed */
73 long start_col; /* First displayed column, negative */
74 long max_column; /* The maximum cursor position ever reached used to calc hori scroll bar */
75 long curs_row; /* row position of cursor on the screen */
76 long curs_col; /* column position on screen */
77 long over_col; /* pos after '\n' */
78 int force; /* how much of the screen do we redraw? */
79 unsigned int overwrite:1; /* Overwrite on type mode (as opposed to insert) */
80 unsigned int modified:1; /* File has been modified and needs saving */
81 unsigned int loading_done:1;/* File has been loaded into the editor */
82 unsigned int locked:1; /* We hold lock on current file */
83 unsigned int screen_modified:1; /* File has been changed since the last screen draw */
84 unsigned int delete_file:1; /* New file, needs to be deleted unless modified */
85 unsigned int highlight:1; /* There is a selected block */
86 unsigned int utf8:1; /* It's multibyte file codeset */
87 long prev_col; /* recent column position of the cursor - used when moving
88 up or down past lines that are shorter than the current line */
89 long curs_line; /* line number of the cursor. */
90 long start_line; /* line number of the top of the page */
92 /* file info */
93 long total_lines; /* total lines in the file */
94 long mark1; /* position of highlight start */
95 long mark2; /* position of highlight end */
96 int column1; /* position of column highlight start */
97 int column2; /* position of column highlight end */
98 long bracket; /* position of a matching bracket */
100 /* cache speedup for line lookups */
101 int caches_valid;
102 int line_numbers[N_LINE_CACHES];
103 long line_offsets[N_LINE_CACHES];
105 struct _book_mark *book_mark;
107 /* undo stack and pointers */
108 unsigned long stack_pointer;
109 long *undo_stack;
110 unsigned long stack_size;
111 unsigned long stack_size_mask;
112 unsigned long stack_bottom;
113 unsigned int stack_disable:1; /* If not 0, don't save events in the undo stack */
115 struct stat stat1; /* Result of mc_fstat() on the file */
116 unsigned int skip_detach_prompt:1; /* Do not prompt whether to detach a file anymore */
118 /* syntax higlighting */
119 struct _syntax_marker *syntax_marker;
120 struct context_rule **rules;
121 long last_get_rule;
122 struct syntax_rule rule;
123 char *syntax_type; /* description of syntax highlighting type being used */
124 GTree *defines; /* List of defines */
126 /* macro stuff */
127 int macro_i; /* index to macro[], -1 if not recording a macro */
128 int macro_depth; /* depth of the macro recursion */
129 struct macro macro[MAX_MACRO_LENGTH];
131 /* user map stuff */
132 GIConv converter;
133 const global_key_map_t *user_map;
134 const global_key_map_t *ext_map;
136 /* line break */
137 LineBreaks lb;
138 int extmod;
140 char *labels[10];
144 #endif /* MC_EDIT_WIDGET_H */