16,6 → 16,7 |
#include "..\lib\file_system.h" |
#include "..\lib\mem.h" |
#include "..\lib\dll.h" |
#include "..\lib\list_box.h" |
//*.obj libraries |
#include "..\lib\lib.obj\box_lib.h" |
#include "..\lib\lib.obj\libio_lib.h" |
25,10 → 26,10 |
#include "img\URLgoto.txt"; |
|
#ifdef LANG_RUS |
char version[]=" ¥ªáâ®¢ë© ¡à 㧥à 0.99.11"; |
?define IMAGES_CACHE_CLEARED "íè ª à⨮ª ®ç¨é¥" |
char version[]=" ’ҐЄбв®ўл© Ўа 㧥а 0.99.3"; |
?define IMAGES_CACHE_CLEARED "Љни Є авЁ®Є ®зЁйҐ" |
#else |
char version[]=" Text-based Browser 0.99.11"; |
char version[]=" Text-based Browser 0.99.3"; |
?define IMAGES_CACHE_CLEARED "Images cache cleared" |
#endif |
|
69,8 → 70,8 |
|
mem_Init(); |
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) debug("Error: library doesn't exists - libio"w); |
if (load_dll2(libimg, #libimg_init,1)!=0) debug("Error: library doesn't exists - libimg"w); |
if (load_dll2(libio, #libio_init,1)!=0) debug("Error: library doesn't exists - libio"); |
if (load_dll2(libimg, #libimg_init,1)!=0) debug("Error: library doesn't exists - libimg"); |
|
if (!URL) strcpy(#URL, "/sys/index.htm"); |
strcpy(#editURL, #URL); |
90,9 → 91,9 |
/* |
//not work well, so we are use custom way of processing scroll |
scrollbar_v_mouse (#scroll1); |
if (lines.first <> scroll1.position) |
if (WB1.list.first <> scroll1.position) |
{ |
lines.first = scroll1.position; |
WB1.list.first = scroll1.position; |
WB1.ParseHTML(buf, filesize); |
}; |
*/ |
118,28 → 119,15 |
} |
} |
|
if (m.vert==65535) |
if (m.vert) |
{ |
if (lines.first==0) break; |
if (lines.first>3) lines.first-=2; ELSE lines.first=1; |
Scan(ID1); |
break; |
if (WB1.list.MouseScroll(m.vert)) WB1.ParseHTML(buf); |
} |
if (m.vert==1) |
{ |
if(lines.visible+lines.first+3>=lines.all) Scan(181); |
else |
{ |
lines.first+=2; |
Scan(ID2); |
} |
break; |
} |
|
if (!m.lkm) scroll_used=0; |
if (m.x>=scroll1.start_x) && (m.x<=scroll1.start_x+scroll1.size_x) |
&& (m.y>=scroll1.start_y+scroll1.btn_height) && (-scroll1.btn_height+scroll1.start_y+scroll1.size_y>m.y) |
&& (lines.all>lines.visible) && (m.lkm) |
&& (WB1.list.count>WB1.list.visible) && (m.lkm) |
{ |
scroll_used=1; |
} |
146,12 → 134,12 |
|
if (scroll_used) |
{ |
half_scroll_size = WB1.list.h - 16 * lines.visible / lines.all - 3 /2; |
if (half_scroll_size+WB1.list.y>m.y) || (m.y<0) || (m.y>4000) m.y=half_scroll_size+WB1.list.y; //åñëè êóðñîð íàä îêíîì |
btn=lines.first; //ñîõðàíÿåì ñòàðîå êîëè÷åñòâî |
lines.first = m.y -half_scroll_size -WB1.list.y * lines.all / WB1.list.h; |
if (lines.visible+lines.first>lines.all) lines.first=lines.all-lines.visible; |
if (btn<>lines.first) WB1.ParseHTML(buf); //÷òîá ëèøíèé ðàç íå ïåðåðèñîâûâàòü |
half_scroll_size = WB1.list.h - 16 * WB1.list.visible / WB1.list.count - 3 /2; |
if (half_scroll_size+WB1.list.y>m.y) || (m.y<0) || (m.y>4000) m.y=half_scroll_size+WB1.list.y; //åñëè êóðñîð íàä îêíîì |
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); //÷òîá ëèøíèé ðàç íå ïåðåðèñîâûâàòü |
} |
|
break; |
187,7 → 175,7 |
{ |
if (GetProcessSlot(downloader_id)<>0) break; |
downloader_id=0; |
lines.first = lines.all = 0; |
WB1.list.first = WB1.list.count = 0; |
WB1.ReadHtml(_WIN); |
Draw_Window(); |
} |
199,8 → 187,8 |
{ |
address_box.width = Form.width-266; |
WB1.list.SetSizes(0, 44, Form.width - 10 - scroll1.size_x, Form.cheight - 44, 0, 10); |
lines.column_max = WB1.list.w - 30 / 6; |
lines.visible = WB1.list.h - 3 / WB1.list.line_h - 2; |
WB1.list.column_max = WB1.list.w - 30 / 6; |
WB1.list.visible = WB1.list.h - 3 / WB1.list.line_h - 2; |
DrawBufInit(); |
} |
|
235,74 → 223,37 |
SetElementSizes(); |
WB1.ShowPage(); |
|
DefineButton(scroll1.start_x+1, scroll1.start_y+1, 16, 16, ID1+BT_HIDE, 0xE4DFE1); |
DefineButton(scroll1.start_x+1, scroll1.start_y+scroll1.size_y-18, 16, 16, ID2+BT_HIDE, 0xE4DFE1); |
DefineButton(scroll1.start_x+1, scroll1.start_y+1, 16, 16, BTN_UP+BT_HIDE, 0xE4DFE1); |
DefineButton(scroll1.start_x+1, scroll1.start_y+scroll1.size_y-18, 16, 16, BTN_DOWN+BT_HIDE, 0xE4DFE1); |
} |
|
|
void Scan(int id) |
{ |
if (id >= 400) |
{ |
GetURLfromPageLinks(id); |
if (id >= 400) ProcessLinks(id); |
|
//#1 |
if (URL[0] == '#') |
{ |
strcpy(#anchor, #URL+strrchr(#URL, '#')); |
|
strcpy(#URL, BrowserHistory.CurrentUrl()); |
|
lines.first=lines.all-lines.visible; |
WB1.ShowPage(); |
return; |
} |
//liner.ru#1 |
if (strrchr(#URL, '#')<>-1) |
{ |
strcpy(#anchor, #URL+strrchr(#URL, '#')); |
URL[strrchr(#URL, '#')-1] = 0x00; //çàãëóøêà |
} |
|
WB1.GetNewUrl(); |
|
if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg")) |
{ |
//if (strstr(#URL,"http:")) |
RunProgram("/sys/media/kiv", #URL); |
strcpy(#editURL, BrowserHistory.CurrentUrl()); |
strcpy(#URL, BrowserHistory.CurrentUrl()); |
return; |
} |
if (!strcmpn(#URL,"mailto:", 7)) |
{ |
RunProgram("@notify", #URL); |
strcpy(#editURL, BrowserHistory.CurrentUrl()); |
strcpy(#URL, BrowserHistory.CurrentUrl()); |
return; |
} |
|
WB1.OpenPage(); |
return; |
} |
|
IF(lines.all < lines.visible) SWITCH(id) //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè |
{ CASE 183: CASE 184: CASE 180: CASE 181: return; } |
|
switch (id) |
{ |
case 011: //Ctrk+K |
WB1.ReadHtml(_KOI); |
break; |
WB1.ParseHTML(buf); |
return; |
|
case 021: //Ctrl+U |
WB1.ReadHtml(_UTF); |
break; |
WB1.ParseHTML(buf); |
return; |
|
case 004: //Ctrl+D |
WB1.ReadHtml(_DOS); |
break; |
WB1.ParseHTML(buf); |
return; |
|
case 002: //free img cache |
FreeImgCache(); |
break; |
WB1.ParseHTML(buf); |
return; |
|
case BACK: |
if (!BrowserHistory.GoBack()) return; |
WB1.OpenPage(); |
312,10 → 263,13 |
WB1.OpenPage(); |
return; |
case 052: //F3 |
if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #download_path); |
if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/tinypad", #URL); |
else RunProgram("/rd/1/tinypad", #download_path); |
return; |
case 054: //F5 |
IF(address_box.flags & 0b10) break; |
IF(address_box.flags & 0b10) WB1.ParseHTML(buf); |
return; |
|
case REFRESH: |
if (GetProcessSlot(downloader_id)<>0) |
{ |
324,12 → 278,12 |
Draw_Window(); |
return; |
} |
anchor_line_num=lines.first; //âåñ¸ëûé êîñòûëü :Ð |
anchor_line_num=WB1.list.first; |
anchor[0]='|'; |
WB1.OpenPage(); |
return; |
case 014: //Ctrl+N íîâîå îêíî |
case 020: //Ctrl+T íîâàÿ âêëàäêà |
case 014: |
case 020: |
case NEWTAB: |
MoveSize(190,80,OLD,OLD); |
RunProgram(#program_path, #URL); |
339,8 → 293,6 |
strcpy(#editURL, "http://kolibrios.org/en/index.htm"); |
case GOTOURL: |
case 0x0D: //enter |
//ïî÷åìó ttp://? Ãîñïîäà, îòëè÷íûé âîïðîñ. Äåëî â òîì, ÷òî ýòî õàê. |
//strstr() åñëè íå íàøëî âîçâðàùàåò 0 è â ñëó÷àå óñïåõà âîçâðàùàåò 0. Òàê ÷òî ýòî õàê. |
if ((strstr(#editURL,"ttp://")==0) && (editURL[0]!='/')) strcpy(#URL,"http://"); else URL[0] = 0; |
strcat(#URL, #editURL); |
WB1.OpenPage(); |
351,39 → 303,95 |
WB1.OpenPage(); |
return; |
|
case ID1: //ìîòàåì ââåðõ |
IF(lines.first <= 0) return; |
lines.first--; |
break; |
case ID2: //ìîòàåì âíèç |
IF(lines.visible + lines.first >= lines.all) return; |
lines.first++; |
break; |
case 183: //PgDown |
IF(lines.first == lines.all - lines.visible) return; |
lines.first += lines.visible + 2; |
IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible; |
break; |
if (WB1.list.count < WB1.list.visible) return; |
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); |
return; |
|
case 184: //PgUp |
IF(lines.first == 0) return; |
lines.first -= lines.visible - 2; |
IF(lines.first < 0) lines.first = 0; |
break; |
if (WB1.list.count < WB1.list.visible) return; |
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); |
return; |
|
case 178: |
case BTN_UP: //мотаем вверх |
IF(WB1.list.first <= 0) return; |
WB1.list.first--; |
WB1.ParseHTML(buf); |
return; |
|
case 177: |
case BTN_DOWN: //мотаем вниз |
IF(WB1.list.visible + WB1.list.first >= WB1.list.count) return; |
WB1.list.first++; |
WB1.ParseHTML(buf); |
return; |
|
case 180: //home |
IF(lines.first == 0) return; |
lines.first = 0; |
break; |
if (WB1.list.KeyHome()) WB1.ParseHTML(buf); |
return; |
|
case 181: //end |
IF (lines.first == lines.all - lines.visible) return; |
lines.first = lines.all - lines.visible; |
break; |
default: |
if (WB1.list.count < WB1.list.visible) return; |
if (WB1.list.KeyEnd()) WB1.ParseHTML(buf); |
return; |
} |
WB1.ParseHTML(buf); |
} |
|
|
|
void ProcessLinks(int id) |
{ |
GetURLfromPageLinks(id); |
|
//#1 |
if (URL[0] == '#') |
{ |
strcpy(#anchor, #URL+strrchr(#URL, '#')); |
|
strcpy(#URL, BrowserHistory.CurrentUrl()); |
|
WB1.list.first=WB1.list.count-WB1.list.visible; |
WB1.ShowPage(); |
return; |
} |
//liner.ru#1 |
if (strrchr(#URL, '#')<>-1) |
{ |
strcpy(#anchor, #URL+strrchr(#URL, '#')); |
URL[strrchr(#URL, '#')-1] = 0x00; //çàãëóøêà |
} |
|
WB1.GetNewUrl(); |
|
if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg")) |
{ |
//if (strstr(#URL,"http:")) |
RunProgram("/sys/media/kiv", #URL); |
strcpy(#editURL, BrowserHistory.CurrentUrl()); |
strcpy(#URL, BrowserHistory.CurrentUrl()); |
return; |
} |
if (!strcmpn(#URL,"mailto:", 7)) |
{ |
notify(#URL); |
strcpy(#editURL, BrowserHistory.CurrentUrl()); |
strcpy(#URL, BrowserHistory.CurrentUrl()); |
return; |
} |
|
WB1.OpenPage(); |
return; |
} |
|
|
|
|
|
stop: |