diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c
index f5bdbe3c16..090d24bd83 100644
--- a/programs/cmm/browser/WebView.c
+++ b/programs/cmm/browser/WebView.c
@@ -26,17 +26,20 @@
#include "..\lib\lib.obj\libimg_lib.h"
#include "..\lib\lib.obj\http.h"
+//useful patterns
+#include "..\lib\patterns\libimg_load_skin.h"
+
char homepage[] = FROM "html\homepage.htm";
#ifdef LANG_RUS
- char version[]=" Текстовый браузер 1.0 Beta 6.1";
+ char version[]=" Текстовый браузер 1.0 Beta 6.2";
?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.0 Beta 6.1";
+ char version[]=" Text-based Browser 1.0 Beta 6.2";
?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...
";
@@ -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 };
-struct struct_skin {
- dword image, w, h;
- int Load();
-} skin;
+libimg_image skin;
-int struct_skin::Load()
+int SetSkinColors()
{
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];
-
col_bg = DSDWORD[image_data];
panel_color = DSDWORD[skin.w*4*4 + 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(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");
- skin.Load();
+ Libimg_LoadImage(#skin, abspath("wv_skin.png"));
+ SetSkinColors();
Form.width=WIN_W;
Form.height=WIN_H;
diff --git a/programs/cmm/browser/menu_rmb.h b/programs/cmm/browser/menu_rmb.h
index 24e3eb1eac..4cf854c0ef 100644
--- a/programs/cmm/browser/menu_rmb.h
+++ b/programs/cmm/browser/menu_rmb.h
@@ -54,7 +54,7 @@ void menu_rmb()
break;
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);
DrawMenuList();
}
diff --git a/programs/cmm/browser/wv_skin.png b/programs/cmm/browser/wv_skin.png
index 8351a0d143..91adf4cd33 100644
Binary files a/programs/cmm/browser/wv_skin.png and b/programs/cmm/browser/wv_skin.png differ
diff --git a/programs/cmm/lib/patterns/libimg_load_skin.h b/programs/cmm/lib/patterns/libimg_load_skin.h
new file mode 100644
index 0000000000..fa66af1e4c
--- /dev/null
+++ b/programs/cmm/lib/patterns/libimg_load_skin.h
@@ -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];
+}
\ No newline at end of file