From b30587c4a16ec97124e03fbf43e22bb6371ccfa9 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sun, 17 Jun 2012 12:03:52 +0000 Subject: [PATCH] HTMLv: some improvements git-svn-id: svn://kolibrios.org@2803 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/network/htmlv/browser/HTMLv.c-- | 12 +++- programs/network/htmlv/browser/TWB.h | 33 +++++------ .../network/htmlv/browser/include/menu_rmb.h | 58 +++++++++++-------- programs/network/htmlv/lib/kolibri.h-- | 13 +++-- 4 files changed, 66 insertions(+), 50 deletions(-) diff --git a/programs/network/htmlv/browser/HTMLv.c-- b/programs/network/htmlv/browser/HTMLv.c-- index 9eb189af22..3cbdadf653 100644 --- a/programs/network/htmlv/browser/HTMLv.c-- +++ b/programs/network/htmlv/browser/HTMLv.c-- @@ -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.y0x0d) && (key<>183) && (key<>184) && (key<>173) {EAX=key<<8; edit_box_key stdcall(#edit1);} //адресная строка break; case evReDraw: diff --git a/programs/network/htmlv/browser/TWB.h b/programs/network/htmlv/browser/TWB.h index 044ebedb36..3f05816f32 100644 --- a/programs/network/htmlv/browser/TWB.h +++ b/programs/network/htmlv/browser/TWB.h @@ -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); } diff --git a/programs/network/htmlv/browser/include/menu_rmb.h b/programs/network/htmlv/browser/include/menu_rmb.h index 0ce0bb5ca5..9639087b77 100644 --- a/programs/network/htmlv/browser/include/menu_rmb.h +++ b/programs/network/htmlv/browser/include/menu_rmb.h @@ -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(); + + GetProcessInfo(#MenuForm, SelfInfo); + id1=GetSlot(MenuForm.ID); + if (id1<>ActiveProcess()) ExitProcess(); - id=mm.y/ITEM_HEIGHT; - if (id<0) || (id+1>items_num) break; - if (items_cur<>id) + 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,10 +73,31 @@ void menu_rmb() _ITEMS_DRAW: for (i=0; iitems_cur) EDX=0xFFFFFF; else EDX=0x94AECE; DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, EDX); WriteText(8,i*ITEM_HEIGHT+6,0x80,0x000000,ITEMS_LIST[i],0); } } -} \ No newline at end of file +} + +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(); +} + + + + + diff --git a/programs/network/htmlv/lib/kolibri.h-- b/programs/network/htmlv/lib/kolibri.h-- index 4275de4d24..d69a0eb766 100644 --- a/programs/network/htmlv/lib/kolibri.h-- +++ b/programs/network/htmlv/lib/kolibri.h-- @@ -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