Rev 7781 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7781 | Rev 7852 | ||
---|---|---|---|
Line 135... | Line 135... | ||
135 | dword end; |
135 | dword end; |
Line 136... | Line 136... | ||
136 | 136 | ||
137 | dword width; |
137 | dword width; |
Line 138... | Line -... | ||
138 | }; |
- | |
139 | - | ||
140 | /* |
- | |
141 | dword line_break; |
- | |
142 | byte char_holder; |
- | |
143 | - | ||
144 | if (ESBYTE[buf.pos]==0x0A) { |
- | |
145 | if (style.pre) { |
- | |
146 | draw.line_break(); |
- | |
147 | continue; |
- | |
148 | } |
- | |
149 | } |
- | |
150 | - | ||
151 | while (get_label_len(text.start) + draw.x + 30 > list.w) |
- | |
152 | { |
- | |
153 | for (line_break=tag.start-1; line_break>text.start; line_break--;) |
- | |
154 | { |
- | |
155 | char_holder = ESBYTE[line_break]; //set line end |
- | |
156 | ESBYTE[line_break] = '\0'; |
- | |
157 | if (get_label_len(text.start) + draw.x + 30 <= list.w) break; |
- | |
158 | ESBYTE[line_break] = char_holder; //restore line |
- | |
159 | } |
- | |
160 | if (draw_on) { |
- | |
161 | if (style.a) { |
- | |
162 | link.add(draw.x,draw.y + size_pt_change,get_label_len(text.start),list.item_h,text.start," "); |
- | |
163 | label_draw_bar(draw.x, draw.y+kfont.size.pt+1, get_label_len(text.start), style.color); |
- | |
164 | } |
- | |
165 | WriteTextIntoBuf(draw.x, draw.y, style.color, text.start); |
- | |
166 | } |
- | |
167 | draw.x+=char_width[' ']; |
- | |
168 | ESBYTE[line_break] = char_holder; //restore line |
- | |
169 | text.start = line_break; |
- | |
170 | draw.line_break(); |
- | |
171 | } |
- | |
172 | if (draw_on) { |
- | |
173 | if (style.a) { |
- | |
174 | link.add(draw.x,draw.y + size_pt_change,get_label_len(text.start),list.item_h,text.start," "); |
- | |
175 | label_draw_bar(draw.x, draw.y+kfont.size.pt+1, get_label_len(text.start), style.color); |
- | |
176 | } |
- | |
177 | WriteTextIntoBuf(draw.x, draw.y, style.color, text.start); |
- | |
178 | } |
- | |
179 | draw.x += char_width[' ']; |
- | |
180 | draw.x += get_label_len(text.start); |
- | |
181 | */ |
- | |
182 | 138 | }; |
|
183 | 139 | ||
184 | /*======================================================== |
140 | /*======================================================== |
185 | = = |
141 | = = |
186 | = DOM = |
142 | = DOM = |
Line 273... | Line 229... | ||
273 | return; |
229 | return; |
274 | } |
230 | } |
275 | */ |
231 | */ |
276 | } |
232 | } |
Line 277... | Line 233... | ||
277 | 233 | ||
278 | void _dom::apply_text() |
234 | void _dom::apply_text(dword _intext) |
- | 235 | { |
|
- | 236 | int label_w; |
|
- | 237 | int textlen = strlen(_intext); |
|
- | 238 | dword curline = malloc(textlen); |
|
279 | { |
239 | |
- | 240 | if (!textlen) || (!style.body) return; |
|
- | 241 | ||
- | 242 | do { |
|
- | 243 | strlcpy(curline, _intext, textlen); |
|
- | 244 | label_w = kfont.get_label_width(curline); |
|
- | 245 | textlen--; |
|
- | 246 | } while (label_w > list.w - draw.x - 10) && (textlen); |
|
280 | if (kfont.size.height) && (style.body) { |
247 | |
- | 248 | kfont.bold = style.bold; |
|
- | 249 | ||
281 | kfont.bold = style.bold; |
250 | if (kfont.size.height) { |
282 | canvas.write_text(draw.x, draw.y, style.color, text.start); |
251 | canvas.write_text(draw.x, draw.y, style.color, curline); |
283 | if (style.a) { |
252 | if (style.a) { |
- | 253 | canvas.draw_hor_line(draw.x, draw.y + list.item_h-2, |
|
284 | canvas.draw_hor_line(draw.x, draw.y + list.item_h-2, kfont.get_label_width(text.start), style.color); |
254 | kfont.get_label_width(curline), style.color); |
- | 255 | link.add(draw.x, draw.y, kfont.get_label_width(curline), |
|
- | 256 | list.item_h, curline, "http://kolibrios.org"); |
|
285 | link.add(draw.x, draw.y, kfont.get_label_width(text.start), list.item_h, text.start, "http://kolibrios.org"); |
257 | } |
- | 258 | } |
|
- | 259 | draw.x += label_w; |
|
- | 260 | strcpy(curline, _intext + textlen); |
|
- | 261 | ||
- | 262 | if (textlen) && (textlen < strlen(_intext)-1) { |
|
- | 263 | draw.x = 0; |
|
- | 264 | draw.y += list.item_h; |
|
286 | } |
265 | apply_text(_intext + textlen); |
287 | } |
266 | } |
Line 288... | Line 267... | ||
288 | } |
267 | } |
289 | 268 | ||
Line 298... | Line 277... | ||
298 | { |
277 | { |
299 | if (ESBYTE[i]=='<') { |
278 | if (ESBYTE[i]=='<') { |
300 | tag.start = i+1; |
279 | tag.start = i+1; |
301 | text.end = i-1; |
280 | text.end = i-1; |
302 | ESBYTE[i] = '\0'; |
281 | ESBYTE[i] = '\0'; |
303 | apply_text(); |
282 | apply_text(text.start); |
304 | } |
283 | } |
305 | if (ESBYTE[i]=='>') { |
284 | if (ESBYTE[i]=='>') { |
306 | tag.end = i-1; |
285 | tag.end = i-1; |
307 | text.start = i+1; |
286 | text.start = i+1; |
308 | ESBYTE[i] = '\0'; |
287 | ESBYTE[i] = '\0'; |
Line 336... | Line 315... | ||
336 | ChangeCharset(encoding, "CP866", io.buffer_data); |
315 | ChangeCharset(encoding, "CP866", io.buffer_data); |
337 | link.clear(); |
316 | link.clear(); |
Line 338... | Line 317... | ||
338 | 317 | ||
Line 339... | Line 318... | ||
339 | kfont.size.height = 0; |
318 | kfont.size.height = 0; |
Line 340... | Line 319... | ||
340 | 319 | ||
Line 341... | Line 320... | ||
341 | if ( strstri(io.buffer_data, " |
320 | dom.parse(); |
342 | 321 | ||
343 | kfont.ApplySmooth(); |
- | |
344 | - | ||
345 | DrawPage(); |
- | |
346 | } |
- | |
347 | - | ||
348 | void ParseTxt() |
- | |
349 | { |
- | |
350 | _canvas canvas; |
- | |
351 | byte ch, zeroch=0; |
- | |
352 | dword bufoff, buflen, line_start, srch_pos; |
- | |
353 | int stroka_y=5, line_length=0; |
- | |
354 | - | ||
355 | line_start=io.buffer_data; |
- | |
356 | buflen = strlen(io.buffer_data) + io.buffer_data; |
- | |
357 | for (bufoff=io.buffer_data; bufoff |
- | |
358 | { |
- | |
359 | ch = ESBYTE[bufoff]; |
- | |
360 | line_length += kfont_char_width[ch]; |
- | |
361 | if (line_length>=list.w-30) || (ch==10) { |
- | |
362 | srch_pos = bufoff; |
- | |
363 | loop() |
- | |
364 | { |
- | |
365 | if (__isWhite(ESBYTE[srch_pos])) { bufoff=srch_pos+1; break; } //normal word-break |
- | |
366 | if (srch_pos == line_start) break; //no white space found in whole line |
- | |
367 | srch_pos--; |
- | |
368 | } |
- | |
369 | if (kfont.size.height) { |
- | |
370 | ESBYTE[bufoff] >< zeroch; //set line end |
- | |
371 | canvas.write_text(8, stroka_y, 0x000000, line_start); |
- | |
372 | ESBYTE[bufoff] >< zeroch; //restore line |
- | |
373 | } |
- | |
374 | stroka_y += list.item_h; |
- | |
375 | line_start = bufoff; |
- | |
376 | line_length = 0; |
- | |
377 | } |
- | |
378 | } |
- | |
379 | if (!kfont.size.height) { |
- | |
380 | list.count = stroka_y/list.item_h+3; |
- | |
381 | if (list.count < list.visible) list.count = list.visible; |
- | |
382 | kfont.size.height = list.count+5*list.item_h; |
- | |
383 | kfont.raw_size = 0; |
- | |
384 | ParseTxt(); |
322 | kfont.ApplySmooth(); |