Merge commit '315633ecce31cd5af92112ab9903f6e7e8ae8df7'
[free-mc.git] / src / panel.h
blob1cd15af7c9eb0a15e859cbf7f8e5d1af06cc7323
1 #ifndef MC_PANEL_H
2 #define MC_PANEL_H
4 #include "dir.h" /* dir_list */
5 #include "dialog.h" /* Widget */
7 #define selection(p) (&(p->dir.list[p->selected]))
8 #define DEFAULT_USER_FORMAT "half type name | size | perm"
10 #define LIST_TYPES 4
12 enum list_types {
13 list_full, /* Name, size, perm/date */
14 list_brief, /* Name */
15 list_long, /* Like ls -l */
16 list_user /* User defined */
19 enum view_modes {
20 view_listing, /* Directory listing */
21 view_info, /* Information panel */
22 view_tree, /* Tree view */
23 view_quick, /* Quick view */
24 view_nothing /* Undefined */
27 enum panel_display_enum {
28 frame_full, /* full screen frame */
29 frame_half /* half screen frame */
32 struct format_e;
34 typedef struct WPanel {
35 Widget widget;
36 dir_list dir; /* Directory contents */
38 int list_type; /* listing type (was view_type) */
39 int active; /* If panel is currently selected */
40 char cwd [MC_MAXPATHLEN];/* Current Working Directory */
41 char lwd [MC_MAXPATHLEN];/* Last Working Directory */
42 GList *dir_history; /* directory history */
43 char *hist_name; /* directory history name for history file */
44 int count; /* Number of files in dir structure */
45 int marked; /* Count of marked files */
46 int dirs_marked; /* Count of marked directories */
47 double total; /* Bytes in marked files */
48 int top_file; /* The file showed on the top of the panel */
49 int selected; /* Index to the selected file */
50 int reverse; /* Show listing in reverse? */
51 int case_sensitive; /* Listing is case sensitive? */
52 int split; /* Split panel to allow two columns */
53 int is_panelized; /* Flag: special filelisting, can't reload */
54 int frame_size; /* half or full frame */
55 sortfn *sort_type; /* Sort type */
56 char *filter; /* File name filter */
58 int dirty; /* Should we redisplay the panel? */
60 int user_mini_status; /* Is user_status_format used */
61 char *user_format; /* User format */
62 char *user_status_format[LIST_TYPES];/* User format for status line */
64 struct format_e *format; /* Display format */
65 struct format_e *status_format; /* Mini status format */
67 int format_modified; /* If the format was changed this is set */
69 char *panel_name; /* The panel name */
70 struct stat dir_stat; /* Stat of current dir: used by execute () */
72 int searching;
73 char search_buffer [256];
74 } WPanel;
76 WPanel *panel_new (const char *panel_name);
77 void panel_clean_dir (WPanel *panel);
79 extern int torben_fj_mode;
80 extern int permission_mode;
81 extern int filetype_mode;
82 extern int show_mini_info;
83 extern int panel_scroll_pages;
84 extern int fast_reload;
86 void panel_reload (WPanel *panel);
87 void panel_set_sort_order (WPanel *panel, sortfn *sort_order);
88 void panel_re_sort (WPanel *panel);
90 void update_dirty_panels (void);
91 void panel_update_cols (Widget *widget, int frame_size);
92 int set_panel_formats (WPanel *p);
94 #define other_panel get_other_panel()
96 extern WPanel *left_panel;
97 extern WPanel *right_panel;
98 extern WPanel *current_panel;
100 void try_to_select (WPanel *panel, const char *name);
102 void unmark_files (WPanel *panel);
103 void select_item (WPanel *panel);
105 extern Hook *select_file_hook;
107 void recalculate_panel_summary (WPanel *panel);
108 void file_mark (WPanel *panel, int index, int val);
109 void do_file_mark (WPanel *panel, int index, int val);
111 void directory_history_next (WPanel *panel);
112 void directory_history_prev (WPanel *panel);
113 void directory_history_list (WPanel *panel);
115 #endif