Original patch as attached on the bugreport
[midnight-commander.git] / src / panel.h
blob844f3594bec05ccff69bf96fb5038e99e5094cad
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 exec_first; /* Show executable top in list? */
53 int split; /* Split panel to allow two columns */
54 int is_panelized; /* Flag: special filelisting, can't reload */
55 int frame_size; /* half or full frame */
56 sortfn *sort_type; /* Sort type */
57 char *filter; /* File name filter */
59 int dirty; /* Should we redisplay the panel? */
61 int user_mini_status; /* Is user_status_format used */
62 char *user_format; /* User format */
63 char *user_status_format[LIST_TYPES];/* User format for status line */
65 struct format_e *format; /* Display format */
66 struct format_e *status_format; /* Mini status format */
68 int format_modified; /* If the format was changed this is set */
70 char *panel_name; /* The panel name */
71 struct stat dir_stat; /* Stat of current dir: used by execute () */
73 int searching;
74 char search_buffer [256];
75 } WPanel;
77 WPanel *panel_new (const char *panel_name);
78 void panel_clean_dir (WPanel *panel);
80 extern int torben_fj_mode;
81 extern int permission_mode;
82 extern int filetype_mode;
83 extern int show_mini_info;
84 extern int panel_scroll_pages;
85 extern int fast_reload;
87 void panel_reload (WPanel *panel);
88 void panel_set_sort_order (WPanel *panel, sortfn *sort_order);
89 void panel_re_sort (WPanel *panel);
91 void update_dirty_panels (void);
92 void panel_update_cols (Widget *widget, int frame_size);
93 int set_panel_formats (WPanel *p);
95 #define other_panel get_other_panel()
97 extern WPanel *left_panel;
98 extern WPanel *right_panel;
99 extern WPanel *current_panel;
101 void try_to_select (WPanel *panel, const char *name);
103 void unmark_files (WPanel *panel);
104 void select_item (WPanel *panel);
106 extern Hook *select_file_hook;
108 void recalculate_panel_summary (WPanel *panel);
109 void file_mark (WPanel *panel, int index, int val);
110 void do_file_mark (WPanel *panel, int index, int val);
112 void directory_history_next (WPanel *panel);
113 void directory_history_prev (WPanel *panel);
114 void directory_history_list (WPanel *panel);
116 #endif