2012-11-26 16:26:15 +01:00
|
|
|
|
//HTML Viewer in C--
|
2013-10-08 19:27:18 +02:00
|
|
|
|
//Copyright 2007-2013 by Veliant & Leency
|
2012-12-15 01:16:06 +01:00
|
|
|
|
//Asper, lev, Lrz, Barsuk, Nable...
|
2012-11-26 16:26:15 +01:00
|
|
|
|
//home icon - rachel fu, GPL licence
|
|
|
|
|
|
2013-10-24 23:45:17 +02:00
|
|
|
|
#ifndef AUTOBUILD
|
|
|
|
|
#include "lang.h--"
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-12-15 01:16:06 +01:00
|
|
|
|
//libraries
|
2013-03-11 19:16:24 +01:00
|
|
|
|
#define MEMSIZE 0x100000
|
2012-11-26 16:26:15 +01:00
|
|
|
|
#include "..\lib\strings.h"
|
2015-03-05 21:55:28 +01:00
|
|
|
|
#include "..\lib\gui.h"
|
2012-11-26 16:26:15 +01:00
|
|
|
|
#include "..\lib\file_system.h"
|
|
|
|
|
#include "..\lib\mem.h"
|
2014-01-22 01:08:47 +01:00
|
|
|
|
#include "..\lib\draw_buf.h"
|
|
|
|
|
#include "..\lib\list_box.h"
|
|
|
|
|
#include "..\lib\cursor.h"
|
|
|
|
|
|
2012-12-15 01:16:06 +01:00
|
|
|
|
//*.obj libraries
|
2015-03-05 21:55:28 +01:00
|
|
|
|
#include "..\lib\obj\box_lib.h"
|
|
|
|
|
#include "..\lib\obj\libio_lib.h"
|
|
|
|
|
#include "..\lib\obj\libimg_lib.h"
|
|
|
|
|
#include "..\lib\obj\http.h"
|
2015-08-07 00:37:34 +02:00
|
|
|
|
#include "..\lib\obj\iconv.h"
|
2014-03-22 11:29:29 +01:00
|
|
|
|
|
2015-02-15 11:18:26 +01:00
|
|
|
|
//useful patterns
|
|
|
|
|
#include "..\lib\patterns\libimg_load_skin.h"
|
|
|
|
|
|
2015-03-01 22:36:17 +01:00
|
|
|
|
char homepage[] = FROM "html\\homepage.htm";
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
2013-10-15 00:41:27 +02:00
|
|
|
|
#ifdef LANG_RUS
|
2015-08-23 21:59:44 +02:00
|
|
|
|
char version[]=" <20><><EFBFBD><EFBFBD>⮢<EFBFBD><E2AEA2> <20><><EFBFBD>㧥<EFBFBD> 1.31 UNSTABLE";
|
2013-12-27 13:30:42 +01:00
|
|
|
|
?define IMAGES_CACHE_CLEARED "<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>⨭<EFBFBD><E2A8AD> <20><><EFBFBD>饭"
|
2013-12-29 13:48:06 +01:00
|
|
|
|
?define T_LAST_SLIDE "<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <><E1ABA0>"
|
2014-01-30 19:28:50 +01:00
|
|
|
|
char loading[] = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>㧪<EFBFBD> <20><>࠭<EFBFBD><E0A0AD><EFBFBD>...<br>";
|
2014-03-22 11:29:29 +01:00
|
|
|
|
char page_not_found[] = FROM "html\page_not_found_ru.htm";
|
2014-03-15 12:48:03 +01:00
|
|
|
|
char accept_language[]= "Accept-Language: ru\n";
|
2013-10-15 00:41:27 +02:00
|
|
|
|
#else
|
2015-08-23 21:59:44 +02:00
|
|
|
|
char version[]=" Text-based Browser 1.31 UNSTABLE";
|
2013-10-15 00:41:27 +02:00
|
|
|
|
?define IMAGES_CACHE_CLEARED "Images cache cleared"
|
2013-12-29 13:48:06 +01:00
|
|
|
|
?define T_LAST_SLIDE "This slide is the last"
|
2014-01-30 19:28:50 +01:00
|
|
|
|
char loading[] = "Loading...<br>";
|
2014-03-22 11:29:29 +01:00
|
|
|
|
char page_not_found[] = FROM "html\page_not_found_en.htm";
|
2014-03-15 12:48:03 +01:00
|
|
|
|
char accept_language[]= "Accept-Language: en\n";
|
2013-10-15 00:41:27 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
2015-07-30 17:49:09 +02:00
|
|
|
|
|
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
|
proc_info Form;
|
2015-03-16 15:20:32 +01:00
|
|
|
|
#define WIN_W 799
|
|
|
|
|
#define WIN_H 559
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
2013-12-27 13:30:42 +01:00
|
|
|
|
char search_path[]="http://nigma.ru/index.php?s=";
|
2014-02-05 00:57:32 +01:00
|
|
|
|
char str_location[]="location\0";
|
|
|
|
|
int redirected = 0;
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
2013-10-22 23:56:28 +02:00
|
|
|
|
char stak[4096];
|
2015-08-02 00:08:58 +02:00
|
|
|
|
|
2013-10-15 00:41:27 +02:00
|
|
|
|
int action_buf;
|
|
|
|
|
|
2014-02-09 18:00:40 +01:00
|
|
|
|
dword http_transfer = 0;
|
2014-01-27 20:35:41 +01:00
|
|
|
|
dword http_buffer;
|
2014-01-27 03:16:25 +01:00
|
|
|
|
|
2014-03-23 23:49:49 +01:00
|
|
|
|
dword TAB_H = false; //19;
|
2014-03-22 11:29:29 +01:00
|
|
|
|
dword TAB_W = 150;
|
2014-03-23 23:49:49 +01:00
|
|
|
|
dword TOOLBAR_H = 31; //50;
|
2015-03-16 15:20:32 +01:00
|
|
|
|
dword STATUSBAR_H = 15;
|
2014-03-30 13:57:13 +02:00
|
|
|
|
dword col_bg;
|
|
|
|
|
dword panel_color;
|
|
|
|
|
dword border_color;
|
2014-03-22 11:29:29 +01:00
|
|
|
|
|
2015-08-13 14:23:35 +02:00
|
|
|
|
progress_bar wv_progress_bar;
|
2014-03-30 13:57:13 +02:00
|
|
|
|
byte souce_mode = false;
|
2014-03-22 11:29:29 +01:00
|
|
|
|
|
2015-08-13 14:23:35 +02:00
|
|
|
|
enum {
|
|
|
|
|
BACK_BUTTON=1000,
|
|
|
|
|
FORWARD_BUTTON,
|
|
|
|
|
REFRESH_BUTTON,
|
|
|
|
|
GOTOURL_BUTTON,
|
|
|
|
|
SANDWICH_BUTTON
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
2015-08-23 21:59:44 +02:00
|
|
|
|
VIEW_SOURCE=1100,
|
2015-08-13 14:23:35 +02:00
|
|
|
|
EDIT_SOURCE,
|
|
|
|
|
VIEW_HISTORY,
|
|
|
|
|
FREE_IMG_CACHE,
|
|
|
|
|
DOWNLOAD_MANAGER
|
|
|
|
|
};
|
|
|
|
|
|
2013-12-27 00:36:17 +01:00
|
|
|
|
#include "..\TWB\TWB.c"
|
2015-08-23 21:59:44 +02:00
|
|
|
|
#include "menu.h"
|
2014-03-12 23:56:28 +01:00
|
|
|
|
#include "history.h"
|
2014-03-30 13:57:13 +02:00
|
|
|
|
#include "show_src.h"
|
2015-08-05 17:30:25 +02:00
|
|
|
|
#include "network_get.h"
|
2015-03-01 22:36:17 +01:00
|
|
|
|
#include "downloader.h"
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
2014-01-27 03:16:25 +01:00
|
|
|
|
char editURL[sizeof(URL)];
|
|
|
|
|
int mouse_twb;
|
2014-03-22 11:29:29 +01:00
|
|
|
|
edit_box address_box = {250,55,34,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(URL),#editURL,#mouse_twb,2,19,19};
|
2014-01-27 03:16:25 +01:00
|
|
|
|
|
2014-03-22 11:29:29 +01:00
|
|
|
|
#define URL_SERVICE_HISTORY "WebView://history"
|
|
|
|
|
#define URL_SERVICE_HOME "WebView://home"
|
2014-03-30 13:57:13 +02:00
|
|
|
|
#define URL_SERVICE_SOURCE "WebView://source:"
|
2014-01-27 03:16:25 +01:00
|
|
|
|
|
2014-01-19 21:06:42 +01:00
|
|
|
|
|
2015-02-15 11:18:26 +01:00
|
|
|
|
libimg_image skin;
|
2014-03-22 11:29:29 +01:00
|
|
|
|
|
2015-02-15 11:18:26 +01:00
|
|
|
|
int SetSkinColors()
|
2014-03-22 11:29:29 +01:00
|
|
|
|
{
|
2014-03-30 13:57:13 +02:00
|
|
|
|
dword image_data;
|
|
|
|
|
image_data = DSDWORD[skin.image+24];
|
2014-04-17 20:07:07 +02:00
|
|
|
|
col_bg = DSDWORD[image_data];
|
2014-03-30 13:57:13 +02:00
|
|
|
|
panel_color = DSDWORD[skin.w*4*4 + image_data];
|
|
|
|
|
border_color = DSDWORD[skin.w*4*7 + image_data];
|
2015-03-16 15:20:32 +01:00
|
|
|
|
wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data];
|
2014-03-30 13:57:13 +02:00
|
|
|
|
$and col_bg, 0x00ffffff
|
|
|
|
|
$and panel_color, 0x00ffffff
|
|
|
|
|
$and border_color, 0x00ffffff
|
2015-03-16 15:20:32 +01:00
|
|
|
|
$and wv_progress_bar.progress_color, 0x00ffffff
|
2014-03-22 11:29:29 +01:00
|
|
|
|
}
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
2014-03-23 18:12:21 +01:00
|
|
|
|
void DrawProgress()
|
|
|
|
|
{
|
|
|
|
|
unsigned long btn;
|
|
|
|
|
if (http_transfer == 0) return;
|
2015-03-16 15:20:32 +01:00
|
|
|
|
if (wv_progress_bar.max) btn = address_box.width*wv_progress_bar.value/wv_progress_bar.max; else btn = 30;
|
2015-08-13 14:23:35 +02:00
|
|
|
|
DrawBar(address_box.left-1, address_box.top+15, btn, 2, wv_progress_bar.progress_color);
|
2014-03-23 18:12:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-30 13:57:13 +02:00
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
|
void main()
|
|
|
|
|
{
|
2015-08-10 17:08:16 +02:00
|
|
|
|
dword btn;
|
2012-11-26 16:26:15 +01:00
|
|
|
|
int half_scroll_size;
|
2013-10-15 00:41:27 +02:00
|
|
|
|
int scroll_used=0, show_menu;
|
2015-08-13 14:23:35 +02:00
|
|
|
|
|
2014-01-27 20:34:00 +01:00
|
|
|
|
CursorPointer.Load(#CursorFile);
|
2015-07-29 22:43:05 +02:00
|
|
|
|
load_dll(boxlib, #box_lib_init,0);
|
|
|
|
|
load_dll(libio, #libio_init,1);
|
|
|
|
|
load_dll(libimg, #libimg_init,1);
|
|
|
|
|
load_dll(libHTTP, #http_lib_init,1);
|
2015-08-07 00:37:34 +02:00
|
|
|
|
load_dll(iconv_lib, #iconv_open,0);
|
2015-08-13 14:23:35 +02:00
|
|
|
|
//load_dll(kmenu, #akmenu_init,0);
|
2015-02-15 11:18:26 +01:00
|
|
|
|
Libimg_LoadImage(#skin, abspath("wv_skin.png"));
|
|
|
|
|
SetSkinColors();
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
2015-08-05 00:21:08 +02:00
|
|
|
|
WB1.DrawBuf.zoom = 1;
|
2015-08-10 17:38:08 +02:00
|
|
|
|
WB1.list.SetFont(8, 14, 10111000b);
|
2012-11-26 16:26:15 +01:00
|
|
|
|
Form.width=WIN_W;
|
|
|
|
|
Form.height=WIN_H;
|
|
|
|
|
SetElementSizes();
|
2015-03-01 22:36:17 +01:00
|
|
|
|
if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME);
|
2013-12-27 13:30:42 +01:00
|
|
|
|
OpenPage();
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
2015-03-01 22:36:17 +01:00
|
|
|
|
CreateDir("/tmp0/1/downloads");
|
|
|
|
|
|
2014-01-27 20:34:00 +01:00
|
|
|
|
SetEventMask(0xa7);
|
2015-07-30 17:49:09 +02:00
|
|
|
|
BEGIN_LOOP_APPLICATION:
|
2012-11-26 16:26:15 +01:00
|
|
|
|
WaitEventTimeout(2);
|
|
|
|
|
switch(EAX & 0xFF)
|
|
|
|
|
{
|
|
|
|
|
CASE evMouse:
|
2013-10-24 20:26:04 +02:00
|
|
|
|
if (!CheckActiveProcess(Form.ID)) break;
|
2014-03-12 23:56:28 +01:00
|
|
|
|
//Edit URL
|
2013-04-12 02:11:49 +02:00
|
|
|
|
edit_box_mouse stdcall (#address_box);
|
2015-08-02 00:08:58 +02:00
|
|
|
|
mouse.get();
|
2014-03-12 23:56:28 +01:00
|
|
|
|
//Links hover
|
2015-08-02 00:08:58 +02:00
|
|
|
|
if (mouse.y>WB1.list.y) PageLinks.Hover(mouse.x, mouse.y, link_color_inactive, link_color_active, bg_color);
|
2014-03-12 23:56:28 +01:00
|
|
|
|
//Menu
|
2015-08-02 00:08:58 +02:00
|
|
|
|
if (mouse.y>WB1.list.y) && (mouse.y<Form.height) && (bufsize)
|
2012-11-26 16:26:15 +01:00
|
|
|
|
{
|
2015-08-02 00:08:58 +02:00
|
|
|
|
if (mouse.pkm) && (mouse.up)
|
2013-10-15 00:41:27 +02:00
|
|
|
|
{
|
2013-10-22 23:56:28 +02:00
|
|
|
|
CreateThread(#menu_rmb,#stak+4092);
|
2013-10-15 00:41:27 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2012-11-26 16:26:15 +01:00
|
|
|
|
}
|
2014-03-12 23:56:28 +01:00
|
|
|
|
//Mouse scroll
|
2015-08-02 00:08:58 +02:00
|
|
|
|
if (mouse.vert)
|
2012-11-26 16:26:15 +01:00
|
|
|
|
{
|
2015-08-23 12:12:13 +02:00
|
|
|
|
if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
|
2012-11-26 16:26:15 +01:00
|
|
|
|
}
|
2014-03-12 23:56:28 +01:00
|
|
|
|
//Drag scroller
|
2014-03-22 11:29:29 +01:00
|
|
|
|
scroll_wv.all_redraw = 0;
|
2015-08-02 00:08:58 +02:00
|
|
|
|
if (!mouse.lkm) scroll_used=0;
|
|
|
|
|
if (mouse.x>=scroll_wv.start_x) && (mouse.x<=scroll_wv.start_x+scroll_wv.size_x)
|
|
|
|
|
&& (mouse.y>=scroll_wv.start_y+scroll_wv.btn_height) && (-scroll_wv.btn_height+scroll_wv.start_y+scroll_wv.size_y>mouse.y)
|
|
|
|
|
&& (WB1.list.count>WB1.list.visible) && (mouse.lkm)
|
2013-10-15 00:41:27 +02:00
|
|
|
|
{
|
|
|
|
|
scroll_used=1;
|
2014-03-12 23:56:28 +01:00
|
|
|
|
}
|
2012-11-26 16:26:15 +01:00
|
|
|
|
if (scroll_used)
|
|
|
|
|
{
|
2015-08-05 00:21:08 +02:00
|
|
|
|
mouse.y = mouse.y + 5;
|
2013-12-27 12:15:17 +01:00
|
|
|
|
half_scroll_size = WB1.list.h - 16 * WB1.list.visible / WB1.list.count - 3 /2;
|
2015-08-02 00:08:58 +02:00
|
|
|
|
if (half_scroll_size+WB1.list.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=half_scroll_size+WB1.list.y;
|
2013-12-27 13:30:42 +01:00
|
|
|
|
btn=WB1.list.first;
|
2015-08-02 00:08:58 +02:00
|
|
|
|
WB1.list.first = mouse.y -half_scroll_size -WB1.list.y * WB1.list.count / WB1.list.h;
|
2013-12-27 12:15:17 +01:00
|
|
|
|
if (WB1.list.visible+WB1.list.first>WB1.list.count) WB1.list.first=WB1.list.count-WB1.list.visible;
|
2015-08-23 12:12:13 +02:00
|
|
|
|
if (btn!=WB1.list.first) WB1.DrawPage();
|
2012-11-26 16:26:15 +01:00
|
|
|
|
}
|
|
|
|
|
break;
|
2015-08-10 17:08:16 +02:00
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
|
case evButton:
|
|
|
|
|
btn=GetButtonID();
|
2014-03-12 23:56:28 +01:00
|
|
|
|
if (btn==1) ExitProcess();
|
|
|
|
|
Scan(btn);
|
2012-11-26 16:26:15 +01:00
|
|
|
|
break;
|
2015-08-10 17:08:16 +02:00
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
|
case evKey:
|
2015-08-10 17:08:16 +02:00
|
|
|
|
GetKeys();
|
2015-03-18 23:23:24 +01:00
|
|
|
|
if (address_box.flags & 0b10)
|
2015-03-18 20:40:42 +01:00
|
|
|
|
{
|
2015-08-10 17:08:16 +02:00
|
|
|
|
if (key_ascii == ASCII_KEY_ENTER) Scan(key_scancode); else
|
|
|
|
|
if (key_ascii != 0x0d) && (key_ascii != 183) && (key_ascii != 184) {EAX = key_ascii << 8; edit_box_key stdcall(#address_box);}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Scan(key_scancode);
|
2015-03-18 20:40:42 +01:00
|
|
|
|
}
|
2012-11-26 16:26:15 +01:00
|
|
|
|
break;
|
2015-03-18 20:40:42 +01:00
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
|
case evReDraw:
|
2014-03-12 23:56:28 +01:00
|
|
|
|
if (action_buf) Scan(action_buf);
|
2014-03-31 19:14:16 +02:00
|
|
|
|
DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2,WIN_W,WIN_H,0x73,col_bg,0,0);
|
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
2014-03-31 20:05:04 +02:00
|
|
|
|
if (Form.status_window>2) { DrawTitle(#header); break; }
|
2014-03-31 19:14:16 +02:00
|
|
|
|
if (Form.height<120) MoveSize(OLD,OLD,OLD,120);
|
|
|
|
|
if (Form.width<280) MoveSize(OLD,OLD,280,OLD);
|
2012-11-26 16:26:15 +01:00
|
|
|
|
Draw_Window();
|
|
|
|
|
break;
|
2014-01-27 21:16:33 +01:00
|
|
|
|
|
2014-01-27 20:34:00 +01:00
|
|
|
|
case evNetwork:
|
2014-01-27 21:16:33 +01:00
|
|
|
|
if (http_transfer > 0) {
|
2015-03-20 13:04:14 +01:00
|
|
|
|
http_receive stdcall (http_transfer);
|
2014-03-22 11:29:29 +01:00
|
|
|
|
$push EAX
|
|
|
|
|
ESI = http_transfer;
|
2015-03-16 15:20:32 +01:00
|
|
|
|
wv_progress_bar.max = ESI.http_msg.content_length;
|
|
|
|
|
if (wv_progress_bar.value != ESI.http_msg.content_received)
|
2014-03-23 18:12:21 +01:00
|
|
|
|
{
|
2015-03-16 15:20:32 +01:00
|
|
|
|
wv_progress_bar.value = ESI.http_msg.content_received;
|
2014-03-23 18:12:21 +01:00
|
|
|
|
DrawProgress();
|
|
|
|
|
}
|
2014-03-22 11:29:29 +01:00
|
|
|
|
$pop EAX
|
|
|
|
|
if (EAX == 0) {
|
2014-02-05 00:57:32 +01:00
|
|
|
|
ESI = http_transfer;
|
|
|
|
|
// Handle redirects
|
2014-02-09 16:19:23 +01:00
|
|
|
|
if (ESI.http_msg.status >= 300) && (ESI.http_msg.status < 400)
|
|
|
|
|
{
|
2014-02-05 00:57:32 +01:00
|
|
|
|
redirected++;
|
2014-02-09 16:19:23 +01:00
|
|
|
|
if (redirected<=5)
|
|
|
|
|
{
|
2014-02-05 00:57:32 +01:00
|
|
|
|
http_find_header_field stdcall (http_transfer, #str_location);
|
|
|
|
|
if (EAX!=0) {
|
|
|
|
|
ESI = EAX;
|
|
|
|
|
EDI = #URL;
|
|
|
|
|
do {
|
|
|
|
|
$lodsb;
|
|
|
|
|
$stosb;
|
|
|
|
|
} while (AL != 0) && (AL != 13) && (AL != 10));
|
|
|
|
|
DSBYTE[EDI-1]='\0';
|
|
|
|
|
}
|
2014-02-09 16:19:23 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-02-05 00:57:32 +01:00
|
|
|
|
//TODO: display error (too many redirects)
|
|
|
|
|
}
|
2014-02-09 16:19:23 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-02-05 00:57:32 +01:00
|
|
|
|
redirected = 0;
|
|
|
|
|
}
|
2014-02-02 20:20:59 +01:00
|
|
|
|
// Loading the page is complete, free resources
|
2014-02-09 16:19:23 +01:00
|
|
|
|
if (redirected>0)
|
|
|
|
|
{
|
2014-03-14 01:07:05 +01:00
|
|
|
|
http_free stdcall (http_transfer);
|
|
|
|
|
http_transfer=0;
|
2014-03-23 18:12:21 +01:00
|
|
|
|
PageLinks.GetAbsoluteURL(#URL);
|
2014-03-23 18:33:24 +01:00
|
|
|
|
BrowserHistory.current--;
|
2014-02-05 00:57:32 +01:00
|
|
|
|
strcpy(#editURL, #URL);
|
2015-08-13 14:23:35 +02:00
|
|
|
|
DrawEditBox();
|
2014-02-05 00:57:32 +01:00
|
|
|
|
OpenPage();
|
2014-02-09 16:19:23 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-03-23 18:12:21 +01:00
|
|
|
|
BrowserHistory.AddUrl();
|
2014-03-14 01:07:05 +01:00
|
|
|
|
ESI = http_transfer;
|
|
|
|
|
bufpointer = ESI.http_msg.content_ptr;
|
|
|
|
|
bufsize = ESI.http_msg.content_received;
|
|
|
|
|
http_free stdcall (http_transfer);
|
|
|
|
|
http_transfer=0;
|
2014-03-14 20:06:48 +01:00
|
|
|
|
SetPageDefaults();
|
2014-02-05 00:57:32 +01:00
|
|
|
|
Draw_Window(); // stop button => refresh button
|
|
|
|
|
}
|
2014-01-27 20:34:00 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-11-26 16:26:15 +01:00
|
|
|
|
}
|
2015-07-30 17:49:09 +02:00
|
|
|
|
goto BEGIN_LOOP_APPLICATION;
|
2012-11-26 16:26:15 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetElementSizes()
|
|
|
|
|
{
|
2014-03-22 11:29:29 +01:00
|
|
|
|
address_box.top = TOOLBAR_H-TAB_H/2-7+TAB_H;
|
|
|
|
|
address_box.width = Form.cwidth - address_box.left - 25 - 22;
|
2015-08-05 00:21:08 +02:00
|
|
|
|
WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom,
|
2015-08-10 17:08:16 +02:00
|
|
|
|
Form.cheight - TOOLBAR_H - STATUSBAR_H, WB1.list.font_h + WB1.DrawBuf.zoom + WB1.DrawBuf.zoom * WB1.DrawBuf.zoom);
|
2015-08-19 17:14:52 +02:00
|
|
|
|
WB1.list.wheel_size = 7;
|
2015-08-10 14:45:00 +02:00
|
|
|
|
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
|
2014-03-23 23:49:49 +01:00
|
|
|
|
WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h;
|
2015-08-23 12:12:13 +02:00
|
|
|
|
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h * 20);
|
2012-11-26 16:26:15 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Draw_Window()
|
|
|
|
|
{
|
2014-03-22 11:29:29 +01:00
|
|
|
|
int img_off;
|
|
|
|
|
// tab {
|
2015-08-19 17:14:52 +02:00
|
|
|
|
/*
|
2014-03-23 23:49:49 +01:00
|
|
|
|
if (TAB_H)
|
|
|
|
|
{
|
|
|
|
|
DrawBar(0, 0, TAB_W, TAB_H+1, panel_color);
|
|
|
|
|
WriteText(5, 7, 0x80, 0xfdfdFd, "Index.htm");
|
|
|
|
|
WriteText(4, 6, 0x80, 0, "Index.htm");
|
|
|
|
|
DrawBar(TAB_W,0, Form.cwidth-TAB_W,TAB_H, col_bg);
|
|
|
|
|
DrawBar(TAB_W-1,TAB_H, Form.cwidth-TAB_W+1,1, border_color);
|
|
|
|
|
img_draw stdcall(skin.image, TAB_W-13, 0, 30, skin.h, 101, 0);
|
|
|
|
|
}
|
2015-08-19 17:14:52 +02:00
|
|
|
|
else */ DrawBar(0,0, Form.cwidth,1, col_bg);
|
2014-03-22 11:29:29 +01:00
|
|
|
|
// }
|
2014-03-23 18:12:21 +01:00
|
|
|
|
DrawBar(0,TAB_H+1, Form.cwidth,TOOLBAR_H-TAB_H-3, panel_color);
|
2015-08-13 14:23:35 +02:00
|
|
|
|
DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
|
2014-03-22 11:29:29 +01:00
|
|
|
|
DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
|
2012-11-26 16:26:15 +01:00
|
|
|
|
SetElementSizes();
|
2015-08-13 14:23:35 +02:00
|
|
|
|
DrawRectangle(address_box.left-2, address_box.top-3, address_box.width+4, 20,border_color);
|
|
|
|
|
DrawRectangle(address_box.left-1, address_box.top-2, address_box.width+2, 18,address_box.color);
|
2014-03-22 11:29:29 +01:00
|
|
|
|
DrawRectangle(address_box.left-1, address_box.top-1, address_box.width+2, 16,address_box.color);
|
|
|
|
|
// < / >
|
2015-08-13 14:23:35 +02:00
|
|
|
|
DefineButton(address_box.left-49, address_box.top-2, 23, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
|
|
|
|
|
DefineButton(address_box.left-25, address_box.top-2, 23, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
|
|
|
|
|
img_draw stdcall(skin.image, address_box.left-50, address_box.top-3, 48, skin.h, 3, 0);
|
|
|
|
|
// refresh_BUTTON
|
|
|
|
|
DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
|
2014-03-22 11:29:29 +01:00
|
|
|
|
if (http_transfer > 0) img_off = 131; else img_off = 52;
|
2015-08-13 14:23:35 +02:00
|
|
|
|
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, img_off, 0);
|
2014-03-22 11:29:29 +01:00
|
|
|
|
// config
|
2015-08-13 14:23:35 +02:00
|
|
|
|
DefineButton(Form.cwidth-24, address_box.top-3, 19, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
|
|
|
|
|
img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-3, 16, skin.h, 85, 0);
|
2014-03-22 11:29:29 +01:00
|
|
|
|
//status bar
|
|
|
|
|
DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
|
|
|
|
|
DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
|
2014-03-23 23:49:49 +01:00
|
|
|
|
ShowPage();
|
|
|
|
|
DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
|
2014-03-24 00:18:01 +01:00
|
|
|
|
DrawProgress();
|
2012-11-26 16:26:15 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-08-10 17:08:16 +02:00
|
|
|
|
void Scan(dword id__)
|
2013-12-27 01:33:12 +01:00
|
|
|
|
{
|
2014-03-12 23:56:28 +01:00
|
|
|
|
action_buf=0;
|
2015-08-13 14:23:35 +02:00
|
|
|
|
if (id__ >= 400) && (id__ < 1000)
|
2014-03-12 23:56:28 +01:00
|
|
|
|
{
|
2015-08-10 17:08:16 +02:00
|
|
|
|
ProcessLinks(id__);
|
2014-03-12 23:56:28 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
2015-08-10 17:08:16 +02:00
|
|
|
|
switch (id__)
|
2013-12-27 01:33:12 +01:00
|
|
|
|
{
|
2015-08-10 17:08:16 +02:00
|
|
|
|
case SCAN_CODE_BS:
|
2015-08-13 14:23:35 +02:00
|
|
|
|
case BACK_BUTTON:
|
2015-08-10 17:08:16 +02:00
|
|
|
|
if (!BrowserHistory.GoBack()) return;
|
|
|
|
|
OpenPage();
|
|
|
|
|
return;
|
|
|
|
|
|
2015-08-13 14:23:35 +02:00
|
|
|
|
case FORWARD_BUTTON:
|
2015-08-10 17:08:16 +02:00
|
|
|
|
if (!BrowserHistory.GoForward()) return;
|
|
|
|
|
OpenPage();
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case SCAN_CODE_HOME:
|
|
|
|
|
case SCAN_CODE_END:
|
|
|
|
|
case SCAN_CODE_PGUP:
|
|
|
|
|
case SCAN_CODE_PGDN:
|
2015-08-23 12:12:13 +02:00
|
|
|
|
if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage();
|
2015-08-10 17:08:16 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case SCAN_CODE_UP:
|
|
|
|
|
if (WB1.list.first <= 0) return;
|
|
|
|
|
WB1.list.first--;
|
2015-08-23 12:12:13 +02:00
|
|
|
|
WB1.DrawPage();
|
2015-08-10 17:08:16 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case SCAN_CODE_DOWN:
|
|
|
|
|
if (WB1.list.visible + WB1.list.first >= WB1.list.count) return;
|
|
|
|
|
WB1.list.first++;
|
2015-08-23 12:12:13 +02:00
|
|
|
|
WB1.DrawPage();
|
2015-08-10 17:08:16 +02:00
|
|
|
|
return;
|
|
|
|
|
|
2015-08-13 14:23:35 +02:00
|
|
|
|
case GOTOURL_BUTTON:
|
2015-08-10 17:08:16 +02:00
|
|
|
|
case SCAN_CODE_ENTER: //enter
|
|
|
|
|
if (!editURL[0]) return;
|
|
|
|
|
if (strncmp(#editURL,"http:",5)) && (editURL[0]!='/') && (strncmp(#editURL,"WebView:",9)) strncpy(#URL,"http://",7);
|
|
|
|
|
else
|
|
|
|
|
URL[0] = 0;
|
|
|
|
|
strcat(#URL, #editURL);
|
|
|
|
|
OpenPage();
|
|
|
|
|
return;
|
|
|
|
|
|
2015-08-13 14:23:35 +02:00
|
|
|
|
case 063: //F5
|
|
|
|
|
IF(address_box.flags & 0b10) return;
|
|
|
|
|
case REFRESH_BUTTON:
|
2015-08-10 17:59:20 +02:00
|
|
|
|
if (http_transfer > 0)
|
|
|
|
|
{
|
|
|
|
|
StopLoading();
|
|
|
|
|
Draw_Window();
|
|
|
|
|
}
|
|
|
|
|
else OpenPage();
|
|
|
|
|
return;
|
|
|
|
|
|
2015-08-13 14:23:35 +02:00
|
|
|
|
case SANDWICH_BUTTON:
|
|
|
|
|
mouse.y = TOOLBAR_H-6;
|
|
|
|
|
mouse.x = Form.cwidth - 167;
|
|
|
|
|
CreateThread(#menu_rmb,#stak+4092);
|
2014-01-29 01:14:09 +01:00
|
|
|
|
return;
|
2015-08-13 14:23:35 +02:00
|
|
|
|
|
|
|
|
|
case VIEW_SOURCE:
|
2014-03-31 19:14:16 +02:00
|
|
|
|
WB1.list.first = 0;
|
2014-03-30 13:57:13 +02:00
|
|
|
|
ShowSource();
|
2015-08-23 12:12:13 +02:00
|
|
|
|
WB1.DrawPage();
|
2014-03-30 13:57:13 +02:00
|
|
|
|
break;
|
2015-08-13 14:23:35 +02:00
|
|
|
|
|
|
|
|
|
case EDIT_SOURCE:
|
2015-07-30 17:49:09 +02:00
|
|
|
|
if (!strncmp(#URL,"http:",5))
|
2014-03-12 23:56:28 +01:00
|
|
|
|
{
|
2014-03-30 13:57:13 +02:00
|
|
|
|
WriteFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
|
2015-07-30 17:49:09 +02:00
|
|
|
|
if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
|
2014-03-12 23:56:28 +01:00
|
|
|
|
}
|
2015-07-30 17:49:09 +02:00
|
|
|
|
else RunProgram("/rd/1/tinypad", #URL);
|
2013-12-27 01:33:12 +01:00
|
|
|
|
return;
|
2015-08-10 17:59:20 +02:00
|
|
|
|
|
2015-08-13 14:23:35 +02:00
|
|
|
|
case FREE_IMG_CACHE:
|
|
|
|
|
ImgCache.Free();
|
|
|
|
|
notify(IMAGES_CACHE_CLEARED);
|
2015-08-23 12:12:13 +02:00
|
|
|
|
WB1.DrawPage();
|
2015-08-13 14:23:35 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case VIEW_HISTORY:
|
|
|
|
|
strcpy(#URL, URL_SERVICE_HISTORY);
|
|
|
|
|
OpenPage();
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case DOWNLOAD_MANAGER:
|
|
|
|
|
if (!downloader_opened) {
|
|
|
|
|
strncpy(#DL_URL, "http://",7);
|
|
|
|
|
CreateThread(#Downloader,#downloader_stak+4092);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
/*
|
2013-12-27 12:15:17 +01:00
|
|
|
|
case 020:
|
2013-12-27 01:33:12 +01:00
|
|
|
|
case NEWTAB:
|
|
|
|
|
MoveSize(190,80,OLD,OLD);
|
|
|
|
|
RunProgram(#program_path, #URL);
|
|
|
|
|
return;
|
2015-08-10 17:08:16 +02:00
|
|
|
|
|
2015-08-13 14:23:35 +02:00
|
|
|
|
case SEARCHWEB_BUTTON:
|
2015-07-30 17:49:09 +02:00
|
|
|
|
sprintf(#URL,"%s%s",#search_path,#editURL);
|
2013-12-27 13:30:42 +01:00
|
|
|
|
OpenPage();
|
2013-12-27 01:33:12 +01:00
|
|
|
|
return;
|
2015-08-10 17:08:16 +02:00
|
|
|
|
*/
|
2013-12-27 01:33:12 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-27 12:15:17 +01:00
|
|
|
|
void ProcessLinks(int id)
|
|
|
|
|
{
|
2014-03-23 18:33:24 +01:00
|
|
|
|
if (http_transfer > 0)
|
|
|
|
|
{
|
|
|
|
|
StopLoading();
|
|
|
|
|
BrowserHistory.current--;
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-29 01:14:09 +01:00
|
|
|
|
strcpy(#URL, PageLinks.GetURL(id-401));
|
2013-12-27 12:15:17 +01:00
|
|
|
|
//#1
|
|
|
|
|
if (URL[0] == '#')
|
|
|
|
|
{
|
2013-12-29 13:48:06 +01:00
|
|
|
|
strcpy(#anchor, #URL+strrchr(#URL, '#'));
|
2013-12-27 12:15:17 +01:00
|
|
|
|
strcpy(#URL, BrowserHistory.CurrentUrl());
|
|
|
|
|
WB1.list.first=WB1.list.count-WB1.list.visible;
|
2014-01-22 01:08:47 +01:00
|
|
|
|
ShowPage();
|
2013-12-27 12:15:17 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//liner.ru#1
|
2013-12-29 13:48:06 +01:00
|
|
|
|
if (strrchr(#URL, '#')!=-1)
|
2013-12-27 12:15:17 +01:00
|
|
|
|
{
|
|
|
|
|
strcpy(#anchor, #URL+strrchr(#URL, '#'));
|
2013-12-27 13:30:42 +01:00
|
|
|
|
URL[strrchr(#URL, '#')-1] = 0x00;
|
2013-12-27 12:15:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-23 18:12:21 +01:00
|
|
|
|
PageLinks.GetAbsoluteURL(#URL);
|
2013-12-27 12:15:17 +01:00
|
|
|
|
|
2015-03-16 15:20:32 +01:00
|
|
|
|
if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1) || (UrlExtIs(".kex")==1)
|
2015-03-01 22:36:17 +01:00
|
|
|
|
|| (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1)
|
2013-12-27 12:15:17 +01:00
|
|
|
|
{
|
2015-03-08 15:39:42 +01:00
|
|
|
|
//notify(#URL);
|
2015-07-30 17:49:09 +02:00
|
|
|
|
if (!strncmp(#URL,"http://", 7))
|
2015-03-01 22:36:17 +01:00
|
|
|
|
{
|
|
|
|
|
strcpy(#DL_URL, #URL);
|
|
|
|
|
CreateThread(#Downloader,#downloader_stak+4092);
|
|
|
|
|
}
|
2015-07-30 17:49:09 +02:00
|
|
|
|
else RunProgram("@open", #URL);
|
2013-12-27 12:15:17 +01:00
|
|
|
|
strcpy(#editURL, BrowserHistory.CurrentUrl());
|
|
|
|
|
strcpy(#URL, BrowserHistory.CurrentUrl());
|
|
|
|
|
return;
|
|
|
|
|
}
|
2015-07-30 17:49:09 +02:00
|
|
|
|
if (!strncmp(#URL,"mailto:", 7))
|
2013-12-27 12:15:17 +01:00
|
|
|
|
{
|
|
|
|
|
notify(#URL);
|
|
|
|
|
strcpy(#editURL, BrowserHistory.CurrentUrl());
|
|
|
|
|
strcpy(#URL, BrowserHistory.CurrentUrl());
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-12-27 13:30:42 +01:00
|
|
|
|
OpenPage();
|
2013-12-27 12:15:17 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-12 23:56:28 +01:00
|
|
|
|
void StopLoading()
|
|
|
|
|
{
|
2015-07-30 17:49:09 +02:00
|
|
|
|
if (http_transfer)
|
2014-03-15 11:34:28 +01:00
|
|
|
|
{
|
|
|
|
|
EAX = http_transfer;
|
|
|
|
|
EAX = EAX.http_msg.content_ptr; // get pointer to data
|
|
|
|
|
$push EAX // save it on the stack
|
|
|
|
|
http_free stdcall (http_transfer); // abort connection
|
|
|
|
|
$pop EAX
|
2015-07-30 17:49:09 +02:00
|
|
|
|
free(EAX); // free data
|
2014-03-15 11:34:28 +01:00
|
|
|
|
http_transfer=0;
|
|
|
|
|
bufsize = 0;
|
2015-07-30 17:49:09 +02:00
|
|
|
|
bufpointer = free(bufpointer);
|
2014-03-15 11:34:28 +01:00
|
|
|
|
}
|
2015-03-16 15:20:32 +01:00
|
|
|
|
wv_progress_bar.value = 0;
|
2015-08-13 14:23:35 +02:00
|
|
|
|
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 52, 0);
|
2014-03-14 20:06:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetPageDefaults()
|
|
|
|
|
{
|
|
|
|
|
strcpy(#header, #version);
|
|
|
|
|
WB1.list.count = WB1.list.first = 0;
|
|
|
|
|
stroka = 0;
|
2015-08-10 09:09:10 +02:00
|
|
|
|
cur_encoding = CH_NULL;
|
2014-03-14 20:06:48 +01:00
|
|
|
|
if (o_bufpointer) o_bufpointer = free(o_bufpointer);
|
2014-03-12 23:56:28 +01:00
|
|
|
|
anchor_line_num=WB1.list.first;
|
|
|
|
|
anchor[0]='|';
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-27 13:30:42 +01:00
|
|
|
|
void OpenPage()
|
|
|
|
|
{
|
2014-03-12 23:56:28 +01:00
|
|
|
|
StopLoading();
|
2014-03-30 13:57:13 +02:00
|
|
|
|
souce_mode = false;
|
2013-12-27 13:30:42 +01:00
|
|
|
|
strcpy(#editURL, #URL);
|
2014-03-23 18:33:24 +01:00
|
|
|
|
BrowserHistory.AddUrl();
|
2015-07-30 17:49:09 +02:00
|
|
|
|
if (!strncmp(#URL,"WebView:",8))
|
2014-03-23 23:49:49 +01:00
|
|
|
|
{
|
|
|
|
|
SetPageDefaults();
|
2015-08-19 14:54:01 +02:00
|
|
|
|
if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
|
2015-07-30 17:49:09 +02:00
|
|
|
|
else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
|
2014-03-23 23:49:49 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
2015-07-30 17:49:09 +02:00
|
|
|
|
if (!strncmp(#URL,"http:",5))
|
2013-12-27 13:30:42 +01:00
|
|
|
|
{
|
2015-08-13 14:23:35 +02:00
|
|
|
|
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 131, 0);
|
2015-03-20 13:04:14 +01:00
|
|
|
|
http_get stdcall (#URL, 0, 0, #accept_language);
|
2014-03-12 23:56:28 +01:00
|
|
|
|
http_transfer = EAX;
|
2015-07-30 17:49:09 +02:00
|
|
|
|
if (!http_transfer)
|
2014-03-15 11:23:06 +01:00
|
|
|
|
{
|
|
|
|
|
StopLoading();
|
|
|
|
|
bufsize = 0;
|
2015-07-30 17:49:09 +02:00
|
|
|
|
bufpointer = free(bufpointer);
|
2014-03-15 11:23:06 +01:00
|
|
|
|
ShowPage();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-12-27 13:30:42 +01:00
|
|
|
|
}
|
2014-03-12 23:56:28 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
file_size stdcall (#URL);
|
|
|
|
|
bufsize = EBX;
|
2014-03-15 16:16:08 +01:00
|
|
|
|
if (bufsize)
|
|
|
|
|
{
|
2015-07-30 17:49:09 +02:00
|
|
|
|
free(bufpointer);
|
|
|
|
|
bufpointer = malloc(bufsize);
|
2014-03-15 16:16:08 +01:00
|
|
|
|
SetPageDefaults();
|
2014-03-30 13:57:13 +02:00
|
|
|
|
ReadFile(0, bufsize, bufpointer, #URL);
|
2014-03-15 16:16:08 +01:00
|
|
|
|
}
|
2014-03-14 20:06:48 +01:00
|
|
|
|
ShowPage();
|
2014-03-12 23:56:28 +01:00
|
|
|
|
}
|
2013-12-27 13:30:42 +01:00
|
|
|
|
}
|
2013-12-27 12:15:17 +01:00
|
|
|
|
|
2014-03-30 13:57:13 +02:00
|
|
|
|
DrawEditBox()
|
2014-01-22 01:08:47 +01:00
|
|
|
|
{
|
2014-03-30 13:57:13 +02:00
|
|
|
|
address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
|
|
|
|
|
address_box.offset = 0;
|
2014-01-22 01:08:47 +01:00
|
|
|
|
edit_box_draw stdcall(#address_box);
|
2014-03-30 13:57:13 +02:00
|
|
|
|
}
|
2014-01-22 01:08:47 +01:00
|
|
|
|
|
2014-03-30 13:57:13 +02:00
|
|
|
|
|
|
|
|
|
void ShowPage()
|
|
|
|
|
{
|
|
|
|
|
DrawEditBox();
|
2014-01-27 21:16:33 +01:00
|
|
|
|
if (!bufsize)
|
2014-01-22 01:08:47 +01:00
|
|
|
|
{
|
|
|
|
|
PageLinks.Clear();
|
2015-07-30 17:49:09 +02:00
|
|
|
|
if (http_transfer)
|
2014-03-12 23:56:28 +01:00
|
|
|
|
{
|
2015-08-19 14:54:01 +02:00
|
|
|
|
WB1.LoadInternalPage(#loading, sizeof(loading));
|
2014-03-12 23:56:28 +01:00
|
|
|
|
}
|
2014-01-22 01:08:47 +01:00
|
|
|
|
else
|
2015-08-19 14:54:01 +02:00
|
|
|
|
WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
|
2014-01-22 01:08:47 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2015-08-23 21:59:44 +02:00
|
|
|
|
{
|
2015-08-23 12:12:13 +02:00
|
|
|
|
WB1.Prepare();
|
2015-08-23 21:59:44 +02:00
|
|
|
|
}
|
2014-01-22 01:08:47 +01:00
|
|
|
|
|
|
|
|
|
if (!header) strcpy(#header, #version);
|
|
|
|
|
if (!strcmp(#version, #header)) DrawTitle(#header);
|
|
|
|
|
}
|
2013-12-27 12:15:17 +01:00
|
|
|
|
|
2015-03-01 22:36:17 +01:00
|
|
|
|
byte UrlExtIs(dword ext)
|
|
|
|
|
{
|
2015-07-30 17:49:09 +02:00
|
|
|
|
if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
|
|
|
|
|
return false;
|
2015-03-01 22:36:17 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-08-19 14:48:31 +02:00
|
|
|
|
|
2014-03-12 23:56:28 +01:00
|
|
|
|
|
2015-03-01 22:36:17 +01:00
|
|
|
|
char downloader_stak[4096];
|
2015-07-30 17:49:09 +02:00
|
|
|
|
stop:
|