From 31fc4fdbc0213d82ef056e441846457d4c287eef Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Tue, 1 Sep 2015 09:36:58 +0000 Subject: [PATCH] CMM: fix list with no selection, browser fix
 tag, fix
 keys

git-svn-id: svn://kolibrios.org@5781 a494cfbc-eb01-0410-851d-a64ba20cac60
---
 programs/cmm/TWB/TWB.c         | 14 +++++++-------
 programs/cmm/browser/WebView.c |  6 +++---
 programs/cmm/lib/list_box.h    | 20 +++++++++++++++++---
 3 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c
index 7f8232f542..adb8ab62eb 100644
--- a/programs/cmm/TWB/TWB.c
+++ b/programs/cmm/TWB/TWB.c
@@ -38,9 +38,9 @@ byte
 	t_html,
 	t_body;
 
-dword bufpointer;
-dword o_bufpointer;
-dword bufsize;
+dword bufpointer=0;
+dword o_bufpointer=0;
+dword bufsize=0;
 
 dword text_colors[300];
 dword text_color_index;
@@ -152,8 +152,8 @@ void TWebBrowser::Prepare(){
 		case 0x0a:
 			if (style.pre)
 			{
-				chrcat(#line, ' ');
-				Perenos();
+				DrawStyle();
+				NewLine();
 				break;
 			}
 		case '\9':
@@ -370,7 +370,7 @@ void TWebBrowser::SetStyle() {
 		if (opened)
 		{
 			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("right")) style.align = ALIGN_RIGHT;
 			if (stroka>1) NewLine();
@@ -378,7 +378,7 @@ void TWebBrowser::SetStyle() {
 		else
 		{
 			WB1.DrawBuf.zoom=1;
-			WB1.list.SetFont(8, 14, 10111000b);
+			WB1.list.font_type = 10111000b;
 			style.align = ALIGN_LEFT;
 		}
 		return;
diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c
index cc71271884..2a36c57abf 100644
--- a/programs/cmm/browser/WebView.c
+++ b/programs/cmm/browser/WebView.c
@@ -25,14 +25,14 @@
 char homepage[] = FROM "html\\homepage.htm";
 
 #ifdef LANG_RUS
-	char version[]=" Текстовый браузер 1.38";
+	char version[]=" Текстовый браузер 1.39";
 	?define IMAGES_CACHE_CLEARED "Кэш картинок очищен"
 	?define T_LAST_SLIDE "Это последний слайд"
 	char loading[] = "Загрузка страницы...
"; char page_not_found[] = FROM "html\page_not_found_ru.htm"; char accept_language[]= "Accept-Language: ru\n"; #else - char version[]=" Text-based Browser 1.38"; + char version[]=" Text-based Browser 1.39"; ?define IMAGES_CACHE_CLEARED "Images cache cleared" ?define T_LAST_SLIDE "This slide is the last" char loading[] = "Loading...
"; @@ -281,7 +281,7 @@ void Draw_Window() void Scan(dword id__) { action_buf=0; - if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage(); + if (WB1.list.ProcessKey(id__)) WB1.DrawPage(); else switch (id__) { case SCAN_CODE_BS: diff --git a/programs/cmm/lib/list_box.h b/programs/cmm/lib/list_box.h index eee1b42ee4..dd36d1efd6 100644 --- a/programs/cmm/lib/list_box.h +++ b/programs/cmm/lib/list_box.h @@ -11,7 +11,7 @@ struct llist { int x, y, w, h, line_h, text_y; 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 active; byte no_selection; @@ -126,7 +126,14 @@ int llist::ProcessKey(dword key) int llist::KeyDown() { - if (current-first+1= count) return 0; + first++; + return 1; + } + + if (current-first+1= count) return 0; current++; @@ -147,7 +154,14 @@ int llist::KeyDown() int llist::KeyUp() { - if (current > first) && (!no_selection) + if (no_selection) + { + if (first == 0) return 0; + first--; + return 1; + } + + if (current > first) { current--; }