Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4539 → Rev 4540

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