Subversion Repositories Kolibri OS

Rev

Rev 7208 | Rev 7229 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. //HTML Viewer in C--
  2. //Copyright 2007-2017 by Veliant & Leency
  3. //Asper, lev, Lrz, Barsuk, Nable, hidnplayr...
  4.  
  5. #ifndef AUTOBUILD
  6.         #include "lang.h--"
  7. #endif
  8.  
  9. //libraries
  10. #define MEMSIZE 4096 * 200
  11. #include "..\lib\gui.h"
  12. #include "..\lib\draw_buf.h"
  13. #include "..\lib\list_box.h"
  14. #include "..\lib\cursor.h"
  15. #include "..\lib\collection.h"
  16. #include "..\lib\menu.h"
  17. #include "..\lib\random.h"
  18. #include "..\lib\clipboard.h"
  19.  
  20. //*.obj libraries
  21. #include "..\lib\obj\box_lib.h"
  22. #include "..\lib\obj\libio.h"
  23. #include "..\lib\obj\libimg.h"
  24. #include "..\lib\obj\http.h"
  25. #include "..\lib\obj\iconv.h"
  26. //useful patterns
  27. #include "..\lib\patterns\libimg_load_skin.h"
  28. #include "..\lib\patterns\history.h"
  29. #include "..\lib\patterns\http_downloader.h"
  30.  
  31. char homepage[] = FROM "html\\homepage.htm""\0";
  32.  
  33. #ifdef LANG_RUS
  34. char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.73";
  35. ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
  36. ?define T_LAST_SLIDE "â® ¯®á«¥¤­¨© á« ©¤"
  37. char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
  38. char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0";
  39. char accept_language[]= "Accept-Language: ru\n";
  40. char rmb_menu[] =
  41. "®á¬®âà¥âì ¨á室­¨ª
  42. ¥¤ ªâ¨à®¢ âì ¨á室­¨ª
  43. ˆáâ®à¨ï
  44. Œ¥­¥¤¦¥à § £à㧮ª";
  45. char link_menu[] =
  46. "Š®¯¨à®¢ âì áá뫪ã
  47. ‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
  48. #else
  49. char version[]="Text-based Browser 1.73";
  50. ?define IMAGES_CACHE_CLEARED "Images cache cleared"
  51. ?define T_LAST_SLIDE "This slide is the last"
  52. char loading[] = "Loading...<br>";
  53. char page_not_found[] = FROM "html\\page_not_found_en.htm""\0";
  54. char accept_language[]= "Accept-Language: en\n";
  55. char rmb_menu[] =
  56. "View source
  57. Edit source
  58. History
  59. Download Manager";
  60. char link_menu[] =
  61. "Copy link
  62. Download link contents";
  63. #endif
  64.  
  65.  
  66. #define URL_SERVICE_HISTORY "WebView://history"
  67. #define URL_SERVICE_HOME "WebView://home"
  68. #define URL_SERVICE_SOURCE "WebView://source:"
  69.  
  70. proc_info Form;
  71.  
  72. //char search_path[]="http://nigma.ru/index.php?s=";
  73. int redirected = 0;
  74.  
  75. char stak[4096];
  76.  
  77. int action_buf;
  78.  
  79. dword http_transfer = 0;
  80. dword http_buffer;
  81.  
  82. dword TOOLBAR_H = 40;
  83. dword STATUSBAR_H = 15;
  84. dword col_bg;
  85. dword panel_color;
  86. dword border_color;
  87.  
  88. progress_bar wv_progress_bar;
  89. bool souce_mode = false;
  90. bool open_in_a_new_window = false;
  91.  
  92. enum {
  93.         BACK_BUTTON=1000,
  94.         FORWARD_BUTTON,
  95.         REFRESH_BUTTON,
  96.         GOTOURL_BUTTON,
  97.         SANDWICH_BUTTON,
  98.         VIEW_SOURCE=1100,
  99.         EDIT_SOURCE,
  100.         VIEW_HISTORY,
  101.         //FREE_IMG_CACHE,
  102.         DOWNLOAD_MANAGER,
  103.         COPY_LINK=1200,
  104.         DOWNLOAD_LINK_CONTENTS,
  105. };
  106.  
  107. #include "..\TWB\TWB.c"
  108. #include "history.h"
  109. #include "show_src.h"
  110. #include "download_manager.h"
  111.  
  112. char editURL[sizeof(URL)];
  113. int     mouse_twb;
  114. edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(URL),#editURL,#mouse_twb,2,19,19};
  115.  
  116.  
  117. void main()
  118. {
  119.         CursorPointer.Load(#CursorFile);
  120.         load_dll(boxlib, #box_lib_init,0);
  121.         load_dll(libio, #libio_init,1);
  122.         load_dll(libimg, #libimg_init,1);
  123.         load_dll(libHTTP, #http_lib_init,1);
  124.         load_dll(iconv_lib, #iconv_open,0);
  125.         Libimg_LoadImage(#skin, abspath("wv_skin.png"));
  126.         SetSkinColors();
  127.         CreateDir("/tmp0/1/downloads");
  128.         if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME);
  129.         WB1.list.SetFont(8, 14, 10011000b);
  130.         WB1.list.no_selection = true;
  131.         SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK);
  132.         loop() switch(WaitEvent())
  133.         {
  134.                 case evMouse:
  135.                         edit_box_mouse stdcall (#address_box);
  136.                         mouse.get();
  137.                         if (WB1.list.MouseOver(mouse.x, mouse.y))
  138.                         {
  139.                                 if (PageLinks.HoverAndProceed(mouse.x, WB1.list.first + mouse.y))
  140.                                 && (bufsize) && (mouse.pkm) && (mouse.up) {
  141.                                         EventShowPageMenu(mouse.x, mouse.y);
  142.                                         break;
  143.                                 }
  144.                                 if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
  145.                         }
  146.                         scrollbar_v_mouse (#scroll_wv);
  147.                         if (WB1.list.first != scroll_wv.position)
  148.                         {
  149.                                 WB1.list.first = scroll_wv.position;
  150.                                 WB1.DrawPage();
  151.                                 break;
  152.                         }
  153.                         break;
  154.  
  155.                 case evButton:
  156.                         ProcessEvent(GetButtonID());
  157.                         break;
  158.  
  159.                 case evKey:
  160.                         GetKeys();
  161.                         if (address_box.flags & 0b10)  
  162.                         {
  163.                                 if (key_ascii == ASCII_KEY_ENTER) ProcessEvent(key_scancode); else {
  164.                                         EAX = key_editbox;
  165.                                         edit_box_key stdcall(#address_box);
  166.                                 }
  167.                         }
  168.                         else
  169.                         {
  170.                                 if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage();
  171.                                 else ProcessEvent(key_scancode);
  172.                         }
  173.                         break;
  174.  
  175.                 case evReDraw:
  176.                         if (menu.list.cur_y) {
  177.                                 ProcessEvent(menu.list.cur_y);
  178.                                 menu.list.cur_y = 0;
  179.                         }
  180.                         DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),GetScreenHeight()-600/2-random(80),800,600,0x73,col_bg,0,0);
  181.                         GetProcessInfo(#Form, SelfInfo);
  182.                         if (Form.status_window>2) { DrawTitle(#header); break; }
  183.                         if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; }
  184.                         if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; }
  185.                         Draw_Window();
  186.                         break;
  187.                        
  188.                 case evNetwork:
  189.                         if (http_transfer > 0) {
  190.                                 http_receive stdcall (http_transfer);
  191.                                 $push EAX
  192.                                 ESI = http_transfer;
  193.                                 wv_progress_bar.max = ESI.http_msg.content_length;
  194.                                 if (wv_progress_bar.value != ESI.http_msg.content_received)
  195.                                 {
  196.                                         wv_progress_bar.value = ESI.http_msg.content_received; 
  197.                                         DrawProgress();
  198.                                 }
  199.                                 $pop EAX
  200.                                 if (EAX == 0) {
  201.                                         ESI = http_transfer;
  202.                                         // Handle redirects
  203.                                         if (ESI.http_msg.status >= 300) && (ESI.http_msg.status < 400)
  204.                                         {
  205.                                                 redirected++;
  206.                                                 if (redirected<=5)
  207.                                                 {
  208.                                                         http_find_header_field stdcall (http_transfer, "location\0");
  209.                                                         if (EAX!=0) {
  210.                                                                 ESI = EAX;
  211.                                                                 EDI = #URL;
  212.                                                                 do {
  213.                                                                         $lodsb;
  214.                                                                         $stosb;
  215.                                                                 } while (AL != 0) && (AL != 13) && (AL != 10);
  216.                                                                 DSBYTE[EDI-1]='\0';
  217.                                                                 if (!strncmp(#URL,"https://",8))
  218.                                                                 {
  219.                                                                         history.back();
  220.                                                                         strcpy(#editURL, history.current());
  221.                                                                         strcpy(#URL, history.current());
  222.                                                                         ShowErrorMessageThatHttpsIsNotSupportedYet();
  223.                                                                         StopLoading();
  224.                                                                         break; 
  225.                                                                 }
  226.                                                         }
  227.                                                 }
  228.                                                 else
  229.                                                 {
  230.                                                         notify("Too many redirects");
  231.                                                         StopLoading();
  232.                                                         break;
  233.                                                 }
  234.                                         }
  235.                                         else
  236.                                         {
  237.                                                 redirected = 0;
  238.                                         }
  239.                                         // Loading the page is complete, free resources
  240.                                         if (redirected>0)
  241.                                         {
  242.                                                 http_free stdcall (http_transfer);
  243.                                                 http_transfer=0;
  244.                                                 GetAbsoluteURL(#URL);
  245.                                                 history.back();
  246.                                                 strcpy(#editURL, #URL);
  247.                                                 DrawEditBoxWebView();
  248.                                                 OpenPage();
  249.                                         }
  250.                                         else
  251.                                         {
  252.                                                 history.add(#URL);
  253.                                                 ESI = http_transfer;
  254.                                                 bufpointer = ESI.http_msg.content_ptr;
  255.                                                 bufsize = ESI.http_msg.content_received;
  256.                                                 http_free stdcall (http_transfer);
  257.                                                 http_transfer=0;
  258.                                                 SetPageDefaults();
  259.                                                 ShowPage();
  260.                                         }
  261.                                 }
  262.                         }
  263.         }
  264. }
  265.  
  266. void SetElementSizes()
  267. {
  268.         address_box.top = TOOLBAR_H/2-10;
  269.         basic_line_h = calc(WB1.list.font_h * 130) / 100;
  270.         address_box.width = Form.cwidth - address_box.left - 50;
  271.         WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x,
  272.                 Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h);
  273.         WB1.list.wheel_size = 7 * basic_line_h;
  274.         WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
  275.         WB1.list.visible = WB1.list.h;
  276.         if (WB1.list.w!=WB1.DrawBuf.bufw) {
  277.                 WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 32700);
  278.                 ProcessEvent(REFRESH_BUTTON);
  279.         }
  280. }
  281.  
  282.  
  283.  
  284. void Draw_Window()
  285. {
  286.         DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color);
  287.         DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
  288.         DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
  289.         SetElementSizes();
  290.         DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 25,border_color);
  291.         DefineButton(address_box.left-52, address_box.top-2, 24, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
  292.         DefineButton(address_box.left-27, address_box.top-2, 24, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
  293.         img_draw stdcall(skin.image, address_box.left-53, address_box.top-3, 51, skin.h, 3, 0);
  294.         DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
  295.         DefineButton(Form.cwidth-27, address_box.top-3, 23, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
  296.         img_draw stdcall(skin.image, Form.cwidth-24, address_box.top-3, 17, skin.h, 87, 0);
  297.         DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
  298.         DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
  299.         if (!header) OpenPage(); else { WB1.DrawPage(); DrawEditBoxWebView(); }
  300.         DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
  301.         DrawProgress();
  302. }
  303.  
  304.  
  305. void ProcessEvent(dword id__)
  306. {
  307.         switch (id__)
  308.         {
  309.                 case 1:
  310.                         ExitProcess();
  311.                         return;
  312.                 case SCAN_CODE_BS:
  313.                 case BACK_BUTTON:
  314.                         if (history.back()) {
  315.                                 strcpy(#URL, history.current());
  316.                                 OpenPage();
  317.                         }
  318.                         return;
  319.                 case FORWARD_BUTTON:
  320.                         if (history.forward()) {
  321.                                 strcpy(#URL, history.current());
  322.                                 OpenPage();
  323.                         }
  324.                         return;
  325.                 case GOTOURL_BUTTON:
  326.                 case SCAN_CODE_ENTER:
  327.                         if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/')
  328.                         || (!strncmp(#editURL,"https:",6)) || (!strncmp(#editURL,"WebView:",8))
  329.                         {
  330.                                 strcpy(#URL, #editURL);
  331.                         }
  332.                         else
  333.                         {
  334.                                 strlcpy(#URL,"http://",7);
  335.                                 strcat(#URL, #editURL);
  336.                         }
  337.                         OpenPage();
  338.                         return;
  339.                 case 063: //F5
  340.                         IF(address_box.flags & 0b10) return;
  341.                 case REFRESH_BUTTON:
  342.                         if (http_transfer > 0)
  343.                         {
  344.                                 StopLoading();
  345.                                 Draw_Window();
  346.                         }
  347.                         else OpenPage();
  348.                         return;
  349.                 case SANDWICH_BUTTON:
  350.                         EventShowPageMenu(Form.cwidth - 215, TOOLBAR_H-6);
  351.                         return;
  352.                 case VIEW_SOURCE:
  353.                         WB1.list.first = 0;
  354.                         ShowSource();
  355.                         WB1.LoadInternalPage(bufpointer, bufsize);
  356.                         break;
  357.                 case EDIT_SOURCE:
  358.                         if (!strncmp(#URL,"http:",5))
  359.                         {
  360.                                 CreateFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
  361.                                 if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
  362.                         }
  363.                         else RunProgram("/rd/1/tinypad", #URL);
  364.                         return;
  365.                 // case FREE_IMG_CACHE:
  366.                 //      ImgCache.Free();
  367.                 //      notify(IMAGES_CACHE_CLEARED);
  368.                 //      WB1.DrawPage();
  369.                 //      return;
  370.                 case VIEW_HISTORY:
  371.                         strcpy(#URL, URL_SERVICE_HISTORY);
  372.                         OpenPage();
  373.                         return;
  374.                 case DOWNLOAD_MANAGER:
  375.                         if (!downloader_opened) {
  376.                                 downloader_edit = NULL;
  377.                                 CreateThread(#Downloader,#downloader_stak+4092);
  378.                         }
  379.                         return;
  380.                 case COPY_LINK:
  381.                         Clipboard__CopyText(PageLinks.GetURL(PageLinks.active));
  382.                         notify("'URL copied to clipboard'O");
  383.                         return;
  384.                 case DOWNLOAD_LINK_CONTENTS:
  385.                         if (!downloader_opened) {
  386.                                 strcpy(#downloader_edit, PageLinks.GetURL(PageLinks.active));
  387.                                 CreateThread(#Downloader,#downloader_stak+4092);
  388.                         }
  389.                         return;
  390.         }
  391. }
  392.  
  393. void StopLoading()
  394. {
  395.         if (http_transfer)
  396.         {
  397.                 EAX = http_transfer;
  398.                 EAX = EAX.http_msg.content_ptr;         // get pointer to data
  399.                 $push   EAX                                                     // save it on the stack
  400.                 http_free stdcall (http_transfer);      // abort connection
  401.                 $pop    EAX                                                    
  402.                 free(EAX);                                              // free data
  403.                 http_transfer=0;
  404.                 bufsize = 0;
  405.                 bufpointer = free(bufpointer);
  406.         }
  407.         wv_progress_bar.value = 0;
  408.         DrawEditBoxWebView();
  409. }
  410.  
  411. void SetPageDefaults()
  412. {
  413.         strcpy(#header, #version);
  414.         WB1.list.count = WB1.list.first = 0;
  415.         cur_encoding = CH_NULL;
  416.         if (o_bufpointer) o_bufpointer = free(o_bufpointer);
  417. }
  418.  
  419. void OpenPage()
  420. {
  421.         StopLoading();
  422.         souce_mode = false;
  423.         strcpy(#editURL, #URL);
  424.         history.add(#URL);
  425.         if (!strncmp(#URL,"WebView:",8))
  426.         {
  427.                 SetPageDefaults();
  428.                 if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
  429.                 else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
  430.                 DrawEditBoxWebView();
  431.                 return;
  432.         }
  433.         if (!strncmp(#URL,"http:",5))
  434.         {
  435.                 img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 131, 0);
  436.                 http_get stdcall (#URL, 0, 0, #accept_language);
  437.                 http_transfer = EAX;
  438.                 if (!http_transfer)
  439.                 {
  440.                         StopLoading();
  441.                         bufsize = 0;
  442.                         bufpointer = free(bufpointer);
  443.                         ShowPage();
  444.                         return;
  445.                 }
  446.         }
  447.         else
  448.         {
  449.                 file_size stdcall (#URL);
  450.                 bufsize = EBX;
  451.                 if (bufsize)
  452.                 {
  453.                         free(bufpointer);
  454.                         bufpointer = malloc(bufsize);
  455.                         SetPageDefaults();
  456.                         ReadFile(0, bufsize, bufpointer, #URL);
  457.                 }
  458.                 ShowPage();
  459.         }
  460. }
  461.  
  462. DrawEditBoxWebView()
  463. {
  464.         DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 2, address_box.color);
  465.         DrawBar(address_box.left-2, address_box.top, 2, 22, address_box.color);
  466.         address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
  467.         address_box.offset = 0;
  468.         edit_box_draw stdcall(#address_box);
  469.         if (http_transfer > 0) EAX = 131; else EAX = 54;
  470.         img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, EAX, 0);
  471. }
  472.  
  473.  
  474. void ShowPage()
  475. {
  476.         DrawEditBoxWebView();
  477.         debugval("bufsize", bufsize);
  478.         if (!bufsize)
  479.         {
  480.                 if (http_transfer) WB1.LoadInternalPage(#loading, sizeof(loading));
  481.                 else WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
  482.         }
  483.         else
  484.         {
  485.                 WB1.Prepare();
  486.         }
  487. }
  488.  
  489. byte UrlExtIs(dword ext)
  490. {
  491.         if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
  492.         return false;
  493. }
  494.  
  495. int SetSkinColors()
  496. {
  497.         dword image_data;
  498.         image_data = DSDWORD[skin.image+24];
  499.         col_bg = DSDWORD[image_data];
  500.         panel_color  = DSDWORD[skin.w*4*4 + image_data];
  501.         border_color = DSDWORD[skin.w*4*7 + image_data];
  502.         wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data];
  503.         $and col_bg, 0x00ffffff
  504.         $and panel_color, 0x00ffffff
  505.         $and border_color, 0x00ffffff
  506.         $and wv_progress_bar.progress_color, 0x00ffffff
  507. }
  508.  
  509. void DrawProgress()
  510. {
  511.         unsigned long btn;
  512.         if (http_transfer == 0) return;
  513.         if (wv_progress_bar.max) btn = address_box.width*wv_progress_bar.value/wv_progress_bar.max; else btn = 30;
  514.         DrawBar(address_box.left-2, address_box.top+20, btn, 2, wv_progress_bar.progress_color);
  515. }
  516.  
  517.  
  518. char anchor[256];
  519. void ClickLink()
  520. {
  521.         if (http_transfer > 0)
  522.         {
  523.                 StopLoading();
  524.                 history.back();
  525.         }
  526.  
  527.         strcpy(#URL, PageLinks.GetURL(PageLinks.active));      
  528.         //#1
  529.         if (URL[0] == '#')
  530.         {
  531.                 if (URL[1] == NULL) {
  532.                         WB1.list.first = 0;
  533.                         strcpy(#URL, history.current());
  534.                 }
  535.                 else {
  536.                         strlcpy(#anchor, #URL+strrchr(#URL, '#'), sizeof(anchor));
  537.                         strcpy(#URL, history.current());
  538.                 }
  539.                 ShowPage();                    
  540.                 return;
  541.         }
  542.         //liner.ru#1
  543.         if (strrchr(#URL, '#')!=0)
  544.         {
  545.                 strlcpy(#anchor, #URL+strrchr(#URL, '#'), sizeof(anchor));
  546.                 URL[strrchr(#URL, '#')-1] = 0x00;
  547.         }
  548.  
  549.         if (!strncmp(#URL,"mailto:", 7))
  550.         {
  551.                 notify(#URL);
  552.                 strcpy(#editURL, history.current());
  553.                 strcpy(#URL, history.current());
  554.                 return;
  555.         }
  556.  
  557.         if (!strncmp(#URL,"https://",8))
  558.         {
  559.                 ShowErrorMessageThatHttpsIsNotSupportedYet();
  560.                 strcpy(#editURL, history.current());
  561.                 strcpy(#URL, history.current());
  562.                 return;
  563.         }
  564.        
  565.         GetAbsoluteURL(#URL);
  566.  
  567.         if (strncmp(#URL,"http://",7)!=0)
  568.         {
  569.                 if (UrlExtIs(".htm")!=true) && (UrlExtIs(".html")!=true)
  570.                 {      
  571.                         RunProgram("/sys/@open", #URL);
  572.                         strcpy(#editURL, history.current());
  573.                         strcpy(#URL, history.current());
  574.                         return;
  575.                 }
  576.         }
  577.         else   
  578.         {
  579.                 if (UrlExtIs(".png")==true) || (UrlExtIs(".gif")==true) || (UrlExtIs(".jpg")==true)
  580.                 || (UrlExtIs(".zip")==true) || (UrlExtIs(".kex")==true) || (UrlExtIs(".pdf")==true)
  581.                 || (UrlExtIs(".7z")==true) {
  582.                         if (!downloader_opened) {
  583.                                 strcpy(#downloader_edit, #URL);
  584.                                 CreateThread(#Downloader,#downloader_stak+4092);
  585.                                 strcpy(#editURL, history.current());
  586.                                 strcpy(#URL, history.current());
  587.                         }
  588.                         else notify("'WebView\nPlease, start a new download only when previous ended.'Et");
  589.                         return;
  590.                 }
  591.         }
  592.         if (open_in_a_new_window)
  593.         {
  594.                 RunProgram(#program_path, #URL);
  595.                 strcpy(#editURL, history.current());
  596.                 strcpy(#URL, history.current());
  597.         }
  598.         else
  599.         {
  600.                 OpenPage();
  601.         }
  602.         open_in_a_new_window = false;
  603. }
  604.  
  605. void EventShowPageMenu(dword _left, _top)
  606. {
  607.         menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #rmb_menu, VIEW_SOURCE);
  608. }
  609.  
  610. void EventShowLinkMenu(dword _left, _top)
  611. {
  612.         menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #link_menu, COPY_LINK);
  613. }
  614.  
  615.  
  616. void ShowErrorMessageThatHttpsIsNotSupportedYet()
  617. {
  618.         notify("'HTTPS protocol is not supported yet' -E");
  619. }
  620.  
  621. DrawStatusBar(dword _status_text)
  622. {
  623.         status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10;
  624.         status_text.start_y = Form.cheight - STATUSBAR_H + 3;
  625.         status_text.area_size_x = Form.cwidth - status_text.start_x -3;
  626.         DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
  627.         status_text.text_pointer = _status_text;
  628.         PathShow_prepare stdcall(#status_text);
  629.         PathShow_draw stdcall(#status_text);
  630. }
  631.  
  632. stop: