2012-02-29 13:29:47 +01:00
|
|
|
|
//Web-component, Leency & Veliant 2007-20012
|
2011-06-25 03:52:11 +02:00
|
|
|
|
//lev
|
|
|
|
|
|
2011-08-20 17:36:15 +02:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2011-06-25 03:52:11 +02:00
|
|
|
|
//ol - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
2012-02-27 14:48:04 +01:00
|
|
|
|
//<2F><> <20><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
2011-09-05 11:18:16 +02:00
|
|
|
|
int downloader_id;
|
2011-06-25 03:52:11 +02:00
|
|
|
|
|
|
|
|
|
dword j,
|
|
|
|
|
buf,
|
|
|
|
|
filesize,
|
|
|
|
|
blink = 400;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
char download_path[]="/rd/1/.download";
|
|
|
|
|
//char search_path[]="http://nova.rambler.ru/search?words=";
|
|
|
|
|
char search_path[]="http://nigma.ru/index.php?s=";
|
2012-02-29 13:29:47 +01:00
|
|
|
|
char version[]=" Text-based Browser 0.77";
|
2011-06-25 03:52:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct TWebBrowser {
|
2011-08-20 17:36:15 +02:00
|
|
|
|
int left,
|
2011-06-25 03:52:11 +02:00
|
|
|
|
top,
|
|
|
|
|
width,
|
|
|
|
|
height;
|
|
|
|
|
void DrawScroller();
|
2012-02-24 22:27:05 +01:00
|
|
|
|
void ShowPage();
|
2011-06-25 03:52:11 +02:00
|
|
|
|
void ParseHTML(dword, dword);
|
|
|
|
|
void Scan(dword);
|
|
|
|
|
void WhatTextStyle(int left1, top1, width1);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TWebBrowser WB1;
|
|
|
|
|
|
2012-02-29 13:29:47 +01:00
|
|
|
|
byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text, link, ignor_text, li_tab, body_present;
|
2011-09-26 13:41:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dword text_colors[10],
|
|
|
|
|
text_color_index = 0,
|
2012-02-29 13:29:47 +01:00
|
|
|
|
link_color,
|
|
|
|
|
bg_color=0xFFFFFF;
|
2011-09-26 13:41:07 +02:00
|
|
|
|
|
|
|
|
|
int stroka,
|
|
|
|
|
stolbec,
|
|
|
|
|
tab_len;
|
|
|
|
|
|
|
|
|
|
char line[330],
|
|
|
|
|
tag[100],
|
|
|
|
|
tagparam[10000],
|
|
|
|
|
parametr[1200],
|
|
|
|
|
options[1000];
|
|
|
|
|
|
|
|
|
|
|
2012-02-27 14:48:04 +01:00
|
|
|
|
#include "include\history.h"
|
|
|
|
|
#include "include\colors.h"
|
|
|
|
|
#include "include\unicode_tags.h"
|
|
|
|
|
#include "include\some_code.h"
|
|
|
|
|
|
2011-06-25 03:52:11 +02:00
|
|
|
|
|
|
|
|
|
void TWebBrowser::Scan(dword id) {
|
2012-02-21 23:22:44 +01:00
|
|
|
|
if (id > 399)
|
2011-09-30 11:19:41 +02:00
|
|
|
|
{
|
2012-03-04 00:29:02 +01:00
|
|
|
|
GetURLfromPageLinks(id);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> GetNewUrl() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-21 23:22:44 +01:00
|
|
|
|
IF (URL[0] == '#') { //<2F><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD> <20><><EFBFBD>...
|
|
|
|
|
copystr(#editURL, #URL);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-02-27 14:48:04 +01:00
|
|
|
|
|
|
|
|
|
URL[find_symbol(#URL, '#')-1] = 0x00; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
2012-03-04 00:29:02 +01:00
|
|
|
|
|
2012-02-21 23:22:44 +01:00
|
|
|
|
GetNewUrl();
|
2012-02-27 14:48:04 +01:00
|
|
|
|
|
2012-03-04 00:29:02 +01:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg"))
|
|
|
|
|
{
|
|
|
|
|
RunProgram("/sys/media/kiv", #URL);
|
|
|
|
|
copystr(#editURL, #URL);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-28 11:49:22 +01:00
|
|
|
|
copystr(#URL, #editURL);
|
2012-02-29 00:38:54 +01:00
|
|
|
|
za_kadrom = count = 0;
|
2012-03-04 00:29:02 +01:00
|
|
|
|
|
|
|
|
|
if (!strcmp(get_URL_part(5),"http:")) HttpLoad();
|
|
|
|
|
|
2012-02-29 00:38:54 +01:00
|
|
|
|
ShowPage(#URL);
|
2011-06-25 03:52:11 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
2011-09-30 11:19:41 +02:00
|
|
|
|
|
2011-06-25 03:52:11 +02:00
|
|
|
|
//edit1.flags=64;
|
2011-09-30 11:19:41 +02:00
|
|
|
|
IF(count < max_kolvo_strok) SWITCH(id) //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{ CASE 183: CASE 184: CASE 180: CASE 181: return; }
|
|
|
|
|
|
2011-09-26 16:09:58 +02:00
|
|
|
|
switch (id)
|
|
|
|
|
{
|
|
|
|
|
case 011: //Ctrk+K
|
|
|
|
|
ReadHtml();
|
|
|
|
|
koitodos(buf);
|
|
|
|
|
break;
|
|
|
|
|
case BACK:
|
|
|
|
|
BrowserHistory.GoBack();
|
|
|
|
|
return;
|
|
|
|
|
case FORWARD:
|
2012-02-24 22:27:05 +01:00
|
|
|
|
RunProgram("@notify", "Forward button is not realized yet");
|
2011-09-26 16:09:58 +02:00
|
|
|
|
return;
|
|
|
|
|
case 054: //F5
|
|
|
|
|
IF(edit1.flags == 66) break;
|
|
|
|
|
case REFRESH:
|
2012-02-27 14:48:04 +01:00
|
|
|
|
if (GetProcessSlot(downloader_id)<>0)
|
|
|
|
|
{
|
|
|
|
|
KillProcess(downloader_id);
|
|
|
|
|
Pause(20);
|
|
|
|
|
Draw_Window();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2011-09-26 16:09:58 +02:00
|
|
|
|
copystr(#URL, #editURL);
|
2012-02-27 14:48:04 +01:00
|
|
|
|
if (!strcmp(get_URL_part(5),"http:"))) HttpLoad();
|
|
|
|
|
ShowPage(#URL);
|
2011-09-26 16:09:58 +02:00
|
|
|
|
return;
|
|
|
|
|
case 014: //Ctrl+N <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
case 020: //Ctrl+T <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
case NEWTAB:
|
|
|
|
|
MoveSize(190,80,OLD,OLD);
|
|
|
|
|
RunProgram(#program_path, #URL);
|
|
|
|
|
return;
|
2011-09-30 11:19:41 +02:00
|
|
|
|
case 052: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> F3
|
|
|
|
|
IF(edit1.flags <> 66)
|
|
|
|
|
IF (strcmp(get_URL_part(5),"http:")<>0) RunProgram("tinypad", #URL); ELSE RunProgram("tinypad", #download_path);
|
|
|
|
|
return;
|
|
|
|
|
|
2012-02-24 22:27:05 +01:00
|
|
|
|
case HOME:
|
|
|
|
|
copystr("http://bash.org.ru", #editURL);
|
2011-09-26 16:09:58 +02:00
|
|
|
|
case GOTOURL:
|
|
|
|
|
case 0x0D: //enter
|
|
|
|
|
copystr(#editURL, #URL);
|
2012-02-21 23:22:44 +01:00
|
|
|
|
if (!strcmp(get_URL_part(5),"http:"))) HttpLoad();
|
2012-02-29 00:38:54 +01:00
|
|
|
|
za_kadrom = count = 0;
|
2012-02-24 22:27:05 +01:00
|
|
|
|
ShowPage(#URL);
|
2011-09-26 16:09:58 +02:00
|
|
|
|
return;
|
|
|
|
|
case 173: //ctrl+enter
|
|
|
|
|
case SEARCHWEB:
|
|
|
|
|
copystr(#search_path, #URL);
|
|
|
|
|
copystr(#editURL, #URL + strlen(#URL));
|
2012-02-24 22:27:05 +01:00
|
|
|
|
if (!strcmp(get_URL_part(5),"http:"))) HttpLoad();
|
2012-02-29 00:38:54 +01:00
|
|
|
|
za_kadrom = count = 0;
|
2012-02-24 22:27:05 +01:00
|
|
|
|
ShowPage(#URL);
|
2011-09-26 16:09:58 +02:00
|
|
|
|
return;
|
2011-09-30 11:19:41 +02:00
|
|
|
|
|
2011-09-26 16:09:58 +02:00
|
|
|
|
case ID1: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
2011-09-30 11:19:41 +02:00
|
|
|
|
IF(za_kadrom <= 0) return;
|
|
|
|
|
za_kadrom--;
|
2011-09-26 16:09:58 +02:00
|
|
|
|
break;
|
|
|
|
|
case ID2: //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
IF(max_kolvo_strok + za_kadrom >= count) return;
|
|
|
|
|
za_kadrom++;
|
|
|
|
|
break;
|
|
|
|
|
case 183: //PgDown
|
|
|
|
|
IF(za_kadrom == count - max_kolvo_strok) return;
|
2011-09-30 11:19:41 +02:00
|
|
|
|
za_kadrom += max_kolvo_strok + 2;
|
2011-09-26 16:09:58 +02:00
|
|
|
|
IF(max_kolvo_strok + za_kadrom > count) za_kadrom = count - max_kolvo_strok;
|
|
|
|
|
BREAK;
|
|
|
|
|
case 184: //PgUp
|
|
|
|
|
IF(za_kadrom == 0) RETURN;
|
2011-09-30 11:19:41 +02:00
|
|
|
|
za_kadrom -= max_kolvo_strok - 2;
|
2011-09-26 16:09:58 +02:00
|
|
|
|
IF(za_kadrom < 0) za_kadrom = 0;
|
|
|
|
|
BREAK;
|
|
|
|
|
case 180: //home
|
2011-09-30 11:19:41 +02:00
|
|
|
|
IF(za_kadrom == 0) RETURN;
|
|
|
|
|
za_kadrom = 0;
|
2011-09-26 16:09:58 +02:00
|
|
|
|
BREAK;
|
|
|
|
|
case 181: //end
|
2011-09-30 11:19:41 +02:00
|
|
|
|
IF (za_kadrom == count - max_kolvo_strok) RETURN;
|
2011-09-26 16:09:58 +02:00
|
|
|
|
za_kadrom = count - max_kolvo_strok;
|
|
|
|
|
BREAK;
|
|
|
|
|
default:
|
|
|
|
|
RETURN;
|
2011-06-25 03:52:11 +02:00
|
|
|
|
}
|
|
|
|
|
ParseHTML(buf, filesize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GetNewUrl(){
|
2012-03-04 00:29:02 +01:00
|
|
|
|
IF (!strcmp(get_URL_part(2),"./")) copystr(#URL+2,#URL);
|
|
|
|
|
|
|
|
|
|
if (URL[0] <> '/')
|
2011-06-25 03:52:11 +02:00
|
|
|
|
&& (strcmp(get_URL_part(5),"http:")<>0) && (strcmp(get_URL_part(5),"mailt")<>0) && (strcmp(get_URL_part(5),"ftp:/")<>0)
|
|
|
|
|
{
|
|
|
|
|
copystr(BrowserHistory.CurrentUrl(), #editURL); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
2012-03-04 00:29:02 +01:00
|
|
|
|
_CUT_ST_LEVEL_MARK:
|
|
|
|
|
|
|
|
|
|
IF (editURL[find_symbol(#editURL, '/')-2]<>'/') // <20><><EFBFBD><EFBFBD> <20><> http://pagename.ua <-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>???
|
2011-06-25 03:52:11 +02:00
|
|
|
|
{
|
|
|
|
|
editURL[find_symbol(#editURL, '/')] = 0x00; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /
|
|
|
|
|
}
|
2012-03-04 00:29:02 +01:00
|
|
|
|
|
|
|
|
|
IF (!strcmp(get_URL_part(3),"../")) //<2F><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
copystr(#URL+3,#URL);
|
|
|
|
|
editURL[find_symbol(#editURL, '/')-1] = 0x00; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /
|
|
|
|
|
goto _CUT_ST_LEVEL_MARK;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-25 03:52:11 +02:00
|
|
|
|
copystr(#URL, #editURL + strlen(#editURL)); //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
copystr(#editURL, #URL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-27 14:48:04 +01:00
|
|
|
|
|
2011-09-26 16:09:58 +02:00
|
|
|
|
void HttpLoad()
|
2012-02-29 00:38:54 +01:00
|
|
|
|
{
|
|
|
|
|
//count = 0; <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-29 13:29:47 +01:00
|
|
|
|
copystr(#version, #header);
|
2012-02-27 14:48:04 +01:00
|
|
|
|
KillProcess(downloader_id); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2011-09-26 16:09:58 +02:00
|
|
|
|
DeleteFile(#download_path);
|
|
|
|
|
IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]='';
|
|
|
|
|
downloader_id = RunProgram("/sys/network/downloader", #URL);
|
|
|
|
|
IF (downloader_id<0) RunProgram("@notify", "Error running Downloader. Internet unavilable.");
|
2012-02-27 14:48:04 +01:00
|
|
|
|
Draw_Window();
|
2011-09-26 16:09:58 +02:00
|
|
|
|
}
|
2011-06-25 03:52:11 +02:00
|
|
|
|
|
2011-09-26 16:09:58 +02:00
|
|
|
|
|
2011-09-30 11:19:41 +02:00
|
|
|
|
void ReadHtml()
|
2011-09-26 16:09:58 +02:00
|
|
|
|
{
|
|
|
|
|
if (!strcmp(get_URL_part(5),"http:")))
|
|
|
|
|
file_size stdcall (#download_path);
|
|
|
|
|
else
|
|
|
|
|
file_size stdcall (#URL);
|
2011-09-04 18:37:00 +02:00
|
|
|
|
|
2011-09-13 21:40:37 +02:00
|
|
|
|
filesize = EBX;
|
2012-02-27 14:48:04 +01:00
|
|
|
|
if (!filesize) /*{Pause(200); ReadHtml();}*/ return;
|
2011-09-04 18:37:00 +02:00
|
|
|
|
mem_Free(buf);
|
2011-09-13 21:40:37 +02:00
|
|
|
|
buf = mem_Alloc(filesize);
|
2012-02-21 23:22:44 +01:00
|
|
|
|
if (!strcmp(get_URL_part(5),"http:")))
|
|
|
|
|
ReadFile(0, filesize, buf, #download_path);
|
|
|
|
|
else
|
|
|
|
|
ReadFile(0, filesize, buf, #URL);
|
2011-09-13 21:40:37 +02:00
|
|
|
|
}
|
2011-09-04 18:37:00 +02:00
|
|
|
|
|
2011-06-25 03:52:11 +02:00
|
|
|
|
|
|
|
|
|
|
2012-02-24 22:27:05 +01:00
|
|
|
|
void TWebBrowser::ShowPage(dword adress) {
|
2011-06-25 03:52:11 +02:00
|
|
|
|
max_kolvo_stolbcov = width - 30 / 6;
|
|
|
|
|
max_kolvo_strok = height - 3 / 10 - 2;
|
|
|
|
|
edit1.size = edit1.pos = strlen(#editURL);
|
|
|
|
|
edit_box_draw stdcall(#edit1); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2012-02-27 14:48:04 +01:00
|
|
|
|
|
2012-02-29 11:36:36 +01:00
|
|
|
|
BrowserHistory.AddUrl();
|
|
|
|
|
|
2011-09-30 11:19:41 +02:00
|
|
|
|
//LETS_LOAD
|
|
|
|
|
ReadHtml();
|
2012-02-27 14:48:04 +01:00
|
|
|
|
|
|
|
|
|
if (!filesize)
|
|
|
|
|
{
|
|
|
|
|
DrawBar(left, top, width+2, height, 0xFFFFFF); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (GetProcessSlot(downloader_id)<>0) WriteText(left + 10, top + 18, 0x80, 0, "Loading...", 0);
|
|
|
|
|
else
|
2011-06-25 03:52:11 +02:00
|
|
|
|
{
|
|
|
|
|
WriteText(left + 10, top + 18, 0x80, 0, "Page not found. May be, URL contains some errors.", 0);
|
2012-02-27 14:48:04 +01:00
|
|
|
|
if (!strcmp(get_URL_part(5),"http:"))) WriteText(left + 10, top + 32, 0x80, 0, "Or Internet unavilable for your configuration.", 0);
|
|
|
|
|
}
|
|
|
|
|
DrawTitle(#version); //?
|
|
|
|
|
return;
|
2011-06-25 03:52:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2012-02-27 14:48:04 +01:00
|
|
|
|
wintodos(buf);
|
|
|
|
|
ParseHTML(buf, filesize);
|
2011-06-25 15:51:05 +02:00
|
|
|
|
IF (!strcmp(#version, #header)) DrawTitle(#header);
|
2011-06-25 03:52:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TWebBrowser::ParseHTML(dword bword, fsize){
|
|
|
|
|
word bukva[1];
|
2011-09-26 13:41:07 +02:00
|
|
|
|
byte ignor_param = 0;
|
2011-06-25 03:52:11 +02:00
|
|
|
|
char temp[768];
|
|
|
|
|
stroka = -za_kadrom;
|
|
|
|
|
stolbec = 0;
|
|
|
|
|
FOR(j = 400; j < blink + 1; j++;) DeleteButton(j);
|
2012-02-29 13:29:47 +01:00
|
|
|
|
b_text = i_text = u_text = s_text = pre_text = blq_text = body_present =
|
2011-06-25 03:52:11 +02:00
|
|
|
|
li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
link_color = 0x0000FF;
|
2012-02-29 13:29:47 +01:00
|
|
|
|
bg_color = 0xFFFFFF;
|
2011-06-25 03:52:11 +02:00
|
|
|
|
blink = 400;
|
|
|
|
|
line = '';
|
|
|
|
|
copystr("|", #page_links);
|
2012-02-29 00:38:54 +01:00
|
|
|
|
copystr(#version, #header);
|
2012-02-29 13:29:47 +01:00
|
|
|
|
IF(!strcmp(#URL + strlen(#URL) - 4, ".txt"))
|
|
|
|
|
{
|
|
|
|
|
DrawBar(left, top, width-15, 15, bg_color); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
pre_text = 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
2011-06-25 03:52:11 +02:00
|
|
|
|
IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
|
|
|
|
|
for (; buf + fsize > bword; bword++;) {
|
|
|
|
|
bukva = ESBYTE[bword];
|
|
|
|
|
switch (bukva) {
|
|
|
|
|
case 0x0a:
|
|
|
|
|
IF(pre_text == 1) {
|
|
|
|
|
bukva = '';
|
|
|
|
|
temp = '';
|
|
|
|
|
goto NEXT_MARK;
|
|
|
|
|
}
|
2011-06-25 14:58:55 +02:00
|
|
|
|
CASE '\9':
|
2011-08-20 17:36:15 +02:00
|
|
|
|
if (pre_text == 1) //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> 0x0d
|
|
|
|
|
{
|
|
|
|
|
tab_len=strlen(#line)/8;
|
|
|
|
|
tab_len=tab_len*8;
|
|
|
|
|
tab_len=8+tab_len-strlen(#line);
|
|
|
|
|
for (i=0; i<tab_len; i++;) copystr(" ", #line + strlen(#line));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 0x0d:
|
2011-06-25 03:52:11 +02:00
|
|
|
|
bukva = ' ';
|
|
|
|
|
goto DEFAULT_MARK;
|
2011-08-20 17:36:15 +02:00
|
|
|
|
case '<':
|
2011-06-25 03:52:11 +02:00
|
|
|
|
bword++; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <
|
|
|
|
|
IF(ESBYTE[bword] == '!') //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <!-- -->, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
bword++;
|
|
|
|
|
IF(ESBYTE[bword] == '-') {
|
|
|
|
|
HH_: do {
|
|
|
|
|
bword++;
|
|
|
|
|
IF(bword >= buf + fsize) break 1;
|
|
|
|
|
} while (ESBYTE[bword] <>'-');
|
|
|
|
|
bword++;
|
|
|
|
|
IF(ESBYTE[bword] <>'-') GOTO HH_;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-06-25 14:58:55 +02:00
|
|
|
|
WHILE (ESBYTE[bword] <>'>') && (bword < buf + fsize) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2011-06-25 03:52:11 +02:00
|
|
|
|
{
|
|
|
|
|
bukva = ESBYTE[bword];
|
|
|
|
|
IF(bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
|
|
|
|
|
IF(!ignor_param) && (bukva <>' ') copystr(#bukva, #tag + strlen(#tag));
|
|
|
|
|
ELSE {
|
|
|
|
|
ignor_param = true;
|
|
|
|
|
copystr(#bukva, #tagparam + strlen(#tagparam));
|
|
|
|
|
}
|
|
|
|
|
bword++;
|
|
|
|
|
}
|
|
|
|
|
lowcase(#tag);
|
|
|
|
|
lowcase(#tagparam);
|
2012-02-29 00:38:54 +01:00
|
|
|
|
|
2011-06-25 03:52:11 +02:00
|
|
|
|
IF (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=''; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> XHTML-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> br/
|
|
|
|
|
IF(strlen(#tagparam) > 0) && (strlen(#tagparam) < 4000) GetNextParam();
|
|
|
|
|
WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
line = tag = parametr = tagparam = ignor_param = 0; //<2F><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
case '=': //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><>7
|
|
|
|
|
IF(strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK;
|
|
|
|
|
|
|
|
|
|
bword++;
|
|
|
|
|
bukva=ESBYTE[bword];
|
|
|
|
|
copystr(#bukva, #temp);
|
|
|
|
|
|
|
|
|
|
bword++;
|
|
|
|
|
bukva=ESBYTE[bword];
|
|
|
|
|
copystr(#bukva, #temp + strlen(#temp));
|
|
|
|
|
|
|
|
|
|
bukva=Hex2Symb(#temp);
|
|
|
|
|
IF (bukva) goto DEFAULT_MARK;
|
2011-09-22 13:18:01 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '&': //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
2011-06-25 03:52:11 +02:00
|
|
|
|
IF(ignor_text) break;
|
|
|
|
|
bword++;
|
2011-09-22 13:18:01 +02:00
|
|
|
|
tag='';
|
|
|
|
|
FOR (j=0; (ESBYTE[bword] <>';') && (j < 7); j++; bword++;)
|
|
|
|
|
{
|
2011-06-25 03:52:11 +02:00
|
|
|
|
bukva = ESBYTE[bword];
|
|
|
|
|
copystr(#bukva, #tag + strlen(#tag));
|
|
|
|
|
}
|
2011-09-22 13:18:01 +02:00
|
|
|
|
|
|
|
|
|
FOR (j=0; unicode_tags[j]!=0; j+=2;)
|
|
|
|
|
{
|
|
|
|
|
IF(!strcmp(#tag, unicode_tags[j]))
|
|
|
|
|
{
|
|
|
|
|
copystr(unicode_tags[j+1], #line + strlen(#line));
|
|
|
|
|
break 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-25 03:52:11 +02:00
|
|
|
|
rez = StrToInt(#tag + 1) - 1040;
|
2011-09-26 16:09:58 +02:00
|
|
|
|
IF(tag[1] == '1') && (rez>=0) && (rez<=72) && (strlen(#tag) == 5)
|
2011-09-22 13:18:01 +02:00
|
|
|
|
{
|
2011-09-26 16:09:58 +02:00
|
|
|
|
bukva = unicode_chars[rez];
|
|
|
|
|
GOTO DEFAULT_MARK; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
2011-09-22 13:18:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
2011-09-26 16:09:58 +02:00
|
|
|
|
WriteDebug(#tag); //<2F><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2011-09-22 13:18:01 +02:00
|
|
|
|
copystr(#tag, #line + strlen(#line)); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
2011-06-25 03:52:11 +02:00
|
|
|
|
default:
|
|
|
|
|
DEFAULT_MARK:
|
|
|
|
|
IF(ignor_text) break;
|
|
|
|
|
IF(pre_text == 0) && (bukva == ' ') && (strcmp(#line + strlen(#line) - 1, " ") == 0) continue;
|
|
|
|
|
//
|
2011-09-26 16:09:58 +02:00
|
|
|
|
if (stolbec + strlen(#line) > max_kolvo_stolbcov)
|
2011-09-22 13:18:01 +02:00
|
|
|
|
{
|
2011-06-25 03:52:11 +02:00
|
|
|
|
copystr(#line + find_symbol(#line, ' '), #temp); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
line[find_symbol(#line, ' ')] = 0x00;
|
|
|
|
|
NEXT_MARK: IF(stroka - 1 > max_kolvo_strok) && (za_kadrom <>0) break 1; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...
|
|
|
|
|
WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2011-09-22 13:18:01 +02:00
|
|
|
|
TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2011-06-25 03:52:11 +02:00
|
|
|
|
copystr(#temp, #line);
|
|
|
|
|
}
|
2011-06-25 14:58:55 +02:00
|
|
|
|
IF(pre_text == 0) && (bukva == ' ') && (stolbec == 0) && (strlen(#line) == 0) CONTINUE;
|
2011-06-25 03:52:11 +02:00
|
|
|
|
copystr(#bukva, #line + strlen(#line));
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-02-29 13:29:47 +01:00
|
|
|
|
if (strcmp(#URL + strlen(#URL) - 4, ".txt")<>0) && (body_present==0)
|
|
|
|
|
DrawBar(left, top, width-15, 15, bg_color); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
if (max_kolvo_strok * 10 + 25 <= height)
|
|
|
|
|
DrawBar(left, max_kolvo_strok * 10 + top + 25, width - 15, -max_kolvo_strok * 10 + height - 25, bg_color);
|
|
|
|
|
if (stroka * 10 + 15 <= height)
|
|
|
|
|
DrawBar(left, stroka * 10 + top + 15, width - 15, -stroka * 10 + height - 15, bg_color); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (za_kadrom == 0) count = stroka;
|
2011-06-25 03:52:11 +02:00
|
|
|
|
DrawScroller(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-09-13 20:45:17 +02:00
|
|
|
|
void GetNextParam()
|
|
|
|
|
{
|
|
|
|
|
byte kavichki = false;
|
|
|
|
|
int i = strlen(#tagparam) - 1;
|
|
|
|
|
|
|
|
|
|
WHILE((i > 0) && ((tagparam[i] == '"') || (tagparam[i] == ' ') || (tagparam[i] == '\'') || (tagparam[i] == '/')))
|
2011-06-25 03:52:11 +02:00
|
|
|
|
{
|
2011-09-13 20:45:17 +02:00
|
|
|
|
IF (tagparam[i] == '"') || (tagparam[i] == '\'') kavichki=tagparam[i];
|
2011-06-25 03:52:11 +02:00
|
|
|
|
tagparam[i] = 0x00;
|
|
|
|
|
i--;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-13 20:45:17 +02:00
|
|
|
|
IF (kavichki)
|
2011-06-25 03:52:11 +02:00
|
|
|
|
{
|
2011-09-13 20:45:17 +02:00
|
|
|
|
i=find_symbol(#tagparam, kavichki);
|
2011-06-25 03:52:11 +02:00
|
|
|
|
copystr(#tagparam + i, #options);
|
|
|
|
|
}
|
2011-06-25 14:58:55 +02:00
|
|
|
|
ELSE
|
2011-06-25 03:52:11 +02:00
|
|
|
|
{
|
2011-09-13 20:45:17 +02:00
|
|
|
|
WHILE((i > 0) && (tagparam[i] <>'=')) i--; //i=find_symbol(#tagparam, '=')+1;
|
|
|
|
|
i++;
|
|
|
|
|
|
2011-06-25 03:52:11 +02:00
|
|
|
|
copystr(#tagparam + i, #options); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
WHILE (options[0] == ' ') copystr(#options + 1, #options);
|
|
|
|
|
}
|
|
|
|
|
tagparam[i] = 0x00;
|
|
|
|
|
|
2011-09-13 20:45:17 +02:00
|
|
|
|
FOR ( ; ((tagparam[i] <>' ') && (i > 0); i--)
|
|
|
|
|
{
|
|
|
|
|
IF (tagparam[i] == '=') //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2011-06-25 03:52:11 +02:00
|
|
|
|
{
|
|
|
|
|
//copystr(#tagparam+i+2,#options);
|
|
|
|
|
tagparam[i + 1] = 0x00;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-09-13 20:45:17 +02:00
|
|
|
|
|
2011-06-25 03:52:11 +02:00
|
|
|
|
copystr(#tagparam + i + 1, #parametr); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
tagparam[i] = 0x00;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char oldtag[100];
|
2011-08-20 17:36:15 +02:00
|
|
|
|
void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
|
2011-06-25 03:52:11 +02:00
|
|
|
|
dword hr_color;
|
|
|
|
|
|
|
|
|
|
dword image=0;
|
2011-09-13 20:45:17 +02:00
|
|
|
|
char temp[4096];
|
|
|
|
|
int w, h, img_za_kadrom=0;
|
2011-06-25 03:52:11 +02:00
|
|
|
|
|
2011-09-26 13:41:07 +02:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
IF(tag[0] == '/')
|
|
|
|
|
{
|
2011-06-25 03:52:11 +02:00
|
|
|
|
rez = 0;
|
|
|
|
|
copystr(#tag + 1, #tag);
|
2011-09-26 13:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
ELSE
|
|
|
|
|
rez = 1;
|
|
|
|
|
|
2011-06-25 03:52:11 +02:00
|
|
|
|
//
|
|
|
|
|
IF(!chTag("html")) {
|
|
|
|
|
IF(!strcmp(#URL + strlen(#URL) - 4, ".mht")) IF (rez==0) ignor_text = 1; ELSE ignor_text = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
IF(!chTag("script")) || (!chTag("style")) ignor_text = rez;
|
|
|
|
|
|
2012-02-29 00:38:54 +01:00
|
|
|
|
if(!chTag("title")) && (!rez)
|
2011-09-26 13:41:07 +02:00
|
|
|
|
{
|
2011-06-25 03:52:11 +02:00
|
|
|
|
copystr(#line, #header);
|
2011-06-25 16:03:04 +02:00
|
|
|
|
copystr(" -", #header + strlen(#header));
|
|
|
|
|
copystr(#version, #header + strlen(#header));
|
2012-02-29 00:38:54 +01:00
|
|
|
|
if (stroka==0) DrawTitle(#header);
|
2011-06-25 03:52:11 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
2011-09-26 13:41:07 +02:00
|
|
|
|
|
2012-02-29 00:38:54 +01:00
|
|
|
|
IF (ignor_text == 1) return;
|
|
|
|
|
//
|
|
|
|
|
|
2011-06-25 03:52:11 +02:00
|
|
|
|
//
|
|
|
|
|
IF(!chTag("q")) copystr("\"", #line + strlen(#line));
|
2011-09-26 13:41:07 +02:00
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (stroka >= 0) && (stroka - 2 < max_kolvo_strok) && (line)
|
|
|
|
|
{
|
2011-06-25 03:52:11 +02:00
|
|
|
|
WriteText(stolbec * 6 + left1, top1, 0x80, text_colors[text_color_index], #line, 0);
|
2011-09-26 13:41:07 +02:00
|
|
|
|
IF (b_text) WriteText(stolbec * 6 + left1 + 1, top1, 0x80, text_colors[text_color_index], #line, 0);
|
|
|
|
|
IF (i_text) Skew(stolbec * 6 + left1, top1, strlen(#line)+1*6, 10); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
IF (s_text) DrawBar(stolbec * 6 + left1, top1 + 4, strlen(#line) * 6, 1, text_colors[text_color_index]); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
IF (u_text) DrawBar(stolbec * 6 + left1, top1 + 8, strlen(#line) * 6, 1, text_colors[text_color_index]); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
IF (link) {
|
2011-06-25 03:52:11 +02:00
|
|
|
|
DefineButton(stolbec * 6 + left1 - 2, top1, strlen(#line) * 6 + 3, 9, blink + BT_HIDE, 0xB5BFC9); //
|
|
|
|
|
DrawBar(stolbec * 6 + left1, top1 + 8, strlen(#line) * 6, 1, text_colors[text_color_index]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
IF(!tag) return;
|
|
|
|
|
stolbec += strlen(#line);
|
2012-02-29 13:29:47 +01:00
|
|
|
|
|
2011-09-26 13:41:07 +02:00
|
|
|
|
if (!chTag("body"))
|
|
|
|
|
{
|
|
|
|
|
BODY_MARK:
|
|
|
|
|
|
|
|
|
|
if (strcmp(#parametr, "link=") == 0)
|
|
|
|
|
link_color = GetColor(#options);
|
|
|
|
|
|
2012-02-29 13:29:47 +01:00
|
|
|
|
if (strcmp(#parametr, "text=") == 0)
|
2011-09-26 13:41:07 +02:00
|
|
|
|
{
|
|
|
|
|
text_colors[0]=GetColor(#options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strcmp(#parametr, "bgcolor=") == 0)
|
|
|
|
|
{
|
2012-02-29 13:29:47 +01:00
|
|
|
|
bg_color=GetColor(#options);
|
|
|
|
|
}
|
2011-09-26 13:41:07 +02:00
|
|
|
|
|
|
|
|
|
IF(tagparam) {
|
|
|
|
|
GetNextParam();
|
|
|
|
|
GOTO BODY_MARK;
|
2012-02-29 13:29:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body_present = 1; //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
if (rez) DrawBar(WB1.left, WB1.top, WB1.width-15, 15, bg_color); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
return;
|
2011-09-26 13:41:07 +02:00
|
|
|
|
}
|
2011-06-25 03:52:11 +02:00
|
|
|
|
//////////////////////////
|
|
|
|
|
if (!chTag("a")) {
|
|
|
|
|
IF (stroka - 1 > max_kolvo_strok) || (stroka < -2) return;
|
|
|
|
|
if (rez) {
|
|
|
|
|
HREF: IF(strcmp(#parametr, "href=") == 0) {
|
|
|
|
|
IF(link == 1) text_color_index--; //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
|
|
|
|
|
link = 1;
|
|
|
|
|
blink++;
|
|
|
|
|
text_color_index++;
|
|
|
|
|
text_colors[text_color_index] = link_color;
|
|
|
|
|
copystr(#options, #page_links + strlen(#page_links));
|
|
|
|
|
copystr("|", #page_links + strlen(#page_links));
|
|
|
|
|
}
|
|
|
|
|
IF(tagparam) {
|
|
|
|
|
GetNextParam();
|
|
|
|
|
GOTO HREF;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ELSE {
|
|
|
|
|
link = 0;
|
|
|
|
|
IF(text_color_index > 0) text_color_index--;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/////////////////////////
|
2011-09-04 18:13:26 +02:00
|
|
|
|
if (!chTag("font"))
|
|
|
|
|
{
|
|
|
|
|
IF(stroka < 0) || (stroka - 1 > max_kolvo_strok) return;
|
|
|
|
|
COL_MARK:
|
|
|
|
|
if (strcmp(#parametr, "color=") == 0) //&& (parametr[1] == '#')
|
2011-06-25 03:52:11 +02:00
|
|
|
|
{
|
2011-09-04 18:13:26 +02:00
|
|
|
|
text_color_index++;
|
2011-09-26 13:41:07 +02:00
|
|
|
|
text_colors[text_color_index] = GetColor(#options);
|
2011-06-25 03:52:11 +02:00
|
|
|
|
}
|
2011-09-26 13:41:07 +02:00
|
|
|
|
IF(tagparam) {
|
2011-06-25 03:52:11 +02:00
|
|
|
|
GetNextParam();
|
|
|
|
|
GOTO COL_MARK;
|
|
|
|
|
}
|
|
|
|
|
IF(!rez) && (text_color_index > 0) text_color_index--;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//////////////////////////
|
|
|
|
|
IF(!chTag("tr")) || (!chTag("br")) {
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
IF(!chTag("div")) {
|
|
|
|
|
IF(oldtag[0] <>'h') TextGoDown(left1, top1, width1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
IF(!chTag("p")) {
|
|
|
|
|
IF(oldtag[0] == 'h') return;
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
IF(rez) TextGoDown(left1, top1 + 10, width1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
////////////////////////////
|
|
|
|
|
IF(!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) {
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
IF(rez) TextGoDown(left1, top1 + 10, width1);
|
|
|
|
|
b_text = rez;
|
|
|
|
|
copystr(#tag, #oldtag);
|
|
|
|
|
return;
|
|
|
|
|
} ELSE copystr("", #oldtag);
|
|
|
|
|
IF(!chTag("b")) || (!chTag("strong")) || (!chTag("big")) {
|
|
|
|
|
b_text = rez;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
////////////////////////////
|
|
|
|
|
IF(!chTag("i")) || (!chTag("em")) {
|
|
|
|
|
i_text = rez;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
////////////////////////////
|
|
|
|
|
if(!chTag("li")) || (!chTag("dt")) //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
li_text = rez;
|
|
|
|
|
IF(rez == 0) return;
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
IF(stroka > -1) && (stroka - 2 < max_kolvo_strok) IF(!chTag("li")) DrawBar(li_tab * 5 * 6 + left1 - 5, top1 + 12, 2, 2, 0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
////////////////////////////
|
|
|
|
|
IF(!chTag("u")) || (!chTag("ins")) u_text = rez;
|
|
|
|
|
IF(!chTag("s")) || (!chTag("strike")) || (!chTag("del")) s_text = rez;
|
|
|
|
|
IF(!chTag("ul")) || (!chTag("ol")) IF(!rez) {
|
|
|
|
|
li_text = rez;
|
|
|
|
|
li_tab--;
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
} ELSE li_tab++;
|
|
|
|
|
IF(!chTag("dd")) stolbec += 5;
|
|
|
|
|
IF(!chTag("blockquote")) blq_text = rez;
|
|
|
|
|
IF(!chTag("pre")) pre_text = rez;
|
|
|
|
|
IF(!chTag("hr")) {
|
|
|
|
|
TextGoDown(left1, top1, width1);
|
|
|
|
|
TextGoDown(left1, top1 + 10, width1);
|
2011-09-26 13:41:07 +02:00
|
|
|
|
IF(strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options);
|
2011-06-25 03:52:11 +02:00
|
|
|
|
ELSE hr_color = 0x999999;
|
|
|
|
|
IF(stroka > 0) DrawBar(left1, top1 + 14, width1 - 8, 1, hr_color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!chTag("img"))
|
|
|
|
|
{
|
|
|
|
|
//IF (GetFileInfo(#libimg)<>0) return; //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
|
|
|
|
|
IMG_TAG:
|
2011-06-25 14:58:55 +02:00
|
|
|
|
IF (strcmp(#parametr,"src=")==0) //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> GetNewUrl()
|
2011-06-25 03:52:11 +02:00
|
|
|
|
{
|
|
|
|
|
copystr(BrowserHistory.CurrentUrl(), #temp); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
temp[find_symbol(#temp, '/')] = 0x00; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> /
|
|
|
|
|
copystr(#options,#temp+strlen(#temp));
|
|
|
|
|
image=load_image(#temp);
|
|
|
|
|
|
|
|
|
|
w=DSWORD[image+4];
|
|
|
|
|
h=DSWORD[image+8];
|
|
|
|
|
}
|
|
|
|
|
IF(tagparam) {
|
|
|
|
|
GetNextParam();
|
|
|
|
|
GOTO IMG_TAG;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-05 11:18:16 +02:00
|
|
|
|
if (w>width1) w=width1;
|
|
|
|
|
|
2011-06-25 03:52:11 +02:00
|
|
|
|
if (image)
|
|
|
|
|
{
|
2011-08-20 17:36:15 +02:00
|
|
|
|
stroka+=h/10;
|
|
|
|
|
|
|
|
|
|
if (top1+h<WB1.top) || (top1>WB1.top+WB1.height-10) //<2F><><EFBFBD><EFBFBD> <20>Ѩ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
return;
|
2011-09-13 20:45:17 +02:00
|
|
|
|
|
2011-08-20 17:36:15 +02:00
|
|
|
|
if (top1<WB1.top) //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
2011-09-13 20:45:17 +02:00
|
|
|
|
img_za_kadrom=WB1.top-top1;
|
|
|
|
|
h=h-img_za_kadrom;
|
2011-08-20 17:36:15 +02:00
|
|
|
|
top1=WB1.top-5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (top1>WB1.top+WB1.height-h-10) //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> IF (stroka - 2 < max_kolvo_strok)
|
|
|
|
|
{
|
|
|
|
|
h=WB1.top+WB1.height-top1-10;
|
2011-09-05 11:18:16 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IF (h<=0) return;
|
2011-08-20 17:36:15 +02:00
|
|
|
|
|
2011-09-13 20:45:17 +02:00
|
|
|
|
img_draw stdcall (image,left1-5,top1+10,w, h,0,img_za_kadrom);
|
2012-02-29 13:29:47 +01:00
|
|
|
|
DrawBar(left1+w - 5, top1 + 10, width1-w + 5, h, bg_color);
|
2011-06-25 03:52:11 +02:00
|
|
|
|
}
|
2012-02-27 14:48:04 +01:00
|
|
|
|
/*else
|
|
|
|
|
{
|
|
|
|
|
IF (strcmp(#parametr,"alt=")==0) copystr(#options,#line+strlen(#line));
|
|
|
|
|
}*/
|
2011-09-05 11:18:16 +02:00
|
|
|
|
return;
|
2011-06-25 03:52:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2011-09-05 11:18:16 +02:00
|
|
|
|
if (!chTag("meta"))
|
|
|
|
|
{
|
2011-06-25 03:52:11 +02:00
|
|
|
|
META:
|
|
|
|
|
if (!strcmp(#parametr, "charset=")) || (!strcmp(#parametr, "content="))
|
|
|
|
|
{
|
|
|
|
|
copystr(#options[find_symbol(#options, '=')],#options); //<2F><><EFBFBD><EFBFBD><EFBFBD> <20> content=
|
|
|
|
|
|
2011-09-05 11:18:16 +02:00
|
|
|
|
IF (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8"))
|
2011-06-25 03:52:11 +02:00
|
|
|
|
{
|
2011-09-30 11:19:41 +02:00
|
|
|
|
ReadHtml();
|
2011-09-05 11:18:16 +02:00
|
|
|
|
utf8rutodos(buf);
|
2011-06-25 03:52:11 +02:00
|
|
|
|
}
|
|
|
|
|
IF(!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u"))
|
|
|
|
|
{
|
2011-09-30 11:19:41 +02:00
|
|
|
|
ReadHtml();
|
2011-06-25 03:52:11 +02:00
|
|
|
|
koitodos(buf);
|
|
|
|
|
}
|
|
|
|
|
IF(!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866"))
|
|
|
|
|
{
|
2011-09-30 11:19:41 +02:00
|
|
|
|
ReadHtml();
|
2011-06-25 03:52:11 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2011-09-26 13:41:07 +02:00
|
|
|
|
IF(tagparam)
|
2011-09-05 11:18:16 +02:00
|
|
|
|
{
|
2011-06-25 03:52:11 +02:00
|
|
|
|
GetNextParam();
|
|
|
|
|
goto META;
|
|
|
|
|
}
|
2011-09-05 11:18:16 +02:00
|
|
|
|
return;
|
2011-06-25 03:52:11 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TextGoDown(int left1, top1, width1) {
|
|
|
|
|
stroka++;
|
|
|
|
|
IF(blq_text == 1) stolbec = 8;
|
|
|
|
|
ELSE stolbec = 0;
|
|
|
|
|
IF(li_text == 1) stolbec = li_tab * 5;
|
2012-02-29 13:29:47 +01:00
|
|
|
|
IF(stroka >= 0) && (stroka - 2 < max_kolvo_strok) DrawBar(left1 - 5, top1 + 10, width1 + 5, 10, bg_color);
|
2012-02-21 23:22:44 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void TWebBrowser::DrawScroller() {
|
|
|
|
|
dword on_y;
|
|
|
|
|
DrawBar(left + width - 15, top + 17, 1, height - 34, 0x94AECE); //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
DrawFlatButton(left + width - 15, top + height - 17, 16, 16, ID2, 0xE4DFE1, "\x19");
|
|
|
|
|
DrawFlatButton(left + width - 15, top, 16, 16, ID1, 0xE4DFE1, "\x18");
|
|
|
|
|
|
|
|
|
|
IF(count <= max_kolvo_strok) {
|
2012-02-29 00:38:54 +01:00
|
|
|
|
DrawBar(left + width - 14, top+17, 16, height - 34, 0xCED0D0);
|
2012-02-21 23:22:44 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scroll_size = height - 16 * max_kolvo_strok / count - 3;
|
|
|
|
|
IF(scroll_size < 10) scroll_size = 10;
|
|
|
|
|
IF(za_kadrom + max_kolvo_strok >= count) on_y = height - scroll_size + top - 17;
|
|
|
|
|
ELSE on_y = height - 32 * za_kadrom / count + top + 16;
|
|
|
|
|
DrawFlatButton(left + width - 15, on_y, 16, scroll_size, 0, 0xE4DFE1, ""); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
IF(on_y > top + 17) DrawBar(left + width - 14, top + 17, 16, on_y - top - 17, 0xCED0D0); //<2F><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
IF(height - scroll_size + top - 17 > on_y)
|
|
|
|
|
DrawBar(left + width - 14, on_y + scroll_size + 1, 16, height - scroll_size - on_y + top - 18, 0xCED0D0); //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2011-06-25 03:52:11 +02:00
|
|
|
|
}
|