Subversion Repositories Kolibri OS

Rev

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