Rev 4544 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4544 | Rev 4550 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | struct TWebBrowser { |
15 | struct TWebBrowser { |
16 | llist list; |
16 | llist list; |
17 | DrawBufer DrawBuf; |
17 | DrawBufer DrawBuf; |
18 | void GetNewUrl(); |
18 | void GetNewUrl(); |
19 | void ReadHtml(); |
19 | void ReadHtml(); |
20 | void ParseHTML(); |
20 | void Parse(); |
21 | void WhatTextStyle(); |
21 | void WhatTextStyle(); |
22 | void DrawPage(); |
22 | void DrawPage(); |
23 | void DrawScroller(); |
23 | void DrawScroller(); |
24 | void TextGoDown(); |
24 | void TextGoDown(); |
25 | }; |
25 | }; |
Line 88... | Line 88... | ||
88 | IF (s_text) DrawBuf.DrawBar(start_x, 4, line_length, 1, text_colors[text_color_index]); |
88 | IF (s_text) DrawBuf.DrawBar(start_x, 4, line_length, 1, text_colors[text_color_index]); |
89 | IF (u_text) DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
89 | IF (u_text) DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
90 | IF (link) { |
90 | IF (link) { |
91 | UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
91 | UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
92 | DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
92 | DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
93 | PageLinks.AddText(#line, line_length, list.line_h); |
93 | PageLinks.AddText(#line, line_length, list.line_h, UNDERLINE); |
94 | } |
94 | } |
95 | stolbec += strlen(#line); |
95 | stolbec += strlen(#line); |
96 | } |
96 | } |
97 | } |
97 | } |
98 | //======================================================================= |
98 | //======================================================================= |
Line 164... | Line 164... | ||
164 | if (encoding==_UTF) utf8rutodos(bufpointer); |
164 | if (encoding==_UTF) utf8rutodos(bufpointer); |
165 | if (encoding==_KOI) koitodos(bufpointer); |
165 | if (encoding==_KOI) koitodos(bufpointer); |
166 | } |
166 | } |
Line 167... | Line 167... | ||
167 | 167 | ||
168 | 168 | ||
169 | void TWebBrowser::ParseHTML(dword bufpos){ |
169 | void TWebBrowser::Parse(dword bufpos, in_filesize){ |
170 | word bukva[2]; |
170 | word bukva[2]; |
171 | int j, perenos_num; |
171 | int j, perenos_num; |
- | 172 | byte ignor_param; |
|
172 | byte ignor_param; |
173 | char temp[768]; |
Line 173... | Line 174... | ||
173 | char temp[768]; |
174 | bufsize = in_filesize; |
174 | dword bufstart = bufpos; |
175 | bufpointer = bufpos; |
175 | 176 | ||
176 | b_text = i_text = u_text = s_text = blq_text = |
177 | b_text = i_text = u_text = s_text = blq_text = |
Line 193... | Line 194... | ||
193 | pre_text=0; |
194 | pre_text=0; |
194 | if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; |
195 | if (!strcmp(#URL + strlen(#URL) - 4, ".txt")) pre_text = 1; |
195 | if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1; |
196 | if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1; |
196 | } |
197 | } |
Line 197... | Line 198... | ||
197 | 198 | ||
198 | for ( ; bufstart+bufsize > bufpos; bufpos++;) |
199 | for ( ; bufpointer+bufsize > bufpos; bufpos++;) |
199 | { |
200 | { |
200 | bukva = ESBYTE[bufpos]; |
201 | bukva = ESBYTE[bufpos]; |
201 | if (ignor_text) && (bukva!='<') continue; |
202 | if (ignor_text) && (bukva!='<') continue; |
202 | if (condition_text_active) && (condition_text_val != condition_href) && (bukva!='<') continue; |
203 | if (condition_text_active) && (condition_text_val != condition_href) && (bukva!='<') continue; |
Line 251... | Line 252... | ||
251 | { |
252 | { |
252 | HH_: |
253 | HH_: |
253 | do |
254 | do |
254 | { |
255 | { |
255 | bufpos++; |
256 | bufpos++; |
256 | if (bufstart + bufsize <= bufpos) break 2; |
257 | if (bufpointer + bufsize <= bufpos) break 2; |
257 | } |
258 | } |
258 | while (ESBYTE[bufpos] <>'-'); |
259 | while (ESBYTE[bufpos] <>'-'); |
Line 259... | Line 260... | ||
259 | 260 | ||
260 | bufpos++; |
261 | bufpos++; |
261 | if (ESBYTE[bufpos] <>'-') goto HH_; |
262 | if (ESBYTE[bufpos] <>'-') goto HH_; |
262 | } |
263 | } |
263 | } |
264 | } |
264 | while (ESBYTE[bufpos] !='>') && (bufpos < bufstart + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû |
265 | while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû |
265 | { |
266 | { |
266 | bukva = ESBYTE[bufpos]; |
267 | bukva = ESBYTE[bufpos]; |
267 | if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; |
268 | if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; |
268 | if (!ignor_param) && (bukva <>' ') |
269 | if (!ignor_param) && (bukva <>' ') |
Line 297... | Line 298... | ||
297 | strcpy(#line, #temp); |
298 | strcpy(#line, #temp); |
298 | TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó |
299 | TextGoDown(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó |
299 | } |
300 | } |
300 | DrawPage(); |
301 | DrawPage(); |
Line 301... | Line -... | ||
301 | - | ||
302 | if (tag) WhatTextStyle(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //îáðàáîòêà òåãîâ |
302 | |
- | 303 | line=NULL; |
|
Line 303... | Line 304... | ||
303 | line=NULL; |
304 | if (tag) WhatTextStyle(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //îáðàáîòêà òåãîâ |
304 | 305 | ||
305 | tag = parametr = tagparam = ignor_param = NULL; |
306 | tag = parametr = tagparam = ignor_param = NULL; |
306 | break; |
307 | break; |
Line 339... | Line 340... | ||
339 | if (list.first == 0) list.count = stroka; |
340 | if (list.first == 0) list.count = stroka; |
340 | if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë |
341 | if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë |
341 | { |
342 | { |
342 | anchor=NULL; |
343 | anchor=NULL; |
343 | list.first=anchor_line_num; |
344 | list.first=anchor_line_num; |
344 | ParseHTML(bufstart); |
345 | Parse(bufpointer, bufsize); |
345 | } |
346 | } |
346 | DrawScroller(); |
347 | DrawScroller(); |
347 | } |
348 | } |