mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
[button] _node
This commit is contained in:
parent
66137e8f7d
commit
cd6f8a9ea4
@ -184,19 +184,19 @@ static widget_handler_status_T
|
|||||||
display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||||
{
|
{
|
||||||
struct terminal *term = dlg_data->win->term;
|
struct terminal *term = dlg_data->win->term;
|
||||||
struct color_pair *color, *shortcut_color;
|
unsigned int color_node, shortcut_color_node;
|
||||||
struct el_box *pos = &widget_data->box;
|
struct el_box *pos = &widget_data->box;
|
||||||
int len, x;
|
int len, x;
|
||||||
int sel = is_selected_widget(dlg_data, widget_data);
|
int sel = is_selected_widget(dlg_data, widget_data);
|
||||||
|
|
||||||
if (sel) {
|
if (sel) {
|
||||||
shortcut_color = get_bfu_color(term, "dialog.button-shortcut-selected");
|
shortcut_color_node = get_bfu_color_node(term, "dialog.button-shortcut-selected");
|
||||||
color = get_bfu_color(term, "dialog.button-selected");
|
color_node = get_bfu_color_node(term, "dialog.button-selected");
|
||||||
} else {
|
} else {
|
||||||
shortcut_color = get_bfu_color(term, "dialog.button-shortcut");
|
shortcut_color_node = get_bfu_color_node(term, "dialog.button-shortcut");
|
||||||
color = get_bfu_color(term, "dialog.button");
|
color_node = get_bfu_color_node(term, "dialog.button");
|
||||||
}
|
}
|
||||||
if (!color || !shortcut_color) return EVENT_PROCESSED;
|
if (!color_node || !shortcut_color_node) return EVENT_PROCESSED;
|
||||||
|
|
||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
if (term->utf8_cp) {
|
if (term->utf8_cp) {
|
||||||
@ -215,7 +215,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
draw_dlg_text(dlg_data, pos->x, pos->y, BUTTON_LEFT, BUTTON_LEFT_LEN, 0, color);
|
draw_dlg_text_node(dlg_data, pos->x, pos->y, BUTTON_LEFT, BUTTON_LEFT_LEN, 0, color_node);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
char *text = widget_data->widget->text;
|
char *text = widget_data->widget->text;
|
||||||
int hk_pos = widget_data->widget->info.button.hotkey_pos;
|
int hk_pos = widget_data->widget->info.button.hotkey_pos;
|
||||||
@ -240,18 +240,18 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (hk_pos)
|
if (hk_pos)
|
||||||
draw_dlg_text(dlg_data, x, pos->y,
|
draw_dlg_text_node(dlg_data, x, pos->y,
|
||||||
text, hk_pos, 0, color);
|
text, hk_pos, 0, color_node);
|
||||||
|
|
||||||
draw_dlg_text(dlg_data, x + cells_to_hk, pos->y,
|
draw_dlg_text_node(dlg_data, x + cells_to_hk, pos->y,
|
||||||
&text[hk_pos + 1], hk_bytes,
|
&text[hk_pos + 1], hk_bytes,
|
||||||
attr, shortcut_color);
|
attr, shortcut_color_node);
|
||||||
|
|
||||||
if (right > 1)
|
if (right > 1)
|
||||||
draw_dlg_text(dlg_data, x+cells_to_hk+hk_cells,
|
draw_dlg_text_node(dlg_data, x+cells_to_hk+hk_cells,
|
||||||
pos->y,
|
pos->y,
|
||||||
&text[hk_pos + hk_bytes + 1],
|
&text[hk_pos + hk_bytes + 1],
|
||||||
right - 1, 0, color);
|
right - 1, 0, color_node);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
int hk_width = utf8_char2cells(text, NULL);
|
int hk_width = utf8_char2cells(text, NULL);
|
||||||
@ -261,13 +261,13 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
|||||||
len - hk_width,
|
len - hk_width,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
draw_dlg_text(dlg_data, x, pos->y,
|
draw_dlg_text_node(dlg_data, x, pos->y,
|
||||||
text, hk_len,
|
text, hk_len,
|
||||||
attr, shortcut_color);
|
attr, shortcut_color_node);
|
||||||
|
|
||||||
draw_dlg_text(dlg_data, x + hk_width, pos->y,
|
draw_dlg_text_node(dlg_data, x + hk_width, pos->y,
|
||||||
&text[hk_len], len_to_display,
|
&text[hk_len], len_to_display,
|
||||||
0, color);
|
0, color_node);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
@ -275,18 +275,18 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
|||||||
int right = widget_data->widget->info.button.truetextlen - hk_pos - 1;
|
int right = widget_data->widget->info.button.truetextlen - hk_pos - 1;
|
||||||
|
|
||||||
if (hk_pos) {
|
if (hk_pos) {
|
||||||
draw_dlg_text(dlg_data, x, pos->y, text, hk_pos, 0, color);
|
draw_dlg_text_node(dlg_data, x, pos->y, text, hk_pos, 0, color_node);
|
||||||
}
|
}
|
||||||
draw_dlg_text(dlg_data, x + hk_pos, pos->y,
|
draw_dlg_text_node(dlg_data, x + hk_pos, pos->y,
|
||||||
&text[hk_pos + 1], 1, attr, shortcut_color);
|
&text[hk_pos + 1], 1, attr, shortcut_color_node);
|
||||||
if (right > 1) {
|
if (right > 1) {
|
||||||
draw_dlg_text(dlg_data, x + hk_pos + 1, pos->y,
|
draw_dlg_text_node(dlg_data, x + hk_pos + 1, pos->y,
|
||||||
&text[hk_pos + 2], right - 1, 0, color);
|
&text[hk_pos + 2], right - 1, 0, color_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
draw_dlg_text(dlg_data, x, pos->y, text, 1, attr, shortcut_color);
|
draw_dlg_text_node(dlg_data, x, pos->y, text, 1, attr, shortcut_color_node);
|
||||||
draw_dlg_text(dlg_data, x + 1, pos->y, &text[1], len - 1, 0, color);
|
draw_dlg_text_node(dlg_data, x + 1, pos->y, &text[1], len - 1, 0, color_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
@ -294,12 +294,12 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
|||||||
int text_cells = utf8_ptr2cells(widget_data->widget->text, NULL);
|
int text_cells = utf8_ptr2cells(widget_data->widget->text, NULL);
|
||||||
int hk = (widget_data->widget->info.button.hotkey_pos >= 0);
|
int hk = (widget_data->widget->info.button.hotkey_pos >= 0);
|
||||||
|
|
||||||
draw_dlg_text(dlg_data, x + text_cells - hk, pos->y,
|
draw_dlg_text_node(dlg_data, x + text_cells - hk, pos->y,
|
||||||
BUTTON_RIGHT, BUTTON_RIGHT_LEN, 0, color);
|
BUTTON_RIGHT, BUTTON_RIGHT_LEN, 0, color_node);
|
||||||
} else
|
} else
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
draw_dlg_text(dlg_data, x + len, pos->y, BUTTON_RIGHT,
|
draw_dlg_text_node(dlg_data, x + len, pos->y, BUTTON_RIGHT,
|
||||||
BUTTON_RIGHT_LEN, 0, color);
|
BUTTON_RIGHT_LEN, 0, color_node);
|
||||||
if (sel) {
|
if (sel) {
|
||||||
set_dlg_cursor(term, dlg_data, x, pos->y, 1);
|
set_dlg_cursor(term, dlg_data, x, pos->y, 1);
|
||||||
set_dlg_window_ptr(dlg_data, dlg_data->win, pos->x, pos->y);
|
set_dlg_window_ptr(dlg_data, dlg_data->win, pos->x, pos->y);
|
||||||
|
Loading…
Reference in New Issue
Block a user