5 #include "dir.h" /* file_entry */
8 #include "widget.h" /* for history loading and saving */
13 list_full
, /* Name, size, perm/date */
14 list_brief
, /* Name */
15 list_long
, /* Like ls -l */
16 list_user
, /* User defined */
17 list_icons
/* iconic display */
21 view_listing
, /* Directory listing */
22 view_info
, /* Information panel */
23 view_tree
, /* Tree view */
24 view_quick
, /* Quick view */
25 view_nothing
/* Undefined */
28 enum panel_display_enum
{
29 frame_full
, /* full screen frame */
30 frame_half
/* half screen frame */
33 #define is_view_special(x) (((x) == view_info) || ((x) == view_quick))
39 #define IS_FIT(x) ((x) & 0x0004)
40 #define MAKE_FIT(x) ((x) | 0x0004)
41 #define HIDE_FIT(x) ((x) & 0x0003)
45 #define J_CENTER_FIT 7
50 #define MARKED_SELECTED 3
54 * This describes a format item. The parse_display_format routine parses
55 * the user specified format and creates a linked list of format_e structures.
57 * parse_display_format computes the actual field allocations if
58 * the COMPUTE_FORMAT_ALLOCATIONs define is set. MC frontends that are
59 * just interested in the parsed display format should not set this define.
61 typedef struct format_e
{
62 struct format_e
*next
;
63 int requested_field_len
;
67 char *(*string_fn
)(file_entry
*, int len
);
71 /* first format_e has the number of items */
78 dir_list dir
; /* Directory contents */
80 int list_type
; /* listing type (was view_type) */
81 int active
; /* If panel is currently selected */
82 char cwd
[MC_MAXPATHLEN
];/* Current Working Directory */
83 char lwd
[MC_MAXPATHLEN
];/* Last Working Directory */
84 Hist
*dir_history
; /* directory history */
85 char *hist_name
; /* directory history name for history file */
86 int count
; /* Number of files in dir structure */
87 int marked
; /* Count of marked files */
88 int dirs_marked
; /* Count of marked directories */
89 double total
; /* Bytes in marked files */
90 int top_file
; /* The file showed on the top of the panel */
91 int selected
; /* Index to the selected file */
92 int reverse
; /* Show listing in reverse? */
93 int case_sensitive
; /* Listing is case sensitive? */
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 int icons_per_row
; /* Icon view; how many icons displayed per row */
98 sortfn
*sort_type
; /* Sort type */
99 char *filter
; /* File name filter */
101 int dirty
; /* Should we redisplay the panel? */
103 int user_mini_status
; /* Is user_status_format used */
104 char *user_format
; /* User format */
105 char *user_status_format
[LIST_TYPES
];/* User format for status line */
107 format_e
*format
; /* Display format */
108 format_e
*status_format
; /* Mini status format */
110 int format_modified
; /* If the format was changed this is set */
112 char *panel_name
; /* The panel name */
113 struct stat dir_stat
; /* Stat of current dir: used by execute () */
123 char search_buffer
[256];
125 void *port_ui
; /* UI stuff specific to each GUI port */
128 WPanel
*panel_new (const char *panel_name
);
129 void panel_set_size (WPanel
*panel
, int x1
, int y1
, int x2
, int y2
);
130 void paint_paint (WPanel
*panel
);
131 void panel_refresh (WPanel
*panel
);
132 void Xtry_to_select (WPanel
*panel
, char *name
);
133 void panel_clean_dir (WPanel
*panel
);
135 extern int torben_fj_mode
;
136 extern int permission_mode
;
137 extern int filetype_mode
;
138 extern int show_mini_info
;
139 extern int panel_scroll_pages
;
141 #define selection(p) (&(p->dir.list [p->selected]))
143 extern int fast_reload
;
144 extern int extra_info
;
146 /*#define ITEMS(p) ((p)->view_type == view_brief ? (p)->lines *2 : (p)->lines)
148 /* The return value of panel_reload */
151 #define PANEL_ISVIEW(p) (p->view_type == view_brief || \
152 p->view_type == view_full || \
153 p->view_type == view_long || \
154 p->view_type == view_user || \
155 p->view_type == view_tree)
157 #define RP_ONLY_PAINT 0
160 void paint_panel (WPanel
*panel
);
161 void display_mini_info (WPanel
*panel
);
162 void panel_reload (WPanel
*panel
);
164 void panel_set_sort_order (WPanel
*panel
, sortfn
*sort_order
);
165 void panel_re_sort (WPanel
*panel
);
167 void x_panel_set_size (int index
);
168 void x_create_panel (Dlg_head
*h
, widget_data parent
, WPanel
*panel
);
169 void x_fill_panel (WPanel
*panel
);
170 void x_adjust_top_file (WPanel
*panel
);
171 void x_filter_changed (WPanel
*panel
);
172 void x_add_sort_label (WPanel
*panel
, int index
, char *text
, char *tag
, void *sr
);
173 void x_sort_label_start (WPanel
*panel
);
174 void x_reset_sort_labels (WPanel
*panel
);
175 void x_panel_destroy (WPanel
*panel
);
176 void change_view (WPanel
*panel
, int view_type
);
177 void x_panel_update_marks (WPanel
*panel
);
179 extern void paint_info_panel (WPanel
*);
180 extern void paint_quick_view_panel (WPanel
*);
181 void info_frame (WPanel
*panel
);
182 extern WPanel
*the_info_panel
;
183 void panel_update_contents (WPanel
*panel
);
184 void panel_update_cols (Widget
*widget
, int frame_size
);
185 int set_panel_formats (WPanel
*p
);
187 WPanel
*get_current_panel (void);
188 WPanel
*get_other_panel (void);
190 #define other_panel get_other_panel()
192 extern WPanel
*left_panel
;
193 extern WPanel
*right_panel
;
194 extern WPanel
*current_panel
;
196 void try_to_select (WPanel
*panel
, char *name
);
198 #define DEFAULT_USER_FORMAT "half type,name,|,size,|,perm"
200 /* This were in main: */
201 void unmark_files (WPanel
*panel
);
202 void select_item (WPanel
*panel
);
204 extern Hook
*select_file_hook
;
206 void recalculate_panel_summary (WPanel
*panel
);
207 void file_mark (WPanel
*panel
, int index
, int val
);
208 void do_file_mark (WPanel
*panel
, int index
, int val
);
210 void x_panel_select_item (WPanel
*panel
, int index
, int val
);
211 void x_select_item (WPanel
*panel
);
212 void x_unselect_item (WPanel
*panel
);
213 sortfn
*get_sort_fn (char *name
);
214 void update_one_panel_widget (WPanel
*panel
, int force_update
, char *current_file
);
215 void panel_update_marks (WPanel
*panel
);
217 void directory_history_next (WPanel
* panel
);
218 void directory_history_prev (WPanel
* panel
);
219 void directory_history_list (WPanel
* panel
);
221 #endif /* __PANEL_H */