mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
(mcview_new): use WRect to define a panel area.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
d16ca7a1f5
commit
fe47ac5b56
@ -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;
|
||||
|
@ -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 ());
|
||||
|
@ -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}.
|
||||
|
Loading…
Reference in New Issue
Block a user