From d16ca7a1f5265481638ef4dac28b8eeaa4c45c6a Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 18 Feb 2024 13:28:45 +0300 Subject: [PATCH] Modify WTree creation API. * (tree_init): use WRect to define widget area. * (create_panel): sync with modified API. * (tree_box): likewise. Signed-off-by: Andrew Borodin --- src/filemanager/boxes.c | 4 +++- src/filemanager/layout.c | 2 +- src/filemanager/tree.c | 5 ++--- src/filemanager/tree.h | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/filemanager/boxes.c b/src/filemanager/boxes.c index 2dbc75d65..6291ec5f0 100644 --- a/src/filemanager/boxes.c +++ b/src/filemanager/boxes.c @@ -1077,6 +1077,7 @@ char * tree_box (const char *current_dir) { WTree *mytree; + WRect r; WDialog *dlg; WGroup *g; Widget *wd; @@ -1091,7 +1092,8 @@ tree_box (const char *current_dir) g = GROUP (dlg); wd = WIDGET (dlg); - mytree = tree_new (2, 2, wd->rect.lines - 6, wd->rect.cols - 5, FALSE); + rect_init (&r, 2, 2, wd->rect.lines - 6, wd->rect.cols - 5); + mytree = tree_new (&r, FALSE); group_add_widget_autopos (g, mytree, WPOS_KEEP_ALL, NULL); group_add_widget_autopos (g, hline_new (wd->rect.lines - 4, 1, -1), WPOS_KEEP_BOTTOM, NULL); bar = buttonbar_new (); diff --git a/src/filemanager/layout.c b/src/filemanager/layout.c index d435bb29b..8fd70d5ba 100644 --- a/src/filemanager/layout.c +++ b/src/filemanager/layout.c @@ -1192,7 +1192,7 @@ create_panel (int num, panel_view_mode_t type) break; case view_tree: - new_widget = WIDGET (tree_new (r.y, r.x, r.lines, r.cols, TRUE)); + new_widget = WIDGET (tree_new (&r, TRUE)); break; case view_quick: diff --git a/src/filemanager/tree.c b/src/filemanager/tree.c index 6f86693d2..6b16dd8e6 100644 --- a/src/filemanager/tree.c +++ b/src/filemanager/tree.c @@ -1282,16 +1282,15 @@ tree_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) /* --------------------------------------------------------------------------------------------- */ WTree * -tree_new (int y, int x, int lines, int cols, gboolean is_panel) +tree_new (const WRect * r, gboolean is_panel) { - WRect r = { y, x, lines, cols }; WTree *tree; Widget *w; tree = g_new (WTree, 1); w = WIDGET (tree); - widget_init (w, &r, tree_callback, tree_mouse_callback); + widget_init (w, r, tree_callback, tree_mouse_callback); w->options |= WOP_SELECTABLE | WOP_TOP_SELECT; w->keymap = tree_map; diff --git a/src/filemanager/tree.h b/src/filemanager/tree.h index f1dbba686..5fda4a4fc 100644 --- a/src/filemanager/tree.h +++ b/src/filemanager/tree.h @@ -22,7 +22,7 @@ extern gboolean xtree_mode; /*** declarations of public functions ************************************************************/ -WTree *tree_new (int y, int x, int lines, int cols, gboolean is_panel); +WTree *tree_new (const WRect * r, gboolean is_panel); void tree_chdir (WTree * tree, const vfs_path_t * dir); const vfs_path_t *tree_selected_name (const WTree * tree);