HTMLv 0.97.5: switch to TryeType fonts

git-svn-id: svn://kolibrios.org@3005 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2012-11-05 16:10:14 +00:00
parent cfa3ea094a
commit 5b833a1058
5 changed files with 38 additions and 25 deletions

View File

@ -14,13 +14,14 @@
#include "..\lib\libimg_lib.h" #include "..\lib\libimg_lib.h"
#include "..\lib\edit_box_lib.h" #include "..\lib\edit_box_lib.h"
#include "..\lib\scroll_lib.h" #include "..\lib\scroll_lib.h"
#include "..\lib\ttf_fonts.h" #include "..\lib\truetype.h"
//êàðòèíêè //êàðòèíêè
#include "img\toolbar_icons.c" #include "img\toolbar_icons.c"
#include "img\URLgoto.txt"; #include "img\URLgoto.txt";
#define URL param #define URL param
int use_truetype = 0;
char editURL[sizeof(URL)], char editURL[sizeof(URL)],
page_links[12000], page_links[12000],
@ -55,11 +56,11 @@ void main()
int scroll_used=0; int scroll_used=0;
mem_Init(); mem_Init();
load_dll2(libio, #libio_init,1); if (load_dll2(libio, #libio_init,1)!=0) debug("Íå óäàëîñü ïîäêëþ÷èòü áèáëèîòåêó libio."w);
load_dll2(libimg, #libimg_init,1); if (load_dll2(libimg, #libimg_init,1)!=0) debug("Íå óäàëîñü ïîäêëþ÷èòü áèáëèîòåêó libimg."w);
load_dll2(boxlib, #edit_box_draw,0); if (load_dll2(boxlib, #edit_box_draw,0)!=0) debug("Íå óäàëîñü ïîäêëþ÷èòü áèáëèîòåêó boxlib."w);
load_dll2(#abox_lib, #boxlib_init,0); load_dll2(#abox_lib, #boxlib_init,0);
//load_dll2(libtruetype, #truetype,0); if (load_dll2(libtruetype, #truetype,0)!=0) debug("Íå óäàëîñü ïîäêëþ÷èòü áèáëèîòåêó TrueType."w);
if (!URL) strcpy(#URL, "/sys/home.htm"); if (!URL) strcpy(#URL, "/sys/home.htm");
strcpy(#editURL, #URL); strcpy(#editURL, #URL);

View File

@ -1,3 +1,6 @@
05.11.12 - 0.97.5
Переключалка на шрифты TrueType из меню ПКМ.
16.07.12 - 0.97 16.07.12 - 0.97
- небольшие улучшения в обработке ссылок и изображений; - небольшие улучшения в обработке ссылок и изображений;
- включение обработки разрывов строк через меню; - включение обработки разрывов строк через меню;

View File

@ -8,7 +8,7 @@ dword
char download_path[]="/rd/1/.download"; char download_path[]="/rd/1/.download";
char search_path[]="http://nigma.ru/index.php?s="; char search_path[]="http://nigma.ru/index.php?s=";
char version[]=" Text-based Browser 0.97"; char version[]=" Text-based Browser 0.97.5";
struct TWebBrowser { struct TWebBrowser {
@ -119,6 +119,9 @@ void TWebBrowser::Scan(int id)
if (!pre_text) pre_text=2; if (!pre_text) pre_text=2;
else pre_text=0; else pre_text=0;
break; break;
case 005: //truetype
if (use_truetype == 1) use_truetype=0; else use_truetype=1;
break;
case BACK: case BACK:
if (!BrowserHistory.GoBack()) return; if (!BrowserHistory.GoBack()) return;
OpenPage(); OpenPage();
@ -130,9 +133,6 @@ void TWebBrowser::Scan(int id)
case 052: //Íàæàòà F3 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; 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 case 054: //F5
IF(edit1.flags == 66) break; IF(edit1.flags == 66) break;
case REFRESH: case REFRESH:
@ -180,22 +180,22 @@ void TWebBrowser::Scan(int id)
IF(lines.first == lines.all - lines.visible) return; IF(lines.first == lines.all - lines.visible) return;
lines.first += lines.visible + 2; lines.first += lines.visible + 2;
IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible; IF(lines.visible + lines.first > lines.all) lines.first = lines.all - lines.visible;
BREAK; break;
case 184: //PgUp case 184: //PgUp
IF(lines.first == 0) RETURN; IF(lines.first == 0) return;
lines.first -= lines.visible - 2; lines.first -= lines.visible - 2;
IF(lines.first < 0) lines.first = 0; IF(lines.first < 0) lines.first = 0;
BREAK; break;
case 180: //home case 180: //home
IF(lines.first == 0) RETURN; IF(lines.first == 0) return;
lines.first = 0; lines.first = 0;
BREAK; break;
case 181: //end case 181: //end
IF (lines.first == lines.all - lines.visible) RETURN; IF (lines.first == lines.all - lines.visible) return;
lines.first = lines.all - lines.visible; lines.first = lines.all - lines.visible;
BREAK; break;
default: default:
RETURN; return;
} }
ParseHTML(buf); ParseHTML(buf);
} }
@ -540,10 +540,17 @@ void TWebBrowser::DrawPage() //
start_y=stroka * 10 + top + 5; start_y=stroka * 10 + top + 5;
line_length=strlen(#line)*6; line_length=strlen(#line)*6;
WriteText(start_x, start_y, 0x80, text_colors[text_color_index], #line, 0); if (use_truetype == 1)
{
//line_length = get_length stdcall (#line,-1,16,line_length); //line_length = get_length stdcall (#line,-1,16,line_length);
//text_out stdcall (#line, -1, 17, text_colors[text_color_index], start_x, start_y-2); text_out stdcall (#line, -1, 17, text_colors[text_color_index], start_x, start_y-3);
Pause(10);
}
else
{
WriteText(start_x, start_y, 0x80, text_colors[text_color_index], #line, 0);
IF (b_text) { $add ebx, 1<<16 $int 0x40 } IF (b_text) { $add ebx, 1<<16 $int 0x40 }
}
IF (i_text) Skew(start_x, start_y, line_length+6, 10); IF (i_text) Skew(start_x, start_y, line_length+6, 10);
IF (s_text) DrawBar(start_x, start_y + 4, line_length, 1, text_colors[text_color_index]); IF (s_text) DrawBar(start_x, start_y + 4, line_length, 1, text_colors[text_color_index]);
IF (u_text) DrawBar(start_x, start_y + 8, line_length, 1, text_colors[text_color_index]); IF (u_text) DrawBar(start_x, start_y + 8, line_length, 1, text_colors[text_color_index]);

View File

@ -2,5 +2,5 @@
del HTMLv del HTMLv
rename HTMLv.com HTMLv rename HTMLv.com HTMLv
rem ..\C--\kpack HTMLv rem ..\C--\kpack HTMLv
pause
del warning.txt del warning.txt
pause

View File

@ -5,11 +5,12 @@
char *ITEMS_LIST[]={ char *ITEMS_LIST[]={
"View in Tinypad F3",52, "View in Tinypad F3",52,
"View in TextEdit F4",53, "WIN F5",REFRESH,
"DOS Ctrl+D",04,
"KOI-8 Ctrl+K",11, "KOI-8 Ctrl+K",11,
"UTF Ctrl+U",21, "UTF Ctrl+U",21,
"DOS Ctrl+D",04,
"Line breaks ON" ,01, "Line breaks ON" ,01,
"TrueType fonts" ,05,
0}; 0};
@ -88,6 +89,7 @@ void menu_rmb()
DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, EDX); DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, EDX);
WriteText(8,i*ITEM_HEIGHT+6,0x80,0x000000,ITEMS_LIST[i*2],0); WriteText(8,i*ITEM_HEIGHT+6,0x80,0x000000,ITEMS_LIST[i*2],0);
if (ITEMS_LIST[i*2+1]==1) && (pre_text==2) DrawBar(ITEM_WIDTH-18, i*ITEM_HEIGHT+8, 4, 4, 0x444444); if (ITEMS_LIST[i*2+1]==1) && (pre_text==2) DrawBar(ITEM_WIDTH-18, i*ITEM_HEIGHT+8, 4, 4, 0x444444);
if (ITEMS_LIST[i*2+1]==5) && (use_truetype==1) DrawBar(ITEM_WIDTH-18, i*ITEM_HEIGHT+8, 4, 4, 0x444444);
} }
} }
} }