Subversion Repositories Kolibri OS

Rev

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