diff --git a/src/filemanager/layout.c b/src/filemanager/layout.c index 8fd70d5ba..f048d1882 100644 --- a/src/filemanager/layout.c +++ b/src/filemanager/layout.c @@ -1196,7 +1196,7 @@ create_panel (int num, panel_view_mode_t type) break; case view_quick: - new_widget = WIDGET (mcview_new (r.y, r.x, r.lines, r.cols, TRUE)); + new_widget = WIDGET (mcview_new (&r, TRUE)); the_other_panel = PANEL (panels[the_other].widget); if (the_other_panel != NULL) file_name = panel_current_entry (the_other_panel)->fname->str; diff --git a/src/viewer/mcviewer.c b/src/viewer/mcviewer.c index 1ec75c3d3..ca567b027 100644 --- a/src/viewer/mcviewer.c +++ b/src/viewer/mcviewer.c @@ -195,16 +195,15 @@ mcview_mouse_callback (Widget * w, mouse_msg_t msg, mouse_event_t * event) /* --------------------------------------------------------------------------------------------- */ WView * -mcview_new (int y, int x, int lines, int cols, gboolean is_panel) +mcview_new (const WRect * r, gboolean is_panel) { - WRect r = { y, x, lines, cols }; WView *view; Widget *w; view = g_new0 (WView, 1); w = WIDGET (view); - widget_init (w, &r, mcview_callback, mcview_mouse_callback); + widget_init (w, r, mcview_callback, mcview_mouse_callback); w->options |= WOP_SELECTABLE | WOP_TOP_SELECT; w->keymap = viewer_map; @@ -243,6 +242,7 @@ mcview_viewer (const char *command, const vfs_path_t * file_vpath, int start_lin WDialog *view_dlg; Widget *vw, *b; WGroup *g; + WRect r; /* Create dialog and widgets, put them on the dialog */ view_dlg = dlg_create (FALSE, 0, 0, 1, 1, WPOS_FULLSCREEN, FALSE, NULL, mcview_dialog_callback, @@ -252,7 +252,9 @@ mcview_viewer (const char *command, const vfs_path_t * file_vpath, int start_lin g = GROUP (view_dlg); - lc_mcview = mcview_new (vw->rect.y, vw->rect.x, vw->rect.lines - 1, vw->rect.cols, FALSE); + r = vw->rect; + r.lines--; + lc_mcview = mcview_new (&r, FALSE); group_add_widget_autopos (g, lc_mcview, WPOS_KEEP_ALL, NULL); b = WIDGET (buttonbar_new ()); diff --git a/src/viewer/mcviewer.h b/src/viewer/mcviewer.h index d90716c6e..e9b8577db 100644 --- a/src/viewer/mcviewer.h +++ b/src/viewer/mcviewer.h @@ -6,6 +6,7 @@ #define MC__VIEWER_H #include "lib/global.h" +#include "lib/widget.h" /* WRect */ /*** typedefs(not structures) and defined constants **********************************************/ @@ -37,10 +38,8 @@ extern char *mcview_show_eof; /*** declarations of public functions ************************************************************/ -/* Creates a new WView object with the given properties. Caveat: the - * origin is in y-x order, while the extent is in x-y order. */ -extern WView *mcview_new (int y, int x, int lines, int cols, gboolean is_panel); - +/* Creates a new WView object with the given properties. */ +extern WView *mcview_new (const WRect * r, gboolean is_panel); /* Shows {file} or the output of {command} in the internal viewer, * starting in line {start_line}.