mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
mcviewer: refactoring of MSG_RESIZE handling.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
5ca0dbab01
commit
2ddd6b41a0
@ -622,18 +622,8 @@ mcview_handle_key (WView * view, int key)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static inline void
|
||||
mcview_adjust_size (WDialog * h)
|
||||
mcview_resize (WView * view)
|
||||
{
|
||||
WView *view;
|
||||
WButtonBar *b;
|
||||
|
||||
/* Look up the viewer and the buttonbar, we assume only two widgets here */
|
||||
view = (WView *) find_widget_type (h, mcview_callback);
|
||||
b = find_buttonbar (h);
|
||||
|
||||
widget_set_size (WIDGET (view), 0, 0, LINES - 1, COLS);
|
||||
widget_set_size (WIDGET (b), LINES - 1, 0, 1, COLS);
|
||||
|
||||
view->dpy_wrap_dirty = TRUE;
|
||||
mcview_compute_areas (view);
|
||||
mcview_update_bytes_per_line (view);
|
||||
@ -725,6 +715,10 @@ mcview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
|
||||
mcview_update (view);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_RESIZE:
|
||||
mcview_resize (view);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_DESTROY:
|
||||
if (mcview_is_in_panel (view))
|
||||
{
|
||||
@ -773,10 +767,6 @@ mcview_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case MSG_RESIZE:
|
||||
mcview_adjust_size (h);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_ACTION:
|
||||
/* Handle shortcuts. */
|
||||
|
||||
|
@ -234,16 +234,19 @@ mcview_viewer (const char *command, const vfs_path_t * file_vpath, int start_lin
|
||||
gboolean succeeded;
|
||||
WView *lc_mcview;
|
||||
WDialog *view_dlg;
|
||||
Widget *vw, *b;
|
||||
|
||||
/* 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,
|
||||
NULL, "[Internal File Viewer]", NULL);
|
||||
widget_want_tab (WIDGET (view_dlg), TRUE);
|
||||
vw = WIDGET (view_dlg);
|
||||
widget_want_tab (vw, TRUE);
|
||||
|
||||
lc_mcview = mcview_new (0, 0, LINES - 1, COLS, FALSE);
|
||||
add_widget (view_dlg, lc_mcview);
|
||||
lc_mcview = mcview_new (vw->y, vw->x, vw->lines - 1, vw->cols, FALSE);
|
||||
add_widget_autopos (view_dlg, lc_mcview, WPOS_KEEP_ALL, NULL);
|
||||
|
||||
add_widget (view_dlg, buttonbar_new (TRUE));
|
||||
b = WIDGET (buttonbar_new (TRUE));
|
||||
add_widget_autopos (view_dlg, b, b->pos_flags, NULL);
|
||||
|
||||
view_dlg->get_title = mcview_get_title;
|
||||
|
||||
@ -256,7 +259,7 @@ mcview_viewer (const char *command, const vfs_path_t * file_vpath, int start_lin
|
||||
else
|
||||
dlg_stop (view_dlg);
|
||||
|
||||
if (widget_get_state (WIDGET (view_dlg), WST_CLOSED))
|
||||
if (widget_get_state (vw, WST_CLOSED))
|
||||
dlg_destroy (view_dlg);
|
||||
|
||||
return succeeded;
|
||||
|
Loading…
Reference in New Issue
Block a user