/programs/cmm/TWB/history.h |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/TWB/TWB.c |
---|
1,4 → 1,6 |
#include "..\lib\list_box.h" |
int downloader_id; |
dword |
12,7 → 14,7 |
struct TWebBrowser { |
int left, top, width, height, line_h; |
void Scan(int); |
llist list; |
void GetNewUrl(); |
void OpenPage(); |
void ReadHtml(byte); |
46,7 → 48,6 |
options[4096], |
anchor[256]; |
#include "..\TWB\history.h" |
#include "..\TWB\colors.h" |
#include "..\TWB\unicode_tags.h" |
#include "..\TWB\img_cache.h" |
90,150 → 91,8 |
} |
//======================================================================= |
void TWebBrowser::Scan(int id) |
{ |
if (id >= 400) |
{ |
GetURLfromPageLinks(id); |
//#1 |
if (URL[0] == '#') |
{ |
strcpy(#anchor, #URL+strrchr(#URL, '#')); |
strcpy(#URL, BrowserHistory.CurrentUrl()); |
lines.first=lines.all-lines.visible; |
ShowPage(); |
return; |
} |
//liner.ru#1 |
if (strrchr(#URL, '#')<>-1) |
{ |
strcpy(#anchor, #URL+strrchr(#URL, '#')); |
URL[strrchr(#URL, '#')-1] = 0x00; //çàãëóøêà |
} |
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; |
} |
OpenPage(); |
return; |
} |
IF(lines.all < lines.visible) SWITCH(id) //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè |
{ CASE 183: CASE 184: CASE 180: CASE 181: return; } |
switch (id) |
{ |
case 011: //Ctrk+K |
ReadHtml(_KOI); |
break; |
case 021: //Ctrl+U |
ReadHtml(_UTF); |
break; |
case 004: //Ctrl+D |
ReadHtml(_DOS); |
break; |
case 002: //free img cache |
FreeImgCache(); |
break; |
case BACK: |
if (!BrowserHistory.GoBack()) return; |
OpenPage(); |
return; |
case FORWARD: |
if (!BrowserHistory.GoForward()) return; |
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); |
return; |
case 054: //F5 |
IF(address_box.flags & 0b10) break; |
case REFRESH: |
if (GetProcessSlot(downloader_id)<>0) |
{ |
KillProcess(downloader_id); |
pause(20); |
Draw_Window(); |
return; |
} |
anchor_line_num=lines.first; //âåñ¸ëûé êîñòûëü :Ð |
anchor[0]='|'; |
OpenPage(); |
return; |
case 014: //Ctrl+N íîâîå îêíî |
case 020: //Ctrl+T íîâàÿ âêëàäêà |
case NEWTAB: |
MoveSize(190,80,OLD,OLD); |
RunProgram(#program_path, #URL); |
return; |
case HOME: |
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); |
OpenPage(); |
return; |
case SEARCHWEB: |
strcpy(#URL, #search_path); |
strcat(#URL, #editURL); |
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; |
case 184: //PgUp |
IF(lines.first == 0) return; |
lines.first -= lines.visible - 2; |
IF(lines.first < 0) lines.first = 0; |
break; |
case 180: //home |
IF(lines.first == 0) return; |
lines.first = 0; |
break; |
case 181: //end |
IF (lines.first == lines.all - lines.visible) return; |
lines.first = lines.all - lines.visible; |
break; |
default: |
return; |
} |
ParseHTML(buf); |
} |
char *ABSOLUTE_LINKS[]={ "http:", "mailto:", "ftp:", "/sys/", "/kolibrios/", "/rd/", "/bd", "/hd", "/cd", "/tmp", "/usbhd", 0}; |
//dword TWebBrowser::GetNewUrl(dword CUR_URL, NEW_URL){ |
void TWebBrowser::GetNewUrl(){ |
/programs/cmm/browser/DrawBuf.h |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/browser/include/some_code.h |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/browser/include/acid_0.1.htm |
---|
File deleted |
/programs/cmm/browser/include/img_cache.h |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/browser/include/colors.h |
---|
File deleted |
/programs/cmm/browser/include/history.h |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/browser/include/unicode_tags.h |
---|
File deleted |
/programs/cmm/browser/include/menu_rmb.h |
---|
File deleted |
/programs/cmm/browser/include/parce_tag.h |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/browser/include |
---|
Property changes: |
Deleted: tsvn:logminsize |
-5 |
\ No newline at end of property |
/programs/cmm/browser/TWB.h |
---|
File deleted |
/programs/cmm/browser/HTMLv.c |
---|
20,7 → 20,6 |
#include "..\lib\lib.obj\box_lib.h" |
#include "..\lib\lib.obj\libio_lib.h" |
#include "..\lib\lib.obj\libimg_lib.h" |
#include "..\lib\list_box.h" |
//images |
#include "img\toolbar_icons.c" |
#include "img\URLgoto.txt"; |
60,6 → 59,7 |
int action_buf; |
#include "history.h" |
#include "..\TWB\TWB.c" |
#include "menu_rmb.h" |
123,16 → 123,16 |
{ |
if (lines.first==0) break; |
if (lines.first>3) lines.first-=2; ELSE lines.first=1; |
WB1.Scan(ID1); |
Scan(ID1); |
break; |
} |
if (m.vert==1) |
{ |
if(lines.visible+lines.first+3>=lines.all) WB1.Scan(181); |
if(lines.visible+lines.first+3>=lines.all) Scan(181); |
else |
{ |
lines.first+=2; |
WB1.Scan(ID2); |
Scan(ID2); |
} |
break; |
} |
165,7 → 165,7 |
} |
ELSE |
{ |
WB1.Scan(btn); |
Scan(btn); |
} |
break; |
case evKey: |
174,13 → 174,13 |
if (address_box.flags & 0b10) SWITCH(key) //åñëè àêòèâíà ñòðîêà àäðåñà èãíîðèðóåì íåêîòîðûå êíîïêè |
{ CASE 52: CASE 53: CASE 54: goto _EDIT_MARK; } |
WB1.Scan(key); |
Scan(key); |
_EDIT_MARK: |
if (key<>0x0d) && (key<>183) && (key<>184) {EAX=key<<8; edit_box_key stdcall(#address_box);} //àäðåñíàÿ ñòðîêà |
break; |
case evReDraw: |
if (action_buf) { WB1.Scan(action_buf); action_buf=0;} |
if (action_buf) { Scan(action_buf); action_buf=0;} |
Draw_Window(); |
break; |
default: |
244,4 → 244,150 |
} |
void Scan(int id) |
{ |
if (id >= 400) |
{ |
GetURLfromPageLinks(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; |
case 021: //Ctrl+U |
WB1.ReadHtml(_UTF); |
break; |
case 004: //Ctrl+D |
WB1.ReadHtml(_DOS); |
break; |
case 002: //free img cache |
FreeImgCache(); |
break; |
case BACK: |
if (!BrowserHistory.GoBack()) return; |
WB1.OpenPage(); |
return; |
case FORWARD: |
if (!BrowserHistory.GoForward()) return; |
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); |
return; |
case 054: //F5 |
IF(address_box.flags & 0b10) break; |
case REFRESH: |
if (GetProcessSlot(downloader_id)<>0) |
{ |
KillProcess(downloader_id); |
pause(20); |
Draw_Window(); |
return; |
} |
anchor_line_num=lines.first; //âåñ¸ëûé êîñòûëü :Ð |
anchor[0]='|'; |
WB1.OpenPage(); |
return; |
case 014: //Ctrl+N íîâîå îêíî |
case 020: //Ctrl+T íîâàÿ âêëàäêà |
case NEWTAB: |
MoveSize(190,80,OLD,OLD); |
RunProgram(#program_path, #URL); |
return; |
case HOME: |
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(); |
return; |
case SEARCHWEB: |
strcpy(#URL, #search_path); |
strcat(#URL, #editURL); |
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; |
case 184: //PgUp |
IF(lines.first == 0) return; |
lines.first -= lines.visible - 2; |
IF(lines.first < 0) lines.first = 0; |
break; |
case 180: //home |
IF(lines.first == 0) return; |
lines.first = 0; |
break; |
case 181: //end |
IF (lines.first == lines.all - lines.visible) return; |
lines.first = lines.all - lines.visible; |
break; |
default: |
return; |
} |
WB1.ParseHTML(buf); |
} |
stop: |
/programs/cmm/browser/history.h |
---|
0,0 → 1,59 |
struct UrlsHistory { |
dword CurrentUrl(); |
void AddUrl(); |
byte GoBack(); |
byte GoForward(); |
}; |
UrlsHistory BrowserHistory; |
struct path_string { |
char Item[4096]; |
}; |
#define MAX_HISTORY_NUM 40 |
path_string history_list[MAX_HISTORY_NUM]; |
int history_num; |
int history_current; |
dword UrlsHistory::CurrentUrl() |
{ |
return #history_list[history_current].Item; |
} |
void UrlsHistory::AddUrl() //òóò íóæåí ââîäèìûé ýëåìåíò - äëÿ óíèâåðñàëüíîñòè |
{ |
int i; |
if (history_num>0) && (!strcmp(#URL,#history_list[history_current].Item)) return; |
if (history_current>=MAX_HISTORY_NUM-1) |
{ |
history_current/=2; |
for (i=0; i<history_current; i++;) |
{ |
strlcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item, sizeof(history_list[0].Item)); |
} |
} |
history_current++; |
strlcpy(#history_list[history_current].Item, #URL, sizeof(history_list[0].Item)); |
history_num=history_current; |
} |
byte UrlsHistory::GoBack() |
{ |
if (history_current<=1) return 0; |
history_current--; |
strlcpy(#URL, #history_list[history_current].Item, sizeof(URL)); |
return 1; |
} |
byte UrlsHistory::GoForward() |
{ |
if (history_current==history_num) return 0; |
history_current++; |
strlcpy(#URL, #history_list[history_current].Item, sizeof(URL)); |
return 1; |
} |