Rev 8500 | Rev 9294 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8500 | Rev 9103 | ||
---|---|---|---|
Line 19... | Line 19... | ||
19 | else if (ESBYTE[_line]) |
19 | else if (ESBYTE[_line]) |
20 | { |
20 | { |
21 | pw = strlen(_line) * list.font_w; |
21 | pw = strlen(_line) * list.font_w; |
22 | zoom = list.font_w / BASIC_CHAR_W; |
22 | zoom = list.font_w / BASIC_CHAR_W; |
Line -... | Line 23... | ||
- | 23 | ||
23 | 24 | //there is some shit happens!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|
24 | if (pw > draw_w) { |
25 | if (pw > draw_w) { |
25 | draw_w = pw; |
26 | //draw_w = pw; |
26 | NewLine(); |
27 | NewLine(); |
Line 27... | Line 28... | ||
27 | } |
28 | } |
28 | 29 | ||
29 | if (debug_mode) { |
30 | if (debug_mode) { |
30 | canvas.DrawBar(draw_x, draw_y, pw, list.item_h, 0xCCCccc); |
31 | canvas.DrawBar(draw_x, draw_y, pw, list.item_h, 0xCCCccc); |
Line 31... | Line 32... | ||
31 | debugln(_line); |
32 | debugln(_line); |
Line -... | Line 33... | ||
- | 33 | } |
|
32 | } |
34 | |
33 | 35 | style.cur_line_h = math.max(style.cur_line_h, list.item_h); |
|
34 | style.cur_line_h = math.max(style.cur_line_h, list.item_h); |
36 | |
Line 35... | Line 37... | ||
35 | 37 | if (!secondrun) goto _SKIP_DRAW; |
|
Line 56... | Line 58... | ||
56 | if (ESBYTE[_line]==' ') && (ESBYTE[_line+1]==NULL) {} else { |
58 | if (ESBYTE[_line]==' ') && (ESBYTE[_line+1]==NULL) {} else { |
57 | canvas.DrawBar(draw_x, draw_y + list.item_h - calc(zoom*2)-1, pw, zoom, link_color_default); |
59 | canvas.DrawBar(draw_x, draw_y + list.item_h - calc(zoom*2)-1, pw, zoom, link_color_default); |
58 | links.add_text(draw_x, draw_y + list.y, pw, list.item_h - calc(zoom*2)-1, zoom); |
60 | links.add_text(draw_x, draw_y + list.y, pw, list.item_h - calc(zoom*2)-1, zoom); |
59 | } |
61 | } |
60 | } |
62 | } |
- | 63 | _SKIP_DRAW: |
|
61 | draw_x += pw; |
64 | draw_x += pw; |
62 | } |
65 | } |
63 | ESBYTE[_line] = NULL; |
66 | ESBYTE[_line] = NULL; |
64 | } |
67 | } |
Line 69... | Line 72... | ||
69 | int br; //break position |
72 | int br; //break position |
70 | char nul = '\0'; |
73 | char nul = '\0'; |
71 | int len; |
74 | int len; |
Line 72... | Line 75... | ||
72 | 75 | ||
- | 76 | //Do we need a line break? |
|
73 | //Do we need a line break? |
77 | |
74 | while (len = strlen(lbp)) && (len * list.font_w + draw_x >= draw_w) { |
78 | while (len = strlen(lbp)) && (len * list.font_w + draw_x - left_gap >= draw_w) { |
75 | //Yes, we do. Lets calculate where... |
79 | //Yes, we do. Lets calculate where... |
- | 80 | br = len; |
|
- | 81 | ||
Line 76... | Line 82... | ||
76 | br = strrchr(lbp, ' '); |
82 | //debugln(" \\n"); |
77 | 83 | ||
78 | //Is a new line fits in the current line? |
84 | //Is a new line fits in the current line? |
79 | if (br * list.font_w + draw_x >= draw_w) { |
85 | if (br * list.font_w + draw_x - left_gap >= draw_w) { |
80 | br = draw_w - draw_x /list.font_w; |
86 | br = draw_w - draw_x + left_gap /list.font_w; |
81 | while(br) { |
87 | while(br) { |
82 | if (ESBYTE[lbp + br]==' ') { |
88 | if (ESBYTE[lbp + br]==' ') { |
83 | br++; |
89 | br++; |
Line 133... | Line 139... | ||
133 | if (!cur_img) return false; |
139 | if (!cur_img) return false; |
Line 134... | Line 140... | ||
134 | 140 | ||
135 | img_h = ESDWORD[cur_img+8]; |
141 | img_h = ESDWORD[cur_img+8]; |
Line 136... | Line 142... | ||
136 | img_w = ESDWORD[cur_img+4]; |
142 | img_w = ESDWORD[cur_img+4]; |
137 | 143 | ||
138 | if (img_w + draw_x >= draw_w) NewLine(); |
144 | if (img_w + draw_x - left_gap >= draw_w) NewLine(); |
139 | img_y = draw_y; |
145 | img_y = draw_y; |
Line 140... | Line 146... | ||
140 | if (img_h < list.item_h) img_y += list.item_h - img_h / 2 - 1; else img_y -= 2; |
146 | if (img_h < list.item_h) img_y += list.item_h - img_h / 2 - 1; else img_y -= 2; |
Line 141... | Line 147... | ||
141 | style.cur_line_h = math.max(style.cur_line_h, img_h); |
147 | style.cur_line_h = math.max(style.cur_line_h, img_h); |
Line 142... | Line 148... | ||
142 | 148 | ||
Line -... | Line 149... | ||
- | 149 | img_w = math.min(img_w, canvas.bufw - draw_x); |
|
- | 150 | ||
143 | img_w = math.min(img_w, canvas.bufw - draw_x); |
151 | if (link) links.add_text(draw_x + list.x, img_y + list.y, img_w, img_h, 0); |
144 | 152 | ||
145 | if (link) links.add_text(draw_x + list.x, img_y + list.y, img_w, img_h, 0); |
153 | if (img_y + img_h >= canvas.bufh) canvas.IncreaseBufSize(); |
146 | 154 | ||
147 | if (img_y + img_h >= canvas.bufh) canvas.IncreaseBufSize(); |
155 | if (secondrun) |
Line 158... | Line 166... | ||
158 | imgbuf[08] = canvas.bufh; |
166 | imgbuf[08] = canvas.bufh; |
159 | imgbuf[20] = IMAGE_BPP32; |
167 | imgbuf[20] = IMAGE_BPP32; |
160 | imgbuf[24] = buf_data+8; |
168 | imgbuf[24] = buf_data+8; |
161 | img_blend stdcall(#imgbuf, cur_img, draw_x, img_y, 0, 0, img_w, img_h); |
169 | img_blend stdcall(#imgbuf, cur_img, draw_x, img_y, 0, 0, img_w, img_h); |
162 | img_destroy stdcall(cur_img); |
170 | img_destroy stdcall(cur_img); |
- | 171 | } |
|
Line 163... | Line 172... | ||
163 | 172 | ||
164 | draw_x += img_w; |
173 | draw_x += img_w; |
165 | if (draw_x >= draw_w) NewLine(); |
174 | if (draw_x - left_gap >= draw_w) NewLine(); |
166 | return true; |
175 | return true; |
167 | }>>> |
176 | }>>> |