Merge branch 'm-utf-8' of ssh://angel_il@midnight-commander.org:2222/git/mc into m-utf-8

This commit is contained in:
Ilia Maslakov 2009-04-15 18:17:26 +00:00
commit a71e58bcdb
17 changed files with 71 additions and 69 deletions

View File

@ -2840,7 +2840,7 @@ edit_completion_dialog (WEdit * edit, int max_len, int word_len,
/* create the listbox */
compl_list =
listbox_new (1, 1, compl_dlg_w - 2, compl_dlg_h - 2, NULL);
listbox_new (1, 1, compl_dlg_h - 2, compl_dlg_w - 2, NULL);
/* add the dialog */
add_widget (compl_dlg, compl_list);
@ -3078,7 +3078,7 @@ edit_select_definition_dialog (WEdit * edit, char *match_expr, int max_len, int
DLG_COMPACT);
/* create the listbox */
def_list = listbox_new (1, 1, def_dlg_w - 2, def_dlg_h - 2, NULL);
def_list = listbox_new (1, 1, def_dlg_h - 2, def_dlg_w - 2, NULL);
/* add the dialog */
add_widget (def_dlg, def_list);

View File

@ -258,7 +258,7 @@ do_enter_key (Dlg_head * h, int f_pos)
"[Advanced Chown]", title, DLG_COMPACT | DLG_REVERSE);
/* get new listboxes */
chl_list = listbox_new (1, 1, 15, 11, NULL);
chl_list = listbox_new (1, 1, 11, 15, NULL);
listbox_add_item (chl_list, LISTBOX_APPEND_AT_END, 0,
"<Unknown>", NULL);

View File

@ -999,7 +999,7 @@ jobs_cmd (void)
"[Background jobs]", _("Background Jobs"),
DLG_CENTER | DLG_REVERSE);
bg_list = listbox_new (2, 3, JOBS_X-7, JOBS_Y-9, 0);
bg_list = listbox_new (2, 3, JOBS_Y - 9, JOBS_X - 7, NULL);
add_widget (jobs_dlg, bg_list);
i = n_buttons;

View File

@ -172,8 +172,8 @@ init_chown (void)
}
/* get new listboxes */
l_user = listbox_new (UY + 1, UX + 1, 19, 10, NULL);
l_group = listbox_new (GY + 1, GX + 1, 19, 10, NULL);
l_user = listbox_new (UY + 1, UX + 1, 10, 19, NULL);
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);

View File

@ -1088,7 +1088,7 @@ complete_engine (WInput *in, int what_to_do)
query_dlg = create_dlg (y, x, query_height, query_width,
dialog_colors, query_callback,
"[Completion]", NULL, DLG_COMPACT);
query_list = listbox_new (1, 1, w - 2, h - 2, NULL);
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);

View File

@ -49,8 +49,8 @@ typedef enum {
} widget_msg_t;
typedef enum {
MSG_NOT_HANDLED,
MSG_HANDLED
MSG_NOT_HANDLED = 0,
MSG_HANDLED = 1
} cb_ret_t;
/* Widgets are expected to answer to the following messages:

View File

@ -944,7 +944,7 @@ setup_gui (void)
add_widget (find_dlg, status_label);
find_list =
listbox_new (2, 2, FIND2_X - 4, FIND2_Y - 9, 0);
listbox_new (2, 2, FIND2_Y - 9, FIND2_X - 4, NULL);
add_widget (find_dlg, find_list);
}

View File

@ -652,7 +652,7 @@ init_hotlist (int list_type)
}
/* get new listbox */
l_hotlist =
listbox_new (UY + 1, UX + 1, COLS - 2 * UX - 8, LINES - 14,
listbox_new (UY + 1, UX + 1, LINES - 14, COLS - 2 * UX - 8,
l_call);
/* Fill the hotlist with the active VFS or the hotlist */
@ -700,8 +700,8 @@ init_movelist (int list_type, struct hotlist *item)
add_widget (movelist_dlg, movelist_group);
/* get new listbox */
l_movelist =
listbox_new (UY + 1, UX + 1, movelist_dlg->cols - 2 * UX - 2,
movelist_dlg->lines - 8, l_call);
listbox_new (UY + 1, UX + 1, movelist_dlg->lines - 8,
movelist_dlg->cols - 2 * UX - 2, l_call);
fill_listbox ();

View File

@ -439,10 +439,10 @@ init_layout (void)
dialog_colors, layout_callback, "[Layout]",
_("Layout"), DLG_CENTER | DLG_REVERSE);
add_widget (layout_dlg, groupbox_new (4, 2, first_width, 6, title1));
add_widget (layout_dlg, groupbox_new (4, 8, first_width, 4, title2));
add_widget (layout_dlg, groupbox_new (2, 4, 6, first_width, title1));
add_widget (layout_dlg, groupbox_new (8, 4, 4, first_width, title2));
add_widget (layout_dlg,
groupbox_new (5 + first_width, 2, second_width, 10,
groupbox_new (2, 5 + first_width, 10, second_width,
title3));
add_widget (layout_dlg,

View File

@ -173,10 +173,10 @@ init_listmode (char *oldlistformat)
"Listing format edit", DLG_CENTER | DLG_REVERSE);
add_widget (listmode_dlg,
groupbox_new (UX, UY, 63, 4, "General options"));
add_widget (listmode_dlg, groupbox_new (UX, UY + 4, 18, 11, "Items"));
groupbox_new (UY, UX, 4, 63, "General options"));
add_widget (listmode_dlg, groupbox_new (UY + 4, UX, 11, 18, "Items"));
add_widget (listmode_dlg,
groupbox_new (UX + 20, UY + 4, 43, 11, "Item options"));
groupbox_new (UY + 4, UX + 20, 11, 43, "Item options"));
for (i = 0;
i < sizeof (listmode_but) / sizeof (struct listmode_button); i++)
@ -205,7 +205,7 @@ init_listmode (char *oldlistformat)
radio_justify->sel = 1;
/* get new listbox */
l_listmode = listbox_new (UY + 5, UX + 1, 16, 9, NULL);
l_listmode = listbox_new (UY + 5, UX + 1, 9, 16, NULL);
if (strncmp (oldlistformat, "full ", 5) == 0) {
format_width = 1;

View File

@ -18,12 +18,13 @@ enum {
#define ACS_VLINE SLSMG_VLINE_CHAR
#define ACS_HLINE SLSMG_HLINE_CHAR
#define ACS_LTEE SLSMG_LTEE_CHAR
#define ACS_RTEE SLSMG_RTEE_CHAR
#define ACS_ULCORNER SLSMG_ULCORN_CHAR
#define ACS_LLCORNER SLSMG_LLCORN_CHAR
#define ACS_URCORNER SLSMG_URCORN_CHAR
#define ACS_LRCORNER SLSMG_LRCORN_CHAR
#define ACS_LTEE 't'
#define acs() SLsmg_set_char_set(1)
#define noacs() SLsmg_set_char_set (0)
#define baudrate() SLang_TT_Baud_Rate

View File

@ -172,13 +172,13 @@ init_configure (void)
_("Configure options"), DLG_CENTER | DLG_REVERSE);
add_widget (conf_dlg,
groupbox_new (PX, PY, first_width, PANEL_OPTIONS + 2, title1));
groupbox_new (PY, PX, PANEL_OPTIONS + 2, first_width, title1));
add_widget (conf_dlg,
groupbox_new (RX, RY, first_width, PAUSE_OPTIONS + 2, title2));
groupbox_new (RY, RX, PAUSE_OPTIONS + 2, first_width, title2));
add_widget (conf_dlg,
groupbox_new (OX, OY, second_width, OTHER_OPTIONS + 2, title3));
groupbox_new (OY, OX, OTHER_OPTIONS + 2, second_width, title3));
add_widget (conf_dlg,
button_new (BY, b3, B_CANCEL, NORMAL_BUTTON,

View File

@ -172,7 +172,7 @@ init_panelize (void)
/* get new listbox */
l_panelize =
listbox_new (UY + 1, UX + 1, panelize_dlg->cols - 12, 10, NULL);
listbox_new (UY + 1, UX + 1, 10, panelize_dlg->cols - 12, NULL);
while (current) {
listbox_add_item (l_panelize, 0, 0, current->label, current);

View File

@ -774,15 +774,13 @@ show_dir (WPanel *panel)
panel->widget.y, panel->widget.x,
panel->widget.lines, panel->widget.cols);
#ifdef HAVE_SLANG
if (show_mini_info) {
SLsmg_draw_object (panel->widget.y + llines (panel) + 2,
panel->widget.x, SLSMG_LTEE_CHAR);
SLsmg_draw_object (panel->widget.y + llines (panel) + 2,
panel->widget.x + panel->widget.cols - 1,
SLSMG_RTEE_CHAR);
widget_move (&panel->widget, llines (panel) + 2, 0);
tty_print_alt_char (ACS_LTEE);
widget_move (&panel->widget, llines (panel) + 2,
panel->widget.cols - 1);
tty_print_alt_char (ACS_RTEE);
}
#endif /* HAVE_SLANG */
if (panel->active)
attrset (REVERSE_COLOR);

View File

@ -156,10 +156,9 @@ button_callback (Widget *w, widget_msg_t msg, int parm)
if (b->text.hotkey != NULL) {
if (g_ascii_tolower ((gchar)b->text.hotkey[0]) ==
g_ascii_tolower ((gchar)parm)) {
button_callback (w, WIDGET_KEY, ' ');
return MSG_HANDLED;
}
button_callback (w, WIDGET_KEY, ' ');
return MSG_HANDLED;
}
}
return MSG_NOT_HANDLED;
@ -204,7 +203,7 @@ button_callback (Widget *w, widget_msg_t msg, int parm)
widget_selectcolor (w, b->selected, FALSE);
widget_move (w, 0, 0);
switch (b->flags) {
case DEFPUSH_BUTTON:
addstr ("[< ");
@ -221,11 +220,11 @@ button_callback (Widget *w, widget_msg_t msg, int parm)
}
addstr (str_term_form (b->text.start));
if (b->text.hotkey != NULL) {
widget_selectcolor (w, b->selected, TRUE);
addstr (str_term_form (b->text.hotkey));
widget_selectcolor (w, b->selected, FALSE);
widget_selectcolor (w, b->selected, FALSE);
}
if (b->text.end != NULL) {
@ -243,7 +242,6 @@ button_callback (Widget *w, widget_msg_t msg, int parm)
addstr ("]");
break;
}
return MSG_HANDLED;
case WIDGET_DESTROY:
@ -411,7 +409,7 @@ radio_callback (Widget *w, widget_msg_t msg, int parm)
widget_move (&r->widget, i, 0);
addstr ((r->sel == i) ? "(*) " : "( ) ");
addstr (str_term_form (r->texts[i].start));
if (r->texts[i].hotkey != NULL) {
@ -431,7 +429,7 @@ radio_callback (Widget *w, widget_msg_t msg, int parm)
}
g_free (r->texts);
return MSG_HANDLED;
default:
return default_proc (msg, parm);
}
@ -501,10 +499,10 @@ check_callback (Widget *w, widget_msg_t msg, int parm)
if (c->text.hotkey != NULL) {
if (g_ascii_tolower ((gchar)c->text.hotkey[0]) ==
g_ascii_tolower ((gchar)parm)) {
check_callback (w, WIDGET_KEY, ' '); /* make action */
return MSG_HANDLED;
}
check_callback (w, WIDGET_KEY, ' '); /* make action */
return MSG_HANDLED;
}
}
return MSG_NOT_HANDLED;
@ -535,7 +533,7 @@ check_callback (Widget *w, widget_msg_t msg, int parm)
addstr (str_term_form (c->text.hotkey));
widget_selectcolor (w, msg == WIDGET_FOCUS, FALSE);
}
if (c->text.end != NULL) {
addstr (str_term_form (c->text.end));
}
@ -624,7 +622,7 @@ label_callback (Widget *w, widget_msg_t msg, int parm)
widget_move (&l->widget, y, 0);
addstr (str_fit_to_term (p, l->widget.cols, J_LEFT));
if (q == NULL)
break;
q[0] = c;
@ -704,7 +702,7 @@ gauge_callback (Widget *w, widget_msg_t msg, int parm)
if (msg == WIDGET_INIT)
return MSG_HANDLED;
/* We don't want to get the focus */
if (msg == WIDGET_FOCUS)
return MSG_NOT_HANDLED;
@ -717,7 +715,7 @@ gauge_callback (Widget *w, widget_msg_t msg, int parm)
else {
int percentage, columns;
long total = g->max, done = g->current;
if (total <= 0 || done < 0) {
done = 0;
total = 100;
@ -738,6 +736,7 @@ gauge_callback (Widget *w, widget_msg_t msg, int parm)
}
return MSG_HANDLED;
}
return default_proc (msg, parm);
}
@ -1060,7 +1059,7 @@ show_hist (GList *history, int widget_x, int widget_y)
query_dlg =
create_dlg (y, x, h, w, dialog_colors, NULL, "[History-query]",
i18n_htitle (), DLG_COMPACT);
query_list = listbox_new (1, 1, w - 2, h - 2, 0);
query_list = listbox_new (1, 1, h - 2, w - 2, NULL);
add_widget (query_dlg, query_list);
hi = z;
if (y < widget_y) {
@ -1230,16 +1229,18 @@ insert_char (WInput *in, int c_code)
if (c_code == -1)
return MSG_NOT_HANDLED;
if (in->charpoint >= MB_LEN_MAX) return 1;
if (in->charpoint >= MB_LEN_MAX)
return MSG_HANDLED;
in->charbuf[in->charpoint] = c_code;
in->charpoint++;
res = str_is_valid_char (in->charbuf, in->charpoint);
if (res < 0) {
if (res != -2) in->charpoint = 0; /* broken multibyte char, skip */
return 1;
if (res != -2)
in->charpoint = 0; /* broken multibyte char, skip */
return MSG_HANDLED;
}
in->need_push = 1;
@ -1253,7 +1254,7 @@ insert_char (WInput *in, int c_code)
in->current_max_size = new_length;
}
}
if (strlen (in->buffer) + in->charpoint < in->current_max_size) {
/* bytes from begin */
size_t ins_point = str_offset_to_pos (in->buffer, in->point);
@ -1267,7 +1268,7 @@ insert_char (WInput *in, int c_code)
memcpy(in->buffer + ins_point, in->charbuf, in->charpoint);
in->point++;
}
in->charpoint = 0;
return MSG_HANDLED;
}
@ -2090,11 +2091,11 @@ static cb_ret_t
listbox_key (WListbox *l, int key)
{
int i;
int j = 0;
cb_ret_t j = MSG_NOT_HANDLED;
if (!l->list)
return MSG_NOT_HANDLED;
switch (key){
case KEY_HOME:
case KEY_A1:
@ -2125,14 +2126,16 @@ listbox_key (WListbox *l, int key)
case KEY_NPAGE:
case XCTRL('v'):
for (i = 0; i < l->height-1; i++)
j |= listbox_fwd (l);
return (j > 0) ? MSG_HANDLED : MSG_NOT_HANDLED;
if (listbox_fwd (l) != MSG_NOT_HANDLED)
j = MSG_HANDLED;
return j;
case KEY_PPAGE:
case ALT('v'):
for (i = 0; i < l->height-1; i++)
j |= listbox_back (l);
return (j > 0) ? MSG_HANDLED : MSG_NOT_HANDLED;
if (listbox_back (l) != MSG_NOT_HANDLED)
j = MSG_HANDLED;
return j;
}
return MSG_NOT_HANDLED;
}
@ -2275,7 +2278,7 @@ listbox_event (Gpm_Event *event, void *data)
}
WListbox *
listbox_new (int y, int x, int width, int height, lcback callback)
listbox_new (int y, int x, int height, int width, lcback callback)
{
WListbox *l = g_new (WListbox, 1);
@ -2434,7 +2437,7 @@ buttonbat_get_button_width ()
{
int result = COLS / 10;
return (result >= 7) ? result : 7;
}
}
static cb_ret_t
@ -2632,7 +2635,7 @@ groupbox_callback (Widget *w, widget_msg_t msg, int parm)
}
WGroupbox *
groupbox_new (int x, int y, int width, int height, const char *title)
groupbox_new (int y, int x, int height, int width, const char *title)
{
WGroupbox *g = g_new (WGroupbox, 1);

View File

@ -167,8 +167,8 @@ 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);
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, lcback callback);
WGroupbox *groupbox_new (int x, int y, int width, int height, const char *title);
WListbox *listbox_new (int y, int x, int height, int width, lcback callback);
WGroupbox *groupbox_new (int y, int x, int height, int width, const char *title);
/* Input lines */
void winput_set_origin (WInput *i, int x, int field_width);

View File

@ -66,7 +66,7 @@ create_listbox_window (int cols, int lines, const char *title, const char *help)
create_dlg (ypos, xpos, lines + 6, cols + 4, dialog_colors, NULL,
help, title, DLG_CENTER | DLG_REVERSE);
listbox->list = listbox_new (2, 2, cols, lines, 0);
listbox->list = listbox_new (2, 2, lines, cols, NULL);
add_widget (listbox->dlg,
button_new (lines + 3, (cols / 2 + 2) - len / 2, B_CANCEL,