Reorganize WDialog flags.

* DLG_FULLSCREEN: move and rename to WPOS_FULLSCREEN.
 * DLG_CENTER: move and rename to WPOS_CENTER.
 * DLG_TRYUP: move and rename to WPOS_TRYUP.
 * WDialog::fullscreen: remove, use WPOS_FULLSCREEN instead.
 * WDialog::compact: new field. Use instead of DLG_COMPACT.
 * WDialog:🎏 remove.
 * dlg_flags_t: remove.
 * dlg_create: add new agruments: pos_flags, compact. Remove
argument: flags.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2016-05-08 21:10:05 +03:00
parent 0933b08964
commit b4af91dfc0
27 changed files with 134 additions and 115 deletions

View File

@ -388,8 +388,9 @@ dlg_mouse_event (WDialog * h, Gpm_Event * event)
GList *p;
/* close the dialog by mouse left click out of dialog area */
if (mouse_close_dialog && !h->fullscreen && ((event->buttons & GPM_B_LEFT) != 0)
&& ((event->type & GPM_DOWN) != 0) && !mouse_global_in_widget (event, wh))
if (mouse_close_dialog && (wh->pos_flags & WPOS_FULLSCREEN) == 0
&& ((event->buttons & GPM_B_LEFT) != 0) && ((event->type & GPM_DOWN) != 0)
&& !mouse_global_in_widget (event, wh))
{
h->ret_value = B_CANCEL;
dlg_stop (h);
@ -649,7 +650,7 @@ dlg_default_repaint (WDialog * h)
if (!widget_get_state (wh, WST_ACTIVE))
return;
space = (h->flags & DLG_COMPACT) ? 0 : 1;
space = h->compact ? 0 : 1;
tty_setcolor (h->color[DLG_COLOR_NORMAL]);
dlg_erase (h);
@ -755,21 +756,35 @@ dlg_set_position (WDialog * h, int y, int x, int lines, int cols)
void
dlg_set_size (WDialog * h, int lines, int cols)
{
int x = WIDGET (h)->x;
int y = WIDGET (h)->y;
Widget *w = WIDGET (h);
int x, y;
if ((h->flags & DLG_CENTER) != 0)
if ((w->pos_flags & WPOS_FULLSCREEN) != 0)
{
y = (LINES - lines) / 2;
x = (COLS - cols) / 2;
y = 0;
x = 0;
lines = LINES;
cols = COLS;
}
if ((h->flags & DLG_TRYUP) != 0)
else
{
if (y > 3)
y -= 2;
else if (y == 3)
y = 2;
if ((w->pos_flags & WPOS_CENTER_HORZ) != 0)
x = (COLS - cols) / 2;
else
x = w->x;
if ((w->pos_flags & WPOS_CENTER_VERT) != 0)
y = (LINES - lines) / 2;
else
y = w->y;
if ((w->pos_flags & WPOS_TRYUP) != 0)
{
if (y > 3)
y -= 2;
else if (y == 3)
y = 2;
}
}
dlg_set_position (h, y, x, lines, cols);
@ -806,7 +821,7 @@ dlg_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, v
/* this is default resizing mechanism */
/* the main idea of this code is to resize dialog
according to flags (if any of flags require automatic
resizing, like DLG_CENTER, end after that reposition
resizing, like WPOS_CENTER, end after that reposition
controls in dialog according to flags of widget) */
dlg_set_size (h, w->lines, w->cols);
return MSG_HANDLED;
@ -821,17 +836,26 @@ dlg_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, v
/* --------------------------------------------------------------------------------------------- */
WDialog *
dlg_create (gboolean modal, int y1, int x1, int lines, int cols,
const int *colors, widget_cb_fn callback, widget_mouse_cb_fn mouse_callback,
const char *help_ctx, const char *title, dlg_flags_t flags)
dlg_create (gboolean modal, int y1, int x1, int lines, int cols, widget_pos_flags_t pos_flags,
gboolean compact, const int *colors, widget_cb_fn callback,
widget_mouse_cb_fn mouse_callback, const char *help_ctx, const char *title)
{
WDialog *new_d;
Widget *w;
if ((pos_flags & WPOS_FULLSCREEN) != 0)
{
y1 = 0;
x1 = 0;
lines = LINES;
cols = COLS;
}
new_d = g_new0 (WDialog, 1);
w = WIDGET (new_d);
widget_init (w, y1, x1, lines, cols, (callback != NULL) ? callback : dlg_default_callback,
mouse_callback);
w->pos_flags = pos_flags;
w->options |= WOP_TOP_SELECT;
w->state |= WST_CONSTRUCT;
@ -840,11 +864,10 @@ dlg_create (gboolean modal, int y1, int x1, int lines, int cols,
new_d->color = colors;
new_d->help_ctx = help_ctx;
new_d->flags = flags;
new_d->compact = compact;
new_d->data = NULL;
dlg_set_size (new_d, lines, cols);
new_d->fullscreen = (w->x == 0 && w->y == 0 && w->cols == COLS && w->lines == LINES);
new_d->mouse_status = MOU_UNHANDLED;
@ -1029,7 +1052,7 @@ do_refresh (void)
{
/* Search first fullscreen dialog */
for (; d != NULL; d = g_list_next (d))
if (d->data != NULL && DIALOG (d->data)->fullscreen)
if (d->data != NULL && (WIDGET (d->data)->pos_flags & WPOS_FULLSCREEN) != 0)
break;
/* back to top dialog */
for (; d != NULL; d = g_list_previous (d))

View File

@ -29,15 +29,6 @@
/*** enums ***************************************************************************************/
/* Flags for dlg_create */
typedef enum
{
DLG_NONE = 0, /* No options */
DLG_CENTER = (1 << 0), /* Center the dialog */
DLG_TRYUP = (1 << 1), /* Try to move two lines up the dialog */
DLG_COMPACT = (1 << 2) /* Suppress spaces around the frame */
} dlg_flags_t;
/* Dialog color constants */
typedef enum
{
@ -70,7 +61,7 @@ struct WDialog
Widget widget;
/* Set by the user */
dlg_flags_t flags; /* User flags */
gboolean compact; /* Suppress spaces around the frame */
const char *help_ctx; /* Name of the help entry */
const int *color; /* Color set. Unused in viewer and editor */
char *title; /* Title of the dialog */
@ -79,7 +70,6 @@ struct WDialog
int ret_value; /* Result of dlg_run() */
/* Internal flags */
gboolean fullscreen; /* Parents dialogs don't need refresh */
gboolean winch_pending; /* SIGWINCH signal has been got. Resize dialog after rise */
int mouse_status; /* For the autorepeat status of the mouse */
@ -115,8 +105,9 @@ extern const global_keymap_t *dialog_map;
/* Creates a dialog head */
WDialog *dlg_create (gboolean modal, int y1, int x1, int lines, int cols,
widget_pos_flags_t pos_flags, gboolean compact,
const int *colors, widget_cb_fn callback, widget_mouse_cb_fn mouse_callback,
const char *help_ctx, const char *title, dlg_flags_t flags);
const char *help_ctx, const char *title);
void dlg_set_default_colors (void);

View File

@ -319,8 +319,8 @@ history_show (GList ** history, Widget * widget, int current)
hist_data.maxlen = maxlen;
query_dlg =
dlg_create (TRUE, 0, 0, 4, 4, dialog_colors, history_dlg_callback, NULL,
"[History-query]", _("History"), DLG_COMPACT);
dlg_create (TRUE, 0, 0, 4, 4, WPOS_KEEP_DEFAULT, TRUE, dialog_colors, history_dlg_callback,
NULL, "[History-query]", _("History"));
query_dlg->data = &hist_data;
query_list = listbox_new (1, 1, 2, 2, TRUE, NULL);

View File

@ -67,7 +67,7 @@ hline_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
{
Widget *wo = WIDGET (h);
if (((h->flags & DLG_COMPACT) != 0))
if (h->compact)
{
w->x = wo->x;
w->cols = wo->cols;

View File

@ -1271,9 +1271,8 @@ complete_engine (WInput * in, int what_to_do)
query_height = h;
query_width = w;
query_dlg = dlg_create (TRUE, y, x, query_height, query_width,
dialog_colors, query_callback, NULL,
"[Completion]", NULL, DLG_COMPACT);
query_dlg = dlg_create (TRUE, y, x, query_height, query_width, WPOS_KEEP_DEFAULT, TRUE,
dialog_colors, query_callback, NULL, "[Completion]", NULL);
query_list = listbox_new (1, 1, h - 2, w - 2, FALSE, NULL);
add_widget (query_dlg, query_list);

View File

@ -63,7 +63,7 @@ create_listbox_window_centered (int center_y, int center_x, int lines, int cols,
int xpos = 0, ypos = 0;
Listbox *listbox;
dlg_flags_t dlg_flags = DLG_TRYUP;
widget_pos_flags_t pos_flags = WPOS_TRYUP;
/* Adjust sizes */
lines = MIN (lines, LINES - 6);
@ -80,7 +80,7 @@ create_listbox_window_centered (int center_y, int center_x, int lines, int cols,
/* adjust position */
if ((center_y < 0) || (center_x < 0))
dlg_flags |= DLG_CENTER;
pos_flags |= WPOS_CENTER;
else
{
/* Actually, this this is not used in MC. */
@ -105,8 +105,8 @@ create_listbox_window_centered (int center_y, int center_x, int lines, int cols,
listbox = g_new (Listbox, 1);
listbox->dlg =
dlg_create (TRUE, ypos, xpos, lines + space, cols + space,
listbox_colors, NULL, NULL, help, title, dlg_flags);
dlg_create (TRUE, ypos, xpos, lines + space, cols + space, pos_flags, FALSE, listbox_colors,
NULL, NULL, help, title);
listbox->list = listbox_new (2, 2, lines, cols, FALSE, NULL);
add_widget (listbox->dlg, listbox->list);

View File

@ -406,13 +406,13 @@ quick_dialog_skip (quick_dialog_t * quick_dlg, int nskip)
width2 = (quick_dlg->cols - 7) / 2;
if (quick_dlg->x == -1 || quick_dlg->y == -1)
dd = dlg_create (TRUE, 0, 0, y + 3, quick_dlg->cols,
dd = dlg_create (TRUE, 0, 0, y + 3, quick_dlg->cols, WPOS_CENTER | WPOS_TRYUP, FALSE,
dialog_colors, quick_dlg->callback, quick_dlg->mouse_callback,
quick_dlg->help, quick_dlg->title, DLG_CENTER | DLG_TRYUP);
quick_dlg->help, quick_dlg->title);
else
dd = dlg_create (TRUE, quick_dlg->y, quick_dlg->x, y + 3, quick_dlg->cols,
dialog_colors, quick_dlg->callback, quick_dlg->mouse_callback,
quick_dlg->help, quick_dlg->title, DLG_NONE);
WPOS_KEEP_DEFAULT, FALSE, dialog_colors, quick_dlg->callback,
quick_dlg->mouse_callback, quick_dlg->help, quick_dlg->title);
/* add widgets into the dialog */
x2 = x1 + width2 + 1;

View File

@ -90,21 +90,26 @@ typedef enum
/* Flags for widget repositioning on dialog resize */
typedef enum
{
WPOS_CENTER_HORZ = (1 << 0), /* center widget in horizontal */
WPOS_CENTER_VERT = (1 << 1), /* center widget in vertical */
WPOS_KEEP_LEFT = (1 << 2), /* keep widget distance to left border of dialog */
WPOS_KEEP_RIGHT = (1 << 3), /* keep widget distance to right border of dialog */
WPOS_KEEP_TOP = (1 << 4), /* keep widget distance to top border of dialog */
WPOS_KEEP_BOTTOM = (1 << 5), /* keep widget distance to bottom border of dialog */
WPOS_FULLSCREEN = (1 << 0), /* widget occupies the whole screen */
WPOS_CENTER_HORZ = (1 << 1), /* center widget in horizontal */
WPOS_CENTER_VERT = (1 << 2), /* center widget in vertical */
WPOS_CENTER = WPOS_CENTER_HORZ | WPOS_CENTER_VERT, /* center widget */
WPOS_TRYUP = (1 << 3), /* try to move two lines up the widget */
WPOS_KEEP_LEFT = (1 << 4), /* keep widget distance to left border of dialog */
WPOS_KEEP_RIGHT = (1 << 5), /* keep widget distance to right border of dialog */
WPOS_KEEP_TOP = (1 << 6), /* keep widget distance to top border of dialog */
WPOS_KEEP_BOTTOM = (1 << 7), /* keep widget distance to bottom border of dialog */
WPOS_KEEP_HORZ = WPOS_KEEP_LEFT | WPOS_KEEP_RIGHT,
WPOS_KEEP_VERT = WPOS_KEEP_TOP | WPOS_KEEP_BOTTOM,
WPOS_KEEP_ALL = WPOS_KEEP_HORZ | WPOS_KEEP_VERT,
WPOS_KEEP_DEFAULT = WPOS_KEEP_LEFT | WPOS_KEEP_TOP
} widget_pos_flags_t;
/* NOTE: if WPOS_CENTER_HORZ flag is used, other horizontal flags (WPOS_KEEP_LEFT, WPOS_KEEP_RIGHT,
* and WPOS_KEEP_HORZ are ignored).
/* NOTES:
* If WPOS_FULLSCREEN is set then all other position flags are ignored.
* If WPOS_CENTER_HORZ flag is used, other horizontal flags (WPOS_KEEP_LEFT, WPOS_KEEP_RIGHT,
* and WPOS_KEEP_HORZ) are ignored.
* If WPOS_CENTER_VERT flag is used, other horizontal flags (WPOS_KEEP_TOP, WPOS_KEEP_BOTTOM,
* and WPOS_KEEP_VERT are ignored).
* and WPOS_KEEP_VERT) are ignored.
*/
/*** structures declarations (and typedefs of structures)*****************************************/

View File

@ -70,7 +70,7 @@ query_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
switch (msg)
{
case MSG_RESIZE:
if ((h->flags & DLG_CENTER) == 0)
if ((w->pos_flags & WPOS_CENTER) == 0)
{
WDialog *prev_dlg = NULL;
int ypos, xpos;
@ -93,7 +93,7 @@ query_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
}
/* if previous dialog is not fullscreen'd -- overlap it */
if (prev_dlg == NULL || prev_dlg->fullscreen)
if (prev_dlg == NULL || (WIDGET (prev_dlg)->pos_flags & WPOS_FULLSCREEN) != 0)
ypos = LINES / 3 - (w->lines - 3) / 2;
else
ypos = WIDGET (prev_dlg)->y + 2;
@ -279,7 +279,8 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
int result = -1;
int cols, lines;
const int *query_colors = (flags & D_ERROR) != 0 ? alarm_colors : dialog_colors;
dlg_flags_t dlg_flags = (flags & D_CENTER) != 0 ? (DLG_CENTER | DLG_TRYUP) : DLG_NONE;
widget_pos_flags_t pos_flags =
(flags & D_CENTER) != 0 ? (WPOS_CENTER | WPOS_TRYUP) : WPOS_KEEP_DEFAULT;
if (header == MSG_ERROR)
header = _("Error");
@ -304,8 +305,8 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
/* prepare dialog */
query_dlg =
dlg_create (TRUE, 0, 0, lines, cols, query_colors, query_default_callback, NULL,
"[QueryBox]", header, dlg_flags);
dlg_create (TRUE, 0, 0, lines, cols, pos_flags, FALSE, query_colors, query_default_callback,
NULL, "[QueryBox]", header);
if (count > 0)
{
@ -585,8 +586,8 @@ status_msg_init (status_msg_t * sm, const char *title, double delay, status_msg_
start = mc_timer_elapsed (mc_global.timer);
sm->dlg = dlg_create (TRUE, 0, 0, 7, MIN (MAX (40, COLS / 2), COLS), dialog_colors,
NULL, NULL, NULL, title, DLG_CENTER);
sm->dlg = dlg_create (TRUE, 0, 0, 7, MIN (MAX (40, COLS / 2), COLS), WPOS_CENTER, FALSE,
dialog_colors, NULL, NULL, NULL, title);
sm->start = start;
sm->delay = (guint64) (delay * G_USEC_PER_SEC);
sm->block = FALSE;

View File

@ -3460,8 +3460,8 @@ diff_view (const char *file1, const char *file2, const char *label1, const char
/* Create dialog and widgets, put them on the dialog */
dview_dlg =
dlg_create (FALSE, 0, 0, LINES, COLS, NULL, dview_dialog_callback, NULL,
"[Diff Viewer]", NULL, DLG_NONE);
dlg_create (FALSE, 0, 0, 1, 1, WPOS_FULLSCREEN, FALSE, NULL, dview_dialog_callback, NULL,
"[Diff Viewer]", NULL);
widget_want_tab (WIDGET (dview_dlg), TRUE);
dview = g_new0 (WDiff, 1);

View File

@ -320,8 +320,8 @@ editcmd_dialog_raw_key_query (const char *heading, const char *query, gboolean c
w = MAX (w, wq + 3 * 2 + 1 + 2);
raw_dlg =
dlg_create (TRUE, 0, 0, cancel ? 7 : 5, w, dialog_colors, editcmd_dialog_raw_key_query_cb,
NULL, NULL, heading, DLG_CENTER | DLG_TRYUP);
dlg_create (TRUE, 0, 0, cancel ? 7 : 5, w, WPOS_CENTER | WPOS_TRYUP, FALSE, dialog_colors,
editcmd_dialog_raw_key_query_cb, NULL, NULL, heading);
widget_want_tab (WIDGET (raw_dlg), TRUE);
add_widget (raw_dlg, label_new (y, 3, query));
@ -380,8 +380,8 @@ editcmd_dialog_completion_show (const WEdit * edit, int max_len, GString ** comp
/* create the dialog */
compl_dlg =
dlg_create (TRUE, start_y, start_x, compl_dlg_h, compl_dlg_w,
dialog_colors, NULL, NULL, "[Completion]", NULL, DLG_COMPACT);
dlg_create (TRUE, start_y, start_x, compl_dlg_h, compl_dlg_w, WPOS_KEEP_DEFAULT, TRUE,
dialog_colors, NULL, NULL, "[Completion]", NULL);
/* create the listbox */
compl_list = listbox_new (1, 1, compl_dlg_h - 2, compl_dlg_w - 2, FALSE, NULL);
@ -446,8 +446,8 @@ editcmd_dialog_select_definition_show (WEdit * edit, char *match_expr, int max_l
start_y -= (offset + 1);
/* create the dialog */
def_dlg = dlg_create (TRUE, start_y, start_x, def_dlg_h, def_dlg_w,
dialog_colors, NULL, NULL, "[Definitions]", match_expr, DLG_COMPACT);
def_dlg = dlg_create (TRUE, start_y, start_x, def_dlg_h, def_dlg_w, WPOS_KEEP_DEFAULT, TRUE,
dialog_colors, NULL, NULL, "[Definitions]", match_expr);
/* create the listbox */
def_list = listbox_new (1, 1, def_dlg_h - 2, def_dlg_w - 2, FALSE, NULL);

View File

@ -1223,8 +1223,8 @@ edit_files (const GList * files)
/* Create a new dialog and add it widgets to it */
edit_dlg =
dlg_create (FALSE, 0, 0, LINES, COLS, NULL, edit_dialog_callback,
edit_dialog_mouse_callback, "[Internal File Editor]", NULL, DLG_NONE);
dlg_create (FALSE, 0, 0, 1, 1, WPOS_FULLSCREEN, FALSE, NULL, edit_dialog_callback,
edit_dialog_mouse_callback, "[Internal File Editor]", NULL);
widget_want_tab (WIDGET (edit_dlg), TRUE);
edit_dlg->get_shortcut = edit_get_shortcut;

View File

@ -109,8 +109,8 @@ spell_dialog_spell_suggest_show (WEdit * edit, const char *word, char **new_word
sug_dlg_w += max_btn_len;
sug_dlg_w = MAX (sug_dlg_w, word_label_len) + 1;
sug_dlg = dlg_create (TRUE, ypos, xpos, sug_dlg_h, sug_dlg_w,
dialog_colors, NULL, NULL, "[ASpell]", _("Check word"), DLG_COMPACT);
sug_dlg = dlg_create (TRUE, ypos, xpos, sug_dlg_h, sug_dlg_w, WPOS_KEEP_DEFAULT, TRUE,
dialog_colors, NULL, NULL, "[ASpell]", _("Check word"));
add_widget (sug_dlg, label_new (1, 2, lang_label));
add_widget (sug_dlg, label_new (3, 2, word_label));

View File

@ -340,8 +340,8 @@ do_enter_key (WDialog * h, int f_pos)
chl_end = FALSE;
chl_dlg =
dlg_create (TRUE, lyy, lxx, 13, 17, dialog_colors, chl_callback, NULL,
"[Advanced Chown]", title, DLG_COMPACT);
dlg_create (TRUE, lyy, lxx, 13, 17, WPOS_KEEP_DEFAULT, TRUE, dialog_colors,
chl_callback, NULL, "[Advanced Chown]", title);
/* get new listboxes */
chl_list = listbox_new (1, 1, 11, 15, FALSE, NULL);
@ -674,8 +674,8 @@ init_chown_advanced (void)
dlg_h += 2;
ch_dlg =
dlg_create (TRUE, 0, 0, dlg_h, dlg_w, dialog_colors, advanced_chown_callback, NULL,
"[Advanced Chown]", _("Chown advanced command"), DLG_CENTER);
dlg_create (TRUE, 0, 0, dlg_h, dlg_w, WPOS_CENTER, FALSE, dialog_colors,
advanced_chown_callback, NULL, "[Advanced Chown]", _("Chown advanced command"));
l_filename = label_new (2, 3, "");

View File

@ -198,8 +198,8 @@ sel_skin_button (WButton * button, int action)
lxx = COLS / 2;
lyy = (LINES - 13) / 2;
skin_dlg =
dlg_create (TRUE, lyy, lxx, 13, 24, dialog_colors, NULL, NULL, "[Appearance]", _("Skins"),
DLG_COMPACT);
dlg_create (TRUE, lyy, lxx, 13, 24, WPOS_KEEP_DEFAULT, TRUE, dialog_colors, NULL, NULL,
"[Appearance]", _("Skins"));
skin_list = listbox_new (1, 1, 11, 22, FALSE, NULL);
skin_name = "default";
@ -1020,8 +1020,8 @@ tree_box (const char *current_dir)
(void) current_dir;
/* Create the components */
dlg = dlg_create (TRUE, 0, 0, LINES - 9, COLS - 20, dialog_colors, tree_callback, NULL,
"[Directory Tree]", _("Directory tree"), DLG_CENTER);
dlg = dlg_create (TRUE, 0, 0, LINES - 9, COLS - 20, WPOS_CENTER, FALSE, dialog_colors,
tree_callback, NULL, "[Directory Tree]", _("Directory tree"));
wd = WIDGET (dlg);
mytree = tree_new (2, 2, wd->lines - 6, wd->cols - 5, FALSE);
@ -1240,8 +1240,8 @@ jobs_cmd (void)
x += (int) n_but - 1;
cols = MAX (cols, x + 6);
jobs_dlg = dlg_create (TRUE, 0, 0, lines, cols, dialog_colors, NULL, NULL,
"[Background jobs]", _("Background jobs"), DLG_CENTER);
jobs_dlg = dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, NULL, NULL,
"[Background jobs]", _("Background jobs"));
bg_list = listbox_new (2, 2, lines - 6, cols - 6, FALSE, NULL);
jobs_fill_listbox (bg_list);

View File

@ -305,8 +305,8 @@ init_chmod (const char *fname, const struct stat *sf_stat)
}
ch_dlg =
dlg_create (TRUE, 0, 0, lines, cols, dialog_colors,
chmod_callback, NULL, "[Chmod]", _("Chmod command"), DLG_CENTER);
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors,
chmod_callback, NULL, "[Chmod]", _("Chmod command"));
add_widget (ch_dlg, groupbox_new (PY, PX, check_perm_num + 2, perm_gb_len, _("Permission")));

View File

@ -213,8 +213,8 @@ init_chown (void)
lines = GH + 4 + (single_set ? 2 : 4);
ch_dlg =
dlg_create (TRUE, 0, 0, lines, cols, dialog_colors, chown_callback, NULL, "[Chown]",
_("Chown command"), DLG_CENTER);
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, chown_callback,
NULL, "[Chown]", _("Chown command"));
add_widget (ch_dlg, groupbox_new (2, 3, GH, GW, _("User name")));
l_user = listbox_new (3, 4, GH - 2, GW - 2, FALSE, NULL);

View File

@ -542,8 +542,8 @@ overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode)
/* FIXME - missing help node */
ui->replace_dlg =
dlg_create (TRUE, 0, 0, rd_ylen, rd_xlen, alarm_colors, NULL, NULL, "[Replace]", title,
DLG_CENTER);
dlg_create (TRUE, 0, 0, rd_ylen, rd_xlen, WPOS_CENTER, FALSE, alarm_colors, NULL, NULL,
"[Replace]", title);
/* prompt */
ADD_RD_LABEL (0, "", "", y++);
@ -746,8 +746,8 @@ file_op_context_create_ui (file_op_context_t * ctx, gboolean with_eta,
ui->replace_result = REPLACE_YES;
ui->op_dlg =
dlg_create (TRUE, 0, 0, dlg_height, dlg_width, dialog_colors, NULL, NULL, NULL,
op_names[ctx->operation], DLG_CENTER);
dlg_create (TRUE, 0, 0, dlg_height, dlg_width, WPOS_CENTER, FALSE, dialog_colors, NULL,
NULL, NULL, op_names[ctx->operation]);
if (dialog_type != FILEGUI_DIALOG_DELETE_ITEM)
{

View File

@ -661,8 +661,8 @@ find_parameters (char **start_dir, ssize_t * start_dir_len,
in_start_dir = g_strdup (".");
find_dlg =
dlg_create (TRUE, 0, 0, lines, cols, dialog_colors, find_parm_callback, NULL, "[Find File]",
_("Find File"), DLG_CENTER);
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, find_parm_callback,
NULL, "[Find File]", _("Find File"));
x1 = 3;
x2 = cols / 2 + 1;
@ -1615,8 +1615,8 @@ setup_gui (void)
cols = COLS - 16;
find_dlg =
dlg_create (TRUE, 0, 0, lines, cols, dialog_colors, find_callback, NULL, "[Find File]",
_("Find File"), DLG_CENTER);
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, find_callback, NULL,
"[Find File]", _("Find File"));
find_calc_button_locations (find_dlg, TRUE);

View File

@ -759,8 +759,8 @@ init_hotlist (hotlist_t list_type)
}
hotlist_dlg =
dlg_create (TRUE, 0, 0, lines, cols, dialog_colors, hotlist_callback, NULL, help_node,
title, DLG_CENTER);
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, hotlist_callback,
NULL, help_node, title);
y = UY;
hotlist_group = groupbox_new (y, UX, lines - 10 + dh, cols - 2 * UX, _("Top level group"));
@ -827,8 +827,8 @@ init_movelist (struct hotlist *item)
hdr = g_strdup_printf (_("Moving %s"), item->label);
movelist_dlg =
dlg_create (TRUE, 0, 0, lines, cols, dialog_colors, hotlist_callback, NULL, "[Hotlist]",
hdr, DLG_CENTER);
dlg_create (TRUE, 0, 0, lines, cols, WPOS_CENTER, FALSE, dialog_colors, hotlist_callback,
NULL, "[Hotlist]", hdr);
g_free (hdr);

View File

@ -510,8 +510,8 @@ init_layout (void)
width = max (l1 * 2 + 7, b);
layout_dlg =
dlg_create (TRUE, 0, 0, 15, width, dialog_colors, layout_callback, NULL, "[Layout]",
_("Layout"), DLG_CENTER);
dlg_create (TRUE, 0, 0, 15, width, WPOS_CENTER, FALSE, dialog_colors, layout_callback, NULL,
"[Layout]", _("Layout"));
#define XTRACT(i) *check_options[i].variable, check_options[i].text

View File

@ -198,8 +198,8 @@ init_listmode (char *oldlistformat)
do_refresh ();
listmode_dlg =
dlg_create (TRUE, 0, 0, 22, 74, dialog_colors, NULL, NULL, listmode_section,
"Listing format edit", DLG_CENTER | DLG_REVERSE);
dlg_create (TRUE, 0, 0, 22, 74, WPOS_CENTER, FALSE, dialog_colors, NULL, NULL,
listmode_section, "Listing format edit");
add_widget (listmode_dlg, groupbox_new (UY, UX, 4, 63, "General options"));
add_widget (listmode_dlg, groupbox_new (UY + 4, UX, 11, 18, "Items"));

View File

@ -1757,8 +1757,8 @@ do_nc (void)
edit_stack_init ();
#endif
midnight_dlg = dlg_create (FALSE, 0, 0, LINES, COLS, dialog_colors, midnight_callback, NULL,
"[main]", NULL, DLG_NONE);
midnight_dlg = dlg_create (FALSE, 0, 0, 1, 1, WPOS_FULLSCREEN, FALSE, dialog_colors,
midnight_callback, NULL, "[main]", NULL);
/* Check if we were invoked as an editor or file viewer */
if (mc_global.mc_run_mode != MC_RUN_FULL)

View File

@ -168,8 +168,8 @@ init_panelize (void)
panelize_cols = MAX (panelize_cols, blen + 4);
panelize_dlg =
dlg_create (TRUE, 0, 0, 20, panelize_cols, dialog_colors, panelize_callback, NULL,
"[External panelize]", _("External panelize"), DLG_CENTER);
dlg_create (TRUE, 0, 0, 20, panelize_cols, WPOS_CENTER, FALSE, dialog_colors,
panelize_callback, NULL, "[External panelize]", _("External panelize"));
/* add listbox to the dialogs */
y = UY;

View File

@ -1097,8 +1097,8 @@ help_interactive_display (const gchar * event_group_name, const gchar * event_na
help_lines = MIN (LINES - 4, MAX (2 * LINES / 3, 18));
whelp =
dlg_create (TRUE, 0, 0, help_lines + 4, HELP_WINDOW_WIDTH + 4, help_colors,
help_callback, NULL, "[Help]", _("Help"), DLG_TRYUP | DLG_CENTER);
dlg_create (TRUE, 0, 0, help_lines + 4, WPOS_CENTER | WPOS_TRYUP, FALSE,
HELP_WINDOW_WIDTH + 4, help_colors, help_callback, NULL, "[Help]", _("Help"));
widget_want_tab (WIDGET (whelp), TRUE);
selected_item = search_string_node (main_node, STRING_LINK_START) - 1;

View File

@ -274,8 +274,8 @@ init_learn (void)
do_refresh ();
learn_dlg =
dlg_create (TRUE, 0, 0, dlg_height, dlg_width, dialog_colors, learn_callback, NULL,
"[Learn keys]", learn_title, DLG_CENTER);
dlg_create (TRUE, 0, 0, dlg_height, dlg_width, WPOS_CENTER, FALSE, dialog_colors,
learn_callback, NULL, "[Learn keys]", learn_title);
/* find first unshown button */
for (key = key_name_conv_tab, learn_total = 0;

View File

@ -232,8 +232,8 @@ mcview_viewer (const char *command, const vfs_path_t * file_vpath, int start_lin
WDialog *view_dlg;
/* Create dialog and widgets, put them on the dialog */
view_dlg = dlg_create (FALSE, 0, 0, LINES, COLS, NULL, mcview_dialog_callback, NULL,
"[Internal File Viewer]", NULL, DLG_NONE);
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);
lc_mcview = mcview_new (0, 0, LINES - 1, COLS, FALSE);