This source file includes following definitions.
- panel_empty_new
- panel_with_dir_new
- panel_new
- panel_sized_new
1
2
3
4
5 #ifndef MC__PANEL_H
6 #define MC__PANEL_H
7
8 #include <inttypes.h>
9 #include <limits.h>
10
11 #include "lib/global.h"
12 #include "lib/fs.h"
13 #include "lib/strutil.h"
14 #include "lib/widget.h"
15 #include "lib/filehighlight.h"
16 #include "lib/file-entry.h"
17
18 #include "dir.h"
19
20
21
22 #define PANEL(x) ((WPanel *) (x))
23
24 #define LIST_FORMATS 4
25
26 #define UP_KEEPSEL ((char *) -1)
27
28
29
30 typedef enum
31 {
32 list_full,
33 list_brief,
34 list_long,
35 list_user
36 } list_format_t;
37
38 typedef enum
39 {
40 frame_full,
41 frame_half
42 } panel_display_t;
43
44 typedef enum
45 {
46 UP_OPTIMIZE = 0,
47 UP_RELOAD = 1,
48 UP_ONLY_CURRENT = 2
49 } panel_update_flags_t;
50
51
52 enum cd_enum
53 {
54 cd_parse_command,
55 cd_exact
56 };
57
58
59
60 typedef struct panel_field_struct
61 {
62 const char *id;
63 int min_size;
64 gboolean expands;
65 align_crt_t default_just;
66 const char *hotkey;
67 const char *title_hotkey;
68 gboolean is_user_choice;
69 gboolean use_in_user_format;
70 const char *(*string_fn) (const file_entry_t *fe, int len);
71 GCompareFunc sort_routine;
72 } panel_field_t;
73
74 typedef struct
75 {
76 dir_list list;
77 vfs_path_t *root_vpath;
78 } panelized_descr_t;
79
80 typedef struct
81 {
82 Widget widget;
83
84 char *name;
85
86 panel_display_t frame_size;
87
88 gboolean dirty;
89
90 gboolean is_panelized;
91 panelized_descr_t *panelized_descr;
92
93 int codepage;
94
95 dir_list dir;
96 struct stat dir_stat;
97
98 vfs_path_t *cwd_vpath;
99 vfs_path_t *lwd_vpath;
100
101 list_format_t list_format;
102 GSList *format;
103 char *user_format;
104 int list_cols;
105 int brief_cols;
106
107 dir_sort_options_t sort_info;
108 const panel_field_t *sort_field;
109
110 int marked;
111 int dirs_marked;
112 uintmax_t total;
113
114 int top;
115 int current;
116
117 GSList *status_format;
118 gboolean user_mini_status;
119 char *user_status_format[LIST_FORMATS];
120
121 file_filter_t filter;
122
123 struct
124 {
125 char *name;
126 GList *list;
127 GList *current;
128 } dir_history;
129
130 struct
131 {
132 gboolean active;
133 GString *buffer;
134 GString *prev_buffer;
135 char ch[MB_LEN_MAX];
136 int chpoint;
137 } quick_search;
138
139 unsigned int content_shift;
140 unsigned int max_shift;
141 } WPanel;
142
143
144
145 extern hook_t *select_file_hook;
146
147 extern mc_fhl_t *mc_filehighlight;
148
149
150
151 WPanel *panel_sized_empty_new (const char *panel_name, const WRect *r);
152 WPanel *panel_sized_with_dir_new (const char *panel_name, const WRect *r, const vfs_path_t *vpath);
153
154 void panel_clean_dir (WPanel *panel);
155
156 void panel_reload (WPanel *panel);
157 void panel_set_sort_order (WPanel *panel, const panel_field_t *sort_order);
158 void panel_re_sort (WPanel *panel);
159
160 void panel_change_encoding (WPanel *panel);
161 vfs_path_t *remove_encoding_from_path (const vfs_path_t *vpath);
162
163 void update_panels (panel_update_flags_t flags, const char *current_file);
164 int set_panel_formats (WPanel *p);
165
166 void panel_set_filter (WPanel *panel, const file_filter_t *filter);
167
168 file_entry_t *panel_current_entry (const WPanel *panel);
169 void panel_set_current_by_name (WPanel *panel, const char *name);
170
171 void unmark_files (WPanel *panel);
172 void select_item (WPanel *panel);
173
174 void recalculate_panel_summary (WPanel *panel);
175 void file_mark (WPanel *panel, int idx, int val);
176 void do_file_mark (WPanel *panel, int idx, int val);
177 const GString *panel_find_marked_file (const WPanel *panel, int *current_file);
178 const GString *panel_get_marked_file (const WPanel *panel, int *current_file);
179
180 gboolean panel_do_cd (WPanel *panel, const vfs_path_t *new_dir_vpath, enum cd_enum cd_type);
181 MC_MOCKABLE gboolean panel_cd (WPanel *panel, const vfs_path_t *new_dir_vpath,
182 enum cd_enum cd_type);
183
184 gsize panel_get_num_of_sortable_fields (void);
185 char **panel_get_sortable_fields (gsize *array_size);
186 const panel_field_t *panel_get_field_by_id (const char *name);
187 const panel_field_t *panel_get_field_by_title (const char *name);
188 const panel_field_t *panel_get_field_by_title_hotkey (const char *name);
189 gsize panel_get_num_of_user_possible_fields (void);
190 char **panel_get_user_possible_fields (gsize *array_size);
191 void panel_set_cwd (WPanel *panel, const vfs_path_t *vpath);
192 void panel_set_lwd (WPanel *panel, const vfs_path_t *vpath);
193
194 void panel_panelize_restore (void);
195 void panel_panelize_change_root (WPanel *panel, const vfs_path_t *new_root);
196 void panel_panelize_absolutize_if_needed (WPanel *panel);
197 void panel_panelize_save (WPanel *panel);
198
199 void panel_init (void);
200 void panel_deinit (void);
201
202
203
204
205
206
207
208
209
210
211
212
213 static inline WPanel *
214 panel_empty_new (const char *panel_name)
215 {
216
217 WRect r = { 0, 0, 1, 1 };
218
219 return panel_sized_empty_new (panel_name, &r);
220 }
221
222
223
224
225
226
227
228
229
230
231
232 static inline WPanel *
233 panel_with_dir_new (const char *panel_name, const vfs_path_t *vpath)
234 {
235
236 WRect r = { 0, 0, 1, 1 };
237
238 return panel_sized_with_dir_new (panel_name, &r, vpath);
239 }
240
241
242
243
244
245
246
247
248
249
250 static inline WPanel *
251 panel_new (const char *panel_name)
252 {
253 return panel_with_dir_new (panel_name, NULL);
254 }
255
256
257
258
259
260
261
262
263
264
265
266 static inline WPanel *
267 panel_sized_new (const char *panel_name, const WRect *r)
268 {
269 return panel_sized_with_dir_new (panel_name, r, NULL);
270 }
271
272
273
274 #endif