Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4717 → Rev 4718

/programs/cmm/browser/WebView.c
29,7 → 29,7
char homepage[] = FROM "html\homepage.htm";
 
#ifdef LANG_RUS
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.0 Beta 3";
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.0 Beta 4";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
36,7 → 36,7
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 3";
char version[]=" Text-based Browser 1.0 Beta 4";
?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>";
62,16 → 62,18
dword TAB_H = false; //19;
dword TAB_W = 150;
dword TOOLBAR_H = 31; //50;
dword STATUSBAR_H =16;
dword col_bg = 0xE4DFE1;
dword panel_color = 0xF1F1F1;
dword border_color = 0x9F9F9F;
dword STATUSBAR_H =15;
dword col_bg;
dword panel_color;
dword border_color;
 
pb progress_bar = {0, 10, 83, 150, 12, 0, 0, 100, 0xeeeEEE, 8072B7EBh, 0x9F9F9F};
byte souce_mode = false;
 
#include "..\TWB\TWB.c"
#include "menu_rmb.h"
#include "history.h"
#include "show_src.h"
 
char editURL[sizeof(URL)];
int mouse_twb;
79,19 → 81,32
 
#define URL_SERVICE_HISTORY "WebView://history"
#define URL_SERVICE_HOME "WebView://home"
#define URL_SERVICE_SOURCE "WebView://source:"
 
enum { BACK=300, FORWARD, REFRESH, HOME, NEWTAB, GOTOURL, SEARCHWEB, INPUT_CH, INPUT_BT, BTN_UP, BTN_DOWN };
 
struct skin {
struct struct_skin {
dword image, w, h;
int Load();
} skin;
 
int LoadSkin()
int struct_skin::Load()
{
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[DSDWORD[skin.image+24]];
panel_color = DSDWORD[skin.w*4*4 + image_data];
border_color = DSDWORD[skin.w*4*7 + image_data];
progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data];
$and col_bg, 0x00ffffff
$and panel_color, 0x00ffffff
$and border_color, 0x00ffffff
$and progress_bar.progress_color, 0x00ffffff
}
 
void DrawProgress()
104,6 → 119,7
DrawBar(address_box.left-1, address_box.top+14, btn, 2, progress_bar.progress_color);
}
 
 
void main()
{
unsigned long key, btn;
116,7 → 132,7
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");
LoadSkin();
skin.Load();
Form.width=WIN_W;
Form.height=WIN_H;
185,7 → 201,7
key = GetKey();
if (address_box.flags & 0b10) SWITCH(key)
{ CASE 52: CASE 53: CASE 54: goto _EDIT_MARK; }
{ CASE 52: CASE 53: CASE 54: CASE 180: CASE 181: goto _EDIT_MARK; }
 
Scan(key);
268,7 → 284,7
{
address_box.top = TOOLBAR_H-TAB_H/2-7+TAB_H;
address_box.width = Form.cwidth - address_box.left - 25 - 22;
WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x, Form.cheight - TOOLBAR_H - STATUSBAR_H, 0, 10);
WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x, Form.cheight - TOOLBAR_H - STATUSBAR_H, 0, 11);
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / 6;
WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h;
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.line_h);
373,10 → 389,13
OpenPage();
return;
case 052: //F3
ShowSource();
break;
case 053: //F4
if (strncmp(#URL,"http:",5)==0)
{
WriteFile(bufsize, bufpointer, "/tmp0/1/webview.tmp");
if (EAX==0) RunProgram("/rd/1/tinypad", "/tmp0/1/webview.tmp");
WriteFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
if (EAX==0) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
}
else
{
404,6 → 423,7
strcpy(#editURL, "http://kolibrios.org/");
case GOTOURL:
case 0x0D: //enter
if (!editURL[0]) return;
if ((strncmp(#editURL,"http:",5)!=0) && (editURL[0]!='/') && ((strncmp(#editURL,"WebView:",8)!=0))
{
strcpy(#URL,"http://");
559,6 → 579,7
void OpenPage()
{
StopLoading();
souce_mode = false;
strcpy(#editURL, #URL);
BrowserHistory.AddUrl();
if (strncmp(#URL,"WebView:",8)==0)
594,21 → 615,27
bufsize = EBX;
if (bufsize)
{
bufpointer = mem_Free(bufpointer);
mem_Free(bufpointer);
bufpointer = mem_Alloc(bufsize);
SetPageDefaults();
ReadFile(0, bufsize, bufpointer, #URL);
//ShowSource();
}
ShowPage();
}
}
 
void ShowPage()
DrawEditBox()
{
address_box.size = address_box.pos = strlen(#editURL);
address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
address_box.offset=0;
edit_box_draw stdcall(#address_box);
}
 
 
void ShowPage()
{
DrawEditBox();
if (!bufsize)
{
PageLinks.Clear();