Rev 8492 | Rev 8500 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8492 | Rev 8499 | ||
---|---|---|---|
Line 52... | Line 52... | ||
52 | links.add_text(draw_x, draw_y + list.y, pw, list.item_h - calc(zoom*2)-1, zoom); |
52 | links.add_text(draw_x, draw_y + list.y, pw, list.item_h - calc(zoom*2)-1, zoom); |
53 | } |
53 | } |
54 | } |
54 | } |
55 | draw_x += pw; |
55 | draw_x += pw; |
56 | if (debug_mode) debugln(#linebuf); |
56 | if (debug_mode) debugln(#linebuf); |
57 | linebuf = NULL; |
- | |
58 | } |
57 | } |
- | 58 | linebuf = NULL; |
|
59 | } |
59 | } |
Line -... | Line 60... | ||
- | 60 | ||
60 | 61 | ||
61 | void TWebBrowser::RenderTextbuf() |
62 | void TWebBrowser::RenderTextbuf() |
62 | { |
63 | { |
63 | int break_pos; |
64 | int break_pos; |
64 | char next_line[4096]; |
65 | char next_line[sizeof(TWebBrowser.linebuf)]; |
Line 65... | Line 66... | ||
65 | int zoom = list.font_w / BASIC_CHAR_W; |
66 | int zoom = list.font_w / BASIC_CHAR_W; |
66 | 67 | ||
67 | //Do we need a line break? |
68 | //Do we need a line break? |
68 | while (strlen(#linebuf) * list.font_w + draw_x >= draw_w) { |
69 | while (strlen(#linebuf) * list.font_w + draw_x >= draw_w) { |
Line 69... | Line 70... | ||
69 | //Yes, we do. Lets calculate where... |
70 | //Yes, we do. Lets calculate where... |
70 | break_pos = strrchr(#linebuf, ' '); |
71 | break_pos = strrchr(#linebuf, ' '); |
71 | 72 | ||
- | 73 | //Is a new line fits in the current line? |
|
72 | //Is a new line fits in the current line? |
74 | if (break_pos * list.font_w + draw_x > draw_w) { |
- | 75 | break_pos = draw_w - draw_x /list.font_w; |
|
- | 76 | while(break_pos) { |
|
- | 77 | if (linebuf[break_pos]==' ') { |
|
- | 78 | break_pos++; |
|
- | 79 | break; |
|
73 | if (break_pos * list.font_w + draw_x > draw_w) { |
80 | } |
74 | break_pos = draw_w - draw_x /list.font_w; |
81 | break_pos--; |
75 | while(break_pos) && (linebuf[break_pos]!=' ') break_pos--; |
82 | } |
76 | } |
83 | } |
77 | //Maybe a new line is too big for the whole new line? Then we have to split it |
84 | //Maybe a new line is too big for the whole new line? Then we have to split it |
Line 78... | Line -... | ||
78 | if (!break_pos) && (style.tag_list.level*5 + strlen(#linebuf) * zoom >= list.column_max) { |
- | |
79 | break_pos = draw_w - draw_x / list.font_w; |
- | |
Line -... | Line 85... | ||
- | 85 | if (!break_pos) && (style.tag_list.level*5 + strlen(#linebuf) * zoom >= list.column_max) { |
|
- | 86 | break_pos = draw_w - draw_x / list.font_w; |
|
- | 87 | } |
|
80 | } |
88 | |
81 | - | ||
82 | strcpy(#next_line, #linebuf + break_pos); |
89 | |
- | 90 | if (break_pos) { |
|
- | 91 | strlcpy(#next_line, #linebuf + break_pos, sizeof(next_line)); |
|
83 | linebuf[break_pos] = 0x00; |
92 | linebuf[break_pos] = 0x00; |
- | 93 | RenderLine(); |
|
- | 94 | strlcpy(#linebuf, #next_line, sizeof(TWebBrowser.linebuf)); |
|
84 | 95 | NewLine(); |
|
85 | RenderLine(); |
96 | } else { |
86 | 97 | NewLine(); |
|
Line 87... | Line 98... | ||
87 | strcpy(#linebuf, #next_line); |
98 | RenderLine(); |