mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
big dialogs: draw_dlg_text: no need to pass the term.
Instead, make draw_dlg_text read dlg_data->win->term.
This commit is contained in:
parent
1b589beb81
commit
4f41ce00b4
@ -213,7 +213,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
}
|
||||
|
||||
|
||||
draw_dlg_text(term, dlg_data, pos->x, pos->y, BUTTON_LEFT, BUTTON_LEFT_LEN, 0, color);
|
||||
draw_dlg_text(dlg_data, pos->x, pos->y, BUTTON_LEFT, BUTTON_LEFT_LEN, 0, color);
|
||||
if (len > 0) {
|
||||
unsigned char *text = widget_data->widget->text;
|
||||
int hk_pos = widget_data->widget->info.button.hotkey_pos;
|
||||
@ -238,15 +238,15 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
NULL);
|
||||
|
||||
if (hk_pos)
|
||||
draw_dlg_text(term, dlg_data, x, pos->y,
|
||||
draw_dlg_text(dlg_data, x, pos->y,
|
||||
text, hk_pos, 0, color);
|
||||
|
||||
draw_dlg_text(term, dlg_data, x + cells_to_hk, pos->y,
|
||||
draw_dlg_text(dlg_data, x + cells_to_hk, pos->y,
|
||||
&text[hk_pos + 1], hk_bytes,
|
||||
attr, shortcut_color);
|
||||
|
||||
if (right > 1)
|
||||
draw_dlg_text(term, dlg_data, x+cells_to_hk+hk_cells,
|
||||
draw_dlg_text(dlg_data, x+cells_to_hk+hk_cells,
|
||||
pos->y,
|
||||
&text[hk_pos + hk_bytes + 1],
|
||||
right - 1, 0, color);
|
||||
@ -259,11 +259,11 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
len - hk_width,
|
||||
NULL);
|
||||
|
||||
draw_dlg_text(term, dlg_data, x, pos->y,
|
||||
draw_dlg_text(dlg_data, x, pos->y,
|
||||
text, hk_len,
|
||||
attr, shortcut_color);
|
||||
|
||||
draw_dlg_text(term, dlg_data, x + hk_width, pos->y,
|
||||
draw_dlg_text(dlg_data, x + hk_width, pos->y,
|
||||
&text[hk_len], len_to_display,
|
||||
0, color);
|
||||
}
|
||||
@ -273,18 +273,18 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
int right = widget_data->widget->info.button.truetextlen - hk_pos - 1;
|
||||
|
||||
if (hk_pos) {
|
||||
draw_dlg_text(term, dlg_data, x, pos->y, text, hk_pos, 0, color);
|
||||
draw_dlg_text(dlg_data, x, pos->y, text, hk_pos, 0, color);
|
||||
}
|
||||
draw_dlg_text(term, dlg_data, x + hk_pos, pos->y,
|
||||
draw_dlg_text(dlg_data, x + hk_pos, pos->y,
|
||||
&text[hk_pos + 1], 1, attr, shortcut_color);
|
||||
if (right > 1) {
|
||||
draw_dlg_text(term, dlg_data, x + hk_pos + 1, pos->y,
|
||||
draw_dlg_text(dlg_data, x + hk_pos + 1, pos->y,
|
||||
&text[hk_pos + 2], right - 1, 0, color);
|
||||
}
|
||||
|
||||
} else {
|
||||
draw_dlg_text(term, dlg_data, x, pos->y, text, 1, attr, shortcut_color);
|
||||
draw_dlg_text(term, dlg_data, x + 1, pos->y, &text[1], len - 1, 0, color);
|
||||
draw_dlg_text(dlg_data, x, pos->y, text, 1, attr, shortcut_color);
|
||||
draw_dlg_text(dlg_data, x + 1, pos->y, &text[1], len - 1, 0, color);
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_UTF8
|
||||
@ -292,11 +292,11 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
int text_cells = utf8_ptr2cells(widget_data->widget->text, NULL);
|
||||
int hk = (widget_data->widget->info.button.hotkey_pos >= 0);
|
||||
|
||||
draw_dlg_text(term, dlg_data, x + text_cells - hk, pos->y,
|
||||
draw_dlg_text(dlg_data, x + text_cells - hk, pos->y,
|
||||
BUTTON_RIGHT, BUTTON_RIGHT_LEN, 0, color);
|
||||
} else
|
||||
#endif /* CONFIG_UTF8 */
|
||||
draw_dlg_text(term, dlg_data, x + len, pos->y, BUTTON_RIGHT,
|
||||
draw_dlg_text(dlg_data, x + len, pos->y, BUTTON_RIGHT,
|
||||
BUTTON_RIGHT_LEN, 0, color);
|
||||
if (sel) {
|
||||
set_dlg_cursor(term, dlg_data, x, pos->y, 1);
|
||||
|
@ -79,7 +79,7 @@ display_checkbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
else
|
||||
text = widget_data->widget->info.checkbox.gid ? "( )" : "[ ]";
|
||||
|
||||
draw_dlg_text(term, dlg_data, pos->x, pos->y, text, CHECKBOX_LEN, 0, color);
|
||||
draw_dlg_text(dlg_data, pos->x, pos->y, text, CHECKBOX_LEN, 0, color);
|
||||
|
||||
if (selected) {
|
||||
set_dlg_cursor(term, dlg_data, pos->x + 1, pos->y, 1);
|
||||
|
@ -117,9 +117,9 @@ redraw_dialog(struct dialog_data *dlg_data, int layout)
|
||||
y = dlg_data->real_box.y - 1;
|
||||
|
||||
|
||||
draw_dlg_text(term, dlg_data, x - 1, y, " ", 1, 0, title_color);
|
||||
draw_dlg_text(term, dlg_data, x, y, title, titlelen, 0, title_color);
|
||||
draw_dlg_text(term, dlg_data, x + titlecells, y, " ", 1, 0,
|
||||
draw_dlg_text(dlg_data, x - 1, y, " ", 1, 0, title_color);
|
||||
draw_dlg_text(dlg_data, x, y, title, titlelen, 0, title_color);
|
||||
draw_dlg_text(dlg_data, x + titlecells, y, " ", 1, 0,
|
||||
title_color);
|
||||
}
|
||||
}
|
||||
|
@ -88,14 +88,14 @@ dlg_format_group(struct dialog_data *dlg_data,
|
||||
text,
|
||||
label_length,
|
||||
NULL);
|
||||
draw_dlg_text(term, dlg_data, xpos + width
|
||||
draw_dlg_text(dlg_data, xpos + width
|
||||
+ label_padding,
|
||||
*y, text, lb, 0,
|
||||
color);
|
||||
} else
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
draw_dlg_text(term, dlg_data, xpos + width
|
||||
draw_dlg_text(dlg_data, xpos + width
|
||||
+ label_padding,
|
||||
*y, text,
|
||||
label_length, 0,
|
||||
@ -114,12 +114,12 @@ dlg_format_group(struct dialog_data *dlg_data,
|
||||
text,
|
||||
label_length,
|
||||
NULL);
|
||||
draw_dlg_text(term, dlg_data, xpos, *y,
|
||||
draw_dlg_text(dlg_data, xpos, *y,
|
||||
text, lb, 0, color);
|
||||
} else
|
||||
#endif /* CONFIG_UTF8 */
|
||||
{
|
||||
draw_dlg_text(term, dlg_data, xpos, *y,
|
||||
draw_dlg_text(dlg_data, xpos, *y,
|
||||
text, label_length,
|
||||
0, color);
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
|
||||
if (term->utf8_cp)
|
||||
w = utf8_cells2bytes(text, w, NULL);
|
||||
#endif /* CONFIG_UTF8 */
|
||||
draw_dlg_text(term, dlg_data, widget_data->box.x, widget_data->box.y,
|
||||
draw_dlg_text(dlg_data, widget_data->box.x, widget_data->box.y,
|
||||
text, w, 0, color);
|
||||
} else {
|
||||
struct box box;
|
||||
|
@ -257,7 +257,7 @@ dlg_format_text_do(struct dialog_data *dlg_data,
|
||||
|
||||
assert(cells <= width && shift < width);
|
||||
|
||||
draw_dlg_text(term, dlg_data, x + shift, *y, text, line_width, 0, color);
|
||||
draw_dlg_text(dlg_data, x + shift, *y, text, line_width, 0, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -560,10 +560,11 @@ draw_text(struct terminal *term, int x, int y,
|
||||
}
|
||||
|
||||
void
|
||||
draw_dlg_text(struct terminal *term, struct dialog_data *dlg_data, int x, int y,
|
||||
draw_dlg_text(struct dialog_data *dlg_data, int x, int y,
|
||||
unsigned char *text, int length,
|
||||
enum screen_char_attr attr, struct color_pair *color)
|
||||
{
|
||||
struct terminal *term = dlg_data->win->term;
|
||||
struct box *box = &dlg_data->real_box;
|
||||
|
||||
if (box->height) {
|
||||
|
@ -282,7 +282,7 @@ void draw_text(struct terminal *term, int x, int y,
|
||||
struct color_pair *color);
|
||||
|
||||
/** Draws text for dialogs. */
|
||||
void draw_dlg_text(struct terminal *term, struct dialog_data *dlg_data, int x, int y,
|
||||
void draw_dlg_text(struct dialog_data *dlg_data, int x, int y,
|
||||
unsigned char *text, int length,
|
||||
enum screen_char_attr attr, struct color_pair *color);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user