WebView beta 6.2: hamburger icon, fix menu position, use libimg pattern

git-svn-id: svn://kolibrios.org@5408 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2015-02-15 10:18:26 +00:00
parent d7a5290aec
commit 81ef95c4b3
4 changed files with 23 additions and 14 deletions

View File

@ -26,17 +26,20 @@
#include "..\lib\lib.obj\libimg_lib.h" #include "..\lib\lib.obj\libimg_lib.h"
#include "..\lib\lib.obj\http.h" #include "..\lib\lib.obj\http.h"
//useful patterns
#include "..\lib\patterns\libimg_load_skin.h"
char homepage[] = FROM "html\homepage.htm"; char homepage[] = FROM "html\homepage.htm";
#ifdef LANG_RUS #ifdef LANG_RUS
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.0 Beta 6.1"; char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.0 Beta 6.2";
?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.0 Beta 6.1"; char version[]=" Text-based Browser 1.0 Beta 6.2";
?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>";
@ -85,20 +88,12 @@ edit_box address_box = {250,55,34,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(U
enum { BACK=300, FORWARD, REFRESH, HOME, NEWTAB, GOTOURL, SEARCHWEB, INPUT_CH, INPUT_BT, BTN_UP, BTN_DOWN }; enum { BACK=300, FORWARD, REFRESH, HOME, NEWTAB, GOTOURL, SEARCHWEB, INPUT_CH, INPUT_BT, BTN_UP, BTN_DOWN };
struct struct_skin { libimg_image skin;
dword image, w, h;
int Load();
} skin;
int struct_skin::Load() int SetSkinColors()
{ {
dword image_data; dword image_data;
skin.image = load_image(abspath("wv_skin.png"));
if (!skin.image) notify("WebView skin file 'wv_skin.png' not found, program will terminate");
skin.w = DSWORD[skin.image+4];
skin.h = DSWORD[skin.image+8];
image_data = DSDWORD[skin.image+24]; image_data = DSDWORD[skin.image+24];
col_bg = DSDWORD[image_data]; col_bg = DSDWORD[image_data];
panel_color = DSDWORD[skin.w*4*4 + image_data]; panel_color = DSDWORD[skin.w*4*4 + image_data];
border_color = DSDWORD[skin.w*4*7 + image_data]; border_color = DSDWORD[skin.w*4*7 + image_data];
@ -132,7 +127,8 @@ void main()
if (load_dll2(libio, #libio_init,1)!=0) notify("Error: library doesn't exists - libio"); if (load_dll2(libio, #libio_init,1)!=0) notify("Error: library doesn't exists - libio");
if (load_dll2(libimg, #libimg_init,1)!=0) notify("Error: library doesn't exists - libimg"); if (load_dll2(libimg, #libimg_init,1)!=0) notify("Error: library doesn't exists - libimg");
if (load_dll2(libHTTP, #http_lib_init,1)!=0) notify("Error: library doesn't exists - http"); if (load_dll2(libHTTP, #http_lib_init,1)!=0) notify("Error: library doesn't exists - http");
skin.Load(); Libimg_LoadImage(#skin, abspath("wv_skin.png"));
SetSkinColors();
Form.width=WIN_W; Form.width=WIN_W;
Form.height=WIN_H; Form.height=WIN_H;

View File

@ -54,7 +54,7 @@ void menu_rmb()
break; break;
case evReDraw: case evReDraw:
DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF); DefineAndDrawWindow(Form.left+m.x-6,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
DrawPopup(0,0,menu.w,menu.h+3,0, col_bg,border_color); DrawPopup(0,0,menu.w,menu.h+3,0, col_bg,border_color);
DrawMenuList(); DrawMenuList();
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,13 @@
struct libimg_image {
dword image, w, h;
};
int Libimg_LoadImage(dword struct_pointer, file_path)
{
int image_pointer;
image_pointer = load_image(file_path);
if (!image_pointer) notify("Error: Skin not loaded");
ESDWORD[struct_pointer] = image_pointer;
ESDWORD[struct_pointer+4] = DSWORD[image_pointer+4];
ESDWORD[struct_pointer+8] = DSWORD[image_pointer+8];
}