HTMLv 0.99.09: better menu key process, fix menu stack

git-svn-id: svn://kolibrios.org@4074 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2013-10-22 21:56:28 +00:00
parent 61b200d531
commit 6c91093930
4 changed files with 54 additions and 60 deletions

View File

@ -0,0 +1,46 @@
dword drawbuf;
void DrawBufInit()
{
free(drawbuf);
drawbuf = malloc(WB1.width * WB1.line_h +4 * 4 + 8); //+1 for good luck
ESDWORD[drawbuf] = WB1.width;
ESDWORD[drawbuf+4] = WB1.line_h;
}
void DrawBufFill()
{
int i;
for (i=0; i<WB1.width* WB1.line_h +4 * 4; i+=4) ESDWORD[drawbuf+i+8] = bg_color;
}
void DrawBufBar(dword x, y, w, h, color)
{
int i, j;
for (j=0; j<h; j++)
{
for (i = y+j*WB1.width+x*4; i<y+j*WB1.width+x+w*4 ; i+=4) ESDWORD[drawbuf+i+8] = color;
}
}
char shift[]={8,8,4,4};
void DrawBufSkew(dword x, y, w, h)
{
int i, j;
stolbec++;
for (j=0; j<=3; j++)
{
for (i = y+j*WB1.width+x+w+h*4; i>y+j*WB1.width+x+h-12*4 ; i-=4)
ESDWORD[drawbuf+i+8] = ESDWORD[-shift[j]+drawbuf+i+8];
}
}
void TextGoDown(int left1, top1, width1)
{
if (!stroka) DrawBar(WB1.left, WB1.top, WB1.width, 5, bg_color); //çàêðàøèâàåì ôîí íàä ïåðâîé ñòðîêîé
stroka++;
if (blq_text) stolbec = 8; else stolbec = 0;
if (li_text) stolbec = li_tab * 5;
if (top1>=WB1.top) && ( top1 < WB1.height+WB1.top-10) && (!anchor)
{
PutPaletteImage(drawbuf+8, WB1.width, WB1.line_h, left1-5, top1, 32,0);
DrawBufFill();
}
}

View File

@ -26,10 +26,10 @@
#endif #endif
#ifdef LANG_RUS #ifdef LANG_RUS
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 0.99.08"; char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 0.99.09";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­" ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
#else #else
char version[]=" Text-based Browser 0.99.08"; char version[]=" Text-based Browser 0.99.09";
?define IMAGES_CACHE_CLEARED "Images cache cleared" ?define IMAGES_CACHE_CLEARED "Images cache cleared"
#endif #endif
@ -55,7 +55,7 @@ proc_info Form;
#define WIN_H 480 #define WIN_H 480
char stak[512]; char stak[4096];
mouse m; mouse m;
int action_buf; int action_buf;
@ -115,7 +115,7 @@ void main()
{ {
show_menu = 0; show_menu = 0;
SwitchToAnotherThread(); SwitchToAnotherThread();
CreateThread(#menu_rmb,#stak); CreateThread(#menu_rmb,#stak+4092);
break; break;
} }
} }

View File

@ -50,54 +50,10 @@ char line[500],
#include "include\img_cache.h" #include "include\img_cache.h"
#include "include\some_code.h" #include "include\some_code.h"
#include "include\parce_tag.h" #include "include\parce_tag.h"
#include "DrawBuf.h"
//======================================================================= //=======================================================================
dword drawbuf;
void DrawBufInit()
{
free(drawbuf);
drawbuf = malloc(WB1.width * WB1.line_h +4 * 4 + 8); //+1 for good luck
ESDWORD[drawbuf] = WB1.width;
ESDWORD[drawbuf+4] = WB1.line_h;
}
void DrawBufFill()
{
int i;
for (i=0; i<WB1.width* WB1.line_h +4 * 4; i+=4) ESDWORD[drawbuf+i+8] = bg_color;
}
void DrawBufBar(dword x, y, w, h, color)
{
int i, j;
for (j=0; j<h; j++)
{
for (i = y+j*WB1.width+x*4; i<y+j*WB1.width+x+w*4 ; i+=4) ESDWORD[drawbuf+i+8] = color;
}
}
char shift[]={8,8,4,4};
void DrawBufSkew(dword x, y, w, h)
{
int i, j;
stolbec++;
for (j=0; j<=3; j++)
{
for (i = y+j*WB1.width+x+w+h*4; i>y+j*WB1.width+x+h-12*4 ; i-=4)
ESDWORD[drawbuf+i+8] = ESDWORD[-shift[j]+drawbuf+i+8];
}
}
void TextGoDown(int left1, top1, width1)
{
if (!stroka) DrawBar(WB1.left, WB1.top, WB1.width, 5, bg_color); //çàêðàøèâàåì ôîí íàä ïåðâîé ñòðîêîé
stroka++;
if (blq_text) stolbec = 8; else stolbec = 0;
if (li_text) stolbec = li_tab * 5;
if (top1>=WB1.top) && ( top1 < WB1.height+WB1.top-10) && (!anchor)
{
PutPaletteImage(drawbuf+8, WB1.width, WB1.line_h, left1-5, top1, 32,0);
DrawBufFill();
}
}
void TWebBrowser::DrawPage() void TWebBrowser::DrawPage()
{ {

View File

@ -26,7 +26,8 @@ void menu_rmb()
menu.w = 165; menu.w = 165;
menu.line_h = 19; menu.line_h = 19;
while (ITEMS_LIST[menu.count*2]) menu.count++; menu.first = 0;
while (ITEMS_LIST[menu.count*2]) {menu.count++; menu.visible++;}
SetEventMask(100111b); SetEventMask(100111b);
loop() switch(WaitEvent()) loop() switch(WaitEvent())
@ -54,16 +55,7 @@ void menu_rmb()
case evKey: case evKey:
key = GetKey(); key = GetKey();
if (key==27) ExitProcess(); if (key==27) ExitProcess();
if (key==178) && (menu.current) if (menu.ProcessKey(key)) goto _ITEMS_DRAW;
{
menu.current--;
goto _ITEMS_DRAW;
}
if (key==177) && (menu.current+1<menu.count)
{
menu.current++;
goto _ITEMS_DRAW;
}
if (key==13) if (key==13)
{ {
action_buf = ITEMS_LIST[menu.current*2+1]; action_buf = ITEMS_LIST[menu.current*2+1];