1
2
3
4
5 #ifndef MC__EDIT_WIDGET_H
6 #define MC__EDIT_WIDGET_H
7
8 #include <limits.h>
9
10 #include "lib/search.h"
11 #include "lib/widget.h"
12
13 #include "edit-impl.h"
14 #include "editbuffer.h"
15
16
17
18 #define N_LINE_CACHES 32
19
20
21
22
23
24 typedef struct edit_book_mark_t edit_book_mark_t;
25 struct edit_book_mark_t
26 {
27 long line;
28 int c;
29 edit_book_mark_t *next;
30 edit_book_mark_t *prev;
31 };
32
33 typedef struct edit_syntax_rule_t edit_syntax_rule_t;
34 struct edit_syntax_rule_t
35 {
36 unsigned short keyword;
37 off_t end;
38 unsigned char context;
39 unsigned char _context;
40 unsigned char border;
41 };
42
43
44
45
46
47
48
49 typedef enum
50 {
51 MCEDIT_DRAG_NONE = 0,
52 MCEDIT_DRAG_MOVE,
53 MCEDIT_DRAG_RESIZE
54 } mcedit_drag_state_t;
55
56 struct WEdit
57 {
58 Widget widget;
59 mcedit_drag_state_t drag_state;
60 int drag_state_start;
61
62
63 WRect loc_prev;
64
65 vfs_path_t *filename_vpath;
66 vfs_path_t *dir_vpath;
67
68
69 edit_buffer_t buffer;
70
71
72 gboolean utf8;
73 GIConv converter;
74 char charbuf[MB_LEN_MAX + 1];
75 int charpoint;
76
77
78 mc_search_t *search;
79 int replace_mode;
80
81 mc_search_line_t search_line_type;
82
83 char *last_search_string;
84 off_t search_start;
85 unsigned long found_len;
86 off_t found_start;
87
88
89 long start_display;
90 long start_col;
91 long curs_row;
92 long curs_col;
93 long over_col;
94 int force;
95 unsigned int overwrite : 1;
96 unsigned int modified : 1;
97 unsigned int loading_done : 1;
98 unsigned int locked : 1;
99 unsigned int delete_file : 1;
100 unsigned int highlight : 1;
101 unsigned int column_highlight : 1;
102 unsigned int fullscreen : 1;
103 long prev_col;
104
105 long start_line;
106
107
108 off_t mark1;
109 off_t mark2;
110 off_t end_mark_curs;
111 long column1;
112 long column2;
113 off_t bracket;
114 off_t last_bracket;
115
116
117 gboolean caches_valid;
118 long line_numbers[N_LINE_CACHES];
119 off_t line_offsets[N_LINE_CACHES];
120
121 edit_book_mark_t *book_mark;
122 GArray *serialized_bookmarks;
123
124
125 unsigned long undo_stack_pointer;
126 long *undo_stack;
127 unsigned long undo_stack_size;
128 unsigned long undo_stack_size_mask;
129 unsigned long undo_stack_bottom;
130 unsigned int undo_stack_disable : 1;
131
132 unsigned long redo_stack_pointer;
133 long *redo_stack;
134 unsigned long redo_stack_size;
135 unsigned long redo_stack_size_mask;
136 unsigned long redo_stack_bottom;
137 unsigned int redo_stack_reset : 1;
138
139 struct stat stat1;
140 unsigned long attrs;
141 gboolean attrs_ok;
142
143 unsigned int skip_detach_prompt : 1;
144
145
146 GSList *syntax_marker;
147 GPtrArray *rules;
148 off_t last_get_rule;
149 edit_syntax_rule_t rule;
150 char *syntax_type;
151 GTree *defines;
152 gboolean is_case_insensitive;
153
154
155 LineBreaks lb;
156 };
157
158
159
160
161
162
163 #endif