Rev 5724 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5724 | Rev 5746 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | dword bufpointer; |
1 | dword bufpointer; |
2 | dword o_bufpointer; |
2 | dword o_bufpointer; |
3 | dword bufsize; |
3 | dword bufsize; |
Line 4... | Line -... | ||
4 | - | ||
5 | char URL[10000]; |
- | |
6 | 4 | ||
Line -... | Line 5... | ||
- | 5 | scroll_bar scroll_wv = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
|
- | 6 | ||
7 | scroll_bar scroll_wv = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
7 | enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT}; |
- | 8 | ||
- | 9 | struct _style { |
|
- | 10 | byte |
|
- | 11 | b, i, u, s, |
|
- | 12 | pre, |
|
- | 13 | blq, |
|
- | 14 | li, |
|
- | 15 | li_tab, |
|
Line 8... | Line 16... | ||
8 | 16 | align; |
|
9 | char header[2048]; |
17 | }; |
- | 18 | ||
10 | 19 | struct TWebBrowser { |
|
11 | struct TWebBrowser { |
20 | llist list; |
12 | llist list; |
- | |
13 | dword draw_line_width; |
21 | _style style; |
14 | DrawBufer DrawBuf; |
22 | dword draw_line_width; |
15 | void Prepare(); |
23 | DrawBufer DrawBuf; |
16 | void Parse(); |
24 | void Parse(); |
17 | void SetTextStyle(); |
25 | void SetTextStyle(); |
18 | void DrawPage(); |
26 | void DrawPage(); |
19 | void DrawScroller(); |
27 | void DrawScroller(); |
20 | void NewLine(); |
28 | void NewLine(); |
Line -... | Line 29... | ||
- | 29 | void Perenos(); |
|
- | 30 | byte end_parsing; |
|
- | 31 | } WB1; |
|
- | 32 | ||
- | 33 | ||
- | 34 | ||
- | 35 | byte |
|
- | 36 | link, |
|
- | 37 | ignor_text, |
|
21 | void Perenos(); |
38 | cur_encoding, |
- | 39 | t_html, |
|
22 | byte end_parsing; |
40 | t_body; |
- | 41 | /* |
|
- | 42 | struct _condition { |
|
- | 43 | byte |
|
- | 44 | text_active, |
|
- | 45 | text_val, |
|
- | 46 | href, |
|
23 | } WB1; |
47 | max |
Line 24... | Line -... | ||
24 | - | ||
Line 25... | Line 48... | ||
25 | byte b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, li_tab, |
48 | } condition; |
26 | link, ignor_text, cur_encoding, text_align, t_html, t_body; |
49 | */ |
27 | byte condition_text_active, condition_text_val, condition_href, condition_max; |
50 | |
28 | 51 | byte condition_text_active, condition_text_val, condition_href, condition_max; |
|
Line 37... | Line 60... | ||
37 | int stroka; |
60 | int stroka; |
38 | int stolbec; |
61 | int stolbec; |
39 | int tab_len; |
62 | int tab_len; |
40 | int anchor_line_num; |
63 | int anchor_line_num; |
Line -... | Line 64... | ||
- | 64 | ||
- | 65 | char URL[10000]; |
|
41 | 66 | char header[2048]; |
|
42 | char line[500]; |
- | |
43 | char tag[100]; |
67 | char line[500]; |
- | 68 | char tagparam[10000]; |
|
44 | char tagparam[10000]; |
69 | char tag[100]; |
45 | char parametr[1200]; |
70 | char attr[1200]; |
46 | char options[4096]; |
71 | char val[4096]; |
Line 47... | Line 72... | ||
47 | char anchor[256]; |
72 | char anchor[256]; |
48 | 73 | ||
49 | #include "..\TWB\history.h" |
74 | #include "..\TWB\history.h" |
Line 79... | Line 104... | ||
79 | start_y = stroka * list.line_h + magrin_left + list.y; |
104 | start_y = stroka * list.line_h + magrin_left + list.y; |
80 | stolbec_len = utf8_strlen(#line); |
105 | stolbec_len = utf8_strlen(#line); |
81 | line_length = stolbec_len * list.font_w * DrawBuf.zoom; |
106 | line_length = stolbec_len * list.font_w * DrawBuf.zoom; |
Line 82... | Line 107... | ||
82 | 107 | ||
83 | WriteBufText(start_x, 0, list.font_type, text_colors[text_color_index], #line, buf_data); |
108 | WriteBufText(start_x, 0, list.font_type, text_colors[text_color_index], #line, buf_data); |
84 | if (b_text) WriteBufText(start_x+1, 0, list.font_type, text_colors[text_color_index], #line, buf_data); |
109 | if (style.b) WriteBufText(start_x+1, 0, list.font_type, text_colors[text_color_index], #line, buf_data); |
85 | if (i_text) { stolbec++; DrawBuf.Skew(start_x, 0, line_length, list.line_h); } // bug with zoom>1 |
110 | if (style.i) { stolbec++; DrawBuf.Skew(start_x, 0, line_length, list.line_h); } // bug with zoom>1 |
86 | if (s_text) DrawBuf.DrawBar(start_x, list.line_h / 2 - DrawBuf.zoom, line_length, DrawBuf.zoom, text_colors[text_color_index]); |
111 | if (style.s) DrawBuf.DrawBar(start_x, list.line_h / 2 - DrawBuf.zoom, line_length, DrawBuf.zoom, text_colors[text_color_index]); |
87 | if (u_text) DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom, line_length, DrawBuf.zoom, text_colors[text_color_index]); |
112 | if (style.u) DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom, line_length, DrawBuf.zoom, text_colors[text_color_index]); |
88 | if (link) { |
113 | if (link) { |
89 | DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom, line_length, DrawBuf.zoom, text_colors[text_color_index]); |
114 | DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom, line_length, DrawBuf.zoom, text_colors[text_color_index]); |
90 | UnsafeDefineButton(start_x-2, start_y-1, line_length + 3, DrawBuf.zoom * list.font_h, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
115 | UnsafeDefineButton(start_x-2, start_y-1, line_length + 3, DrawBuf.zoom * list.font_h, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
91 | PageLinks.AddText(#line, line_length, list.line_h, UNDERLINE); |
116 | PageLinks.AddText(#line, line_length, list.line_h, UNDERLINE); |
Line 94... | Line 119... | ||
94 | } |
119 | } |
95 | } |
120 | } |
96 | //======================================================================= |
121 | //======================================================================= |
Line 97... | Line -... | ||
97 | - | ||
98 | - | ||
99 | void TWebBrowser::Prepare(dword bufpos, in_filesize){ |
- | |
100 | bufsize = in_filesize; |
- | |
101 | bufpointer = bufpos; |
- | |
102 | Parse(); |
- | |
103 | } |
- | |
104 | 122 | ||
105 | 123 | ||
106 | void TWebBrowser::Parse(){ |
124 | void TWebBrowser::Parse(){ |
107 | word bukva[2]; |
125 | word bukva[2]; |
108 | int j; |
126 | int j; |
109 | byte ignor_param; |
127 | byte ignor_param; |
110 | char temp[768]; |
128 | char temp[768]; |
Line 111... | Line 129... | ||
111 | dword bufpos = bufpointer; |
129 | dword bufpos = bufpointer; |
112 | int line_len; |
130 | int line_len; |
113 | 131 | ||
114 | b_text = i_text = u_text = s_text = blq_text = t_html = t_body = |
132 | style.b = style.i = style.u = style.s = style.blq = t_html = t_body = |
115 | li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = |
133 | style.li = link = ignor_text = text_color_index = text_colors[0] = |
116 | condition_text_val = condition_text_active = 0; //îáíóëÿåì òåãè |
134 | style.li_tab = condition_text_val = condition_text_active = 0; //îáíóëÿåì òåãè |
117 | end_parsing = false; |
135 | end_parsing = false; |
118 | condition_max = 255; |
136 | condition_max = 255; |
119 | text_align = ALIGN_LEFT; |
137 | style.align = ALIGN_LEFT; |
120 | link_color_inactive = 0x0000FF; |
138 | link_color_inactive = 0x0000FF; |
121 | link_color_active = 0xFF0000; |
139 | link_color_active = 0xFF0000; |
Line 127... | Line 145... | ||
127 | stolbec = 0; |
145 | stolbec = 0; |
128 | line = 0; |
146 | line = 0; |
Line 129... | Line 147... | ||
129 | 147 | ||
Line 130... | Line -... | ||
130 | draw_line_width = list.w * DrawBuf.zoom; |
- | |
131 | - | ||
132 | if (pre_text<>2) |
148 | draw_line_width = list.w * DrawBuf.zoom; |
133 | { |
149 | |
134 | pre_text=0; |
- | |
Line 135... | Line 150... | ||
135 | if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; |
150 | style.pre = 1; |
136 | } |
151 | if (strstri(bufpointer, "html")) style.pre = 0; |
137 | 152 | ||
138 | for ( ; (bufpointer+bufsize > bufpos) && (ESBYTE[bufpos]!=0); bufpos++;) |
153 | for ( ; (bufpointer+bufsize > bufpos) && (ESBYTE[bufpos]!=0); bufpos++;) |
139 | { |
154 | { |
140 | if (end_parsing) break; |
155 | if (end_parsing) break; |
141 | bukva = ESBYTE[bufpos]; |
156 | bukva = ESBYTE[bufpos]; |
142 | if (ignor_text) && (bukva!='<') continue; |
157 | if (ignor_text) && (bukva!='<') continue; |
143 | if (condition_text_active) && (condition_text_val != condition_href) && (bukva!='<') continue; |
158 | if (condition_text_active) && (condition_text_val != condition_href) && (bukva!='<') continue; |
144 | switch (bukva) |
159 | switch (bukva) |
145 | { |
160 | { |
146 | case 0x0a: |
161 | case 0x0a: |
147 | if (pre_text) |
162 | if (style.pre) |
148 | { |
163 | { |
149 | chrcat(#line, ' '); |
164 | chrcat(#line, ' '); |
150 | bukva = temp = NULL; |
165 | bukva = temp = NULL; |
151 | Perenos(); |
166 | Perenos(); |
152 | break; |
167 | break; |
153 | } |
168 | } |
154 | case '\9': |
169 | case '\9': |
155 | if (pre_text) //èíà÷å èä¸ì íà 0x0d |
170 | if (style.pre) //èíà÷å èä¸ì íà 0x0d |
156 | { |
171 | { |
157 | tab_len = strlen(#line) % 4; |
172 | tab_len = strlen(#line) % 4; |
Line 171... | Line 186... | ||
171 | } |
186 | } |
172 | if (bukva = GetUnicodeSymbol()) goto DEFAULT_MARK; |
187 | if (bukva = GetUnicodeSymbol()) goto DEFAULT_MARK; |
173 | break; |
188 | break; |
174 | case '<': |
189 | case '<': |
175 | bufpos++; //ïðîìîòàåì ñèìâîë < |
190 | bufpos++; //ïðîìîòàåì ñèìâîë < |
176 | tag = parametr = tagparam = ignor_param = NULL; |
191 | tag = attr = tagparam = ignor_param = NULL; |
177 | if (ESBYTE[bufpos] == '!') //ôèëüòðàöèÿ âíóòðè , äåðçêî |
192 | if (ESBYTE[bufpos] == '!') //ôèëüòðàöèÿ âíóòðè , äåðçêî |
178 | { |
193 | { |
179 | bufpos++; |
194 | bufpos++; |
180 | if (ESBYTE[bufpos] == '-') |
195 | if (ESBYTE[bufpos] == '-') |
181 | { |
196 | { |
Line 217... | Line 232... | ||
217 | 232 | ||
218 | if (stolbec + utf8_strlen(#line) > list.column_max) Perenos(); |
233 | if (stolbec + utf8_strlen(#line) > list.column_max) Perenos(); |
219 | DrawPage(); |
234 | DrawPage(); |
220 | line = NULL; |
235 | line = NULL; |
221 | if (tag) SetTextStyle(WB1.DrawBuf.zoom * 5 + list.x, stroka * list.line_h + list.y + 5); //îáðàáîòêà òåãîâ |
236 | if (tag) SetTextStyle(WB1.DrawBuf.zoom * 5 + list.x, stroka * list.line_h + list.y + 5); //îáðàáîòêà òåãîâ |
222 | tag = parametr = tagparam = ignor_param = NULL; |
237 | tag = attr = tagparam = ignor_param = NULL; |
223 | break; |
238 | break; |
224 | default: |
239 | default: |
225 | DEFAULT_MARK: |
240 | DEFAULT_MARK: |
226 | if (bukva<=15) bukva=' '; |
241 | if (bukva<=15) bukva=' '; |
227 | line_len = utf8_strlen(#line); |
242 | line_len = utf8_strlen(#line); |
228 | if (!pre_text) && (bukva == ' ') |
243 | if (!style.pre) && (bukva == ' ') |
229 | { |
244 | { |
230 | if (line[line_len-1]==' ') break; //no double spaces |
245 | if (line[line_len-1]==' ') break; //no double spaces |
231 | if (!stolbec) && (!line) break; //no paces at the beginning of the line |
246 | if (!stolbec) && (!line) break; //no paces at the beginning of the line |
232 | } |
247 | } |
Line 274... | Line 289... | ||
274 | opened = 0; |
289 | opened = 0; |
275 | strcpy(#tag, #tag+1); |
290 | strcpy(#tag, #tag+1); |
276 | } |
291 | } |
277 | else opened = 1; |
292 | else opened = 1; |
Line 278... | Line 293... | ||
278 | 293 | ||
279 | if (isTag("html")) |
294 | if (istag("html")) |
280 | { |
295 | { |
281 | t_html = opened; |
296 | t_html = opened; |
282 | return; |
297 | return; |
Line 283... | Line 298... | ||
283 | } |
298 | } |
284 | 299 | ||
Line 285... | Line 300... | ||
285 | if (isTag("script")) || (isTag("style")) || (isTag("binary")) || (isTag("select")) ignor_text = opened; |
300 | if (istag("script")) || (istag("style")) || (istag("binary")) || (istag("select")) ignor_text = opened; |
286 | if (isTag("form")) if (!opened) ignor_text = false; |
301 | if (istag("form")) if (!opened) ignor_text = false; |
287 | 302 | ||
288 | if(isTag("title")) |
303 | if(istag("title")) |
289 | { |
304 | { |
290 | if (opened) header=NULL; |
305 | if (opened) header=NULL; |
Line 291... | Line 306... | ||
291 | else if (!stroka) DrawTitle(#header); //òåã çàêðûëñÿ - âûâåëè ñòðîêó |
306 | else if (!stroka) DrawTitle(#header); //òåã çàêðûëñÿ - âûâåëè ñòðîêó |
Line 292... | Line 307... | ||
292 | return; |
307 | return; |
293 | } |
- | |
294 | - | ||
295 | if (ignor_text) return; |
308 | } |
296 | - | ||
297 | IF(isTag("q")) |
309 | |
298 | { |
- | |
299 | if (opened) |
- | |
300 | { |
- | |
301 | NewLine(); |
310 | if (ignor_text) return; |
302 | strcat(#line, ' \"'); |
- | |
303 | } |
- | |
304 | if (!opened) |
311 | |
Line 305... | Line 312... | ||
305 | { |
312 | IF(istag("q")) |
306 | chrcat(#line, '\"'); |
313 | { |
307 | NewLine(); |
314 | if (opened) strcat(#line, " \""); |
308 | } |
315 | if (!opened) strcat(#line, "\" "); |
Line 309... | Line 316... | ||
309 | } |
316 | } |
310 | 317 | ||
311 | if (anchor) && (!strcmp(#parametr, "id=")) //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò |
318 | if (anchor) && (isattr("id=")) //î÷åíü ïëîõî!!! ïîòîìó ÷òî åñëè íå ïîñëåäíèé òåã, ðàáîòàòü íå áóäåò |
312 | { |
319 | { |
313 | if (!strcmp(#anchor, #options)) anchor_line_num=list.first+stroka; |
320 | if (!strcmp(#anchor, #val)) anchor_line_num=list.first+stroka; |
314 | } |
321 | } |
315 | 322 | ||
316 | if (isTag("body")) |
323 | if (istag("body")) |
317 | { |
324 | { |
318 | t_body = opened; |
325 | t_body = opened; |
319 | do{ |
326 | do{ |
320 | if (!strcmp(#parametr, "condition_max=")) condition_max = atoi(#options); |
327 | if (isattr("condition_max=")) condition_max = atoi(#val); |
321 | if (!strcmp(#parametr, "link=")) link_color_inactive = GetColor(#options); |
328 | if (isattr("link=")) link_color_inactive = GetColor(#val); |
322 | if (!strcmp(#parametr, "alink=")) link_color_active = GetColor(#options); |
329 | if (isattr("alink=")) link_color_active = GetColor(#val); |
323 | if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options); |
330 | if (isattr("text=")) text_colors[0]=GetColor(#val); |
324 | if (!strcmp(#parametr, "bgcolor=")) |
331 | if (isattr("bgcolor=")) |
Line 333... | Line 340... | ||
333 | //BufEncode(CH_UTF8); |
340 | //BufEncode(CH_UTF8); |
334 | } |
341 | } |
335 | return; |
342 | return; |
336 | } |
343 | } |
Line 337... | Line 344... | ||
337 | 344 | ||
338 | if (isTag("a")) |
345 | if (istag("a")) |
339 | { |
346 | { |
340 | if (opened) |
347 | if (opened) |
341 | { |
348 | { |
Line 342... | Line 349... | ||
342 | if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò |
349 | if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò |
343 | 350 | ||
344 | do{ |
351 | do{ |
345 | if (!strcmp(#parametr, "href=")) |
352 | if (isattr("href=")) |
Line 346... | Line 353... | ||
346 | { |
353 | { |
347 | if (stroka - 1 > list.visible) || (stroka < -2) return; |
354 | if (stroka - 1 > list.visible) || (stroka < -2) return; |
Line 348... | Line 355... | ||
348 | 355 | ||
349 | text_color_index++; |
356 | text_color_index++; |
350 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
357 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
351 | 358 | ||
352 | link = 1; |
359 | link = 1; |
353 | text_colors[text_color_index] = link_color_inactive; |
360 | text_colors[text_color_index] = link_color_inactive; |
354 | PageLinks.AddLink(#options, DrawBuf.zoom * stolbec * list.font_w + left1, top1-DrawBuf.zoom); |
361 | PageLinks.AddLink(#val, DrawBuf.zoom * stolbec * list.font_w + left1, top1-DrawBuf.zoom); |
355 | } |
362 | } |
356 | if (anchor) && (!strcmp(#parametr, "name=")) |
363 | if (anchor) && (isattr("name=")) |
357 | { |
364 | { |
358 | if (!strcmp(#anchor, #options)) |
365 | if (!strcmp(#anchor, #val)) |
359 | { |
366 | { |
Line 367... | Line 374... | ||
367 | IF(text_color_index > 0) text_color_index--; |
374 | IF(text_color_index > 0) text_color_index--; |
368 | } |
375 | } |
369 | return; |
376 | return; |
370 | } |
377 | } |
Line 371... | Line 378... | ||
371 | 378 | ||
372 | if (isTag("font")) |
379 | if (istag("font")) |
373 | { |
380 | { |
374 | if (opened) |
381 | if (opened) |
375 | { |
382 | { |
376 | text_color_index++; |
383 | text_color_index++; |
Line 377... | Line 384... | ||
377 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
384 | text_colors[text_color_index] = text_colors[text_color_index-1]; |
378 | 385 | ||
379 | do{ |
386 | do{ |
380 | if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#') |
387 | if (strcmp(#attr, "color=") == 0) //&& (attr[1] == '#') |
381 | { |
388 | { |
382 | text_colors[text_color_index] = GetColor(#options); |
389 | text_colors[text_color_index] = GetColor(#val); |
383 | } |
390 | } |
384 | } while(GetNextParam()); |
391 | } while(GetNextParam()); |
385 | } |
392 | } |
386 | else |
393 | else |
387 | if (text_color_index > 0) text_color_index--; |
394 | if (text_color_index > 0) text_color_index--; |
388 | return; |
395 | return; |
389 | } |
396 | } |
390 | if (isTag("br")) { |
397 | if (istag("br")) { |
391 | NewLine(); |
398 | NewLine(); |
392 | return; |
399 | return; |
393 | } |
400 | } |
394 | if (isTag("div")) || (isTag("header")) || (isTag("article")) || (isTag("footer")) { |
401 | if (istag("div")) || (istag("header")) || (istag("article")) || (istag("footer")) { |
395 | IF(oldtag[0] <>'h') NewLine(); |
402 | IF(oldtag[0] <>'h') NewLine(); |
396 | if (!strcmp(#parametr, "bgcolor=")) |
403 | if (isattr("bgcolor=")) |
397 | { |
404 | { |
398 | bg_color=GetColor(#options); |
405 | bg_color=GetColor(#val); |
399 | DrawBuf.Fill(bg_color); |
406 | DrawBuf.Fill(bg_color); |
400 | } |
407 | } |
401 | return; |
408 | return; |
402 | } |
409 | } |
403 | if (isTag("p")) { |
410 | if (istag("p")) { |
404 | IF(oldtag[0] == 'h') return; |
411 | IF(oldtag[0] == 'h') return; |
405 | NewLine(); |
412 | NewLine(); |
406 | IF(opened) NewLine(); |
413 | IF(opened) NewLine(); |
Line 407... | Line 414... | ||
407 | return; |
414 | return; |
408 | } |
415 | } |
409 | 416 | ||
410 | if(isTag("table")) { |
417 | if(istag("table")) { |
411 | table.active = opened; |
418 | table.active = opened; |
Line 412... | Line 419... | ||
412 | NewLine(); |
419 | NewLine(); |
413 | if (opened) table.NewTable(); |
420 | if (opened) table.NewTable(); |
414 | } |
421 | } |
415 | 422 | ||
416 | if(isTag("td")) { |
423 | if(istag("td")) { |
417 | if (opened) |
424 | if (opened) |
418 | { |
425 | { |
419 | table.cur_col++; |
426 | table.cur_col++; |
420 | table.row_h = 0; |
427 | table.row_h = 0; |
421 | do { |
428 | do { |
422 | if (!strcmp(#parametr, "width=")) |
429 | if (isattr("width=")) |
423 | { |
430 | { |
424 | table.col_w[table.cur_col] = atoi(#options); |
431 | table.col_w[table.cur_col] = atoi(#val); |
425 | // NewLine(); |
432 | // NewLine(); |
426 | // strcpy(#line, #options); |
433 | // strcpy(#line, #val); |
427 | // NewLine(); |
434 | // NewLine(); |
428 | } |
435 | } |
429 | } while(GetNextParam()); |
436 | } while(GetNextParam()); |
430 | } |
437 | } |
431 | else |
438 | else |
Line 432... | Line 439... | ||
432 | { |
439 | { |
433 | if (table.row_h > table.row_max_h) table.row_max_h = table.row_h; |
440 | if (table.row_h > table.row_max_h) table.row_max_h = table.row_h; |
434 | } |
441 | } |
435 | } |
442 | } |
436 | 443 | ||
437 | if(isTag("tr")) { |
444 | if(istag("tr")) { |
Line 449... | Line 456... | ||
449 | table.max_cols = table.cur_col; |
456 | table.max_cols = table.cur_col; |
450 | } |
457 | } |
451 | } |
458 | } |
Line 452... | Line 459... | ||
452 | 459 | ||
453 | /* |
460 | /* |
454 | if (isTag("center")) |
461 | if (istag("center")) |
455 | { |
462 | { |
456 | if (opened) text_align = ALIGN_CENTER; |
463 | if (opened) style.align = ALIGN_CENTER; |
457 | if (!opened) |
464 | if (!opened) |
458 | { |
465 | { |
459 | NewLine(); |
466 | NewLine(); |
460 | text_align = ALIGN_LEFT; |
467 | style.align = ALIGN_LEFT; |
461 | } |
468 | } |
462 | return; |
469 | return; |
463 | } |
470 | } |
464 | if (isTag("right")) |
471 | if (istag("right")) |
465 | { |
472 | { |
466 | if (opened) text_align = ALIGN_RIGHT; |
473 | if (opened) style.align = ALIGN_RIGHT; |
467 | if (!opened) |
474 | if (!opened) |
468 | { |
475 | { |
469 | NewLine(); |
476 | NewLine(); |
470 | text_align = ALIGN_LEFT; |
477 | style.align = ALIGN_LEFT; |
471 | } |
478 | } |
472 | return; |
479 | return; |
473 | } |
480 | } |
474 | */ |
481 | */ |
475 | if (isTag("h1")) || (isTag("h2")) || (isTag("h3")) || (isTag("h4")) { |
482 | if (istag("h1")) || (istag("h2")) || (istag("h3")) || (istag("h4")) { |
476 | NewLine(); |
483 | NewLine(); |
477 | if (opened) && (stroka>1) NewLine(); |
484 | if (opened) && (stroka>1) NewLine(); |
478 | strcpy(#oldtag, #tag); |
485 | strcpy(#oldtag, #tag); |
479 | if (opened) |
486 | if (opened) |
480 | { |
487 | { |
481 | if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"center")) text_align = ALIGN_CENTER; |
488 | if (isattr("align=")) && (isval("center")) style.align = ALIGN_CENTER; |
482 | if (!strcmp(#parametr, "align=")) && (!strcmp(#options,"right")) text_align = ALIGN_RIGHT; |
489 | if (isattr("align=")) && (isval("right")) style.align = ALIGN_RIGHT; |
483 | b_text = 1; |
490 | style.b = 1; |
484 | } |
491 | } |
485 | if (!opened) |
492 | if (!opened) |
486 | { |
493 | { |
487 | text_align = ALIGN_LEFT; |
494 | style.align = ALIGN_LEFT; |
488 | b_text = 0; |
495 | style.b = 0; |
489 | } |
496 | } |
490 | return; |
497 | return; |
491 | } |
498 | } |
492 | else |
499 | else |
Line 493... | Line 500... | ||
493 | oldtag=NULL; |
500 | oldtag=NULL; |
494 | 501 | ||
495 | if (isTag("b")) || (isTag("strong")) || (isTag("big")) { |
502 | if (istag("b")) || (istag("strong")) || (istag("big")) { |
496 | b_text = opened; |
503 | style.b = opened; |
497 | return; |
504 | return; |
498 | } |
505 | } |
499 | if(isTag("i")) || (isTag("em")) || (isTag("subtitle")) { |
506 | if(istag("i")) || (istag("em")) || (istag("subtitle")) { |
500 | i_text = opened; |
507 | style.i = opened; |
501 | return; |
508 | return; |
502 | } |
509 | } |
503 | if (isTag("dt")) |
510 | if (istag("dt")) |
504 | { |
511 | { |
505 | li_text = opened; |
512 | style.li = opened; |
506 | IF(opened == 0) return; |
513 | IF(opened == 0) return; |
507 | NewLine(); |
514 | NewLine(); |
508 | return; |
515 | return; |
509 | } |
516 | } |
510 | if (isTag("condition")) |
517 | if (istag("condition")) |
511 | { |
518 | { |
512 | condition_text_active = opened; |
519 | condition_text_active = opened; |
513 | if (opened) && (!strcmp(#parametr, "show_if=")) condition_text_val = atoi(#options); |
520 | if (opened) && (isattr("show_if=")) condition_text_val = atoi(#val); |
514 | return; |
521 | return; |
515 | } |
522 | } |
516 | if (isTag("li")) || (isTag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè |
523 | if (istag("li")) || (istag("dt")) //íàäî ñäåëàòü âëîæåííûå ñïèñêè |
517 | { |
524 | { |
518 | li_text = opened; |
525 | style.li = opened; |
519 | if (opened) |
526 | if (opened) |
520 | { |
527 | { |
521 | NewLine(); |
528 | NewLine(); |
522 | if (stroka > -1) && (stroka - 2 < list.visible) |
529 | if (stroka > -1) && (stroka - 2 < list.visible) |
523 | DrawBuf.DrawBar(li_tab * 5 * list.font_w * DrawBuf.zoom + list.x, list.line_h / 2 - DrawBuf.zoom - DrawBuf.zoom, DrawBuf.zoom*2, DrawBuf.zoom*2, 0x555555); |
530 | DrawBuf.DrawBar(style.li_tab * 5 * list.font_w * DrawBuf.zoom + list.x, list.line_h / 2 - DrawBuf.zoom - DrawBuf.zoom, DrawBuf.zoom*2, DrawBuf.zoom*2, 0x555555); |
524 | } |
531 | } |
525 | return; |
532 | return; |
526 | } |
533 | } |
527 | if (isTag("u")) || (isTag("ins")) u_text = opened; |
534 | if (istag("u")) || (istag("ins")) style.u = opened; |
528 | if (isTag("s")) || (isTag("strike")) || (isTag("del")) s_text = opened; |
535 | if (istag("s")) || (istag("strike")) || (istag("del")) style.s = opened; |
529 | if (isTag("ul")) || (isTag("ol")) IF(!opened) |
536 | if (istag("ul")) || (istag("ol")) IF(!opened) |
530 | { |
537 | { |
531 | li_text = opened; |
538 | style.li = opened; |
532 | li_tab--; |
539 | style.li_tab--; |
533 | NewLine(); |
540 | NewLine(); |
534 | } ELSE li_tab++; |
541 | } ELSE style.li_tab++; |
535 | if (isTag("dd")) stolbec += 5; |
542 | if (istag("dd")) stolbec += 5; |
536 | if (isTag("blockquote")) blq_text = opened; |
543 | if (istag("blockquote")) style.blq = opened; |
537 | if (isTag("pre")) || (isTag("code")) pre_text = opened; |
544 | if (istag("pre")) || (istag("code")) style.pre = opened; |
538 | if (isTag("hr")) |
545 | if (istag("hr")) |
539 | { |
546 | { |
540 | if (anchor) || (stroka < -1) |
547 | if (anchor) || (stroka < -1) |
541 | { |
548 | { |
542 | stroka+=2; |
549 | stroka+=2; |
543 | return; |
550 | return; |
544 | } |
551 | } |
545 | if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999; |
552 | if (strcmp(#attr, "color=") == 0) hr_color = GetColor(#val); else hr_color = 0x999999; |
546 | NewLine(); |
553 | NewLine(); |
547 | DrawBuf.DrawBar(5, list.line_h/2, list.w-10, 1, hr_color); |
554 | DrawBuf.DrawBar(5, list.line_h/2, list.w-10, 1, hr_color); |
548 | NewLine(); |
555 | NewLine(); |
549 | } |
556 | } |
550 | if (isTag("img")) |
557 | if (istag("img")) |
551 | { |
558 | { |
552 | ImgCache.Images( left1, top1, WB1.list.w); |
559 | ImgCache.Images( left1, top1, WB1.list.w); |
553 | return; |
560 | return; |
554 | } |
561 | } |
555 | if (isTag("meta")) || (isTag("?xml")) |
562 | if (istag("meta")) || (istag("?xml")) |
556 | { |
563 | { |
557 | do{ |
564 | do{ |
558 | if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content=")) || (!strcmp(#parametr, "encoding=")) |
565 | if (isattr("charset=")) || (isattr("content=")) || (isattr("encoding=")) |
559 | { |
566 | { |
560 | strcpy(#options, #options[strrchr(#options, '=')]); //ïîèñê â content= |
567 | strcpy(#val, #val[strrchr(#val, '=')]); //ïîèñê â content= |
561 | strlwr(#options); |
568 | strlwr(#val); |
562 | meta_encoding = CH_NULL; |
569 | meta_encoding = CH_NULL; |
563 | if (!strcmp(#options, "utf-8")) || (!strcmp(#options,"utf8")) meta_encoding = CH_UTF8; |
570 | if (isval("utf-8")) || (isval("utf8")) meta_encoding = CH_UTF8; |
564 | else if (!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) meta_encoding = CH_KOI8; |
571 | else if (isval("koi8-r")) || (isval("koi8-u")) meta_encoding = CH_KOI8; |
565 | else if (!strcmp(#options, "windows-1251")) || (!strcmp(#options, "windows1251")) meta_encoding = CH_CP1251; |
572 | else if (isval("windows-1251")) || (isval("windows1251")) meta_encoding = CH_CP1251; |
566 | else if (!strcmp(#options, "windows-1252")) || (!strcmp(#options, "windows1252")) meta_encoding = CH_CP1252; |
573 | else if (isval("windows-1252")) || (isval("windows1252")) meta_encoding = CH_CP1252; |
567 | else if (!strcmp(#options, "iso-8859-5")) || (!strcmp(#options, "iso8859-5")) meta_encoding = CH_ISO8859_5; |
574 | else if (isval("iso-8859-5")) || (isval("iso8859-5")) meta_encoding = CH_ISO8859_5; |
568 | else if (!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) meta_encoding = CH_CP866; |
575 | else if (isval("dos")) || (isval("cp-866")) meta_encoding = CH_CP866; |
569 | if (cur_encoding==CH_NULL) BufEncode(meta_encoding); |
576 | if (cur_encoding==CH_NULL) BufEncode(meta_encoding); |
570 | return; |
577 | return; |
571 | } |
578 | } |
Line 619... | Line 626... | ||
619 | ontop = stroka * list.line_h + list.y + 5; |
626 | ontop = stroka * list.line_h + list.y + 5; |
620 | if (!stroka) DrawBar(list.x, list.y, draw_line_width, 5, bg_color); |
627 | if (!stroka) DrawBar(list.x, list.y, draw_line_width, 5, bg_color); |
621 | if (t_html) && (!t_body) return; |
628 | if (t_html) && (!t_body) return; |
622 | if (stroka * list.line_h + 5 >= 0) && ( stroka + 1 * list.line_h + 5 < list.h) && (!anchor) |
629 | if (stroka * list.line_h + 5 >= 0) && ( stroka + 1 * list.line_h + 5 < list.h) && (!anchor) |
623 | { |
630 | { |
624 | if (text_align == ALIGN_CENTER) && (DrawBuf.zoom==1) DrawBuf.AlignCenter(onleft,ontop,list.w,list.line_h,stolbec * list.font_w); |
631 | if (style.align == ALIGN_CENTER) && (DrawBuf.zoom==1) DrawBuf.AlignCenter(onleft,ontop,list.w,list.line_h,stolbec * list.font_w); |
625 | if (text_align == ALIGN_RIGHT) && (DrawBuf.zoom==1) DrawBuf.AlignRight(onleft,ontop,list.w,list.line_h,stolbec * list.font_w); |
632 | if (style.align == ALIGN_RIGHT) && (DrawBuf.zoom==1) DrawBuf.AlignRight(onleft,ontop,list.w,list.line_h,stolbec * list.font_w); |
626 | DrawBuf.bufy = ontop; |
633 | DrawBuf.bufy = ontop; |
627 | DrawBuf.Show(); |
634 | DrawBuf.Show(); |
628 | DrawBuf.Fill(bg_color); |
635 | DrawBuf.Fill(bg_color); |
629 | } |
636 | } |
630 | stroka++; |
637 | stroka++; |
631 | if (blq_text) stolbec = 6; else stolbec = 0; |
638 | if (style.blq) stolbec = 6; else stolbec = 0; |
632 | if (li_text) stolbec = li_tab * 5; |
639 | if (style.li) stolbec = style.li_tab * 5; |
633 | } |
640 | } |
Line 634... | Line 641... | ||
634 | 641 | ||
635 | - | ||
- | 642 | ||
636 | 643 | ||
637 | int isTag(dword text) |
- |