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