mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-05 11:04:42 +03:00
Change the file list panel creation APIs.
* (panel_sized_empty_new): use WRect to define a panel area. * (panel_sized_with_dir_new): likewise. * (panel_sized_new): likewise. * (panel_empty_new): sync with modified API. * (panel_with_dir_new): likewise. * (panel_sized_with_dir_new): likewise. * (create_panel): likewise. * (restore_into_right_dir_panel): likewise. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
8bb12a40e6
commit
be148a0578
@ -649,7 +649,7 @@ panel_do_cols (int idx)
|
|||||||
/** Save current list_view widget directory into panel */
|
/** Save current list_view widget directory into panel */
|
||||||
|
|
||||||
static Widget *
|
static Widget *
|
||||||
restore_into_right_dir_panel (int idx, gboolean last_was_panel, int y, int x, int lines, int cols)
|
restore_into_right_dir_panel (int idx, gboolean last_was_panel, const WRect * r)
|
||||||
{
|
{
|
||||||
WPanel *new_widget;
|
WPanel *new_widget;
|
||||||
const char *p_name;
|
const char *p_name;
|
||||||
@ -661,11 +661,11 @@ restore_into_right_dir_panel (int idx, gboolean last_was_panel, int y, int x, in
|
|||||||
vfs_path_t *saved_dir_vpath;
|
vfs_path_t *saved_dir_vpath;
|
||||||
|
|
||||||
saved_dir_vpath = vfs_path_from_str (panels[idx].last_saved_dir);
|
saved_dir_vpath = vfs_path_from_str (panels[idx].last_saved_dir);
|
||||||
new_widget = panel_sized_with_dir_new (p_name, y, x, lines, cols, saved_dir_vpath);
|
new_widget = panel_sized_with_dir_new (p_name, r, saved_dir_vpath);
|
||||||
vfs_path_free (saved_dir_vpath, TRUE);
|
vfs_path_free (saved_dir_vpath, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
new_widget = panel_sized_new (p_name, y, x, lines, cols);
|
new_widget = panel_sized_new (p_name, r);
|
||||||
|
|
||||||
return WIDGET (new_widget);
|
return WIDGET (new_widget);
|
||||||
}
|
}
|
||||||
@ -1183,8 +1183,7 @@ create_panel (int num, panel_view_mode_t type)
|
|||||||
gboolean last_was_panel;
|
gboolean last_was_panel;
|
||||||
|
|
||||||
last_was_panel = old_widget != NULL && get_panel_type (num) != view_listing;
|
last_was_panel = old_widget != NULL && get_panel_type (num) != view_listing;
|
||||||
new_widget =
|
new_widget = restore_into_right_dir_panel (num, last_was_panel, &r);
|
||||||
restore_into_right_dir_panel (num, last_was_panel, r.y, r.x, r.lines, r.cols);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4467,14 +4467,14 @@ panel_set_lwd (WPanel * panel, const vfs_path_t * vpath)
|
|||||||
* Creatie an empty panel with specified size.
|
* Creatie an empty panel with specified size.
|
||||||
*
|
*
|
||||||
* @param panel_name name of panel for setup receiving
|
* @param panel_name name of panel for setup receiving
|
||||||
|
* @param r panel areaa
|
||||||
*
|
*
|
||||||
* @return new instance of WPanel
|
* @return new instance of WPanel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
WPanel *
|
WPanel *
|
||||||
panel_sized_empty_new (const char *panel_name, int y, int x, int lines, int cols)
|
panel_sized_empty_new (const char *panel_name, const WRect * r)
|
||||||
{
|
{
|
||||||
WRect r = { y, x, lines, cols };
|
|
||||||
WPanel *panel;
|
WPanel *panel;
|
||||||
Widget *w;
|
Widget *w;
|
||||||
char *section;
|
char *section;
|
||||||
@ -4482,7 +4482,7 @@ panel_sized_empty_new (const char *panel_name, int y, int x, int lines, int cols
|
|||||||
|
|
||||||
panel = g_new0 (WPanel, 1);
|
panel = g_new0 (WPanel, 1);
|
||||||
w = WIDGET (panel);
|
w = WIDGET (panel);
|
||||||
widget_init (w, &r, panel_callback, panel_mouse_callback);
|
widget_init (w, r, panel_callback, panel_mouse_callback);
|
||||||
w->options |= WOP_SELECTABLE | WOP_TOP_SELECT;
|
w->options |= WOP_SELECTABLE | WOP_TOP_SELECT;
|
||||||
w->keymap = panel_map;
|
w->keymap = panel_map;
|
||||||
|
|
||||||
@ -4555,18 +4555,14 @@ panel_sized_empty_new (const char *panel_name, int y, int x, int lines, int cols
|
|||||||
* Panel creation for specified size and directory.
|
* Panel creation for specified size and directory.
|
||||||
*
|
*
|
||||||
* @param panel_name name of panel for setup retrieving
|
* @param panel_name name of panel for setup retrieving
|
||||||
* @param y y coordinate of top-left corner
|
* @param r panel areaa
|
||||||
* @param x x coordinate of top-left corner
|
|
||||||
* @param lines vertical size
|
|
||||||
* @param cols horizontal size
|
|
||||||
* @param vpath working panel directory. If NULL then current directory is used
|
* @param vpath working panel directory. If NULL then current directory is used
|
||||||
*
|
*
|
||||||
* @return new instance of WPanel
|
* @return new instance of WPanel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
WPanel *
|
WPanel *
|
||||||
panel_sized_with_dir_new (const char *panel_name, int y, int x, int lines, int cols,
|
panel_sized_with_dir_new (const char *panel_name, const WRect * r, const vfs_path_t * vpath)
|
||||||
const vfs_path_t * vpath)
|
|
||||||
{
|
{
|
||||||
WPanel *panel;
|
WPanel *panel;
|
||||||
char *curdir = NULL;
|
char *curdir = NULL;
|
||||||
@ -4574,7 +4570,7 @@ panel_sized_with_dir_new (const char *panel_name, int y, int x, int lines, int c
|
|||||||
const vfs_path_element_t *path_element;
|
const vfs_path_element_t *path_element;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
panel = panel_sized_empty_new (panel_name, y, x, lines, cols);
|
panel = panel_sized_empty_new (panel_name, r);
|
||||||
|
|
||||||
if (vpath != NULL)
|
if (vpath != NULL)
|
||||||
{
|
{
|
||||||
|
@ -152,8 +152,8 @@ extern mc_fhl_t *mc_filehighlight;
|
|||||||
|
|
||||||
/*** declarations of public functions ************************************************************/
|
/*** declarations of public functions ************************************************************/
|
||||||
|
|
||||||
WPanel *panel_sized_empty_new (const char *panel_name, int y, int x, int lines, int cols);
|
WPanel *panel_sized_empty_new (const char *panel_name, const WRect * r);
|
||||||
WPanel *panel_sized_with_dir_new (const char *panel_name, int y, int x, int lines, int cols,
|
WPanel *panel_sized_with_dir_new (const char *panel_name, const WRect * r,
|
||||||
const vfs_path_t * vpath);
|
const vfs_path_t * vpath);
|
||||||
|
|
||||||
void panel_clean_dir (WPanel * panel);
|
void panel_clean_dir (WPanel * panel);
|
||||||
@ -217,7 +217,9 @@ static inline WPanel *
|
|||||||
panel_empty_new (const char *panel_name)
|
panel_empty_new (const char *panel_name)
|
||||||
{
|
{
|
||||||
/* Unknown sizes of the panel at startup */
|
/* Unknown sizes of the panel at startup */
|
||||||
return panel_sized_empty_new (panel_name, 0, 0, 1, 1);
|
WRect r = { 0, 0, 1, 1 };
|
||||||
|
|
||||||
|
return panel_sized_empty_new (panel_name, &r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
@ -234,7 +236,9 @@ static inline WPanel *
|
|||||||
panel_with_dir_new (const char *panel_name, const vfs_path_t * vpath)
|
panel_with_dir_new (const char *panel_name, const vfs_path_t * vpath)
|
||||||
{
|
{
|
||||||
/* Unknown sizes of the panel at startup */
|
/* Unknown sizes of the panel at startup */
|
||||||
return panel_sized_with_dir_new (panel_name, 0, 0, 1, 1, vpath);
|
WRect r = { 0, 0, 1, 1 };
|
||||||
|
|
||||||
|
return panel_sized_with_dir_new (panel_name, &r, vpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -258,18 +262,15 @@ panel_new (const char *panel_name)
|
|||||||
* Panel creation with specified size.
|
* Panel creation with specified size.
|
||||||
*
|
*
|
||||||
* @param panel_name name of panel for setup retrieving
|
* @param panel_name name of panel for setup retrieving
|
||||||
* @param y y coordinate of top-left corner
|
* @param r panel area
|
||||||
* @param x x coordinate of top-left corner
|
|
||||||
* @param lines vertical size
|
|
||||||
* @param cols horizontal size
|
|
||||||
*
|
*
|
||||||
* @return new instance of WPanel
|
* @return new instance of WPanel
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static inline WPanel *
|
static inline WPanel *
|
||||||
panel_sized_new (const char *panel_name, int y, int x, int lines, int cols)
|
panel_sized_new (const char *panel_name, const WRect * r)
|
||||||
{
|
{
|
||||||
return panel_sized_with_dir_new (panel_name, y, x, lines, cols, NULL);
|
return panel_sized_with_dir_new (panel_name, r, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user