mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
Added deletable member to WListbox structure.
Added deletable member to WListbox structure to enable delete some list entries. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
1695465594
commit
1947d842a5
@ -268,7 +268,7 @@ do_enter_key (Dlg_head * h, int f_pos)
|
|||||||
"[Advanced Chown]", title, DLG_COMPACT | DLG_REVERSE);
|
"[Advanced Chown]", title, DLG_COMPACT | DLG_REVERSE);
|
||||||
|
|
||||||
/* get new listboxes */
|
/* get new listboxes */
|
||||||
chl_list = listbox_new (1, 1, 11, 15, NULL);
|
chl_list = listbox_new (1, 1, 11, 15, FALSE, NULL);
|
||||||
|
|
||||||
listbox_add_item (chl_list, LISTBOX_APPEND_AT_END, 0,
|
listbox_add_item (chl_list, LISTBOX_APPEND_AT_END, 0,
|
||||||
"<Unknown>", NULL);
|
"<Unknown>", NULL);
|
||||||
|
@ -952,7 +952,7 @@ jobs_cmd (void)
|
|||||||
"[Background jobs]", _("Background Jobs"),
|
"[Background jobs]", _("Background Jobs"),
|
||||||
DLG_CENTER | DLG_REVERSE);
|
DLG_CENTER | DLG_REVERSE);
|
||||||
|
|
||||||
bg_list = listbox_new (2, 3, JOBS_Y - 9, JOBS_X - 7, NULL);
|
bg_list = listbox_new (2, 3, JOBS_Y - 9, JOBS_X - 7, FALSE, NULL);
|
||||||
add_widget (jobs_dlg, bg_list);
|
add_widget (jobs_dlg, bg_list);
|
||||||
|
|
||||||
i = n_buttons;
|
i = n_buttons;
|
||||||
|
@ -181,8 +181,8 @@ init_chown (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get new listboxes */
|
/* get new listboxes */
|
||||||
l_user = listbox_new (UY + 1, UX + 1, 10, 19, NULL);
|
l_user = listbox_new (UY + 1, UX + 1, 10, 19, FALSE, NULL);
|
||||||
l_group = listbox_new (GY + 1, GX + 1, 10, 19, NULL);
|
l_group = listbox_new (GY + 1, GX + 1, 10, 19, FALSE, NULL);
|
||||||
|
|
||||||
/* add fields for unknown names (numbers) */
|
/* add fields for unknown names (numbers) */
|
||||||
listbox_add_item (l_user, LISTBOX_APPEND_AT_END, 0, _("<Unknown user>"), NULL);
|
listbox_add_item (l_user, LISTBOX_APPEND_AT_END, 0, _("<Unknown user>"), NULL);
|
||||||
|
@ -1106,7 +1106,7 @@ complete_engine (WInput *in, int what_to_do)
|
|||||||
query_dlg = create_dlg (y, x, query_height, query_width,
|
query_dlg = create_dlg (y, x, query_height, query_width,
|
||||||
dialog_colors, query_callback,
|
dialog_colors, query_callback,
|
||||||
"[Completion]", NULL, DLG_COMPACT);
|
"[Completion]", NULL, DLG_COMPACT);
|
||||||
query_list = listbox_new (1, 1, h - 2, w - 2, NULL);
|
query_list = listbox_new (1, 1, h - 2, w - 2, FALSE, NULL);
|
||||||
add_widget (query_dlg, query_list);
|
add_widget (query_dlg, query_list);
|
||||||
for (p = in->completions + 1; *p; p++)
|
for (p = in->completions + 1; *p; p++)
|
||||||
listbox_add_item (query_list, LISTBOX_APPEND_AT_END, 0, *p, NULL);
|
listbox_add_item (query_list, LISTBOX_APPEND_AT_END, 0, *p, NULL);
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#include "lib/mcconfig.h"
|
#include "lib/mcconfig.h"
|
||||||
#include "lib/skin.h"
|
#include "lib/skin.h"
|
||||||
#include "lib/strutil.h" /* utf string functions */
|
#include "lib/strutil.h" /* utf string functions */
|
||||||
|
#include "lib/vfs/mc-vfs/vfs.h"
|
||||||
|
|
||||||
#include "src/history.h"
|
#include "src/history.h"
|
||||||
#include "src/widget.h" /* listbox_new() */
|
#include "src/widget.h" /* listbox_new() */
|
||||||
@ -62,10 +63,7 @@
|
|||||||
#include "src/selcodepage.h"
|
#include "src/selcodepage.h"
|
||||||
#include "src/cmddef.h"
|
#include "src/cmddef.h"
|
||||||
|
|
||||||
#include "lib/vfs/mc-vfs/vfs.h"
|
|
||||||
|
|
||||||
#include "src/editor/edit-impl.h"
|
#include "src/editor/edit-impl.h"
|
||||||
#include "src/editor/edit.h"
|
|
||||||
#include "src/editor/editlock.h"
|
#include "src/editor/editlock.h"
|
||||||
#include "src/editor/edit-widget.h"
|
#include "src/editor/edit-widget.h"
|
||||||
#include "src/editor/editcmd_dialogs.h"
|
#include "src/editor/editcmd_dialogs.h"
|
||||||
|
@ -340,7 +340,7 @@ editcmd_dialog_completion_show (WEdit * edit, int max_len, int word_len,
|
|||||||
dialog_colors, NULL, "[Completion]", NULL, DLG_COMPACT);
|
dialog_colors, NULL, "[Completion]", NULL, DLG_COMPACT);
|
||||||
|
|
||||||
/* create the listbox */
|
/* create the listbox */
|
||||||
compl_list = listbox_new (1, 1, compl_dlg_h - 2, compl_dlg_w - 2, NULL);
|
compl_list = listbox_new (1, 1, compl_dlg_h - 2, compl_dlg_w - 2, FALSE, NULL);
|
||||||
|
|
||||||
/* add the dialog */
|
/* add the dialog */
|
||||||
add_widget (compl_dlg, compl_list);
|
add_widget (compl_dlg, compl_list);
|
||||||
@ -425,12 +425,11 @@ editcmd_dialog_select_definition_show (WEdit * edit, char *match_expr, int max_l
|
|||||||
dialog_colors, NULL, "[Definitions]", match_expr, DLG_COMPACT);
|
dialog_colors, NULL, "[Definitions]", match_expr, DLG_COMPACT);
|
||||||
|
|
||||||
/* create the listbox */
|
/* create the listbox */
|
||||||
def_list = listbox_new (1, 1, def_dlg_h - 2, def_dlg_w - 2, NULL);
|
def_list = listbox_new (1, 1, def_dlg_h - 2, def_dlg_w - 2, FALSE, NULL);
|
||||||
|
|
||||||
/* add the dialog */
|
/* add the dialog */
|
||||||
add_widget (def_dlg, def_list);
|
add_widget (def_dlg, def_list);
|
||||||
|
|
||||||
|
|
||||||
/* fill the listbox with the completions */
|
/* fill the listbox with the completions */
|
||||||
for (i = 0; i < num_lines; i++) {
|
for (i = 0; i < num_lines; i++) {
|
||||||
label_def =
|
label_def =
|
||||||
@ -439,11 +438,9 @@ editcmd_dialog_select_definition_show (WEdit * edit, char *match_expr, int max_l
|
|||||||
listbox_add_item (def_list, LISTBOX_APPEND_AT_END, 0, label_def, &def_hash[i]);
|
listbox_add_item (def_list, LISTBOX_APPEND_AT_END, 0, label_def, &def_hash[i]);
|
||||||
g_free (label_def);
|
g_free (label_def);
|
||||||
}
|
}
|
||||||
/* pop up the dialog */
|
|
||||||
run_dlg (def_dlg);
|
|
||||||
|
|
||||||
/* apply the choosen completion */
|
/* pop up the dialog and apply the choosen completion */
|
||||||
if (def_dlg->ret_value == B_ENTER) {
|
if (run_dlg (def_dlg) == B_ENTER) {
|
||||||
char *tmp_curr_def = (char *) curr_def;
|
char *tmp_curr_def = (char *) curr_def;
|
||||||
int do_moveto = 0;
|
int do_moveto = 0;
|
||||||
|
|
||||||
@ -460,6 +457,7 @@ editcmd_dialog_select_definition_show (WEdit * edit, char *match_expr, int max_l
|
|||||||
} else {
|
} else {
|
||||||
do_moveto = 1;
|
do_moveto = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curr && do_moveto) {
|
if (curr && do_moveto) {
|
||||||
if (edit_stack_iterator + 1 < MAX_HISTORY_MOVETO) {
|
if (edit_stack_iterator + 1 < MAX_HISTORY_MOVETO) {
|
||||||
g_free (edit_history_moveto[edit_stack_iterator].filename);
|
g_free (edit_history_moveto[edit_stack_iterator].filename);
|
||||||
|
@ -1192,7 +1192,7 @@ setup_gui (void)
|
|||||||
add_widget (find_dlg, found_num_label);
|
add_widget (find_dlg, found_num_label);
|
||||||
|
|
||||||
find_list =
|
find_list =
|
||||||
listbox_new (2, 2, FIND2_Y - 10, FIND2_X - 4, NULL);
|
listbox_new (2, 2, FIND2_Y - 10, FIND2_X - 4, FALSE, NULL);
|
||||||
add_widget (find_dlg, find_list);
|
add_widget (find_dlg, find_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,7 +701,7 @@ init_hotlist (int list_type)
|
|||||||
/* get new listbox */
|
/* get new listbox */
|
||||||
l_hotlist =
|
l_hotlist =
|
||||||
listbox_new (UY + 1, UX + 1, LINES - 14, COLS - 2 * UX - 8,
|
listbox_new (UY + 1, UX + 1, LINES - 14, COLS - 2 * UX - 8,
|
||||||
l_call);
|
FALSE, l_call);
|
||||||
|
|
||||||
/* Fill the hotlist with the active VFS or the hotlist */
|
/* Fill the hotlist with the active VFS or the hotlist */
|
||||||
#ifdef ENABLE_VFS
|
#ifdef ENABLE_VFS
|
||||||
@ -749,7 +749,7 @@ init_movelist (int list_type, struct hotlist *item)
|
|||||||
/* get new listbox */
|
/* get new listbox */
|
||||||
l_movelist =
|
l_movelist =
|
||||||
listbox_new (UY + 1, UX + 1, movelist_dlg->lines - 8,
|
listbox_new (UY + 1, UX + 1, movelist_dlg->lines - 8,
|
||||||
movelist_dlg->cols - 2 * UX - 2, l_call);
|
movelist_dlg->cols - 2 * UX - 2, FALSE, l_call);
|
||||||
|
|
||||||
fill_listbox ();
|
fill_listbox ();
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ init_listmode (char *oldlistformat)
|
|||||||
radio_justify->sel = 1;
|
radio_justify->sel = 1;
|
||||||
|
|
||||||
/* get new listbox */
|
/* get new listbox */
|
||||||
l_listmode = listbox_new (UY + 5, UX + 1, 9, 16, NULL);
|
l_listmode = listbox_new (UY + 5, UX + 1, 9, 16, FALSE, NULL);
|
||||||
|
|
||||||
if (strncmp (oldlistformat, "full ", 5) == 0) {
|
if (strncmp (oldlistformat, "full ", 5) == 0) {
|
||||||
format_width = 1;
|
format_width = 1;
|
||||||
|
@ -180,7 +180,7 @@ init_panelize (void)
|
|||||||
|
|
||||||
/* get new listbox */
|
/* get new listbox */
|
||||||
l_panelize =
|
l_panelize =
|
||||||
listbox_new (UY + 1, UX + 1, 10, panelize_dlg->cols - 12, NULL);
|
listbox_new (UY + 1, UX + 1, 10, panelize_dlg->cols - 12, FALSE, NULL);
|
||||||
|
|
||||||
while (current) {
|
while (current) {
|
||||||
listbox_add_item (l_panelize, LISTBOX_APPEND_AT_END, 0, current->label, current);
|
listbox_add_item (l_panelize, LISTBOX_APPEND_AT_END, 0, current->label, current);
|
||||||
|
@ -1187,7 +1187,7 @@ show_hist (GList *history, Widget *widget)
|
|||||||
"[History-query]", i18n_htitle (), DLG_COMPACT);
|
"[History-query]", i18n_htitle (), DLG_COMPACT);
|
||||||
query_dlg->data = &hist_data;
|
query_dlg->data = &hist_data;
|
||||||
|
|
||||||
query_list = listbox_new (1, 1, 2, 2, NULL);
|
query_list = listbox_new (1, 1, 2, 2, TRUE, NULL);
|
||||||
|
|
||||||
/* this call makes list stick to all sides of dialog, effectively make
|
/* this call makes list stick to all sides of dialog, effectively make
|
||||||
it be resized with dialog */
|
it be resized with dialog */
|
||||||
@ -2454,7 +2454,7 @@ listbox_event (Gpm_Event *event, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WListbox *
|
WListbox *
|
||||||
listbox_new (int y, int x, int height, int width, lcback callback)
|
listbox_new (int y, int x, int height, int width, gboolean deletable, lcback callback)
|
||||||
{
|
{
|
||||||
WListbox *l = g_new (WListbox, 1);
|
WListbox *l = g_new (WListbox, 1);
|
||||||
|
|
||||||
@ -2467,6 +2467,7 @@ listbox_new (int y, int x, int height, int width, lcback callback)
|
|||||||
l->list = NULL;
|
l->list = NULL;
|
||||||
l->top = l->pos = 0;
|
l->top = l->pos = 0;
|
||||||
l->count = 0;
|
l->count = 0;
|
||||||
|
l->deletable = deletable;
|
||||||
l->cback = callback;
|
l->cback = callback;
|
||||||
l->allow_duplicates = TRUE;
|
l->allow_duplicates = TRUE;
|
||||||
l->scrollbar = !tty_is_slow ();
|
l->scrollbar = !tty_is_slow ();
|
||||||
|
@ -152,6 +152,7 @@ struct WListbox {
|
|||||||
int count; /* Number of items in the listbox */
|
int count; /* Number of items in the listbox */
|
||||||
gboolean allow_duplicates; /* Do we allow duplicates on the list? */
|
gboolean allow_duplicates; /* Do we allow duplicates on the list? */
|
||||||
gboolean scrollbar; /* Draw a scrollbar? */
|
gboolean scrollbar; /* Draw a scrollbar? */
|
||||||
|
gboolean deletable; /* Can list entries be deleted? */
|
||||||
lcback cback; /* The callback function */
|
lcback cback; /* The callback function */
|
||||||
int cursor_x, cursor_y; /* Cache the values */
|
int cursor_x, cursor_y; /* Cache the values */
|
||||||
};
|
};
|
||||||
@ -187,7 +188,7 @@ WCheck *check_new (int y, int x, int state, const char *text);
|
|||||||
WInput *input_new (int y, int x, int color, int len, const char *text, const char *histname, INPUT_COMPLETE_FLAGS completion_flags);
|
WInput *input_new (int y, int x, int color, int len, const char *text, const char *histname, INPUT_COMPLETE_FLAGS completion_flags);
|
||||||
WLabel *label_new (int y, int x, const char *text);
|
WLabel *label_new (int y, int x, const char *text);
|
||||||
WGauge *gauge_new (int y, int x, int shown, int max, int current);
|
WGauge *gauge_new (int y, int x, int shown, int max, int current);
|
||||||
WListbox *listbox_new (int y, int x, int height, int width, lcback callback);
|
WListbox *listbox_new (int y, int x, int height, int width, gboolean deletable, lcback callback);
|
||||||
WButtonBar *buttonbar_new (gboolean visible);
|
WButtonBar *buttonbar_new (gboolean visible);
|
||||||
WGroupbox *groupbox_new (int y, int x, int height, int width, const char *title);
|
WGroupbox *groupbox_new (int y, int x, int height, int width, const char *title);
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ create_listbox_window_centered (int center_y, int center_x, int lines, int cols,
|
|||||||
listbox_colors, NULL,
|
listbox_colors, NULL,
|
||||||
help, title, DLG_REVERSE | DLG_TRYUP);
|
help, title, DLG_REVERSE | DLG_TRYUP);
|
||||||
|
|
||||||
listbox->list = listbox_new (2, 2, lines, cols, NULL);
|
listbox->list = listbox_new (2, 2, lines, cols, FALSE, NULL);
|
||||||
add_widget (listbox->dlg, listbox->list);
|
add_widget (listbox->dlg, listbox->list);
|
||||||
|
|
||||||
return listbox;
|
return listbox;
|
||||||
|
Loading…
Reference in New Issue
Block a user