From a1815a31eee82a725372d41f40fff05b0092e1ac Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sat, 21 Mar 2020 18:49:45 +0000 Subject: [PATCH] WebView 1.85: russification, new feature to search the web, allow to set background color of the text, add help page, more hotkeys Pixie: better icon of audio button git-svn-id: svn://kolibrios.org@7743 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/TWB/TWB.c | 24 ++++++++--- programs/cmm/TWB/img_cache.h | 4 +- programs/cmm/TWB/links.h | 2 +- programs/cmm/browser/WebView.c | 45 ++++++++++++++------ programs/cmm/browser/history.h | 41 ++++++++++++++---- programs/cmm/browser/html/help_en.htm | 23 ++++++++++ programs/cmm/browser/html/help_ru.htm | 20 +++++++++ programs/cmm/browser/html/homepage.htm | 15 ------- programs/cmm/browser/html/homepage_en.htm | 17 ++++++++ programs/cmm/browser/html/homepage_ru.htm | 17 ++++++++ programs/cmm/eolite/include/menu.h | 6 --- programs/cmm/lib/patterns/http_downloader.h | 1 + programs/cmm/pixie2/pixieskn.png | Bin 1857 -> 1794 bytes 13 files changed, 162 insertions(+), 53 deletions(-) create mode 100644 programs/cmm/browser/html/help_en.htm create mode 100644 programs/cmm/browser/html/help_ru.htm delete mode 100644 programs/cmm/browser/html/homepage.htm create mode 100644 programs/cmm/browser/html/homepage_en.htm create mode 100644 programs/cmm/browser/html/homepage_ru.htm diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c index fc4aa0a413..d38cecaedd 100644 --- a/programs/cmm/TWB/TWB.c +++ b/programs/cmm/TWB/TWB.c @@ -13,6 +13,8 @@ bool button, image, align; +dword + bg_color; }; struct TWebBrowser { @@ -47,7 +49,7 @@ dword text_colors[300]; dword text_color_index; dword link_color_inactive; dword link_color_active; -dword bg_color; +dword page_bg; int draw_y; int stolbec; @@ -93,8 +95,12 @@ void TWebBrowser::DrawStyle() stolbec_len = strlen(#line) * zoom; line_length = stolbec_len * list.font_w; + if (style.bg_color!=page_bg) { + DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h-1, style.bg_color); + } + if (style.image) { - DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h, 0xF9DBCB); + DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h-1, 0xF9DBCB); } if (style.button) { DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h - calc(zoom*2), 0xCCCccc); @@ -130,8 +136,9 @@ void TWebBrowser::Prepare(){ style.align = ALIGN_LEFT; link_color_inactive = 0x0000FF; link_color_active = 0xFF0000; - bg_color = 0xFFFFFF; - DrawBuf.Fill(0, bg_color); + page_bg = 0xFFFFFF; + style.bg_color = page_bg; + DrawBuf.Fill(0, page_bg); PageLinks.Clear(); strcpy(#header, #version); draw_y = body_magrin; @@ -300,8 +307,8 @@ void TWebBrowser::SetStyle() { if (isattr("text=")) text_colors[0]=GetColor(#val); if (isattr("bgcolor=")) { - bg_color = GetColor(#val); - DrawBuf.Fill(0, bg_color); + style.bg_color = page_bg = GetColor(#val); + DrawBuf.Fill(0, page_bg); } } while(GetNextParam()); if (opened) && (cur_encoding==CH_NULL) { @@ -340,12 +347,14 @@ void TWebBrowser::SetStyle() { return; } if (istag("font")) { + style.bg_color = page_bg; if (opened) { text_color_index++; text_colors[text_color_index] = text_colors[text_color_index-1]; do{ if (isattr("color=")) text_colors[text_color_index] = GetColor(#val); + if (isattr("bg=")) style.bg_color = GetColor(#val); } while(GetNextParam()); } else if (text_color_index > 0) text_color_index--; @@ -426,8 +435,9 @@ void TWebBrowser::SetStyle() { if (opened) { NewLine(); + stolbec = style.li_tab * 5 - 2; strcpy(#line, "\31 "); - stolbec-=2; + //stolbec-=2; } return; } diff --git a/programs/cmm/TWB/img_cache.h b/programs/cmm/TWB/img_cache.h index 5d4767fd4d..bd3e521929 100644 --- a/programs/cmm/TWB/img_cache.h +++ b/programs/cmm/TWB/img_cache.h @@ -67,8 +67,8 @@ void ImageCache::Images(dword left1, top1, width1) if (imgh<=0) return; img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first); - DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, bg_color); - DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, bg_color); + DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, page_bg); + DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, page_bg); if (link) { //UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); diff --git a/programs/cmm/TWB/links.h b/programs/cmm/TWB/links.h index de8d232020..63fd1ec41c 100644 --- a/programs/cmm/TWB/links.h +++ b/programs/cmm/TWB/links.h @@ -93,7 +93,7 @@ bool LinksArray::HoverAndProceed(dword mx, my) if (links[active].underline) DrawBar(links[active].x, -WB1.list.first + links[active].y + links[active].h, links[active].w, links[active].underline_h, link_color_inactive); if (links[i].underline) DrawBar(links[i].x, -WB1.list.first + links[i].y - + links[i].h, links[i].w, links[i].underline_h, bg_color); + + links[i].h, links[i].w, links[i].underline_h, page_bg); active = i; DrawStatusBar(links[active].link); return true; diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index e594ece7e4..8ddf16dd1d 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -28,14 +28,15 @@ _http http = {0, 0, 0, 0, 0, 0, 0}; -char homepage[] = FROM "html\\homepage.htm""\0"; #ifdef LANG_RUS -char version[]="Текстовый браузер 1.84"; +char version[]="Текстовый браузер 1.85"; ?define IMAGES_CACHE_CLEARED "Кэш картинок очищен" ?define T_LAST_SLIDE "Это последний слайд" char loading[] = "Загрузка страницы...
"; char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0"; +char homepage[] = FROM "html\\homepage_ru.htm""\0"; +char help[] = FROM "html\\help_ru.htm""\0"; char accept_language[]= "Accept-Language: ru\n"; char rmb_menu[] = "Посмотреть исходник @@ -46,11 +47,13 @@ char link_menu[] = "Копировать ссылку Скачать содержимое ссылки"; #else -char version[]="Text-based Browser 1.84"; +char version[]="Text-based Browser 1.85"; ?define IMAGES_CACHE_CLEARED "Images cache cleared" ?define T_LAST_SLIDE "This slide is the last" char loading[] = "Loading...
"; char page_not_found[] = FROM "html\\page_not_found_en.htm""\0"; +char homepage[] = FROM "html\\homepage_en.htm""\0"; +char help[] = FROM "html\\help_en.htm""\0"; char accept_language[]= "Accept-Language: en\n"; char rmb_menu[] = "View source @@ -64,7 +67,8 @@ Download link contents"; #define URL_SERVICE_HISTORY "WebView://history" -#define URL_SERVICE_HOME "WebView://home" +#define URL_SERVICE_HOMEPAGE "WebView://home" +#define URL_SERVICE_HELP "WebView://help" #define URL_SERVICE_SOURCE "WebView://source:" proc_info Form; @@ -132,7 +136,7 @@ void main() CreateThread(#Downloader,#downloader_stak+4092); ExitProcess(); } - else if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME); + else if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOMEPAGE); WB1.list.SetFont(8, 14, 10011000b); WB1.list.no_selection = true; SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK); @@ -169,7 +173,14 @@ void main() || (key_scancode == SCAN_CODE_KEY_N) RunProgram(#program_path, NULL); if (key_scancode == SCAN_CODE_KEY_W) ExitProcess(); if (key_scancode == SCAN_CODE_KEY_J) ProcessEvent(DOWNLOAD_MANAGER); + if (key_scancode == SCAN_CODE_KEY_R) ProcessEvent(REFRESH_BUTTON); + if (key_scancode == SCAN_CODE_ENTER) EventSeachWeb(); + if (key_scancode == SCAN_CODE_LEFT) ProcessEvent(BACK_BUTTON); + if (key_scancode == SCAN_CODE_RIGHT) ProcessEvent(FORWARD_BUTTON); } + + if (key_scancode == SCAN_CODE_F5) ProcessEvent(REFRESH_BUTTON); + if (address_box.flags & ed_focus) { if (key_scancode == SCAN_CODE_ENTER) { @@ -185,6 +196,7 @@ void main() #define KEY_SCROLL_N 11 if (SCAN_CODE_UP == key_scancode) for (i=0;i + + История + + +

История

+
+ Посещенные страницы
+" +#else +#define HISTORY_HEADER " + + History + + +

History

+
+ Visited pages
+" +#endif + + ShowHistory() { int i; @@ -6,16 +29,16 @@ ShowHistory() free(history_pointer); history_pointer = malloc(history.items.data_size+256); - strcat(history_pointer, "History

History

"); - strcat(history_pointer, "
Visited pages
"); + strcat(history_pointer, HISTORY_HEADER); for (i=0; i"); strcat(history_pointer, history.items.get(i)); strcat(history_pointer, "
"); } + /* strcat(history_pointer, "
Cached images
"); for (i=1; i"); strcat(history_pointer, #pics[i].path); strcat(history_pointer, "
"); - /* - strcat(history_pointer, "
"); - strcat(history_pointer, #pics[i].path); - */ + + // strcat(history_pointer, "
"); + // strcat(history_pointer, #pics[i].path); } + */ strcat(history_pointer, ""); WB1.LoadInternalPage(history_pointer, strlen(history_pointer)); } \ No newline at end of file diff --git a/programs/cmm/browser/html/help_en.htm b/programs/cmm/browser/html/help_en.htm new file mode 100644 index 0000000000..c9cbacf8bb --- /dev/null +++ b/programs/cmm/browser/html/help_en.htm @@ -0,0 +1,23 @@ + + + +WebView Help + +

WebView Help

+ +Shortcut keys + +[CTRL + N or CTRL + T] New window +[CTRL + R or F5] Refresh the current page +[CTRL + U] View a web page's source code +[CTRL + H] Open browser history +[CTRL + J] Display the file downloader +[CTRL + W] Exit browser +[CTRL + ENTER] Submit a web search +[CTRL + LEFT] Back a page. +[CTRL + RIGHT] Forward a page. +[F6] Moves a text cursor to the omnibox + +
+ + \ No newline at end of file diff --git a/programs/cmm/browser/html/help_ru.htm b/programs/cmm/browser/html/help_ru.htm new file mode 100644 index 0000000000..2d228bdbaf --- /dev/null +++ b/programs/cmm/browser/html/help_ru.htm @@ -0,0 +1,20 @@ + + + +Справка WebView + +

Справка WebView

+[CTRL + N или CTRL + T] Новое окно +[CTRL + R или F5] Перезагрузить страницу +[CTRL + U] Смотреть исходный код страницы +[CTRL + H] Смотреть историю посещенных страниц +[CTRL + J] Открыть загрузчик файлов +[CTRL + W] Закрыть браузер +[CTRL + ENTER] Поиск в интернете с помощью Google +[CTRL + ВЛЕВО] Аналогично кнопке "Назад" в браузере +[CTRL + ВПРАВО] Аналогично кнопке "Вперед" +[F6] Перемещает текстовый курсор в омнибокс + +
+ + \ No newline at end of file diff --git a/programs/cmm/browser/html/homepage.htm b/programs/cmm/browser/html/homepage.htm deleted file mode 100644 index 91a2a0d3c4..0000000000 --- a/programs/cmm/browser/html/homepage.htm +++ /dev/null @@ -1,15 +0,0 @@ - - -Homepage - - - -
-Bookmarks:
-1. KolibriOS homepage
-2. KolibriN homepage
-3. Kolibri Stuff - - - - \ No newline at end of file diff --git a/programs/cmm/browser/html/homepage_en.htm b/programs/cmm/browser/html/homepage_en.htm new file mode 100644 index 0000000000..eacaebbd26 --- /dev/null +++ b/programs/cmm/browser/html/homepage_en.htm @@ -0,0 +1,17 @@ + + + +Homepage + +
Bookmarks:
+1. KolibriOS homepage
+2. KolibriN homepage
+3. Kolibri Stuff
+
+Hint: to run a web search, type a text in the adress box
+and press Ctrl+Enter. You can also use other Hotkeys.
+
+
+
+ + \ No newline at end of file diff --git a/programs/cmm/browser/html/homepage_ru.htm b/programs/cmm/browser/html/homepage_ru.htm new file mode 100644 index 0000000000..803a12b56d --- /dev/null +++ b/programs/cmm/browser/html/homepage_ru.htm @@ -0,0 +1,17 @@ + + + +Домашняя страница + +
Закладки:
+1. Домашняя страница KolibriOS
+2. KolibriN10
+3. Kolibri Store
+
+Для поиска в Google наберите тест в адресной строке
+и нажмите Ctrl+Enter. Есть также другие Горячие клавиши.
+
+
+
+ + \ No newline at end of file diff --git a/programs/cmm/eolite/include/menu.h b/programs/cmm/eolite/include/menu.h index 506fdb0a57..1123108df6 100644 --- a/programs/cmm/eolite/include/menu.h +++ b/programs/cmm/eolite/include/menu.h @@ -3,8 +3,6 @@ char *file_captions[] = { "Открыть", "Enter",100, "Открыть с помощью...", "CrlEnt",201, - "Открыть как текст", "F3",202, - "Открыть как HEX", "F4",203, "Копировать", "Crl+C",104, "Вырезать", "Crl+X",105, "Вставить", "Crl+V",106, @@ -17,8 +15,6 @@ char *file_captions[] = { char *file_captions[] = { "Ava", "Enter",100, "Ava ...", "CrlEnt",201, - "Vaata tekstina", "F3",202, - "Vaata HEX", "F4",203, "Kopeeri", "Crl+C",104, "Lїika", "Crl+X",105, "Aseta", "Crl+V",106, @@ -31,8 +27,6 @@ char *file_captions[] = { char *file_captions[] = { "Open", "Enter",100, "Open with...", "CrlEnt",201, - "View as text", "F3",202, - "View as HEX", "F4",203, "Copy", "Crl+C",104, "Cut", "Crl+X",105, "Paste", "Crl+V",106, diff --git a/programs/cmm/lib/patterns/http_downloader.h b/programs/cmm/lib/patterns/http_downloader.h index 083939c1a8..7103fd178f 100644 --- a/programs/cmm/lib/patterns/http_downloader.h +++ b/programs/cmm/lib/patterns/http_downloader.h @@ -176,6 +176,7 @@ int check_is_the_url_absolute(dword _in) if(!strncmp(_in,"mailto:",7)) return true; if(!strncmp(_in,"tel:",4)) return true; if(!strncmp(_in,"#",1)) return true; + if(!strncmp(_in,"WebView:",8)) return true; if(check_is_the_adress_local(_in)) return true; return false; } diff --git a/programs/cmm/pixie2/pixieskn.png b/programs/cmm/pixie2/pixieskn.png index 92c02bd666a128ff892ba770912a6f10dbe16d7f..d7c24ebed2596adc7b7dfbf522bac9d05b05db5c 100644 GIT binary patch delta 1778 zcmVuIyyo^LNG8e z7#J8H9v&bdAW>0K8yg$M#Kb5lC=(MC7^2KmQ&Yjg!3qirD=RBaO-(Q~Fw4u!4h{~p zv$L(Ot$%-iTwGizEGW9Vx{#2NwY9Z%c6HCs&zqZ@NJ&T;cz=`|M^zb=x~He78eVf7 zHa;1Gq8ej*nJw(1000IpNkl^JmFvJEyk(cz>t!e11M@f7Wv=f7#x$_L)Ty)t?_j zSHwQ!FMG|a%7DWlp4+E;^y^Rr_2=*AU&R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