forked from KolibriOS/kolibrios
HTMLv: some improvements
git-svn-id: svn://kolibrios.org@2803 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3bb023473d
commit
b30587c4a1
@ -63,8 +63,6 @@ void main()
|
||||
switch(EAX & 0xFF)
|
||||
{
|
||||
CASE evMouse:
|
||||
edit_box_mouse stdcall (#edit1);
|
||||
|
||||
/*scrollbar_v_mouse (#scroll1); //êîí÷åíûé ñêğîëë ïğèòîğìàæèìàåò, èä¸ì "ñâîèì ïóò¸ì"
|
||||
if (za_kadrom <> scroll1.position)
|
||||
{
|
||||
@ -72,15 +70,17 @@ void main()
|
||||
WB1.ParseHTML(buf, filesize);
|
||||
//break;
|
||||
};*/
|
||||
|
||||
btn=GetSlot(Form.ID);
|
||||
IF (btn<>ActiveProcess()) break; //åñëè îêíî íå àêòèâíî íà ñîáûòèÿ ìûøè íå ğåàãèğóåì
|
||||
|
||||
edit_box_mouse stdcall (#edit1);
|
||||
|
||||
m.get();
|
||||
|
||||
if (m.pkm) && (m.y>WB1.top) && (m.y<Form.height) && (filesize)
|
||||
{
|
||||
CreateThread(#menu_rmb,#stak);
|
||||
break;
|
||||
}
|
||||
|
||||
IF (m.vert==65535) //ïğîêğóòêà êîë¸ñèêîì
|
||||
@ -130,7 +130,13 @@ void main()
|
||||
break;
|
||||
case evKey:
|
||||
key = GetKey();
|
||||
|
||||
if (edit1.flags == 66) || (edit1.flags == 98) SWITCH(key) //åñëè àêòèâíà ñòðîêà àäðåñà èãíîðèðóåì íåêîòîðûå êíîïêè
|
||||
{ CASE 52: CASE 53: CASE 54: goto _EDIT_MARK; }
|
||||
|
||||
WB1.Scan(key);
|
||||
|
||||
_EDIT_MARK:
|
||||
IF (key<>0x0d) && (key<>183) && (key<>184) && (key<>173) {EAX=key<<8; edit_box_key stdcall(#edit1);} //àäğåñíàÿ ñòğîêà
|
||||
break;
|
||||
case evReDraw:
|
||||
|
@ -9,10 +9,7 @@ dword j,
|
||||
|
||||
char download_path[]="/rd/1/.download";
|
||||
char search_path[]="http://nigma.ru/index.php?s=";
|
||||
char version[]=" Text-based Browser 0.93b";
|
||||
|
||||
char tinypad_path[]="/sys/tinypad";
|
||||
char t_edit_path[]="/sys/develop/t_edit";
|
||||
char version[]=" Text-based Browser 0.93e";
|
||||
|
||||
|
||||
struct TWebBrowser {
|
||||
@ -54,7 +51,8 @@ int anchor_line_num;
|
||||
#include "include\some_code.h"
|
||||
|
||||
|
||||
void TWebBrowser::Scan(int id) {
|
||||
void TWebBrowser::Scan(int id)
|
||||
{
|
||||
if (id > 399)
|
||||
{
|
||||
GetURLfromPageLinks(id);
|
||||
@ -92,7 +90,6 @@ void TWebBrowser::Scan(int id) {
|
||||
return;
|
||||
}
|
||||
|
||||
//edit1.flags=64;
|
||||
IF(count < max_kolvo_strok) SWITCH(id) //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè
|
||||
{ CASE 183: CASE 184: CASE 180: CASE 181: return; }
|
||||
|
||||
@ -114,6 +111,12 @@ void TWebBrowser::Scan(int id) {
|
||||
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 053: //Íàæàòà F4
|
||||
if (strcmp(get_URL_part(5),"http:")<>0) RunProgram("/rd/1/develop/t_edit", #URL); else RunProgram("/rd/1/develop/t_edit", #download_path);
|
||||
return;
|
||||
case 054: //F5
|
||||
IF(edit1.flags == 66) break;
|
||||
case REFRESH:
|
||||
@ -124,7 +127,9 @@ void TWebBrowser::Scan(int id) {
|
||||
Draw_Window();
|
||||
return;
|
||||
}
|
||||
OpenPage(); //îò ñåðäöà îòðûâàþ, çäåñü íóæíî za_kadrom ñòàðîå
|
||||
anchor_line_num=za_kadrom; //âåñ¸ëûé êîñòûëü :Ð
|
||||
anchor[0]='|';
|
||||
OpenPage();
|
||||
return;
|
||||
case 014: //Ctrl+N íîâîå îêíî
|
||||
case 020: //Ctrl+T íîâàÿ âêëàäêà
|
||||
@ -132,14 +137,6 @@ void TWebBrowser::Scan(int id) {
|
||||
MoveSize(190,80,OLD,OLD);
|
||||
RunProgram(#program_path, #URL);
|
||||
return;
|
||||
case 052: //Íàæàòà F3
|
||||
IF(edit1.flags <> 66)
|
||||
IF (!strcmp(get_URL_part(5),"http:")) RunProgram(#tinypad_path, #download_path); ELSE RunProgram(#tinypad_path, #URL);
|
||||
return;
|
||||
case 053: //Íàæàòà F4
|
||||
IF(edit1.flags <> 66)
|
||||
IF (!strcmp(get_URL_part(5),"http:")) RunProgram(#t_edit_path, #download_path); ELSE RunProgram(#t_edit_path, #URL);
|
||||
return;
|
||||
|
||||
case HOME:
|
||||
copystr("http://kolibri-os.narod.ru", #editURL);
|
||||
@ -256,7 +253,7 @@ void OpenPage()
|
||||
Pause(60);
|
||||
if (GetProcessSlot(downloader_id)<>0)
|
||||
{
|
||||
WriteDebug("Browser Hack v2.0: Killing downloader and trying to run it one more!");
|
||||
debug("Browser Hack v2.0: Killing downloader and trying to run it one more!");
|
||||
KillProcess(downloader_id); //óáèâàåì ñòàðûé ïðîöåññ
|
||||
downloader_id = RunProgram("/sys/network/downloader", #URL);
|
||||
}
|
||||
@ -536,7 +533,7 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
|
||||
IF(!chTag("q")) copystr("\"", #line + strlen(#line));
|
||||
|
||||
//âûâîä íà ýêðàí
|
||||
if (stroka >= 0) && (stroka - 2 < max_kolvo_strok) && (line)
|
||||
if (stroka >= 0) && (stroka - 2 < max_kolvo_strok) && (line) && (!anchor)
|
||||
{
|
||||
WriteText(stolbec * 6 + left1, top1, 0x80, text_colors[text_color_index], #line, 0); //ìîæåò òóò ðèñîâàòü áåëóþ ñòðîêó?
|
||||
IF (b_text) { $add ebx, 1<<16 $int 0x40 }
|
||||
@ -803,7 +800,7 @@ void TextGoDown(int left1, top1, width1)
|
||||
IF(blq_text == 1) stolbec = 8;
|
||||
ELSE stolbec = 0;
|
||||
IF(li_text == 1) stolbec = li_tab * 5;
|
||||
IF(stroka >= 0) && (stroka - 2 < max_kolvo_strok) DrawBar(left1 - 5, top1 + 10, width1 + 5, 10, bg_color);
|
||||
IF(stroka >= 0) && (stroka - 2 < max_kolvo_strok) && (!anchor) DrawBar(left1 - 5, top1 + 10, width1 + 5, 10, bg_color);
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
char *ITEMS_LIST[]={
|
||||
"View in Tinypad F3",
|
||||
"View in TextEdit F4",
|
||||
"--------------------", //ñäåëàòü îïðåäåëåíèå òàêèõ ëèíèé è ðèñîâàòü èõ
|
||||
"-",
|
||||
"KOI-8 Ctrl+K",
|
||||
"UTF Ctrl+U",
|
||||
0};
|
||||
@ -19,38 +19,31 @@ void menu_rmb()
|
||||
|
||||
mouse mm;
|
||||
int items_num, items_cur;
|
||||
byte id, key;
|
||||
int id1, key;
|
||||
|
||||
SetEventMask(100111b);
|
||||
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
case evMouse:
|
||||
mm.get();
|
||||
if (mm.lkm) || (mm.pkm)
|
||||
if (mm.x>ITEM_WIDTH) || (mm.y>items_num*ITEM_HEIGHT+1) ExitProcess();
|
||||
|
||||
id=mm.y/ITEM_HEIGHT;
|
||||
if (id<0) || (id+1>items_num) break;
|
||||
if (items_cur<>id)
|
||||
GetProcessInfo(#MenuForm, SelfInfo);
|
||||
id1=GetSlot(MenuForm.ID);
|
||||
if (id1<>ActiveProcess()) ExitProcess();
|
||||
|
||||
id1=mm.y/ITEM_HEIGHT;
|
||||
if (id1<0) || (id1+1>items_num) || (mm.x<0) || (mm.x>ITEM_WIDTH) break;
|
||||
if (items_cur<>id1)
|
||||
{
|
||||
items_cur=id;
|
||||
items_cur=id1;
|
||||
goto _ITEMS_DRAW;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
if (id==1) ExitProcess();
|
||||
_BUTTON_MARK:
|
||||
if (id==10) WB1.Scan(52); //View html code
|
||||
if (id==11) WB1.Scan(53); //View html code
|
||||
if (id==12) break;
|
||||
if (id==13) WB1.Scan(11); //KOI
|
||||
if (id==14) WB1.Scan(21); //UTF
|
||||
|
||||
ExitProcess();
|
||||
ItemProcess(GetButtonID());
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
@ -68,9 +61,7 @@ void menu_rmb()
|
||||
}
|
||||
if (key==13)
|
||||
{
|
||||
id=items_cur+10;
|
||||
//WriteDebug(IntToStr(id));
|
||||
goto _BUTTON_MARK;
|
||||
ItemProcess(items_cur+10);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -82,6 +73,12 @@ void menu_rmb()
|
||||
_ITEMS_DRAW:
|
||||
for (i=0; i<items_num; i++;)
|
||||
{
|
||||
if (!strcmp(ITEMS_LIST[i],"-"))
|
||||
{
|
||||
DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, 0xFFFFFF);
|
||||
DrawBar(1, i*ITEM_HEIGHT+1+9, ITEM_WIDTH-1, 1, 0x999999);
|
||||
continue;
|
||||
}
|
||||
DefineButton(0, i*ITEM_HEIGHT, ITEM_WIDTH, ITEM_HEIGHT, i+10+BT_HIDE, 0xFFFFFF);
|
||||
if (i<>items_cur) EDX=0xFFFFFF; else EDX=0x94AECE;
|
||||
DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, EDX);
|
||||
@ -89,3 +86,18 @@ void menu_rmb()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ItemProcess(int num_id)
|
||||
{
|
||||
if (num_id==10) WB1.Scan(52);
|
||||
if (num_id==11) WB1.Scan(53);
|
||||
//-----------------------
|
||||
if (num_id==13) WB1.Scan(11); //KOI
|
||||
if (num_id==14) WB1.Scan(21); //UTF
|
||||
ExitProcess();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -181,7 +181,7 @@ inline fastcall ExitProcess(){
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
inline fastcall KillProcess(dword ECX){
|
||||
inline fastcall int KillProcess(dword ECX){
|
||||
$mov eax,18;
|
||||
$mov ebx,18;
|
||||
$int 0x40
|
||||
@ -206,9 +206,11 @@ inline fastcall void DrawTitle(dword ECX)
|
||||
|
||||
inline fastcall dword GetSkinWidth()
|
||||
{
|
||||
EAX = 48;
|
||||
EBX = 4;
|
||||
$push ebx
|
||||
$mov eax,48
|
||||
$mov ebx,4
|
||||
$int 0x40
|
||||
$pop ebx
|
||||
}
|
||||
|
||||
inline fastcall void SetSystemSkin(ECX){
|
||||
@ -373,7 +375,7 @@ void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaC
|
||||
}
|
||||
|
||||
|
||||
inline fastcall dword CreateThread(dword ECX,EDX)
|
||||
inline fastcall int CreateThread(dword ECX,EDX)
|
||||
{
|
||||
EAX = 51;
|
||||
EBX = 1;
|
||||
@ -493,13 +495,12 @@ void DrawFlatButton(dword x,y,width,height,id,color,text)
|
||||
PutPixel(px + x, y - py, 0);
|
||||
px = py / r + px;
|
||||
py = -px / r + py;
|
||||
//Pause(1);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
inline fastcall dword WriteDebug(dword EDX)
|
||||
inline fastcall void debug(dword EDX)
|
||||
{
|
||||
$push ebx
|
||||
$push ecx
|
||||
|
Loading…
Reference in New Issue
Block a user