2 * \brief Header: defines WPanel structure
8 #include "lib/global.h" /* gboolean */
9 #include "lib/fs.h" /* MC_MAXPATHLEN */
10 #include "lib/strutil.h"
11 #include "lib/widget.h" /* Widget */
13 #include "dir.h" /* dir_list */
14 #include "main.h" /* cd_enum */
16 /*** typedefs(not structures) and defined constants **********************************************/
18 #define selection(p) (&(p->dir.list[p->selected]))
19 #define DEFAULT_USER_FORMAT "half type name | size | perm"
25 #define UP_ONLY_CURRENT 2
27 #define UP_KEEPSEL ((char *) -1)
29 #define other_panel get_other_panel()
31 /*** enums ***************************************************************************************/
35 list_full
, /* Name, size, perm/date */
36 list_brief
, /* Name */
37 list_long
, /* Like ls -l */
38 list_user
/* User defined */
43 view_listing
= 0, /* Directory listing */
44 view_info
= 1, /* Information panel */
45 view_tree
= 2, /* Tree view */
46 view_quick
= 3, /* Quick view */
47 view_nothing
= 4, /* Undefined */
50 enum panel_display_enum
52 frame_full
, /* full screen frame */
53 frame_half
/* half screen frame */
56 /*** structures declarations (and typedefs of structures)*****************************************/
60 typedef struct panel_format_struct
65 align_crt_t default_just
;
67 const char *title_hotkey
;
68 gboolean is_user_choice
;
69 gboolean use_in_user_format
;
70 const char *(*string_fn
) (file_entry
*, int);
71 sortfn
*sort_routine
; /* used by mouse_sort_col() */
77 dir_list dir
; /* Directory contents */
79 int list_type
; /* listing type (was view_type) */
80 int active
; /* If panel is currently selected */
81 char cwd
[MC_MAXPATHLEN
]; /* Current Working Directory */
82 char lwd
[MC_MAXPATHLEN
]; /* Last Working Directory */
83 GList
*dir_history
; /* directory history */
84 char *hist_name
; /* directory history name for history file */
85 int count
; /* Number of files in dir structure */
86 int marked
; /* Count of marked files */
87 int dirs_marked
; /* Count of marked directories */
88 double total
; /* Bytes in marked files */
89 int top_file
; /* The file showed on the top of the panel */
90 int selected
; /* Index to the selected file */
91 int reverse
; /* Show listing in reverse? */
92 int case_sensitive
; /* Listing is case sensitive? */
93 int exec_first
; /* Show executable top in list? */
94 int split
; /* Split panel to allow two columns */
95 int is_panelized
; /* Flag: special filelisting, can't reload */
96 int frame_size
; /* half or full frame */
97 const panel_field_t
*current_sort_field
;
98 char *filter
; /* File name filter */
100 int dirty
; /* Should we redisplay the panel? */
102 int user_mini_status
; /* Is user_status_format used */
103 char *user_format
; /* User format */
104 char *user_status_format
[LIST_TYPES
]; /* User format for status line */
106 struct format_e
*format
; /* Display format */
107 struct format_e
*status_format
; /* Mini status format */
109 int format_modified
; /* If the format was changed this is set */
111 char *panel_name
; /* The panel name */
112 struct stat dir_stat
; /* Stat of current dir: used by execute () */
114 int codepage
; /* panel codepage */
117 char search_buffer
[MC_MAXFILENAMELEN
];
118 char prev_search_buffer
[MC_MAXFILENAMELEN
];
119 char search_char
[MB_LEN_MAX
]; /*buffer for multibytes characters */
120 int search_chpoint
; /*point after last characters in search_char */
123 /*** global variables defined in .c file *********************************************************/
125 extern panel_field_t panel_fields
[];
127 extern int torben_fj_mode
;
128 extern int show_mini_info
;
130 extern WPanel
*left_panel
;
131 extern WPanel
*right_panel
;
132 extern WPanel
*current_panel
;
134 extern hook_t
*select_file_hook
;
136 /*** declarations of public functions ************************************************************/
138 WPanel
*panel_new (const char *panel_name
);
139 WPanel
*panel_new_with_dir (const char *panel_name
, const char *dr
);
140 void panel_clean_dir (WPanel
* panel
);
142 void panel_reload (WPanel
* panel
);
143 void panel_set_sort_order (WPanel
* panel
, const panel_field_t
* sort_order
);
144 void panel_re_sort (WPanel
* panel
);
145 void panel_change_encoding (WPanel
* panel
);
147 void update_dirty_panels (void);
148 void update_panels (int force_update
, const char *current_file
);
149 void panel_update_cols (Widget
* widget
, int frame_size
);
150 int set_panel_formats (WPanel
* p
);
152 void try_to_select (WPanel
* panel
, const char *name
);
154 void unmark_files (WPanel
* panel
);
155 void select_item (WPanel
* panel
);
157 void recalculate_panel_summary (WPanel
* panel
);
158 void file_mark (WPanel
* panel
, int idx
, int val
);
159 void do_file_mark (WPanel
* panel
, int idx
, int val
);
161 gboolean
do_panel_cd (struct WPanel
*panel
, const char *new_dir
, enum cd_enum cd_type
);
163 void directory_history_add (struct WPanel
*panel
, const char *dir
);
165 gsize
panel_get_num_of_sortable_fields (void);
166 const char **panel_get_sortable_fields (gsize
*);
167 const panel_field_t
*panel_get_field_by_id (const char *);
168 const panel_field_t
*panel_get_field_by_title (const char *);
169 const panel_field_t
*panel_get_field_by_title_hotkey (const char *);
170 gsize
panel_get_num_of_user_possible_fields (void);
171 const char **panel_get_user_possible_fields (gsize
*);
173 void panel_init (void);
174 void panel_deinit (void);
176 /*** inline functions ****************************************************************************/
177 #endif /* MC__PANEL_H */