Reimplemented WListbox to use GList.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
aac16c693d
Коммит
32c580ee87
10
src/achown.c
10
src/achown.c
@ -250,7 +250,7 @@ do_enter_key (Dlg_head * h, int f_pos)
|
||||
WListbox *chl_list;
|
||||
struct passwd *chl_pass;
|
||||
struct group *chl_grp;
|
||||
WLEntry *fe;
|
||||
int fe;
|
||||
int lxx, lyy, chl_end, b_pos;
|
||||
int is_owner;
|
||||
const char *title;
|
||||
@ -295,7 +295,6 @@ do_enter_key (Dlg_head * h, int f_pos)
|
||||
get_group (sf_stat->st_gid));
|
||||
}
|
||||
|
||||
if (fe)
|
||||
listbox_select_entry (chl_list, fe);
|
||||
|
||||
b_pos = chl_list->pos;
|
||||
@ -305,14 +304,17 @@ do_enter_key (Dlg_head * h, int f_pos)
|
||||
|
||||
if (b_pos != chl_list->pos) {
|
||||
int ok = 0;
|
||||
char *text;
|
||||
|
||||
listbox_get_current (chl_list, &text, NULL);
|
||||
if (is_owner) {
|
||||
chl_pass = getpwnam (chl_list->current->text);
|
||||
chl_pass = getpwnam (text);
|
||||
if (chl_pass) {
|
||||
ok = 1;
|
||||
sf_stat->st_uid = chl_pass->pw_uid;
|
||||
}
|
||||
} else {
|
||||
chl_grp = getgrnam (chl_list->current->text);
|
||||
chl_grp = getgrnam (text);
|
||||
if (chl_grp) {
|
||||
sf_stat->st_gid = chl_grp->gr_gid;
|
||||
ok = 1;
|
||||
|
@ -873,7 +873,7 @@ task_cb (int action)
|
||||
return 0;
|
||||
|
||||
/* Get this instance information */
|
||||
tl = (TaskList *) bg_list->current->data;
|
||||
listbox_get_current (bg_list, NULL, (void **) &tl);
|
||||
|
||||
# ifdef SIGTSTP
|
||||
if (action == B_STOP){
|
||||
|
36
src/chown.c
36
src/chown.c
@ -185,8 +185,8 @@ init_chown (void)
|
||||
l_group = listbox_new (GY + 1, GX + 1, 10, 19, NULL);
|
||||
|
||||
/* add fields for unknown names (numbers) */
|
||||
listbox_add_item (l_user, 0, 0, _("<Unknown user>"), NULL);
|
||||
listbox_add_item (l_group, 0, 0, _("<Unknown group>"), NULL);
|
||||
listbox_add_item (l_user, LISTBOX_APPEND_AT_END, 0, _("<Unknown user>"), NULL);
|
||||
listbox_add_item (l_group, LISTBOX_APPEND_AT_END, 0, _("<Unknown group>"), NULL);
|
||||
|
||||
/* get and put user names in the listbox */
|
||||
setpwent ();
|
||||
@ -270,13 +270,8 @@ chown_cmd (void)
|
||||
}
|
||||
|
||||
/* select in listboxes */
|
||||
fe = listbox_search_text (l_user, get_owner(sf_stat.st_uid));
|
||||
if (fe)
|
||||
listbox_select_entry (l_user, fe);
|
||||
|
||||
fe = listbox_search_text (l_group, get_group(sf_stat.st_gid));
|
||||
if (fe)
|
||||
listbox_select_entry (l_group, fe);
|
||||
listbox_select_entry (l_user, listbox_search_text (l_user, get_owner(sf_stat.st_uid)));
|
||||
listbox_select_entry (l_group, listbox_search_text (l_group, get_group(sf_stat.st_gid)));
|
||||
|
||||
chown_label (0, str_trunc (fname, 15));
|
||||
chown_label (1, str_trunc (get_owner (sf_stat.st_uid), 15));
|
||||
@ -285,9 +280,7 @@ chown_cmd (void)
|
||||
chown_label (3, buffer);
|
||||
chown_label (4, string_perm (sf_stat.st_mode));
|
||||
|
||||
run_dlg (ch_dlg);
|
||||
|
||||
switch (ch_dlg->ret_value) {
|
||||
switch (run_dlg (ch_dlg)) {
|
||||
case B_CANCEL:
|
||||
end_chown = 1;
|
||||
break;
|
||||
@ -295,8 +288,10 @@ chown_cmd (void)
|
||||
case B_SETUSR:
|
||||
{
|
||||
struct passwd *user;
|
||||
char *text;
|
||||
|
||||
user = getpwnam (l_user->current->text);
|
||||
listbox_get_current (l_user, &text, NULL);
|
||||
user = getpwnam (text);
|
||||
if (user){
|
||||
new_user = user->pw_uid;
|
||||
apply_chowns (new_user, new_group);
|
||||
@ -306,8 +301,10 @@ chown_cmd (void)
|
||||
case B_SETGRP:
|
||||
{
|
||||
struct group *grp;
|
||||
char *text;
|
||||
|
||||
grp = getgrnam (l_group->current->text);
|
||||
listbox_get_current (l_group, &text, NULL);
|
||||
grp = getgrnam (text);
|
||||
if (grp){
|
||||
new_group = grp->gr_gid;
|
||||
apply_chowns (new_user, new_group);
|
||||
@ -319,14 +316,17 @@ chown_cmd (void)
|
||||
{
|
||||
struct group *grp;
|
||||
struct passwd *user;
|
||||
char *text;
|
||||
|
||||
grp = getgrnam (l_group->current->text);
|
||||
listbox_get_current (l_group, &text, NULL);
|
||||
grp = getgrnam (text);
|
||||
if (grp)
|
||||
new_group = grp->gr_gid;
|
||||
user = getpwnam (l_user->current->text);
|
||||
listbox_get_current (l_user, &text, NULL);
|
||||
user = getpwnam (text);
|
||||
if (user)
|
||||
new_user = user->pw_uid;
|
||||
if (ch_dlg->ret_value==B_ENTER) {
|
||||
if (ch_dlg->ret_value == B_ENTER) {
|
||||
need_update = 1;
|
||||
if (mc_chown (fname, new_user, new_group) == -1)
|
||||
message (D_ERROR, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "),
|
||||
@ -335,7 +335,7 @@ chown_cmd (void)
|
||||
apply_chowns (new_user, new_group);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* switch */
|
||||
|
||||
if (current_panel->marked && ch_dlg->ret_value != B_CANCEL){
|
||||
do_file_mark (current_panel, current_file, 0);
|
||||
|
@ -922,24 +922,23 @@ query_callback (Dlg_head *h, Widget *sender,
|
||||
if (end == min_end) {
|
||||
h->ret_value = 0;
|
||||
dlg_stop (h);
|
||||
return MSG_HANDLED;
|
||||
} else {
|
||||
WLEntry *e, *e1;
|
||||
int i;
|
||||
GList *e;
|
||||
|
||||
e1 = e = ((WListbox *) (h->current))->list;
|
||||
do {
|
||||
if (!strncmp (input->buffer + start,
|
||||
e1->text, end - start - 1)) {
|
||||
for (i = 0, e = ((WListbox *) h->current)->list;
|
||||
e != NULL;
|
||||
i++, e = g_list_next (e)) {
|
||||
WLEntry *le = (WLEntry *) e->data;
|
||||
|
||||
listbox_select_entry ((WListbox *) (h->current), e1);
|
||||
end = str_get_prev_char (&(input->buffer[end]))
|
||||
- input->buffer;
|
||||
if (strncmp (input->buffer + start, le->text, end - start - 1) == 0) {
|
||||
listbox_select_entry ((WListbox *) h->current, i);
|
||||
end = str_get_prev_char (&(input->buffer[end])) - input->buffer;
|
||||
handle_char (input, parm);
|
||||
send_message (h->current, WIDGET_DRAW, 0);
|
||||
break;
|
||||
}
|
||||
e1 = e1->next;
|
||||
} while (e != e1);
|
||||
}
|
||||
}
|
||||
return MSG_HANDLED;
|
||||
|
||||
@ -956,7 +955,8 @@ query_callback (Dlg_head *h, Widget *sender,
|
||||
} else
|
||||
return MSG_NOT_HANDLED;
|
||||
} else {
|
||||
WLEntry *e, *e1;
|
||||
GList *e;
|
||||
int i;
|
||||
int need_redraw = 0;
|
||||
int low = 4096;
|
||||
char *last_text = NULL;
|
||||
@ -971,46 +971,47 @@ query_callback (Dlg_head *h, Widget *sender,
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
|
||||
e1 = e = ((WListbox *) (h->current))->list;
|
||||
do {
|
||||
if (!strncmp (input->buffer + start,
|
||||
e1->text, end - start)) {
|
||||
for (i = 0, e = ((WListbox *) h->current)->list;
|
||||
e != NULL;
|
||||
i++, e = g_list_next (e)) {
|
||||
WLEntry *le = (WLEntry *) e->data;
|
||||
|
||||
if (strncmp (&e1->text[end - start], buff, bl) == 0) {
|
||||
if (strncmp (input->buffer + start, le->text, end - start) == 0) {
|
||||
if (strncmp (&le->text[end - start], buff, bl) == 0) {
|
||||
if (need_redraw) {
|
||||
char *si, *sl;
|
||||
char *nexti, *nextl;
|
||||
si = &(e1->text[end - start]);
|
||||
|
||||
si = &(le->text[end - start]);
|
||||
sl = &(last_text[end - start]);
|
||||
|
||||
for (; si[0] != '\0' && sl[0] != '\0';) {
|
||||
|
||||
nexti = str_get_next_char (si);
|
||||
nextl = str_get_next_char (sl);
|
||||
|
||||
if (nexti - si != nextl - sl) break;
|
||||
if (strncmp (si, sl, nexti - si) != 0) break;
|
||||
if (nexti - si != nextl - sl)
|
||||
break;
|
||||
if (strncmp (si, sl, nexti - si) != 0)
|
||||
break;
|
||||
|
||||
si = nexti;
|
||||
sl = nextl;
|
||||
}
|
||||
|
||||
if (low > si - &e1->text[end - start])
|
||||
low = si - &e1->text[end - start];
|
||||
if (low > si - &le->text[end - start])
|
||||
low = si - &le->text[end - start];
|
||||
|
||||
last_text = e1->text;
|
||||
last_text = le->text;
|
||||
need_redraw = 2;
|
||||
} else {
|
||||
need_redraw = 1;
|
||||
listbox_select_entry ((WListbox *) (h->
|
||||
current),
|
||||
e1);
|
||||
last_text = e1->text;
|
||||
listbox_select_entry ((WListbox *) h->current, i);
|
||||
last_text = le->text;
|
||||
}
|
||||
}
|
||||
}
|
||||
e1 = e1->next;
|
||||
} while (e != e1);
|
||||
}
|
||||
|
||||
if (need_redraw == 2) {
|
||||
insert_text (input, last_text, low);
|
||||
send_message (h->current, WIDGET_DRAW, 0);
|
||||
@ -1108,7 +1109,7 @@ complete_engine (WInput *in, int what_to_do)
|
||||
query_list = listbox_new (1, 1, h - 2, w - 2, NULL);
|
||||
add_widget (query_dlg, query_list);
|
||||
for (p = in->completions + 1; *p; p++)
|
||||
listbox_add_item (query_list, 0, 0, *p, NULL);
|
||||
listbox_add_item (query_list, LISTBOX_APPEND_AT_END, 0, *p, NULL);
|
||||
run_dlg (query_dlg);
|
||||
q = NULL;
|
||||
if (query_dlg->ret_value == B_ENTER){
|
||||
|
@ -52,9 +52,9 @@ exec_edit_syntax_dialog (const char **names) {
|
||||
|
||||
for (i = 0; names[i]; i++) {
|
||||
LISTBOX_APPEND_TEXT (syntaxlist, 0, names[i], NULL);
|
||||
if (! option_auto_syntax && option_syntax_type &&
|
||||
(strcmp (names[i], option_syntax_type) == 0))
|
||||
listbox_select_by_number (syntaxlist->list, i + N_DFLT_ENTRIES);
|
||||
if (! option_auto_syntax && option_syntax_type
|
||||
&& (strcmp (names[i], option_syntax_type) == 0))
|
||||
listbox_select_entry (syntaxlist->list, i + N_DFLT_ENTRIES);
|
||||
}
|
||||
|
||||
return run_listbox (syntaxlist);
|
||||
|
32
src/find.c
32
src/find.c
@ -265,7 +265,7 @@ found_num_update (void)
|
||||
static void
|
||||
get_list_info (char **file, char **dir)
|
||||
{
|
||||
listbox_get_current (find_list, file, dir);
|
||||
listbox_get_current (find_list, file, (void **) dir);
|
||||
}
|
||||
|
||||
/* check regular expression */
|
||||
@ -626,7 +626,7 @@ find_add_match (const char *dir, const char *file)
|
||||
|
||||
/* Don't scroll */
|
||||
if (matches == 0)
|
||||
listbox_select_by_number (find_list, 0);
|
||||
listbox_select_first (find_list);
|
||||
send_message (&find_list->widget, WIDGET_DRAW, 0);
|
||||
|
||||
matches++;
|
||||
@ -1038,18 +1038,15 @@ find_do_view_edit (int unparsed_view, int edit, char *dir, char *file)
|
||||
static cb_ret_t
|
||||
view_edit_currently_selected_file (int unparsed_view, int edit)
|
||||
{
|
||||
WLEntry *entry = find_list->current;
|
||||
char *dir = NULL;
|
||||
char *text = NULL;
|
||||
|
||||
if (!entry)
|
||||
listbox_get_current (find_list, &text, (void **) &dir);
|
||||
|
||||
if ((text == NULL) || (dir == NULL))
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
dir = entry->data;
|
||||
|
||||
if (!entry->text || !dir)
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
find_do_view_edit (unparsed_view, edit, dir, entry->text);
|
||||
find_do_view_edit (unparsed_view, edit, dir, text);
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
|
||||
@ -1249,23 +1246,24 @@ find_file (const char *start_dir, const char *pattern, const char *content,
|
||||
int next_free = 0;
|
||||
int i;
|
||||
struct stat st;
|
||||
WLEntry *entry = find_list->list;
|
||||
GList *entry;
|
||||
dir_list *list = ¤t_panel->dir;
|
||||
char *name = NULL;
|
||||
|
||||
for (i = 0; entry != NULL && i < find_list->count;
|
||||
entry = entry->next, i++) {
|
||||
for (i = 0, entry = find_list->list; entry != NULL;
|
||||
i++, entry = g_list_next (entry)) {
|
||||
const char *lc_filename = NULL;
|
||||
WLEntry *le = (WLEntry *) entry->data;
|
||||
|
||||
if (!entry->text || !entry->data)
|
||||
if ((le->text == NULL) || (entry->data == NULL))
|
||||
continue;
|
||||
|
||||
if (content_pattern != NULL)
|
||||
lc_filename = strchr (entry->text + 4, ':') + 1;
|
||||
lc_filename = strchr (le->text + 4, ':') + 1;
|
||||
else
|
||||
lc_filename = entry->text + 4;
|
||||
lc_filename = le->text + 4;
|
||||
|
||||
name = make_fullname (entry->data, lc_filename);
|
||||
name = make_fullname (le->data, lc_filename);
|
||||
status =
|
||||
handle_path (list, name, &st, next_free, &link_to_dir,
|
||||
&stale_link);
|
||||
|
291
src/hotlist.c
291
src/hotlist.c
@ -43,8 +43,8 @@
|
||||
#include "lib/global.h"
|
||||
|
||||
#include "lib/tty/tty.h" /* COLS */
|
||||
#include "lib/skin.h"
|
||||
#include "lib/tty/key.h" /* KEY_M_CTRL */
|
||||
#include "lib/skin.h" /* colors */
|
||||
#include "lib/mcconfig.h" /* Load/save directories hotlist */
|
||||
#include "lib/fileloc.h"
|
||||
#include "lib/strutil.h"
|
||||
@ -195,17 +195,21 @@ update_path_name (void)
|
||||
WListbox *list = hotlist_state.moving ? l_movelist : l_hotlist;
|
||||
Dlg_head *dlg = list->widget.parent;
|
||||
|
||||
if (list->current) {
|
||||
if (list->current->data != 0) {
|
||||
struct hotlist *hlp = (struct hotlist *) list->current->data;
|
||||
if (list->count != 0) {
|
||||
char *ctext = NULL;
|
||||
void *cdata = NULL;
|
||||
|
||||
listbox_get_current (list, &ctext, &cdata);
|
||||
if (cdata == NULL)
|
||||
text = ctext;
|
||||
else {
|
||||
struct hotlist *hlp = (struct hotlist *) cdata;
|
||||
|
||||
if (hlp->type == HL_TYPE_ENTRY ||
|
||||
hlp->type == HL_TYPE_DOTDOT)
|
||||
text = hlp->directory;
|
||||
else if (hlp->type == HL_TYPE_GROUP)
|
||||
text = _("Subgroup - press ENTER to see list");
|
||||
} else {
|
||||
text = list->current->text;
|
||||
}
|
||||
}
|
||||
if (!hotlist_state.moving)
|
||||
@ -249,17 +253,17 @@ static void fill_listbox (void)
|
||||
g_string_append(buff,"->");
|
||||
g_string_append(buff,current->label);
|
||||
if (hotlist_state.moving)
|
||||
listbox_add_item (l_movelist, 0, 0, buff->str, current);
|
||||
listbox_add_item (l_movelist, LISTBOX_APPEND_AT_END, 0, buff->str, current);
|
||||
else
|
||||
listbox_add_item (l_hotlist, 0, 0, buff->str, current);
|
||||
listbox_add_item (l_hotlist, LISTBOX_APPEND_AT_END, 0, buff->str, current);
|
||||
}
|
||||
break;
|
||||
case HL_TYPE_DOTDOT:
|
||||
case HL_TYPE_ENTRY:
|
||||
if (hotlist_state.moving)
|
||||
listbox_add_item (l_movelist, 0, 0, current->label, current);
|
||||
listbox_add_item (l_movelist, LISTBOX_APPEND_AT_END, 0, current->label, current);
|
||||
else
|
||||
listbox_add_item (l_hotlist, 0, 0, current->label, current);
|
||||
listbox_add_item (l_hotlist, LISTBOX_APPEND_AT_END, 0, current->label, current);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -289,7 +293,7 @@ unlink_entry (struct hotlist *entry)
|
||||
#ifdef ENABLE_VFS
|
||||
static void add_name_to_list (const char *path)
|
||||
{
|
||||
listbox_add_item (l_hotlist, 0, 0, path, 0);
|
||||
listbox_add_item (l_hotlist, LISTBOX_APPEND_AT_END, 0, path, 0);
|
||||
}
|
||||
#endif /* !ENABLE_VFS */
|
||||
|
||||
@ -300,21 +304,22 @@ hotlist_button_callback (int action)
|
||||
case B_MOVE:
|
||||
{
|
||||
struct hotlist *saved = current_group;
|
||||
struct hotlist *item;
|
||||
struct hotlist *moveto_item = 0;
|
||||
struct hotlist *moveto_group = 0;
|
||||
struct hotlist *item = NULL;
|
||||
struct hotlist *moveto_item = NULL;
|
||||
struct hotlist *moveto_group = NULL;
|
||||
int ret;
|
||||
|
||||
if (!l_hotlist->current)
|
||||
if (l_hotlist->count == 0)
|
||||
return MSG_NOT_HANDLED; /* empty group - nothing to do */
|
||||
item = l_hotlist->current->data;
|
||||
|
||||
listbox_get_current (l_hotlist, NULL, (void **) &item);
|
||||
hotlist_state.moving = 1;
|
||||
init_movelist (LIST_MOVELIST, item);
|
||||
run_dlg (movelist_dlg);
|
||||
ret = movelist_dlg->ret_value;
|
||||
|
||||
ret = run_dlg (movelist_dlg);
|
||||
|
||||
hotlist_state.moving = 0;
|
||||
if (l_movelist->current)
|
||||
moveto_item = l_movelist->current->data;
|
||||
listbox_get_current (l_movelist, NULL, (void **) &moveto_item);
|
||||
moveto_group = current_group;
|
||||
destroy_dlg (movelist_dlg);
|
||||
current_group = saved;
|
||||
@ -357,51 +362,50 @@ hotlist_button_callback (int action)
|
||||
repaint_screen ();
|
||||
hotlist_state.modified = 1;
|
||||
return MSG_NOT_HANDLED;
|
||||
break;
|
||||
}
|
||||
case B_REMOVE:
|
||||
if (l_hotlist->current && l_hotlist->current->data)
|
||||
remove_from_hotlist (l_hotlist->current->data);
|
||||
{
|
||||
struct hotlist *entry = NULL;
|
||||
listbox_get_current (l_hotlist, NULL, (void **) &entry);
|
||||
remove_from_hotlist (entry);
|
||||
}
|
||||
return MSG_NOT_HANDLED;
|
||||
break;
|
||||
|
||||
case B_NEW_GROUP:
|
||||
add_new_group_cmd ();
|
||||
return MSG_NOT_HANDLED;
|
||||
break;
|
||||
|
||||
case B_ADD_CURRENT:
|
||||
add2hotlist_cmd ();
|
||||
return MSG_NOT_HANDLED;
|
||||
break;
|
||||
|
||||
case B_NEW_ENTRY:
|
||||
add_new_entry_cmd ();
|
||||
return MSG_NOT_HANDLED;
|
||||
break;
|
||||
|
||||
case B_ENTER:
|
||||
{
|
||||
WListbox *list = hotlist_state.moving ? l_movelist : l_hotlist;
|
||||
if (list->current) {
|
||||
if (list->current->data) {
|
||||
struct hotlist *hlp =
|
||||
(struct hotlist *) list->current->data;
|
||||
WListbox *list;
|
||||
void *data;
|
||||
struct hotlist *hlp;
|
||||
|
||||
list = hotlist_state.moving ? l_movelist : l_hotlist;
|
||||
listbox_get_current (list, NULL, &data);
|
||||
|
||||
if (data == NULL)
|
||||
return MSG_HANDLED;
|
||||
|
||||
hlp = (struct hotlist *) data;
|
||||
|
||||
if (hlp->type == HL_TYPE_ENTRY)
|
||||
return MSG_HANDLED;
|
||||
else if (hlp->type == HL_TYPE_DOTDOT) {
|
||||
/* Fall through - go up */
|
||||
;
|
||||
}
|
||||
else {
|
||||
if (hlp->type != HL_TYPE_DOTDOT) {
|
||||
listbox_remove_list (list);
|
||||
current_group = hlp;
|
||||
fill_listbox ();
|
||||
return MSG_NOT_HANDLED;
|
||||
}
|
||||
} else
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
/* Fall through - go up */
|
||||
}
|
||||
/* Fall through if list empty - just go up */
|
||||
|
||||
@ -412,7 +416,6 @@ hotlist_button_callback (int action)
|
||||
current_group = current_group->up;
|
||||
fill_listbox ();
|
||||
return MSG_NOT_HANDLED;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VFS
|
||||
@ -422,15 +425,72 @@ hotlist_button_callback (int action)
|
||||
|
||||
case B_REFRESH_VFS:
|
||||
listbox_remove_list (l_hotlist);
|
||||
listbox_add_item (l_hotlist, 0, 0, home_dir, 0);
|
||||
listbox_add_item (l_hotlist, LISTBOX_APPEND_AT_END, 0, home_dir, 0);
|
||||
vfs_fill_names (add_name_to_list);
|
||||
return MSG_NOT_HANDLED;
|
||||
#endif /* ENABLE_VFS */
|
||||
|
||||
default:
|
||||
return MSG_HANDLED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline cb_ret_t
|
||||
hotlist_handle_key (Dlg_head *h, int key)
|
||||
{
|
||||
switch (key) {
|
||||
case KEY_M_CTRL | '\n':
|
||||
goto l1;
|
||||
|
||||
case '\n':
|
||||
case KEY_ENTER:
|
||||
case KEY_RIGHT:
|
||||
if (hotlist_button_callback (B_ENTER)) {
|
||||
h->ret_value = B_ENTER;
|
||||
dlg_stop (h);
|
||||
}
|
||||
return MSG_HANDLED;
|
||||
|
||||
case KEY_LEFT:
|
||||
if (hotlist_state.type != LIST_VFSLIST)
|
||||
return !hotlist_button_callback (B_UP_GROUP);
|
||||
else
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
case KEY_DC:
|
||||
if (hotlist_state.moving)
|
||||
return MSG_NOT_HANDLED;
|
||||
else {
|
||||
hotlist_button_callback (B_REMOVE);
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
|
||||
l1:
|
||||
case ALT ('\n'):
|
||||
case ALT ('\r'):
|
||||
if (!hotlist_state.moving) {
|
||||
void *ldata = NULL;
|
||||
|
||||
listbox_get_current (l_hotlist, NULL, &ldata);
|
||||
|
||||
if (ldata != NULL) {
|
||||
struct hotlist *hlp = (struct hotlist *) ldata;
|
||||
|
||||
if (hlp->type == HL_TYPE_ENTRY) {
|
||||
char *tmp;
|
||||
|
||||
tmp = g_strconcat ("cd ", hlp->directory, (char *) NULL);
|
||||
stuff (cmdline, tmp, 0);
|
||||
g_free (tmp);
|
||||
h->ret_value = B_CANCEL;
|
||||
dlg_stop (h);
|
||||
}
|
||||
}
|
||||
}
|
||||
return MSG_HANDLED; /* ignore key */
|
||||
|
||||
default:
|
||||
return MSG_NOT_HANDLED;
|
||||
}
|
||||
}
|
||||
|
||||
@ -444,53 +504,7 @@ hotlist_callback (Dlg_head *h, Widget *sender,
|
||||
return MSG_HANDLED;
|
||||
|
||||
case DLG_UNHANDLED_KEY:
|
||||
switch (parm) {
|
||||
case KEY_M_CTRL | '\n':
|
||||
goto l1;
|
||||
case '\n':
|
||||
case KEY_ENTER:
|
||||
case KEY_RIGHT:
|
||||
if (hotlist_button_callback (B_ENTER)) {
|
||||
h->ret_value = B_ENTER;
|
||||
dlg_stop (h);
|
||||
};
|
||||
return MSG_HANDLED;
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
if (hotlist_state.type != LIST_VFSLIST)
|
||||
return !hotlist_button_callback (B_UP_GROUP);
|
||||
else
|
||||
return MSG_NOT_HANDLED;
|
||||
break;
|
||||
case KEY_DC:
|
||||
if (!hotlist_state.moving) {
|
||||
hotlist_button_callback (B_REMOVE);
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
break;
|
||||
l1:
|
||||
case ALT ('\n'):
|
||||
case ALT ('\r'):
|
||||
if (!hotlist_state.moving) {
|
||||
if (l_hotlist->current) {
|
||||
if (l_hotlist->current->data) {
|
||||
struct hotlist *hlp =
|
||||
(struct hotlist *) l_hotlist->current->data;
|
||||
if (hlp->type == HL_TYPE_ENTRY) {
|
||||
char *tmp =
|
||||
g_strconcat ("cd ", hlp->directory, (char *) NULL);
|
||||
stuff (cmdline, tmp, 0);
|
||||
g_free (tmp);
|
||||
dlg_stop (h);
|
||||
h->ret_value = B_CANCEL;
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return MSG_HANDLED; /* ignore key */
|
||||
}
|
||||
return MSG_NOT_HANDLED;
|
||||
return hotlist_handle_key (h, parm);
|
||||
|
||||
case DLG_POST_KEY:
|
||||
if (hotlist_state.moving)
|
||||
@ -515,13 +529,18 @@ hotlist_callback (Dlg_head *h, Widget *sender,
|
||||
}
|
||||
}
|
||||
|
||||
static int l_call (WListbox *list)
|
||||
static int
|
||||
l_call (WListbox *list)
|
||||
{
|
||||
Dlg_head *dlg = list->widget.parent;
|
||||
|
||||
if (list->current){
|
||||
if (list->current->data) {
|
||||
struct hotlist *hlp = (struct hotlist*) list->current->data;
|
||||
if (list->count != 0) {
|
||||
void *data = NULL;
|
||||
|
||||
listbox_get_current (list, NULL, &data);
|
||||
|
||||
if (data != NULL) {
|
||||
struct hotlist *hlp = (struct hotlist*) data;
|
||||
if (hlp->type == HL_TYPE_ENTRY) {
|
||||
dlg->ret_value = B_ENTER;
|
||||
dlg_stop (dlg);
|
||||
@ -687,7 +706,7 @@ init_hotlist (int list_type)
|
||||
/* Fill the hotlist with the active VFS or the hotlist */
|
||||
#ifdef ENABLE_VFS
|
||||
if (list_type == LIST_VFSLIST) {
|
||||
listbox_add_item (l_hotlist, 0, 0, home_dir, 0);
|
||||
listbox_add_item (l_hotlist, LISTBOX_APPEND_AT_END, 0, home_dir, 0);
|
||||
vfs_fill_names (add_name_to_list);
|
||||
} else
|
||||
#endif /* !ENABLE_VFS */
|
||||
@ -757,18 +776,8 @@ find_group_section (struct hotlist *grp)
|
||||
return g_strconcat (grp->directory, ".Group", (char *) NULL);
|
||||
}
|
||||
|
||||
|
||||
/* 1.11.96 bor: added pos parameter to control placement of new item.
|
||||
see widget.c, listbox_add_item()
|
||||
now hotlist is in unsorted mode
|
||||
*/
|
||||
enum {
|
||||
HL_BEFORE_CURRENT = 1
|
||||
,HL_AFTER_CURRENT = 2
|
||||
};
|
||||
|
||||
static struct hotlist *
|
||||
add2hotlist (char *label, char *directory, enum HotListType type, int pos)
|
||||
add2hotlist (char *label, char *directory, enum HotListType type, listbox_append_t pos)
|
||||
{
|
||||
struct hotlist *new;
|
||||
struct hotlist *current = NULL;
|
||||
@ -780,13 +789,11 @@ add2hotlist (char *label, char *directory, enum HotListType type, int pos)
|
||||
if (!current_group)
|
||||
load_hotlist ();
|
||||
|
||||
if (l_hotlist && l_hotlist->current) {
|
||||
current = l_hotlist->current->data;
|
||||
listbox_get_current (l_hotlist, NULL, (void **) ¤t);
|
||||
|
||||
/* Make sure `..' stays at the top of the list. */
|
||||
if (current->type == HL_TYPE_DOTDOT)
|
||||
pos = HL_AFTER_CURRENT;
|
||||
}
|
||||
if ((current != NULL) && (current->type == HL_TYPE_DOTDOT))
|
||||
pos = LISTBOX_APPEND_AFTER;
|
||||
|
||||
new = new_hotlist ();
|
||||
|
||||
@ -801,17 +808,17 @@ add2hotlist (char *label, char *directory, enum HotListType type, int pos)
|
||||
current_group = new->up;
|
||||
}
|
||||
|
||||
if (!current_group->head) { /* first element in group */
|
||||
if (!current_group->head) {
|
||||
/* first element in group */
|
||||
current_group->head = new;
|
||||
} else if (pos == HL_AFTER_CURRENT) {
|
||||
} else if (pos == LISTBOX_APPEND_AFTER) {
|
||||
new->next = current->next;
|
||||
current->next = new;
|
||||
} else if (pos == HL_BEFORE_CURRENT &&
|
||||
current == current_group->head) {
|
||||
} else if (pos == LISTBOX_APPEND_BEFORE && current == current_group->head) {
|
||||
/* should be inserted before first item */
|
||||
new->next = current;
|
||||
current_group->head = new;
|
||||
} else if (pos == HL_BEFORE_CURRENT) {
|
||||
} else if (pos == LISTBOX_APPEND_BEFORE) {
|
||||
struct hotlist *p = current_group->head;
|
||||
|
||||
while (p->next != current)
|
||||
@ -828,8 +835,7 @@ add2hotlist (char *label, char *directory, enum HotListType type, int pos)
|
||||
p->next = new;
|
||||
}
|
||||
|
||||
if (hotlist_state.running && type != HL_TYPE_COMMENT &&
|
||||
type != HL_TYPE_DOTDOT) {
|
||||
if (hotlist_state.running && type != HL_TYPE_COMMENT && type != HL_TYPE_DOTDOT) {
|
||||
if (type == HL_TYPE_GROUP) {
|
||||
char *lbl = g_strconcat ("->", new->label, (char *) NULL);
|
||||
|
||||
@ -837,7 +843,7 @@ add2hotlist (char *label, char *directory, enum HotListType type, int pos)
|
||||
g_free (lbl);
|
||||
} else
|
||||
listbox_add_item (l_hotlist, pos, 0, new->label, new);
|
||||
listbox_select_entry (l_hotlist, l_hotlist->current);
|
||||
listbox_select_entry (l_hotlist, l_hotlist->pos);
|
||||
}
|
||||
return new;
|
||||
|
||||
@ -958,9 +964,9 @@ static void add_new_entry_cmd (void)
|
||||
}
|
||||
|
||||
if (ret == B_ENTER || ret == B_APPEND)
|
||||
add2hotlist (title, url, HL_TYPE_ENTRY, HL_AFTER_CURRENT);
|
||||
add2hotlist (title, url, HL_TYPE_ENTRY, LISTBOX_APPEND_AFTER);
|
||||
else
|
||||
add2hotlist (title, url, HL_TYPE_ENTRY, HL_BEFORE_CURRENT);
|
||||
add2hotlist (title, url, HL_TYPE_ENTRY, LISTBOX_APPEND_BEFORE);
|
||||
|
||||
hotlist_state.modified = 1;
|
||||
}
|
||||
@ -1029,9 +1035,9 @@ static void add_new_group_cmd (void)
|
||||
return;
|
||||
|
||||
if (ret == B_ENTER || ret == B_APPEND)
|
||||
add2hotlist (label, 0, HL_TYPE_GROUP, HL_AFTER_CURRENT);
|
||||
add2hotlist (label, 0, HL_TYPE_GROUP, LISTBOX_APPEND_AFTER);
|
||||
else
|
||||
add2hotlist (label, 0, HL_TYPE_GROUP, HL_BEFORE_CURRENT);
|
||||
add2hotlist (label, 0, HL_TYPE_GROUP, LISTBOX_APPEND_BEFORE);
|
||||
|
||||
hotlist_state.modified = 1;
|
||||
}
|
||||
@ -1054,7 +1060,7 @@ void add2hotlist_cmd (void)
|
||||
g_free (label);
|
||||
return;
|
||||
}
|
||||
add2hotlist (label, label_string, HL_TYPE_ENTRY, 0);
|
||||
add2hotlist (label, label_string, HL_TYPE_ENTRY, LISTBOX_APPEND_AT_END);
|
||||
hotlist_state.modified = 1;
|
||||
}
|
||||
|
||||
@ -1079,6 +1085,9 @@ static void remove_group (struct hotlist *grp)
|
||||
|
||||
static void remove_from_hotlist (struct hotlist *entry)
|
||||
{
|
||||
if (entry == NULL)
|
||||
return;
|
||||
|
||||
if (entry->type == HL_TYPE_DOTDOT)
|
||||
return;
|
||||
|
||||
@ -1132,7 +1141,8 @@ static void remove_from_hotlist (struct hotlist *entry)
|
||||
hotlist_state.modified = 1;
|
||||
}
|
||||
|
||||
char *hotlist_cmd (int vfs_or_hotlist)
|
||||
char *
|
||||
hotlist_cmd (int vfs_or_hotlist)
|
||||
{
|
||||
char *target = NULL;
|
||||
|
||||
@ -1150,17 +1160,20 @@ char *hotlist_cmd (int vfs_or_hotlist)
|
||||
save_hotlist ();
|
||||
|
||||
switch (hotlist_dlg->ret_value) {
|
||||
default:
|
||||
case B_CANCEL:
|
||||
break;
|
||||
|
||||
case B_ENTER:
|
||||
if (l_hotlist->current->data) {
|
||||
struct hotlist *hlp = (struct hotlist*) l_hotlist->current->data;
|
||||
target = g_strdup (hlp->directory);
|
||||
} else
|
||||
target = g_strdup (l_hotlist->current->text);
|
||||
{
|
||||
char *text = NULL;
|
||||
struct hotlist *hlp = NULL;
|
||||
|
||||
listbox_get_current (l_hotlist, &text, (void **) &hlp);
|
||||
target = g_strdup (hlp != NULL ? hlp->directory : text);
|
||||
break;
|
||||
}
|
||||
} /* switch */
|
||||
|
||||
hotlist_done ();
|
||||
return target;
|
||||
@ -1185,7 +1198,7 @@ load_group (struct hotlist *grp)
|
||||
mc_config_get_string(mc_main_config, group_section, *profile_keys, ""),
|
||||
g_strdup (*profile_keys),
|
||||
HL_TYPE_GROUP,
|
||||
0);
|
||||
LISTBOX_APPEND_AT_END);
|
||||
profile_keys++;
|
||||
}
|
||||
g_free (group_section);
|
||||
@ -1198,7 +1211,7 @@ load_group (struct hotlist *grp)
|
||||
mc_config_get_string(mc_main_config,group_section,*profile_keys,""),
|
||||
g_strdup (*profile_keys),
|
||||
HL_TYPE_ENTRY,
|
||||
0);
|
||||
LISTBOX_APPEND_AT_END);
|
||||
profile_keys++;
|
||||
}
|
||||
g_strfreev(keys);
|
||||
@ -1331,7 +1344,7 @@ hot_load_group (struct hotlist * grp)
|
||||
switch (tkn) {
|
||||
case TKN_GROUP:
|
||||
CHECK_TOKEN(TKN_STRING);
|
||||
new_grp = add2hotlist (g_strdup (tkn_buf->str), 0, HL_TYPE_GROUP, 0);
|
||||
new_grp = add2hotlist (g_strdup (tkn_buf->str), 0, HL_TYPE_GROUP, LISTBOX_APPEND_AT_END);
|
||||
SKIP_TO_EOL;
|
||||
hot_load_group (new_grp);
|
||||
current_group = grp;
|
||||
@ -1342,12 +1355,12 @@ hot_load_group (struct hotlist * grp)
|
||||
CHECK_TOKEN(TKN_URL);
|
||||
CHECK_TOKEN(TKN_STRING);
|
||||
url = g_strdup (tkn_buf->str);
|
||||
add2hotlist (label, url, HL_TYPE_ENTRY, 0);
|
||||
add2hotlist (label, url, HL_TYPE_ENTRY, LISTBOX_APPEND_AT_END);
|
||||
SKIP_TO_EOL;
|
||||
break;
|
||||
case TKN_COMMENT:
|
||||
label = g_strdup (tkn_buf->str);
|
||||
add2hotlist (label, 0, HL_TYPE_COMMENT, 0);
|
||||
add2hotlist (label, 0, HL_TYPE_COMMENT, LISTBOX_APPEND_AT_END);
|
||||
break;
|
||||
case TKN_EOF:
|
||||
hotlist_state.readonly = 1;
|
||||
@ -1379,7 +1392,7 @@ hot_load_file (struct hotlist * grp)
|
||||
switch (tkn) {
|
||||
case TKN_GROUP:
|
||||
CHECK_TOKEN(TKN_STRING);
|
||||
new_grp = add2hotlist (g_strdup (tkn_buf->str), 0, HL_TYPE_GROUP, 0);
|
||||
new_grp = add2hotlist (g_strdup (tkn_buf->str), 0, HL_TYPE_GROUP, LISTBOX_APPEND_AT_END);
|
||||
SKIP_TO_EOL;
|
||||
hot_load_group (new_grp);
|
||||
current_group = grp;
|
||||
@ -1390,12 +1403,12 @@ hot_load_file (struct hotlist * grp)
|
||||
CHECK_TOKEN(TKN_URL);
|
||||
CHECK_TOKEN(TKN_STRING);
|
||||
url = g_strdup (tkn_buf->str);
|
||||
add2hotlist (label, url, HL_TYPE_ENTRY, 0);
|
||||
add2hotlist (label, url, HL_TYPE_ENTRY, LISTBOX_APPEND_AT_END);
|
||||
SKIP_TO_EOL;
|
||||
break;
|
||||
case TKN_COMMENT:
|
||||
label = g_strdup (tkn_buf->str);
|
||||
add2hotlist (label, 0, HL_TYPE_COMMENT, 0);
|
||||
add2hotlist (label, 0, HL_TYPE_COMMENT, LISTBOX_APPEND_AT_END);
|
||||
break;
|
||||
case TKN_EOL:
|
||||
/* skip empty lines */
|
||||
@ -1608,6 +1621,6 @@ add_dotdot_to_list (void)
|
||||
{
|
||||
if (current_group != hotlist) {
|
||||
if (hotlist_has_dot_dot != 0)
|
||||
add2hotlist (g_strdup (".."), g_strdup (".."), HL_TYPE_DOTDOT, 0);
|
||||
add2hotlist (g_strdup (".."), g_strdup (".."), HL_TYPE_DOTDOT, LISTBOX_APPEND_AT_END);
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ select_new_item (void)
|
||||
create_listbox_window (20, 12, " Add listing format item ",
|
||||
listmode_section);
|
||||
for (i = 0; possible_items[i]; i++) {
|
||||
listbox_add_item (mylistbox->list, 0, 0, possible_items[i], NULL);
|
||||
listbox_add_item (mylistbox->list, LISTBOX_APPEND_AT_END, 0, possible_items[i], NULL);
|
||||
}
|
||||
|
||||
i = run_listbox (mylistbox);
|
||||
@ -133,7 +133,7 @@ badd_cback (int action)
|
||||
{
|
||||
char *s = select_new_item ();
|
||||
if (s) {
|
||||
listbox_add_item (l_listmode, 0, 0, s, NULL);
|
||||
listbox_add_item (l_listmode, LISTBOX_APPEND_AT_END, 0, s, NULL);
|
||||
g_free(s);
|
||||
}
|
||||
return 0;
|
||||
@ -226,7 +226,7 @@ init_listmode (char *oldlistformat)
|
||||
s = strtok (oldlistformat, ",");
|
||||
|
||||
while (s) {
|
||||
listbox_add_item (l_listmode, 0, 0, s, NULL);
|
||||
listbox_add_item (l_listmode, LISTBOX_APPEND_AT_END, 0, s, NULL);
|
||||
s = strtok (NULL, ",");
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@ collect_new_format (void)
|
||||
strcat (newformat, "2 ");
|
||||
last = NULL;
|
||||
for (i = 0;; i++) {
|
||||
listbox_select_by_number (l_listmode, i);
|
||||
listbox_select_entry (l_listmode, i);
|
||||
listbox_get_current (l_listmode, &text, &extra);
|
||||
if (text == last)
|
||||
break;
|
||||
|
@ -91,9 +91,11 @@ static void
|
||||
update_command (void)
|
||||
{
|
||||
if (l_panelize->pos != last_listitem) {
|
||||
struct panelize *data = NULL;
|
||||
|
||||
last_listitem = l_panelize->pos;
|
||||
assign_text (pname,
|
||||
((struct panelize *) l_panelize->current->data)->command);
|
||||
listbox_get_current (l_panelize, NULL, (void **) &data);
|
||||
assign_text (pname, data->command);
|
||||
pname->point = 0;
|
||||
update_input (pname, 1);
|
||||
}
|
||||
@ -181,7 +183,7 @@ init_panelize (void)
|
||||
listbox_new (UY + 1, UX + 1, 10, panelize_dlg->cols - 12, NULL);
|
||||
|
||||
while (current) {
|
||||
listbox_add_item (l_panelize, 0, 0, current->label, current);
|
||||
listbox_add_item (l_panelize, LISTBOX_APPEND_AT_END, 0, current->label, current);
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
@ -293,8 +295,13 @@ external_panelize (void)
|
||||
break;
|
||||
|
||||
case B_REMOVE:
|
||||
remove_from_panelize (l_panelize->current->data);
|
||||
{
|
||||
struct panelize *entry;
|
||||
|
||||
listbox_get_current (l_panelize, NULL, (void **) &entry);
|
||||
remove_from_panelize (entry);
|
||||
break;
|
||||
}
|
||||
|
||||
case B_ENTER:
|
||||
target = pname->buffer;
|
||||
|
@ -89,7 +89,7 @@ select_charset (int center_y, int center_x, int current_charset, gboolean seldis
|
||||
? ((current_charset < 0) ? n_codepages : current_charset)
|
||||
: (current_charset + 1);
|
||||
|
||||
listbox_select_by_number (listbox->list, i);
|
||||
listbox_select_entry (listbox->list, i);
|
||||
|
||||
i = run_listbox (listbox);
|
||||
|
||||
|
@ -880,7 +880,7 @@ user_menu_cmd (struct WEdit *edit_widget)
|
||||
extract_line (p, p + MAX_ENTRY_LEN), p);
|
||||
}
|
||||
/* Select the default entry */
|
||||
listbox_select_by_number (listbox->list, selected);
|
||||
listbox_select_entry (listbox->list, selected);
|
||||
|
||||
selected = run_listbox (listbox);
|
||||
if (selected >= 0)
|
||||
|
409
src/widget.c
409
src/widget.c
@ -1102,15 +1102,6 @@ i18n_htitle (void)
|
||||
return _(" History ");
|
||||
}
|
||||
|
||||
static void
|
||||
listbox_fwd (WListbox *l)
|
||||
{
|
||||
if (l->current != l->list->prev)
|
||||
listbox_select_entry (l, l->current->next);
|
||||
else
|
||||
listbox_select_first (l);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
Widget *widget;
|
||||
int count;
|
||||
@ -2042,40 +2033,47 @@ input_new (int y, int x, int color, int width, const char *def_text,
|
||||
return in;
|
||||
}
|
||||
|
||||
|
||||
/* Listbox widget */
|
||||
|
||||
/* Should draw the scrollbar, but currently draws only
|
||||
* indications that there is more information
|
||||
*/
|
||||
static int listbox_cdiff (WLEntry *s, WLEntry *e);
|
||||
|
||||
static void
|
||||
listbox_entry_free (void *data)
|
||||
{
|
||||
WLEntry *e = data;
|
||||
g_free (e->text);
|
||||
g_free (e);
|
||||
}
|
||||
|
||||
static void
|
||||
listbox_drawscroll (WListbox *l)
|
||||
{
|
||||
const int max_line = l->widget.lines - 1;
|
||||
int line = 0;
|
||||
int i, top;
|
||||
int max_line = l->widget.lines - 1;
|
||||
int i;
|
||||
|
||||
/* Are we at the top? */
|
||||
widget_move (&l->widget, 0, l->widget.cols);
|
||||
if (l->list == l->top)
|
||||
if (l->top == 0)
|
||||
tty_print_one_vline ();
|
||||
else
|
||||
tty_print_char ('^');
|
||||
|
||||
/* Are we at the bottom? */
|
||||
widget_move (&l->widget, max_line, l->widget.cols);
|
||||
top = listbox_cdiff (l->list, l->top);
|
||||
if ((top + l->widget.lines == l->count) || l->widget.lines >= l->count)
|
||||
if ((l->top + l->widget.lines == l->count) || (l->widget.lines >= l->count))
|
||||
tty_print_one_vline ();
|
||||
else
|
||||
tty_print_char ('v');
|
||||
|
||||
/* Now draw the nice relative pointer */
|
||||
if (l->count != 0)
|
||||
line = 1+ ((l->pos * (l->widget.lines - 2)) / l->count);
|
||||
line = 1 + ((l->pos * (l->widget.lines - 2)) / l->count);
|
||||
|
||||
for (i = 1; i < max_line; i++){
|
||||
for (i = 1; i < max_line; i++) {
|
||||
widget_move (&l->widget, i, l->widget.cols);
|
||||
if (i != line)
|
||||
tty_print_one_vline ();
|
||||
@ -2091,14 +2089,20 @@ listbox_draw (WListbox *l, gboolean focused)
|
||||
const int normalc = DLG_NORMALC (h);
|
||||
int selc = focused ? DLG_HOT_FOCUSC (h) : DLG_FOCUSC (h);
|
||||
|
||||
WLEntry *e;
|
||||
GList *le;
|
||||
int pos;
|
||||
int i;
|
||||
int sel_line = -1;
|
||||
|
||||
le = g_list_nth (l->list, l->top);
|
||||
/* pos = (le == NULL) ? 0 : g_list_position (l->list, le); */
|
||||
pos = (le == NULL) ? 0 : l->top;
|
||||
|
||||
for (i = 0; i < l->widget.lines; i++) {
|
||||
const char *text;
|
||||
|
||||
for (e = l->top, i = 0; i < l->widget.lines; i++) {
|
||||
/* Display the entry */
|
||||
if (e == l->current && sel_line == -1) {
|
||||
if (pos == l->pos && sel_line == -1) {
|
||||
sel_line = i;
|
||||
tty_setcolor (selc);
|
||||
} else
|
||||
@ -2106,185 +2110,146 @@ listbox_draw (WListbox *l, gboolean focused)
|
||||
|
||||
widget_move (&l->widget, i, 1);
|
||||
|
||||
if ((i > 0 && e == l->list) || !l->list)
|
||||
if ((i > 0 && pos >= l->count) || (l->list == NULL) || (le == NULL))
|
||||
text = "";
|
||||
else {
|
||||
WLEntry *e = (WLEntry *) le->data;
|
||||
text = e->text;
|
||||
e = e->next;
|
||||
le = g_list_next (le);
|
||||
pos++;
|
||||
}
|
||||
|
||||
tty_print_string (str_fit_to_term (text, l->widget.cols - 2, J_LEFT_FIT));
|
||||
}
|
||||
|
||||
l->cursor_y = sel_line;
|
||||
|
||||
if (l->scrollbar && l->count > l->widget.lines) {
|
||||
if (l->scrollbar && (l->count > l->widget.lines)) {
|
||||
tty_setcolor (normalc);
|
||||
listbox_drawscroll (l);
|
||||
}
|
||||
}
|
||||
|
||||
/* Returns the number of items between s and e,
|
||||
must be on the same linked list */
|
||||
static int
|
||||
listbox_cdiff (WLEntry *s, WLEntry *e)
|
||||
{
|
||||
int count;
|
||||
|
||||
for (count = 0; s != e; count++)
|
||||
s = s->next;
|
||||
return count;
|
||||
}
|
||||
|
||||
static WLEntry *
|
||||
listbox_check_hotkey (WListbox *l, int key)
|
||||
{
|
||||
int i;
|
||||
WLEntry *e;
|
||||
GList *le;
|
||||
|
||||
i = 0;
|
||||
e = l->list;
|
||||
if (!e)
|
||||
return NULL;
|
||||
|
||||
while (1) {
|
||||
|
||||
/* If we didn't find anything, return */
|
||||
if (i && e == l->list)
|
||||
return NULL;
|
||||
for (i = 0, le = l->list; le != NULL; i++, le = g_list_next (le)) {
|
||||
WLEntry *e = (WLEntry *) le->data;
|
||||
|
||||
if (e->hotkey == key)
|
||||
return e;
|
||||
|
||||
i++;
|
||||
e = e->next;
|
||||
return i;
|
||||
}
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Selects the last entry and scrolls the list to the bottom */
|
||||
void
|
||||
listbox_select_last (WListbox *l)
|
||||
{
|
||||
unsigned int i;
|
||||
l->current = l->top = l->list->prev;
|
||||
for (i = min (l->widget.lines, l->count) - 1; i; i--)
|
||||
l->top = l->top->prev;
|
||||
l->pos = l->count - 1;
|
||||
l->top = (l->count > l->widget.lines) ? (l->count - l->widget.lines) : 0;
|
||||
}
|
||||
|
||||
/* Selects the first entry and scrolls the list to the top */
|
||||
void
|
||||
listbox_select_first (WListbox *l)
|
||||
{
|
||||
l->current = l->top = l->list;
|
||||
l->pos = 0;
|
||||
l->pos = l->top = 0;
|
||||
}
|
||||
|
||||
void
|
||||
listbox_remove_list (WListbox *l)
|
||||
{
|
||||
WLEntry *p, *q;
|
||||
|
||||
if (!l->count)
|
||||
return;
|
||||
|
||||
p = l->list;
|
||||
|
||||
while (l->count--) {
|
||||
q = p->next;
|
||||
g_free (p->text);
|
||||
g_free (p);
|
||||
p = q;
|
||||
if ((l != NULL) && (l->count != 0)) {
|
||||
g_list_foreach (l->list, (GFunc) listbox_entry_free, NULL);
|
||||
g_list_free (l->list);
|
||||
l->list = NULL;
|
||||
l->pos = l->top = 0;
|
||||
}
|
||||
l->pos = l->count = 0;
|
||||
l->list = l->top = l->current = 0;
|
||||
}
|
||||
|
||||
void
|
||||
listbox_remove_current (WListbox *l)
|
||||
{
|
||||
WLEntry *p;
|
||||
|
||||
if ((l == NULL) || (l->count == 0))
|
||||
return;
|
||||
if ((l != NULL) && (l->count != 0)) {
|
||||
GList *current;
|
||||
|
||||
current = g_list_nth (l->list, l->pos);
|
||||
l->list = g_list_remove_link (l->list, current);
|
||||
listbox_entry_free ((WLEntry *) current->data);
|
||||
g_list_free_1 (current);
|
||||
l->count--;
|
||||
p = l->current;
|
||||
|
||||
if (l->count) {
|
||||
l->current->next->prev = l->current->prev;
|
||||
l->current->prev->next = l->current->next;
|
||||
if (p->next == l->list) {
|
||||
l->current = p->prev;
|
||||
l->pos--;
|
||||
} else
|
||||
l->current = p->next;
|
||||
|
||||
if (p == l->list)
|
||||
l->list = l->top = p->next;
|
||||
} else {
|
||||
l->pos = 0;
|
||||
l->list = l->top = l->current = NULL;
|
||||
if (l->count == 0)
|
||||
l->top = l->pos = 0;
|
||||
else if (l->pos >= l->count)
|
||||
l->pos = l->count - 1;
|
||||
}
|
||||
|
||||
g_free (p->text);
|
||||
g_free (p);
|
||||
}
|
||||
|
||||
/* Makes *e the selected entry (sets current and pos) */
|
||||
void
|
||||
listbox_select_entry (WListbox *l, WLEntry *dest)
|
||||
listbox_select_entry (WListbox *l, int dest)
|
||||
{
|
||||
WLEntry *e;
|
||||
GList *le;
|
||||
int pos;
|
||||
int top_seen;
|
||||
gboolean top_seen = FALSE;
|
||||
|
||||
top_seen = 0;
|
||||
if (dest < 0)
|
||||
return;
|
||||
|
||||
/* Special case */
|
||||
for (pos = 0, e = l->list; pos < l->count; e = e->next, pos++){
|
||||
for (pos = 0, le = l->list; le != NULL; pos++, le = g_list_next (le)) {
|
||||
if (pos == l->top)
|
||||
top_seen = TRUE;
|
||||
|
||||
if (e == l->top)
|
||||
top_seen = 1;
|
||||
|
||||
if (e == dest){
|
||||
l->current = e;
|
||||
if (top_seen){
|
||||
while (listbox_cdiff (l->top, l->current) >= l->widget.lines)
|
||||
l->top = l->top->next;
|
||||
} else {
|
||||
l->top = l->current;
|
||||
}
|
||||
l->pos = pos;
|
||||
if (pos == dest) {
|
||||
l->pos = dest;
|
||||
if (!top_seen)
|
||||
l->top = l->pos;
|
||||
else
|
||||
if (l->pos - l->top >= l->widget.lines)
|
||||
l->top = l->pos - l->widget.lines + 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we are unable to find it, set decent values */
|
||||
l->current = l->top = l->list;
|
||||
l->pos = 0;
|
||||
l->pos = l->top = 0;
|
||||
}
|
||||
|
||||
/* Selects from base the pos element */
|
||||
static WLEntry *
|
||||
listbox_select_pos (WListbox *l, WLEntry *base, int pos)
|
||||
static int
|
||||
listbox_select_pos (WListbox *l, int base, int pos)
|
||||
{
|
||||
WLEntry *last = l->list->prev;
|
||||
int last = l->count - 1;
|
||||
|
||||
base += pos;
|
||||
if (base >= last)
|
||||
base = last;
|
||||
|
||||
if (base == last)
|
||||
return last;
|
||||
while (pos--){
|
||||
base = base->next;
|
||||
if (base == last)
|
||||
break;
|
||||
}
|
||||
return base;
|
||||
}
|
||||
|
||||
static void
|
||||
listbox_fwd (WListbox *l)
|
||||
{
|
||||
if (l->pos + 1 >= l->count)
|
||||
listbox_select_first (l);
|
||||
else
|
||||
listbox_select_entry (l, l->pos + 1);
|
||||
}
|
||||
|
||||
static void
|
||||
listbox_back (WListbox *l)
|
||||
{
|
||||
if (l->pos != 0)
|
||||
listbox_select_entry (l, l->current->prev);
|
||||
else
|
||||
if (l->pos <= 0)
|
||||
listbox_select_last (l);
|
||||
else
|
||||
listbox_select_entry (l, l->pos - 1);
|
||||
}
|
||||
|
||||
/* Return MSG_HANDLED if we want a redraw */
|
||||
@ -2298,16 +2263,16 @@ listbox_key (WListbox *l, int key)
|
||||
/* focus on listbox item N by '0'..'9' keys */
|
||||
if (key >= '0' && key <= '9') {
|
||||
int oldpos = l->pos;
|
||||
listbox_select_by_number(l, key - '0');
|
||||
listbox_select_entry (l, key - '0');
|
||||
|
||||
/* need scroll to item? */
|
||||
if (abs(oldpos - l->pos) > l->widget.lines)
|
||||
l->top = l->current;
|
||||
if (abs (oldpos - l->pos) > l->widget.lines)
|
||||
l->top = l->pos;
|
||||
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
|
||||
if (!l->list)
|
||||
if (l->list == NULL)
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
switch (key){
|
||||
@ -2335,8 +2300,7 @@ listbox_key (WListbox *l, int key)
|
||||
|
||||
case KEY_NPAGE:
|
||||
case XCTRL('v'):
|
||||
for (i = 0; ((i < l->widget.lines - 1)
|
||||
&& (l->current != l->list->prev)); i++) {
|
||||
for (i = 0; ((i < l->widget.lines - 1) && (l->pos < l->count - 1)); i++) {
|
||||
listbox_fwd (l);
|
||||
j = MSG_HANDLED;
|
||||
}
|
||||
@ -2344,8 +2308,7 @@ listbox_key (WListbox *l, int key)
|
||||
|
||||
case KEY_PPAGE:
|
||||
case ALT('v'):
|
||||
for (i = 0; ((i < l->widget.lines - 1)
|
||||
&& (l->current != l->list)); i++) {
|
||||
for (i = 0; ((i < l->widget.lines - 1) && (l->pos > 0)); i++) {
|
||||
listbox_back (l);
|
||||
j = MSG_HANDLED;
|
||||
}
|
||||
@ -2354,18 +2317,10 @@ listbox_key (WListbox *l, int key)
|
||||
return MSG_NOT_HANDLED;
|
||||
}
|
||||
|
||||
static void
|
||||
static inline void
|
||||
listbox_destroy (WListbox *l)
|
||||
{
|
||||
WLEntry *n, *p = l->list;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < l->count; i++){
|
||||
n = p->next;
|
||||
g_free (p->text);
|
||||
g_free (p);
|
||||
p = n;
|
||||
}
|
||||
listbox_remove_list (l);
|
||||
}
|
||||
|
||||
static cb_ret_t
|
||||
@ -2373,7 +2328,6 @@ listbox_callback (Widget *w, widget_msg_t msg, int parm)
|
||||
{
|
||||
WListbox *l = (WListbox *) w;
|
||||
Dlg_head *h = l->widget.parent;
|
||||
WLEntry *e;
|
||||
cb_ret_t ret_code;
|
||||
|
||||
switch (msg) {
|
||||
@ -2381,15 +2335,18 @@ listbox_callback (Widget *w, widget_msg_t msg, int parm)
|
||||
return MSG_HANDLED;
|
||||
|
||||
case WIDGET_HOTKEY:
|
||||
e = listbox_check_hotkey (l, parm);
|
||||
if (e != NULL) {
|
||||
int action;
|
||||
{
|
||||
int pos, action;
|
||||
|
||||
listbox_select_entry (l, e);
|
||||
pos = listbox_check_hotkey (l, parm);
|
||||
if (pos < 0)
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
listbox_select_entry (l, pos);
|
||||
h->callback (h, w, DLG_ACTION, l->pos, NULL);
|
||||
|
||||
if (l->cback)
|
||||
action = (*l->cback) (l);
|
||||
if (l->cback != NULL)
|
||||
action = l->cback (l);
|
||||
else
|
||||
action = LISTBOX_DONE;
|
||||
|
||||
@ -2397,9 +2354,9 @@ listbox_callback (Widget *w, widget_msg_t msg, int parm)
|
||||
h->ret_value = B_ENTER;
|
||||
dlg_stop (h);
|
||||
}
|
||||
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
case WIDGET_KEY:
|
||||
ret_code = listbox_key (l, parm);
|
||||
@ -2466,9 +2423,7 @@ listbox_event (Gpm_Event *event, void *data)
|
||||
listbox_fwd (l);
|
||||
ret = MOU_NORMAL;
|
||||
} else
|
||||
listbox_select_entry (l,
|
||||
listbox_select_pos (l, l->top,
|
||||
event->y - 1));
|
||||
listbox_select_entry (l, listbox_select_pos (l, l->top, event->y - 1));
|
||||
|
||||
/* We need to refresh ourselves since the dialog manager doesn't */
|
||||
/* know about this event */
|
||||
@ -2485,12 +2440,10 @@ listbox_event (Gpm_Event *event, void *data)
|
||||
return MOU_NORMAL;
|
||||
|
||||
dlg_select_widget (l);
|
||||
listbox_select_entry (l,
|
||||
listbox_select_pos (l, l->top,
|
||||
event->y - 1));
|
||||
listbox_select_entry (l, listbox_select_pos (l, l->top, event->y - 1));
|
||||
|
||||
if (l->cback)
|
||||
action = (*l->cback) (l);
|
||||
if (l->cback != NULL)
|
||||
action = l->cback (l);
|
||||
else
|
||||
action = LISTBOX_DONE;
|
||||
|
||||
@ -2514,79 +2467,66 @@ listbox_new (int y, int x, int height, int width, lcback callback)
|
||||
init_widget (&l->widget, y, x, height, width,
|
||||
listbox_callback, listbox_event);
|
||||
|
||||
l->list = l->top = l->current = 0;
|
||||
l->pos = 0;
|
||||
l->list = NULL;
|
||||
l->top = l->pos = 0;
|
||||
l->count = 0;
|
||||
l->cback = callback;
|
||||
l->allow_duplicates = 1;
|
||||
l->allow_duplicates = TRUE;
|
||||
l->scrollbar = !tty_is_slow ();
|
||||
widget_want_hotkey (l->widget, 1);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
/* Listbox item adding function. They still lack a lot of functionality */
|
||||
/* any takers? */
|
||||
/* 1.11.96 bor: added pos argument to control placement of new entry */
|
||||
static void
|
||||
listbox_append_item (WListbox *l, WLEntry *e, enum append_pos pos)
|
||||
static int
|
||||
listbox_entry_cmp (const void *a, const void *b)
|
||||
{
|
||||
if (!l->list){
|
||||
l->list = e;
|
||||
l->top = e;
|
||||
l->current = e;
|
||||
e->next = l->list;
|
||||
e->prev = l->list;
|
||||
} else if (pos == LISTBOX_APPEND_AT_END) {
|
||||
e->next = l->list;
|
||||
e->prev = l->list->prev;
|
||||
l->list->prev->next = e;
|
||||
l->list->prev = e;
|
||||
} else if (pos == LISTBOX_APPEND_BEFORE){
|
||||
e->next = l->current;
|
||||
e->prev = l->current->prev;
|
||||
l->current->prev->next = e;
|
||||
l->current->prev = e;
|
||||
if (l->list == l->current) { /* move list one position down */
|
||||
l->list = e;
|
||||
l->top = e;
|
||||
}
|
||||
} else if (pos == LISTBOX_APPEND_AFTER) {
|
||||
e->prev = l->current;
|
||||
e->next = l->current->next;
|
||||
l->current->next->prev = e;
|
||||
l->current->next = e;
|
||||
} else if (pos == LISTBOX_APPEND_SORTED) {
|
||||
WLEntry *w = l->list;
|
||||
const WLEntry *ea = (const WLEntry *) a;
|
||||
const WLEntry *eb = (const WLEntry *) b;
|
||||
|
||||
while (w->next != l->list && strcmp (e->text, w->text) > 0)
|
||||
w = w->next;
|
||||
if (w->next == l->list) {
|
||||
e->prev = w;
|
||||
e->next = l->list;
|
||||
w->next = e;
|
||||
l->list->prev = e;
|
||||
} else {
|
||||
e->next = w;
|
||||
e->prev = w->prev;
|
||||
w->prev->next = e;
|
||||
w->prev = e;
|
||||
}
|
||||
return strcmp (ea->text, eb->text);
|
||||
}
|
||||
|
||||
/* Listbox item adding function */
|
||||
static inline void
|
||||
listbox_append_item (WListbox *l, WLEntry *e, listbox_append_t pos)
|
||||
{
|
||||
switch (pos) {
|
||||
case LISTBOX_APPEND_AT_END:
|
||||
l->list = g_list_append (l->list, e);
|
||||
break;
|
||||
|
||||
case LISTBOX_APPEND_BEFORE:
|
||||
l->list = g_list_insert_before (l->list, g_list_nth (l->list, l->pos), e);
|
||||
if (l->pos > 0)
|
||||
l->pos--;
|
||||
break;
|
||||
|
||||
case LISTBOX_APPEND_AFTER:
|
||||
l->list = g_list_insert (l->list, e, l->pos + 1);
|
||||
break;
|
||||
|
||||
case LISTBOX_APPEND_SORTED:
|
||||
l->list = g_list_insert_sorted (l->list, e, (GCompareFunc) listbox_entry_cmp);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
l->count++;
|
||||
}
|
||||
|
||||
char *
|
||||
listbox_add_item (WListbox *l, enum append_pos pos, int hotkey,
|
||||
listbox_add_item (WListbox *l, listbox_append_t pos, int hotkey,
|
||||
const char *text, void *data)
|
||||
{
|
||||
WLEntry *entry;
|
||||
|
||||
if (!l)
|
||||
if (l == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!l->allow_duplicates)
|
||||
if (listbox_search_text (l, text))
|
||||
if (!l->allow_duplicates && (listbox_search_text (l, text) >= 0))
|
||||
return NULL;
|
||||
|
||||
entry = g_new (WLEntry, 1);
|
||||
@ -2599,45 +2539,46 @@ listbox_add_item (WListbox *l, enum append_pos pos, int hotkey,
|
||||
return entry->text;
|
||||
}
|
||||
|
||||
/* Selects the nth entry in the listbox */
|
||||
void
|
||||
listbox_select_by_number (WListbox *l, int n)
|
||||
{
|
||||
if (l->list != NULL)
|
||||
listbox_select_entry (l, listbox_select_pos (l, l->list, n));
|
||||
}
|
||||
|
||||
WLEntry *
|
||||
int
|
||||
listbox_search_text (WListbox *l, const char *text)
|
||||
{
|
||||
WLEntry *e;
|
||||
if (l != NULL) {
|
||||
int i;
|
||||
GList *le;
|
||||
|
||||
e = l->list;
|
||||
if (!e)
|
||||
return NULL;
|
||||
for (i = 0, le = l->list; le != NULL; i++, le = g_list_next (le)) {
|
||||
WLEntry *e = (WLEntry *) le->data;
|
||||
|
||||
do {
|
||||
if(!strcmp (e->text, text))
|
||||
return e;
|
||||
e = e->next;
|
||||
} while (e!=l->list);
|
||||
if (strcmp (e->text, text) == 0)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Returns the current string text as well as the associated extra data */
|
||||
void
|
||||
listbox_get_current (WListbox *l, char **string, char **extra)
|
||||
listbox_get_current (WListbox *l, char **string, void **extra)
|
||||
{
|
||||
gboolean ok = (l != NULL) && (l->current != NULL);
|
||||
WLEntry *e = NULL;
|
||||
gboolean ok;
|
||||
|
||||
if (l != NULL)
|
||||
e = (WLEntry *) g_list_nth_data (l->list, l->pos);
|
||||
|
||||
ok = (e != NULL);
|
||||
|
||||
if (string != NULL)
|
||||
*string = ok ? l->current->text : NULL;
|
||||
*string = ok ? e->text : NULL;
|
||||
|
||||
if (extra != NULL)
|
||||
*extra = ok ? l->current->data : NULL;
|
||||
*extra = ok ? e->data : NULL;
|
||||
}
|
||||
|
||||
|
||||
/* ButtonBar widget */
|
||||
|
||||
/* returns TRUE if a function has been called, FALSE otherwise. */
|
||||
static gboolean
|
||||
buttonbar_call (WButtonBar *bb, int i)
|
||||
|
30
src/widget.h
30
src/widget.h
@ -132,8 +132,6 @@ typedef struct WLEntry {
|
||||
char *text; /* Text to display */
|
||||
int hotkey;
|
||||
void *data; /* Client information */
|
||||
struct WLEntry *next;
|
||||
struct WLEntry *prev;
|
||||
} WLEntry;
|
||||
|
||||
struct WListbox;
|
||||
@ -148,13 +146,12 @@ enum {
|
||||
|
||||
struct WListbox {
|
||||
Widget widget;
|
||||
WLEntry *list; /* Pointer to the circular double linked list. */
|
||||
WLEntry *top; /* The first element displayed */
|
||||
WLEntry *current; /* The current element displayed */
|
||||
int pos; /* Cur. pos, must be kept in sync with current */
|
||||
GList *list; /* Pointer to the double linked list */
|
||||
int pos; /* The current element displayed */
|
||||
int top; /* The first element displayed */
|
||||
int count; /* Number of items in the listbox */
|
||||
int allow_duplicates; /* Do we allow duplicates on the list? */
|
||||
int scrollbar; /* Draw a scrollbar? */
|
||||
gboolean allow_duplicates; /* Do we allow duplicates on the list? */
|
||||
gboolean scrollbar; /* Draw a scrollbar? */
|
||||
lcback cback; /* The callback function */
|
||||
int cursor_x, cursor_y; /* Cache the values */
|
||||
};
|
||||
@ -226,24 +223,23 @@ int button_get_len (const WButton *b);
|
||||
WLEntry *listbox_get_data (WListbox *l, int pos);
|
||||
|
||||
/* search text int listbox entries */
|
||||
WLEntry *listbox_search_text (WListbox *l, const char *text);
|
||||
void listbox_select_entry (WListbox *l, WLEntry *dest);
|
||||
void listbox_select_by_number (WListbox *l, int n);
|
||||
void listbox_select_last (WListbox *l);
|
||||
int listbox_search_text (WListbox *l, const char *text);
|
||||
void listbox_select_entry (WListbox *l, int dest);
|
||||
void listbox_select_first (WListbox *l);
|
||||
void listbox_select_last (WListbox *l);
|
||||
void listbox_remove_current (WListbox *l);
|
||||
void listbox_remove_list (WListbox *l);
|
||||
void listbox_get_current (WListbox *l, char **string, char **extra);
|
||||
void listbox_get_current (WListbox *l, char **string, void **extra);
|
||||
|
||||
enum append_pos {
|
||||
typedef enum {
|
||||
LISTBOX_APPEND_AT_END = 0, /* append at the end */
|
||||
LISTBOX_APPEND_BEFORE, /* insert before current */
|
||||
LISTBOX_APPEND_AFTER, /* insert after current */
|
||||
LISTBOX_APPEND_SORTED /* insert alphabetically */
|
||||
};
|
||||
} listbox_append_t;
|
||||
|
||||
char *listbox_add_item (WListbox *l, enum append_pos pos, int
|
||||
hotkey, const char *text, void *data);
|
||||
char *listbox_add_item (WListbox *l, listbox_append_t pos,
|
||||
int hotkey, const char *text, void *data);
|
||||
|
||||
struct global_keymap_t;
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user