This source file includes following definitions.
- panel_empty_new
- panel_with_dir_new
- panel_new
- panel_sized_new
- panel_current_entry
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 #define DEFAULT_USER_FORMAT "half type name | size | perm"
24
25 #define LIST_FORMATS 4
26
27 #define UP_KEEPSEL ((char *) -1)
28
29
30
31 typedef enum
32 {
33 list_full,
34 list_brief,
35 list_long,
36 list_user
37 } list_format_t;
38
39 typedef enum
40 {
41 frame_full,
42 frame_half
43 } panel_display_t;
44
45 typedef enum
46 {
47 UP_OPTIMIZE = 0,
48 UP_RELOAD = 1,
49 UP_ONLY_CURRENT = 2
50 } panel_update_flags_t;
51
52
53 enum cd_enum
54 {
55 cd_parse_command,
56 cd_exact
57 };
58
59
60
61 typedef struct panel_field_struct
62 {
63 const char *id;
64 int min_size;
65 gboolean expands;
66 align_crt_t default_just;
67 const char *hotkey;
68 const char *title_hotkey;
69 gboolean is_user_choice;
70 gboolean use_in_user_format;
71 const char *(*string_fn) (file_entry_t *, int);
72 GCompareFunc sort_routine;
73 } panel_field_t;
74
75 typedef struct
76 {
77 dir_list list;
78 vfs_path_t *root_vpath;
79 } panelized_descr_t;
80
81 typedef struct
82 {
83 Widget widget;
84
85 char *name;
86
87 panel_display_t frame_size;
88
89 gboolean active;
90 gboolean dirty;
91
92 gboolean is_panelized;
93 panelized_descr_t *panelized_descr;
94
95 #ifdef HAVE_CHARSET
96 int codepage;
97 #endif
98
99 dir_list dir;
100 struct stat dir_stat;
101
102 vfs_path_t *cwd_vpath;
103 vfs_path_t *lwd_vpath;
104
105 list_format_t list_format;
106 GSList *format;
107 char *user_format;
108 int list_cols;
109 int brief_cols;
110
111 dir_sort_options_t sort_info;
112 const panel_field_t *sort_field;
113
114 int marked;
115 int dirs_marked;
116 uintmax_t total;
117
118 int top;
119 int current;
120
121 GSList *status_format;
122 gboolean user_mini_status;
123 char *user_status_format[LIST_FORMATS];
124
125 file_filter_t filter;
126
127 struct
128 {
129 char *name;
130 GList *list;
131 GList *current;
132 } dir_history;
133
134 struct
135 {
136 gboolean active;
137 GString *buffer;
138 GString *prev_buffer;
139 char ch[MB_LEN_MAX];
140 int chpoint;
141 } quick_search;
142
143 int content_shift;
144 int max_shift;
145 } WPanel;
146
147
148
149 extern hook_t *select_file_hook;
150
151 extern mc_fhl_t *mc_filehighlight;
152
153
154
155 WPanel *panel_sized_empty_new (const char *panel_name, int y, int x, int lines, int cols);
156 WPanel *panel_sized_with_dir_new (const char *panel_name, int y, int x, int lines, int cols,
157 const vfs_path_t * vpath);
158
159 void panel_clean_dir (WPanel * panel);
160
161 void panel_reload (WPanel * panel);
162 void panel_set_sort_order (WPanel * panel, const panel_field_t * sort_order);
163 void panel_re_sort (WPanel * panel);
164
165 #ifdef HAVE_CHARSET
166 void panel_change_encoding (WPanel * panel);
167 vfs_path_t *remove_encoding_from_path (const vfs_path_t * vpath);
168 #endif
169
170 void update_panels (panel_update_flags_t flags, const char *current_file);
171 int set_panel_formats (WPanel * p);
172
173 void panel_set_filter (WPanel * panel, const file_filter_t * filter);
174
175 void panel_set_current_by_name (WPanel * panel, const char *name);
176
177 void unmark_files (WPanel * panel);
178 void select_item (WPanel * panel);
179
180 void recalculate_panel_summary (WPanel * panel);
181 void file_mark (WPanel * panel, int idx, int val);
182 void do_file_mark (WPanel * panel, int idx, int val);
183
184 gboolean panel_do_cd (WPanel * panel, const vfs_path_t * new_dir_vpath, enum cd_enum cd_type);
185 gboolean panel_cd (WPanel * panel, const vfs_path_t * new_dir_vpath, enum cd_enum cd_type);
186
187 gsize panel_get_num_of_sortable_fields (void);
188 char **panel_get_sortable_fields (gsize * array_size);
189 const panel_field_t *panel_get_field_by_id (const char *name);
190 const panel_field_t *panel_get_field_by_title (const char *name);
191 const panel_field_t *panel_get_field_by_title_hotkey (const char *name);
192 gsize panel_get_num_of_user_possible_fields (void);
193 char **panel_get_user_possible_fields (gsize * array_size);
194 void panel_set_cwd (WPanel * panel, const vfs_path_t * vpath);
195 void panel_set_lwd (WPanel * panel, const vfs_path_t * vpath);
196
197 void panel_panelize_cd (void);
198 void panel_panelize_change_root (WPanel * panel, const vfs_path_t * new_root);
199 void panel_panelize_absolutize_if_needed (WPanel * panel);
200 void panel_panelize_save (WPanel * panel);
201
202 void panel_init (void);
203 void panel_deinit (void);
204
205
206
207
208
209
210
211
212
213
214
215
216 static inline WPanel *
217 panel_empty_new (const char *panel_name)
218 {
219
220 return panel_sized_empty_new (panel_name, 0, 0, 1, 1);
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 return panel_sized_with_dir_new (panel_name, 0, 0, 1, 1, vpath);
238 }
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
267
268
269 static inline WPanel *
270 panel_sized_new (const char *panel_name, int y, int x, int lines, int cols)
271 {
272 return panel_sized_with_dir_new (panel_name, y, x, lines, cols, NULL);
273 }
274
275
276
277 static inline file_entry_t *
278 panel_current_entry (const WPanel * panel)
279 {
280 return &(panel->dir.list[panel->current]);
281 }
282
283
284
285 #endif