CMM: fix list with no selection, browser fix <pre> tag, fix keys

git-svn-id: svn://kolibrios.org@5781 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2015-09-01 09:36:58 +00:00
parent 40ec306f72
commit 31fc4fdbc0
3 changed files with 27 additions and 13 deletions

View File

@ -38,9 +38,9 @@ byte
t_html, t_html,
t_body; t_body;
dword bufpointer; dword bufpointer=0;
dword o_bufpointer; dword o_bufpointer=0;
dword bufsize; dword bufsize=0;
dword text_colors[300]; dword text_colors[300];
dword text_color_index; dword text_color_index;
@ -152,8 +152,8 @@ void TWebBrowser::Prepare(){
case 0x0a: case 0x0a:
if (style.pre) if (style.pre)
{ {
chrcat(#line, ' '); DrawStyle();
Perenos(); NewLine();
break; break;
} }
case '\9': case '\9':
@ -370,7 +370,7 @@ void TWebBrowser::SetStyle() {
if (opened) if (opened)
{ {
WB1.DrawBuf.zoom=2; WB1.DrawBuf.zoom=2;
WB1.list.SetFont(8, 14, 10111001b); WB1.list.font_type |= 10111001b;
if (isattr("align=")) && (isval("center")) style.align = ALIGN_CENTER; if (isattr("align=")) && (isval("center")) style.align = ALIGN_CENTER;
if (isattr("align=")) && (isval("right")) style.align = ALIGN_RIGHT; if (isattr("align=")) && (isval("right")) style.align = ALIGN_RIGHT;
if (stroka>1) NewLine(); if (stroka>1) NewLine();
@ -378,7 +378,7 @@ void TWebBrowser::SetStyle() {
else else
{ {
WB1.DrawBuf.zoom=1; WB1.DrawBuf.zoom=1;
WB1.list.SetFont(8, 14, 10111000b); WB1.list.font_type = 10111000b;
style.align = ALIGN_LEFT; style.align = ALIGN_LEFT;
} }
return; return;

View File

@ -25,14 +25,14 @@
char homepage[] = FROM "html\\homepage.htm"; char homepage[] = FROM "html\\homepage.htm";
#ifdef LANG_RUS #ifdef LANG_RUS
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.38"; char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.39";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­" ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤" ?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>"; char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
char page_not_found[] = FROM "html\page_not_found_ru.htm"; char page_not_found[] = FROM "html\page_not_found_ru.htm";
char accept_language[]= "Accept-Language: ru\n"; char accept_language[]= "Accept-Language: ru\n";
#else #else
char version[]=" Text-based Browser 1.38"; char version[]=" Text-based Browser 1.39";
?define IMAGES_CACHE_CLEARED "Images cache cleared" ?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last" ?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>"; char loading[] = "Loading...<br>";
@ -281,7 +281,7 @@ void Draw_Window()
void Scan(dword id__) void Scan(dword id__)
{ {
action_buf=0; action_buf=0;
if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage(); if (WB1.list.ProcessKey(id__)) WB1.DrawPage();
else switch (id__) else switch (id__)
{ {
case SCAN_CODE_BS: case SCAN_CODE_BS:

View File

@ -11,7 +11,7 @@ struct llist
{ {
int x, y, w, h, line_h, text_y; int x, y, w, h, line_h, text_y;
int count, visible, first, current, column_max; //visible = row_max int count, visible, first, current, column_max; //visible = row_max
dword font_w, font_h, font_type; byte font_w, font_h, font_type;
byte wheel_size; byte wheel_size;
byte active; byte active;
byte no_selection; byte no_selection;
@ -126,7 +126,14 @@ int llist::ProcessKey(dword key)
int llist::KeyDown() int llist::KeyDown()
{ {
if (current-first+1<visible) && (!no_selection) if (no_selection)
{
if (visible + first >= count) return 0;
first++;
return 1;
}
if (current-first+1<visible)
{ {
if (current + 1 >= count) return 0; if (current + 1 >= count) return 0;
current++; current++;
@ -147,7 +154,14 @@ int llist::KeyDown()
int llist::KeyUp() int llist::KeyUp()
{ {
if (current > first) && (!no_selection) if (no_selection)
{
if (first == 0) return 0;
first--;
return 1;
}
if (current > first)
{ {
current--; current--;
} }