forked from KolibriOS/kolibrios
Text-based Browser 23.67 aka HTML Viewer v0.67
git-svn-id: svn://kolibrios.org@2085 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
fe72383413
commit
e3f508ee0c
@ -16,7 +16,7 @@
|
||||
#include "../lib/dll.h--"
|
||||
|
||||
//ïåðåìåííûå
|
||||
byte URL[4096]="/sys/html/index.htm",
|
||||
byte URL[4096]="/sys/index.htm",
|
||||
editURL[4096],
|
||||
page_links[12000],
|
||||
header[512];
|
||||
@ -75,7 +75,9 @@ void main()
|
||||
}
|
||||
}
|
||||
//IF (kolichestvo<max_kolvo_strok) break;
|
||||
if (m.x>=WB1.width-14) && (m.x<=WB1.width+6) && (kolichestvo>max_kolvo_strok) while (m.lkm)
|
||||
if (m.x>=WB1.width-14) && (m.x<=WB1.width+6)
|
||||
&& (m.y>WB1.top+16) && (m.y<WB1.top+WB1.height-16)
|
||||
&& (kolichestvo>max_kolvo_strok) while (m.lkm)
|
||||
{
|
||||
IF (razm_scrl/2+WB1.top>m.y) || (m.y<0) || (m.y>4000) m.y=razm_scrl/2+WB1.top; //åñëè êóðñîð íàä îêíîì
|
||||
btn=za_kadrom; //ñîõðàíÿåì ñòàðîå êîëè÷åñòâî
|
||||
|
@ -1,3 +1,16 @@
|
||||
20.08.11 -- v0.67 -- 11.1 Кб
|
||||
- более адекватная прокрутка изображений;
|
||||
- корректная обработка табов в тексте и с тегом <pre> (спасибо Nazarus и Jaeger);
|
||||
- улучшена отзывчивость программы при прокрутке больших страниц (фикс изначально
|
||||
был написан Gluk'ом для игры Косилка по моей просьба, сюда перенесен мной);
|
||||
- небольшие исправления в реакции ползунка прокрутки;
|
||||
- исправлено залезание текста в наклонном шрифте на левый ободок окна;
|
||||
- кнопка "Новая вкладка" и комбинации Ctrl+N, Ctrl+T банально создают новое окно;
|
||||
- правильное распознание украинской буквы ґ;
|
||||
- поддержка кодировки "UTF8" для универсальности (идея фичи Joaquin).
|
||||
|
||||
|
||||
|
||||
20.06.11 -- v0.63 -- 11.32 Êá
|
||||
lev
|
||||
- íàêëîííûé øðèôò
|
||||
|
@ -1,14 +1,12 @@
|
||||
//http://jsbeautifier.org/
|
||||
//Web-component, Leency & Veliant 2007-2009
|
||||
//lev
|
||||
|
||||
|
||||
//èäåÿ - ëåâûå ôàéëû îòêðûâàòü ñîîòâåòñòâóþùèìè ïðîãàìè
|
||||
|
||||
// wintodos(buf); -> â ïàðñå õòìë êàê è âñå êîäèðîâêè
|
||||
|
||||
//wintodos(buf); -> â ïàðñå õòìë êàê è âñå êîäèðîâêè
|
||||
//ol - öèôåðêè
|
||||
|
||||
//óñêîðåíà çàãðóçêà ñòðàíèöû, ñîäåðæàùåé èçîáðàæåíèÿ
|
||||
//óìåíüøåíî êîëè÷åñòâî ïåðåðèñîâîê çàãîëîâêà îêíà ïðè çàãðóçêå ñòðàíèöû
|
||||
|
||||
dword j,
|
||||
buf,
|
||||
@ -19,11 +17,11 @@ dword j,
|
||||
char download_path[]="/rd/1/.download";
|
||||
//char search_path[]="http://nova.rambler.ru/search?words=";
|
||||
char search_path[]="http://nigma.ru/index.php?s=";
|
||||
char version[]=" HTML Viewer v0.63";
|
||||
char version[]=" Text-based Browser 23.67";
|
||||
|
||||
|
||||
struct TWebBrowser {
|
||||
dword left,
|
||||
int left,
|
||||
top,
|
||||
width,
|
||||
height;
|
||||
@ -64,15 +62,21 @@ void TWebBrowser::Scan(dword id) {
|
||||
case BACK:
|
||||
BrowserHistory.GoBack();
|
||||
return;
|
||||
/*case FORWARD:
|
||||
WriteDebug(#UrlHistory);
|
||||
return;*/
|
||||
case FORWARD:
|
||||
//RunProgram("@notify", "Forward button is not realized yet");
|
||||
return;
|
||||
case 054: //F5
|
||||
IF(edit1.flags == 66) break;
|
||||
case REFRESH:
|
||||
copystr(#URL, #editURL);
|
||||
Draw_Window();
|
||||
return;
|
||||
case 014: //Ctrl+N íîâîå îêíî
|
||||
case 020: //Ctrl+T íîâàÿ âêëàäêà
|
||||
case NEWTAB:
|
||||
MoveSize(190,80,OLD,OLD);
|
||||
RunProgram(#program_path, #URL);
|
||||
return;
|
||||
case HOME:
|
||||
copystr("/sys/index.htm", #editURL);
|
||||
case GOTOURL:
|
||||
@ -235,7 +239,8 @@ dword text_colors[10],
|
||||
text_color_index = 0,
|
||||
link_color;
|
||||
int stroka,
|
||||
stolbec;
|
||||
stolbec,
|
||||
tab_len;
|
||||
byte line[330],
|
||||
tag[100],
|
||||
tagparam[10000],
|
||||
@ -271,11 +276,18 @@ void TWebBrowser::ParseHTML(dword bword, fsize){
|
||||
goto NEXT_MARK;
|
||||
}
|
||||
CASE '\9':
|
||||
CASE 0x0d:
|
||||
//IF(pre_text == 1) {copystr(" ", #line + strlen(#line)); break;} ELSE
|
||||
if (pre_text == 1) //èíà÷å èä¸ì íà 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:
|
||||
bukva = ' ';
|
||||
goto DEFAULT_MARK;
|
||||
CASE '<':
|
||||
case '<':
|
||||
bword++; //ïðîìîòàåì ñèìâîë <
|
||||
IF(ESBYTE[bword] == '!') //ôèëüòðàöèÿ âíóòðè <!-- -->, äåðçêî
|
||||
{
|
||||
@ -325,37 +337,6 @@ void TWebBrowser::ParseHTML(dword bword, fsize){
|
||||
bukva=Hex2Symb(#temp);
|
||||
IF (bukva) goto DEFAULT_MARK;
|
||||
break;
|
||||
/*case '\\': //ïîääåðæêà RTF, http://dev.rembish.ru/rtf.phps
|
||||
IF(strcmp(#URL + strlen(#URL) - 4, ".rtf")<>0) goto DEFAULT_MARK;
|
||||
rtf_text='';
|
||||
|
||||
//
|
||||
bword++;
|
||||
j = 0;
|
||||
|
||||
IF (ESBYTE[bword]=='\'')
|
||||
{
|
||||
bword++;
|
||||
bukva=ESBYTE[bword];
|
||||
copystr(#bukva, #rtf_text);
|
||||
|
||||
bword++;
|
||||
bukva=ESBYTE[bword];
|
||||
copystr(#bukva, #rtf_text + strlen(#rtf_text));
|
||||
|
||||
bukva=Hex2Symb(#rtf_text);
|
||||
IF (bukva) goto DEFAULT_MARK;
|
||||
}
|
||||
|
||||
WHILE ((ESBYTE[bword] <>' ') && (j < 25) && (ESBYTE[bword] <>'\\') && (ESBYTE[bword] <>0x0d)) {
|
||||
bukva = ESBYTE[bword];
|
||||
copystr(#bukva, #rtf_text + strlen(#rtf_text));
|
||||
bword++;
|
||||
j++;
|
||||
}
|
||||
|
||||
IF (strcmp(#rtf_text,"par")==0) goto NEXT_MARK;
|
||||
break;*/
|
||||
case '&':
|
||||
IF(ignor_text) break;
|
||||
bword++;
|
||||
@ -457,7 +438,7 @@ void GetNextParam() {
|
||||
|
||||
|
||||
char oldtag[100];
|
||||
void TWebBrowser::WhatTextStyle(word left1, top1, width1) {
|
||||
void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
|
||||
dword hr_color;
|
||||
|
||||
dword image=0;
|
||||
@ -636,13 +617,28 @@ void TWebBrowser::WhatTextStyle(word left1, top1, width1) {
|
||||
|
||||
if (image)
|
||||
{
|
||||
IF (width1<w) w=width1;
|
||||
IF (WB1.height<h) h=WB1.height;
|
||||
IF (top1<WB1.top) {h=h-top1+WB1.top; top1=WB1.top;}
|
||||
TextGoDown2(left1+w,top1,width1-w,h);
|
||||
IF (stroka - 2 < max_kolvo_strok) img_draw stdcall (image,left1-5,top1+10,w,-stroka * 10 + WB1.height -15 + h,0,0);
|
||||
stroka+=h/10;
|
||||
|
||||
if (top1+h<WB1.top) || (top1>WB1.top+WB1.height-10) //åñëè ÂѨ èçîáðàæåíèå óøëî ÂÅÐÕ èëè ÂÍÈÇ
|
||||
return;
|
||||
|
||||
if (top1<WB1.top) //åñëè ÷àñòü èçîáðàæåíèÿ ñâåðõó
|
||||
{
|
||||
h=h-WB1.top+top1;
|
||||
top1=WB1.top-5;
|
||||
}
|
||||
|
||||
if (top1>WB1.top+WB1.height-h-10) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó IF (stroka - 2 < max_kolvo_strok)
|
||||
{
|
||||
//WriteDebug(IntToStr(top1));
|
||||
//WriteDebug(IntToStr(WB1.top));
|
||||
//WriteDebug(IntToStr(h));
|
||||
h=WB1.top+WB1.height-top1-10;
|
||||
}
|
||||
|
||||
img_draw stdcall (image,left1-5,top1+10,w, h,0,0);
|
||||
DrawBar(left1+w - 5, top1 + 10, width1-w + 5, h, 0xFFFFFF);
|
||||
}
|
||||
//else WriteDebug(#options);
|
||||
}
|
||||
|
||||
if (!chTag("meta")) {
|
||||
@ -651,7 +647,7 @@ void TWebBrowser::WhatTextStyle(word left1, top1, width1) {
|
||||
{
|
||||
copystr(#options[find_symbol(#options, '=')],#options); //ïîèñê â content=
|
||||
|
||||
IF (!strcmp(#options,"utf-8"))
|
||||
IF (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8"))
|
||||
{
|
||||
ReadHtml(DONT_LOAD);
|
||||
utf8rutodos(buf);
|
||||
@ -680,12 +676,4 @@ void TextGoDown(int left1, top1, width1) {
|
||||
ELSE stolbec = 0;
|
||||
IF(li_text == 1) stolbec = li_tab * 5;
|
||||
IF(stroka >= 0) && (stroka - 2 < max_kolvo_strok) DrawBar(left1 - 5, top1 + 10, width1 + 5, 10, 0xFFFFFF);
|
||||
}
|
||||
|
||||
void TextGoDown2(int left1,top1,width1,height1)//ASPER: Íàäî çàìåíèòü ýòó ôóíêöèþ áîëåå ïðàâèëüíîé.
|
||||
{
|
||||
stroka+=height1/10;
|
||||
IF (blq_text==1) stolbec=8; ELSE stolbec=0;
|
||||
IF (li_text==1) stolbec=5;
|
||||
IF (stroka>=0) && (stroka-2<max_kolvo_strok) DrawBar(left1 - 5, top1 + 10, width1 + 5, height1, 0xFFFFFF);
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
//ª®¯ª¨
|
||||
#define BACK 300
|
||||
#define FORWARD 301
|
||||
#define REFRESH 302
|
||||
#define FORWARD 301
|
||||
#define REFRESH 302
|
||||
#define HOME 303
|
||||
#define GOTOURL 305
|
||||
#define NEWTAB 304
|
||||
#define GOTOURL 305
|
||||
#define SEARCHWEB 306
|
||||
#define ID1 178
|
||||
#define ID2 177
|
||||
@ -26,6 +27,11 @@ dword get_URL_part(byte len) {
|
||||
return #temp1;
|
||||
}
|
||||
|
||||
inline fastcall CopyScreen(dword EBX, ECX, EDX)
|
||||
{
|
||||
EAX = 36;
|
||||
$int 0x40;
|
||||
}
|
||||
|
||||
inline byte chTag(dword text) {return strcmp(#tag,text);}
|
||||
|
||||
@ -43,20 +49,14 @@ int tile_height=2,//
|
||||
i, skin_width,
|
||||
shift=-2;
|
||||
|
||||
skin_width = GetSkinWidth();
|
||||
Form.GetInfo(SelfInfo);
|
||||
italic_buf = malloc(w*h*3);
|
||||
//ebx = 㪠§ â¥«ì ¯à¥¤¢ à¨â¥«ì® ¢ë¤¥«¥ãî ®¡« áâì ¯ ¬ïâ¨, ªã¤ ¡ã¤¥â ¯®¬¥é¥® ¨§®¡à ¦¥¨¥ ¢ ä®à¬ ⥠BBGGRRBBGGRR...
|
||||
EBX = italic_buf;
|
||||
//ecx = [à §¬¥à ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ y]
|
||||
ECX = w * 65536 + h;
|
||||
//edx = [ª®®à¤¨ â ¯® ®á¨ x]*65536 + [ª®®à¤¨ â ¯® ®á¨ y]
|
||||
EDX = x + Form.left * 65536 + y + Form.top + skin_width;
|
||||
EAX = 36;
|
||||
$int 0x40;
|
||||
skin_width = GetSkinWidth();
|
||||
|
||||
CopyScreen(italic_buf, w * 65536 + h, x + Form.left + 2 * 65536 + y + Form.top + skin_width);
|
||||
|
||||
|
||||
FOR (i=0;i*tile_height<h;i++){
|
||||
PutImage(w*3*tile_height*i+italic_buf,w,tile_height,x+shift-i,i*tile_height+y);
|
||||
PutImage(w*3*tile_height*i+italic_buf,w,tile_height,x+shift-i+1,i*tile_height+y);
|
||||
}
|
||||
free(italic_buf);
|
||||
}
|
||||
|
@ -10,8 +10,9 @@ dword final_addr = #stop+32;
|
||||
dword alloc_mem = #0x00100000;
|
||||
dword x86esp_reg = #0x00100000;
|
||||
dword I_Param = #param;
|
||||
dword I_Icon = 0x0;
|
||||
char param[256]="";
|
||||
dword I_Path = #program_path;
|
||||
char param[4096]="";
|
||||
char program_path[4096]="";
|
||||
|
||||
//Events
|
||||
#define evMouse 6
|
||||
@ -121,10 +122,22 @@ inline fastcall ScancodesGeting(){
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
inline fastcall word GetKey(){
|
||||
EAX = 2; // just read this key from buffer
|
||||
$int 0x40
|
||||
EAX = EAX >> 8;
|
||||
|
||||
inline fastcall word GetKey(){ //Gluk fix
|
||||
$push edx
|
||||
@getkey:
|
||||
$mov eax,2
|
||||
$int 0x40
|
||||
$cmp eax,1
|
||||
$jne getkeyi
|
||||
$mov ah,dh
|
||||
$jmp getkeyii //jz?
|
||||
@getkeyi:
|
||||
$mov dh,ah
|
||||
$jmp getkey
|
||||
@getkeyii:
|
||||
$pop edx
|
||||
EAX = EAX >> 8;
|
||||
}
|
||||
|
||||
inline fastcall word GetButtonID(){
|
||||
@ -356,13 +369,14 @@ inline fastcall wintodos (dword ESI)
|
||||
IF (BL==178) ESBYTE[ESI] = 73; //I
|
||||
IF (BL==179) ESBYTE[ESI] = 105; //i
|
||||
IF (BL==175) ESBYTE[ESI] = 244; //J
|
||||
IF (BL==191) ESBYTE[ESI] = 245; //j
|
||||
IF (BL==191) ESBYTE[ESI] = 245; //j
|
||||
IF (BL==170) ESBYTE[ESI] = 242; //E
|
||||
IF (BL==186) ESBYTE[ESI] = 243; //e
|
||||
IF (BL==168) ESBYTE[ESI] = 240; //ð
|
||||
IF (BL==184) ESBYTE[ESI] = 'e'; //e
|
||||
IF ((BL==147) || (BL==148) || (BL==171) || (BL==187)) ESBYTE[ESI] = 34;
|
||||
IF ((BL==150) || (BL==151)) ESBYTE[ESI] = 45;
|
||||
IF (BL==168) ESBYTE[ESI] = 240; //ð
|
||||
IF (BL==184) ESBYTE[ESI] = 'e'; //e
|
||||
IF (BL==180) ESBYTE[ESI] = 254; //ã
|
||||
IF ((BL==147) || (BL==148) || (BL==171) || (BL==187)) ESBYTE[ESI] = 34;
|
||||
IF ((BL==150) || (BL==151)) ESBYTE[ESI] = 45;
|
||||
}
|
||||
ESI++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user