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();
/programs/cmm/browser/history.h
2,6 → 2,7
{
int i;
static int history_pointer;
int t;
free(history_pointer);
history_pointer = malloc(64000);
9,6 → 10,8
strcat(history_pointer, "<h2>Visited pages</h2><blockquote><br>");
for (i=1; i<BrowserHistory.links_count; i++)
{
// t = BrowserHistory.GetFirstLine(i);
// strcat(history_pointer, itoa(t));
strcat(history_pointer, "<a href='");
strcat(history_pointer, BrowserHistory.GetUrl(i));
strcat(history_pointer, "'>");
/programs/cmm/browser/menu_rmb.h
6,11 → 6,13
"KOI Ctrl+K",11,
"UTF Ctrl+U",21,
#ifdef LANG_RUS
"ˆá室­¨ª áâà ­¨æë F3",52,
"®á¬®âà¥âì ¨á室­¨ª F3",52,
"¥¤ ªâ¨à®¢ âì ¨á室­¨ª F4",53,
"Žç¨áâ¨âì ªíè ª à⨭®ª" ,02,
"ˆáâ®à¨ï" ,03,
#else
"View source F3",52,
"Edit source F4",53,
"Free image cache" ,09,
"History" ,03,
#endif
26,7 → 28,7
 
menu.first = menu.current = 0;
while (ITEMS_LIST[menu.count*2]) menu.count++;
menu.SetSizes(2,2,165,menu.count*19,0,19);
menu.SetSizes(2,2,177,menu.count*19,0,19);
SetEventMask(100111b);
 
loop() switch(WaitEvent())
/programs/cmm/browser/show_src.h
0,0 → 1,69
//you are butifull, you are butifull
dword ShowSource()
{
dword new_buf, new_buf_start, i;
byte ww, param, comment;
 
if (souce_mode) return;
souce_mode = true;
new_buf_start = new_buf = malloc(bufsize*5);
strcat(new_buf, "<pre>");
for (i=bufpointer; i<bufpointer+bufsize; i++)
{
ww = ESBYTE[i];
new_buf++;
switch (ww)
{
case '<':
if (ESBYTE[i+1]=='!') && (ESBYTE[i+2]=='-') && (ESBYTE[i+3]=='-')
{
strcat(new_buf, "<font color=#ccc>&lt;");
new_buf+=20;
}
else
{
strcat(new_buf, "<font color=#00f>&lt;");
new_buf+=20;
}
break;
case '>':
if (!param) //fix non-closed quote
{
param = 1;
strcat(new_buf, "&quot;</font>");
new_buf+=12;
}
if (ESBYTE[i-1]=='-') && (ESBYTE[i-2]=='-')
{
strcat(new_buf, "&gt;</font>");
new_buf+=10;
}
else
{
strcat(new_buf, "&gt;</font>");
new_buf+=10;
}
break;
case '\"':
case '\'':
if (param)
{
param = 0;
strcat(new_buf, "<font color=#f0f>&quot;");
new_buf+=22;
}
else
{
param = 1;
strcat(new_buf, "&quot;</font>");
new_buf+=12;
}
break;
default:
chrcat(new_buf, ww);
}
}
bufsize = new_buf;
free(bufpointer);
bufpointer = new_buf_start;
}