Drop old QuickWidget engine.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-09-16 12:54:19 +04:00
parent dca06a6786
commit 298201d305
18 changed files with 1117 additions and 1568 deletions

View File

@ -31,7 +31,6 @@ typedef struct Dlg_head Dlg_head;
#include "lib/widget/input.h"
#include "lib/widget/listbox-window.h"
#include "lib/widget/quick.h"
#include "lib/widget/quick2.h"
#include "lib/widget/wtools.h"
#include "lib/widget/dialog-switch.h"

View File

@ -18,7 +18,6 @@ libmcwidget_la_SOURCES = \
label.c label.h \
menu.c menu.h \
quick.c quick.h \
quick2.c quick2.h \
radio.c radio.h \
widget-common.c widget-common.h \
wtools.c wtools.h

View File

@ -2,7 +2,7 @@
Widget based utility functions.
Copyright (C) 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011
2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
The Free Software Foundation, Inc.
Authors:
@ -10,7 +10,7 @@
Radek Doulik, 1994, 1995
Jakub Jelinek, 1995
Andrej Borsenkow, 1995
Andrew Borodin <aborodin@vmail.ru>, 2009, 2010
Andrew Borodin <aborodin@vmail.ru>, 2009, 2010, 2011, 2012
This file is part of the Midnight Commander.
@ -38,6 +38,7 @@
#include <stdio.h> /* fprintf() */
#include "lib/global.h"
#include "lib/strutil.h" /* str_term_width1() */
#include "lib/util.h" /* tilde_expand() */
#include "lib/widget.h"
@ -45,118 +46,518 @@
/*** file scope macro definitions ****************************************************************/
#ifdef ENABLE_NLS
#define I18N(x) (x = x != NULL && *x != '\0' ? _(x) : x)
#else
#define I18N(x) (x = x)
#endif
/*** file scope type declarations ****************************************************************/
typedef struct
{
Widget *widget;
quick_widget_t *quick_widget;
} quick_widget_item_t;
/*** file scope variables ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
static WInput *
quick_create_input (int y, int x, const quick_widget_t * qw)
{
WInput *in;
in = input_new (y, x, input_get_default_colors (), 8, qw->u.input.text, qw->u.input.histname,
INPUT_COMPLETE_DEFAULT);
in->is_password = (qw->u.input.flags == 1);
if ((qw->u.input.flags & 2) != 0)
in->completion_flags |= INPUT_COMPLETE_CD;
if ((qw->u.input.flags & 4) != 0)
in->strip_password = TRUE;
return in;
}
/* --------------------------------------------------------------------------------------------- */
static void
quick_create_labeled_input (GArray * widgets, int *y, int x, quick_widget_t * quick_widget,
int *width)
{
quick_widget_item_t in, label;
label.quick_widget = g_new0 (quick_widget_t, 1);
label.quick_widget->widget_type = quick_label;
label.quick_widget->options = quick_widget->options;
switch (quick_widget->u.input.label_location)
{
case input_label_above:
label.widget = WIDGET (label_new (*y, x, I18N (quick_widget->u.input.label_text)));
*y += label.widget->lines - 1;
g_array_append_val (widgets, label);
in.widget = WIDGET (quick_create_input (++(*y), x, quick_widget));
in.quick_widget = quick_widget;
g_array_append_val (widgets, in);
*width = max (label.widget->cols, in.widget->cols);
break;
case input_label_left:
label.widget = WIDGET (label_new (*y, x, I18N (quick_widget->u.input.label_text)));
g_array_append_val (widgets, label);
in.widget = WIDGET (quick_create_input (*y, x + label.widget->cols + 1, quick_widget));
in.quick_widget = quick_widget;
g_array_append_val (widgets, in);
*width = label.widget->cols + in.widget->cols + 1;
break;
case input_label_right:
in.widget = WIDGET (quick_create_input (*y, x, quick_widget));
in.quick_widget = quick_widget;
g_array_append_val (widgets, in);
label.widget =
WIDGET (label_new
(*y, x + in.widget->cols + 1, I18N (quick_widget->u.input.label_text)));
g_array_append_val (widgets, label);
*width = label.widget->cols + in.widget->cols + 1;
break;
case input_label_below:
in.widget = WIDGET (quick_create_input (*y, x, quick_widget));
in.quick_widget = quick_widget;
g_array_append_val (widgets, in);
label.widget = WIDGET (label_new (++(*y), x, I18N (quick_widget->u.input.label_text)));
*y += label.widget->lines - 1;
g_array_append_val (widgets, label);
*width = max (label.widget->cols, in.widget->cols);
break;
default:
return;
}
((WInput *) in.widget)->label = (WLabel *) label.widget;
/* cross references */
label.quick_widget->u.label.input = in.quick_widget;
in.quick_widget->u.input.label = label.quick_widget;
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
int
quick_dialog_skip (QuickDialog * qd, int nskip)
quick_dialog_skip (quick_dialog_t * quick_dlg, int nskip)
{
#ifdef ENABLE_NLS
#define I18N(x) (x = !qd->i18n && x != NULL && *x != '\0' ? _(x): x)
#else
#define I18N(x) (x = x)
#endif
int len;
int blen = 0;
int x, y; /* current positions */
int y1 = 0; /* bottom of 1st column in case of two columns */
int y2 = -1; /* start of two columns */
int width1 = 0; /* width of single column */
int width2 = 0; /* width of each of two columns*/
gboolean have_groupbox = FALSE;
gboolean two_columns = FALSE;
gboolean put_buttons = FALSE;
/* x position of 1st column is 3 */
const int x1 = 3;
/* x position of 2nd column is 4 and it will be fixed later, after creation of all widgets */
int x2 = 4;
GArray *widgets;
size_t i;
quick_widget_t *quick_widget;
WGroupbox *g = NULL;
Dlg_head *dd;
QuickWidget *qw;
WInput *in;
WRadio *r;
int return_val;
I18N (qd->title);
len = str_term_width1 (I18N (quick_dlg->title)) + 6;
quick_dlg->cols = max (quick_dlg->cols, len);
if ((qd->xpos == -1) || (qd->ypos == -1))
dd = create_dlg (TRUE, 0, 0, qd->ylen, qd->xlen,
dialog_colors, qd->callback, qd->mouse, qd->help, qd->title,
DLG_CENTER | DLG_TRYUP | DLG_REVERSE);
else
dd = create_dlg (TRUE, qd->ypos, qd->xpos, qd->ylen, qd->xlen,
dialog_colors, qd->callback, qd->mouse, qd->help, qd->title, DLG_REVERSE);
y = 1;
x = x1;
for (qw = qd->widgets; qw->widget_type != quick_end; qw++)
/* create widgets */
widgets = g_array_sized_new (FALSE, FALSE, sizeof (quick_widget_item_t), 8);
for (quick_widget = quick_dlg->widgets; quick_widget->widget_type != quick_end; quick_widget++)
{
int xpos;
int ypos;
quick_widget_item_t item = { NULL, quick_widget };
int width = 0;
xpos = (qd->xlen * qw->relative_x) / qw->x_divisions;
ypos = (qd->ylen * qw->relative_y) / qw->y_divisions;
switch (qw->widget_type)
switch (quick_widget->widget_type)
{
case quick_checkbox:
qw->widget = WIDGET (check_new (ypos, xpos, *qw->u.checkbox.state,
I18N (qw->u.checkbox.text)));
item.widget =
WIDGET (check_new
(++y, x, *quick_widget->u.checkbox.state,
I18N (quick_widget->u.checkbox.text)));
g_array_append_val (widgets, item);
width = item.widget->cols;
if (g != NULL)
width += 2;
if (two_columns)
width2 = max (width2, width);
else
width1 = max (width1, width);
break;
case quick_button:
qw->widget = WIDGET (button_new (ypos, xpos, qw->u.button.action,
qw->u.button.action == B_ENTER ?
DEFPUSH_BUTTON : NORMAL_BUTTON,
I18N (qw->u.button.text), qw->u.button.callback));
/* single button */
item.widget = WIDGET (button_new (++y, x, quick_widget->u.button.action,
quick_widget->u.button.action == B_ENTER ?
DEFPUSH_BUTTON : NORMAL_BUTTON,
I18N (quick_widget->u.button.text),
quick_widget->u.button.callback));
g_array_append_val (widgets, item);
width = item.widget->cols;
if (g != NULL)
width += 2;
if (two_columns)
width2 = max (width2, width);
else
width1 = max (width1, width);
break;
case quick_input:
in = input_new (ypos, xpos, input_get_default_colors (),
qw->u.input.len, qw->u.input.text, qw->u.input.histname,
INPUT_COMPLETE_DEFAULT);
in->is_password = (qw->u.input.flags == 1);
if ((qw->u.input.flags & 2) != 0)
in->completion_flags |= INPUT_COMPLETE_CD;
if ((qw->u.input.flags & 4) != 0)
in->strip_password = TRUE;
qw->widget = WIDGET (in);
*qw->u.input.result = NULL;
*quick_widget->u.input.result = NULL;
y++;
if (quick_widget->u.input.label_location != input_label_none)
quick_create_labeled_input (widgets, &y, x, quick_widget, &width);
else
{
item.widget = WIDGET (quick_create_input (y, x, quick_widget));
g_array_append_val (widgets, item);
width = item.widget->cols;
}
if (g != NULL)
width += 2;
if (two_columns)
width2 = max (width2, width);
else
width1 = max (width1, width);
break;
case quick_label:
qw->widget = WIDGET (label_new (ypos, xpos, I18N (qw->u.label.text)));
break;
case quick_groupbox:
qw->widget = WIDGET (groupbox_new (ypos, xpos,
qw->u.groupbox.height,
qw->u.groupbox.width,
I18N (qw->u.groupbox.title)));
item.widget = WIDGET (label_new (++y, x, I18N (quick_widget->u.label.text)));
g_array_append_val (widgets, item);
y += item.widget->lines - 1;
width = item.widget->cols;
if (g != NULL)
width += 2;
if (two_columns)
width2 = max (width2, width);
else
width1 = max (width1, width);
break;
case quick_radio:
{
int i;
WRadio *r;
char **items = NULL;
/* create the copy of radio_items to avoid mwmory leak */
items = g_new0 (char *, qw->u.radio.count + 1);
items = g_new (char *, quick_widget->u.radio.count + 1);
for (i = 0; i < (size_t) quick_widget->u.radio.count; i++)
items[i] = g_strdup (_(quick_widget->u.radio.items[i]));
items[i] = NULL;
if (!qd->i18n)
for (i = 0; i < qw->u.radio.count; i++)
items[i] = g_strdup (_(qw->u.radio.items[i]));
else
for (i = 0; i < qw->u.radio.count; i++)
items[i] = g_strdup (qw->u.radio.items[i]);
r = radio_new (ypos, xpos, qw->u.radio.count, (const char **) items);
r->pos = r->sel = *qw->u.radio.value;
qw->widget = WIDGET (r);
r = radio_new (++y, x, quick_widget->u.radio.count, (const char **) items);
r->pos = r->sel = *quick_widget->u.radio.value;
g_strfreev (items);
break;
item.widget = WIDGET (r);
g_array_append_val (widgets, item);
y += item.widget->lines - 1;
width = item.widget->cols;
if (g != NULL)
width += 2;
if (two_columns)
width2 = max (width2, width);
else
width1 = max (width1, width);
}
break;
case quick_start_groupbox:
I18N (quick_widget->u.groupbox.title);
len = str_term_width1 (quick_widget->u.groupbox.title);
g = groupbox_new (++y, x, 1, len + 4, quick_widget->u.groupbox.title);
item.widget = WIDGET (g);
g_array_append_val (widgets, item);
have_groupbox = TRUE;
break;
case quick_stop_groupbox:
if (g != NULL)
{
Widget *w = WIDGET (g);
y++;
w->lines = y + 1 - w->y;
g = NULL;
g_array_append_val (widgets, item);
}
break;
case quick_separator:
y++;
if (quick_widget->u.separator.line)
{
item.widget = WIDGET (hline_new (y, x, 1));
g_array_append_val (widgets, item);
}
break;
case quick_start_columns:
y2 = y;
g_array_append_val (widgets, item);
two_columns = TRUE;
break;
case quick_next_column:
x = x2;
y1 = y;
y = y2;
break;
case quick_stop_columns:
x = x1;
y = max (y1, y);
g_array_append_val (widgets, item);
two_columns = FALSE;
break;
case quick_buttons:
/* start put several buttons in bottom line */
if (quick_widget->u.separator.space)
{
y++;
if (quick_widget->u.separator.line)
item.widget = WIDGET (hline_new (y, 1, -1));
}
g_array_append_val (widgets, item);
/* several buttons in bottom line */
y++;
quick_widget++;
for (; quick_widget->widget_type == quick_button; quick_widget++)
{
item.widget = WIDGET (button_new (y, x++, quick_widget->u.button.action,
quick_widget->u.button.action == B_ENTER ?
DEFPUSH_BUTTON : NORMAL_BUTTON,
I18N (quick_widget->u.button.text),
quick_widget->u.button.callback));
item.quick_widget = quick_widget;
g_array_append_val (widgets, item);
blen += item.widget->cols + 1;
}
/* stop dialog build here */
blen--;
quick_widget->widget_type = quick_end;
quick_widget--;
break;
default:
break;
}
}
/* adjust dialog width */
quick_dlg->cols = max (quick_dlg->cols, blen + 6);
if (have_groupbox)
{
if (width1 != 0)
width1 += 2;
if (width2 != 0)
width2 += 2;
}
if (width2 == 0)
len = width1 + 6;
else
{
len = width2 * 2 + 7;
if (width1 != 0)
len = max (len, width1 + 6);
}
quick_dlg->cols = max (quick_dlg->cols, len);
width1 = quick_dlg->cols - 6;
width2 = (quick_dlg->cols - 7) / 2;
if (quick_dlg->x == -1 || quick_dlg->y == -1)
dd = create_dlg (TRUE, 0, 0, y + 3, quick_dlg->cols,
dialog_colors, quick_dlg->callback, quick_dlg->mouse, quick_dlg->help,
quick_dlg->title, DLG_CENTER | DLG_TRYUP);
else
dd = create_dlg (TRUE, quick_dlg->y, quick_dlg->x, y + 3, quick_dlg->cols,
dialog_colors, quick_dlg->callback, quick_dlg->mouse, quick_dlg->help,
quick_dlg->title, DLG_NONE);
/* add widgets into the dialog */
x2 = x1 + width2 + 1;
g = NULL;
two_columns = FALSE;
x = (WIDGET (dd)->cols - blen) / 2;
for (i = 0; i < widgets->len; i++)
{
quick_widget_item_t *item;
int column_width;
item = &g_array_index (widgets, quick_widget_item_t, i);
column_width = two_columns ? width2 : width1;
/* adjust widget width and x position */
switch (item->quick_widget->widget_type)
{
case quick_label:
{
quick_widget_t *input = item->quick_widget->u.label.input;
if (input != NULL && input->u.input.label_location == input_label_right)
{
/* location of this label will be adjusted later */
break;
}
}
/* fall through */
case quick_checkbox:
case quick_radio:
if (item->widget->x != x1)
item->widget->x = x2;
if (g != NULL)
item->widget->x += 2;
break;
case quick_button:
if (!put_buttons)
{
if (item->widget->x != x1)
item->widget->x = x2;
if (g != NULL)
item->widget->x += 2;
}
else
{
item->widget->x = x;
x += item->widget->cols + 1;
}
break;
case quick_input:
{
Widget *label = WIDGET (((WInput *) item->widget)->label);
int width = column_width;
if (g != NULL)
width -= 4;
switch (item->quick_widget->u.input.label_location)
{
case input_label_left:
/* label was adjusted before; adjust input line */
item->widget->x = label->x + label->cols + 1 - WIDGET (label->owner)->x;
item->widget->cols = width - label->cols - 1;
break;
case input_label_right:
label->x =
item->widget->x + item->widget->cols + 1 - WIDGET (item->widget->owner)->x;
item->widget->cols = width - label->cols - 1;
break;
default:
if (item->widget->x != x1)
item->widget->x = x2;
if (g != NULL)
item->widget->x += 2;
item->widget->cols = width;
break;
}
/* forced update internal variables of inpuit line */
input_set_origin ((WInput *) (item->widget), item->widget->x, item->widget->cols);
}
break;
case quick_start_groupbox:
g = (WGroupbox *) item->widget;
if (item->widget->x != x1)
item->widget->x = x2;
item->widget->cols = column_width;
break;
case quick_stop_groupbox:
g = NULL;
break;
case quick_separator:
if (item->widget != NULL)
{
if (g != NULL)
{
Widget *wg = WIDGET (g);
((WHLine *) item->widget)->auto_adjust_cols = FALSE;
item->widget->x = wg->x + 1 - WIDGET (wg->owner)->x;
item->widget->cols = wg->cols;
}
else if (two_columns)
{
((WHLine *) item->widget)->auto_adjust_cols = FALSE;
if (item->widget->x != x1)
item->widget->x = x2;
item->widget->x--;
item->widget->cols = column_width + 2;
}
else
((WHLine *) item->widget)->auto_adjust_cols = TRUE;
}
break;
case quick_start_columns:
two_columns = TRUE;
break;
case quick_stop_columns:
two_columns = FALSE;
break;
case quick_buttons:
/* several buttons in bottom line */
put_buttons = TRUE;
break;
default:
qw->widget = NULL;
fprintf (stderr, "QuickWidget: unknown widget type\n");
break;
}
if (qw->widget != NULL)
if (item->widget != NULL)
{
qw->widget->options |= qw->options; /* FIXME: cannot reset flags, setup only */
add_widget (dd, qw->widget);
unsigned long id;
/* add widget into dialog */
item->widget->options |= item->quick_widget->options; /* FIXME: cannot reset flags, setup only */
id = add_widget (dd, item->widget);
if (item->quick_widget->id != NULL)
*item->quick_widget->id = id;
}
}
@ -171,36 +572,51 @@ quick_dialog_skip (QuickDialog * qd, int nskip)
/* Get the data if we found something interesting */
if (return_val != B_CANCEL)
{
for (qw = qd->widgets; qw->widget_type != quick_end; qw++)
for (i = 0; i < widgets->len; i++)
{
switch (qw->widget_type)
quick_widget_item_t *item;
item = &g_array_index (widgets, quick_widget_item_t, i);
switch (item->quick_widget->widget_type)
{
case quick_checkbox:
*qw->u.checkbox.state = ((WCheck *) qw->widget)->state & C_BOOL;
*item->quick_widget->u.checkbox.state = ((WCheck *) item->widget)->state & C_BOOL;
break;
case quick_input:
if ((qw->u.input.flags & 2) != 0)
*qw->u.input.result = tilde_expand (((WInput *) qw->widget)->buffer);
if ((quick_widget->u.input.flags & 2) != 0)
*item->quick_widget->u.input.result =
tilde_expand (((WInput *) item->widget)->buffer);
else
*qw->u.input.result = g_strdup (((WInput *) qw->widget)->buffer);
*item->quick_widget->u.input.result =
g_strdup (((WInput *) item->widget)->buffer);
break;
case quick_radio:
*qw->u.radio.value = ((WRadio *) qw->widget)->sel;
*item->quick_widget->u.radio.value = ((WRadio *) item->widget)->sel;
break;
default:
break;
}
}
}
destroy_dlg (dd);
/* destroy input labels created before */
for (i = 0; i < widgets->len; i++)
{
quick_widget_item_t *item;
item = &g_array_index (widgets, quick_widget_item_t, i);
if (item->quick_widget->widget_type == quick_input)
g_free (item->quick_widget->u.input.label);
}
g_array_free (widgets, TRUE);
return return_val;
#undef I18N
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -9,131 +9,207 @@
/*** typedefs(not structures) and defined constants **********************************************/
#define QUICK_CHECKBOX(x, xdiv, y, ydiv, txt, st) \
{ \
.widget_type = quick_checkbox, \
.relative_x = x, \
.x_divisions = xdiv, \
.relative_y = y, \
.y_divisions = ydiv, \
.widget = NULL, \
.options = 0, \
.u = { \
.checkbox = { \
.text = txt, \
.state = st \
} \
} \
#define QUICK_CHECKBOX(txt, st, id_) \
{ \
.widget_type = quick_checkbox, \
.options = 0, \
.id = id_, \
.u = { \
.checkbox = { \
.text = txt, \
.state = st \
} \
} \
}
#define QUICK_BUTTON(x, xdiv, y, ydiv, txt, act, cb) \
{ \
.widget_type = quick_button, \
.relative_x = x, \
.x_divisions = xdiv, \
.relative_y = y, \
.y_divisions = ydiv, \
.widget = NULL, \
.options = 0, \
.u = { \
.button = { \
.text = txt, \
.action = act, \
.callback = cb \
} \
} \
#define QUICK_BUTTON(txt, act, cb, id_) \
{ \
.widget_type = quick_button, \
.options = 0, \
.id = id_, \
.u = { \
.button = { \
.text = txt, \
.action = act, \
.callback = cb \
} \
} \
}
#define QUICK_INPUT(x, xdiv, y, ydiv, txt, len_, flags_, hname, res) \
{ \
.widget_type = quick_input, \
.relative_x = x, \
.x_divisions = xdiv, \
.relative_y = y, \
.y_divisions = ydiv, \
.widget = NULL, \
.options = 0, \
.u = { \
.input = { \
.text = txt, \
.len = len_, \
.flags = flags_, \
.histname = hname, \
.result = res \
} \
} \
#define QUICK_INPUT(txt, flags_, hname, res, id_) \
{ \
.widget_type = quick_input, \
.options = 0, \
.id = id_, \
.u = { \
.input = { \
.label_text = NULL, \
.label_location = input_label_none, \
.label = NULL, \
.text = txt, \
.flags = flags_, \
.histname = hname, \
.result = res \
} \
} \
}
#define QUICK_LABEL(x, xdiv, y, ydiv, txt) \
{ \
.widget_type = quick_label, \
.relative_x = x, \
.x_divisions = xdiv, \
.relative_y = y, \
.y_divisions = ydiv, \
.widget = NULL, \
.options = 0, \
.u = { \
.label = { \
.text = txt \
} \
} \
#define QUICK_LABELED_INPUT(label_, label_loc, txt, flags_, hname, res, id_) \
{ \
.widget_type = quick_input, \
.options = 0, \
.id = id_, \
.u = { \
.input = { \
.label_text = label_, \
.label_location = label_loc, \
.label = NULL, \
.text = txt, \
.flags = flags_, \
.histname = hname, \
.result = res \
} \
} \
}
#define QUICK_RADIO(x, xdiv, y, ydiv, cnt, items_, val) \
{ \
.widget_type = quick_radio, \
.relative_x = x, \
.x_divisions = xdiv, \
.relative_y = y, \
.y_divisions = ydiv, \
.widget = NULL, \
.options = 0, \
.u = { \
.radio = { \
.count = cnt, \
.items = items_, \
.value = val \
} \
} \
#define QUICK_LABEL(txt, id_) \
{ \
.widget_type = quick_label, \
.options = 0, \
.id = id_, \
.u = { \
.label = { \
.text = txt, \
.input = NULL \
} \
} \
}
#define QUICK_GROUPBOX(x, xdiv, y, ydiv, w, h, t) \
{ \
.widget_type = quick_groupbox, \
.relative_x = x, \
.x_divisions = xdiv, \
.relative_y = y, \
.y_divisions = ydiv, \
.widget = NULL, \
.options = 0, \
.u = { \
.groupbox = { \
.width = w, \
.height = h, \
.title = t \
} \
} \
#define QUICK_RADIO(cnt, items_, val, id_) \
{ \
.widget_type = quick_radio, \
.options = 0, \
.id = id_, \
.u = { \
.radio = { \
.count = cnt, \
.items = items_, \
.value = val \
} \
} \
}
#define QUICK_END \
{ \
.widget_type = quick_end, \
.relative_x = 0, \
.x_divisions = 0, \
.relative_y = 0, \
.y_divisions = 0, \
.widget = NULL, \
.options = 0, \
.u = { \
.input = { \
.text = NULL, \
.len = 0, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
} \
#define QUICK_START_GROUPBOX(t) \
{ \
.widget_type = quick_start_groupbox, \
.options = 0, \
.id = NULL, \
.u = { \
.groupbox = { \
.title = t \
} \
} \
}
#define QUICK_STOP_GROUPBOX \
{ \
.widget_type = quick_stop_groupbox, \
.options = 0, \
.id = NULL, \
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
} \
}
#define QUICK_SEPARATOR(line_) \
{ \
.widget_type = quick_separator, \
.options = 0, \
.id = NULL, \
.u = { \
.separator = { \
.space = TRUE, \
.line = line_ \
} \
} \
}
#define QUICK_START_COLUMNS \
{ \
.widget_type = quick_start_columns, \
.options = 0, \
.id = NULL, \
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
} \
}
#define QUICK_NEXT_COLUMN \
{ \
.widget_type = quick_next_column, \
.options = 0, \
.id = NULL, \
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
} \
}
#define QUICK_STOP_COLUMNS \
{ \
.widget_type = quick_stop_columns, \
.options = 0, \
.id = NULL, \
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
} \
}
#define QUICK_START_BUTTONS(space_, line_) \
{ \
.widget_type = quick_buttons, \
.options = 0, \
.id = NULL, \
.u = { \
.separator = { \
.space = space_, \
.line = line_ \
} \
} \
}
#define QUICK_END \
{ \
.widget_type = quick_end, \
.options = 0, \
.id = NULL, \
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
} \
}
/*** enums ***************************************************************************************/
@ -147,23 +223,35 @@ typedef enum
quick_input = 3,
quick_label = 4,
quick_radio = 5,
quick_groupbox = 6
quick_start_groupbox = 6,
quick_stop_groupbox = 7,
quick_separator = 8,
quick_start_columns = 9,
quick_next_column = 10,
quick_stop_columns = 11,
quick_buttons = 12
} quick_t;
typedef enum
{
input_label_none = 0,
input_label_above = 1,
input_label_left = 2,
input_label_right = 3,
input_label_below = 4
} quick_input_label_location_t;
/*** structures declarations (and typedefs of structures)*****************************************/
/* The widget is placed on relative_?/divisions_? of the parent widget */
typedef struct
typedef struct quick_widget_t quick_widget_t;
struct quick_widget_t
{
quick_t widget_type;
int relative_x;
int x_divisions;
int relative_y;
int y_divisions;
Widget *widget;
widget_options_t options;
unsigned long *id;
/* widget parameters */
union
@ -183,8 +271,10 @@ typedef struct
struct
{
const char *label_text;
quick_input_label_location_t label_location;
quick_widget_t *label;
const char *text;
int len;
int flags; /* 1 -- is_password, 2 -- INPUT_COMPLETE_CD */
const char *histname;
char **result;
@ -194,6 +284,7 @@ typedef struct
struct
{
const char *text;
quick_widget_t *input;
} label;
struct
@ -205,37 +296,40 @@ typedef struct
struct
{
int width;
int height;
const char *title;
} groupbox;
struct
{
gboolean space;
gboolean line;
} separator;
} u;
} QuickWidget;
};
typedef struct
{
int xlen, ylen;
int xpos, ypos; /* if -1, then center the dialog */
int y, x; /* if -1, then center the dialog */
int cols; /* heigth is calculated automatically */
const char *title;
const char *help;
QuickWidget *widgets;
quick_widget_t *widgets;
dlg_cb_fn callback;
mouse_h mouse;
gboolean i18n; /* If true, internationalization has happened */
} QuickDialog;
} quick_dialog_t;
/*** global variables defined in .c file *********************************************************/
/*** declarations of public functions ************************************************************/
int quick_dialog_skip (QuickDialog * qd, int nskip);
int quick_dialog_skip (quick_dialog_t * quick_dlg, int nskip);
/*** inline functions ****************************************************************************/
static inline int
quick_dialog (QuickDialog * qd)
quick_dialog (quick_dialog_t * quick_dlg)
{
return quick_dialog_skip (qd, 0);
return quick_dialog_skip (quick_dlg, 1);
}
#endif /* MC__QUICK_H */

View File

@ -1,622 +0,0 @@
/*
Widget based utility functions.
Copyright (C) 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
The Free Software Foundation, Inc.
Authors:
Miguel de Icaza, 1994, 1995, 1996
Radek Doulik, 1994, 1995
Jakub Jelinek, 1995
Andrej Borsenkow, 1995
Andrew Borodin <aborodin@vmail.ru>, 2009, 2010, 2011, 2012
This file is part of the Midnight Commander.
The Midnight Commander is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
The Midnight Commander is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** \file quick2.c
* \brief Source: quick dialog engine
*/
#include <config.h>
#include <stdlib.h>
#include <stdio.h> /* fprintf() */
#include "lib/global.h"
#include "lib/strutil.h" /* str_term_width1() */
#include "lib/util.h" /* tilde_expand() */
#include "lib/widget.h"
/*** global variables ****************************************************************************/
/*** file scope macro definitions ****************************************************************/
#ifdef ENABLE_NLS
#define I18N(x) (x = x != NULL && *x != '\0' ? _(x) : x)
#else
#define I18N(x) (x = x)
#endif
/*** file scope type declarations ****************************************************************/
typedef struct
{
Widget *widget;
quick_widget_t *quick_widget;
} quick_widget_item_t;
/*** file scope variables ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
static WInput *
quick_create_input (int y, int x, const quick_widget_t * qw)
{
WInput *in;
in = input_new (y, x, input_get_default_colors (), 8, qw->u.input.text, qw->u.input.histname,
INPUT_COMPLETE_DEFAULT);
in->is_password = (qw->u.input.flags == 1);
if ((qw->u.input.flags & 2) != 0)
in->completion_flags |= INPUT_COMPLETE_CD;
if ((qw->u.input.flags & 4) != 0)
in->strip_password = TRUE;
return in;
}
/* --------------------------------------------------------------------------------------------- */
static void
quick_create_labeled_input (GArray * widgets, int *y, int x, quick_widget_t * quick_widget,
int *width)
{
quick_widget_item_t in, label;
label.quick_widget = g_new0 (quick_widget_t, 1);
label.quick_widget->widget_type = quick2_label;
label.quick_widget->options = quick_widget->options;
switch (quick_widget->u.input.label_location)
{
case input_label_above:
label.widget = WIDGET (label_new (*y, x, I18N (quick_widget->u.input.label_text)));
*y += label.widget->lines - 1;
g_array_append_val (widgets, label);
in.widget = WIDGET (quick_create_input (++(*y), x, quick_widget));
in.quick_widget = quick_widget;
g_array_append_val (widgets, in);
*width = max (label.widget->cols, in.widget->cols);
break;
case input_label_left:
label.widget = WIDGET (label_new (*y, x, I18N (quick_widget->u.input.label_text)));
g_array_append_val (widgets, label);
in.widget = WIDGET (quick_create_input (*y, x + label.widget->cols + 1, quick_widget));
in.quick_widget = quick_widget;
g_array_append_val (widgets, in);
*width = label.widget->cols + in.widget->cols + 1;
break;
case input_label_right:
in.widget = WIDGET (quick_create_input (*y, x, quick_widget));
in.quick_widget = quick_widget;
g_array_append_val (widgets, in);
label.widget =
WIDGET (label_new
(*y, x + in.widget->cols + 1, I18N (quick_widget->u.input.label_text)));
g_array_append_val (widgets, label);
*width = label.widget->cols + in.widget->cols + 1;
break;
case input_label_below:
in.widget = WIDGET (quick_create_input (*y, x, quick_widget));
in.quick_widget = quick_widget;
g_array_append_val (widgets, in);
label.widget = WIDGET (label_new (++(*y), x, I18N (quick_widget->u.input.label_text)));
*y += label.widget->lines - 1;
g_array_append_val (widgets, label);
*width = max (label.widget->cols, in.widget->cols);
break;
default:
return;
}
((WInput *) in.widget)->label = (WLabel *) label.widget;
/* cross references */
label.quick_widget->u.label.input = in.quick_widget;
in.quick_widget->u.input.label = label.quick_widget;
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
int
quick2_dialog_skip (quick_dialog_t * quick_dlg, int nskip)
{
int len;
int blen = 0;
int x, y; /* current positions */
int y1 = 0; /* bottom of 1st column in case of two columns */
int y2 = -1; /* start of two columns */
int width1 = 0; /* width of single column */
int width2 = 0; /* width of each of two columns*/
gboolean have_groupbox = FALSE;
gboolean two_columns = FALSE;
gboolean put_buttons = FALSE;
/* x position of 1st column is 3 */
const int x1 = 3;
/* x position of 2nd column is 4 and it will be fixed later, after creation of all widgets */
int x2 = 4;
GArray *widgets;
size_t i;
quick_widget_t *quick_widget;
WGroupbox *g = NULL;
Dlg_head *dd;
int return_val;
len = str_term_width1 (I18N (quick_dlg->title)) + 6;
quick_dlg->cols = max (quick_dlg->cols, len);
y = 1;
x = x1;
/* create widgets */
widgets = g_array_sized_new (FALSE, FALSE, sizeof (quick_widget_item_t), 8);
for (quick_widget = quick_dlg->widgets; quick_widget->widget_type != quick2_end; quick_widget++)
{
quick_widget_item_t item = { NULL, quick_widget };
int width = 0;
switch (quick_widget->widget_type)
{
case quick2_checkbox:
item.widget =
WIDGET (check_new
(++y, x, *quick_widget->u.checkbox.state,
I18N (quick_widget->u.checkbox.text)));
g_array_append_val (widgets, item);
width = item.widget->cols;
if (g != NULL)
width += 2;
if (two_columns)
width2 = max (width2, width);
else
width1 = max (width1, width);
break;
case quick2_button:
/* single button */
item.widget = WIDGET (button_new (++y, x, quick_widget->u.button.action,
quick_widget->u.button.action == B_ENTER ?
DEFPUSH_BUTTON : NORMAL_BUTTON,
I18N (quick_widget->u.button.text),
quick_widget->u.button.callback));
g_array_append_val (widgets, item);
width = item.widget->cols;
if (g != NULL)
width += 2;
if (two_columns)
width2 = max (width2, width);
else
width1 = max (width1, width);
break;
case quick2_input:
*quick_widget->u.input.result = NULL;
y++;
if (quick_widget->u.input.label_location != input_label_none)
quick_create_labeled_input (widgets, &y, x, quick_widget, &width);
else
{
item.widget = WIDGET (quick_create_input (y, x, quick_widget));
g_array_append_val (widgets, item);
width = item.widget->cols;
}
if (g != NULL)
width += 2;
if (two_columns)
width2 = max (width2, width);
else
width1 = max (width1, width);
break;
case quick2_label:
item.widget = WIDGET (label_new (++y, x, I18N (quick_widget->u.label.text)));
g_array_append_val (widgets, item);
y += item.widget->lines - 1;
width = item.widget->cols;
if (g != NULL)
width += 2;
if (two_columns)
width2 = max (width2, width);
else
width1 = max (width1, width);
break;
case quick2_radio:
{
WRadio *r;
char **items = NULL;
/* create the copy of radio_items to avoid mwmory leak */
items = g_new (char *, quick_widget->u.radio.count + 1);
for (i = 0; i < (size_t) quick_widget->u.radio.count; i++)
items[i] = g_strdup (_(quick_widget->u.radio.items[i]));
items[i] = NULL;
r = radio_new (++y, x, quick_widget->u.radio.count, (const char **) items);
r->pos = r->sel = *quick_widget->u.radio.value;
g_strfreev (items);
item.widget = WIDGET (r);
g_array_append_val (widgets, item);
y += item.widget->lines - 1;
width = item.widget->cols;
if (g != NULL)
width += 2;
if (two_columns)
width2 = max (width2, width);
else
width1 = max (width1, width);
}
break;
case quick2_start_groupbox:
I18N (quick_widget->u.groupbox.title);
len = str_term_width1 (quick_widget->u.groupbox.title);
g = groupbox_new (++y, x, 1, len + 4, quick_widget->u.groupbox.title);
item.widget = WIDGET (g);
g_array_append_val (widgets, item);
have_groupbox = TRUE;
break;
case quick2_stop_groupbox:
if (g != NULL)
{
Widget *w = WIDGET (g);
y++;
w->lines = y + 1 - w->y;
g = NULL;
g_array_append_val (widgets, item);
}
break;
case quick2_separator:
y++;
if (quick_widget->u.separator.line)
{
item.widget = WIDGET (hline_new (y, x, 1));
g_array_append_val (widgets, item);
}
break;
case quick2_start_columns:
y2 = y;
g_array_append_val (widgets, item);
two_columns = TRUE;
break;
case quick2_next_column:
x = x2;
y1 = y;
y = y2;
break;
case quick2_stop_columns:
x = x1;
y = max (y1, y);
g_array_append_val (widgets, item);
two_columns = FALSE;
break;
case quick2_buttons:
/* start put several buttons in bottom line */
if (quick_widget->u.separator.space)
{
y++;
if (quick_widget->u.separator.line)
item.widget = WIDGET (hline_new (y, 1, -1));
}
g_array_append_val (widgets, item);
/* several buttons in bottom line */
y++;
quick_widget++;
for (; quick_widget->widget_type == quick2_button; quick_widget++)
{
item.widget = WIDGET (button_new (y, x++, quick_widget->u.button.action,
quick_widget->u.button.action == B_ENTER ?
DEFPUSH_BUTTON : NORMAL_BUTTON,
I18N (quick_widget->u.button.text),
quick_widget->u.button.callback));
item.quick_widget = quick_widget;
g_array_append_val (widgets, item);
blen += item.widget->cols + 1;
}
/* stop dialog build here */
blen--;
quick_widget->widget_type = quick2_end;
quick_widget--;
break;
default:
break;
}
}
/* adjust dialog width */
quick_dlg->cols = max (quick_dlg->cols, blen + 6);
if (have_groupbox)
{
if (width1 != 0)
width1 += 2;
if (width2 != 0)
width2 += 2;
}
if (width2 == 0)
len = width1 + 6;
else
{
len = width2 * 2 + 7;
if (width1 != 0)
len = max (len, width1 + 6);
}
quick_dlg->cols = max (quick_dlg->cols, len);
width1 = quick_dlg->cols - 6;
width2 = (quick_dlg->cols - 7) / 2;
if (quick_dlg->x == -1 || quick_dlg->y == -1)
dd = create_dlg (TRUE, 0, 0, y + 3, quick_dlg->cols,
dialog_colors, quick_dlg->callback, quick_dlg->mouse, quick_dlg->help,
quick_dlg->title, DLG_CENTER | DLG_TRYUP);
else
dd = create_dlg (TRUE, quick_dlg->y, quick_dlg->x, y + 3, quick_dlg->cols,
dialog_colors, quick_dlg->callback, quick_dlg->mouse, quick_dlg->help,
quick_dlg->title, DLG_NONE);
/* add widgets into the dialog */
x2 = x1 + width2 + 1;
g = NULL;
two_columns = FALSE;
x = (WIDGET (dd)->cols - blen) / 2;
for (i = 0; i < widgets->len; i++)
{
quick_widget_item_t *item;
int column_width;
item = &g_array_index (widgets, quick_widget_item_t, i);
column_width = two_columns ? width2 : width1;
/* adjust widget width and x position */
switch (item->quick_widget->widget_type)
{
case quick2_label:
{
quick_widget_t *input = item->quick_widget->u.label.input;
if (input != NULL && input->u.input.label_location == input_label_right)
{
/* location of this label will be adjusted later */
break;
}
}
/* fall through */
case quick2_checkbox:
case quick2_radio:
if (item->widget->x != x1)
item->widget->x = x2;
if (g != NULL)
item->widget->x += 2;
break;
case quick2_button:
if (!put_buttons)
{
if (item->widget->x != x1)
item->widget->x = x2;
if (g != NULL)
item->widget->x += 2;
}
else
{
item->widget->x = x;
x += item->widget->cols + 1;
}
break;
case quick2_input:
{
Widget *label = WIDGET (((WInput *) item->widget)->label);
int width = column_width;
if (g != NULL)
width -= 4;
switch (item->quick_widget->u.input.label_location)
{
case input_label_left:
/* label was adjusted before; adjust input line */
item->widget->x = label->x + label->cols + 1 - WIDGET (label->owner)->x;
item->widget->cols = width - label->cols - 1;
break;
case input_label_right:
label->x =
item->widget->x + item->widget->cols + 1 - WIDGET (item->widget->owner)->x;
item->widget->cols = width - label->cols - 1;
break;
default:
if (item->widget->x != x1)
item->widget->x = x2;
if (g != NULL)
item->widget->x += 2;
item->widget->cols = width;
break;
}
/* forced update internal variables of inpuit line */
input_set_origin ((WInput *) (item->widget), item->widget->x, item->widget->cols);
}
break;
case quick2_start_groupbox:
g = (WGroupbox *) item->widget;
if (item->widget->x != x1)
item->widget->x = x2;
item->widget->cols = column_width;
break;
case quick2_stop_groupbox:
g = NULL;
break;
case quick2_separator:
if (item->widget != NULL)
{
if (g != NULL)
{
Widget *wg = WIDGET (g);
((WHLine *) item->widget)->auto_adjust_cols = FALSE;
item->widget->x = wg->x + 1 - WIDGET (wg->owner)->x;
item->widget->cols = wg->cols;
}
else if (two_columns)
{
((WHLine *) item->widget)->auto_adjust_cols = FALSE;
if (item->widget->x != x1)
item->widget->x = x2;
item->widget->x--;
item->widget->cols = column_width + 2;
}
else
((WHLine *) item->widget)->auto_adjust_cols = TRUE;
}
break;
case quick2_start_columns:
two_columns = TRUE;
break;
case quick2_stop_columns:
two_columns = FALSE;
break;
case quick2_buttons:
/* several buttons in bottom line */
put_buttons = TRUE;
break;
default:
break;
}
if (item->widget != NULL)
{
unsigned long id;
/* add widget into dialog */
item->widget->options |= item->quick_widget->options; /* FIXME: cannot reset flags, setup only */
id = add_widget (dd, item->widget);
if (item->quick_widget->id != NULL)
*item->quick_widget->id = id;
}
}
while (nskip-- != 0)
{
dd->current = g_list_next (dd->current);
if (dd->current == NULL)
dd->current = dd->widgets;
}
return_val = run_dlg (dd);
/* Get the data if we found something interesting */
if (return_val != B_CANCEL)
for (i = 0; i < widgets->len; i++)
{
quick_widget_item_t *item;
item = &g_array_index (widgets, quick_widget_item_t, i);
switch (item->quick_widget->widget_type)
{
case quick_checkbox:
*item->quick_widget->u.checkbox.state = ((WCheck *) item->widget)->state & C_BOOL;
break;
case quick_input:
if ((quick_widget->u.input.flags & 2) != 0)
*item->quick_widget->u.input.result =
tilde_expand (((WInput *) item->widget)->buffer);
else
*item->quick_widget->u.input.result =
g_strdup (((WInput *) item->widget)->buffer);
break;
case quick_radio:
*item->quick_widget->u.radio.value = ((WRadio *) item->widget)->sel;
break;
default:
break;
}
}
destroy_dlg (dd);
/* destroy input labels created before */
for (i = 0; i < widgets->len; i++)
{
quick_widget_item_t *item;
item = &g_array_index (widgets, quick_widget_item_t, i);
if (item->quick_widget->widget_type == quick2_input)
g_free (item->quick_widget->u.input.label);
}
g_array_free (widgets, TRUE);
return return_val;
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -1,335 +0,0 @@
/** \file quick2.h
* \brief Header: quick dialog engine
*/
#ifndef MC__QUICK2_H
#define MC__QUICK2_H
#include "lib/tty/mouse.h"
/*** typedefs(not structures) and defined constants **********************************************/
#define QUICK2_CHECKBOX(txt, st, id_) \
{ \
.widget_type = quick2_checkbox, \
.options = 0, \
.id = id_, \
.u = { \
.checkbox = { \
.text = txt, \
.state = st \
} \
} \
}
#define QUICK2_BUTTON(txt, act, cb, id_) \
{ \
.widget_type = quick2_button, \
.options = 0, \
.id = id_, \
.u = { \
.button = { \
.text = txt, \
.action = act, \
.callback = cb \
} \
} \
}
#define QUICK2_INPUT(txt, flags_, hname, res, id_) \
{ \
.widget_type = quick2_input, \
.options = 0, \
.id = id_, \
.u = { \
.input = { \
.label_text = NULL, \
.label_location = input_label_none, \
.label = NULL, \
.text = txt, \
.flags = flags_, \
.histname = hname, \
.result = res \
} \
} \
}
#define QUICK2_LABELED_INPUT(label_, label_loc, txt, flags_, hname, res, id_) \
{ \
.widget_type = quick2_input, \
.options = 0, \
.id = id_, \
.u = { \
.input = { \
.label_text = label_, \
.label_location = label_loc, \
.label = NULL, \
.text = txt, \
.flags = flags_, \
.histname = hname, \
.result = res \
} \
} \
}
#define QUICK2_LABEL(txt, id_) \
{ \
.widget_type = quick2_label, \
.options = 0, \
.id = id_, \
.u = { \
.label = { \
.text = txt, \
.input = NULL \
} \
} \
}
#define QUICK2_RADIO(cnt, items_, val, id_) \
{ \
.widget_type = quick2_radio, \
.options = 0, \
.id = id_, \
.u = { \
.radio = { \
.count = cnt, \
.items = items_, \
.value = val \
} \
} \
}
#define QUICK2_START_GROUPBOX(t) \
{ \
.widget_type = quick2_start_groupbox, \
.options = 0, \
.id = NULL, \
.u = { \
.groupbox = { \
.title = t \
} \
} \
}
#define QUICK2_STOP_GROUPBOX \
{ \
.widget_type = quick2_stop_groupbox, \
.options = 0, \
.id = NULL, \
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
} \
}
#define QUICK2_SEPARATOR(line_) \
{ \
.widget_type = quick2_separator, \
.options = 0, \
.id = NULL, \
.u = { \
.separator = { \
.space = TRUE, \
.line = line_ \
} \
} \
}
#define QUICK2_START_COLUMNS \
{ \
.widget_type = quick2_start_columns, \
.options = 0, \
.id = NULL, \
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
} \
}
#define QUICK2_NEXT_COLUMN \
{ \
.widget_type = quick2_next_column, \
.options = 0, \
.id = NULL, \
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
} \
}
#define QUICK2_STOP_COLUMNS \
{ \
.widget_type = quick2_stop_columns, \
.options = 0, \
.id = NULL, \
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
} \
}
#define QUICK2_START_BUTTONS(space_, line_) \
{ \
.widget_type = quick2_buttons, \
.options = 0, \
.id = NULL, \
.u = { \
.separator = { \
.space = space_, \
.line = line_ \
} \
} \
}
#define QUICK2_END \
{ \
.widget_type = quick2_end, \
.options = 0, \
.id = NULL, \
.u = { \
.input = { \
.text = NULL, \
.flags = 0, \
.histname = NULL, \
.result = NULL \
} \
} \
}
/*** enums ***************************************************************************************/
/* Quick Widgets */
typedef enum
{
quick2_end = 0,
quick2_checkbox = 1,
quick2_button = 2,
quick2_input = 3,
quick2_label = 4,
quick2_radio = 5,
quick2_start_groupbox = 6,
quick2_stop_groupbox = 7,
quick2_separator = 8,
quick2_start_columns = 9,
quick2_next_column = 10,
quick2_stop_columns = 11,
quick2_buttons = 12
} quick2_t;
typedef enum
{
input_label_none = 0,
input_label_above = 1,
input_label_left = 2,
input_label_right = 3,
input_label_below = 4
} quick_input_label_location_t;
/*** structures declarations (and typedefs of structures)*****************************************/
/* The widget is placed on relative_?/divisions_? of the parent widget */
typedef struct quick_widget_t quick_widget_t;
struct quick_widget_t
{
quick2_t widget_type;
widget_options_t options;
unsigned long *id;
/* widget parameters */
union
{
struct
{
const char *text;
int *state; /* in/out */
} checkbox;
struct
{
const char *text;
int action;
bcback_fn callback;
} button;
struct
{
const char *label_text;
quick_input_label_location_t label_location;
quick_widget_t *label;
const char *text;
int flags; /* 1 -- is_password, 2 -- INPUT_COMPLETE_CD */
const char *histname;
char **result;
gboolean strip_password;
} input;
struct
{
const char *text;
quick_widget_t *input;
} label;
struct
{
int count;
const char **items;
int *value; /* in/out */
} radio;
struct
{
const char *title;
} groupbox;
struct
{
gboolean space;
gboolean line;
} separator;
} u;
};
typedef struct
{
int y, x; /* if -1, then center the dialog */
int cols; /* heigth is calculated automatically */
const char *title;
const char *help;
quick_widget_t *widgets;
dlg_cb_fn callback;
mouse_h mouse;
} quick_dialog_t;
/*** global variables defined in .c file *********************************************************/
/*** declarations of public functions ************************************************************/
int quick2_dialog_skip (quick_dialog_t * quick_dlg, int nskip);
/*** inline functions ****************************************************************************/
static inline int
quick2_dialog (quick_dialog_t * quick_dlg)
{
return quick2_dialog_skip (quick_dlg, 1);
}
#endif /* MC__QUICK2_H */

View File

@ -208,12 +208,12 @@ fg_input_dialog_help (const char *header, const char *text, const char *help,
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABELED_INPUT (p_text, input_label_above, def_text, flags, histname, &my_str,
NULL),
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_LABELED_INPUT (p_text, input_label_above, def_text, flags, histname, &my_str,
NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-OFF* */
};
@ -222,7 +222,7 @@ fg_input_dialog_help (const char *header, const char *text, const char *help,
help, quick_widgets, NULL, NULL
};
ret = quick2_dialog (&qdlg);
ret = quick_dialog (&qdlg);
}
g_free (p_text);

View File

@ -82,25 +82,24 @@ mcdiffview_dialog_search (WDiff * dview)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABELED_INPUT (N_("Enter search string:"), input_label_above,
INPUT_LAST_TEXT, 0, MC_HISTORY_SHARED_SEARCH, &exp, NULL),
QUICK2_SEPARATOR (TRUE),
QUICK2_START_COLUMNS,
QUICK2_RADIO (num_of_types, (const char **) list_of_types,
(int *) &mcdiffview_search_options.type, NULL),
QUICK2_NEXT_COLUMN,
QUICK2_CHECKBOX (N_("Cas&e sensitive"), &mcdiffview_search_options.case_sens, NULL),
QUICK2_CHECKBOX (N_("&Backwards"), &mcdiffview_search_options.backwards, NULL),
QUICK2_CHECKBOX (N_("&Whole words"), &mcdiffview_search_options.whole_words, NULL),
QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above,
INPUT_LAST_TEXT, 0, MC_HISTORY_SHARED_SEARCH, &exp, NULL),
QUICK_SEPARATOR (TRUE),
QUICK_START_COLUMNS,
QUICK_RADIO (num_of_types, (const char **) list_of_types,
(int *) &mcdiffview_search_options.type, NULL),
QUICK_NEXT_COLUMN,
QUICK_CHECKBOX (N_("Cas&e sensitive"), &mcdiffview_search_options.case_sens, NULL),
QUICK_CHECKBOX (N_("&Backwards"), &mcdiffview_search_options.backwards, NULL),
QUICK_CHECKBOX (N_("&Whole words"), &mcdiffview_search_options.whole_words, NULL),
#ifdef HAVE_CHARSET
QUICK2_CHECKBOX (N_("&All charsets"), &mcdiffview_search_options.all_codepages,
NULL),
QUICK_CHECKBOX (N_("&All charsets"), &mcdiffview_search_options.all_codepages, NULL),
#endif
QUICK2_STOP_COLUMNS,
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_STOP_COLUMNS,
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -110,7 +109,7 @@ mcdiffview_dialog_search (WDiff * dview)
quick_widgets, NULL, NULL
};
qd_result = quick2_dialog (&qdlg);
qd_result = quick_dialog (&qdlg);
}
g_strfreev (list_of_types);

View File

@ -2352,21 +2352,21 @@ dview_diff_options (WDiff * dview)
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_START_GROUPBOX (N_("Diff algorithm")),
QUICK2_RADIO (3, (const char **) quality_str, (int *) &dview->opt.quality, NULL),
QUICK2_STOP_GROUPBOX,
QUICK2_START_GROUPBOX (N_("Diff extra options")),
QUICK2_CHECKBOX (N_("&Ignore case"), &dview->opt.ignore_case, NULL),
QUICK2_CHECKBOX (N_("Ignore tab &expansion"), &dview->opt.ignore_tab_expansion, NULL),
QUICK2_CHECKBOX (N_("Ignore &space change"), &dview->opt.ignore_space_change, NULL),
QUICK2_CHECKBOX (N_("Ignore all &whitespace"), &dview->opt.ignore_all_space, NULL),
QUICK2_CHECKBOX (N_("Strip &trailing carriage return"), &dview->opt.strip_trailing_cr,
NULL),
QUICK2_STOP_GROUPBOX,
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_START_GROUPBOX (N_("Diff algorithm")),
QUICK_RADIO (3, (const char **) quality_str, (int *) &dview->opt.quality, NULL),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("Diff extra options")),
QUICK_CHECKBOX (N_("&Ignore case"), &dview->opt.ignore_case, NULL),
QUICK_CHECKBOX (N_("Ignore tab &expansion"), &dview->opt.ignore_tab_expansion, NULL),
QUICK_CHECKBOX (N_("Ignore &space change"), &dview->opt.ignore_space_change, NULL),
QUICK_CHECKBOX (N_("Ignore all &whitespace"), &dview->opt.ignore_all_space, NULL),
QUICK_CHECKBOX (N_("Strip &trailing carriage return"), &dview->opt.strip_trailing_cr,
NULL),
QUICK_STOP_GROUPBOX,
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -2376,7 +2376,7 @@ dview_diff_options (WDiff * dview)
quick_widgets, NULL, NULL
};
if (quick2_dialog (&qdlg) != B_CANCEL)
if (quick_dialog (&qdlg) != B_CANCEL)
dview_reread (dview);
}

View File

@ -462,15 +462,15 @@ edit_get_save_file_as (WEdit * edit)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABELED_INPUT (N_("Enter file name:"), input_label_above, filename, 0, "save-as",
&filename_res, NULL),
QUICK2_SEPARATOR (TRUE),
QUICK2_LABEL (N_("Change line breaks to:"), NULL),
QUICK2_RADIO (LB_NAMES, lb_names, (int *) &cur_lb, NULL),
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_LABELED_INPUT (N_("Enter file name:"), input_label_above, filename, 0, "save-as",
&filename_res, NULL),
QUICK_SEPARATOR (TRUE),
QUICK_LABEL (N_("Change line breaks to:"), NULL),
QUICK_RADIO (LB_NAMES, lb_names, (int *) &cur_lb, NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -480,7 +480,7 @@ edit_get_save_file_as (WEdit * edit)
quick_widgets, NULL, NULL
};
if (quick2_dialog (&qdlg) != B_CANCEL)
if (quick_dialog (&qdlg) != B_CANCEL)
{
char *fname;
@ -1603,15 +1603,15 @@ edit_save_mode_cmd (void)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_RADIO (3, str, &option_save_mode, &edit_save_mode_radio_id),
QUICK2_INPUT (option_backup_ext, 0, "edit-backup-ext", &str_result,
&edit_save_mode_input_id),
QUICK2_SEPARATOR (TRUE),
QUICK2_CHECKBOX (N_("Check &POSIX new line"), &option_check_nl_at_eof, NULL),
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_RADIO (3, str, &option_save_mode, &edit_save_mode_radio_id),
QUICK_INPUT (option_backup_ext, 0, "edit-backup-ext", &str_result,
&edit_save_mode_input_id),
QUICK_SEPARATOR (TRUE),
QUICK_CHECKBOX (N_("Check &POSIX new line"), &option_check_nl_at_eof, NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -1621,7 +1621,7 @@ edit_save_mode_cmd (void)
quick_widgets, edit_save_mode_callback, NULL
};
if (quick2_dialog (&qdlg) != B_CANCEL)
if (quick_dialog (&qdlg) != B_CANCEL)
{
g_free (option_backup_ext);
option_backup_ext = str_result;
@ -3300,20 +3300,20 @@ edit_mail_dialog (WEdit * edit)
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABEL (N_("mail -s <subject> -c <cc> <to>"), NULL),
QUICK2_LABELED_INPUT (N_("To"), input_label_above,
mail_to_last != NULL ? mail_to_last : "", 0,
"mail-dlg-input-3", &tmail_to, NULL),
QUICK2_LABELED_INPUT (N_("Subject"), input_label_above,
mail_subject_last != NULL ? mail_subject_last : "", 0,
"mail-dlg-input-2", &tmail_subject, NULL),
QUICK2_LABELED_INPUT (N_("Copies to"), input_label_above,
mail_cc_last != NULL ? mail_cc_last : "", 0,
"mail-dlg-input", &tmail_cc, NULL),
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_LABEL (N_("mail -s <subject> -c <cc> <to>"), NULL),
QUICK_LABELED_INPUT (N_("To"), input_label_above,
mail_to_last != NULL ? mail_to_last : "", 0,
"mail-dlg-input-3", &tmail_to, NULL),
QUICK_LABELED_INPUT (N_("Subject"), input_label_above,
mail_subject_last != NULL ? mail_subject_last : "", 0,
"mail-dlg-input-2", &tmail_subject, NULL),
QUICK_LABELED_INPUT (N_("Copies to"), input_label_above,
mail_cc_last != NULL ? mail_cc_last : "", 0,
"mail-dlg-input", &tmail_cc, NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -3323,7 +3323,7 @@ edit_mail_dialog (WEdit * edit)
quick_widgets, NULL, NULL
};
if (quick2_dialog (&qdlg) != B_CANCEL)
if (quick_dialog (&qdlg) != B_CANCEL)
{
g_free (mail_cc_last);
g_free (mail_subject_last);

View File

@ -99,26 +99,26 @@ editcmd_dialog_search_show (WEdit * edit)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABELED_INPUT (N_("Enter search string:"), input_label_above,
INPUT_LAST_TEXT, 0, MC_HISTORY_SHARED_SEARCH, &search_text, NULL),
QUICK2_SEPARATOR (TRUE),
QUICK2_START_COLUMNS,
QUICK2_RADIO (num_of_types, (const char **) list_of_types,
(int *) &edit_search_options.type, NULL),
QUICK2_NEXT_COLUMN,
QUICK2_CHECKBOX (N_("Cas&e sensitive"), &edit_search_options.case_sens, NULL),
QUICK2_CHECKBOX (N_("&Backwards"), &edit_search_options.backwards, NULL),
QUICK2_CHECKBOX (N_("In se&lection"), &edit_search_options.only_in_selection, NULL),
QUICK2_CHECKBOX (N_("&Whole words"), &edit_search_options.whole_words, NULL),
QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above,
INPUT_LAST_TEXT, 0, MC_HISTORY_SHARED_SEARCH, &search_text, NULL),
QUICK_SEPARATOR (TRUE),
QUICK_START_COLUMNS,
QUICK_RADIO (num_of_types, (const char **) list_of_types,
(int *) &edit_search_options.type, NULL),
QUICK_NEXT_COLUMN,
QUICK_CHECKBOX (N_("Cas&e sensitive"), &edit_search_options.case_sens, NULL),
QUICK_CHECKBOX (N_("&Backwards"), &edit_search_options.backwards, NULL),
QUICK_CHECKBOX (N_("In se&lection"), &edit_search_options.only_in_selection, NULL),
QUICK_CHECKBOX (N_("&Whole words"), &edit_search_options.whole_words, NULL),
#ifdef HAVE_CHARSET
QUICK2_CHECKBOX (N_("&All charsets"), &edit_search_options.all_codepages, NULL),
QUICK_CHECKBOX (N_("&All charsets"), &edit_search_options.all_codepages, NULL),
#endif
QUICK2_STOP_COLUMNS,
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Find all"), B_USER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_STOP_COLUMNS,
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Find all"), B_USER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -128,7 +128,7 @@ editcmd_dialog_search_show (WEdit * edit)
quick_widgets, NULL, NULL
};
dialog_result = quick2_dialog (&qdlg);
dialog_result = quick_dialog (&qdlg);
}
g_strfreev (list_of_types);
@ -189,27 +189,27 @@ editcmd_dialog_replace_show (WEdit * edit, const char *search_default, const cha
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABELED_INPUT (N_("Enter search string:"), input_label_above,
search_default, 0, MC_HISTORY_SHARED_SEARCH, search_text, NULL),
QUICK2_LABELED_INPUT (N_("Enter replacement string:"), input_label_above,
replace_default, 0, "replace", replace_text, NULL),
QUICK2_SEPARATOR (TRUE),
QUICK2_START_COLUMNS,
QUICK2_RADIO (num_of_types, (const char **) list_of_types,
(int *) &edit_search_options.type, NULL),
QUICK2_NEXT_COLUMN,
QUICK2_CHECKBOX (N_("Cas&e sensitive"), &edit_search_options.case_sens, NULL),
QUICK2_CHECKBOX (N_("&Backwards"), &edit_search_options.backwards, NULL),
QUICK2_CHECKBOX (N_("In se&lection"), &edit_search_options.only_in_selection, NULL),
QUICK2_CHECKBOX (N_("&Whole words"), &edit_search_options.whole_words, NULL),
QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above,
search_default, 0, MC_HISTORY_SHARED_SEARCH, search_text, NULL),
QUICK_LABELED_INPUT (N_("Enter replacement string:"), input_label_above,
replace_default, 0, "replace", replace_text, NULL),
QUICK_SEPARATOR (TRUE),
QUICK_START_COLUMNS,
QUICK_RADIO (num_of_types, (const char **) list_of_types,
(int *) &edit_search_options.type, NULL),
QUICK_NEXT_COLUMN,
QUICK_CHECKBOX (N_("Cas&e sensitive"), &edit_search_options.case_sens, NULL),
QUICK_CHECKBOX (N_("&Backwards"), &edit_search_options.backwards, NULL),
QUICK_CHECKBOX (N_("In se&lection"), &edit_search_options.only_in_selection, NULL),
QUICK_CHECKBOX (N_("&Whole words"), &edit_search_options.whole_words, NULL),
#ifdef HAVE_CHARSET
QUICK2_CHECKBOX (N_("&All charsets"), &edit_search_options.all_codepages, NULL),
QUICK_CHECKBOX (N_("&All charsets"), &edit_search_options.all_codepages, NULL),
#endif
QUICK2_STOP_COLUMNS,
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_STOP_COLUMNS,
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -219,7 +219,7 @@ editcmd_dialog_replace_show (WEdit * edit, const char *search_default, const cha
quick_widgets, NULL, NULL
};
if (quick2_dialog (&qdlg) != B_CANCEL)
if (quick_dialog (&qdlg) != B_CANCEL)
edit->replace_mode = 0;
else
{
@ -263,15 +263,15 @@ editcmd_dialog_replace_prompt_show (WEdit * edit, char *from_text, char *to_text
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABEL (repl_from, NULL),
QUICK2_LABEL (N_("Replace with:"), NULL),
QUICK2_LABEL (repl_to, NULL),
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&Replace"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("A&ll"), B_REPLACE_ALL, NULL, NULL),
QUICK2_BUTTON (N_("&Skip"), B_SKIP_REPLACE, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_LABEL (repl_from, NULL),
QUICK_LABEL (N_("Replace with:"), NULL),
QUICK_LABEL (repl_to, NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&Replace"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("A&ll"), B_REPLACE_ALL, NULL, NULL),
QUICK_BUTTON (N_("&Skip"), B_SKIP_REPLACE, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -281,7 +281,7 @@ editcmd_dialog_replace_prompt_show (WEdit * edit, char *from_text, char *to_text
quick_widgets, NULL, NULL
};
retval = quick2_dialog (&qdlg);
retval = quick_dialog (&qdlg);
}
g_free (repl_from);

View File

@ -145,42 +145,42 @@ edit_options_dialog (Dlg_head * h)
{
/* *INDENT-OFF* */
quick_widget_t quick_widgets[] = {
QUICK2_START_COLUMNS,
QUICK2_START_GROUPBOX (N_("Wrap mode")),
QUICK2_RADIO (3, wrap_str, &wrap_mode, NULL),
QUICK2_STOP_GROUPBOX,
QUICK2_SEPARATOR (FALSE),
QUICK2_START_GROUPBOX (N_("Tabulation")),
QUICK2_CHECKBOX (N_("&Fake half tabs"), &option_fake_half_tabs, NULL),
QUICK2_CHECKBOX (N_("&Backspace through tabs"), &option_backspace_through_tabs,
NULL),
QUICK2_CHECKBOX (N_("Fill tabs with &spaces"), &option_fill_tabs_with_spaces,
NULL),
QUICK2_LABELED_INPUT (N_("Tab spacing:"), input_label_left, tab_spacing, 0,
QUICK_START_COLUMNS,
QUICK_START_GROUPBOX (N_("Wrap mode")),
QUICK_RADIO (3, wrap_str, &wrap_mode, NULL),
QUICK_STOP_GROUPBOX,
QUICK_SEPARATOR (FALSE),
QUICK_START_GROUPBOX (N_("Tabulation")),
QUICK_CHECKBOX (N_("&Fake half tabs"), &option_fake_half_tabs, NULL),
QUICK_CHECKBOX (N_("&Backspace through tabs"), &option_backspace_through_tabs,
NULL),
QUICK_CHECKBOX (N_("Fill tabs with &spaces"), &option_fill_tabs_with_spaces,
NULL),
QUICK_LABELED_INPUT (N_("Tab spacing:"), input_label_left, tab_spacing, 0,
"edit-tab-spacing", &q, NULL),
QUICK2_STOP_GROUPBOX,
QUICK2_NEXT_COLUMN,
QUICK2_START_GROUPBOX (N_("Other options")),
QUICK2_CHECKBOX (N_("&Return does autoindent"), &option_return_does_auto_indent,
QUICK_STOP_GROUPBOX,
QUICK_NEXT_COLUMN,
QUICK_START_GROUPBOX (N_("Other options")),
QUICK_CHECKBOX (N_("&Return does autoindent"), &option_return_does_auto_indent,
NULL),
QUICK_CHECKBOX (N_("Confir&m before saving"), &edit_confirm_save, NULL),
QUICK_CHECKBOX (N_("Save file &position"), &option_save_position, NULL),
QUICK_CHECKBOX (N_("&Visible trailing spaces"), &visible_tws, NULL),
QUICK_CHECKBOX (N_("Visible &tabs"), &visible_tabs, NULL),
QUICK_CHECKBOX (N_("Synta&x highlighting"), &option_syntax_highlighting, NULL),
QUICK_CHECKBOX (N_("Pers&istent selection"), &option_persistent_selections,
NULL),
QUICK2_CHECKBOX (N_("Confir&m before saving"), &edit_confirm_save, NULL),
QUICK2_CHECKBOX (N_("Save file &position"), &option_save_position, NULL),
QUICK2_CHECKBOX (N_("&Visible trailing spaces"), &visible_tws, NULL),
QUICK2_CHECKBOX (N_("Visible &tabs"), &visible_tabs, NULL),
QUICK2_CHECKBOX (N_("Synta&x highlighting"), &option_syntax_highlighting, NULL),
QUICK2_CHECKBOX (N_("Pers&istent selection"), &option_persistent_selections,
QUICK_CHECKBOX (N_("Cursor be&yond end of line"), &option_cursor_beyond_eol,
NULL),
QUICK2_CHECKBOX (N_("Cursor be&yond end of line"), &option_cursor_beyond_eol,
NULL),
QUICK2_CHECKBOX (N_("&Group undo"), &option_group_undo, NULL),
QUICK2_LABELED_INPUT (N_("Word wrap line length:"), input_label_left,
wrap_length, 0, "edit-word-wrap", &p, NULL),
QUICK2_STOP_GROUPBOX,
QUICK2_STOP_COLUMNS,
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_CHECKBOX (N_("&Group undo"), &option_group_undo, NULL),
QUICK_LABELED_INPUT (N_("Word wrap line length:"), input_label_left,
wrap_length, 0, "edit-word-wrap", &p, NULL),
QUICK_STOP_GROUPBOX,
QUICK_STOP_COLUMNS,
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -190,7 +190,7 @@ edit_options_dialog (Dlg_head * h)
quick_widgets, NULL, NULL
};
if (quick2_dialog (&qdlg) == B_CANCEL)
if (quick_dialog (&qdlg) == B_CANCEL)
return;
}

View File

@ -545,17 +545,17 @@ sort_box (panel_sort_info_t * info)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_START_COLUMNS,
QUICK2_RADIO (sort_names_num, sort_orders_names, &sort_idx, NULL),
QUICK2_NEXT_COLUMN,
QUICK2_CHECKBOX (N_("Executable &first"), &info->exec_first, NULL),
QUICK2_CHECKBOX (N_("Case sensi&tive"), &info->case_sensitive, NULL),
QUICK2_CHECKBOX (N_("&Reverse"), &info->reverse, NULL),
QUICK2_STOP_COLUMNS,
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_START_COLUMNS,
QUICK_RADIO (sort_names_num, sort_orders_names, &sort_idx, NULL),
QUICK_NEXT_COLUMN,
QUICK_CHECKBOX (N_("Executable &first"), &info->exec_first, NULL),
QUICK_CHECKBOX (N_("Case sensi&tive"), &info->case_sensitive, NULL),
QUICK_CHECKBOX (N_("&Reverse"), &info->reverse, NULL),
QUICK_STOP_COLUMNS,
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -565,7 +565,7 @@ sort_box (panel_sort_info_t * info)
quick_widgets, NULL, NULL
};
if (quick2_dialog (&qdlg) != B_CANCEL)
if (quick_dialog (&qdlg) != B_CANCEL)
result = panel_get_field_by_title_hotkey (sort_orders_names[sort_idx]);
if (result == NULL)
@ -585,18 +585,18 @@ confirm_box (void)
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
/* TRANSLATORS: no need to translate 'Confirmation', it's just a context prefix */
QUICK2_CHECKBOX (N_("Confirmation|&Delete"), &confirm_delete, NULL),
QUICK2_CHECKBOX (N_("Confirmation|O&verwrite"), &confirm_overwrite, NULL),
QUICK2_CHECKBOX (N_("Confirmation|&Execute"), &confirm_execute, NULL),
QUICK2_CHECKBOX (N_("Confirmation|E&xit"), &confirm_exit, NULL),
QUICK2_CHECKBOX (N_("Confirmation|Di&rectory hotlist delete"),
&confirm_directory_hotlist_delete, NULL),
QUICK2_CHECKBOX (N_("Confirmation|&History cleanup"),
&mc_global.widget.confirm_history_cleanup, NULL),
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_CHECKBOX (N_("Confirmation|&Delete"), &confirm_delete, NULL),
QUICK_CHECKBOX (N_("Confirmation|O&verwrite"), &confirm_overwrite, NULL),
QUICK_CHECKBOX (N_("Confirmation|&Execute"), &confirm_execute, NULL),
QUICK_CHECKBOX (N_("Confirmation|E&xit"), &confirm_exit, NULL),
QUICK_CHECKBOX (N_("Confirmation|Di&rectory hotlist delete"),
&confirm_directory_hotlist_delete, NULL),
QUICK_CHECKBOX (N_("Confirmation|&History cleanup"),
&mc_global.widget.confirm_history_cleanup, NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -606,7 +606,7 @@ confirm_box (void)
quick_widgets, NULL, NULL
};
(void) quick2_dialog (&qdlg);
(void) quick_dialog (&qdlg);
}
/* --------------------------------------------------------------------------------------------- */
@ -627,13 +627,13 @@ display_bits_box (void)
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_RADIO (4, display_bits_str, &current_mode, NULL),
QUICK2_SEPARATOR (TRUE),
QUICK2_CHECKBOX (N_("F&ull 8 bits input"), &new_meta, NULL),
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_RADIO (4, display_bits_str, &current_mode, NULL),
QUICK_SEPARATOR (TRUE),
QUICK_CHECKBOX (N_("F&ull 8 bits input"), &new_meta, NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -652,7 +652,7 @@ display_bits_box (void)
new_meta = !use_8th_bit_as_meta;
if (quick2_dialog (&qdlg) != B_CANCEL)
if (quick_dialog (&qdlg) != B_CANCEL)
{
mc_global.eight_bit_clean = current_mode < 3;
mc_global.full_eight_bits = current_mode < 2;
@ -683,21 +683,21 @@ display_bits_box (void)
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_START_COLUMNS,
QUICK2_LABEL (N_("Input / display codepage:"), NULL),
QUICK2_NEXT_COLUMN,
QUICK2_STOP_COLUMNS,
QUICK2_START_COLUMNS,
QUICK2_LABEL (cpname, &disp_bits_name_id),
QUICK2_NEXT_COLUMN,
QUICK2_BUTTON (N_("&Select"), B_USER, sel_charset_button, NULL),
QUICK2_STOP_COLUMNS,
QUICK2_SEPARATOR (TRUE),
QUICK2_CHECKBOX (N_("F&ull 8 bits input"), &new_meta, NULL),
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_START_COLUMNS,
QUICK_LABEL (N_("Input / display codepage:"), NULL),
QUICK_NEXT_COLUMN,
QUICK_STOP_COLUMNS,
QUICK_START_COLUMNS,
QUICK_LABEL (cpname, &disp_bits_name_id),
QUICK_NEXT_COLUMN,
QUICK_BUTTON (N_("&Select"), B_USER, sel_charset_button, NULL),
QUICK_STOP_COLUMNS,
QUICK_SEPARATOR (TRUE),
QUICK_CHECKBOX (N_("F&ull 8 bits input"), &new_meta, NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -710,7 +710,7 @@ display_bits_box (void)
new_meta = !use_8th_bit_as_meta;
application_keypad_mode ();
if (quick2_dialog (&qdlg) == B_ENTER)
if (quick_dialog (&qdlg) == B_ENTER)
{
char *errmsg;
@ -797,27 +797,27 @@ configure_vfs (void)
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABELED_INPUT (N_("Timeout for freeing VFSs (sec):"), input_label_left,
buffer2, 0, "input-timo-vfs", &ret_timeout, NULL),
QUICK_LABELED_INPUT (N_("Timeout for freeing VFSs (sec):"), input_label_left,
buffer2, 0, "input-timo-vfs", &ret_timeout, NULL),
#ifdef ENABLE_VFS_FTP
QUICK2_SEPARATOR (TRUE),
QUICK2_LABELED_INPUT (N_("FTP anonymous password:"), input_label_left,
ftpfs_anonymous_passwd, 0, "input-passwd", &ret_passwd, NULL),
QUICK2_LABELED_INPUT (N_("FTP directory cache timeout (sec):"), input_label_left,
buffer3, 0, "input-timeout", &ret_directory_timeout, NULL),
QUICK2_CHECKBOX (N_("&Always use ftp proxy:"), &ftpfs_always_use_proxy,
&ftpfs_always_use_proxy_id),
QUICK2_INPUT (ftpfs_proxy_host, 0, "input-ftp-proxy", &ret_ftp_proxy,
&ftpfs_proxy_host_id),
QUICK2_CHECKBOX (N_("&Use ~/.netrc"), &ftpfs_use_netrc, NULL),
QUICK2_CHECKBOX (N_("Use &passive mode"), &ftpfs_use_passive_connections, NULL),
QUICK2_CHECKBOX (N_("Use passive mode over pro&xy"),
&ftpfs_use_passive_connections_over_proxy, NULL),
QUICK_SEPARATOR (TRUE),
QUICK_LABELED_INPUT (N_("FTP anonymous password:"), input_label_left,
ftpfs_anonymous_passwd, 0, "input-passwd", &ret_passwd, NULL),
QUICK_LABELED_INPUT (N_("FTP directory cache timeout (sec):"), input_label_left,
buffer3, 0, "input-timeout", &ret_directory_timeout, NULL),
QUICK_CHECKBOX (N_("&Always use ftp proxy:"), &ftpfs_always_use_proxy,
&ftpfs_always_use_proxy_id),
QUICK_INPUT (ftpfs_proxy_host, 0, "input-ftp-proxy", &ret_ftp_proxy,
&ftpfs_proxy_host_id),
QUICK_CHECKBOX (N_("&Use ~/.netrc"), &ftpfs_use_netrc, NULL),
QUICK_CHECKBOX (N_("Use &passive mode"), &ftpfs_use_passive_connections, NULL),
QUICK_CHECKBOX (N_("Use passive mode over pro&xy"),
&ftpfs_use_passive_connections_over_proxy, NULL),
#endif /* ENABLE_VFS_FTP */
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -838,7 +838,7 @@ configure_vfs (void)
quick_widgets[5].options = W_DISABLED;
#endif
if (quick2_dialog (&qdlg) != B_CANCEL)
if (quick_dialog (&qdlg) != B_CANCEL)
{
vfs_timeout = atoi (ret_timeout);
g_free (ret_timeout);
@ -868,8 +868,8 @@ cd_dialog (void)
char *my_str;
quick_widget_t quick_widgets[] = {
QUICK2_LABELED_INPUT (N_("cd"), input_label_left, "", 2, "input", &my_str, NULL),
QUICK2_END
QUICK_LABELED_INPUT (N_("cd"), input_label_left, "", 2, "input", &my_str, NULL),
QUICK_END
};
quick_dialog_t qdlg = {
@ -878,7 +878,7 @@ cd_dialog (void)
quick_widgets, NULL, NULL
};
return (quick2_dialog (&qdlg) != B_CANCEL) ? my_str : NULL;
return (quick_dialog (&qdlg) != B_CANCEL) ? my_str : NULL;
}
/* --------------------------------------------------------------------------------------------- */
@ -896,16 +896,16 @@ symlink_dialog (const vfs_path_t * existing_vpath, const vfs_path_t * new_vpath,
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABELED_INPUT (N_("Existing filename (filename symlink will point to):"),
input_label_above,
existing, 0, "input-2", ret_existing, NULL),
QUICK2_SEPARATOR (FALSE),
QUICK2_LABELED_INPUT (N_("Symbolic link filename:"), input_label_above,
new, 0, "input-1", ret_new, NULL),
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_LABELED_INPUT (N_("Existing filename (filename symlink will point to):"),
input_label_above,
existing, 0, "input-2", ret_existing, NULL),
QUICK_SEPARATOR (FALSE),
QUICK_LABELED_INPUT (N_("Symbolic link filename:"), input_label_above,
new, 0, "input-1", ret_new, NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -915,7 +915,7 @@ symlink_dialog (const vfs_path_t * existing_vpath, const vfs_path_t * new_vpath,
quick_widgets, NULL, NULL
};
if (quick2_dialog (&qdlg) == B_CANCEL)
if (quick_dialog (&qdlg) == B_CANCEL)
{
*ret_new = NULL;
*ret_existing = NULL;

View File

@ -218,14 +218,14 @@ select_unselect_cmd (const char *title, const char *history_name, gboolean do_se
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_INPUT (INPUT_LAST_TEXT, 0, history_name, &reg_exp, NULL),
QUICK2_START_COLUMNS,
QUICK2_CHECKBOX (N_("&Files only"), &files_only, NULL),
QUICK2_CHECKBOX (N_("&Using shell patterns"), &shell_patterns, NULL),
QUICK2_NEXT_COLUMN,
QUICK2_CHECKBOX (N_("&Case sensitive"), &case_sens, NULL),
QUICK2_STOP_COLUMNS,
QUICK2_END
QUICK_INPUT (INPUT_LAST_TEXT, 0, history_name, &reg_exp, NULL),
QUICK_START_COLUMNS,
QUICK_CHECKBOX (N_("&Files only"), &files_only, NULL),
QUICK_CHECKBOX (N_("&Using shell patterns"), &shell_patterns, NULL),
QUICK_NEXT_COLUMN,
QUICK_CHECKBOX (N_("&Case sensitive"), &case_sens, NULL),
QUICK_STOP_COLUMNS,
QUICK_END
/* *INDENT-ON* */
};
@ -235,7 +235,7 @@ select_unselect_cmd (const char *title, const char *history_name, gboolean do_se
quick_widgets, NULL, NULL
};
if (quick2_dialog (&qdlg) == B_CANCEL)
if (quick_dialog (&qdlg) == B_CANCEL)
return;
if (reg_exp == NULL || *reg_exp == '\0')

View File

@ -1068,31 +1068,31 @@ file_mask_dialog (FileOpContext * ctx, FileOperation operation,
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABELED_INPUT (fmd_buf, input_label_above,
easy_patterns ? "*" : "^(.*)$", 0, "input-def", &source_mask,
NULL),
QUICK2_START_COLUMNS,
QUICK2_SEPARATOR (FALSE),
QUICK2_NEXT_COLUMN,
QUICK2_CHECKBOX (N_("&Using shell patterns"), &source_easy_patterns, NULL),
QUICK2_STOP_COLUMNS,
QUICK2_LABELED_INPUT (N_("to:"), input_label_above,
def_text_secure, 0, "input2", &dest_dir, NULL),
QUICK2_SEPARATOR (TRUE),
QUICK2_START_COLUMNS,
QUICK2_CHECKBOX (N_("Follow &links"), &ctx->follow_links, NULL),
QUICK2_CHECKBOX (N_("Preserve &attributes"), &ctx->op_preserve, NULL),
QUICK2_NEXT_COLUMN,
QUICK2_CHECKBOX (N_("Di&ve into subdir if exists"), &ctx->dive_into_subdirs, NULL),
QUICK2_CHECKBOX (N_("&Stable symlinks"), &ctx->stable_symlinks, NULL),
QUICK2_STOP_COLUMNS,
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_LABELED_INPUT (fmd_buf, input_label_above,
easy_patterns ? "*" : "^(.*)$", 0, "input-def", &source_mask,
NULL),
QUICK_START_COLUMNS,
QUICK_SEPARATOR (FALSE),
QUICK_NEXT_COLUMN,
QUICK_CHECKBOX (N_("&Using shell patterns"), &source_easy_patterns, NULL),
QUICK_STOP_COLUMNS,
QUICK_LABELED_INPUT (N_("to:"), input_label_above,
def_text_secure, 0, "input2", &dest_dir, NULL),
QUICK_SEPARATOR (TRUE),
QUICK_START_COLUMNS,
QUICK_CHECKBOX (N_("Follow &links"), &ctx->follow_links, NULL),
QUICK_CHECKBOX (N_("Preserve &attributes"), &ctx->op_preserve, NULL),
QUICK_NEXT_COLUMN,
QUICK_CHECKBOX (N_("Di&ve into subdir if exists"), &ctx->dive_into_subdirs, NULL),
QUICK_CHECKBOX (N_("&Stable symlinks"), &ctx->stable_symlinks, NULL),
QUICK_STOP_COLUMNS,
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
#ifdef ENABLE_BACKGROUND
QUICK2_BUTTON (N_("&Background"), B_USER, NULL, NULL),
QUICK_BUTTON (N_("&Background"), B_USER, NULL, NULL),
#endif /* ENABLE_BACKGROUND */
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -1103,7 +1103,7 @@ file_mask_dialog (FileOpContext * ctx, FileOperation operation,
};
ask_file_mask:
val = quick2_dialog_skip (&qdlg, 4);
val = quick_dialog_skip (&qdlg, 4);
if (val == B_CANCEL)
{

View File

@ -982,14 +982,14 @@ add_new_entry_input (const char *header, const char *text1, const char *text2,
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABELED_INPUT (text1, input_label_above, *r1, 0, "input-lbl", r1, NULL),
QUICK2_SEPARATOR (FALSE),
QUICK2_LABELED_INPUT (text2, input_label_above, *r2, 0, "input-lbl", r2, NULL),
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&Append"), B_APPEND, NULL, NULL),
QUICK2_BUTTON (N_("&Insert"), B_INSERT, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_LABELED_INPUT (text1, input_label_above, *r1, 0, "input-lbl", r1, NULL),
QUICK_SEPARATOR (FALSE),
QUICK_LABELED_INPUT (text2, input_label_above, *r2, 0, "input-lbl", r2, NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&Append"), B_APPEND, NULL, NULL),
QUICK_BUTTON (N_("&Insert"), B_INSERT, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -1001,7 +1001,7 @@ add_new_entry_input (const char *header, const char *text1, const char *text2,
int ret;
ret = quick2_dialog (&qdlg);
ret = quick_dialog (&qdlg);
return (ret != B_CANCEL) ? ret : 0;
}
@ -1045,12 +1045,12 @@ add_new_group_input (const char *header, const char *label, char **result)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABELED_INPUT (label, input_label_above, "", 0, "input", result, NULL),
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&Append"), B_APPEND, NULL, NULL),
QUICK2_BUTTON (N_("&Insert"), B_INSERT, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_LABELED_INPUT (label, input_label_above, "", 0, "input", result, NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&Append"), B_APPEND, NULL, NULL),
QUICK_BUTTON (N_("&Insert"), B_INSERT, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -1062,7 +1062,7 @@ add_new_group_input (const char *header, const char *label, char **result)
int ret;
ret = quick2_dialog (&qdlg);
ret = quick_dialog (&qdlg);
return (ret != B_CANCEL) ? ret : 0;
}

View File

@ -110,48 +110,47 @@ configure_box (void)
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_START_COLUMNS,
QUICK2_START_GROUPBOX (N_("File operations")),
QUICK2_CHECKBOX (N_("&Verbose operation"), &verbose, NULL),
QUICK2_CHECKBOX (N_("Compute tota&ls"), &file_op_compute_totals, NULL),
QUICK2_CHECKBOX (N_("Classic pro&gressbar"), &classic_progressbar, NULL),
QUICK2_CHECKBOX (N_("Mkdi&r autoname"), &auto_fill_mkdir_name, NULL),
QUICK2_CHECKBOX (N_("Preallocate &space"), &mc_global.vfs.preallocate_space,
NULL),
QUICK2_STOP_GROUPBOX,
QUICK2_START_GROUPBOX (N_("Esc key mode")),
QUICK2_CHECKBOX (N_("S&ingle press"), &old_esc_mode,
&configure_old_esc_mode_id),
QUICK2_LABELED_INPUT (N_("Timeout:"), input_label_left,
(const char *) time_out, 0, MC_HISTORY_ESC_TIMEOUT,
&time_out_new, &configure_time_out_id),
QUICK2_STOP_GROUPBOX,
QUICK2_START_GROUPBOX (N_("Pause after run")),
QUICK2_RADIO (pause_options_num, pause_options, &pause_after_run, NULL),
QUICK2_STOP_GROUPBOX,
QUICK2_NEXT_COLUMN,
QUICK2_START_GROUPBOX (N_("Other options")),
QUICK2_CHECKBOX (N_("Use internal edi&t"), &use_internal_edit, NULL),
QUICK2_CHECKBOX (N_("Use internal vie&w"), &use_internal_view, NULL),
QUICK2_CHECKBOX (N_("Auto m&enus"), &auto_menu, NULL),
QUICK2_CHECKBOX (N_("&Drop down menus"), &drop_menus, NULL),
QUICK2_CHECKBOX (N_("Shell &patterns"), &easy_patterns, NULL),
QUICK2_CHECKBOX (N_("Co&mplete: show all"),
&mc_global.widget.show_all_if_ambiguous, NULL),
QUICK2_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL),
QUICK2_CHECKBOX (N_("Cd follows lin&ks"), &mc_global.vfs.cd_symlinks, NULL),
QUICK2_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL),
QUICK2_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL),
QUICK2_SEPARATOR (FALSE),
QUICK2_SEPARATOR (FALSE),
QUICK2_SEPARATOR (FALSE),
QUICK2_SEPARATOR (FALSE),
QUICK2_STOP_GROUPBOX,
QUICK2_STOP_COLUMNS,
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_START_COLUMNS,
QUICK_START_GROUPBOX (N_("File operations")),
QUICK_CHECKBOX (N_("&Verbose operation"), &verbose, NULL),
QUICK_CHECKBOX (N_("Compute tota&ls"), &file_op_compute_totals, NULL),
QUICK_CHECKBOX (N_("Classic pro&gressbar"), &classic_progressbar, NULL),
QUICK_CHECKBOX (N_("Mkdi&r autoname"), &auto_fill_mkdir_name, NULL),
QUICK_CHECKBOX (N_("Preallocate &space"), &mc_global.vfs.preallocate_space,
NULL),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("Esc key mode")),
QUICK_CHECKBOX (N_("S&ingle press"), &old_esc_mode, &configure_old_esc_mode_id),
QUICK_LABELED_INPUT (N_("Timeout:"), input_label_left,
(const char *) time_out, 0, MC_HISTORY_ESC_TIMEOUT,
&time_out_new, &configure_time_out_id),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("Pause after run")),
QUICK_RADIO (pause_options_num, pause_options, &pause_after_run, NULL),
QUICK_STOP_GROUPBOX,
QUICK_NEXT_COLUMN,
QUICK_START_GROUPBOX (N_("Other options")),
QUICK_CHECKBOX (N_("Use internal edi&t"), &use_internal_edit, NULL),
QUICK_CHECKBOX (N_("Use internal vie&w"), &use_internal_view, NULL),
QUICK_CHECKBOX (N_("Auto m&enus"), &auto_menu, NULL),
QUICK_CHECKBOX (N_("&Drop down menus"), &drop_menus, NULL),
QUICK_CHECKBOX (N_("Shell &patterns"), &easy_patterns, NULL),
QUICK_CHECKBOX (N_("Co&mplete: show all"),
&mc_global.widget.show_all_if_ambiguous, NULL),
QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL),
QUICK_CHECKBOX (N_("Cd follows lin&ks"), &mc_global.vfs.cd_symlinks, NULL),
QUICK_CHECKBOX (N_("Sa&fe delete"), &safe_delete, NULL),
QUICK_CHECKBOX (N_("A&uto save setup"), &auto_save_setup, NULL),
QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_STOP_GROUPBOX,
QUICK_STOP_COLUMNS,
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -171,7 +170,7 @@ configure_box (void)
quick_widgets[7].options = W_DISABLED;
#endif
if (quick2_dialog (&qdlg) == B_ENTER)
if (quick_dialog (&qdlg) == B_ENTER)
old_esc_mode_timeout = atoi (time_out_new);
g_free (time_out_new);
@ -197,44 +196,44 @@ panel_options_box (void)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_START_COLUMNS,
QUICK2_START_GROUPBOX (N_("Main options")),
QUICK2_CHECKBOX (N_("Show mi&ni-status"), &panels_options.show_mini_info, NULL),
QUICK2_CHECKBOX (N_("Use SI si&ze units"), &panels_options.kilobyte_si, NULL),
QUICK2_CHECKBOX (N_("Mi&x all files"), &panels_options.mix_all_files, NULL),
QUICK2_CHECKBOX (N_("Show &backup files"), &panels_options.show_backups, NULL),
QUICK2_CHECKBOX (N_("Show &hidden files"), &panels_options.show_dot_files, NULL),
QUICK2_CHECKBOX (N_("&Fast dir reload"), &panels_options.fast_reload, NULL),
QUICK2_CHECKBOX (N_("Ma&rk moves down"), &panels_options.mark_moves_down, NULL),
QUICK2_CHECKBOX (N_("Re&verse files only"), &panels_options.reverse_files_only,
NULL),
QUICK2_CHECKBOX (N_("Simple s&wap"), &simple_swap, NULL),
QUICK2_CHECKBOX (N_("A&uto save panels setup"), &panels_options.auto_save_setup,
NULL),
QUICK2_SEPARATOR (FALSE),
QUICK2_SEPARATOR (FALSE),
QUICK2_STOP_GROUPBOX,
QUICK2_NEXT_COLUMN,
QUICK2_START_GROUPBOX (N_("Navigation")),
QUICK2_CHECKBOX (N_("L&ynx-like motion"), &panels_options.navigate_with_arrows,
NULL),
QUICK2_CHECKBOX (N_("Pa&ge scrolling"), &panels_options.scroll_pages, NULL),
QUICK2_CHECKBOX (N_("&Mouse page scrolling"), &panels_options.mouse_move_pages,
NULL),
QUICK2_STOP_GROUPBOX,
QUICK2_START_GROUPBOX (N_("File highlight")),
QUICK2_CHECKBOX (N_("File &types"), &panels_options.filetype_mode, NULL),
QUICK2_CHECKBOX (N_("&Permissions"), &panels_options.permission_mode, NULL),
QUICK2_STOP_GROUPBOX,
QUICK2_START_GROUPBOX (N_("Quick search")),
QUICK2_RADIO (QSEARCH_NUM, qsearch_options, (int *) &panels_options.qsearch_mode,
NULL),
QUICK2_STOP_GROUPBOX,
QUICK2_STOP_COLUMNS,
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_START_COLUMNS,
QUICK_START_GROUPBOX (N_("Main options")),
QUICK_CHECKBOX (N_("Show mi&ni-status"), &panels_options.show_mini_info, NULL),
QUICK_CHECKBOX (N_("Use SI si&ze units"), &panels_options.kilobyte_si, NULL),
QUICK_CHECKBOX (N_("Mi&x all files"), &panels_options.mix_all_files, NULL),
QUICK_CHECKBOX (N_("Show &backup files"), &panels_options.show_backups, NULL),
QUICK_CHECKBOX (N_("Show &hidden files"), &panels_options.show_dot_files, NULL),
QUICK_CHECKBOX (N_("&Fast dir reload"), &panels_options.fast_reload, NULL),
QUICK_CHECKBOX (N_("Ma&rk moves down"), &panels_options.mark_moves_down, NULL),
QUICK_CHECKBOX (N_("Re&verse files only"), &panels_options.reverse_files_only,
NULL),
QUICK_CHECKBOX (N_("Simple s&wap"), &simple_swap, NULL),
QUICK_CHECKBOX (N_("A&uto save panels setup"), &panels_options.auto_save_setup,
NULL),
QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_STOP_GROUPBOX,
QUICK_NEXT_COLUMN,
QUICK_START_GROUPBOX (N_("Navigation")),
QUICK_CHECKBOX (N_("L&ynx-like motion"), &panels_options.navigate_with_arrows,
NULL),
QUICK_CHECKBOX (N_("Pa&ge scrolling"), &panels_options.scroll_pages, NULL),
QUICK_CHECKBOX (N_("&Mouse page scrolling"), &panels_options.mouse_move_pages,
NULL),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("File highlight")),
QUICK_CHECKBOX (N_("File &types"), &panels_options.filetype_mode, NULL),
QUICK_CHECKBOX (N_("&Permissions"), &panels_options.permission_mode, NULL),
QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("Quick search")),
QUICK_RADIO (QSEARCH_NUM, qsearch_options, (int *) &panels_options.qsearch_mode,
NULL),
QUICK_STOP_GROUPBOX,
QUICK_STOP_COLUMNS,
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -244,7 +243,7 @@ panel_options_box (void)
quick_widgets, NULL, NULL
};
if (quick2_dialog (&qdlg) != B_ENTER)
if (quick_dialog (&qdlg) != B_ENTER)
return;
}

View File

@ -87,25 +87,25 @@ mcview_dialog_search (mcview_t * view)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_LABELED_INPUT (N_("Enter search string:"), input_label_above,
INPUT_LAST_TEXT, 0, MC_HISTORY_SHARED_SEARCH, &exp, NULL),
QUICK2_SEPARATOR (TRUE),
QUICK2_START_COLUMNS,
QUICK2_RADIO (num_of_types, (const char **) list_of_types,
(int *) &mcview_search_options.type, NULL),
QUICK2_NEXT_COLUMN,
QUICK2_CHECKBOX (N_("Cas&e sensitive"), &mcview_search_options.case_sens, NULL),
QUICK2_CHECKBOX (N_("&Backwards"), &mcview_search_options.backwards, NULL),
QUICK2_CHECKBOX (N_("&Whole words"), &mcview_search_options.whole_words, NULL),
QUICK_LABELED_INPUT (N_("Enter search string:"), input_label_above,
INPUT_LAST_TEXT, 0, MC_HISTORY_SHARED_SEARCH, &exp, NULL),
QUICK_SEPARATOR (TRUE),
QUICK_START_COLUMNS,
QUICK_RADIO (num_of_types, (const char **) list_of_types,
(int *) &mcview_search_options.type, NULL),
QUICK_NEXT_COLUMN,
QUICK_CHECKBOX (N_("Cas&e sensitive"), &mcview_search_options.case_sens, NULL),
QUICK_CHECKBOX (N_("&Backwards"), &mcview_search_options.backwards, NULL),
QUICK_CHECKBOX (N_("&Whole words"), &mcview_search_options.whole_words, NULL),
#ifdef HAVE_CHARSET
QUICK2_CHECKBOX (N_("&All charsets"), &mcview_search_options.all_codepages, NULL),
QUICK_CHECKBOX (N_("&All charsets"), &mcview_search_options.all_codepages, NULL),
#endif
QUICK2_STOP_COLUMNS,
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_STOP_COLUMNS,
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
/* *INDENT-ON* */
QUICK2_END
QUICK_END
};
quick_dialog_t qdlg = {
@ -114,7 +114,7 @@ mcview_dialog_search (mcview_t * view)
quick_widgets, NULL, NULL
};
qd_result = quick2_dialog (&qdlg);
qd_result = quick_dialog (&qdlg);
}
g_strfreev (list_of_types);
@ -199,13 +199,13 @@ mcview_dialog_goto (mcview_t * view, off_t * offset)
{
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK2_INPUT (INPUT_LAST_TEXT, 0, MC_HISTORY_VIEW_GOTO, &exp, NULL),
QUICK2_RADIO (num_of_types, (const char **) mc_view_goto_str,
(int *) &current_goto_type, NULL),
QUICK2_START_BUTTONS (TRUE, TRUE),
QUICK2_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK2_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK2_END
QUICK_INPUT (INPUT_LAST_TEXT, 0, MC_HISTORY_VIEW_GOTO, &exp, NULL),
QUICK_RADIO (num_of_types, (const char **) mc_view_goto_str, (int *) &current_goto_type,
NULL),
QUICK_START_BUTTONS (TRUE, TRUE),
QUICK_BUTTON (N_("&OK"), B_ENTER, NULL, NULL),
QUICK_BUTTON (N_("&Cancel"), B_CANCEL, NULL, NULL),
QUICK_END
/* *INDENT-ON* */
};
@ -216,7 +216,7 @@ mcview_dialog_goto (mcview_t * view, off_t * offset)
};
/* run dialog */
qd_result = quick2_dialog (&qdlg);
qd_result = quick_dialog (&qdlg);
}
*offset = -1;