1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

big dialogs: dlg_format_text: no need to pass the term.

This commit is contained in:
Witold Filipczyk 2008-09-07 18:12:42 +02:00 committed by Witold Filipczyk
parent de815bb206
commit cd35fa79fc
6 changed files with 16 additions and 14 deletions

View File

@ -49,7 +49,7 @@ dlg_format_checkbox(struct terminal *term, struct dialog_data *dlg_data,
if (text && *text) {
if (rw) *rw -= CHECKBOX_LS;
dlg_format_text_do(term, dlg_data, text, x + CHECKBOX_LS, y,
dlg_format_text_do(dlg_data, text, x + CHECKBOX_LS, y,
w - CHECKBOX_LS, rw,
get_bfu_color(term, "dialog.checkbox-label"),
align, format_only);

View File

@ -591,7 +591,7 @@ format_widgets(struct terminal *term, struct dialog_data *dlg_data,
break;
case WIDGET_TEXT:
dlg_format_text(term, dlg_data, wdata, x, y, w, rw, h,
dlg_format_text(dlg_data, wdata, x, y, w, rw, h,
format_only);
break;

View File

@ -132,7 +132,7 @@ dlg_format_field(struct terminal *term, struct dialog_data *dlg_data,
if (label && *label) {
if (!format_only) text_color = get_bfu_color(term, "dialog.text");
dlg_format_text_do(term, dlg_data, label, x, y, w, rw, text_color, ALIGN_LEFT, format_only);
dlg_format_text_do(dlg_data, label, x, y, w, rw, text_color, ALIGN_LEFT, format_only);
}
/* XXX: We want the field and label on the same line if the terminal
@ -140,7 +140,7 @@ dlg_format_field(struct terminal *term, struct dialog_data *dlg_data,
if (label && *label && float_label) {
if (widget_data->widget->info.field.flags & INPFIELD_FLOAT) {
(*y) -= INPUTFIELD_HEIGHT;
dlg_format_text_do(term, dlg_data, INPUTFIELD_FLOAT_SEPARATOR,
dlg_format_text_do(dlg_data, INPUTFIELD_FLOAT_SEPARATOR,
x + label_width, y, w, rw,
text_color, ALIGN_LEFT, format_only);
w -= INPUTFIELD_FLOAT_SEPARATOR_LEN + INPUTFIELD_FLOATLABEL_PADDING;

View File

@ -211,12 +211,13 @@ split_lines(struct widget_data *widget_data, int max_width)
/* Format text according to dialog box and alignment. */
void
dlg_format_text_do(struct terminal *term, struct dialog_data *dlg_data,
dlg_format_text_do(struct dialog_data *dlg_data,
unsigned char *text,
int x, int *y, int width, int *real_width,
struct color_pair *color, enum format_align align,
int format_only)
{
struct terminal *term = dlg_data->win->term;
int line_width;
int firstline = 1;
@ -261,11 +262,12 @@ dlg_format_text_do(struct terminal *term, struct dialog_data *dlg_data,
}
void
dlg_format_text(struct terminal *term, struct dialog_data *dlg_data,
dlg_format_text(struct dialog_data *dlg_data,
struct widget_data *widget_data,
int x, int *y, int width, int *real_width, int max_height,
int format_only)
{
struct terminal *term = dlg_data->win->term;
unsigned char *text = widget_data->widget->text;
unsigned char saved = 0;
unsigned char *saved_pos = NULL;
@ -337,7 +339,7 @@ dlg_format_text(struct terminal *term, struct dialog_data *dlg_data,
widget_data->info.text.current = 0;
}
dlg_format_text_do(term, dlg_data, text,
dlg_format_text_do(dlg_data, text,
x, y, width, real_width,
get_bfu_color(term, "dialog.text"),
widget_data->widget->info.text.align, format_only);
@ -425,7 +427,7 @@ format_and_display_text(struct widget_data *widget_data,
draw_box(term, &widget_data->box, ' ', 0,
get_bfu_color(term, "dialog.generic"));
dlg_format_text(term, dlg_data, widget_data,
dlg_format_text(dlg_data, widget_data,
widget_data->box.x, &y, widget_data->box.width, NULL,
height, 0);

View File

@ -46,12 +46,12 @@ void add_dlg_text(struct dialog *dlg, unsigned char *text,
enum format_align align, int bottom_pad);
extern const struct widget_ops text_ops;
void dlg_format_text_do(struct terminal *term, struct dialog_data *dlg_data,
void dlg_format_text_do(struct dialog_data *dlg_data,
unsigned char *text, int x, int *y, int w, int *rw,
struct color_pair *scolor, enum format_align align, int format_only);
void
dlg_format_text(struct terminal *term, struct dialog_data *dlg_data, struct widget_data *widget_data,
dlg_format_text(struct dialog_data *dlg_data, struct widget_data *widget_data,
int x, int *y, int dlg_width, int *real_width, int height, int format_only);
#define text_is_scrollable(widget_data) \

View File

@ -157,7 +157,7 @@ download_dialog_layouter(struct dialog_data *dlg_data)
int_lower_bound(&w, DOWN_DLG_MIN);
}
dlg_format_text_do(term, dlg_data, url, 0, &y, w, &rw,
dlg_format_text_do(dlg_data, url, 0, &y, w, &rw,
dialog_text_color, ALIGN_LEFT, 1);
y++;
@ -166,7 +166,7 @@ download_dialog_layouter(struct dialog_data *dlg_data)
#if CONFIG_BITTORRENT
if (bittorrent) y += 2;
#endif
dlg_format_text_do(term, dlg_data, msg, 0, &y, w, &rw,
dlg_format_text_do(dlg_data, msg, 0, &y, w, &rw,
dialog_text_color, ALIGN_LEFT, 1);
y++;
@ -190,7 +190,7 @@ download_dialog_layouter(struct dialog_data *dlg_data)
y = dlg_data->box.y + DIALOG_TB + 1;
x = dlg_data->box.x + DIALOG_LB;
dlg_format_text_do(term, dlg_data, url, x, &y, w, NULL,
dlg_format_text_do(dlg_data, url, x, &y, w, NULL,
dialog_text_color, ALIGN_LEFT, 0);
if (show_meter) {
@ -207,7 +207,7 @@ download_dialog_layouter(struct dialog_data *dlg_data)
}
#endif
y++;
dlg_format_text_do(term, dlg_data, msg, x, &y, w, NULL,
dlg_format_text_do(dlg_data, msg, x, &y, w, NULL,
dialog_text_color, ALIGN_LEFT, 0);
y++;