Added D_CENTER flag to query dialog flags
...to forced place a query dialog in the center of the screen. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
e1f2b5b017
Коммит
19a4eb1ca6
lib
@ -390,7 +390,7 @@ close_error_pipe (int error, const char *text)
|
||||
if (error_pipe[0] == -1)
|
||||
return 0;
|
||||
|
||||
if (error)
|
||||
if (error < 0 || (error > 0 && (error & D_ERROR) != 0))
|
||||
title = MSG_ERROR;
|
||||
else
|
||||
title = _("Warning");
|
||||
@ -398,6 +398,9 @@ close_error_pipe (int error, const char *text)
|
||||
{
|
||||
if (dup2 (old_error, 2) == -1)
|
||||
{
|
||||
if (error < 0)
|
||||
error = D_ERROR;
|
||||
|
||||
message (error, MSG_ERROR, _("Error dup'ing old error pipe"));
|
||||
return 1;
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ default_query_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm,
|
||||
switch (msg)
|
||||
{
|
||||
case DLG_RESIZE:
|
||||
if ((h->flags & DLG_CENTER) == 0)
|
||||
{
|
||||
Dlg_head *prev_dlg = NULL;
|
||||
int ypos, xpos;
|
||||
@ -99,8 +100,10 @@ default_query_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm,
|
||||
|
||||
/* set position */
|
||||
dlg_set_position (h, ypos, xpos, ypos + h->lines, xpos + h->cols);
|
||||
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
return MSG_HANDLED;
|
||||
/* fallthrough */
|
||||
|
||||
default:
|
||||
return default_dlg_callback (h, sender, msg, parm, data);
|
||||
@ -314,7 +317,8 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
|
||||
int result = -1;
|
||||
int cols, lines;
|
||||
char *cur_name;
|
||||
const int *query_colors = (flags & D_ERROR) ? alarm_colors : dialog_colors;
|
||||
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;
|
||||
|
||||
if (header == MSG_ERROR)
|
||||
header = _("Error");
|
||||
@ -340,7 +344,7 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
|
||||
/* prepare dialog */
|
||||
query_dlg =
|
||||
create_dlg (TRUE, 0, 0, lines, cols, query_colors, default_query_callback,
|
||||
"[QueryBox]", header, DLG_NONE);
|
||||
"[QueryBox]", header, dlg_flags);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
|
@ -19,7 +19,8 @@
|
||||
enum
|
||||
{
|
||||
D_NORMAL = 0,
|
||||
D_ERROR = 1
|
||||
D_ERROR = (1 << 0),
|
||||
D_CENTER = (1 << 1)
|
||||
} /* dialog options */ ;
|
||||
|
||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user