Rev 8454 | Rev 8462 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8454 | Rev 8457 | ||
---|---|---|---|
Line 39... | Line 39... | ||
39 | //===================================================// |
39 | //===================================================// |
40 | // // |
40 | // // |
41 | // DATA // |
41 | // DATA // |
42 | // // |
42 | // // |
43 | //===================================================// |
43 | //===================================================// |
44 | char version[]="WebView 3.21"; |
44 | char version[]="WebView 3.25"; |
Line 45... | Line 45... | ||
45 | 45 | ||
Line 46... | Line 46... | ||
46 | #define DEFAULT_URL URL_SERVICE_HOMEPAGE |
46 | #define DEFAULT_URL URL_SERVICE_HOMEPAGE |
47 | 47 | ||
Line 218... | Line 218... | ||
218 | // Handle redirects |
218 | // Handle redirects |
219 | if (redirect_count<=5) { |
219 | if (redirect_count<=5) { |
220 | redirect_count++; |
220 | redirect_count++; |
221 | HandleRedirect(); |
221 | HandleRedirect(); |
222 | } else { |
222 | } else { |
223 | notify("'Too many redirects.' -E"); |
- | |
224 | StopLoading(); |
223 | StopLoading(); |
225 | redirect_count = 0; |
224 | redirect_count = 0; |
226 | if (http_get_type==IMG) goto _IMG_RES; |
225 | if (http_get_type==IMG) goto _IMG_RES; |
- | 226 | notify("'Too many redirects.' -E"); |
|
227 | } |
227 | } |
228 | } else { |
228 | } else { |
229 | // Loading the page is complete, free resources |
229 | // Loading the page is complete, free resources |
230 | redirect_count = 0; |
230 | redirect_count = 0; |
231 | http.hfree(); |
231 | http.hfree(); |
Line 333... | Line 333... | ||
333 | } |
333 | } |
Line 334... | Line 334... | ||
334 | 334 | ||
335 | void SetElementSizes() |
335 | void SetElementSizes() |
336 | { |
336 | { |
337 | omnibox_edit.width = Form.cwidth - omnibox_edit.left - 52 - 16; |
337 | omnibox_edit.width = Form.cwidth - omnibox_edit.left - 52 - 16; |
338 | WB1.list.SetSizes(0, TOOLBAR_H+TAB_H, Form.width - 10 - scroll_wv.size_x, |
338 | WB1.list.SetSizes(0, TOOLBAR_H+TAB_H, Form.cwidth - scroll_wv.size_x, |
339 | Form.cheight - TOOLBAR_H - STATUSBAR_H - TAB_H, BASIC_LINE_H); |
339 | Form.cheight - TOOLBAR_H - STATUSBAR_H - TAB_H, BASIC_LINE_H); |
340 | WB1.list.wheel_size = 7 * BASIC_LINE_H; |
340 | WB1.list.wheel_size = 7 * BASIC_LINE_H; |
341 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w + 1; |
341 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w + 1; |
342 | WB1.list.visible = WB1.list.h; |
342 | WB1.list.visible = WB1.list.h; |
Line 364... | Line 364... | ||
364 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, sc.work_graph); |
364 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, sc.work_graph); |
Line 365... | Line 365... | ||
365 | 365 | ||
366 | DrawRectangle(WB1.list.x + WB1.list.w, WB1.list.y, scroll_wv.size_x, |
366 | DrawRectangle(WB1.list.x + WB1.list.w, WB1.list.y, scroll_wv.size_x, |
Line 367... | Line 367... | ||
367 | WB1.list.h-1, scroll_wv.bckg_col); |
367 | WB1.list.h-1, scroll_wv.bckg_col); |
- | 368 | ||
- | 369 | if (!canvas.bufw) { |
|
368 | 370 | OpenPage(history.current()); |
|
369 | if (!BrowserWidthChanged()) { |
371 | } else { |
370 | WB1.DrawPage(); |
372 | WB1.DrawPage(); |
371 | DrawOmnibox(); |
373 | DrawOmnibox(); |
372 | } |
374 | } |
373 | DrawProgress(); |
375 | DrawProgress(); |
374 | DrawStatusBar(NULL); |
376 | DrawStatusBar(NULL); |
Line 375... | Line -... | ||
375 | DrawTabsBar(); |
- | |
376 | } |
- | |
377 | - | ||
378 | bool BrowserWidthChanged() |
- | |
379 | { |
- | |
380 | dword source_mode_holder; |
- | |
381 | if (WB1.list.w!=canvas.bufw) { |
- | |
382 | canvas.Init(WB1.list.x, WB1.list.y, WB1.list.w, 400*20); |
- | |
383 | if (!strncmp(history.current(),"http",4)) { |
- | |
384 | //nihuya ne izyashnoe reshenie, no pust' poka butet tak |
- | |
385 | source_mode_holder = source_mode; |
- | |
386 | LoadInternalPage(#loading_text, sizeof(loading_text)); |
- | |
387 | source_mode = source_mode_holder; |
- | |
388 | } |
- | |
389 | OpenPage(history.current()); |
- | |
390 | return true; |
- | |
391 | } |
- | |
392 | return false; |
- | |
393 | } |
377 | DrawTabsBar(); |
394 | 378 | } |
|
395 | 379 | ||
396 | void EventChangeEncodingAndLoadPage(int _new_encoding) |
380 | void EventChangeEncodingAndLoadPage(int _new_encoding) |
397 | { |
381 | { |
Line 559... | Line 543... | ||
559 | } else if (!strncmp(#new_url,"WebView:",8)) { |
543 | } else if (!strncmp(#new_url,"WebView:",8)) { |
560 | //INTERNAL PAGE |
544 | //INTERNAL PAGE |
561 | history.add(#new_url); |
545 | history.add(#new_url); |
562 | if (streq(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#buildin_page_home, sizeof(buildin_page_home)); |
546 | if (streq(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#buildin_page_home, sizeof(buildin_page_home)); |
563 | else if (streq(#new_url, URL_SERVICE_HELP)) LoadInternalPage(#buildin_page_help, sizeof(buildin_page_help)); |
547 | else if (streq(#new_url, URL_SERVICE_HELP)) LoadInternalPage(#buildin_page_help, sizeof(buildin_page_help)); |
- | 548 | else if (streq(#new_url, URL_SERVICE_TEST)) LoadInternalPage(#buildin_page_test, sizeof(buildin_page_test)); |
|
564 | else if (streq(#new_url, URL_SERVICE_HISTORY)) ShowHistory(); |
549 | else if (streq(#new_url, URL_SERVICE_HISTORY)) ShowHistory(); |
565 | else LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)); |
550 | else LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)); |
Line 566... | Line 551... | ||
566 | 551 | ||
567 | } else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) { |
552 | } else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) { |
Line 948... | Line 933... | ||
948 | } |
933 | } |
949 | } |
934 | } |
950 | if (_new) return; |
935 | if (_new) return; |
951 | DrawOmnibox(); |
936 | DrawOmnibox(); |
952 | DrawStatusBar(T_RENDERING); |
937 | DrawStatusBar(T_RENDERING); |
953 | WB1.ParseHtml(WB1.o_bufpointer, WB1.bufsize); |
938 | WB1.ParseHtml(WB1.bufpointer, WB1.bufsize); |
954 | WB1.DrawPage(); |
939 | WB1.DrawPage(); |
955 | debugln(sprintf(#param, T_DONE_IN_SEC, GetStartTime()-render_start_time/100)); |
940 | debugln(sprintf(#param, T_DONE_IN_SEC, GetStartTime()-render_start_time/100)); |
956 | DrawStatusBar(NULL); |
941 | DrawStatusBar(NULL); |
957 | } |
942 | } |