Subversion Repositories Kolibri OS

Rev

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

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