src/wtools: add (Widget *) widget member to QuickWidget structure
Этот коммит содержится в:
родитель
d7f85d90d3
Коммит
2137d0037f
68
src/boxes.c
68
src/boxes.c
@ -377,20 +377,20 @@ static int my_exit;
|
||||
|
||||
static QuickWidget conf_widgets [] = {
|
||||
{ quick_button, 4, 6, 4, CONFY, N_("&Cancel"),
|
||||
0, B_CANCEL, 0, 0, NULL },
|
||||
0, B_CANCEL, 0, 0, NULL , NULL},
|
||||
{ quick_button, 4, 6, 3, CONFY, N_("&OK"),
|
||||
0, B_ENTER, 0, 0, NULL },
|
||||
0, B_ENTER, 0, 0, NULL , NULL},
|
||||
|
||||
{ quick_checkbox, 1, 13, 7, CONFY, N_(" confirm di&Rectory hotlist delete "),
|
||||
11, 0, &my_directory_hotlist_delete, NULL, NULL },
|
||||
11, 0, &my_directory_hotlist_delete, NULL, NULL , NULL},
|
||||
{ quick_checkbox, 1, 13, 6, CONFY, N_(" confirm &Exit "),
|
||||
9, 0, &my_exit, 0, NULL },
|
||||
9, 0, &my_exit, 0, NULL , NULL},
|
||||
{ quick_checkbox, 1, 13, 5, CONFY, N_(" confirm e&Xecute "),
|
||||
10, 0, &my_execute, 0, NULL },
|
||||
10, 0, &my_execute, 0, NULL , NULL},
|
||||
{ quick_checkbox, 1, 13, 4, CONFY, N_(" confirm o&Verwrite "),
|
||||
10, 0, &my_overwrite, 0, NULL },
|
||||
10, 0, &my_overwrite, 0, NULL , NULL},
|
||||
{ quick_checkbox, 1, 13, 3, CONFY, N_(" confirm &Delete "),
|
||||
9, 0, &my_delete, 0, NULL },
|
||||
9, 0, &my_delete, 0, NULL , NULL},
|
||||
NULL_QuickWidget
|
||||
};
|
||||
|
||||
@ -473,13 +473,13 @@ static const char *display_bits_str [] =
|
||||
|
||||
static QuickWidget display_widgets [] = {
|
||||
{ quick_button, 4, 6, 4, DISPY, N_("&Cancel"),
|
||||
0, B_CANCEL, 0, 0, NULL },
|
||||
0, B_CANCEL, 0, 0, NULL , NULL},
|
||||
{ quick_button, 4, 6, 3, DISPY, N_("&OK"),
|
||||
0, B_ENTER, 0, 0, NULL },
|
||||
0, B_ENTER, 0, 0, NULL , NULL},
|
||||
{ quick_checkbox, 4, DISPX, 7, DISPY, N_("F&ull 8 bits input"),
|
||||
0, 0, &new_meta, 0, NULL },
|
||||
0, 0, &new_meta, 0, NULL , NULL},
|
||||
{ quick_radio, 4, DISPX, 3, DISPY, "", 3, 0,
|
||||
&new_mode, const_cast(char **, display_bits_str), NULL },
|
||||
&new_mode, const_cast(char **, display_bits_str), NULL , NULL},
|
||||
NULL_QuickWidget
|
||||
};
|
||||
|
||||
@ -728,37 +728,37 @@ static int ret_ftpfs_use_passive_connections_over_proxy;
|
||||
|
||||
static QuickWidget confvfs_widgets [] = {
|
||||
{ quick_button, 30, VFSX, VFSY - 3, VFSY, N_("&Cancel"),
|
||||
0, B_CANCEL, 0, 0, NULL },
|
||||
0, B_CANCEL, 0, 0, NULL , NULL},
|
||||
{ quick_button, 12, VFSX, VFSY - 3, VFSY, N_("&OK"),
|
||||
0, B_ENTER, 0, 0, NULL },
|
||||
0, B_ENTER, 0, 0, NULL , NULL},
|
||||
#if defined(USE_NETCODE)
|
||||
{ quick_checkbox, 4, VFSX, 12, VFSY, N_("Use passive mode over pro&xy"), 0, 0,
|
||||
&ret_ftpfs_use_passive_connections_over_proxy, 0, NULL },
|
||||
&ret_ftpfs_use_passive_connections_over_proxy, 0, NULL , NULL},
|
||||
{ quick_checkbox, 4, VFSX, 11, VFSY, N_("Use &passive mode"), 0, 0,
|
||||
&ret_ftpfs_use_passive_connections, 0, NULL },
|
||||
&ret_ftpfs_use_passive_connections, 0, NULL , NULL},
|
||||
{ quick_checkbox, 4, VFSX, 10, VFSY, N_("&Use ~/.netrc"), 0, 0,
|
||||
&ret_use_netrc, 0, NULL },
|
||||
&ret_use_netrc, 0, NULL , NULL},
|
||||
{ quick_input, 4, VFSX, 9, VFSY, "", 48, 0, 0, &ret_ftp_proxy,
|
||||
"input-ftp-proxy" },
|
||||
"input-ftp-proxy" , NULL},
|
||||
{ quick_checkbox, 4, VFSX, 8, VFSY, N_("&Always use ftp proxy"), 0, 0,
|
||||
&ftpfs_always_use_proxy, 0, NULL },
|
||||
&ftpfs_always_use_proxy, 0, NULL , NULL},
|
||||
{ quick_label, 49, VFSX, 7, VFSY, N_("sec"),
|
||||
0, 0, 0, 0, NULL },
|
||||
0, 0, 0, 0, NULL , NULL},
|
||||
{ quick_input, 38, VFSX, 7, VFSY, "", 10, 0, 0, &ret_directory_timeout,
|
||||
"input-timeout" },
|
||||
"input-timeout" , NULL},
|
||||
{ quick_label, 4, VFSX, 7, VFSY, N_("ftpfs directory cache timeout:"),
|
||||
0, 0, 0, 0, NULL },
|
||||
0, 0, 0, 0, NULL , NULL},
|
||||
{ quick_input, 4, VFSX, 6, VFSY, "", 48, 0, 0, &ret_passwd,
|
||||
"input-passwd" },
|
||||
"input-passwd" , NULL},
|
||||
{ quick_label, 4, VFSX, 5, VFSY, N_("ftp anonymous password:"),
|
||||
0, 0, 0, 0, NULL },
|
||||
0, 0, 0, 0, NULL , NULL},
|
||||
#endif
|
||||
{ quick_label, 49, VFSX, 3, VFSY, "sec",
|
||||
0, 0, 0, 0, NULL },
|
||||
0, 0, 0, 0, NULL , NULL},
|
||||
{ quick_input, 38, VFSX, 3, VFSY, "", 10, 0, 0, &ret_timeout,
|
||||
"input-timo-vfs" },
|
||||
"input-timo-vfs" , NULL},
|
||||
{ quick_label, 4, VFSX, 3, VFSY, N_("Timeout for freeing VFSs:"),
|
||||
0, 0, 0, 0, NULL },
|
||||
0, 0, 0, 0, NULL , NULL},
|
||||
NULL_QuickWidget
|
||||
};
|
||||
|
||||
@ -810,8 +810,8 @@ cd_dialog (void)
|
||||
{
|
||||
QuickDialog Quick_input;
|
||||
QuickWidget quick_widgets [] = {
|
||||
{ quick_input, 6, 57, 2, 0, "", 50, 0, 0, 0, "input" },
|
||||
{ quick_label, 3, 57, 2, 0, "", 0, 0, 0, 0, NULL },
|
||||
{ quick_input, 6, 57, 2, 0, "", 50, 0, 0, 0, "input" , NULL},
|
||||
{ quick_label, 3, 57, 2, 0, "", 0, 0, 0, 0, NULL , NULL},
|
||||
NULL_QuickWidget
|
||||
};
|
||||
char *my_str;
|
||||
@ -853,15 +853,15 @@ symlink_dialog (const char *existing, const char *new, char **ret_existing,
|
||||
QuickDialog Quick_input;
|
||||
QuickWidget quick_widgets[] = {
|
||||
{quick_button, 50, 80, 6, 8, N_("&Cancel"), 0, B_CANCEL, 0, 0,
|
||||
NULL},
|
||||
{quick_button, 16, 80, 6, 8, N_("&OK"), 0, B_ENTER, 0, 0, NULL},
|
||||
{quick_input, 4, 80, 5, 8, "", 58, 0, 0, 0, "input-1"},
|
||||
NULL, NULL},
|
||||
{quick_button, 16, 80, 6, 8, N_("&OK"), 0, B_ENTER, 0, 0, NULL, NULL},
|
||||
{quick_input, 4, 80, 5, 8, "", 58, 0, 0, 0, "input-1", NULL},
|
||||
{quick_label, 4, 80, 4, 8, N_("Symbolic link filename:"), 0, 0, 0,
|
||||
0, NULL},
|
||||
{quick_input, 4, 80, 3, 8, "", 58, 0, 0, 0, "input-2"},
|
||||
0, NULL, NULL},
|
||||
{quick_input, 4, 80, 3, 8, "", 58, 0, 0, 0, "input-2", NULL},
|
||||
{quick_label, 4, 80, 2, 8,
|
||||
N_("Existing filename (filename symlink will point to):"), 0, 0,
|
||||
0, 0, NULL},
|
||||
0, 0, NULL, NULL},
|
||||
NULL_QuickWidget
|
||||
};
|
||||
|
||||
|
@ -731,24 +731,24 @@ static QuickWidget fmd_widgets[] = {
|
||||
#define FMCB11 1
|
||||
/* follow symlinks and preserve Attributes must be the first */
|
||||
{quick_checkbox, 3, 64, 8, FMDY, N_("preserve &Attributes"), 9, 0,
|
||||
0 /* &op_preserve */ , 0, NULL},
|
||||
0 /* &op_preserve */ , 0, NULL, NULL},
|
||||
{quick_checkbox, 3, 64, 7, FMDY, N_("follow &Links"), 7, 0,
|
||||
0 /* &file_mask_op_follow_links */ , 0, NULL},
|
||||
{quick_label, 3, 64, 5, FMDY, N_("to:"), 0, 0, 0, 0, NULL},
|
||||
0 /* &file_mask_op_follow_links */ , 0, NULL, NULL},
|
||||
{quick_label, 3, 64, 5, FMDY, N_("to:"), 0, 0, 0, 0, NULL, NULL},
|
||||
{quick_checkbox, 37, 64, 4, FMDY, N_("&Using shell patterns"), 0, 0,
|
||||
0 /* &source_easy_patterns */ , 0, NULL},
|
||||
0 /* &source_easy_patterns */ , 0, NULL, NULL},
|
||||
{quick_input, 3, 64, 3, FMDY, "", 58,
|
||||
0, 0, 0, "input-def"},
|
||||
0, 0, 0, "input-def", NULL},
|
||||
#define FMDI1 4
|
||||
#define FMDI2 5
|
||||
#define FMDC 3
|
||||
{quick_input, 3, 64, 6, FMDY, "", 58, 0,
|
||||
0, 0, "input2"},
|
||||
0, 0, "input2", NULL},
|
||||
#define FMDI0 6
|
||||
{quick_label, 3, 64, 2, FMDY, "", 0, 0, 0, 0, NULL},
|
||||
{quick_label, 3, 64, 2, FMDY, "", 0, 0, 0, 0, NULL, NULL},
|
||||
#define FMBRGT 7
|
||||
{quick_button, 42, 64, 9, FMDY, N_("&Cancel"), 0, B_CANCEL, 0, 0,
|
||||
NULL},
|
||||
NULL, NULL},
|
||||
#undef SKIP
|
||||
#ifdef WITH_BACKGROUND
|
||||
# define SKIP 5
|
||||
@ -757,7 +757,7 @@ static QuickWidget fmd_widgets[] = {
|
||||
# define FMBLFT 9
|
||||
# define FMBMID 8
|
||||
{quick_button, 25, 64, 9, FMDY, N_("&Background"), 0, B_USER, 0, 0,
|
||||
NULL},
|
||||
NULL, NULL},
|
||||
#else /* WITH_BACKGROUND */
|
||||
# define SKIP 4
|
||||
# define FMCB21 10
|
||||
@ -765,12 +765,12 @@ static QuickWidget fmd_widgets[] = {
|
||||
# define FMBLFT 8
|
||||
# undef FMBMID
|
||||
#endif
|
||||
{quick_button, 14, 64, 9, FMDY, N_("&OK"), 0, B_ENTER, 0, 0, NULL},
|
||||
{quick_button, 14, 64, 9, FMDY, N_("&OK"), 0, B_ENTER, 0, 0, NULL, NULL},
|
||||
{quick_checkbox, 42, 64, 8, FMDY, N_("&Stable Symlinks"), 0, 0,
|
||||
0 /* &file_mask_stable_symlinks */ , 0, NULL},
|
||||
0 /* &file_mask_stable_symlinks */ , 0, NULL, NULL},
|
||||
{quick_checkbox, 31, 64, 7, FMDY, N_("&Dive into subdir if exists"), 0,
|
||||
0,
|
||||
0 /* &dive_into_subdirs */ , 0, NULL},
|
||||
0 /* &dive_into_subdirs */ , 0, NULL, NULL},
|
||||
NULL_QuickWidget
|
||||
};
|
||||
|
||||
|
@ -853,19 +853,19 @@ add_new_entry_input (const char *header, const char *text1, const char *text2,
|
||||
QuickDialog Quick_input;
|
||||
static QuickWidget quick_widgets [] = {
|
||||
{ quick_button, 55, 80, RELATIVE_Y_BUTTONS, 0, N_("&Cancel"), 0, B_CANCEL,
|
||||
0, 0, NULL },
|
||||
0, 0, NULL , NULL},
|
||||
{ quick_button, 30, 80, RELATIVE_Y_BUTTONS, 0, N_("&Insert"), 0, B_INSERT,
|
||||
0, 0, NULL },
|
||||
0, 0, NULL , NULL},
|
||||
{ quick_button, 10, 80, RELATIVE_Y_BUTTONS, 0, N_("&Append"), 0, B_APPEND,
|
||||
0, 0, NULL },
|
||||
0, 0, NULL , NULL},
|
||||
{ quick_input, 4, 80, RELATIVE_Y_INPUT_PTH, 0, "",58, 0,
|
||||
0, 0, "input-pth" },
|
||||
0, 0, "input-pth" , NULL},
|
||||
{ quick_label, RELATIVE_Y_LABEL_PTH, 80, 3, 0, 0, 0, 0,
|
||||
0, 0, NULL },
|
||||
0, 0, NULL , NULL},
|
||||
{ quick_input, 4, 80, 3, 0, "", 58, 0,
|
||||
0, 0, "input-lbl" },
|
||||
0, 0, "input-lbl" , NULL},
|
||||
{ quick_label, 3, 80, 2, 0, 0, 0, 0,
|
||||
0, 0, NULL },
|
||||
0, 0, NULL , NULL},
|
||||
NULL_QuickWidget };
|
||||
|
||||
int len;
|
||||
@ -956,13 +956,13 @@ add_new_group_input (const char *header, const char *label, char **result)
|
||||
QuickDialog Quick_input;
|
||||
static QuickWidget quick_widgets [] = {
|
||||
{ quick_button, 55, 80, 1, 0, N_("&Cancel"), 0, B_CANCEL, 0, 0,
|
||||
NULL },
|
||||
NULL , NULL},
|
||||
{ quick_button, 30, 80, 1, 0, N_("&Insert"), 0, B_INSERT, 0, 0,
|
||||
NULL },
|
||||
NULL , NULL},
|
||||
{ quick_button, 10, 80, 1, 0, N_("&Append"), 0, B_APPEND, 0, 0,
|
||||
NULL },
|
||||
{ quick_input, 4, 80, 0, 0, "", 58, 0, 0, 0, "input" },
|
||||
{ quick_label, 3, 80, 2, 0, 0, 0, 0, 0, 0, NULL },
|
||||
NULL , NULL},
|
||||
{ quick_input, 4, 80, 0, 0, "", 58, 0, 0, 0, "input" , NULL},
|
||||
{ quick_label, 3, 80, 2, 0, 0, 0, 0, 0, 0, NULL , NULL},
|
||||
NULL_QuickWidget };
|
||||
int relative_y[] = {1, 1, 1, 0, 2}; /* the relative_x component from the
|
||||
quick_widgets variable above */
|
||||
|
10
src/view.c
10
src/view.c
@ -3467,17 +3467,17 @@ view_normal_search_cmd (WView *view)
|
||||
static QuickWidget quick_widgets[] = {
|
||||
{quick_button, 6, 10, 5, SEARCH_DLG_HEIGHT, N_("&Cancel"), 0,
|
||||
B_CANCEL,
|
||||
0, 0, NULL},
|
||||
0, 0, NULL, NULL},
|
||||
{quick_button, 2, 10, 5, SEARCH_DLG_HEIGHT, N_("&OK"), 0, B_ENTER,
|
||||
0, 0, NULL},
|
||||
0, 0, NULL, NULL},
|
||||
{quick_checkbox, 3, SEARCH_DLG_WIDTH, 4, SEARCH_DLG_HEIGHT,
|
||||
N_("&Backwards"), 0, 0,
|
||||
0, 0, NULL},
|
||||
0, 0, NULL, NULL},
|
||||
{quick_input, 3, SEARCH_DLG_WIDTH, 3, SEARCH_DLG_HEIGHT, "", 52, 0,
|
||||
0, 0, N_("Search")},
|
||||
0, 0, N_("Search"), NULL},
|
||||
{quick_label, 2, SEARCH_DLG_WIDTH, 2, SEARCH_DLG_HEIGHT,
|
||||
N_(" Enter search string:"), 0, 0,
|
||||
0, 0, 0},
|
||||
0, 0, 0, NULL},
|
||||
NULL_QuickWidget
|
||||
};
|
||||
static QuickDialog Quick_input = {
|
||||
|
40
src/wtools.c
40
src/wtools.c
@ -308,7 +308,7 @@ int
|
||||
quick_dialog_skip (QuickDialog *qd, int nskip)
|
||||
{
|
||||
Dlg_head *dd;
|
||||
void *widget;
|
||||
|
||||
WRadio *r;
|
||||
int xpos;
|
||||
int ypos;
|
||||
@ -316,9 +316,6 @@ quick_dialog_skip (QuickDialog *qd, int nskip)
|
||||
WInput *input;
|
||||
QuickWidget *qw;
|
||||
int do_int;
|
||||
int count = 0; /* number of quick widgets */
|
||||
int curr_widget; /* number of the current quick widget */
|
||||
Widget **widgets; /* table of corresponding widgets */
|
||||
|
||||
if (!qd->i18n) {
|
||||
qd->i18n = 1;
|
||||
@ -337,30 +334,23 @@ quick_dialog_skip (QuickDialog *qd, int nskip)
|
||||
dialog_colors, NULL, qd->help, qd->title,
|
||||
DLG_REVERSE);
|
||||
|
||||
/* Count widgets */
|
||||
for (qw = qd->widgets; qw->widget_type; qw++) {
|
||||
count++;
|
||||
}
|
||||
|
||||
widgets = (Widget **) g_new (Widget *, count);
|
||||
|
||||
for (curr_widget = 0, qw = qd->widgets; qw->widget_type; qw++) {
|
||||
xpos = (qd->xlen * qw->relative_x) / qw->x_divisions;
|
||||
ypos = (qd->ylen * qw->relative_y) / qw->y_divisions;
|
||||
|
||||
switch (qw->widget_type) {
|
||||
case quick_checkbox:
|
||||
widget = check_new (ypos, xpos, *qw->result, I18N (qw->text));
|
||||
qw->widget = check_new (ypos, xpos, *qw->result, I18N (qw->text));
|
||||
break;
|
||||
|
||||
case quick_radio:
|
||||
r = radio_new (ypos, xpos, qw->hotkey_pos, const_cast(const char **, qw->str_result));
|
||||
r->pos = r->sel = qw->value;
|
||||
widget = r;
|
||||
qw->widget = r;
|
||||
break;
|
||||
|
||||
case quick_button:
|
||||
widget =
|
||||
qw->widget =
|
||||
button_new (ypos, xpos, qw->value,
|
||||
(qw->value ==
|
||||
B_ENTER) ? DEFPUSH_BUTTON : NORMAL_BUTTON,
|
||||
@ -376,20 +366,19 @@ quick_dialog_skip (QuickDialog *qd, int nskip)
|
||||
input->point = 0;
|
||||
if (qw->value & 2)
|
||||
input->completion_flags |= INPUT_COMPLETE_CD;
|
||||
widget = input;
|
||||
qw->widget = input;
|
||||
break;
|
||||
|
||||
case quick_label:
|
||||
widget = label_new (ypos, xpos, I18N (qw->text));
|
||||
qw->widget = label_new (ypos, xpos, I18N (qw->text));
|
||||
break;
|
||||
|
||||
default:
|
||||
widget = 0;
|
||||
qw->widget = 0;
|
||||
fprintf (stderr, "QuickWidget: unknown widget type\n");
|
||||
break;
|
||||
}
|
||||
widgets[curr_widget++] = widget;
|
||||
add_widget (dd, widget);
|
||||
add_widget (dd, qw->widget);
|
||||
}
|
||||
|
||||
while (nskip--)
|
||||
@ -399,8 +388,8 @@ quick_dialog_skip (QuickDialog *qd, int nskip)
|
||||
|
||||
/* Get the data if we found something interesting */
|
||||
if (dd->ret_value != B_CANCEL) {
|
||||
for (curr_widget = 0, qw = qd->widgets; qw->widget_type; qw++) {
|
||||
Widget *w = widgets[curr_widget++];
|
||||
for (qw = qd->widgets; qw->widget_type; qw++) {
|
||||
Widget *w = qw->widget;
|
||||
|
||||
switch (qw->widget_type) {
|
||||
case quick_checkbox:
|
||||
@ -423,7 +412,6 @@ quick_dialog_skip (QuickDialog *qd, int nskip)
|
||||
}
|
||||
return_val = dd->ret_value;
|
||||
destroy_dlg (dd);
|
||||
g_free (widgets);
|
||||
|
||||
return return_val;
|
||||
}
|
||||
@ -457,10 +445,10 @@ fg_input_dialog_help (const char *header, const char *text, const char *help,
|
||||
QuickDialog Quick_input;
|
||||
QuickWidget quick_widgets[] = {
|
||||
{quick_button, 6, 10, 1, 0, N_("&Cancel"), 0, B_CANCEL, 0, 0,
|
||||
NULL},
|
||||
{quick_button, 3, 10, 1, 0, N_("&OK"), 0, B_ENTER, 0, 0, NULL},
|
||||
{quick_input, 4, 80, 0, 0, "", 58, 0, 0, 0, NULL},
|
||||
{quick_label, 4, 80, 2, 0, "", 0, 0, 0, 0, NULL},
|
||||
NULL, NULL},
|
||||
{quick_button, 3, 10, 1, 0, N_("&OK"), 0, B_ENTER, 0, 0, NULL, NULL},
|
||||
{quick_input, 4, 80, 0, 0, "", 58, 0, 0, 0, NULL, NULL},
|
||||
{quick_label, 4, 80, 2, 0, "", 0, 0, 0, 0, NULL, NULL},
|
||||
NULL_QuickWidget
|
||||
};
|
||||
|
||||
|
@ -39,8 +39,10 @@ typedef struct {
|
||||
int *result; /* Checkbutton: where to store result */
|
||||
char **str_result; /* Input lines: destination */
|
||||
const char *histname; /* Name of the section for saving history */
|
||||
|
||||
Widget *widget;
|
||||
} QuickWidget;
|
||||
#define NULL_QuickWidget { 0, 0, 0, 0, 0, NULL, 0, 0, NULL, NULL, NULL }
|
||||
#define NULL_QuickWidget { 0, 0, 0, 0, 0, NULL, 0, 0, NULL, NULL, NULL , NULL }
|
||||
|
||||
typedef struct {
|
||||
int xlen, ylen;
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user