Subversion Repositories Kolibri OS

Rev

Rev 7450 | Rev 7521 | 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. edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(URL)-2,#editURL,0,2,19,19};
  115.  
  116. #define SKIN_Y 24
  117.  
  118. void main()
  119. {
  120.         int i;
  121.         load_dll(boxlib, #box_lib_init,0);
  122.         load_dll(libio, #libio_init,1);
  123.         load_dll(libimg, #libimg_init,1);
  124.         load_dll(libHTTP, #http_lib_init,1);
  125.         load_dll(iconv_lib, #iconv_open,0);
  126.         Libimg_LoadImage(#skin, "/sys/toolbar.png");
  127.         skin.h = 26;
  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 & ed_focus)  
  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.cur_y) {
  179.                                 ProcessEvent(menu.cur_y);
  180.                                 menu.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, 0, SKIN_Y);
  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, 102, SKIN_Y);
  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 REFRESH_BUTTON:
  311.                         if (http.transfer > 0)
  312.                         {
  313.                                 StopLoading();
  314.                                 Draw_Window();
  315.                         }
  316.                         else OpenPage();
  317.                         return;
  318.                 case SANDWICH_BUTTON:
  319.                         EventShowPageMenu(Form.cwidth - 215, TOOLBAR_H-6);
  320.                         return;
  321.                 case VIEW_SOURCE:
  322.                         WB1.list.first = 0;
  323.                         ShowSource();
  324.                         WB1.LoadInternalPage(bufpointer, bufsize);
  325.                         break;
  326.                 case EDIT_SOURCE:
  327.                         if (!strncmp(#URL,"http",4))
  328.                         {
  329.                                 CreateFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
  330.                                 if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
  331.                         }
  332.                         else RunProgram("/rd/1/tinypad", #URL);
  333.                         return;
  334.                 // case FREE_IMG_CACHE:
  335.                 //      ImgCache.Free();
  336.                 //      notify(IMAGES_CACHE_CLEARED);
  337.                 //      WB1.DrawPage();
  338.                 //      return;
  339.                 case VIEW_HISTORY:
  340.                         strcpy(#URL, URL_SERVICE_HISTORY);
  341.                         OpenPage();
  342.                         return;
  343.                 case DOWNLOAD_MANAGER:
  344.                         if (!downloader_opened) {
  345.                                 downloader_edit = NULL;
  346.                                 CreateThread(#Downloader,#downloader_stak+4092);
  347.                         }
  348.                         return;
  349.                 case COPY_LINK_URL:
  350.                         Clipboard__CopyText(PageLinks.GetURL(PageLinks.active));
  351.                         notify("'URL copied to clipboard'O");
  352.                         return;
  353.                 case DOWNLOAD_LINK_CONTENTS:
  354.                         if (!downloader_opened) {
  355.                                 strcpy(#downloader_edit, PageLinks.GetURL(PageLinks.active));
  356.                                 CreateThread(#Downloader,#downloader_stak+4092);
  357.                         }
  358.                         return;
  359.                 case SCAN_CODE_F12:
  360.                         debug_mode ^= 1;
  361.                         if (debug_mode) notify("'Debug mode ON'-I");
  362.                         else notify("'Debug mode OFF'-I");
  363.                         return;
  364.                 case SCAN_CODE_F11:
  365.                         old_tag_parser_mode ^= 1;
  366.                         if (old_tag_parser_mode) notify("'Old tag parser ON'-I");
  367.                         else notify("'Old tag parser OFF'-I");
  368.                         return;
  369.         }
  370. }
  371.  
  372. void StopLoading()
  373. {
  374.         if (http.transfer)
  375.         {
  376.                 EAX = http.transfer;
  377.                 EAX = EAX.http_msg.content_ptr;         // get pointer to data
  378.                 $push   EAX                                                     // save it on the stack
  379.                 http_free stdcall (http.transfer);      // abort connection
  380.                 $pop    EAX                                                    
  381.                 free(EAX);                                              // free data
  382.                 http.transfer=0;
  383.                 bufsize = 0;
  384.                 bufpointer = free(bufpointer);
  385.         }
  386.         wv_progress_bar.value = 0;
  387.         DrawEditBoxWebView();
  388. }
  389.  
  390. void SetPageDefaults()
  391. {
  392.         strcpy(#header, #version);
  393.         WB1.list.count = WB1.list.first = 0;
  394.         cur_encoding = CH_NULL;
  395.         if (o_bufpointer) o_bufpointer = free(o_bufpointer);
  396. }
  397.  
  398. void OpenPage()
  399. {
  400.         char getUrl[sizeof(URL)];
  401.         StopLoading();
  402.         souce_mode = false;
  403.         strcpy(#editURL, #URL);
  404.         history.add(#URL);
  405.         if (!strncmp(#URL,"WebView:",8))
  406.         {
  407.                 SetPageDefaults();
  408.                 if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
  409.                 else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
  410.                 DrawEditBoxWebView();
  411.                 return;
  412.         }
  413.         if (!strncmp(#URL,"http:",5)) || (!strncmp(#URL,"https://",8))
  414.         {
  415.                 img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 68, SKIN_Y);
  416.  
  417.                 if (!strncmp(#URL,"http:",5)) {
  418.                         http.get(#URL);
  419.                 }
  420.                 if (!strncmp(#URL,"https://",8)) {
  421.                         sprintf(#getUrl, "http://gate.aspero.pro/?site=%s", #URL);
  422.                         http.get(#getUrl);
  423.                 }
  424.                 //http.get(#URL);
  425.                 if (!http.transfer)
  426.                 {
  427.                         StopLoading();
  428.                         bufsize = 0;
  429.                         bufpointer = free(bufpointer);
  430.                         ShowPage();
  431.                         return;
  432.                 }
  433.         }
  434.         else
  435.         {
  436.                 file_size stdcall (#URL);
  437.                 bufsize = EBX;
  438.                 if (bufsize)
  439.                 {
  440.                         free(bufpointer);
  441.                         bufpointer = malloc(bufsize);
  442.                         SetPageDefaults();
  443.                         ReadFile(0, bufsize, bufpointer, #URL);
  444.                 }
  445.                 ShowPage();
  446.         }
  447. }
  448.  
  449. DrawEditBoxWebView()
  450. {
  451.         int skin_x_offset;
  452.         DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 2, address_box.color);
  453.         DrawBar(address_box.left-2, address_box.top, 2, 22, address_box.color);
  454.         //address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
  455.         //address_box.offset = 0;
  456.         EditBox_UpdateText(#address_box, address_box.flags);
  457.         edit_box_draw stdcall(#address_box);
  458.         if (http.transfer > 0) skin_x_offset = 68; else skin_x_offset = 51;
  459.         img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y);
  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: