forked from KolibriOS/kolibrios
HTMLv 0.99.08: menu final fixes
git-svn-id: svn://kolibrios.org@4026 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e3504571ad
commit
a0126a688c
@ -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<Form.height) && (filesize)
|
||||
if (m.y>WB1.top) && (m.y<Form.height) && (filesize)
|
||||
{
|
||||
if (m.pkm)
|
||||
{
|
||||
show_menu = 1;
|
||||
}
|
||||
if (!m.pkm) && (show_menu)
|
||||
{
|
||||
show_menu = 0;
|
||||
SwitchToAnotherThread();
|
||||
CreateThread(#menu_rmb,#stak);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m.vert==65535) //ïðîêðóòêà êîë¸ñèêîì
|
||||
if (m.vert==65535)
|
||||
{
|
||||
if (lines.first==0) break;
|
||||
if (lines.first>3) 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);
|
||||
}
|
||||
@ -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:
|
||||
|
@ -1,3 +1,7 @@
|
||||
15.10.13 - 0.99.08
|
||||
- ףכףקרוםםמו לום
|
||||
- לףכ<D7A3>עט<D7A2>ח<EFBFBD>קםמסע<D7A1>
|
||||
|
||||
08.10.13 - 0.99.04
|
||||
- поддержка относительных путей
|
||||
- исправления для скроллбара
|
||||
|
@ -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);
|
||||
}
|
||||
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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
N=GetProcessSlot(MenuForm.ID);
|
||||
if (N<>GetActiveProcess()) ExitProcess();
|
||||
|
||||
id1=mm.y/ITEM_HEIGHT;
|
||||
if (id1<0) || (id1+1>items_num) || (mm.x<0) || (mm.x>ITEM_WIDTH) break;
|
||||
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+1<items_num)
|
||||
if (key==177) && (menu.current+1<menu.count)
|
||||
{
|
||||
items_cur++;
|
||||
menu.current++;
|
||||
goto _ITEMS_DRAW;
|
||||
}
|
||||
if (key==13)
|
||||
{
|
||||
WB1.Scan(ITEMS_LIST[items_cur*2+1]);
|
||||
action_buf = ITEMS_LIST[menu.current*2+1];
|
||||
ExitProcess();
|
||||
}
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
while (ITEMS_LIST[items_num*2]) items_num++;
|
||||
DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,ITEM_WIDTH+2,items_num*ITEM_HEIGHT+4,0x01, 0, 0, 0x01fffFFF);
|
||||
DrawPopup(0,0,ITEM_WIDTH,items_num*ITEM_HEIGHT+2,0, -1,col_border);
|
||||
DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.count*menu.line_h+4,0x01, 0, 0, 0x01fffFFF);
|
||||
DrawPopup(0,0,menu.w,menu.count*menu.line_h+3,0, col_work,col_border);
|
||||
//PutPixel();
|
||||
|
||||
_ITEMS_DRAW:
|
||||
for (i=0; i<items_num; i++;)
|
||||
for (N=0; N<menu.count; N++;)
|
||||
{
|
||||
if (i<>items_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]);
|
||||
}
|
||||
DrawBar(7, cur_encoding*ITEM_HEIGHT+9, 4, 4, 0x444444); //ïîêàçûâàåò âûáðàíóþ êîäèðîâêó
|
||||
WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
|
||||
}
|
||||
DrawBar(7, cur_encoding*menu.line_h+9, 4, 4, 0x444444); //show current encoding
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user