diff --git a/programs/cmm/browser/HTMLv.c b/programs/cmm/browser/HTMLv.c
index e4fcd64c42..6871b7f8e3 100644
--- a/programs/cmm/browser/HTMLv.c
+++ b/programs/cmm/browser/HTMLv.c
@@ -16,14 +16,25 @@
#include "..\lib\lib.obj\box_lib.h"
#include "..\lib\lib.obj\libio_lib.h"
#include "..\lib\lib.obj\libimg_lib.h"
-#include "..\lib\lib.obj\truetype.h"
+#include "..\lib\list_box.h"
//images
#include "img\toolbar_icons.c"
#include "img\URLgoto.txt";
+#ifndef AUTOBUILD
+ #include "lang.h--"
+#endif
+
+#ifdef LANG_RUS
+ char version[]=" ’ҐЄбв®ўл© Ўа 㧥а 0.99.08";
+ ?define IMAGES_CACHE_CLEARED "Љни Є авЁ®Є ®зЁйҐ"
+#else
+ char version[]=" Text-based Browser 0.99.08";
+ ?define IMAGES_CACHE_CLEARED "Images cache cleared"
+#endif
+
#define URL param
-int use_truetype = 0;
char fontlol[64];
char editURL[sizeof(URL)],
@@ -47,6 +58,8 @@ proc_info Form;
char stak[512];
mouse m;
+int action_buf;
+
#include "TWB.h"
#include "include\menu_rmb.h"
@@ -55,14 +68,12 @@ void main()
{
int btn, key;
int half_scroll_size;
- int scroll_used=0;
+ int scroll_used=0, show_menu;
mem_Init();
if (load_dll2(boxlib, #box_lib_init,0)!=0) {notify("System Error: library doesn't exists /rd/1/lib/box_lib.obj"); ExitProcess();}
if (load_dll2(libio, #libio_init,1)!=0) debug("Error: library doesn't exists - libio"w);
if (load_dll2(libimg, #libimg_init,1)!=0) debug("Error: library doesn't exists - libimg"w);
- if (load_dll2(libtruetype, #truetype,0)!=0) {debug("Warning: library doesn't exists - TrueType"w); use_truetype = 2; }
- else init_font(#fontlol);
if (!URL) strcpy(#URL, "/sys/index.htm");
strcpy(#editURL, #URL);
@@ -88,20 +99,28 @@ void main()
};*/
btn=GetProcessSlot(Form.ID);
- if (btn<>GetActiveProcess()) break; //если окно не активно на события мыши не реагируем
+ if (btn<>GetActiveProcess()) break;
edit_box_mouse stdcall (#address_box);
m.get();
- if (m.pkm) && (m.y>WB1.top) && (m.y
WB1.top) && (m.y3) lines.first-=2; ELSE lines.first=1;
@@ -111,7 +130,8 @@ void main()
if (m.vert==1)
{
if(lines.visible+lines.first+3>=lines.all) WB1.Scan(181);
- ELSE {
+ else
+ {
lines.first+=2;
WB1.Scan(ID2);
}
@@ -120,11 +140,11 @@ void main()
if (!m.lkm) scroll_used=0;
if (m.x>=scroll1.start_x) && (m.x<=scroll1.start_x+scroll1.size_x)
- && (m.y>=scroll1.start_y+scroll1.btn_height) && (-scroll1.btn_height+scroll1.start_y+scroll1.size_y>m.y)
- && (lines.all>lines.visible) && (m.lkm)
- {
- scroll_used=1;
- }
+ && (m.y>=scroll1.start_y+scroll1.btn_height) && (-scroll1.btn_height+scroll1.start_y+scroll1.size_y>m.y)
+ && (lines.all>lines.visible) && (m.lkm)
+ {
+ scroll_used=1;
+ }
if (scroll_used)
{
@@ -161,6 +181,7 @@ void main()
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;}
Draw_Window();
break;
default:
diff --git a/programs/cmm/browser/History.txt b/programs/cmm/browser/History.txt
index 4e685c72a2..2ba92a7a4f 100644
--- a/programs/cmm/browser/History.txt
+++ b/programs/cmm/browser/History.txt
@@ -1,3 +1,7 @@
+15.10.13 - 0.99.08
+- улучшенное меню
+- мультиязычность
+
08.10.13 - 0.99.04
- поддержка относительных путей
- исправления для скроллбара
diff --git a/programs/cmm/browser/TWB.h b/programs/cmm/browser/TWB.h
index c9321073ec..de01f14c5a 100644
--- a/programs/cmm/browser/TWB.h
+++ b/programs/cmm/browser/TWB.h
@@ -9,18 +9,6 @@ dword
char download_path[]="/rd/1/.download";
char search_path[]="http://nigma.ru/index.php?s=";
-#ifndef AUTOBUILD
- #include "lang.h--"
-#endif
-
-#ifdef LANG_RUS
- char version[]=" ’ҐЄбв®ўл© Ўа 㧥а 0.99.07";
-#else
- char version[]=" Text-based Browser 0.99.07";
-#endif
-
-
-
struct TWebBrowser {
int left, top, width, height, line_h;
@@ -130,15 +118,7 @@ void TWebBrowser::DrawPage()
start_y = stroka * 10 + top + magrin_left;
line_length = strlen(#line) * 6;
- if (use_truetype == 1)
- {
- //line_length = get_length stdcall (#line,-1,16,line_length);
- text_out stdcall (#line, #fontlol, 17, text_colors[text_color_index], start_x, start_y-3);
- }
- else
- {
- WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, drawbuf);
- }
+ WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, drawbuf);
IF (b_text) WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, drawbuf);
IF (i_text) DrawBufSkew(start_x, 0, line_length, line_h);
IF (s_text) DrawBufBar(start_x, 4, line_length, 1, text_colors[text_color_index]);
@@ -215,14 +195,6 @@ void TWebBrowser::Scan(int id)
case 002: //free img cache
FreeImgCache();
break;
- case 005: //truetype
- if (use_truetype == 2)
- {
- RunProgram("@notify", "Library does not exists /rd/1/lib/truetype.obj"w);
- return;
- }
- if (use_truetype == 1) use_truetype=0; else use_truetype=1;
- break;
case BACK:
if (!BrowserHistory.GoBack()) return;
OpenPage();
@@ -443,11 +415,11 @@ void TWebBrowser::ParseHTML(dword bword){
link_color = 0x0000FF;
bg_color = 0xFFFFFF;
DrawBufFill();
- line = NULL;
strcpy(#page_links,"|");
strcpy(#header, #version);
stroka = -lines.first;
stolbec = 0;
+ line = 0;
if (pre_text<>2)
{
@@ -784,31 +756,6 @@ void TWebBrowser::WhatTextStyle(int left1, top1, width1) {
DrawBufBar(5, WB1.line_h/2, WB1.width-10, 1, hr_color);
TextGoDown(left1, top1+WB1.line_h, width1);
}
- /*
- if (!chTag("input"))
- {
- do{
- if (!strcmp(#parametr, "type="))
- {
- if ((!strcmp(#options, "radio")) || (!strcmp(#options, "checkbox")))
- {
- if (!anchor) && (stroka > 0) CheckBox(stolbec*6 + left1,top1-2,10,10, 0, "\0", 0x888888, text_colors[text_color_index], 0);
- stolbec+=2;
- }
- if ((!strcmp(#options, "text")) || (!strcmp(#options, "password")))
- {
- if (!anchor) && (stroka > 0) CheckBox(stolbec*6 + left1,top1-2,90,10, 0, "\0", 0x555555, 0, 0);
- stolbec+=16;
- }
- if ((!strcmp(#options, "button")) || (!strcmp(#options, "file")) || (!strcmp(#options, "submit")))
- {
- if (!anchor) && (stroka > 0) DrawCaptButton(stolbec*6 + left1,top1-2,60,10, 0, 0xCCCccc, 0, "Button");
- stolbec+=21;
- }
- }
- } while(GetNextParam());
- }
- */
if (!chTag("img"))
{
Images( left1, top1, width1);
diff --git a/programs/cmm/browser/include/img_cache.h b/programs/cmm/browser/include/img_cache.h
index cef9593abf..00b455bf40 100644
--- a/programs/cmm/browser/include/img_cache.h
+++ b/programs/cmm/browser/include/img_cache.h
@@ -24,6 +24,7 @@ void FreeImgCache()
if (pics[num_of_pics].image) img_destroy stdcall (pics[num_of_pics].image);
pics[num_of_pics].path = NULL;
}
+ notify(IMAGES_CACHE_CLEARED);
}
diff --git a/programs/cmm/browser/include/menu_rmb.h b/programs/cmm/browser/include/menu_rmb.h
index 6920f7036d..d0105b3f91 100644
--- a/programs/cmm/browser/include/menu_rmb.h
+++ b/programs/cmm/browser/include/menu_rmb.h
@@ -1,10 +1,5 @@
//Leency - 2012-2013
-#define ITEM_HEIGHT 19
-#define ITEM_WIDTH 165
-dword col_work = 0xE4DFE1;
-dword col_border = 0x9098B0;
-
char *ITEMS_LIST[]={
"WIN F5",54,
"DOS Ctrl+D",04,
@@ -13,89 +8,87 @@ char *ITEMS_LIST[]={
#ifdef LANG_RUS
"€б室ЁЄ бва Ёжл F3",52,
"ЋзЁбвЁвм Єни Є авЁ®Є" ,02,
-//"TrueType fonts" ,05,
#else
"View source F3",52,
"Free image cache" ,02,
#endif
-//"TrueType fonts" ,05,
0};
-
-proc_info MenuForm;
-
void menu_rmb()
{
mouse mm;
- int items_num, items_cur;
- int id1, key, i;
-
+ proc_info MenuForm;
+ llist menu;
+ int overid, key, N;
+ dword col_work = 0xE4DFE1;
+ dword col_border = 0x9098B0;
+
+ menu.w = 165;
+ menu.line_h = 19;
+ while (ITEMS_LIST[menu.count*2]) menu.count++;
SetEventMask(100111b);
loop() switch(WaitEvent())
{
case evMouse:
- mm.get();
-
GetProcessInfo(#MenuForm, SelfInfo);
- id1=GetProcessSlot(MenuForm.ID);
- if (id1<>GetActiveProcess()) ExitProcess();
-
- id1=mm.y/ITEM_HEIGHT;
- if (id1<0) || (id1+1>items_num) || (mm.x<0) || (mm.x>ITEM_WIDTH) break;
+ N=GetProcessSlot(MenuForm.ID);
+ if (N<>GetActiveProcess()) ExitProcess();
+
+ mm.get();
+ overid=mm.y/menu.line_h;
+ if (overid<0) || (overid+1>menu.count) || (mm.x<0) || (mm.x>menu.w) break;
if (mm.lkm) || (mm.pkm)
{
- ActivateWindow(GetProcessSlot(Form.ID));
- SendWindowMessage(evButton, ITEMS_LIST[items_cur*2+1]);
- SwitchToAnotherThread();
+ action_buf = ITEMS_LIST[menu.current*2+1];
ExitProcess();
}
- if (items_cur<>id1)
+ if (menu.current<>overid)
{
- items_cur=id1;
+ menu.current=overid;
goto _ITEMS_DRAW;
}
break;
- case evButton:
- break;
-
case evKey:
key = GetKey();
if (key==27) ExitProcess();
- if (key==178) && (items_cur)
+ if (key==178) && (menu.current)
{
- items_cur--;
+ menu.current--;
goto _ITEMS_DRAW;
}
- if (key==177) && (items_cur+1items_cur) EDX=col_work; else EDX=0x94AECE;
- DrawBar(2, i*ITEM_HEIGHT+2, ITEM_WIDTH-2, ITEM_HEIGHT, EDX);
- if (i<>items_cur) WriteText(19,i*ITEM_HEIGHT+9,0x80,0xf2f2f2,ITEMS_LIST[i*2]);
- WriteText(18,i*ITEM_HEIGHT+8,0x80,0x000000,ITEMS_LIST[i*2]);
- //if (ITEMS_LIST[i*2+1]==5) && (use_truetype==1) DrawBar(ITEM_WIDTH-18, i*ITEM_HEIGHT+9, 4, 4, 0x444444);
+ if (N==menu.current)
+ DrawBar(2, N*menu.line_h+2, menu.w-3, menu.line_h, 0x94AECE);
+ else
+ {
+ DrawBar(2, N*menu.line_h+2, menu.w-3, menu.line_h, col_work);
+ WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N*2]);
+ }
+ WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
}
- DrawBar(7, cur_encoding*ITEM_HEIGHT+9, 4, 4, 0x444444); //показывает выбраную кодировку
+ DrawBar(7, cur_encoding*menu.line_h+9, 4, 4, 0x444444); //show current encoding
}
}