1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Code cleanup.

This commit is contained in:
Pavol Babincak 2006-01-31 00:12:05 +01:00 committed by Jonas Fonseca
parent 44a1aa9c87
commit 259a64a7a7

View File

@ -102,71 +102,6 @@ check_nonempty(struct dialog_data *dlg_data, struct widget_data *widget_data)
return EVENT_NOT_PROCESSED;
}
#if 0
void
dlg_format_field(struct terminal *term,
struct widget_data *widget_data,
int x, int *y, int w, int *rw, enum format_align align)
{
static int max_label_width;
static int *prev_y; /* Assert the uniqueness of y */ /* TODO: get rid of this !! --Zas */
unsigned char *label = widget_data->widget->text;
struct color_pair *text_color = NULL;
int label_width = 0;
int float_label = widget_data->widget->info.field.flags & (INPFIELD_FLOAT|INPFIELD_FLOAT2);
if (label && *label && float_label) {
unsigned char *l2 = label;
int len = strlen(label);
label_width = term->utf8 ? strlen_utf8(&l2) : len;
if (prev_y == y) {
int_lower_bound(&max_label_width, label_width);
} else {
max_label_width = label_width;
prev_y = y;
}
/* Right align the floating label up against the
* input field */
x += max_label_width - label_width;
w -= max_label_width - len;
}
if (label && *label) {
if (term) text_color = get_bfu_color(term, "dialog.text");
dlg_format_text_do(term, label, x, y, w, rw, text_color, ALIGN_LEFT);
}
/* XXX: We want the field and label on the same line if the terminal
* width allows it. */
if (label && *label && float_label) {
if (widget_data->widget->info.field.flags & INPFIELD_FLOAT) {
(*y) -= INPUTFIELD_HEIGHT;
dlg_format_text_do(term, INPUTFIELD_FLOAT_SEPARATOR,
x + label_width, y, w, rw,
text_color, ALIGN_LEFT);
w -= INPUTFIELD_FLOAT_SEPARATOR_LEN + INPUTFIELD_FLOATLABEL_PADDING;
x += INPUTFIELD_FLOAT_SEPARATOR_LEN + INPUTFIELD_FLOATLABEL_PADDING;
}
/* FIXME: Is 5 chars for input field enough? --jonas */
if (label_width < w - 5) {
(*y) -= INPUTFIELD_HEIGHT;
w -= label_width;
x += label_width;
}
}
if (rw) int_lower_bound(rw, int_min(w, DIALOG_MIN_WIDTH));
set_box(&widget_data->box, x, *y, w, INPUTFIELD_HEIGHT);
(*y) += INPUTFIELD_HEIGHT;
}
#endif
void
dlg_format_field(struct terminal *term,
struct widget_data *widget_data,