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 active;
89 gboolean dirty;
90
91 gboolean is_panelized;
92 panelized_descr_t *panelized_descr;
93
94 int codepage;
95
96 dir_list dir;
97 struct stat dir_stat;
98
99 vfs_path_t *cwd_vpath;
100 vfs_path_t *lwd_vpath;
101
102 list_format_t list_format;
103 GSList *format;
104 char *user_format;
105 int list_cols;
106 int brief_cols;
107
108 dir_sort_options_t sort_info;
109 const panel_field_t *sort_field;
110
111 int marked;
112 int dirs_marked;
113 uintmax_t total;
114
115 int top;
116 int current;
117
118 GSList *status_format;
119 gboolean user_mini_status;
120 char *user_status_format[LIST_FORMATS];
121
122 file_filter_t filter;
123
124 struct
125 {
126 char *name;
127 GList *list;
128 GList *current;
129 } dir_history;
130
131 struct
132 {
133 gboolean active;
134 GString *buffer;
135 GString *prev_buffer;
136 char ch[MB_LEN_MAX];
137 int chpoint;
138 } quick_search;
139
140 int content_shift;
141 int max_shift;
142 } WPanel;
143
144
145
146 extern hook_t *select_file_hook;
147
148 extern mc_fhl_t *mc_filehighlight;
149
150
151
152 WPanel *panel_sized_empty_new (const char *panel_name, const WRect *r);
153 WPanel *panel_sized_with_dir_new (const char *panel_name, const WRect *r, const vfs_path_t *vpath);
154
155 void panel_clean_dir (WPanel *panel);
156
157 void panel_reload (WPanel *panel);
158 void panel_set_sort_order (WPanel *panel, const panel_field_t *sort_order);
159 void panel_re_sort (WPanel *panel);
160
161 void panel_change_encoding (WPanel *panel);
162 vfs_path_t *remove_encoding_from_path (const vfs_path_t *vpath);
163
164 void update_panels (panel_update_flags_t flags, const char *current_file);
165 int set_panel_formats (WPanel *p);
166
167 void panel_set_filter (WPanel *panel, const file_filter_t *filter);
168
169 file_entry_t *panel_current_entry (const WPanel *panel);
170 void panel_set_current_by_name (WPanel *panel, const char *name);
171
172 void unmark_files (WPanel *panel);
173 void select_item (WPanel *panel);
174
175 void recalculate_panel_summary (WPanel *panel);
176 void file_mark (WPanel *panel, int idx, int val);
177 void do_file_mark (WPanel *panel, int idx, int val);
178 const GString *panel_find_marked_file (const WPanel *panel, int *current_file);
179 const GString *panel_get_marked_file (const WPanel *panel, int *current_file);
180
181 gboolean panel_do_cd (WPanel *panel, const vfs_path_t *new_dir_vpath, enum cd_enum cd_type);
182 MC_MOCKABLE gboolean panel_cd (WPanel *panel, const vfs_path_t *new_dir_vpath,
183 enum cd_enum cd_type);
184
185 gsize panel_get_num_of_sortable_fields (void);
186 char **panel_get_sortable_fields (gsize *array_size);
187 const panel_field_t *panel_get_field_by_id (const char *name);
188 const panel_field_t *panel_get_field_by_title (const char *name);
189 const panel_field_t *panel_get_field_by_title_hotkey (const char *name);
190 gsize panel_get_num_of_user_possible_fields (void);
191 char **panel_get_user_possible_fields (gsize *array_size);
192 void panel_set_cwd (WPanel *panel, const vfs_path_t *vpath);
193 void panel_set_lwd (WPanel *panel, const vfs_path_t *vpath);
194
195 void panel_panelize_cd (void);
196 void panel_panelize_change_root (WPanel *panel, const vfs_path_t *new_root);
197 void panel_panelize_absolutize_if_needed (WPanel *panel);
198 void panel_panelize_save (WPanel *panel);
199
200 void panel_init (void);
201 void panel_deinit (void);
202
203
204
205
206
207
208
209
210
211
212
213
214 static inline WPanel *
215 panel_empty_new (const char *panel_name)
216 {
217
218 WRect r = { 0, 0, 1, 1 };
219
220 return panel_sized_empty_new (panel_name, &r);
221 }
222
223
224
225
226
227
228
229
230
231
232
233 static inline WPanel *
234 panel_with_dir_new (const char *panel_name, const vfs_path_t *vpath)
235 {
236
237 WRect r = { 0, 0, 1, 1 };
238
239 return panel_sized_with_dir_new (panel_name, &r, vpath);
240 }
241
242
243
244
245
246
247
248
249
250
251 static inline WPanel *
252 panel_new (const char *panel_name)
253 {
254 return panel_with_dir_new (panel_name, NULL);
255 }
256
257
258
259
260
261
262
263
264
265
266
267 static inline WPanel *
268 panel_sized_new (const char *panel_name, const WRect *r)
269 {
270 return panel_sized_with_dir_new (panel_name, r, NULL);
271 }
272
273
274
275 #endif