Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4540 → Rev 4539

/programs/cmm/browser/HTMLv.c
58,8 → 58,6
dword http_transfer = 0;
dword http_buffer;
 
int downloader_id;
 
#include "..\TWB\TWB.c"
#include "menu_rmb.h"
 
82,7 → 80,6
if (load_dll2(boxlib, #box_lib_init,0)!=0) {notify("System Error: library doesn't exists /rd/1/lib/box_lib.obj"); ExitProcess();}
if (load_dll2(libio, #libio_init,1)!=0) notify("Error: library doesn't exists - libio");
if (load_dll2(libimg, #libimg_init,1)!=0) notify("Error: library doesn't exists - libimg");
if (load_dll2(libHTTP, #http_lib_init,1)!=0) notify("Error: library doesn't exists - http");
if (!URL) strcpy(#URL, "/sys/index.htm");
Form.width=WIN_W;
104,7 → 101,7
m.get();
PageLinks.Hover(m.x, m.y, link_color_inactive, link_color_active, bg_color);
if (m.y>WB1.list.y) && (m.y<Form.height) && (bufsize)
if (m.y>WB1.list.y) && (m.y<Form.height) && (filesize)
{
if (m.pkm)
{
121,7 → 118,7
 
if (m.vert)
{
if (WB1.list.MouseScroll(m.vert)) WB1.ParseHTML(bufpointer);
if (WB1.list.MouseScroll(m.vert)) WB1.ParseHTML(buf);
}
if (!m.lkm) scroll_used=0;
139,7 → 136,7
btn=WB1.list.first;
WB1.list.first = m.y -half_scroll_size -WB1.list.y * WB1.list.count / WB1.list.h;
if (WB1.list.visible+WB1.list.first>WB1.list.count) WB1.list.first=WB1.list.count-WB1.list.visible;
if (btn<>WB1.list.first) WB1.ParseHTML(bufpointer);
if (btn<>WB1.list.first) WB1.ParseHTML(buf);
}
 
break;
170,29 → 167,28
if (action_buf) { Scan(action_buf); action_buf=0;}
Draw_Window();
break;
case evNetwork:
return;
http_get stdcall (#search_path, 0);
//open page
http_get stdcall (#URL, 0);
http_transfer = EAX;
IF (http_transfer < 0) notify("Error from HTTP lib");
 
if (http_transfer > 0) {
//
if (http_transfer != 0) {
http_process stdcall (http_transfer);
$push EAX
ESI = http_transfer;
bufpointer = ESI.http_msg.content_ptr;
debug(bufpointer);
//bufsize = ESI.http_msg.content_received;
bufsize = strlen(bufpointer)-2;
debugi(bufsize);
WB1.ParseHTML(bufpointer);
if (!ESI.http_msg.content_received) break;
buf = ESI.http_msg.content_ptr;
debug(buf);
filesize = ESI.http_msg.content_received;
debugi(filesize);
WB1.ParseHTML(buf);
$pop EAX
if (EAX == 0) {
http_free stdcall (http_transfer);
http_transfer=0;
}
pause(10);
}
default:
if (downloader_id<>0)
260,28 → 256,28
{
case 011: //Ctrk+K
WB1.ReadHtml(_KOI);
WB1.ParseHTML(bufpointer);
WB1.ParseHTML(buf);
return;
 
case 021: //Ctrl+U
WB1.ReadHtml(_UTF);
WB1.ParseHTML(bufpointer);
WB1.ParseHTML(buf);
return;
 
case 004: //Ctrl+D
WB1.ReadHtml(_DOS);
WB1.ParseHTML(bufpointer);
WB1.ParseHTML(buf);
return;
 
case 005: //Win encoding
WB1.ReadHtml(_WIN);
WB1.ParseHTML(bufpointer);
WB1.ParseHTML(buf);
return;
 
case 009: //free img cache
ImgCache.Free();
notify(IMAGES_CACHE_CLEARED);
WB1.ParseHTML(bufpointer);
WB1.ParseHTML(buf);
return;
 
case BACK:
297,7 → 293,7
else RunProgram("/rd/1/tinypad", #download_path);
return;
case 054: //F5
IF(address_box.flags & 0b10) WB1.ParseHTML(bufpointer);
IF(address_box.flags & 0b10) WB1.ParseHTML(buf);
return;
 
case REFRESH:
338,7 → 334,7
IF(WB1.list.first == WB1.list.count - WB1.list.visible) return;
WB1.list.first += WB1.list.visible + 2;
IF(WB1.list.visible + WB1.list.first > WB1.list.count) WB1.list.first = WB1.list.count - WB1.list.visible;
WB1.ParseHTML(bufpointer);
WB1.ParseHTML(buf);
return;
 
case 184: //PgUp
346,7 → 342,7
IF(WB1.list.first == 0) return;
WB1.list.first -= WB1.list.visible - 2;
IF(WB1.list.first < 0) WB1.list.first = 0;
WB1.ParseHTML(bufpointer);
WB1.ParseHTML(buf);
return;
 
case 178:
353,7 → 349,7
case BTN_UP: //ìîòàåì ââåðõ
if (WB1.list.first <= 0) return;
WB1.list.first--;
WB1.ParseHTML(bufpointer);
WB1.ParseHTML(buf);
return;
 
case 177:
360,16 → 356,16
case BTN_DOWN: //ìîòàåì âíèç
if (WB1.list.visible + WB1.list.first >= WB1.list.count) return;
WB1.list.first++;
WB1.ParseHTML(bufpointer);
WB1.ParseHTML(buf);
return;
 
case 180: //home
if (WB1.list.KeyHome()) WB1.ParseHTML(bufpointer);
if (WB1.list.KeyHome()) WB1.ParseHTML(buf);
return;
 
case 181: //end
if (WB1.list.count < WB1.list.visible) return;
if (WB1.list.KeyEnd()) WB1.ParseHTML(bufpointer);
if (WB1.list.KeyEnd()) WB1.ParseHTML(buf);
return;
}
}
460,12 → 456,12
address_box.offset=0;
edit_box_draw stdcall(#address_box);
 
if (!bufsize)
if (!filesize)
{
PageLinks.Clear();
if (GetProcessSlot(downloader_id)<>0)
{
bufsize = sizeof(loading);
filesize = sizeof(loading);
WB1.ParseHTML(#loading);
}
else
472,12 → 468,12
{
if (strncmp(#URL,"http:",5)==0)
{
bufsize = sizeof(page_not_found_no_internet);
filesize = sizeof(page_not_found_no_internet);
WB1.ParseHTML(#page_not_found_no_internet);
}
else
{
bufsize = sizeof(page_not_found);
filesize = sizeof(page_not_found);
WB1.ParseHTML(#page_not_found);
}
}
484,7 → 480,7
//return;
}
else
WB1.ParseHTML(bufpointer);
WB1.ParseHTML(buf);
 
if (!header) strcpy(#header, #version);
if (!strcmp(#version, #header)) DrawTitle(#header);
/programs/cmm/TWB/TWB.c
1,8 → 1,8
#include "..\TWB\links.h"
 
 
dword bufpointer;
dword bufsize;
dword buf;
dword filesize;
 
#define URL param
 
10,10 → 10,12
 
char header[2048];
 
int downloader_id;
 
char download_path[]="/rd/1/.download";
 
struct TWebBrowser {
llist list;
llist list; //need #include "..\lib\list_box.h"
DrawBufer DrawBuf;
void GetNewUrl();
void ReadHtml();
149,20 → 151,20
else
file_size stdcall (#URL);
bufsize = EBX;
if (!bufsize) return;
filesize = EBX;
if (!filesize) return;
mem_Free(bufpointer);
bufpointer = mem_Alloc(bufsize);
mem_Free(buf);
buf = mem_Alloc(filesize);
if (!strncmp(#URL,"http:",5))
ReadFile(0, bufsize, bufpointer, #download_path);
ReadFile(0, filesize, buf, #download_path);
else
ReadFile(0, bufsize, bufpointer, #URL);
ReadFile(0, filesize, buf, #URL);
cur_encoding = encoding;
if (encoding==_WIN) wintodos(bufpointer);
if (encoding==_UTF) utf8rutodos(bufpointer);
if (encoding==_KOI) koitodos(bufpointer);
if (encoding==_WIN) wintodos(buf);
if (encoding==_UTF) utf8rutodos(buf);
if (encoding==_KOI) koitodos(buf);
}
 
 
195,7 → 197,7
if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
}
for ( ; bufstart+bufsize > bufpos; bufpos++;)
for ( ; bufstart+filesize > bufpos; bufpos++;)
{
bukva = ESBYTE[bufpos];
if (ignor_text) && (bukva!='<') continue;
253,7 → 255,7
do
{
bufpos++;
if (bufstart + bufsize <= bufpos) break 2;
if (bufstart + filesize <= bufpos) break 2;
}
while (ESBYTE[bufpos] <>'-');
261,7 → 263,7
if (ESBYTE[bufpos] <>'-') goto HH_;
}
}
while (ESBYTE[bufpos] !='>') && (bufpos < bufstart + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
while (ESBYTE[bufpos] !='>') && (bufpos < bufstart + filesize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
{
bukva = ESBYTE[bufpos];
if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
/programs/cmm/TWB/img_cache.h
43,8 → 43,9
do{
if (!strcmp(#parametr,"src=")) //íàäî îáúåäèíèòü ñ GetNewUrl()
{
//if (downloader_id) strcpy(#img_path, #history_list[history_current-1].Item); else
strcpy(#img_path, BrowserHistory.CurrentUrl());
if (downloader_id) strcpy(#img_path, #history_list[history_current-1].Item);
else strcpy(#img_path, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
if (strcmpn(#img_path, "http:", 5)!=0) || (strcmpn(#options, "http:", 5)!=0)
{
//get path: absolute or relative
/programs/cmm/liza/mail_box.c
355,9 → 355,8
}
 
void DrawLetter() {
pre_text = 2;
bufsize = strlen(mdata);
if (bufsize) WB1.ParseHTML(mdata);
filesize = strlen(mdata);
if (filesize) WB1.ParseHTML(mdata);
}