Subversion Repositories Kolibri OS

Rev

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

  1. //HTML Viewer in C--
  2. //Copyright 2007-2018 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\random.h"
  17. #include "..\lib\clipboard.h"
  18.  
  19. // *.obj libraries
  20. #include "..\lib\obj\box_lib.h"
  21. #include "..\lib\obj\libio.h"
  22. #include "..\lib\obj\libimg.h"
  23. #include "..\lib\obj\http.h"
  24. #include "..\lib\obj\iconv.h"
  25. //useful patterns
  26. #include "..\lib\patterns\history.h"
  27. #include "..\lib\patterns\http_downloader.h"
  28.  
  29. _http http = {0, 0, 0, 0, 0, 0, 0};
  30.  
  31. char homepage[] = FROM "html\\homepage.htm""\0";
  32.  
  33. #ifdef LANG_RUS
  34. char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.8c";
  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.8c";
  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 TOOLBAR_H = 40;
  80. dword STATUSBAR_H = 15;
  81.  
  82. dword col_bg = 0xE3E2E2;
  83. dword panel_color  = 0xE3E2E2;
  84. dword border_color = 0x8C8C8C;
  85.  
  86. bool debug_mode = false;
  87. bool old_tag_parser_mode = false;
  88.  
  89. progress_bar wv_progress_bar;
  90. bool souce_mode = false;
  91. bool open_in_a_new_window = false;
  92.  
  93. enum {
  94.         BACK_BUTTON=1000,
  95.         FORWARD_BUTTON,
  96.         REFRESH_BUTTON,
  97.         GOTOURL_BUTTON,
  98.         SANDWICH_BUTTON,
  99.         VIEW_SOURCE=1100,
  100.         EDIT_SOURCE,
  101.         VIEW_HISTORY,
  102.         //FREE_IMG_CACHE,
  103.         DOWNLOAD_MANAGER,
  104.         COPY_LINK_URL=1200,
  105.         DOWNLOAD_LINK_CONTENTS,
  106. };
  107.  
  108. #include "..\TWB\TWB.c"
  109. #include "history.h"
  110. #include "show_src.h"
  111. #include "download_manager.h"
  112.  
  113. char editURL[sizeof(URL)];
  114. int     mouse_twb;
  115. edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(URL),#editURL,#mouse_twb,2,19,19};
  116.  
  117. #define SKIN_Y 24
  118.  
  119. void main()
  120. {
  121.         int i;
  122.         load_dll(boxlib, #box_lib_init,0);
  123.         load_dll(libio, #libio_init,1);
  124.         load_dll(libimg, #libimg_init,1);
  125.         load_dll(libHTTP, #http_lib_init,1);
  126.         load_dll(iconv_lib, #iconv_open,0);
  127.         Libimg_LoadImage(#skin, "/sys/toolbar.png");
  128.         skin.h = 26;
  129.         wv_progress_bar.progress_color = 0x72B7EB;
  130.         CreateDir("/tmp0/1/downloads");
  131.         if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME);
  132.         WB1.list.SetFont(8, 14, 10011000b);
  133.         WB1.list.no_selection = true;
  134.         SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK);
  135.         loop() switch(WaitEvent())
  136.         {
  137.                 case evMouse:
  138.                         edit_box_mouse stdcall (#address_box);
  139.                         mouse.get();
  140.                         if (PageLinks.HoverAndProceed(mouse.x, WB1.list.first + mouse.y))
  141.                         && (bufsize) && (mouse.pkm) && (mouse.up) {
  142.                                 if (WB1.list.MouseOver(mouse.x, mouse.y)) EventShowPageMenu(mouse.x, mouse.y);
  143.                                 break;
  144.                         }
  145.                         if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
  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.                                 #define KEY_SCROLL_N 11
  171.                                 if (SCAN_CODE_UP   == key_scancode) for (i=0;i<KEY_SCROLL_N;i++) WB1.list.KeyUp();
  172.                                 if (SCAN_CODE_DOWN == key_scancode) for (i=0;i<KEY_SCROLL_N;i++) WB1.list.KeyDown();
  173.                                 if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage();
  174.                                 else ProcessEvent(key_scancode);
  175.                         }
  176.                         break;
  177.  
  178.                 case evReDraw:
  179.                         if (menu.list.cur_y) {
  180.                                 ProcessEvent(menu.list.cur_y);
  181.                                 menu.list.cur_y = 0;
  182.                         }
  183.                         DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),GetScreenHeight()-600/2-random(80),800,600,0x73,col_bg,0,0);
  184.                         GetProcessInfo(#Form, SelfInfo);
  185.                         if (Form.status_window>2) { DrawTitle(#header); break; }
  186.                         if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; }
  187.                         if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; }
  188.                         Draw_Window();
  189.                         break;
  190.                        
  191.                 case evNetwork:
  192.                         if (http.transfer > 0) {
  193.                                 http.receive();
  194.                                 EventUpdateProgressBar();
  195.                                 if (http.receive_result == 0) {
  196.                                         // Handle redirects
  197.                                         if (http.status_code >= 300) && (http.status_code < 400)
  198.                                         {
  199.                                                 redirected++;
  200.                                                 if (redirected>5)
  201.                                                 {
  202.                                                         notify("'Too many redirects.' -E");
  203.                                                         StopLoading();
  204.                                                 }
  205.                                                 else
  206.                                                 {
  207.                                                         http.handle_redirect();
  208.                                                         http.free();
  209.                                                         GetAbsoluteURL(#http.redirect_url);
  210.                                                         history.back();
  211.                                                         strcpy(#editURL, #URL);
  212.                                                         DrawEditBoxWebView();
  213.                                                         OpenPage();
  214.                                                 }
  215.                                                 break;
  216.                                         }
  217.                                         redirected = 0;
  218.                                         // Loading the page is complete, free resources
  219.                                         history.add(#URL);
  220.                                         bufpointer = http.content_pointer;
  221.                                         bufsize = http.content_received;
  222.                                         http.free();
  223.                                         SetPageDefaults();
  224.                                         ShowPage();
  225.                                 }
  226.                         }
  227.         }
  228. }
  229.  
  230. void SetElementSizes()
  231. {
  232.         address_box.top = TOOLBAR_H/2-10;
  233.         basic_line_h = calc(WB1.list.font_h * 130) / 100;
  234.         address_box.width = Form.cwidth - address_box.left - 50;
  235.         WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x,
  236.                 Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h);
  237.         WB1.list.wheel_size = 7 * basic_line_h;
  238.         WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
  239.         WB1.list.visible = WB1.list.h;
  240.         if (WB1.list.w!=WB1.DrawBuf.bufw) {
  241.                 WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 32700);
  242.                 ProcessEvent(REFRESH_BUTTON);
  243.         }
  244. }
  245.  
  246.  
  247.  
  248. void Draw_Window()
  249. {
  250.         DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color);
  251.         DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
  252.         DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
  253.         SetElementSizes();
  254.         DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 25,border_color);
  255.         DefineButton(address_box.left-52, address_box.top-2, 24, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
  256.         DefineButton(address_box.left-27, address_box.top-2, 24, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
  257.         img_draw stdcall(skin.image, address_box.left-53, address_box.top-3, 51, skin.h, 0, SKIN_Y);
  258.         DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
  259.         DefineButton(Form.cwidth-27, address_box.top-3, 23, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
  260.         img_draw stdcall(skin.image, Form.cwidth-24, address_box.top-3, 17, skin.h, 102, SKIN_Y);
  261.         DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
  262.         DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
  263.         if (!header)
  264.                 OpenPage();
  265.         else {
  266.                 WB1.DrawPage();
  267.                 DrawEditBoxWebView();
  268.         }
  269.         DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
  270.         DrawProgress();
  271. }
  272.  
  273.  
  274. void ProcessEvent(dword id__)
  275. {
  276.         switch (id__)
  277.         {
  278.                 case 1:
  279.                         ExitProcess();
  280.                         return;
  281.                 case SCAN_CODE_BS:
  282.                 case BACK_BUTTON:
  283.                         if (history.back()) {
  284.                                 strcpy(#URL, history.current());
  285.                                 OpenPage();
  286.                         }
  287.                         return;
  288.                 case FORWARD_BUTTON:
  289.                         if (history.forward()) {
  290.                                 strcpy(#URL, history.current());
  291.                                 OpenPage();
  292.                         }
  293.                         return;
  294.                 case GOTOURL_BUTTON:
  295.                 case SCAN_CODE_ENTER:
  296.                         if (!editURL[0]) {
  297.                                 strcpy(#URL, URL_SERVICE_HOME);
  298.                         }
  299.                         else if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/')
  300.                         || (!strncmp(#editURL,"https:",6)) || (!strncmp(#editURL,"WebView:",8))
  301.                         {
  302.                                 strcpy(#URL, #editURL);
  303.                         }
  304.                         else
  305.                         {
  306.                                 strlcpy(#URL,"http://",7);
  307.                                 strcat(#URL, #editURL);
  308.                         }
  309.                         OpenPage();
  310.                         return;
  311.                 case SCAN_CODE_F5:
  312.                         IF(address_box.flags & 0b10) return;
  313.                 case REFRESH_BUTTON:
  314.                         if (http.transfer > 0)
  315.                         {
  316.                                 StopLoading();
  317.                                 Draw_Window();
  318.                         }
  319.                         else OpenPage();
  320.                         return;
  321.                 case SANDWICH_BUTTON:
  322.                         EventShowPageMenu(Form.cwidth - 215, TOOLBAR_H-6);
  323.                         return;
  324.                 case VIEW_SOURCE:
  325.                         WB1.list.first = 0;
  326.                         ShowSource();
  327.                         WB1.LoadInternalPage(bufpointer, bufsize);
  328.                         break;
  329.                 case EDIT_SOURCE:
  330.                         if (!strncmp(#URL,"http",4))
  331.                         {
  332.                                 CreateFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
  333.                                 if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
  334.                         }
  335.                         else RunProgram("/rd/1/tinypad", #URL);
  336.                         return;
  337.                 // case FREE_IMG_CACHE:
  338.                 //      ImgCache.Free();
  339.                 //      notify(IMAGES_CACHE_CLEARED);
  340.                 //      WB1.DrawPage();
  341.                 //      return;
  342.                 case VIEW_HISTORY:
  343.                         strcpy(#URL, URL_SERVICE_HISTORY);
  344.                         OpenPage();
  345.                         return;
  346.                 case DOWNLOAD_MANAGER:
  347.                         if (!downloader_opened) {
  348.                                 downloader_edit = NULL;
  349.                                 CreateThread(#Downloader,#downloader_stak+4092);
  350.                         }
  351.                         return;
  352.                 case COPY_LINK_URL:
  353.                         Clipboard__CopyText(PageLinks.GetURL(PageLinks.active));
  354.                         notify("'URL copied to clipboard'O");
  355.                         return;
  356.                 case DOWNLOAD_LINK_CONTENTS:
  357.                         if (!downloader_opened) {
  358.                                 strcpy(#downloader_edit, PageLinks.GetURL(PageLinks.active));
  359.                                 CreateThread(#Downloader,#downloader_stak+4092);
  360.                         }
  361.                         return;
  362.                 case SCAN_CODE_F12:
  363.                         debug_mode ^= 1;
  364.                         if (debug_mode) notify("'Debug mode ON'-I");
  365.                         else notify("'Debug mode OFF'-I");
  366.                         return;
  367.                 case SCAN_CODE_F11:
  368.                         old_tag_parser_mode ^= 1;
  369.                         if (old_tag_parser_mode) notify("'Old tag parser ON'-I");
  370.                         else notify("'Old tag parser OFF'-I");
  371.                         return;
  372.         }
  373. }
  374.  
  375. void StopLoading()
  376. {
  377.         if (http.transfer)
  378.         {
  379.                 EAX = http.transfer;
  380.                 EAX = EAX.http_msg.content_ptr;         // get pointer to data
  381.                 $push   EAX                                                     // save it on the stack
  382.                 http_free stdcall (http.transfer);      // abort connection
  383.                 $pop    EAX                                                    
  384.                 free(EAX);                                              // free data
  385.                 http.transfer=0;
  386.                 bufsize = 0;
  387.                 bufpointer = free(bufpointer);
  388.         }
  389.         wv_progress_bar.value = 0;
  390.         DrawEditBoxWebView();
  391. }
  392.  
  393. void SetPageDefaults()
  394. {
  395.         strcpy(#header, #version);
  396.         WB1.list.count = WB1.list.first = 0;
  397.         cur_encoding = CH_NULL;
  398.         if (o_bufpointer) o_bufpointer = free(o_bufpointer);
  399. }
  400.  
  401. void OpenPage()
  402. {
  403.         char getUrl[sizeof(URL)];
  404.         StopLoading();
  405.         souce_mode = false;
  406.         strcpy(#editURL, #URL);
  407.         history.add(#URL);
  408.         if (!strncmp(#URL,"WebView:",8))
  409.         {
  410.                 SetPageDefaults();
  411.                 if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
  412.                 else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
  413.                 DrawEditBoxWebView();
  414.                 return;
  415.         }
  416.         if (!strncmp(#URL,"http:",5)) || (!strncmp(#URL,"https://",8))
  417.         {
  418.                 img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 68, SKIN_Y);
  419.  
  420.                 if (!strncmp(#URL,"http:",5)) {
  421.                         http.get(#URL);
  422.                 }
  423.                 if (!strncmp(#URL,"https://",8)) {
  424.                         sprintf(#getUrl, "http://gate.aspero.pro/?site=%s", #URL);
  425.                         http.get(#getUrl);
  426.                 }
  427.                 //http.get(#URL);
  428.                 if (!http.transfer)
  429.                 {
  430.                         StopLoading();
  431.                         bufsize = 0;
  432.                         bufpointer = free(bufpointer);
  433.                         ShowPage();
  434.                         return;
  435.                 }
  436.         }
  437.         else
  438.         {
  439.                 file_size stdcall (#URL);
  440.                 bufsize = EBX;
  441.                 if (bufsize)
  442.                 {
  443.                         free(bufpointer);
  444.                         bufpointer = malloc(bufsize);
  445.                         SetPageDefaults();
  446.                         ReadFile(0, bufsize, bufpointer, #URL);
  447.                 }
  448.                 ShowPage();
  449.         }
  450. }
  451.  
  452. DrawEditBoxWebView()
  453. {
  454.         int skin_x_offset;
  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) skin_x_offset = 68; else skin_x_offset = 51;
  461.         img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y);
  462. }
  463.  
  464.  
  465. void ShowPage()
  466. {
  467.         DrawEditBoxWebView();
  468.         if (!bufsize)
  469.         {
  470.                 if (http.transfer) WB1.LoadInternalPage(#loading, sizeof(loading));
  471.                 else WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
  472.         }
  473.         else
  474.         {
  475.                 WB1.Prepare();
  476.         }
  477. }
  478.  
  479. byte UrlExtIs(dword ext)
  480. {
  481.         if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
  482.         return false;
  483. }
  484.  
  485. void DrawProgress()
  486. {
  487.         dword persent;
  488.         if (http.transfer == 0) return;
  489.         if (wv_progress_bar.max) persent = wv_progress_bar.value*100/wv_progress_bar.max; else persent = 10;
  490.         DrawBar(address_box.left-2, address_box.top+20, persent*address_box.width/100, 2, wv_progress_bar.progress_color);
  491. }
  492.  
  493.  
  494. char anchor[256];
  495. void ClickLink()
  496. {
  497.         if (http.transfer > 0)
  498.         {
  499.                 StopLoading();
  500.                 history.back();
  501.         }
  502.         strcpy(#URL, PageLinks.GetURL(PageLinks.active));
  503.         //#1
  504.         if (URL[0] == '#')
  505.         {
  506.                 if (URL[1] == NULL) {
  507.                         WB1.list.first = 0;
  508.                         strcpy(#URL, history.current());
  509.                 }
  510.                 else {
  511.                         strlcpy(#anchor, #URL+strrchr(#URL, '#'), sizeof(anchor));
  512.                         strcpy(#URL, history.current());
  513.                 }
  514.                 ShowPage();                    
  515.                 return;
  516.         }
  517.         //liner.ru#1
  518.         if (strrchr(#URL, '#')!=0)
  519.         {
  520.                 strlcpy(#anchor, #URL+strrchr(#URL, '#'), sizeof(anchor));
  521.                 URL[strrchr(#URL, '#')-1] = 0x00;
  522.         }
  523.  
  524.         if (!strncmp(#URL,"mailto:", 7))
  525.         {
  526.                 notify(#URL);
  527.                 strcpy(#editURL, history.current());
  528.                 strcpy(#URL, history.current());
  529.                 return;
  530.         }
  531.  
  532.         GetAbsoluteURL(#URL);
  533.  
  534.         if (strncmp(#URL,"http://",7)!=0) && (strncmp(#URL,"https://",8)!=0)
  535.         {
  536.                 if (UrlExtIs(".htm")!=true) && (UrlExtIs(".html")!=true)
  537.                 {      
  538.                         if (strchr(#URL, '|')) {
  539.                                 ESBYTE[strchr(#URL, '|')] = NULL;
  540.                                 RunProgram(#URL, strlen(#URL)+1+#URL);
  541.                         }
  542.                         else {
  543.                                 RunProgram("/sys/@open", #URL);
  544.                         }
  545.                         strcpy(#editURL, history.current());
  546.                         strcpy(#URL, history.current());
  547.                         return;
  548.                 }
  549.         }
  550.         else   
  551.         {
  552.                 if (UrlExtIs(".png")==true) || (UrlExtIs(".gif")==true) || (UrlExtIs(".jpg")==true)
  553.                 || (UrlExtIs(".zip")==true) || (UrlExtIs(".kex")==true) || (UrlExtIs(".pdf")==true)
  554.                 || (UrlExtIs(".7z")==true) {
  555.                         if (!downloader_opened) {
  556.                                 strcpy(#downloader_edit, #URL);
  557.                                 CreateThread(#Downloader,#downloader_stak+4092);
  558.                                 strcpy(#editURL, history.current());
  559.                                 strcpy(#URL, history.current());
  560.                         }
  561.                         else notify("'WebView\nPlease, start a new download only when previous ended.'Et");
  562.                         return;
  563.                 }
  564.         }
  565.         if (open_in_a_new_window)
  566.         {
  567.                 RunProgram(#program_path, #URL);
  568.                 strcpy(#editURL, history.current());
  569.                 strcpy(#URL, history.current());
  570.         }
  571.         else
  572.         {
  573.                 OpenPage();
  574.         }
  575.         open_in_a_new_window = false;
  576. }
  577.  
  578. void EventShowPageMenu(dword _left, _top)
  579. {
  580.         menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #rmb_menu, VIEW_SOURCE);
  581. }
  582.  
  583. void EventShowLinkMenu(dword _left, _top)
  584. {
  585.         menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #link_menu, COPY_LINK_URL);
  586. }
  587.  
  588. void EventUpdateProgressBar()
  589. {
  590.         wv_progress_bar.max = http.content_length;
  591.         if (wv_progress_bar.value != http.content_received)
  592.         {
  593.                 wv_progress_bar.value = http.content_received; 
  594.                 DrawProgress();
  595.         }
  596. }
  597.  
  598. DrawStatusBar(dword _status_text)
  599. {
  600.         status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10;
  601.         status_text.start_y = Form.cheight - STATUSBAR_H + 3;
  602.         status_text.area_size_x = Form.cwidth - status_text.start_x -3;
  603.         DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
  604.         status_text.text_pointer = _status_text;
  605.         PathShow_prepare stdcall(#status_text);
  606.         PathShow_draw stdcall(#status_text);
  607. }
  608.  
  609. stop: