Subversion Repositories Kolibri OS

Rev

Rev 7284 | Rev 7422 | 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. _http http = {0, 0, 0, 0, 0, 0, 0};
  31.  
  32. char homepage[] = FROM "html\\homepage.htm""\0";
  33.  
  34. #ifdef LANG_RUS
  35. char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.8";
  36. ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
  37. ?define T_LAST_SLIDE "â® ¯®á«¥¤­¨© á« ©¤"
  38. char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
  39. char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0";
  40. char accept_language[]= "Accept-Language: ru\n";
  41. char rmb_menu[] =
  42. "®á¬®âà¥âì ¨á室­¨ª
  43. ¥¤ ªâ¨à®¢ âì ¨á室­¨ª
  44. ˆáâ®à¨ï
  45. Œ¥­¥¤¦¥à § £à㧮ª";
  46. char link_menu[] =
  47. "Š®¯¨à®¢ âì áá뫪ã
  48. ‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
  49. #else
  50. char version[]="Text-based Browser 1.8";
  51. ?define IMAGES_CACHE_CLEARED "Images cache cleared"
  52. ?define T_LAST_SLIDE "This slide is the last"
  53. char loading[] = "Loading...<br>";
  54. char page_not_found[] = FROM "html\\page_not_found_en.htm""\0";
  55. char accept_language[]= "Accept-Language: en\n";
  56. char rmb_menu[] =
  57. "View source
  58. Edit source
  59. History
  60. Download Manager";
  61. char link_menu[] =
  62. "Copy link
  63. Download link contents";
  64. #endif
  65.  
  66.  
  67. #define URL_SERVICE_HISTORY "WebView://history"
  68. #define URL_SERVICE_HOME "WebView://home"
  69. #define URL_SERVICE_SOURCE "WebView://source:"
  70.  
  71. proc_info Form;
  72.  
  73. //char search_path[]="http://nigma.ru/index.php?s=";
  74. int redirected = 0;
  75.  
  76. char stak[4096];
  77.  
  78. int action_buf;
  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. 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.  
  118. void main()
  119. {
  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 (PageLinks.HoverAndProceed(mouse.x, WB1.list.first + mouse.y))
  138.                         && (bufsize) && (mouse.pkm) && (mouse.up) {
  139.                                 if (WB1.list.MouseOver(mouse.x, mouse.y)) EventShowPageMenu(mouse.x, mouse.y);
  140.                                 break;
  141.                         }
  142.                         if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
  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();
  188.                                 EventUpdateProgressBar();
  189.                                 if (http.receive_result == 0) {
  190.                                         // Handle redirects
  191.                                         if (http.status_code >= 300) && (http.status_code < 400)
  192.                                         {
  193.                                                 redirected++;
  194.                                                 if (redirected>5)
  195.                                                 {
  196.                                                         notify("'Too many redirects.' -E");
  197.                                                         StopLoading();
  198.                                                 }
  199.                                                 else
  200.                                                 {
  201.                                                         http.handle_redirect();
  202.                                                         http.free();
  203.                                                         GetAbsoluteURL(#http.redirect_url);
  204.                                                         history.back();
  205.                                                         strcpy(#editURL, #URL);
  206.                                                         DrawEditBoxWebView();
  207.                                                         OpenPage();
  208.                                                 }
  209.                                                 break;
  210.                                         }
  211.                                         redirected = 0;
  212.                                         // Loading the page is complete, free resources
  213.                                         history.add(#URL);
  214.                                         bufpointer = http.content_pointer;
  215.                                         bufsize = http.content_received;
  216.                                         http.free();
  217.                                         SetPageDefaults();
  218.                                         ShowPage();
  219.                                 }
  220.                         }
  221.         }
  222. }
  223.  
  224. void SetElementSizes()
  225. {
  226.         address_box.top = TOOLBAR_H/2-10;
  227.         basic_line_h = calc(WB1.list.font_h * 130) / 100;
  228.         address_box.width = Form.cwidth - address_box.left - 50;
  229.         WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x,
  230.                 Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h);
  231.         WB1.list.wheel_size = 7 * basic_line_h;
  232.         WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
  233.         WB1.list.visible = WB1.list.h;
  234.         if (WB1.list.w!=WB1.DrawBuf.bufw) {
  235.                 WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 32700);
  236.                 ProcessEvent(REFRESH_BUTTON);
  237.         }
  238. }
  239.  
  240.  
  241.  
  242. void Draw_Window()
  243. {
  244.         DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color);
  245.         DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
  246.         DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
  247.         SetElementSizes();
  248.         DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 25,border_color);
  249.         DefineButton(address_box.left-52, address_box.top-2, 24, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
  250.         DefineButton(address_box.left-27, address_box.top-2, 24, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
  251.         img_draw stdcall(skin.image, address_box.left-53, address_box.top-3, 51, skin.h, 3, 0);
  252.         DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
  253.         DefineButton(Form.cwidth-27, address_box.top-3, 23, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
  254.         img_draw stdcall(skin.image, Form.cwidth-24, address_box.top-3, 17, skin.h, 87, 0);
  255.         DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
  256.         DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
  257.         if (!header)
  258.                 OpenPage();
  259.         else {
  260.                 WB1.DrawPage();
  261.                 DrawEditBoxWebView();
  262.         }
  263.         DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
  264.         DrawProgress();
  265. }
  266.  
  267.  
  268. void ProcessEvent(dword id__)
  269. {
  270.         switch (id__)
  271.         {
  272.                 case 1:
  273.                         ExitProcess();
  274.                         return;
  275.                 case SCAN_CODE_BS:
  276.                 case BACK_BUTTON:
  277.                         if (history.back()) {
  278.                                 strcpy(#URL, history.current());
  279.                                 OpenPage();
  280.                         }
  281.                         return;
  282.                 case FORWARD_BUTTON:
  283.                         if (history.forward()) {
  284.                                 strcpy(#URL, history.current());
  285.                                 OpenPage();
  286.                         }
  287.                         return;
  288.                 case GOTOURL_BUTTON:
  289.                 case SCAN_CODE_ENTER:
  290.                         if (!editURL[0]) {
  291.                                 strcpy(#URL, URL_SERVICE_HOME);
  292.                         }
  293.                         else if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/')
  294.                         || (!strncmp(#editURL,"https:",6)) || (!strncmp(#editURL,"WebView:",8))
  295.                         {
  296.                                 strcpy(#URL, #editURL);
  297.                         }
  298.                         else
  299.                         {
  300.                                 strlcpy(#URL,"http://",7);
  301.                                 strcat(#URL, #editURL);
  302.                         }
  303.                         OpenPage();
  304.                         return;
  305.                 case SCAN_CODE_F5:
  306.                         IF(address_box.flags & 0b10) return;
  307.                 case REFRESH_BUTTON:
  308.                         if (http.transfer > 0)
  309.                         {
  310.                                 StopLoading();
  311.                                 Draw_Window();
  312.                         }
  313.                         else OpenPage();
  314.                         return;
  315.                 case SANDWICH_BUTTON:
  316.                         EventShowPageMenu(Form.cwidth - 215, TOOLBAR_H-6);
  317.                         return;
  318.                 case VIEW_SOURCE:
  319.                         WB1.list.first = 0;
  320.                         ShowSource();
  321.                         WB1.LoadInternalPage(bufpointer, bufsize);
  322.                         break;
  323.                 case EDIT_SOURCE:
  324.                         if (!strncmp(#URL,"http",4))
  325.                         {
  326.                                 CreateFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
  327.                                 if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
  328.                         }
  329.                         else RunProgram("/rd/1/tinypad", #URL);
  330.                         return;
  331.                 // case FREE_IMG_CACHE:
  332.                 //      ImgCache.Free();
  333.                 //      notify(IMAGES_CACHE_CLEARED);
  334.                 //      WB1.DrawPage();
  335.                 //      return;
  336.                 case VIEW_HISTORY:
  337.                         strcpy(#URL, URL_SERVICE_HISTORY);
  338.                         OpenPage();
  339.                         return;
  340.                 case DOWNLOAD_MANAGER:
  341.                         if (!downloader_opened) {
  342.                                 downloader_edit = NULL;
  343.                                 CreateThread(#Downloader,#downloader_stak+4092);
  344.                         }
  345.                         return;
  346.                 case COPY_LINK_URL:
  347.                         Clipboard__CopyText(PageLinks.GetURL(PageLinks.active));
  348.                         notify("'URL copied to clipboard'O");
  349.                         return;
  350.                 case DOWNLOAD_LINK_CONTENTS:
  351.                         if (!downloader_opened) {
  352.                                 strcpy(#downloader_edit, PageLinks.GetURL(PageLinks.active));
  353.                                 CreateThread(#Downloader,#downloader_stak+4092);
  354.                         }
  355.                         return;
  356.                 case SCAN_CODE_F12:
  357.                         debug_mode ^= 1;
  358.                         if (debug_mode) notify("'Debug mode ON'-I");
  359.                         else notify("'Debug mode OFF'-I");
  360.                         return;
  361.                 case SCAN_CODE_F11:
  362.                         old_tag_parser_mode ^= 1;
  363.                         if (old_tag_parser_mode) notify("'Old tag parser ON'-I");
  364.                         else notify("'Old tag parser OFF'-I");
  365.                         return;
  366.         }
  367. }
  368.  
  369. void StopLoading()
  370. {
  371.         if (http.transfer)
  372.         {
  373.                 EAX = http.transfer;
  374.                 EAX = EAX.http_msg.content_ptr;         // get pointer to data
  375.                 $push   EAX                                                     // save it on the stack
  376.                 http_free stdcall (http.transfer);      // abort connection
  377.                 $pop    EAX                                                    
  378.                 free(EAX);                                              // free data
  379.                 http.transfer=0;
  380.                 bufsize = 0;
  381.                 bufpointer = free(bufpointer);
  382.         }
  383.         wv_progress_bar.value = 0;
  384.         DrawEditBoxWebView();
  385. }
  386.  
  387. void SetPageDefaults()
  388. {
  389.         strcpy(#header, #version);
  390.         WB1.list.count = WB1.list.first = 0;
  391.         cur_encoding = CH_NULL;
  392.         if (o_bufpointer) o_bufpointer = free(o_bufpointer);
  393. }
  394.  
  395. void OpenPage()
  396. {
  397.         char getUrl[sizeof(URL)];
  398.         StopLoading();
  399.         souce_mode = false;
  400.         strcpy(#editURL, #URL);
  401.         history.add(#URL);
  402.         if (!strncmp(#URL,"WebView:",8))
  403.         {
  404.                 SetPageDefaults();
  405.                 if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
  406.                 else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
  407.                 DrawEditBoxWebView();
  408.                 return;
  409.         }
  410.         if (!strncmp(#URL,"http:",5)) || (!strncmp(#URL,"https://",8))
  411.         {
  412.                 img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 131, 0);
  413.  
  414.                 if (!strncmp(#URL,"http:",5)) {
  415.                         http.get(#URL);
  416.                 }
  417.                 if (!strncmp(#URL,"https://",8)) {
  418.                         sprintf(#getUrl, "http://gate.aspero.pro/?site=%s", #URL);
  419.                         http.get(#getUrl);
  420.                 }
  421.                 //http.get(#URL);
  422.                 if (!http.transfer)
  423.                 {
  424.                         StopLoading();
  425.                         bufsize = 0;
  426.                         bufpointer = free(bufpointer);
  427.                         ShowPage();
  428.                         return;
  429.                 }
  430.         }
  431.         else
  432.         {
  433.                 file_size stdcall (#URL);
  434.                 bufsize = EBX;
  435.                 if (bufsize)
  436.                 {
  437.                         free(bufpointer);
  438.                         bufpointer = malloc(bufsize);
  439.                         SetPageDefaults();
  440.                         ReadFile(0, bufsize, bufpointer, #URL);
  441.                 }
  442.                 ShowPage();
  443.         }
  444. }
  445.  
  446. DrawEditBoxWebView()
  447. {
  448.         DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 2, address_box.color);
  449.         DrawBar(address_box.left-2, address_box.top, 2, 22, address_box.color);
  450.         address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
  451.         address_box.offset = 0;
  452.         edit_box_draw stdcall(#address_box);
  453.         if (http.transfer > 0) EAX = 131; else EAX = 54;
  454.         img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, EAX, 0);
  455. }
  456.  
  457.  
  458. void ShowPage()
  459. {
  460.         DrawEditBoxWebView();
  461.         if (!bufsize)
  462.         {
  463.                 if (http.transfer) WB1.LoadInternalPage(#loading, sizeof(loading));
  464.                 else WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
  465.         }
  466.         else
  467.         {
  468.                 WB1.Prepare();
  469.         }
  470. }
  471.  
  472. byte UrlExtIs(dword ext)
  473. {
  474.         if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
  475.         return false;
  476. }
  477.  
  478. int SetSkinColors()
  479. {
  480.         dword image_data;
  481.         image_data = DSDWORD[skin.image+24];
  482.         col_bg = DSDWORD[image_data];
  483.         panel_color  = DSDWORD[skin.w*4*4 + image_data];
  484.         border_color = DSDWORD[skin.w*4*7 + image_data];
  485.         wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data];
  486.         $and col_bg, 0x00ffffff
  487.         $and panel_color, 0x00ffffff
  488.         $and border_color, 0x00ffffff
  489.         $and wv_progress_bar.progress_color, 0x00ffffff
  490. }
  491.  
  492. void DrawProgress()
  493. {
  494.         dword persent;
  495.         if (http.transfer == 0) return;
  496.         if (wv_progress_bar.max) persent = wv_progress_bar.value*100/wv_progress_bar.max; else persent = 10;
  497.         DrawBar(address_box.left-2, address_box.top+20, persent*address_box.width/100, 2, wv_progress_bar.progress_color);
  498. }
  499.  
  500.  
  501. char anchor[256];
  502. void ClickLink()
  503. {
  504.         if (http.transfer > 0)
  505.         {
  506.                 StopLoading();
  507.                 history.back();
  508.         }
  509.         strcpy(#URL, PageLinks.GetURL(PageLinks.active));
  510.         //#1
  511.         if (URL[0] == '#')
  512.         {
  513.                 if (URL[1] == NULL) {
  514.                         WB1.list.first = 0;
  515.                         strcpy(#URL, history.current());
  516.                 }
  517.                 else {
  518.                         strlcpy(#anchor, #URL+strrchr(#URL, '#'), sizeof(anchor));
  519.                         strcpy(#URL, history.current());
  520.                 }
  521.                 ShowPage();                    
  522.                 return;
  523.         }
  524.         //liner.ru#1
  525.         if (strrchr(#URL, '#')!=0)
  526.         {
  527.                 strlcpy(#anchor, #URL+strrchr(#URL, '#'), sizeof(anchor));
  528.                 URL[strrchr(#URL, '#')-1] = 0x00;
  529.         }
  530.  
  531.         if (!strncmp(#URL,"mailto:", 7))
  532.         {
  533.                 notify(#URL);
  534.                 strcpy(#editURL, history.current());
  535.                 strcpy(#URL, history.current());
  536.                 return;
  537.         }
  538.  
  539.         GetAbsoluteURL(#URL);
  540.  
  541.         if (strncmp(#URL,"http://",7)!=0) && (strncmp(#URL,"https://",8)!=0)
  542.         {
  543.                 if (UrlExtIs(".htm")!=true) && (UrlExtIs(".html")!=true)
  544.                 {      
  545.                         RunProgram("/sys/@open", #URL);
  546.                         strcpy(#editURL, history.current());
  547.                         strcpy(#URL, history.current());
  548.                         return;
  549.                 }
  550.         }
  551.         else   
  552.         {
  553.                 if (UrlExtIs(".png")==true) || (UrlExtIs(".gif")==true) || (UrlExtIs(".jpg")==true)
  554.                 || (UrlExtIs(".zip")==true) || (UrlExtIs(".kex")==true) || (UrlExtIs(".pdf")==true)
  555.                 || (UrlExtIs(".7z")==true) {
  556.                         if (!downloader_opened) {
  557.                                 strcpy(#downloader_edit, #URL);
  558.                                 CreateThread(#Downloader,#downloader_stak+4092);
  559.                                 strcpy(#editURL, history.current());
  560.                                 strcpy(#URL, history.current());
  561.                         }
  562.                         else notify("'WebView\nPlease, start a new download only when previous ended.'Et");
  563.                         return;
  564.                 }
  565.         }
  566.         if (open_in_a_new_window)
  567.         {
  568.                 RunProgram(#program_path, #URL);
  569.                 strcpy(#editURL, history.current());
  570.                 strcpy(#URL, history.current());
  571.         }
  572.         else
  573.         {
  574.                 OpenPage();
  575.         }
  576.         open_in_a_new_window = false;
  577. }
  578.  
  579. void EventShowPageMenu(dword _left, _top)
  580. {
  581.         menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #rmb_menu, VIEW_SOURCE);
  582. }
  583.  
  584. void EventShowLinkMenu(dword _left, _top)
  585. {
  586.         menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #link_menu, COPY_LINK_URL);
  587. }
  588.  
  589. void EventUpdateProgressBar()
  590. {
  591.         wv_progress_bar.max = http.content_length;
  592.         if (wv_progress_bar.value != http.content_received)
  593.         {
  594.                 wv_progress_bar.value = http.content_received; 
  595.                 DrawProgress();
  596.         }
  597. }
  598.  
  599. DrawStatusBar(dword _status_text)
  600. {
  601.         status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10;
  602.         status_text.start_y = Form.cheight - STATUSBAR_H + 3;
  603.         status_text.area_size_x = Form.cwidth - status_text.start_x -3;
  604.         DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
  605.         status_text.text_pointer = _status_text;
  606.         PathShow_prepare stdcall(#status_text);
  607.         PathShow_draw stdcall(#status_text);
  608. }
  609.  
  610. stop: