Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3057 → Rev 3058

/programs/network/htmlv/browser/HTMLv.c
5,11 → 5,12
 
#include "..\lib\kolibri.h"
#include "..\lib\strings.h"
#include "..\lib\figures.h"
#include "..\lib\encoding.h"
#include "..\lib\file_system.h"
#include "..\lib\mem.h"
#include "..\lib\dll.h"
//áèáëèîòåêè
//áèáëèîòåêè .obj
#include "..\lib\libio_lib.h"
#include "..\lib\libimg_lib.h"
#include "..\lib\edit_box_lib.h"
47,6 → 48,7
#include "TWB.h"
#include "include\menu_rmb.h"
 
 
void tre()
{
char *font_picture;
55,22 → 57,10
int height=20;
// char palette[256*4];
int x;
debug("fuck this shit\n");
//init_font(#fontinfo);
debug("fuck this shit!\n");
strcpy(#text, "hello world\0");
text_out stdcall (#text, #fontlol, 17, 0x0, 10, 10);
strcpy(#text, "fuck this shit!\0");
text_out stdcall (#text, #fontlol, 27, 0x0, 10, 30);
strcpy(#text, "alarm!\0");
text_out stdcall (#text, #fontlol, 47, 0x00FF0000, 10, 70);
text_out stdcall ("hello world\0",#fontlol, 17, 0x0, 10, 10);
text_out stdcall ("heyeyey!\0",#fontlol, 27, 0x0, 10, 30);
text_out stdcall ("alarm!\0", #fontlol, 47, 0x00FF0000, 10, 70);
/*
strcpy(#text, "hello world\0");
233,7 → 223,7
void Draw_Window()
{
int j;
DefineAndDrawWindow(215,100,WIN_W,WIN_H,0x73,0x00E4DFE1,0);
DefineAndDrawWindow(215,100,WIN_W,WIN_H,0x73,0x00E4DFE1,0,0);
 
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) //åñëè ñâåðíóòî â çàãîëîâîê, íè÷åãî íå ðèñóåì
254,8 → 244,8
PutImage(#URLgoto,40,19,onLeft(57,0),14);
DefineButton(onLeft(37,0),15, 18, 16, GOTOURL+BT_HIDE, 0xE4DFE1);
DefineButton(onLeft(56,0),15, 17, 16, SEARCHWEB+BT_HIDE, 0xE4DFE1);
DrawRegion(205,14,onLeft(58,205),18,0x94AECE); //îáîäîê ïîëîñû àäðåñà
DrawRegion(206,15,onLeft(59,205),16,0xE4ECF3);
DrawRectangle(205,14,onLeft(58,205),18,0x94AECE); //îáîäîê ïîëîñû àäðåñà
DrawRectangle(206,15,onLeft(59,205),16,0xE4ECF3);
 
SetElementSizes();
WB1.ShowPage();
/programs/network/htmlv/browser/History.txt
1,7 → 1,13
11.11.12 - 0.97.6a
SoUrcerer - Ñèíõðîíèçàöèÿ ïðîãðàììû ñ íîâîé
îïòèìèçèðîâàííîé âåðñèåé áèáëèòåêè TryeType.
18.11.12 - 0.97.7
- åñëè èçîáðàæåíèå íå çàãðóçèëîñü, íî ñîäåðæèò ññûëêó îòîáðàæàåòñÿ
çàìåíÿþùèé åãî òåêñò;
- ÷àñòè÷íî èñïðàâëåí ïåðåíîñ ññûëêàõ â òåêñòå;
- îòîáðàæåíèå â ìåíþ òåêóùåé êîäèðîâêè;
- SoUrcerer - Ñèíõðîíèçàöèÿ ïðîãðàììû ñ íîâîé îïòèìèçèðîâàííîé
âåðñèåé áèáëèòåêè TryeType.
 
 
 
10.11.12 - 0.97.6
- íîðìàëüíûé çàïóñê ïðîãðàììû äàæå áåç áèáëèîòåêè lib_img;
- îïîâåùåíèå åñëè box_lib íå íàéäåíà;
/programs/network/htmlv/browser/TWB.h
8,7 → 8,7
 
char download_path[]="/rd/1/.download";
char search_path[]="http://nigma.ru/index.php?s=";
char version[]=" Text-based Browser 0.97.6";
char version[]=" Text-based Browser 0.97.7";
 
 
struct TWebBrowser {
27,7 → 27,7
TWebBrowser WB1;
 
byte rez, b_text, i_text, u_text, s_text, pre_text, blq_text, li_text,
link, ignor_text, li_tab, first_line_drawed;
link, ignor_text, li_tab, first_line_drawed, cur_encoding;
 
 
dword text_colors[300],
262,6 → 262,7
else
ReadFile(0, filesize, buf, #URL);
cur_encoding = encoding;
if (encoding==_WIN) wintodos(buf);
if (encoding==_UTF) utf8rutodos(buf);
if (encoding==_KOI) koitodos(buf);
282,7 → 283,7
DeleteFile(#download_path);
IF (URL[strlen(#URL)-1]=='/') URL[strlen(#URL)-1]='';
downloader_id = RunProgram("/sys/network/downloader", #URL);
//ýòî ãåíèàëüíî è ýòî ïèçäåö!!!
//Browser Hack v2.0
Pause(60);
if (GetProcessSlot(downloader_id)<>0)
{
376,11 → 377,55
break;
}
case 0x0d:
debug("0x0d");
bukva = ' ';
goto DEFAULT_MARK;
case '=': //ïîääåðæêà øàéòàíñêîé êîäèðîâêè ñòðàíèö, ñîõðàí¸ííûõ ÷åðåç ÈÅ7
if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK;
 
bword++;
bukva=ESBYTE[bword];
strcpy(#temp,#bukva);
bword++;
bukva=ESBYTE[bword];
strcat(#temp,#bukva);
bukva=Hex2Symb(#temp);
if (bukva) goto DEFAULT_MARK;
break;
case '&': //&nbsp; and so on
bword++;
tag=0;
for (j=0; (ESBYTE[bword]<>';') && (j<7); j++, bword++;)
{
bukva = ESBYTE[bword];
strcat(#tag, #bukva);
}
for (j=0; unicode_tags[j]!=0; j+=2;)
{
if (!strcmp(#tag, unicode_tags[j]))
{
strcat(#line, unicode_tags[j+1]);
break 1;
}
}
rez = atoi(#tag + 1) - 1040;
if (tag[1] == '1') && (rez>=0) && (rez<=72) && (strlen(#tag) == 5)
{
bukva = unicode_chars[rez];
//GOTO DEFAULT_MARK; //îáðàáàòûâàåì áóêâó ëó÷øå íàâåðíî strcat(#line, unicode_tags[j+1]); è break 1;
strcat(#line, #bukva);
break;
}
strcat(#line,#tag); //âûâîäèì íà ýêðàí íåîáðàáîòàííûé òåã, òàê áðàóçåðû çà÷åì-òî äåëàþò
break;
case '<':
bword++; //ïðîìîòàåì ñèìâîë <
tag = parametr = tagparam = ignor_param = 0;
tag = parametr = tagparam = ignor_param = NULL;
if (ESBYTE[bword] == '!') //ôèëüòðàöèÿ âíóòðè <!-- -->, äåðçêî
{
bword++;
416,62 → 461,19
strlwr(#tag);
strlwr(#tagparam);
 
if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=''; //for br/
if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/
if (tagparam) && (strlen(#tagparam) < 4000) GetNextParam();
 
DrawPage();
line=0;
line=NULL;
 
if (tag) WhatTextStyle(left + 5, stroka * 10 + top + 5, width - 20); //îáðàáîòêà òåãîâ
 
tag = parametr = tagparam = ignor_param = '\0';
tag = parametr = tagparam = ignor_param = NULL;
break;
case '=': //ïîääåðæêà øàéòàíñêîé êîäèðîâêè ñòðàíèö, ñîõðàí¸ííûõ ÷åðåç ÈÅ7
if (strcmp(#URL + strlen(#URL) - 4, ".mht")<>0) goto DEFAULT_MARK;
 
bword++;
bukva=ESBYTE[bword];
strcpy(#temp,#bukva);
bword++;
bukva=ESBYTE[bword];
strcat(#temp,#bukva);
bukva=Hex2Symb(#temp);
if (bukva) goto DEFAULT_MARK;
break;
case '&': //&nbsp; and so on
bword++;
tag=0;
for (j=0; (ESBYTE[bword]<>';') && (j<7); j++, bword++;)
{
bukva = ESBYTE[bword];
strcat(#tag, #bukva);
}
for (j=0; unicode_tags[j]!=0; j+=2;)
{
if (!strcmp(#tag, unicode_tags[j]))
{
strcat(#line, unicode_tags[j+1]);
break 1;
}
}
rez = atoi(#tag + 1) - 1040;
if (tag[1] == '1') && (rez>=0) && (rez<=72) && (strlen(#tag) == 5)
{
bukva = unicode_chars[rez];
//GOTO DEFAULT_MARK; //îáðàáàòûâàåì áóêâó ëó÷øå íàâåðíî strcat(#line, unicode_tags[j+1]); è break 1;
strcat(#line, #bukva);
break;
}
strcat(#line,#tag); //âûâîäèì íà ýêðàí íåîáðàáîòàííûé òåã, òàê áðàóçåðû çà÷åì-òî äåëàþò
break;
default:
DEFAULT_MARK:
if (!pre_text) && (bukva == ' ') && (line[strlen(#line)-1]==' ') break;
if (!pre_text) && (bukva == ' ') && (line[strlen(#line)-1]==' ') break; //óáðàòü 2 ïðîáåëà ïîäðÿä
//
if (stolbec + strlen(#line) > lines.column_max)
{
514,9 → 516,6
{
if (strlen(#version)+strlen(#line)+2>sizeof(header))
{
//line = 123456789
//header = 1234
//line = 56789
strcpy(#temp, #line);
temp[sizeof(header)-strlen(#version)-2]=0;
strcpy(#header, #temp);
572,7 → 571,7
dword hr_color;
 
dword image;
char temp[4096];
char temp[4096], alt[4096];
int w=0, h=0, img_lines_first=0;
 
//ïðîâåðÿåì òåã îòêðûâàåòñÿ èëè çàêðûâàåòñÿ
782,9 → 781,10
IMG_TAG:
if (!strcmp(#parametr,"src=")) //íàäî îáúåäèíèòü ñ GetNewUrl()
{
if (downloader_id!=0) strcpy(#temp, #history_list[history_current-1].Item);
if (downloader_id) strcpy(#temp, #history_list[history_current-1].Item);
else strcpy(#temp, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
if (!strcmpn(#temp, "http:", 5)) || (!strcmpn(#options, "http:", 5)) return;
if (strcmpn(#temp, "http:", 5)!=0) || (strcmpn(#options, "http:", 5)!=0)
{
temp[strrchr(#temp, '/')] = 0x00; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
strcat(#temp, #options);
image=load_image(#temp);
791,12 → 791,13
w=DSWORD[image+4];
h=DSWORD[image+8];
}
/*if (!strcmp(#parametr,"alt="))
}
if (!strcmp(#parametr,"alt="))
{
strcpy(#tag, "[Image: ");
strcat(#tag, #options);
strcat(#tag, "]");
}*/
strcpy(#alt, "[");
strcat(#alt, #options);
strcat(#alt, "]");
}
 
IF(tagparam)
{
804,7 → 805,11
GOTO IMG_TAG;
}
if (!image) return;
if (!image)
{
if (alt) && (link) strcat(#line, #alt);
return;
}
if (w>width1) w=width1;
/programs/network/htmlv/browser/include/menu_rmb.h
7,7 → 7,7
"View in Tinypad F3",52,
"WIN F5",REFRESH,
"DOS Ctrl+D",04,
"KOI-8 Ctrl+K",11,
"KOI Ctrl+K",11,
"UTF Ctrl+U",21,
"Line breaks ON" ,01,
"TrueType fonts" ,05,
78,10 → 78,9
case evReDraw:
while (ITEMS_LIST[items_num*2]) items_num++;
DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x01,0x10FFFFFF,0);
DefineButton(0, 0, ITEM_WIDTH, ITEM_HEIGHT, 10+BT_HIDE+BT_NOFRAME, 0); //hack
DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x01,0x10FFFFFF,0,0x01fffFFF);
 
DrawRegion(0,0,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x777777); //îáîäîê
DrawRectangle(0,0,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x777777); //îáîäîê
_ITEMS_DRAW:
for (i=0; i<items_num; i++;)
{
91,6 → 90,7
if (ITEMS_LIST[i*2+1]==1) && (pre_text==2) DrawBar(ITEM_WIDTH-18, i*ITEM_HEIGHT+8, 4, 4, 0x444444);
if (ITEMS_LIST[i*2+1]==5) && (use_truetype==1) DrawBar(ITEM_WIDTH-18, i*ITEM_HEIGHT+8, 4, 4, 0x444444);
}
DrawBar(33, cur_encoding+1*ITEM_HEIGHT+8, 4, 4, 0x444444); //ïîêàçûâàåò âûáðàíóþ êîäèðîâêó
}
}
 
/programs/network/htmlv/browser/include/some_code.h
1,4 → 1,4
//ª­®¯ª¨
//êíîïêè
#define BACK 300
#define FORWARD 301
#define REFRESH 302
/programs/network/htmlv/lib/figures.h
0,0 → 1,33
void DrawRectangle(dword x,y,width,height,color1)
{
DrawBar(x,y,width,1,color1);
DrawBar(x,y+height,width,1,color1);
DrawBar(x,y,1,height,color1);
DrawBar(x+width,y,1,height+1,color1);
}
 
void DrawRectangle3D(dword x,y,width,height,color1,color2)
{
DrawBar(x,y,width+1,1,color1);
DrawBar(x,y+1,1,height-1,color1);
DrawBar(x+width,y+1,1,height,color2);
DrawBar(x,y+height,width,1,color2);
}
 
void DrawCaptButton(dword x,y,width,height,id,color,text,text_len)
{
DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF);
WriteText(-text_len*6+width/2+x+1,height/2-3+y,0x80,0,text,0);
}
 
void DrawCircle(int x, y, r)
{
int i;
float px=0, py=r, ii = r * 3.1415926 * 2;
FOR (i = 0; i < ii; i++)
{
PutPixel(px + x, y - py, 0);
px = py / r + px;
py = -px / r + py;
}
}
/programs/network/htmlv/lib/kolibri.h
71,7 → 71,8
 
struct system_colors
{
dword frame,grab,grab_button,grab_button_text,grab_text,work,work_button,work_button_text,work_text,work_graph;
dword frame,grab,grab_button,grab_button_text,grab_text,
work,work_button,work_button_text,work_text,work_graph;
void get();
};
 
263,7 → 264,7
$int 0x40
}
 
inline fastcall dword GetSkinHeight()
inline fastcall GetSkinHeight()
{
$push ebx
$mov eax,48
313,9 → 314,30
$int 0x40
}
 
inline fastcall void debug( EDX)
{
$push ebx
$push ecx
$mov eax, 63
$mov ebx, 1
next_char:
$mov ecx, DSDWORD[edx]
$or cl, cl
$jz done
$int 0x40
$inc edx
$jmp next_char
done:
$mov cl, 13
$int 0x40
$mov cl, 10
$int 0x40
$pop ecx
$pop ebx
}
//------------------------------------------------------------------------------
 
void DefineAndDrawWindow(dword x,y, sizeX,sizeY, byte WindowType,dword WindowAreaColor, EDI)
void DefineAndDrawWindow(dword x,y, sizeX,sizeY, byte WindowType,dword WindowAreaColor, EDI, ESI)
{
EAX = 12; // function 12:tell os about windowdraw
EBX = 1;
438,69 → 460,4
EAX = 8;
EDX += BT_DEL;
$int 0x40;
}
 
 
//------------------------------------------------------------------------------
 
:void DrawRegion(dword x,y,width,height,color1)
{
DrawBar(x,y,width,1,color1); //¯®«®á  £®à ᢥàåã
DrawBar(x,y+height,width,1,color1); //¯®«®á  £®à á­¨§ã
DrawBar(x,y,1,height,color1); //¯®«®á  ¢¥àåã á«¥¢ 
DrawBar(x+width,y,1,height+1,color1); //¯®«®á  ¢¥àåã á¯à ¢ 
}
 
:void DrawRegion_3D(dword x,y,width,height,color1,color2)
{
DrawBar(x,y,width+1,1,color1); //¯®«®á  £®à ᢥàåã
DrawBar(x,y+1,1,height-1,color1); //¯®«®á  á«¥¢ 
DrawBar(x+width,y+1,1,height,color2); //¯®«®á  á¯à ¢ 
DrawBar(x,y+height,width,1,color2); //¯®«®á  £®à á­¨§ã
}
 
:void DrawFlatButton(dword x,y,width,height,id,color,text)
{
DrawRegion_3D(x,y,width,height,0x94AECE,0x94AECE);
DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7);
DrawBar(x+2,y+2,width-3,height-3,color); //§ «¨¢ª 
IF (id<>0) DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF); //ª­®¯ª 
//WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0);
WriteText(width/2+x+1,height/2-3+y,0x80,0,text,0);
}
 
:void DrawCircle(int x, y, r)
{
int i;
float px=0, py=r, ii = r * 3.1415926 * 2;
FOR (i = 0; i < ii; i++)
{
PutPixel(px + x, y - py, 0);
px = py / r + px;
py = -px / r + py;
}
}
 
//------------------------------------------------------------------------------
 
inline fastcall void debug( EDX)
{
$push ebx
$push ecx
$mov eax, 63
$mov ebx, 1
next_char:
$mov ecx, DSDWORD[edx]
$or cl, cl
$jz done
$int 0x40
$inc edx
$jmp next_char
done:
$mov cl, 13
$int 0x40
$mov cl, 10
$int 0x40
$pop ecx
$pop ebx
}
}
/programs/network/htmlv/lib/strings.h
193,7 → 193,7
 
inline fastcall signed int strrchr( ESI,BL)
{
int jj=0, last=-1;
int jj=0, last=0;
do{
jj++;
$lodsb