added new parameter mcview_eof into ini-file
[free-mc.git] / src / panel.h
blobb32dabcffa28e3756de8cecfea4c0625b6728e1f
2 /** \file panel.h
3 * \brief Header: defines WPanel structure
4 */
6 #ifndef MC_PANEL_H
7 #define MC_PANEL_H
9 #include "dir.h" /* dir_list */
10 #include "dialog.h" /* Widget */
11 #include "fs.h" /* MC_MAXPATHLEN */
12 #include "strutil.h"
14 #define selection(p) (&(p->dir.list[p->selected]))
15 #define DEFAULT_USER_FORMAT "half type name | size | perm"
17 #define LIST_TYPES 4
19 enum list_types {
20 list_full, /* Name, size, perm/date */
21 list_brief, /* Name */
22 list_long, /* Like ls -l */
23 list_user /* User defined */
26 typedef enum {
27 view_listing = 0, /* Directory listing */
28 view_info = 1, /* Information panel */
29 view_tree = 2, /* Tree view */
30 view_quick = 3, /* Quick view */
31 view_nothing = 4, /* Undefined */
32 } panel_view_mode_t;
34 enum panel_display_enum {
35 frame_full, /* full screen frame */
36 frame_half /* half screen frame */
39 struct format_e;
41 typedef struct panel_format_struct {
42 const char *id;
43 int min_size;
44 int expands;
45 align_crt_t default_just;
46 const char *hotkey;
47 const char *title_hotkey;
48 gboolean is_user_choice;
49 gboolean use_in_user_format;
50 const char *(*string_fn)(file_entry *, int);
51 sortfn *sort_routine; /* used by mouse_sort_col() */
52 } panel_field_t;
54 extern panel_field_t panel_fields [];
56 typedef struct WPanel {
57 Widget widget;
58 dir_list dir; /* Directory contents */
60 int list_type; /* listing type (was view_type) */
61 int active; /* If panel is currently selected */
62 char cwd [MC_MAXPATHLEN];/* Current Working Directory */
63 char lwd [MC_MAXPATHLEN];/* Last Working Directory */
64 GList *dir_history; /* directory history */
65 char *hist_name; /* directory history name for history file */
66 int count; /* Number of files in dir structure */
67 int marked; /* Count of marked files */
68 int dirs_marked; /* Count of marked directories */
69 double total; /* Bytes in marked files */
70 int top_file; /* The file showed on the top of the panel */
71 int selected; /* Index to the selected file */
72 int reverse; /* Show listing in reverse? */
73 int case_sensitive; /* Listing is case sensitive? */
74 int exec_first; /* Show executable top in list? */
75 int split; /* Split panel to allow two columns */
76 int is_panelized; /* Flag: special filelisting, can't reload */
77 int frame_size; /* half or full frame */
78 const panel_field_t *current_sort_field;
79 char *filter; /* File name filter */
81 int dirty; /* Should we redisplay the panel? */
83 int user_mini_status; /* Is user_status_format used */
84 char *user_format; /* User format */
85 char *user_status_format[LIST_TYPES];/* User format for status line */
87 struct format_e *format; /* Display format */
88 struct format_e *status_format; /* Mini status format */
90 int format_modified; /* If the format was changed this is set */
92 char *panel_name; /* The panel name */
93 struct stat dir_stat; /* Stat of current dir: used by execute () */
95 int searching;
96 char search_buffer [256];
97 char search_char [MB_LEN_MAX]; /*buffer for multibytes characters*/
98 int search_chpoint; /*point after last characters in search_char*/
99 } WPanel;
101 WPanel *panel_new (const char *panel_name);
102 WPanel *panel_new_with_dir (const char *panel_name, const char *dr);
103 void panel_clean_dir (WPanel *panel);
105 extern int torben_fj_mode;
106 extern int permission_mode;
107 extern int filetype_mode;
108 extern int show_mini_info;
109 extern int panel_scroll_pages;
110 extern int fast_reload;
112 void panel_reload (WPanel *panel);
113 void panel_set_sort_order (WPanel *panel, const panel_field_t *sort_order);
114 void panel_re_sort (WPanel *panel);
115 void set_panel_encoding (WPanel *);
117 #define UP_OPTIMIZE 0
118 #define UP_RELOAD 1
119 #define UP_ONLY_CURRENT 2
121 #define UP_KEEPSEL ((char *) -1)
123 void update_dirty_panels (void);
124 void update_panels (int force_update, const char *current_file);
125 void panel_update_cols (Widget *widget, int frame_size);
126 int set_panel_formats (WPanel *p);
128 #define other_panel get_other_panel()
130 extern WPanel *left_panel;
131 extern WPanel *right_panel;
132 extern WPanel *current_panel;
134 void try_to_select (WPanel *panel, const char *name);
136 void unmark_files (WPanel *panel);
137 void select_item (WPanel *panel);
139 extern Hook *select_file_hook;
141 void recalculate_panel_summary (WPanel *panel);
142 void file_mark (WPanel *panel, int index, int val);
143 void do_file_mark (WPanel *panel, int index, int val);
145 void directory_history_next (WPanel *panel);
146 void directory_history_prev (WPanel *panel);
147 void directory_history_list (WPanel *panel);
149 gsize panel_get_num_of_sortable_fields(void);
150 const char **panel_get_sortable_fields(gsize *);
151 const panel_field_t *panel_get_field_by_id(const char *);
152 const panel_field_t *panel_get_field_by_title(const char *);
153 const panel_field_t *panel_get_field_by_title_hotkey(const char *);
154 gsize panel_get_num_of_user_possible_fields(void);
155 const char **panel_get_user_possible_fields(gsize *);
157 void panel_init(void);
158 void panel_deinit(void);
160 #endif