3 * \brief Header: defines WPanel structure
9 #include "lib/fs.h" /* MC_MAXPATHLEN */
10 #include "lib/strutil.h"
12 #include "dir.h" /* dir_list */
13 #include "dialog.h" /* Widget */
15 #define selection(p) (&(p->dir.list[p->selected]))
16 #define DEFAULT_USER_FORMAT "half type name | size | perm"
21 list_full
, /* Name, size, perm/date */
22 list_brief
, /* Name */
23 list_long
, /* Like ls -l */
24 list_user
/* User defined */
28 view_listing
= 0, /* Directory listing */
29 view_info
= 1, /* Information panel */
30 view_tree
= 2, /* Tree view */
31 view_quick
= 3, /* Quick view */
32 view_nothing
= 4, /* Undefined */
35 enum panel_display_enum
{
36 frame_full
, /* full screen frame */
37 frame_half
/* half screen frame */
42 typedef struct panel_format_struct
{
46 align_crt_t default_just
;
48 const char *title_hotkey
;
49 gboolean is_user_choice
;
50 gboolean use_in_user_format
;
51 const char *(*string_fn
)(file_entry
*, int);
52 sortfn
*sort_routine
; /* used by mouse_sort_col() */
55 extern panel_field_t panel_fields
[];
57 typedef struct WPanel
{
59 dir_list dir
; /* Directory contents */
61 int list_type
; /* listing type (was view_type) */
62 int active
; /* If panel is currently selected */
63 char cwd
[MC_MAXPATHLEN
];/* Current Working Directory */
64 char lwd
[MC_MAXPATHLEN
];/* Last Working Directory */
65 GList
*dir_history
; /* directory history */
66 char *hist_name
; /* directory history name for history file */
67 int count
; /* Number of files in dir structure */
68 int marked
; /* Count of marked files */
69 int dirs_marked
; /* Count of marked directories */
70 double total
; /* Bytes in marked files */
71 int top_file
; /* The file showed on the top of the panel */
72 int selected
; /* Index to the selected file */
73 int reverse
; /* Show listing in reverse? */
74 int case_sensitive
; /* Listing is case sensitive? */
75 int exec_first
; /* Show executable top in list? */
76 int split
; /* Split panel to allow two columns */
77 int is_panelized
; /* Flag: special filelisting, can't reload */
78 int frame_size
; /* half or full frame */
79 const panel_field_t
*current_sort_field
;
80 char *filter
; /* File name filter */
82 int dirty
; /* Should we redisplay the panel? */
84 int user_mini_status
; /* Is user_status_format used */
85 char *user_format
; /* User format */
86 char *user_status_format
[LIST_TYPES
];/* User format for status line */
88 struct format_e
*format
; /* Display format */
89 struct format_e
*status_format
; /* Mini status format */
91 int format_modified
; /* If the format was changed this is set */
93 char *panel_name
; /* The panel name */
94 struct stat dir_stat
; /* Stat of current dir: used by execute () */
97 char search_buffer
[256];
98 char search_char
[MB_LEN_MAX
]; /*buffer for multibytes characters*/
99 int search_chpoint
; /*point after last characters in search_char*/
102 WPanel
*panel_new (const char *panel_name
);
103 WPanel
*panel_new_with_dir (const char *panel_name
, const char *dr
);
104 void panel_clean_dir (WPanel
*panel
);
106 extern int torben_fj_mode
;
107 extern int show_mini_info
;
109 void panel_reload (WPanel
*panel
);
110 void panel_set_sort_order (WPanel
*panel
, const panel_field_t
*sort_order
);
111 void panel_re_sort (WPanel
*panel
);
112 void set_panel_encoding (WPanel
*);
114 #define UP_OPTIMIZE 0
116 #define UP_ONLY_CURRENT 2
118 #define UP_KEEPSEL ((char *) -1)
120 void update_dirty_panels (void);
121 void update_panels (int force_update
, const char *current_file
);
122 void panel_update_cols (Widget
*widget
, int frame_size
);
123 int set_panel_formats (WPanel
*p
);
125 #define other_panel get_other_panel()
127 extern WPanel
*left_panel
;
128 extern WPanel
*right_panel
;
129 extern WPanel
*current_panel
;
131 void try_to_select (WPanel
*panel
, const char *name
);
133 void unmark_files (WPanel
*panel
);
134 void select_item (WPanel
*panel
);
136 extern Hook
*select_file_hook
;
138 void recalculate_panel_summary (WPanel
*panel
);
139 void file_mark (WPanel
*panel
, int idx
, int val
);
140 void do_file_mark (WPanel
*panel
, int idx
, int val
);
142 void directory_history_next (WPanel
*panel
);
143 void directory_history_prev (WPanel
*panel
);
144 void directory_history_list (WPanel
*panel
);
146 gsize
panel_get_num_of_sortable_fields(void);
147 const char **panel_get_sortable_fields(gsize
*);
148 const panel_field_t
*panel_get_field_by_id(const char *);
149 const panel_field_t
*panel_get_field_by_title(const char *);
150 const panel_field_t
*panel_get_field_by_title_hotkey(const char *);
151 gsize
panel_get_num_of_user_possible_fields(void);
152 const char **panel_get_user_possible_fields(gsize
*);
154 void panel_init(void);
155 void panel_deinit(void);
157 #endif /* MC_PANEL_H */