mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-22 03:02:06 +03:00
(widget_adjust_position): change argument for coordinates.
Use WRect instead of four values. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
390d614b5e
commit
caf41457c6
@ -406,7 +406,7 @@ dlg_create (gboolean modal, int y1, int x1, int lines, int cols, widget_pos_flag
|
||||
new_d = g_new0 (WDialog, 1);
|
||||
w = WIDGET (new_d);
|
||||
g = GROUP (new_d);
|
||||
widget_adjust_position (pos_flags, &r.y, &r.x, &r.lines, &r.cols);
|
||||
widget_adjust_position (pos_flags, &r);
|
||||
group_init (g, &r, callback != NULL ? callback : dlg_default_callback,
|
||||
mouse_callback != NULL ? mouse_callback : dlg_default_mouse_callback);
|
||||
|
||||
|
@ -461,7 +461,7 @@ group_default_resize (WGroup * g, WRect * r)
|
||||
WRect r0;
|
||||
|
||||
r0 = r != NULL ? *r : w->rect;
|
||||
widget_adjust_position (w->pos_flags, &r0.y, &r0.x, &r0.lines, &r0.cols);
|
||||
widget_adjust_position (w->pos_flags, &r0);
|
||||
group_set_position (g, &r0);
|
||||
}
|
||||
|
||||
|
@ -393,29 +393,29 @@ widget_set_options (Widget * w, widget_options_t options, gboolean enable)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
widget_adjust_position (widget_pos_flags_t pos_flags, int *y, int *x, int *lines, int *cols)
|
||||
widget_adjust_position (widget_pos_flags_t pos_flags, WRect * r)
|
||||
{
|
||||
if ((pos_flags & WPOS_FULLSCREEN) != 0)
|
||||
{
|
||||
*y = 0;
|
||||
*x = 0;
|
||||
*lines = LINES;
|
||||
*cols = COLS;
|
||||
r->y = 0;
|
||||
r->x = 0;
|
||||
r->lines = LINES;
|
||||
r->cols = COLS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((pos_flags & WPOS_CENTER_HORZ) != 0)
|
||||
*x = (COLS - *cols) / 2;
|
||||
r->x = (COLS - r->cols) / 2;
|
||||
|
||||
if ((pos_flags & WPOS_CENTER_VERT) != 0)
|
||||
*y = (LINES - *lines) / 2;
|
||||
r->y = (LINES - r->lines) / 2;
|
||||
|
||||
if ((pos_flags & WPOS_TRYUP) != 0)
|
||||
{
|
||||
if (*y > 3)
|
||||
*y -= 2;
|
||||
else if (*y == 3)
|
||||
*y = 2;
|
||||
if (r->y > 3)
|
||||
r->y -= 2;
|
||||
else if (r->y == 3)
|
||||
r->y = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ void widget_init (Widget * w, const WRect * r, widget_cb_fn callback,
|
||||
cb_ret_t widget_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
|
||||
void *data);
|
||||
void widget_set_options (Widget * w, widget_options_t options, gboolean enable);
|
||||
void widget_adjust_position (widget_pos_flags_t pos_flags, int *y, int *x, int *lines, int *cols);
|
||||
void widget_adjust_position (widget_pos_flags_t pos_flags, WRect * r);
|
||||
void widget_set_size (Widget * w, int y, int x, int lines, int cols);
|
||||
void widget_set_size_rect (Widget * w, WRect * r);
|
||||
/* select color for widget in dependance of state */
|
||||
|
@ -1505,8 +1505,7 @@ midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_RESIZE:
|
||||
widget_adjust_position (w->pos_flags, &w->rect.y, &w->rect.x, &w->rect.lines,
|
||||
&w->rect.cols);
|
||||
widget_adjust_position (w->pos_flags, &w->rect);
|
||||
setup_panels ();
|
||||
menubar_arrange (the_menubar);
|
||||
return MSG_HANDLED;
|
||||
|
Loading…
Reference in New Issue
Block a user