@@ -45,12 +45,7 @@ struct rich_text_data_t {
45
45
46
46
rich_text_data_t g_rich_text_data;
47
47
48
- int rich_text_init (const uint8_t * text,
49
- int x_text,
50
- int y_text,
51
- int width_blocks,
52
- int height_blocks,
53
- int adjust_width_on_no_scroll) {
48
+ int rich_text_init (const uint8_t * text, int x_text, int y_text, int width_blocks, int height_blocks, int adjust_width_on_no_scroll) {
54
49
auto &data = g_rich_text_data;
55
50
data.x_text = x_text;
56
51
data.y_text = y_text;
@@ -59,14 +54,14 @@ int rich_text_init(const uint8_t* text,
59
54
data.text_height_lines = height_blocks - 1 ;
60
55
data.text_width_blocks = width_blocks;
61
56
62
- data.num_lines = rich_text_draw (
63
- text, data.x_text + 8 , data.y_text + 6 , 16 * data.text_width_blocks - 16 , data.text_height_lines , 1 );
57
+ data.num_lines = rich_text_draw (text, data.x_text + 8 , data.y_text + 6 , 16 * data.text_width_blocks - 16 , data.text_height_lines , 1 );
64
58
scrollbar.x = data.x_text + 16 * data.text_width_blocks - 1 ;
65
59
scrollbar.y = data.y_text ;
66
60
scrollbar.height = 16 * data.text_height_blocks ;
67
61
scrollbar_init (&scrollbar, scrollbar.scroll_position , data.num_lines - data.text_height_lines );
68
- if (data.num_lines <= data.text_height_lines && adjust_width_on_no_scroll)
62
+ if (data.num_lines <= data.text_height_lines && adjust_width_on_no_scroll) {
69
63
data.text_width_blocks += 2 ;
64
+ }
70
65
71
66
window_invalidate ();
72
67
}
@@ -231,7 +226,7 @@ static void draw_line(painter &ctx, const uint8_t* str, int x, int y, color colo
231
226
}
232
227
}
233
228
234
- static int draw_text (const uint8_t * text, int x_offset, int y_offset, int box_width, int height_lines, color color, bool measure_only) {
229
+ static int rich_text_draw_impl (const uint8_t * text, int x_offset, int y_offset, int box_width, int height_lines, color color, bool measure_only) {
235
230
int image_height_lines = 0 ;
236
231
int image_id = 0 ;
237
232
int lines_before_image = 0 ;
@@ -343,22 +338,12 @@ static int draw_text(const uint8_t* text, int x_offset, int y_offset, int box_wi
343
338
return num_lines;
344
339
}
345
340
346
- int rich_text_draw (const uint8_t * text,
347
- int x_offset,
348
- int y_offset,
349
- int box_width,
350
- int height_lines,
351
- bool measure_only) {
352
- return draw_text (text, x_offset, y_offset, box_width, height_lines, 0 , measure_only);
341
+ int rich_text_draw (const uint8_t * text, int x_offset, int y_offset, int box_width, int height_lines, bool measure_only) {
342
+ return rich_text_draw_impl (text, x_offset, y_offset, box_width, height_lines, 0 , measure_only);
353
343
}
354
344
355
- int rich_text_draw_colored (const uint8_t * text,
356
- int x_offset,
357
- int y_offset,
358
- int box_width,
359
- int height_lines,
360
- color color) {
361
- return draw_text (text, x_offset, y_offset, box_width, height_lines, color, 0 );
345
+ int rich_text_draw_colored (const uint8_t * text, int x_offset, int y_offset, int box_width, int height_lines, color color) {
346
+ return rich_text_draw_impl (text, x_offset, y_offset, box_width, height_lines, color, 0 );
362
347
}
363
348
364
349
void rich_text_draw_scrollbar (void ) {
0 commit comments