HTMLv small update

git-svn-id: svn://kolibrios.org@2248 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2011-09-30 09:19:41 +00:00
parent a31fabebfb
commit 18daa39152
4 changed files with 37 additions and 30 deletions

View File

@ -42,10 +42,6 @@ void main()
int btn; int btn;
byte key; byte key;
IF (param) copystr(#param,#URL);
BrowserHistory.AddUrl();
copystr(#URL,#editURL);
//Asper [ //Asper [
mem_Init(); mem_Init();
$or eax, eax $or eax, eax
@ -56,6 +52,11 @@ void main()
load_dll2(libimg, #libimg_init,1); load_dll2(libimg, #libimg_init,1);
load_dll2(boxlib, #edit_box_draw,0); load_dll2(boxlib, #edit_box_draw,0);
//] Asper //] Asper
IF (param) copystr(#param,#URL);
BrowserHistory.AddUrl();
copystr(#URL,#editURL);
SetEventMask(0x27); SetEventMask(0x27);
loop() loop()
{ {
@ -118,11 +119,12 @@ void Draw_Window()
{ {
WindowRedrawStatus(1); WindowRedrawStatus(1);
DefineAndDrawWindow(215,100,640,480,0x73,0x00E4DFE1,0,0,0); DefineAndDrawWindow(215,100,640,480,0x73,0x00E4DFE1,0,0,0);
WindowRedrawStatus(2);
Form.GetInfo(SelfInfo); Form.GetInfo(SelfInfo);
IF (Form.height==GetSkinWidth()+3) //åñëè ñâåðíóòî â çàãîëîâîê, íè÷åãî íå ðèñóåì IF (Form.height==GetSkinWidth()+3) //åñëè ñâåðíóòî â çàãîëîâîê, íè÷åãî íå ðèñóåì
{ {
DrawTitle(#header); DrawTitle(#header);
WindowRedrawStatus(2);
return; return;
} }
IF (Form.height<120) MoveSize(OLD,OLD,OLD,120); IF (Form.height<120) MoveSize(OLD,OLD,OLD,120);
@ -143,8 +145,6 @@ void Draw_Window()
WB1.width=Form.width-11; WB1.width=Form.width-11;
WB1.height=onTop(43,5); WB1.height=onTop(43,5);
WB1.Load(#URL); WB1.Load(#URL);
WindowRedrawStatus(2);
} }
int onLeft(dword right,left) {return Form.width-right-left;} int onLeft(dword right,left) {return Form.width-right-left;}

View File

@ -58,7 +58,8 @@ char line[330],
#include "include\unicode_tags.h--" #include "include\unicode_tags.h--"
void TWebBrowser::Scan(dword id) { void TWebBrowser::Scan(dword id) {
IF (id > 399) { IF (id > 399)
{
j = 0; j = 0;
FOR(i = 0; i <= id - 401; i++) { FOR(i = 0; i <= id - 401; i++) {
do j++; do j++;
@ -70,10 +71,11 @@ void TWebBrowser::Scan(dword id) {
Draw_Window(); Draw_Window();
return; return;
} }
//edit1.flags=64; //edit1.flags=64;
IF(count < max_kolvo_strok) SWITCH(id) { IF(count < max_kolvo_strok) SWITCH(id) //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè
CASE 183: CASE 184: CASE 180: CASE 181: return; { CASE 183: CASE 184: CASE 180: CASE 181: return; }
} //åñëè ìàëî ñòðîê èãíîðèðóåì íåêîòîðûå êíîïêè
switch (id) switch (id)
{ {
case 011: //Ctrk+K case 011: //Ctrk+K
@ -100,24 +102,26 @@ void TWebBrowser::Scan(dword id) {
return; return;
case HOME: case HOME:
copystr("/sys/index.htm", #editURL); copystr("/sys/index.htm", #editURL);
case 052: //Íàæàòà F3
IF(edit1.flags <> 66)
IF (strcmp(get_URL_part(5),"http:")<>0) RunProgram("tinypad", #URL); ELSE RunProgram("tinypad", #download_path);
return;
case GOTOURL: case GOTOURL:
case 0x0D: //enter case 0x0D: //enter
copystr(#editURL, #URL); copystr(#editURL, #URL);
Load(#URL); Load(#URL);
return; return;
case 052: //Íàæàòà F3
IF(edit1.flags <> 66)
IF (strcmp(get_URL_part(5),"http:")<>0) RunProgram("tinypad", #URL); ELSE RunProgram("tinypad", #download_path);
break;
case 173: //ctrl+enter case 173: //ctrl+enter
case SEARCHWEB: case SEARCHWEB:
copystr(#search_path, #URL); copystr(#search_path, #URL);
copystr(#editURL, #URL + strlen(#URL)); copystr(#editURL, #URL + strlen(#URL));
Load(#URL); Load(#URL);
return; return;
case ID1: //ìîòàåì ââåðõ case ID1: //ìîòàåì ââåðõ
IF(za_kadrom > 0) za_kadrom--; IF(za_kadrom <= 0) return;
ELSE return; za_kadrom--;
break; break;
case ID2: //ìîòàåì âíèç case ID2: //ìîòàåì âíèç
IF(max_kolvo_strok + za_kadrom >= count) return; IF(max_kolvo_strok + za_kadrom >= count) return;
@ -125,19 +129,20 @@ void TWebBrowser::Scan(dword id) {
break; break;
case 183: //PgDown case 183: //PgDown
IF(za_kadrom == count - max_kolvo_strok) return; IF(za_kadrom == count - max_kolvo_strok) return;
za_kadrom = za_kadrom + max_kolvo_strok + 2; za_kadrom += max_kolvo_strok + 2;
IF(max_kolvo_strok + za_kadrom > count) za_kadrom = count - max_kolvo_strok; IF(max_kolvo_strok + za_kadrom > count) za_kadrom = count - max_kolvo_strok;
BREAK; BREAK;
case 184: //PgUp case 184: //PgUp
IF(za_kadrom == 0) RETURN; IF(za_kadrom == 0) RETURN;
za_kadrom = za_kadrom - max_kolvo_strok - 2; za_kadrom -= max_kolvo_strok - 2;
IF(za_kadrom < 0) za_kadrom = 0; IF(za_kadrom < 0) za_kadrom = 0;
BREAK; BREAK;
case 180: //home case 180: //home
IF (za_kadrom <>0) za_kadrom = 0; IF(za_kadrom == 0) RETURN;
ELSE RETURN; za_kadrom = 0;
BREAK; BREAK;
case 181: //end case 181: //end
IF (za_kadrom == count - max_kolvo_strok) RETURN;
za_kadrom = count - max_kolvo_strok; za_kadrom = count - max_kolvo_strok;
BREAK; BREAK;
default: default:
@ -163,7 +168,7 @@ void TWebBrowser::DrawScroller() {
IF(za_kadrom + max_kolvo_strok >= count) on_y = height - scroll_size + top - 17; IF(za_kadrom + max_kolvo_strok >= count) on_y = height - scroll_size + top - 17;
ELSE on_y = height - 32 * za_kadrom / count + top + 16; ELSE on_y = height - 32 * za_kadrom / count + top + 16;
DrawFlatButton(left + width - 15, on_y, 16, scroll_size, 0, 0xE4DFE1, ""); //ïîëçóíîê DrawFlatButton(left + width - 15, on_y, 16, scroll_size, 0, 0xE4DFE1, ""); //ïîëçóíîê
IF(on_y > top + 17) DrawBar(left + width - 14, top + 17, 16, on_y - top - 17, 0xCED0D0); //ïîëå äî ïîëçóíêà IF(on_y > top + 17) DrawBar(left + width - 14, top + 17, 16, on_y - top - 17, 0xCED0D0); //ïîëå äî ïîëçóíêà
IF(height - scroll_size + top - 17 > on_y) IF(height - scroll_size + top - 17 > on_y)
DrawBar(left + width - 14, on_y + scroll_size + 1, 16, height - scroll_size - on_y + top - 18, 0xCED0D0); //ïîëå ïîñëå ïîëçóíêà DrawBar(left + width - 14, on_y + scroll_size + 1, 16, height - scroll_size - on_y + top - 18, 0xCED0D0); //ïîëå ïîñëå ïîëçóíêà
} }
@ -212,7 +217,7 @@ void HttpLoad()
ELSE file_size stdcall (#URL); ELSE file_size stdcall (#URL);
*/ */
void ReadHtml(byte DO_LOAD) void ReadHtml()
{ {
if (!strcmp(get_URL_part(5),"http:"))) if (!strcmp(get_URL_part(5),"http:")))
file_size stdcall (#download_path); file_size stdcall (#download_path);
@ -249,7 +254,8 @@ void TWebBrowser::Load(dword adress) {
edit1.size = edit1.pos = strlen(#editURL); edit1.size = edit1.pos = strlen(#editURL);
edit_box_draw stdcall(#edit1); //ðèñóåì ñòðîêó àäðåñà edit_box_draw stdcall(#edit1); //ðèñóåì ñòðîêó àäðåñà
ReadHtml(LETS_LOAD); //LETS_LOAD
ReadHtml();
IF (!filesize) return; //Lee 22.09 IF (!filesize) return; //Lee 22.09
@ -723,17 +729,17 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
IF (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8")) IF (!strcmp(#options,"utf-8")) || (!strcmp(#options,"utf8"))
{ {
ReadHtml(DONT_LOAD); ReadHtml();
utf8rutodos(buf); utf8rutodos(buf);
} }
IF(!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u")) IF(!strcmp(#options, "koi8-r")) || (!strcmp(#options, "koi8-u"))
{ {
ReadHtml(DONT_LOAD); ReadHtml();
koitodos(buf); koitodos(buf);
} }
IF(!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866")) IF(!strcmp(#options, "dos")) || (!strcmp(#options, "cp-866"))
{ {
ReadHtml(DONT_LOAD); ReadHtml();
} }
} }
IF(tagparam) IF(tagparam)

View File

@ -13,9 +13,6 @@
#define DOS 1 #define DOS 1
#define KOI 2 #define KOI 2
#define UTF 3 #define UTF 3
#define DONT_LOAD 0
#define LETS_LOAD 1
dword get_URL_part(byte len) { dword get_URL_part(byte len) {

View File

@ -22,6 +22,8 @@ char *unicode_tags[]={
"copy", "(c)", "copy", "(c)",
"#169", "(c)", "#169", "(c)",
"trade", "[TM]",
"reg", "(r)", "reg", "(r)",
"#174", "(r)", "#174", "(r)",
@ -38,6 +40,7 @@ char *unicode_tags[]={
"minus", "-", "minus", "-",
"ndash", "-", "ndash", "-",
"mdash", "-", //--
"#8722", "-", "#8722", "-",
"#8211", "-", "#8211", "-",
"#151", "-", "#151", "-",
@ -68,6 +71,7 @@ char *unicode_tags[]={
"#1031","\244", "#1031","\244",
"#8470","N", "#8470","N",
"bull", "-", //¢®®¡é¥ §¤¥áì â®çª 
"percnt","%", "percnt","%",
0}; 0};