1
1

src/wtools: add callback functions for buttons to QuickWidget structure

Этот коммит содержится в:
Slava Zanko 2009-04-29 14:07:09 +03:00
родитель 4eec009295
Коммит d2e62a5c87
7 изменённых файлов: 88 добавлений и 90 удалений

Просмотреть файл

@ -85,60 +85,60 @@ edit_options_dialog (void)
QuickWidget quick_widgets[] = {
/* 0 */
{quick_button, 6, 10, OPT_DLG_H - 3, OPT_DLG_H, N_("&Cancel"), 0,
B_CANCEL, 0, 0, NULL},
B_CANCEL, 0, 0, NULL, NULL, NULL},
/* 1 */
{quick_button, 2, 10, OPT_DLG_H - 3, OPT_DLG_H, N_("&OK"), 0,
B_ENTER, 0, 0, NULL},
B_ENTER, 0, 0, NULL, NULL, NULL},
/* 2 */
{quick_label, OPT_DLG_W / 2, OPT_DLG_W, OPT_DLG_H - 7, OPT_DLG_H,
N_("Word wrap line length: "), 0, 0, 0, 0, NULL},
N_("Word wrap line length: "), 0, 0, 0, 0, NULL, NULL, NULL},
/* 3 */
{quick_input, OPT_DLG_W / 2 + 24, OPT_DLG_W, OPT_DLG_H - 7,
OPT_DLG_H, "", OPT_DLG_W / 2 - 4 - 24, 0, 0, 0, "edit-word-wrap"},
OPT_DLG_H, "", OPT_DLG_W / 2 - 4 - 24, 0, 0, 0, "edit-word-wrap", NULL, NULL},
/* 4 */
{quick_label, OPT_DLG_W / 2, OPT_DLG_W, OPT_DLG_H - 6, OPT_DLG_H,
N_("Tab spacing: "), 0, 0, 0, 0, NULL},
N_("Tab spacing: "), 0, 0, 0, 0, NULL, NULL, NULL},
/* 5 */
{quick_input, OPT_DLG_W / 2 + 24, OPT_DLG_W, OPT_DLG_H - 6,
OPT_DLG_H, "", OPT_DLG_W / 2 - 4 - 24, 0, 0, 0,
"edit-tab-spacing"},
"edit-tab-spacing", NULL, NULL},
/* 6 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 9,
OPT_DLG_H, N_("Pers&istent selection"), 8, 0, 0, 0, NULL},
OPT_DLG_H, N_("Pers&istent selection"), 8, 0, 0, 0, NULL, NULL, NULL},
/* 7 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 10,
OPT_DLG_H, N_("Synta&x highlighting"), 8, 0, 0, 0, NULL},
OPT_DLG_H, N_("Synta&x highlighting"), 8, 0, 0, 0, NULL, NULL, NULL},
/* 7 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 11,
OPT_DLG_H, N_("Save file &position"), 0, 0, 0, 0, NULL},
OPT_DLG_H, N_("Save file &position"), 0, 0, 0, 0, NULL, NULL, NULL},
/* 9 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 12,
OPT_DLG_H, N_("Confir&m before saving"), 6, 0, 0, 0, NULL},
OPT_DLG_H, N_("Confir&m before saving"), 6, 0, 0, 0, NULL, NULL, NULL},
/* 10 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 13,
OPT_DLG_H, N_("Fill tabs with &spaces"), 0, 0, 0, 0, NULL},
OPT_DLG_H, N_("Fill tabs with &spaces"), 0, 0, 0, 0, NULL, NULL, NULL},
/* 11 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 14,
OPT_DLG_H, N_("&Return does autoindent"), 0, 0, 0, 0, NULL},
OPT_DLG_H, N_("&Return does autoindent"), 0, 0, 0, 0, NULL, NULL, NULL},
/* 12 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 15,
OPT_DLG_H, N_("&Backspace through tabs"), 0, 0, 0, 0, NULL},
OPT_DLG_H, N_("&Backspace through tabs"), 0, 0, 0, 0, NULL, NULL, NULL},
/* 13 */
{quick_checkbox, OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 16,
OPT_DLG_H, N_("&Fake half tabs"), 0, 0, 0, 0, NULL},
OPT_DLG_H, N_("&Fake half tabs"), 0, 0, 0, 0, NULL, NULL, NULL},
/* 14 */
{quick_radio, 5, OPT_DLG_W, OPT_DLG_H - 9, OPT_DLG_H, "", 3, 0, 0,
const_cast(char **, wrap_str), "wrapm"},
const_cast(char **, wrap_str), "wrapm", NULL, NULL},
/* 15 */
{quick_label, 4, OPT_DLG_W, OPT_DLG_H - 10, OPT_DLG_H,
N_("Wrap mode"), 0, 0,
0, 0, NULL},
0, 0, NULL, NULL, NULL},
/* 16 */
{quick_radio, 5, OPT_DLG_W, OPT_DLG_H - 15, OPT_DLG_H, "", 3, 0, 0,
const_cast(char **, key_emu_str), "keyemu"},
const_cast(char **, key_emu_str), "keyemu", NULL, NULL},
/* 17 */
{quick_label, 4, OPT_DLG_W, OPT_DLG_H - 16, OPT_DLG_H,
N_("Key emulation"), 0, 0, 0, 0, NULL},
N_("Key emulation"), 0, 0, 0, 0, NULL, NULL, NULL},
NULL_QuickWidget
};

Просмотреть файл

@ -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 , NULL},
0, B_CANCEL, 0, 0, NULL , NULL, NULL},
{ quick_button, 4, 6, 3, CONFY, N_("&OK"),
0, B_ENTER, 0, 0, NULL , NULL},
0, B_ENTER, 0, 0, NULL , NULL, NULL},
{ quick_checkbox, 1, 13, 7, CONFY, N_(" confirm di&Rectory hotlist delete "),
11, 0, &my_directory_hotlist_delete, NULL, NULL , NULL},
11, 0, &my_directory_hotlist_delete, NULL, NULL , NULL, NULL},
{ quick_checkbox, 1, 13, 6, CONFY, N_(" confirm &Exit "),
9, 0, &my_exit, 0, NULL , NULL},
9, 0, &my_exit, 0, NULL , NULL, NULL},
{ quick_checkbox, 1, 13, 5, CONFY, N_(" confirm e&Xecute "),
10, 0, &my_execute, 0, NULL , NULL},
10, 0, &my_execute, 0, NULL , NULL, NULL},
{ quick_checkbox, 1, 13, 4, CONFY, N_(" confirm o&Verwrite "),
10, 0, &my_overwrite, 0, NULL , NULL},
10, 0, &my_overwrite, 0, NULL , NULL, NULL},
{ quick_checkbox, 1, 13, 3, CONFY, N_(" confirm &Delete "),
9, 0, &my_delete, 0, NULL , NULL},
9, 0, &my_delete, 0, NULL , 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 , NULL},
0, B_CANCEL, 0, 0, NULL , NULL, NULL},
{ quick_button, 4, 6, 3, DISPY, N_("&OK"),
0, B_ENTER, 0, 0, NULL , NULL},
0, B_ENTER, 0, 0, NULL , NULL, NULL},
{ quick_checkbox, 4, DISPX, 7, DISPY, N_("F&ull 8 bits input"),
0, 0, &new_meta, 0, NULL , NULL},
0, 0, &new_meta, 0, NULL , NULL, NULL},
{ quick_radio, 4, DISPX, 3, DISPY, "", 3, 0,
&new_mode, const_cast(char **, display_bits_str), NULL , NULL},
&new_mode, const_cast(char **, display_bits_str), NULL , 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 , NULL},
0, B_CANCEL, 0, 0, NULL , NULL, NULL},
{ quick_button, 12, VFSX, VFSY - 3, VFSY, N_("&OK"),
0, B_ENTER, 0, 0, NULL , NULL},
0, B_ENTER, 0, 0, NULL , 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 , NULL},
&ret_ftpfs_use_passive_connections_over_proxy, 0, NULL , NULL, NULL},
{ quick_checkbox, 4, VFSX, 11, VFSY, N_("Use &passive mode"), 0, 0,
&ret_ftpfs_use_passive_connections, 0, NULL , NULL},
&ret_ftpfs_use_passive_connections, 0, NULL , NULL, NULL},
{ quick_checkbox, 4, VFSX, 10, VFSY, N_("&Use ~/.netrc"), 0, 0,
&ret_use_netrc, 0, NULL , NULL},
&ret_use_netrc, 0, NULL , NULL, NULL},
{ quick_input, 4, VFSX, 9, VFSY, "", 48, 0, 0, &ret_ftp_proxy,
"input-ftp-proxy" , NULL},
"input-ftp-proxy" , NULL, NULL},
{ quick_checkbox, 4, VFSX, 8, VFSY, N_("&Always use ftp proxy"), 0, 0,
&ftpfs_always_use_proxy, 0, NULL , NULL},
&ftpfs_always_use_proxy, 0, NULL , NULL, NULL},
{ quick_label, 49, VFSX, 7, VFSY, N_("sec"),
0, 0, 0, 0, NULL , NULL},
0, 0, 0, 0, NULL , NULL, NULL},
{ quick_input, 38, VFSX, 7, VFSY, "", 10, 0, 0, &ret_directory_timeout,
"input-timeout" , NULL},
"input-timeout" , NULL, NULL},
{ quick_label, 4, VFSX, 7, VFSY, N_("ftpfs directory cache timeout:"),
0, 0, 0, 0, NULL , NULL},
0, 0, 0, 0, NULL , NULL, NULL},
{ quick_input, 4, VFSX, 6, VFSY, "", 48, 0, 0, &ret_passwd,
"input-passwd" , NULL},
"input-passwd" , NULL, NULL},
{ quick_label, 4, VFSX, 5, VFSY, N_("ftp anonymous password:"),
0, 0, 0, 0, NULL , NULL},
0, 0, 0, 0, NULL , NULL, NULL},
#endif
{ quick_label, 49, VFSX, 3, VFSY, "sec",
0, 0, 0, 0, NULL , NULL},
0, 0, 0, 0, NULL , NULL, NULL},
{ quick_input, 38, VFSX, 3, VFSY, "", 10, 0, 0, &ret_timeout,
"input-timo-vfs" , NULL},
"input-timo-vfs" , NULL, NULL},
{ quick_label, 4, VFSX, 3, VFSY, N_("Timeout for freeing VFSs:"),
0, 0, 0, 0, NULL , NULL},
0, 0, 0, 0, NULL , 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" , NULL},
{ quick_label, 3, 57, 2, 0, "", 0, 0, 0, 0, NULL , NULL},
{ quick_input, 6, 57, 2, 0, "", 50, 0, 0, 0, "input" , NULL, NULL},
{ quick_label, 3, 57, 2, 0, "", 0, 0, 0, 0, NULL , 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, 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},
NULL, NULL, NULL},
{quick_button, 16, 80, 6, 8, N_("&OK"), 0, B_ENTER, 0, 0, NULL, NULL, NULL},
{quick_input, 4, 80, 5, 8, "", 58, 0, 0, 0, "input-1", NULL, NULL},
{quick_label, 4, 80, 4, 8, N_("Symbolic link filename:"), 0, 0, 0,
0, NULL, NULL},
{quick_input, 4, 80, 3, 8, "", 58, 0, 0, 0, "input-2", NULL},
0, NULL, NULL, NULL},
{quick_input, 4, 80, 3, 8, "", 58, 0, 0, 0, "input-2", NULL, NULL},
{quick_label, 4, 80, 2, 8,
N_("Existing filename (filename symlink will point to):"), 0, 0,
0, 0, NULL, NULL},
0, 0, NULL, 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, NULL},
0 /* &op_preserve */ , 0, NULL, NULL, NULL},
{quick_checkbox, 3, 64, 7, FMDY, N_("follow &Links"), 7, 0,
0 /* &file_mask_op_follow_links */ , 0, NULL, NULL},
{quick_label, 3, 64, 5, FMDY, N_("to:"), 0, 0, 0, 0, NULL, NULL},
0 /* &file_mask_op_follow_links */ , 0, NULL, NULL, NULL},
{quick_label, 3, 64, 5, FMDY, N_("to:"), 0, 0, 0, 0, NULL, NULL, NULL},
{quick_checkbox, 37, 64, 4, FMDY, N_("&Using shell patterns"), 0, 0,
0 /* &source_easy_patterns */ , 0, NULL, NULL},
0 /* &source_easy_patterns */ , 0, NULL, NULL, NULL},
{quick_input, 3, 64, 3, FMDY, "", 58,
0, 0, 0, "input-def", NULL},
0, 0, 0, "input-def", NULL, NULL},
#define FMDI1 4
#define FMDI2 5
#define FMDC 3
{quick_input, 3, 64, 6, FMDY, "", 58, 0,
0, 0, "input2", NULL},
0, 0, "input2", NULL, NULL},
#define FMDI0 6
{quick_label, 3, 64, 2, FMDY, "", 0, 0, 0, 0, NULL, NULL},
{quick_label, 3, 64, 2, FMDY, "", 0, 0, 0, 0, NULL, NULL, NULL},
#define FMBRGT 7
{quick_button, 42, 64, 9, FMDY, N_("&Cancel"), 0, B_CANCEL, 0, 0,
NULL, NULL},
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, NULL, NULL},
#else /* WITH_BACKGROUND */
# define SKIP 4
# define FMCB21 10
@ -765,12 +765,11 @@ static QuickWidget fmd_widgets[] = {
# define FMBLFT 8
# undef FMBMID
#endif
{quick_button, 14, 64, 9, FMDY, N_("&OK"), 0, B_ENTER, 0, 0, NULL, NULL},
{quick_button, 14, 64, 9, FMDY, N_("&OK"), 0, B_ENTER, 0, 0, NULL, NULL, NULL},
{quick_checkbox, 42, 64, 8, FMDY, N_("&Stable Symlinks"), 0, 0,
0 /* &file_mask_stable_symlinks */ , 0, NULL, NULL},
0 /* &file_mask_stable_symlinks */ , 0, NULL, NULL, NULL},
{quick_checkbox, 31, 64, 7, FMDY, N_("&Dive into subdir if exists"), 0,
0,
0 /* &dive_into_subdirs */ , 0, NULL, NULL},
0, 0 /* &dive_into_subdirs */ , 0, NULL, 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 , NULL},
0, 0, NULL , NULL, NULL},
{ quick_button, 30, 80, RELATIVE_Y_BUTTONS, 0, N_("&Insert"), 0, B_INSERT,
0, 0, NULL , NULL},
0, 0, NULL , NULL, NULL},
{ quick_button, 10, 80, RELATIVE_Y_BUTTONS, 0, N_("&Append"), 0, B_APPEND,
0, 0, NULL , NULL},
0, 0, NULL , NULL, NULL},
{ quick_input, 4, 80, RELATIVE_Y_INPUT_PTH, 0, "",58, 0,
0, 0, "input-pth" , NULL},
0, 0, "input-pth" , NULL, NULL},
{ quick_label, RELATIVE_Y_LABEL_PTH, 80, 3, 0, 0, 0, 0,
0, 0, NULL , NULL},
0, 0, NULL , NULL, NULL},
{ quick_input, 4, 80, 3, 0, "", 58, 0,
0, 0, "input-lbl" , NULL},
0, 0, "input-lbl" , NULL, NULL},
{ quick_label, 3, 80, 2, 0, 0, 0, 0,
0, 0, NULL , NULL},
0, 0, NULL , 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 , NULL, NULL},
{ quick_button, 30, 80, 1, 0, N_("&Insert"), 0, B_INSERT, 0, 0,
NULL , NULL},
NULL , NULL, NULL},
{ quick_button, 10, 80, 1, 0, N_("&Append"), 0, B_APPEND, 0, 0,
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 , NULL, NULL},
{ quick_input, 4, 80, 0, 0, "", 58, 0, 0, 0, "input" , NULL, NULL},
{ quick_label, 3, 80, 2, 0, 0, 0, 0, 0, 0, NULL , NULL, NULL},
NULL_QuickWidget };
int relative_y[] = {1, 1, 1, 0, 2}; /* the relative_x component from the
quick_widgets variable above */

Просмотреть файл

@ -3466,18 +3466,16 @@ 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, NULL},
B_CANCEL, 0, 0, NULL, NULL, NULL},
{quick_button, 2, 10, 5, SEARCH_DLG_HEIGHT, N_("&OK"), 0, B_ENTER,
0, 0, NULL, NULL},
0, 0, NULL, NULL, NULL},
{quick_checkbox, 3, SEARCH_DLG_WIDTH, 4, SEARCH_DLG_HEIGHT,
N_("&Backwards"), 0, 0,
0, 0, NULL, NULL},
0, 0, NULL, NULL, NULL},
{quick_input, 3, SEARCH_DLG_WIDTH, 3, SEARCH_DLG_HEIGHT, "", 52, 0,
0, 0, N_("Search"), NULL},
0, 0, N_("Search"), NULL, NULL},
{quick_label, 2, SEARCH_DLG_WIDTH, 2, SEARCH_DLG_HEIGHT,
N_(" Enter search string:"), 0, 0,
0, 0, 0, NULL},
N_(" Enter search string:"), 0, 0, 0, 0, 0, NULL, NULL},
NULL_QuickWidget
};
static QuickDialog Quick_input = {

Просмотреть файл

@ -354,7 +354,7 @@ quick_dialog_skip (QuickDialog *qd, int nskip)
button_new (ypos, xpos, qw->value,
(qw->value ==
B_ENTER) ? DEFPUSH_BUTTON : NORMAL_BUTTON,
I18N (qw->text), 0);
I18N (qw->text), (bcback) qw->cb);
break;
/* We use the hotkey pos as the field length */
@ -445,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, 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, NULL, NULL},
{quick_button, 3, 10, 1, 0, N_("&OK"), 0, B_ENTER, 0, 0, NULL, NULL, NULL},
{quick_input, 4, 80, 0, 0, "", 58, 0, 0, 0, NULL, NULL, NULL},
{quick_label, 4, 80, 2, 0, "", 0, 0, 0, 0, NULL, NULL, NULL},
NULL_QuickWidget
};

Просмотреть файл

@ -39,10 +39,11 @@ 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 */
bcback cb; /* Callback for quick_button */
Widget *widget;
} QuickWidget;
#define NULL_QuickWidget { 0, 0, 0, 0, 0, NULL, 0, 0, NULL, NULL, NULL , NULL }
#define NULL_QuickWidget { 0, 0, 0, 0, 0, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL }
typedef struct {
int xlen, ylen;