Subversion Repositories Kolibri OS

Rev

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