mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* widget.h: Completely get rid of tkname. Rename it to histname
for the input widget. Adjust all dependencies.
This commit is contained in:
parent
10f65ac83d
commit
fab6e8a493
@ -553,8 +553,8 @@ edit_raw_key_query (char *heading, char *query, int cancel)
|
||||
if (cancel)
|
||||
add_widget (raw_dlg,
|
||||
button_new (4, w / 2 - 5, B_CANCEL, NORMAL_BUTTON,
|
||||
_("Cancel"), 0, 0, 0));
|
||||
add_widget (raw_dlg, label_new (3 - cancel, 2, query, 0));
|
||||
_("Cancel"), 0, 0));
|
||||
add_widget (raw_dlg, label_new (3 - cancel, 2, query));
|
||||
add_widget (raw_dlg,
|
||||
input_new (3 - cancel, w - 5, INPUT_COLOR, 2, "", 0));
|
||||
run_dlg (raw_dlg);
|
||||
|
@ -1,5 +1,8 @@
|
||||
2003-08-31 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* widget.h: Completely get rid of tkname. Rename it to histname
|
||||
for the input widget. Adjust all dependencies.
|
||||
|
||||
* dlg.h (struct Widget): Remove tkname field.
|
||||
(init_widget): Remove tkname argument.
|
||||
* widget.h (listbox_new): Likewise.
|
||||
|
@ -550,8 +550,8 @@ init_chown_advanced (void)
|
||||
DLG_CENTER);
|
||||
|
||||
#define XTRACT(i) BY+chown_advanced_but[i].y, BX+chown_advanced_but[i].x, \
|
||||
chown_advanced_but[i].ret_cmd, chown_advanced_but[i].flags, _(chown_advanced_but[i].text), \
|
||||
0, 0, NULL
|
||||
chown_advanced_but[i].ret_cmd, chown_advanced_but[i].flags, \
|
||||
(chown_advanced_but[i].text), 0, 0
|
||||
|
||||
for (i = 0; i < BUTTONS - 5; i++)
|
||||
if (!single_set || i < 2)
|
||||
|
30
src/boxes.c
30
src/boxes.c
@ -184,11 +184,11 @@ display_init (int radio_sel, char *init_text, int _check_status,
|
||||
|
||||
add_widget (dd,
|
||||
button_new (4, button_start, B_CANCEL, NORMAL_BUTTON,
|
||||
cancel_button, 0, 0, "cancel-button"));
|
||||
cancel_button, 0, 0));
|
||||
|
||||
add_widget (dd,
|
||||
button_new (3, button_start, B_ENTER, DEFPUSH_BUTTON,
|
||||
ok_button, 0, 0, "ok-button"));
|
||||
ok_button, 0, 0));
|
||||
|
||||
status =
|
||||
input_new (10, 9, INPUT_COLOR, DISPLAY_X - 14, _status[radio_sel],
|
||||
@ -197,7 +197,7 @@ display_init (int radio_sel, char *init_text, int _check_status,
|
||||
input_set_point (status, 0);
|
||||
|
||||
check_status =
|
||||
check_new (9, 5, _check_status, user_mini_status, "mini-status");
|
||||
check_new (9, 5, _check_status, user_mini_status);
|
||||
add_widget (dd, check_status);
|
||||
|
||||
user =
|
||||
@ -206,7 +206,7 @@ display_init (int radio_sel, char *init_text, int _check_status,
|
||||
add_widget (dd, user);
|
||||
input_set_point (user, 0);
|
||||
|
||||
my_radio = radio_new (3, 5, LIST_TYPES, displays, 1, "radio");
|
||||
my_radio = radio_new (3, 5, LIST_TYPES, displays, 1);
|
||||
my_radio->sel = my_radio->pos = current_mode;
|
||||
add_widget (dd, my_radio);
|
||||
}
|
||||
@ -330,18 +330,18 @@ sort_box (sortfn *sort_fn, int *reverse, int *case_sensitive)
|
||||
|
||||
add_widget (dd,
|
||||
button_new (10, button_pos, B_CANCEL, NORMAL_BUTTON, cancel_button,
|
||||
0, 0, "cancel-button"));
|
||||
0, 0));
|
||||
|
||||
add_widget (dd,
|
||||
button_new (9, button_pos, B_ENTER, DEFPUSH_BUTTON, ok_button,
|
||||
0, 0, "ok-button"));
|
||||
0, 0));
|
||||
|
||||
case_sense = check_new (4, check_pos, *case_sensitive, case_label, "case-check");
|
||||
case_sense = check_new (4, check_pos, *case_sensitive, case_label);
|
||||
add_widget (dd, case_sense);
|
||||
c = check_new (3, check_pos, *reverse, reverse_label, "reverse-check");
|
||||
c = check_new (3, check_pos, *reverse, reverse_label);
|
||||
add_widget (dd, c);
|
||||
|
||||
my_radio = radio_new (3, 3, SORT_TYPES, sort_orders_names, 1, "radio-1");
|
||||
my_radio = radio_new (3, 3, SORT_TYPES, sort_orders_names, 1);
|
||||
my_radio->sel = my_radio->pos = current_mode;
|
||||
|
||||
add_widget (dd, my_radio);
|
||||
@ -929,14 +929,13 @@ static struct
|
||||
int xpos;
|
||||
int value;
|
||||
int (*callback)(int, void *);
|
||||
char* tkname;
|
||||
}
|
||||
job_buttons [] =
|
||||
{
|
||||
{N_("&Stop"), 3, B_STOP, task_cb, "button-stop"},
|
||||
{N_("&Resume"), 12, B_RESUME, task_cb, "button-cont"},
|
||||
{N_("&Kill"), 23, B_KILL, task_cb, "button-kill"},
|
||||
{N_("&OK"), 35, B_CANCEL, NULL, "button-ok"},
|
||||
{N_("&Stop"), 3, B_STOP, task_cb},
|
||||
{N_("&Resume"), 12, B_RESUME, task_cb},
|
||||
{N_("&Kill"), 23, B_KILL, task_cb},
|
||||
{N_("&OK"), 35, B_CANCEL, NULL }
|
||||
};
|
||||
|
||||
void
|
||||
@ -984,8 +983,7 @@ jobs_cmd (void)
|
||||
add_widget (jobs_dlg, button_new (JOBS_Y-4,
|
||||
job_buttons [i].xpos, job_buttons [i].value,
|
||||
NORMAL_BUTTON, job_buttons [i].name,
|
||||
job_buttons [i].callback, 0,
|
||||
job_buttons [i].tkname));
|
||||
job_buttons [i].callback, 0));
|
||||
}
|
||||
|
||||
/* Insert all of task information in the list */
|
||||
|
12
src/chmod.c
12
src/chmod.c
@ -205,13 +205,13 @@ init_chmod (void)
|
||||
BX + chmod_but[i].x,
|
||||
chmod_but[i].ret_cmd,
|
||||
chmod_but[i].flags,
|
||||
_(chmod_but[i].text), 0, 0, NULL));
|
||||
_(chmod_but[i].text), 0, 0));
|
||||
}
|
||||
|
||||
for (i = 0; i < PERMISSIONS; i++) {
|
||||
check_perm[i].check =
|
||||
check_new (PY + (PERMISSIONS - i), PX + 2, 0,
|
||||
_(check_perm[i].text), NULL);
|
||||
_(check_perm[i].text));
|
||||
add_widget (ch_dlg, check_perm[i].check);
|
||||
}
|
||||
|
||||
@ -300,13 +300,13 @@ void chmod_cmd (void)
|
||||
|
||||
/* Set the labels */
|
||||
c_fname = name_trunc (fname, 21);
|
||||
add_widget (ch_dlg, label_new (FY+2, FX+2, c_fname, NULL));
|
||||
add_widget (ch_dlg, label_new (FY+2, FX+2, c_fname));
|
||||
c_fown = name_trunc (get_owner (sf_stat.st_uid), 21);
|
||||
add_widget (ch_dlg, label_new (FY+6, FX+2, c_fown, NULL));
|
||||
add_widget (ch_dlg, label_new (FY+6, FX+2, c_fown));
|
||||
c_fgrp = name_trunc (get_group (sf_stat.st_gid), 21);
|
||||
add_widget (ch_dlg, label_new (FY+8, FX+2, c_fgrp, NULL));
|
||||
add_widget (ch_dlg, label_new (FY+8, FX+2, c_fgrp));
|
||||
g_snprintf (buffer, sizeof (buffer), "%o", c_stat);
|
||||
statl = label_new (FY+4, FX+2, buffer, NULL);
|
||||
statl = label_new (FY+4, FX+2, buffer);
|
||||
add_widget (ch_dlg, statl);
|
||||
|
||||
run_dlg (ch_dlg); /* retrieve an action */
|
||||
|
@ -167,12 +167,12 @@ init_chown (void)
|
||||
add_widget (ch_dlg,
|
||||
button_new (BY + chown_but[i].y, BX + chown_but[i].x,
|
||||
chown_but[i].ret_cmd, chown_but[i].flags,
|
||||
_(chown_but[i].text), 0, 0, NULL));
|
||||
_(chown_but[i].text), 0, 0));
|
||||
|
||||
/* Add the widgets for the file information */
|
||||
for (i = 0; i < LABELS; i++) {
|
||||
chown_label[i].l =
|
||||
label_new (chown_label[i].y, chown_label[i].x, "", NULL);
|
||||
label_new (chown_label[i].y, chown_label[i].x, "");
|
||||
add_widget (ch_dlg, chown_label[i].l);
|
||||
}
|
||||
|
||||
|
@ -221,40 +221,40 @@ file_op_context_create_ui (FileOpContext *ctx, FileOperation op,
|
||||
|
||||
add_widget (ui->op_dlg,
|
||||
button_new (BY - minus, WX - 19 + eta_offset, FILE_ABORT,
|
||||
NORMAL_BUTTON, _("&Abort"), 0, 0, "abort"));
|
||||
NORMAL_BUTTON, _("&Abort"), 0, 0));
|
||||
add_widget (ui->op_dlg,
|
||||
button_new (BY - minus, 14 + eta_offset, FILE_SKIP,
|
||||
NORMAL_BUTTON, _("&Skip"), 0, 0, "skip"));
|
||||
NORMAL_BUTTON, _("&Skip"), 0, 0));
|
||||
|
||||
add_widget (ui->op_dlg, ui->progress_gauge[2] =
|
||||
gauge_new (7, FCOPY_GAUGE_X, 0, 100, 0, "g-1"));
|
||||
gauge_new (7, FCOPY_GAUGE_X, 0, 100, 0));
|
||||
add_widget (ui->op_dlg, ui->progress_label[2] =
|
||||
label_new (7, FCOPY_LABEL_X, fifteen, "l-1"));
|
||||
label_new (7, FCOPY_LABEL_X, fifteen));
|
||||
add_widget (ui->op_dlg, ui->bps_label =
|
||||
label_new (7, WX, "", "bps-label"));
|
||||
label_new (7, WX, ""));
|
||||
|
||||
add_widget (ui->op_dlg, ui->progress_gauge[1] =
|
||||
gauge_new (8, FCOPY_GAUGE_X, 0, 100, 0, "g-2"));
|
||||
gauge_new (8, FCOPY_GAUGE_X, 0, 100, 0));
|
||||
add_widget (ui->op_dlg, ui->progress_label[1] =
|
||||
label_new (8, FCOPY_LABEL_X, fifteen, "l-2"));
|
||||
label_new (8, FCOPY_LABEL_X, fifteen));
|
||||
add_widget (ui->op_dlg, ui->stalled_label =
|
||||
label_new (8, WX, "", "stalled"));
|
||||
label_new (8, WX, ""));
|
||||
|
||||
add_widget (ui->op_dlg, ui->progress_gauge[0] =
|
||||
gauge_new (6, FCOPY_GAUGE_X, 0, 100, 0, "g-3"));
|
||||
gauge_new (6, FCOPY_GAUGE_X, 0, 100, 0));
|
||||
add_widget (ui->op_dlg, ui->progress_label[0] =
|
||||
label_new (6, FCOPY_LABEL_X, fifteen, "l-3"));
|
||||
label_new (6, FCOPY_LABEL_X, fifteen));
|
||||
add_widget (ui->op_dlg, ui->eta_label =
|
||||
label_new (6, WX, "", "eta_label"));
|
||||
label_new (6, WX, ""));
|
||||
|
||||
add_widget (ui->op_dlg, ui->file_string[1] =
|
||||
label_new (4, FCOPY_GAUGE_X, sixty, "fs-l-1"));
|
||||
label_new (4, FCOPY_GAUGE_X, sixty));
|
||||
add_widget (ui->op_dlg, ui->file_label[1] =
|
||||
label_new (4, FCOPY_LABEL_X, fifteen, "fs-l-2"));
|
||||
label_new (4, FCOPY_LABEL_X, fifteen));
|
||||
add_widget (ui->op_dlg, ui->file_string[0] =
|
||||
label_new (3, FCOPY_GAUGE_X, sixty, "fs-x-1"));
|
||||
label_new (3, FCOPY_GAUGE_X, sixty));
|
||||
add_widget (ui->op_dlg, ui->file_label[0] =
|
||||
label_new (3, FCOPY_LABEL_X, fifteen, "fs-x-2"));
|
||||
label_new (3, FCOPY_LABEL_X, fifteen));
|
||||
|
||||
/* We will manage the dialog without any help, that's why
|
||||
we have to call init_dlg */
|
||||
@ -528,34 +528,33 @@ static struct {
|
||||
char *text;
|
||||
int ypos, xpos;
|
||||
int value; /* 0 for labels */
|
||||
char *tkname;
|
||||
} rd_widgets[] = {
|
||||
{
|
||||
N_("Target file \"%s\" already exists!"), 3, 4, 0, "target-e"}, {
|
||||
N_("&Abort"), BY + 3, 25, REPLACE_ABORT, "abort"}, {
|
||||
N_("If &size differs"), BY + 1, 28, REPLACE_SIZE, "if-size"}, {
|
||||
N_("Non&e"), BY, 47, REPLACE_NEVER, "none"}, {
|
||||
N_("&Update"), BY, 36, REPLACE_UPDATE, "update"}, {
|
||||
N_("A&ll"), BY, 28, REPLACE_ALWAYS, "all"}, {
|
||||
N_("Overwrite all targets?"), BY, 4, 0, "over-label"}, {
|
||||
N_("&Reget"), BY - 1, 28, REPLACE_REGET, "reget"}, {
|
||||
N_("A&ppend"), BY - 2, 45, REPLACE_APPEND, "append"}, {
|
||||
N_("&No"), BY - 2, 37, REPLACE_NO, "no"}, {
|
||||
N_("&Yes"), BY - 2, 28, REPLACE_YES, "yes"}, {
|
||||
N_("Overwrite this target?"), BY - 2, 4, 0, "overlab"}, {
|
||||
N_("Target date: %s, size %d"), 6, 4, 0, "target-date"}, {
|
||||
N_("Source date: %s, size %d"), 5, 4, 0, "source-date"}
|
||||
N_("Target file \"%s\" already exists!"), 3, 4, 0}, {
|
||||
N_("&Abort"), BY + 3, 25, REPLACE_ABORT}, {
|
||||
N_("If &size differs"), BY + 1, 28, REPLACE_SIZE}, {
|
||||
N_("Non&e"), BY, 47, REPLACE_NEVER}, {
|
||||
N_("&Update"), BY, 36, REPLACE_UPDATE}, {
|
||||
N_("A&ll"), BY, 28, REPLACE_ALWAYS}, {
|
||||
N_("Overwrite all targets?"), BY, 4, 0}, {
|
||||
N_("&Reget"), BY - 1, 28, REPLACE_REGET}, {
|
||||
N_("A&ppend"), BY - 2, 45, REPLACE_APPEND}, {
|
||||
N_("&No"), BY - 2, 37, REPLACE_NO}, {
|
||||
N_("&Yes"), BY - 2, 28, REPLACE_YES}, {
|
||||
N_("Overwrite this target?"), BY - 2, 4, 0}, {
|
||||
N_("Target date: %s, size %d"), 6, 4, 0}, {
|
||||
N_("Source date: %s, size %d"), 5, 4, 0}
|
||||
};
|
||||
|
||||
#define ADD_RD_BUTTON(i)\
|
||||
add_widget (ui->replace_dlg,\
|
||||
button_new (rd_widgets [i].ypos, rd_widgets [i].xpos, rd_widgets [i].value,\
|
||||
NORMAL_BUTTON, rd_widgets [i].text, 0, 0, rd_widgets [i].tkname))
|
||||
NORMAL_BUTTON, rd_widgets [i].text, 0, 0))
|
||||
|
||||
#define ADD_RD_LABEL(ui,i,p1,p2)\
|
||||
g_snprintf (buffer, sizeof (buffer), rd_widgets [i].text, p1, p2);\
|
||||
add_widget (ui->replace_dlg,\
|
||||
label_new (rd_widgets [i].ypos, rd_widgets [i].xpos, buffer, rd_widgets [i].tkname))
|
||||
label_new (rd_widgets [i].ypos, rd_widgets [i].xpos, buffer))
|
||||
|
||||
static void
|
||||
init_replace (FileOpContext *ctx, enum OperationMode mode)
|
||||
|
43
src/find.c
43
src/find.c
@ -226,17 +226,15 @@ find_parameters (char **start_dir, char **pattern, char **content)
|
||||
DLG_CENTER);
|
||||
|
||||
add_widget (find_dlg,
|
||||
button_new (11, b2, B_CANCEL, NORMAL_BUTTON, buts[2], 0, 0,
|
||||
"cancel"));
|
||||
button_new (11, b2, B_CANCEL, NORMAL_BUTTON, buts[2], 0,
|
||||
0));
|
||||
add_widget (find_dlg,
|
||||
button_new (11, b1, B_TREE, NORMAL_BUTTON, buts[1], 0, 0,
|
||||
"tree"));
|
||||
button_new (11, b1, B_TREE, NORMAL_BUTTON, buts[1], 0, 0));
|
||||
add_widget (find_dlg,
|
||||
button_new (11, b0, B_ENTER, DEFPUSH_BUTTON, buts[0], 0, 0,
|
||||
"ok"));
|
||||
button_new (11, b0, B_ENTER, DEFPUSH_BUTTON, buts[0], 0,
|
||||
0));
|
||||
|
||||
case_sense =
|
||||
check_new (9, 3, case_sensitive, case_label, "find-case-check");
|
||||
case_sense = check_new (9, 3, case_sensitive, case_label);
|
||||
add_widget (find_dlg, case_sense);
|
||||
|
||||
in_with =
|
||||
@ -251,9 +249,9 @@ find_parameters (char **start_dir, char **pattern, char **content)
|
||||
input_new (3, istart, INPUT_COLOR, ilen, in_start_dir, "start");
|
||||
add_widget (find_dlg, in_start);
|
||||
|
||||
add_widget (find_dlg, label_new (7, 3, labs[2], "label-cont"));
|
||||
add_widget (find_dlg, label_new (5, 3, labs[1], "label-file"));
|
||||
add_widget (find_dlg, label_new (3, 3, labs[0], "label-start"));
|
||||
add_widget (find_dlg, label_new (7, 3, labs[2]));
|
||||
add_widget (find_dlg, label_new (5, 3, labs[1]));
|
||||
add_widget (find_dlg, label_new (3, 3, labs[0]));
|
||||
|
||||
run_dlg (find_dlg);
|
||||
|
||||
@ -808,36 +806,29 @@ setup_gui (void)
|
||||
|
||||
add_widget (find_dlg,
|
||||
button_new (FIND2_Y - 3, fbuts[7].x, B_VIEW, NORMAL_BUTTON,
|
||||
fbuts[7].text, find_do_edit_file, find_dlg,
|
||||
"button-edit"));
|
||||
fbuts[7].text, find_do_edit_file, find_dlg));
|
||||
add_widget (find_dlg,
|
||||
button_new (FIND2_Y - 3, fbuts[6].x, B_VIEW, NORMAL_BUTTON,
|
||||
fbuts[6].text, find_do_view_file, find_dlg,
|
||||
"button-view"));
|
||||
fbuts[6].text, find_do_view_file, find_dlg));
|
||||
add_widget (find_dlg,
|
||||
button_new (FIND2_Y - 3, fbuts[5].x, B_PANELIZE,
|
||||
NORMAL_BUTTON, fbuts[5].text, 0, 0,
|
||||
"button-panelize"));
|
||||
NORMAL_BUTTON, fbuts[5].text, 0, 0));
|
||||
|
||||
add_widget (find_dlg,
|
||||
button_new (FIND2_Y - 4, fbuts[4].x, B_CANCEL,
|
||||
NORMAL_BUTTON, fbuts[4].text, 0, 0,
|
||||
"button-quit"));
|
||||
NORMAL_BUTTON, fbuts[4].text, 0, 0));
|
||||
stop_button =
|
||||
button_new (FIND2_Y - 4, fbuts[0].x, B_STOP, NORMAL_BUTTON,
|
||||
fbuts[0].text, start_stop, find_dlg, "start-stop");
|
||||
fbuts[0].text, start_stop, find_dlg);
|
||||
add_widget (find_dlg, stop_button);
|
||||
add_widget (find_dlg,
|
||||
button_new (FIND2_Y - 4, fbuts[3].x, B_AGAIN,
|
||||
NORMAL_BUTTON, fbuts[3].text, 0, 0,
|
||||
"button-again"));
|
||||
NORMAL_BUTTON, fbuts[3].text, 0, 0));
|
||||
add_widget (find_dlg,
|
||||
button_new (FIND2_Y - 4, fbuts[2].x, B_ENTER,
|
||||
DEFPUSH_BUTTON, fbuts[2].text, 0, 0,
|
||||
"button-chdir"));
|
||||
DEFPUSH_BUTTON, fbuts[2].text, 0, 0));
|
||||
|
||||
status_label =
|
||||
label_new (FIND2_Y - 6, 4, _("Searching"), "label-search");
|
||||
status_label = label_new (FIND2_Y - 6, 4, _("Searching"));
|
||||
add_widget (find_dlg, status_label);
|
||||
|
||||
find_list =
|
||||
|
@ -110,23 +110,22 @@ static struct {
|
||||
static struct _hotlist_but {
|
||||
int ret_cmd, flags, y, x;
|
||||
char *text;
|
||||
char *tkname;
|
||||
int type;
|
||||
} hotlist_but[] = {
|
||||
{ B_MOVE, NORMAL_BUTTON, 1, 42, N_("&Move"), "move", LIST_HOTLIST},
|
||||
{ B_REMOVE, NORMAL_BUTTON, 1, 30, N_("&Remove"), "r", LIST_HOTLIST},
|
||||
{ B_APPEND, NORMAL_BUTTON, 1, 15, N_("&Append"), "e", LIST_MOVELIST},
|
||||
{ B_INSERT, NORMAL_BUTTON, 1, 0, N_("&Insert"), "g", LIST_MOVELIST},
|
||||
{ B_NEW_ENTRY, NORMAL_BUTTON, 1, 15, N_("New &Entry"), "e", LIST_HOTLIST},
|
||||
{ B_NEW_GROUP, NORMAL_BUTTON, 1, 0, N_("New &Group"), "g", LIST_HOTLIST},
|
||||
{ B_CANCEL, NORMAL_BUTTON, 0, 53, N_("&Cancel"), "cc", LIST_HOTLIST|LIST_VFSLIST|LIST_MOVELIST},
|
||||
{ B_UP_GROUP, NORMAL_BUTTON, 0, 42, N_("&Up"), "up", LIST_HOTLIST|LIST_MOVELIST},
|
||||
{ B_ADD_CURRENT, NORMAL_BUTTON, 0, 20, N_("&Add current"),"ad", LIST_HOTLIST},
|
||||
{ B_MOVE, NORMAL_BUTTON, 1, 42, N_("&Move"), LIST_HOTLIST},
|
||||
{ B_REMOVE, NORMAL_BUTTON, 1, 30, N_("&Remove"), LIST_HOTLIST},
|
||||
{ B_APPEND, NORMAL_BUTTON, 1, 15, N_("&Append"), LIST_MOVELIST},
|
||||
{ B_INSERT, NORMAL_BUTTON, 1, 0, N_("&Insert"), LIST_MOVELIST},
|
||||
{ B_NEW_ENTRY, NORMAL_BUTTON, 1, 15, N_("New &Entry"), LIST_HOTLIST},
|
||||
{ B_NEW_GROUP, NORMAL_BUTTON, 1, 0, N_("New &Group"), LIST_HOTLIST},
|
||||
{ B_CANCEL, NORMAL_BUTTON, 0, 53, N_("&Cancel"), LIST_HOTLIST|LIST_VFSLIST|LIST_MOVELIST},
|
||||
{ B_UP_GROUP, NORMAL_BUTTON, 0, 42, N_("&Up"), LIST_HOTLIST|LIST_MOVELIST},
|
||||
{ B_ADD_CURRENT, NORMAL_BUTTON, 0, 20, N_("&Add current"), LIST_HOTLIST},
|
||||
#ifdef USE_VFS
|
||||
{ B_REFRESH_VFS, NORMAL_BUTTON, 0, 43, N_("&Refresh"), "r", LIST_VFSLIST},
|
||||
{ B_FREE_ALL_VFS, NORMAL_BUTTON, 0, 20, N_("Fr&ee VFSs now"), "f", LIST_VFSLIST},
|
||||
{ B_REFRESH_VFS, NORMAL_BUTTON, 0, 43, N_("&Refresh"), LIST_VFSLIST},
|
||||
{ B_FREE_ALL_VFS, NORMAL_BUTTON, 0, 20, N_("Fr&ee VFSs now"), LIST_VFSLIST},
|
||||
#endif
|
||||
{ B_ENTER, DEFPUSH_BUTTON, 0, 0, N_("Change &To"), "ct", LIST_HOTLIST|LIST_VFSLIST|LIST_MOVELIST},
|
||||
{ B_ENTER, DEFPUSH_BUTTON, 0, 0, N_("Change &To"), LIST_HOTLIST|LIST_VFSLIST|LIST_MOVELIST},
|
||||
};
|
||||
|
||||
/* Directory hotlist */
|
||||
@ -623,23 +622,22 @@ init_hotlist (int list_type)
|
||||
hotlist_but[i].ret_cmd,
|
||||
hotlist_but[i].flags,
|
||||
hotlist_but[i].text,
|
||||
hotlist_button_callback, 0,
|
||||
hotlist_but[i].tkname));
|
||||
hotlist_button_callback, 0));
|
||||
}
|
||||
|
||||
/* We add the labels.
|
||||
* pname will hold entry's pathname;
|
||||
* pname_group will hold name of current group
|
||||
*/
|
||||
pname = label_new (UY - 11 + LINES, UX + 2, "", "the-lab");
|
||||
pname = label_new (UY - 11 + LINES, UX + 2, "");
|
||||
add_widget (hotlist_dlg, pname);
|
||||
if (!hotlist_state.moving) {
|
||||
add_widget (hotlist_dlg,
|
||||
label_new (UY - 12 + LINES, UX + 1,
|
||||
_(" Directory path "), NULL));
|
||||
_(" Directory path ")));
|
||||
|
||||
/* This one holds the displayed pathname */
|
||||
pname_group = label_new (UY, UX + 1, _(" Directory label "), NULL);
|
||||
pname_group = label_new (UY, UX + 1, _(" Directory label "));
|
||||
add_widget (hotlist_dlg, pname_group);
|
||||
}
|
||||
/* get new listbox */
|
||||
@ -682,14 +680,13 @@ init_movelist (int list_type, struct hotlist *item)
|
||||
hotlist_but[i].ret_cmd,
|
||||
hotlist_but[i].flags,
|
||||
hotlist_but[i].text,
|
||||
hotlist_button_callback, 0,
|
||||
hotlist_but[i].tkname));
|
||||
hotlist_button_callback, 0));
|
||||
}
|
||||
|
||||
/* We add the labels. We are interested in the last one,
|
||||
* that one will hold the path name label
|
||||
*/
|
||||
movelist_group = label_new (UY, UX + 1, _(" Directory label "), NULL);
|
||||
movelist_group = label_new (UY, UX + 1, _(" Directory label "));
|
||||
add_widget (movelist_dlg, movelist_group);
|
||||
/* get new listbox */
|
||||
l_movelist =
|
||||
|
39
src/layout.c
39
src/layout.c
@ -159,18 +159,17 @@ static struct {
|
||||
char *text;
|
||||
int *variable;
|
||||
WCheck *widget;
|
||||
char *tkname;
|
||||
} check_options [] = {
|
||||
{ N_("&Xterm window title"), &xterm_title, 0, "t" },
|
||||
{ N_("h&Intbar visible"), &message_visible, 0, "v" },
|
||||
{ N_("&Keybar visible"), &keybar_visible, 0, "k" },
|
||||
{ N_("command &Prompt"), &command_prompt, 0, "p" },
|
||||
{ N_("show &Mini status"), &show_mini_info, 0, "m" },
|
||||
{ N_("menu&Bar visible"), &menubar_visible, 0, "me" },
|
||||
{ N_("&Equal split"), &equal_split, 0, "eq" },
|
||||
{ N_("pe&Rmissions"), &permission_mode, 0, "pr" },
|
||||
{ N_("&File types"), &filetype_mode, 0, "ft" },
|
||||
{ 0, 0, 0, 0 }
|
||||
{ N_("&Xterm window title"), &xterm_title, 0 },
|
||||
{ N_("h&Intbar visible"), &message_visible, 0 },
|
||||
{ N_("&Keybar visible"), &keybar_visible, 0 },
|
||||
{ N_("command &Prompt"), &command_prompt, 0 },
|
||||
{ N_("show &Mini status"), &show_mini_info, 0 },
|
||||
{ N_("menu&Bar visible"), &menubar_visible, 0 },
|
||||
{ N_("&Equal split"), &equal_split, 0 },
|
||||
{ N_("pe&Rmissions"), &permission_mode, 0 },
|
||||
{ N_("&File types"), &filetype_mode, 0 },
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
|
||||
static int first_width, second_width;
|
||||
@ -438,21 +437,21 @@ static void init_layout (void)
|
||||
"[Layout]", _("Layout"), DLG_CENTER);
|
||||
|
||||
add_widget (layout_dlg,
|
||||
button_new (BY, b3, B_CANCEL, NORMAL_BUTTON, cancel_button, 0, 0, "c"));
|
||||
button_new (BY, b3, B_CANCEL, NORMAL_BUTTON, cancel_button, 0, 0));
|
||||
add_widget (layout_dlg,
|
||||
button_new (BY, b2, B_EXIT, NORMAL_BUTTON, save_button, 0, 0, "s"));
|
||||
button_new (BY, b2, B_EXIT, NORMAL_BUTTON, save_button, 0, 0));
|
||||
add_widget (layout_dlg,
|
||||
button_new (BY, b1, B_ENTER, DEFPUSH_BUTTON, ok_button, 0, 0, "o"));
|
||||
button_new (BY, b1, B_ENTER, DEFPUSH_BUTTON, ok_button, 0, 0));
|
||||
if (console_flag){
|
||||
add_widget (layout_dlg,
|
||||
button_new (9, 12 + first_width, B_MINUS, NARROW_BUTTON, "&-",
|
||||
bminus_cback, 0, NULL));
|
||||
bminus_cback, 0));
|
||||
add_widget (layout_dlg,
|
||||
button_new (9, 7 + first_width, B_PLUS, NARROW_BUTTON, "&+",
|
||||
bplus_cback, 0, NULL));
|
||||
bplus_cback, 0));
|
||||
}
|
||||
|
||||
#define XTRACT(i) *check_options[i].variable, check_options[i].text, check_options[i].tkname
|
||||
#define XTRACT(i) *check_options[i].variable, check_options[i].text
|
||||
|
||||
for (i = 0; i < 6; i++){
|
||||
check_options [i].widget = check_new (8 - i, 7 + first_width, XTRACT(i));
|
||||
@ -471,9 +470,9 @@ static void init_layout (void)
|
||||
_keybar_visible = keybar_visible;
|
||||
_message_visible = message_visible;
|
||||
_xterm_title = xterm_title;
|
||||
bright_widget = button_new(6, 15, B_2RIGHT, NARROW_BUTTON, "&>", b2right_cback, 0, ">");
|
||||
bright_widget = button_new(6, 15, B_2RIGHT, NARROW_BUTTON, "&>", b2right_cback, 0);
|
||||
add_widget (layout_dlg, bright_widget);
|
||||
bleft_widget = button_new (6, 9, B_2LEFT, NARROW_BUTTON, "&<", b2left_cback, 0, "<");
|
||||
bleft_widget = button_new (6, 9, B_2LEFT, NARROW_BUTTON, "&<", b2left_cback, 0);
|
||||
add_widget (layout_dlg, bleft_widget);
|
||||
check_options [6].widget = check_new (5, 6, XTRACT(6));
|
||||
old_first_panel_size = -1;
|
||||
@ -483,7 +482,7 @@ static void init_layout (void)
|
||||
_first_panel_size = first_panel_size;
|
||||
_output_lines = output_lines;
|
||||
add_widget (layout_dlg, check_options [6].widget);
|
||||
radio_widget = radio_new (3, 6, 2, s_split_direction, 1, "r");
|
||||
radio_widget = radio_new (3, 6, 2, s_split_direction, 1);
|
||||
add_widget (layout_dlg, radio_widget);
|
||||
radio_widget->sel = horizontal_split;
|
||||
}
|
||||
|
85
src/learn.c
85
src/learn.c
@ -224,51 +224,51 @@ static int learn_callback (Dlg_head * h, int Par, int Msg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void init_learn (void)
|
||||
static void
|
||||
init_learn (void)
|
||||
{
|
||||
int x, y, i, j;
|
||||
key_code_name_t *key;
|
||||
char buffer [BUF_TINY];
|
||||
char buffer[BUF_TINY];
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
static int i18n_flag = 0;
|
||||
if (!i18n_flag)
|
||||
{
|
||||
char* cp;
|
||||
|
||||
learn_but [0].text = _(learn_but [0].text);
|
||||
learn_but [0].x = 78 / 2 + 4;
|
||||
static int i18n_flag = 0;
|
||||
if (!i18n_flag) {
|
||||
char *cp;
|
||||
|
||||
learn_but [1].text = _(learn_but [1].text);
|
||||
learn_but [1].x = 78 / 2 - (strlen (learn_but [1].text) + 9);
|
||||
learn_but[0].text = _(learn_but[0].text);
|
||||
learn_but[0].x = 78 / 2 + 4;
|
||||
|
||||
for (i = 0; i < BUTTONS; i++)
|
||||
{
|
||||
cp = strchr(learn_but [i].text, '&');
|
||||
if (cp != NULL && *++cp != '\0')
|
||||
learn_but [i].hotkey = toupper(*cp);
|
||||
}
|
||||
learn_but[1].text = _(learn_but[1].text);
|
||||
learn_but[1].x = 78 / 2 - (strlen (learn_but[1].text) + 9);
|
||||
|
||||
learn_title = _(learn_title);
|
||||
i18n_flag = 1;
|
||||
for (i = 0; i < BUTTONS; i++) {
|
||||
cp = strchr (learn_but[i].text, '&');
|
||||
if (cp != NULL && *++cp != '\0')
|
||||
learn_but[i].hotkey = toupper (*cp);
|
||||
}
|
||||
#endif /* ENABLE_NLS */
|
||||
|
||||
learn_title = _(learn_title);
|
||||
i18n_flag = 1;
|
||||
}
|
||||
#endif /* ENABLE_NLS */
|
||||
|
||||
do_refresh ();
|
||||
|
||||
learn_dlg = create_dlg (0, 0, 23, 78, dialog_colors,
|
||||
learn_callback, "[Learn keys]",
|
||||
learn_title, DLG_CENTER);
|
||||
|
||||
#define XTRACT(i) BY+learn_but[i].y, learn_but[i].x, learn_but[i].ret_cmd, learn_but[i].flags, _(learn_but[i].text), 0, 0, NULL
|
||||
learn_dlg =
|
||||
create_dlg (0, 0, 23, 78, dialog_colors, learn_callback,
|
||||
"[Learn keys]", learn_title, DLG_CENTER);
|
||||
|
||||
for (i = 0; i < BUTTONS; i++)
|
||||
add_widget (learn_dlg, button_new (XTRACT (i)));
|
||||
|
||||
add_widget (learn_dlg,
|
||||
button_new (BY + learn_but[i].y, learn_but[i].x,
|
||||
learn_but[i].ret_cmd, learn_but[i].flags,
|
||||
_(learn_but[i].text), 0, 0));
|
||||
|
||||
x = UX;
|
||||
y = UY;
|
||||
for (key = key_name_conv_tab, j = 0; key->name != NULL &&
|
||||
strcmp (key->name, "kpleft"); key++, j++);
|
||||
for (key = key_name_conv_tab, j = 0;
|
||||
key->name != NULL && strcmp (key->name, "kpleft"); key++, j++);
|
||||
learnkeys = g_new (learnkey, j);
|
||||
x += ((j - 1) / ROWS) * COLSHIFT;
|
||||
y += (j - 1) % ROWS;
|
||||
@ -276,13 +276,14 @@ static void init_learn (void)
|
||||
learnok = 0;
|
||||
learnchanged = 0;
|
||||
for (i = j - 1, key = key_name_conv_tab + j - 1; i >= 0; i--, key--) {
|
||||
learnkeys [i].ok = 0;
|
||||
learnkeys [i].sequence = NULL;
|
||||
g_snprintf (buffer, sizeof (buffer), "%-16s", _(key->longname));
|
||||
add_widget (learn_dlg, learnkeys [i].button = (Widget *)
|
||||
button_new (y, x, B_USER + i, NARROW_BUTTON, buffer, learn_button, 0, NULL));
|
||||
add_widget (learn_dlg, learnkeys [i].label = (Widget *)
|
||||
label_new (y, x + 19, "", NULL));
|
||||
learnkeys[i].ok = 0;
|
||||
learnkeys[i].sequence = NULL;
|
||||
g_snprintf (buffer, sizeof (buffer), "%-16s", _(key->longname));
|
||||
add_widget (learn_dlg, learnkeys[i].button = (Widget *)
|
||||
button_new (y, x, B_USER + i, NARROW_BUTTON, buffer,
|
||||
learn_button, 0));
|
||||
add_widget (learn_dlg, learnkeys[i].label = (Widget *)
|
||||
label_new (y, x + 19, ""));
|
||||
if (i % 13)
|
||||
y--;
|
||||
else {
|
||||
@ -291,11 +292,17 @@ static void init_learn (void)
|
||||
}
|
||||
}
|
||||
add_widget (learn_dlg,
|
||||
label_new (UY+14, 5, _("Press all the keys mentioned here. After you have done it, check"), NULL));
|
||||
label_new (UY + 14, 5,
|
||||
_
|
||||
("Press all the keys mentioned here. After you have done it, check")));
|
||||
add_widget (learn_dlg,
|
||||
label_new (UY+15, 5, _("which keys are not marked with OK. Press space on the missing"), NULL));
|
||||
label_new (UY + 15, 5,
|
||||
_
|
||||
("which keys are not marked with OK. Press space on the missing")));
|
||||
add_widget (learn_dlg,
|
||||
label_new (UY+16, 5, _("key, or click with the mouse to define it. Move around with Tab."), NULL));
|
||||
label_new (UY + 16, 5,
|
||||
_
|
||||
("key, or click with the mouse to define it. Move around with Tab.")));
|
||||
}
|
||||
|
||||
static void learn_done (void)
|
||||
|
@ -1095,11 +1095,11 @@ create_panels (void)
|
||||
|
||||
/* Create the nice widgets */
|
||||
cmdline = command_new (0, 0, 0);
|
||||
the_prompt = label_new (0, 0, prompt, NULL);
|
||||
the_prompt = label_new (0, 0, prompt);
|
||||
the_prompt->transparent = 1;
|
||||
the_bar = buttonbar_new (keybar_visible);
|
||||
|
||||
the_hint = label_new (0, 0, 0, NULL);
|
||||
the_hint = label_new (0, 0, 0);
|
||||
the_hint->transparent = 1;
|
||||
the_hint->auto_adjust_cols = 0;
|
||||
the_hint->widget.cols = COLS;
|
||||
|
10
src/option.c
10
src/option.c
@ -202,17 +202,17 @@ init_configure (void)
|
||||
|
||||
add_widget (conf_dlg,
|
||||
button_new (BY, b3, B_CANCEL, NORMAL_BUTTON,
|
||||
cancel_button, 0, 0, "button-cancel"));
|
||||
cancel_button, 0, 0));
|
||||
|
||||
add_widget (conf_dlg,
|
||||
button_new (BY, b2, B_EXIT, NORMAL_BUTTON,
|
||||
save_button, 0, 0, "button-save"));
|
||||
save_button, 0, 0));
|
||||
|
||||
add_widget (conf_dlg,
|
||||
button_new (BY, b1, B_ENTER, DEFPUSH_BUTTON,
|
||||
ok_button, 0, 0, "button-ok"));
|
||||
ok_button, 0, 0));
|
||||
|
||||
#define XTRACT(i) *check_options[i].variable, check_options[i].text, check_options [i].tk
|
||||
#define XTRACT(i) *check_options[i].variable, check_options[i].text
|
||||
|
||||
/* Add checkboxes for "other options" */
|
||||
for (i = 0; i < OTHER_OPTIONS; i++) {
|
||||
@ -222,7 +222,7 @@ init_configure (void)
|
||||
}
|
||||
|
||||
pause_radio =
|
||||
radio_new (RY + 1, RX + 2, 3, pause_options, 1, "pause-radio");
|
||||
radio_new (RY + 1, RX + 2, 3, pause_options, 1);
|
||||
pause_radio->sel = pause_after_run;
|
||||
add_widget (conf_dlg, pause_radio);
|
||||
|
||||
|
@ -65,12 +65,11 @@ static WInput *pname;
|
||||
static struct {
|
||||
int ret_cmd, flags, y, x;
|
||||
char *text;
|
||||
char *tkname;
|
||||
} panelize_but [BUTTONS] = {
|
||||
{ B_CANCEL, NORMAL_BUTTON, 0, 53, N_("&Cancel"), "c"},
|
||||
{ B_ADD, NORMAL_BUTTON, 0, 28, N_("&Add new"), "a"},
|
||||
{ B_REMOVE, NORMAL_BUTTON, 0, 16, N_("&Remove"), "r"},
|
||||
{ B_ENTER, DEFPUSH_BUTTON, 0, 0, N_("Pane&lize"),"l"},
|
||||
{ B_CANCEL, NORMAL_BUTTON, 0, 53, N_("&Cancel") },
|
||||
{ B_ADD, NORMAL_BUTTON, 0, 28, N_("&Add new") },
|
||||
{ B_REMOVE, NORMAL_BUTTON, 0, 16, N_("&Remove") },
|
||||
{ B_ENTER, DEFPUSH_BUTTON, 0, 0, N_("Pane&lize") },
|
||||
};
|
||||
|
||||
static char *panelize_section = "Panelize";
|
||||
@ -119,69 +118,78 @@ static int l_call (void *data)
|
||||
return listbox_nothing;
|
||||
}
|
||||
|
||||
static void init_panelize (void)
|
||||
static void
|
||||
init_panelize (void)
|
||||
{
|
||||
int i, panelize_cols = COLS - 6;
|
||||
struct panelize *current = panelize;
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
static int i18n_flag = 0;
|
||||
static int maxlen = 0;
|
||||
|
||||
if (!i18n_flag)
|
||||
{
|
||||
i = sizeof(panelize_but) / sizeof(panelize_but[0]);
|
||||
while (i--)
|
||||
{
|
||||
panelize_but [i].text = _(panelize_but [i].text);
|
||||
maxlen += strlen (panelize_but [i].text) + 5;
|
||||
}
|
||||
maxlen += 10;
|
||||
static int i18n_flag = 0;
|
||||
static int maxlen = 0;
|
||||
|
||||
i18n_flag = 1;
|
||||
if (!i18n_flag) {
|
||||
i = sizeof (panelize_but) / sizeof (panelize_but[0]);
|
||||
while (i--) {
|
||||
panelize_but[i].text = _(panelize_but[i].text);
|
||||
maxlen += strlen (panelize_but[i].text) + 5;
|
||||
}
|
||||
panelize_cols = max(panelize_cols, maxlen);
|
||||
|
||||
panelize_but [2].x = panelize_but [3].x
|
||||
+ strlen (panelize_but [3].text) + 7;
|
||||
panelize_but [1].x = panelize_but [2].x
|
||||
+ strlen (panelize_but [2].text) + 5;
|
||||
panelize_but [0].x = panelize_cols
|
||||
- strlen (panelize_but[0].text) - 8 - BX;
|
||||
maxlen += 10;
|
||||
|
||||
i18n_flag = 1;
|
||||
}
|
||||
panelize_cols = max (panelize_cols, maxlen);
|
||||
|
||||
panelize_but[2].x =
|
||||
panelize_but[3].x + strlen (panelize_but[3].text) + 7;
|
||||
panelize_but[1].x =
|
||||
panelize_but[2].x + strlen (panelize_but[2].text) + 5;
|
||||
panelize_but[0].x =
|
||||
panelize_cols - strlen (panelize_but[0].text) - 8 - BX;
|
||||
|
||||
#endif /* ENABLE_NLS */
|
||||
|
||||
#endif /* ENABLE_NLS */
|
||||
|
||||
last_listitem = 0;
|
||||
|
||||
|
||||
do_refresh ();
|
||||
|
||||
panelize_dlg = create_dlg (0, 0, 22, panelize_cols, dialog_colors,
|
||||
panelize_callback, "[External panelize]",
|
||||
_("External panelize"), DLG_CENTER);
|
||||
|
||||
#define XTRACT(i) BY+panelize_but[i].y, BX+panelize_but[i].x, panelize_but[i].ret_cmd, panelize_but[i].flags, panelize_but[i].text, 0, 0, panelize_but[i].tkname
|
||||
panelize_dlg =
|
||||
create_dlg (0, 0, 22, panelize_cols, dialog_colors,
|
||||
panelize_callback, "[External panelize]",
|
||||
_("External panelize"), DLG_CENTER);
|
||||
|
||||
for (i = 0; i < BUTTONS; i++)
|
||||
add_widget(panelize_dlg, button_new (XTRACT (i)));
|
||||
add_widget (panelize_dlg,
|
||||
button_new (BY + panelize_but[i].y,
|
||||
BX + panelize_but[i].x,
|
||||
panelize_but[i].ret_cmd,
|
||||
panelize_but[i].flags,
|
||||
panelize_but[i].text, 0, 0));
|
||||
|
||||
pname = input_new (UY+14, UX, INPUT_COLOR, panelize_dlg->cols-10, "", "in");
|
||||
pname =
|
||||
input_new (UY + 14, UX, INPUT_COLOR, panelize_dlg->cols - 10, "",
|
||||
"in");
|
||||
add_widget (panelize_dlg, pname);
|
||||
|
||||
add_widget (panelize_dlg, label_new (UY+13, UX, _("Command"), "label-command"));
|
||||
add_widget (panelize_dlg,
|
||||
label_new (UY + 13, UX, _("Command")));
|
||||
|
||||
/* get new listbox */
|
||||
l_panelize = listbox_new (UY + 1, UX + 1, panelize_dlg->cols-12, 10, 0, l_call);
|
||||
l_panelize =
|
||||
listbox_new (UY + 1, UX + 1, panelize_dlg->cols - 12, 10, 0,
|
||||
l_call);
|
||||
|
||||
while (current){
|
||||
while (current) {
|
||||
listbox_add_item (l_panelize, 0, 0, current->label, current);
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
/* add listbox to the dialogs */
|
||||
add_widget (panelize_dlg, l_panelize);
|
||||
add_widget (panelize_dlg, l_panelize);
|
||||
|
||||
listbox_select_entry (l_panelize,
|
||||
listbox_search_text (l_panelize, _("Other command")));
|
||||
listbox_select_entry (l_panelize,
|
||||
listbox_search_text (l_panelize,
|
||||
_("Other command")));
|
||||
}
|
||||
|
||||
static void panelize_done (void)
|
||||
|
30
src/widget.c
30
src/widget.c
@ -204,7 +204,7 @@ button_scan_hotkey(WButton* b)
|
||||
|
||||
WButton *
|
||||
button_new (int y, int x, int action, int flags, char *text,
|
||||
int (*callback)(int, void *), void *callback_data, char *tkname)
|
||||
int (*callback)(int, void *), void *callback_data)
|
||||
{
|
||||
WButton *b = g_new (WButton, 1);
|
||||
|
||||
@ -348,7 +348,7 @@ radio_event (Gpm_Event *event, WRadio *r)
|
||||
}
|
||||
|
||||
WRadio *
|
||||
radio_new (int y, int x, int count, char **texts, int use_hotkey, char *tkname)
|
||||
radio_new (int y, int x, int count, char **texts, int use_hotkey)
|
||||
{
|
||||
WRadio *r = g_new (WRadio, 1);
|
||||
int i, max, m;
|
||||
@ -450,7 +450,7 @@ check_destroy (WCheck *c)
|
||||
}
|
||||
|
||||
WCheck *
|
||||
check_new (int y, int x, int state, char *text, char *tkname)
|
||||
check_new (int y, int x, int state, char *text)
|
||||
{
|
||||
WCheck *c = g_new (WCheck, 1);
|
||||
char *s, *t;
|
||||
@ -562,7 +562,7 @@ label_destroy (WLabel *l)
|
||||
}
|
||||
|
||||
WLabel *
|
||||
label_new (int y, int x, const char *text, char *tkname)
|
||||
label_new (int y, int x, const char *text)
|
||||
{
|
||||
WLabel *l;
|
||||
int width;
|
||||
@ -662,7 +662,7 @@ gauge_destroy (WGauge *g)
|
||||
}
|
||||
|
||||
WGauge *
|
||||
gauge_new (int y, int x, int shown, int max, int current, char *tkname)
|
||||
gauge_new (int y, int x, int shown, int max, int current)
|
||||
{
|
||||
WGauge *g = g_new (WGauge, 1);
|
||||
|
||||
@ -1599,28 +1599,28 @@ input_event (Gpm_Event * event, WInput * in)
|
||||
}
|
||||
|
||||
WInput *
|
||||
input_new (int y, int x, int color, int len, const char *def_text, char *tkname)
|
||||
input_new (int y, int x, int color, int len, const char *def_text,
|
||||
char *histname)
|
||||
{
|
||||
WInput *in = g_new (WInput, 1);
|
||||
int initial_buffer_len;
|
||||
|
||||
init_widget (&in->widget, y, x, 1, len,
|
||||
(callback_fn) input_callback,
|
||||
(destroy_fn) input_destroy, (mouse_h) input_event);
|
||||
init_widget (&in->widget, y, x, 1, len, (callback_fn) input_callback,
|
||||
(destroy_fn) input_destroy, (mouse_h) input_event);
|
||||
|
||||
/* history setup */
|
||||
in->history = NULL;
|
||||
in->history_name = 0;
|
||||
if (tkname) {
|
||||
if (*tkname) {
|
||||
in->history_name = g_strdup (tkname);
|
||||
in->history = history_get (tkname);
|
||||
if (histname) {
|
||||
if (*histname) {
|
||||
in->history_name = g_strdup (histname);
|
||||
in->history = history_get (histname);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!def_text)
|
||||
def_text = "";
|
||||
|
||||
|
||||
if (def_text == INPUT_LAST_TEXT) {
|
||||
def_text = "";
|
||||
if (in->history)
|
||||
|
12
src/widget.h
12
src/widget.h
@ -135,12 +135,12 @@ typedef struct {
|
||||
|
||||
/* Constructors */
|
||||
WButton *button_new (int y, int x, int action, int flags, char *text,
|
||||
int (*callback)(int, void *), void *extra, char *tkname);
|
||||
WRadio *radio_new (int y, int x, int count, char **text, int use_hotkey, char *tkname);
|
||||
WCheck *check_new (int y, int x, int state, char *text, char *tkname);
|
||||
WInput *input_new (int y, int x, int color, int len, const char *text, char *tkname);
|
||||
WLabel *label_new (int y, int x, const char *text, char *tkname);
|
||||
WGauge *gauge_new (int y, int x, int shown, int max, int current, char *tkname);
|
||||
int (*callback)(int, void *), void *extra);
|
||||
WRadio *radio_new (int y, int x, int count, char **text, int use_hotkey);
|
||||
WCheck *check_new (int y, int x, int state, char *text);
|
||||
WInput *input_new (int y, int x, int color, int len, const char *text, char *histname);
|
||||
WLabel *label_new (int y, int x, const char *text);
|
||||
WGauge *gauge_new (int y, int x, int shown, int max, int current);
|
||||
WListbox *listbox_new (int x, int y, int width, int height, int action, lcback callback);
|
||||
|
||||
/* Input lines */
|
||||
|
26
src/wtools.c
26
src/wtools.c
@ -80,7 +80,7 @@ Listbox *create_listbox_window (int cols, int lines, char *title, char *help)
|
||||
|
||||
add_widget (listbox->dlg,
|
||||
button_new (lines+3, (cols/2 + 2) - len/2,
|
||||
B_CANCEL, NORMAL_BUTTON, cancel_string, 0, 0, "c"));
|
||||
B_CANCEL, NORMAL_BUTTON, cancel_string, 0, 0));
|
||||
add_widget (listbox->dlg, listbox->list);
|
||||
common_dialog_repaint (listbox->dlg);
|
||||
return listbox;
|
||||
@ -164,14 +164,14 @@ int query_dialog (char *header, char *text, int flags, int count, ...)
|
||||
xpos--;
|
||||
add_widget (query_dlg, button_new
|
||||
(lines-3, cols, B_USER+i, NORMAL_BUTTON, cur_name,
|
||||
0, 0, NULL));
|
||||
0, 0));
|
||||
cols += xpos;
|
||||
if (i == sel_pos)
|
||||
query_dlg->initfocus = query_dlg->current;
|
||||
}
|
||||
va_end (ap);
|
||||
|
||||
add_widget (query_dlg, label_new (2, 3, text, NULL));
|
||||
add_widget (query_dlg, label_new (2, 3, text));
|
||||
|
||||
/* run dialog and make result */
|
||||
run_dlg (query_dlg);
|
||||
@ -185,8 +185,8 @@ int query_dialog (char *header, char *text, int flags, int count, ...)
|
||||
/* free used memory */
|
||||
destroy_dlg (query_dlg);
|
||||
} else {
|
||||
add_widget (query_dlg, label_new (2, 3, text, NULL));
|
||||
add_widget (query_dlg, button_new(0, 0, 0, HIDDEN_BUTTON, "-", 0, 0, NULL));
|
||||
add_widget (query_dlg, label_new (2, 3, text));
|
||||
add_widget (query_dlg, button_new(0, 0, 0, HIDDEN_BUTTON, "-", 0, 0));
|
||||
last_query_dlg = query_dlg;
|
||||
}
|
||||
sel_pos = 0;
|
||||
@ -302,13 +302,11 @@ quick_dialog_skip (QuickDialog *qd, int nskip)
|
||||
switch (qw->widget_type) {
|
||||
case quick_checkbox:
|
||||
widget =
|
||||
check_new (ypos, xpos, *qw->result, I18N (qw->text),
|
||||
qw->tkname);
|
||||
check_new (ypos, xpos, *qw->result, I18N (qw->text));
|
||||
break;
|
||||
|
||||
case quick_radio:
|
||||
r = radio_new (ypos, xpos, qw->hotkey_pos, qw->str_result, 1,
|
||||
qw->tkname);
|
||||
r = radio_new (ypos, xpos, qw->hotkey_pos, qw->str_result, 1);
|
||||
r->pos = r->sel = qw->value;
|
||||
widget = r;
|
||||
break;
|
||||
@ -318,13 +316,13 @@ 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, 0, qw->tkname);
|
||||
I18N (qw->text), 0, 0);
|
||||
break;
|
||||
|
||||
/* We use the hotkey pos as the field length */
|
||||
case quick_input:
|
||||
input = input_new (ypos, xpos, INPUT_COLOR,
|
||||
qw->hotkey_pos, qw->text, qw->tkname);
|
||||
qw->hotkey_pos, qw->text, qw->histname);
|
||||
input->is_password = qw->value == 1;
|
||||
input->point = 0;
|
||||
if (qw->value & 2)
|
||||
@ -333,7 +331,7 @@ quick_dialog_skip (QuickDialog *qd, int nskip)
|
||||
break;
|
||||
|
||||
case quick_label:
|
||||
widget = label_new (ypos, xpos, I18N (qw->text), qw->tkname);
|
||||
widget = label_new (ypos, xpos, I18N (qw->text));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -409,12 +407,12 @@ real_input_dialog_help (char *header, char *text, char *help,
|
||||
char *my_str;
|
||||
char tk_name[64] = "inp|";
|
||||
|
||||
/* we need a unique name for tkname because widget.c:history_tool()
|
||||
/* we need a unique name for histname because widget.c:history_tool()
|
||||
needs a unique name for each dialog - using the header is ideal */
|
||||
|
||||
strncpy (tk_name + 3, header, 60);
|
||||
tk_name[63] = '\0';
|
||||
quick_widgets[2].tkname = tk_name;
|
||||
quick_widgets[2].histname = tk_name;
|
||||
|
||||
len = max (strlen (header), msglen (text, &lines)) + 4;
|
||||
len = max (len, 64);
|
||||
|
@ -40,7 +40,7 @@ typedef struct {
|
||||
int value; /* Buttons only: value of button */
|
||||
int *result; /* Checkbutton: where to store result */
|
||||
char **str_result; /* Input lines: destination */
|
||||
char *tkname; /* Name of the widget used for Tk only */
|
||||
char *histname; /* Name of the section for saving history */
|
||||
} QuickWidget;
|
||||
|
||||
typedef struct {
|
||||
|
Loading…
Reference in New Issue
Block a user