Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 7754 → Rev 7755

/programs/cmm/TWB/TWB.c
260,7 → 260,8
DrawStyle();
NewLine();
list.count = draw_y;
DrawPage();
list.CheckDoesValuesOkey();
anchors.current = NULL;
}
//============================================================================================
bool TWebBrowser::CheckForLineBreak()
292,6 → 293,14
 
dword value;
 
if (value = tag.get_value_of("name=")) || (value = tag.get_value_of("id=")) {
anchors.add(value, draw_y);
if (anchors.current) && (streq(value, #anchors.current+1)) {
list.first = draw_y;
anchors.current = NULL;
}
}
 
if (tag.is("html")) {
t_html = tag.opened;
return;
311,9 → 320,6
if (!tag.opened) strcat(#line, "\" ");
return;
}
if (value = tag.get_value_of("name=")) || (value = tag.get_value_of("id=")) {
anchors.add(value, draw_y);
}
if (tag.is("body")) {
t_body = tag.opened;
if (value = tag.get_value_of("link=")) link_color_inactive = GetColor(value);
/programs/cmm/TWB/absolute_url.h
1,9 → 1,9
 
void GetAbsoluteURL(dword in_URL)
dword GetAbsoluteURL(dword in_URL)
{
int i;
dword orig_URL = in_URL;
char newurl[URL_SIZE];
char newurl[URL_SIZE+1];
 
while (i=strstr(in_URL, "&"))
{
10,7 → 10,7
strcpy(i+1, i+5);
}
 
if (check_is_the_url_absolute(in_URL)) return;
if (check_is_the_url_absolute(in_URL)) return orig_URL;
 
IF (!strncmp(in_URL,"//", 2))
{
17,7 → 17,7
strcpy(#newurl, "http:");
strcat(#newurl, in_URL);
strcpy(orig_URL, #newurl);
return;
return orig_URL;
}
IF (!strncmp(in_URL,"./", 2)) in_URL+=2;
55,5 → 55,6
strcat(#newurl, in_URL);
strcpy(orig_URL, #newurl);
return orig_URL;
}
 
/programs/cmm/TWB/anchors.h
1,10 → 1,12
 
struct _anchors {
char current[256];
collection anchor_name;
collection anchor_position;
void add();
int get_pos_by_name();
void clear();
void take_anchor_from();
} anchors;
 
void _anchors::add(dword _name, _pos)
30,3 → 32,12
anchor_position.drop();
}
 
void _anchors::take_anchor_from(dword _URL)
{
int anchor_pos;
if (!current) && (_URL) && (anchor_pos = strrchr(_URL, '#')) {
strncpy(#current, _URL+anchor_pos-1, sizeof(_anchors.current)-1);
ESBYTE[_URL+anchor_pos-1] = EOS;
}
}
 
/programs/cmm/TWB/links.h
58,8 → 58,7
CursorPointer.Restore();
}
 
char temp[URL_SIZE];
PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0};
PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, NULL, 0};
 
bool LinksArray::HoverAndProceed(dword mx, my)
{
77,13 → 76,12
return false;
}
if (mouse.mkm) && (mouse.up) {
open_in_a_new_window = true;
EventClickLink();
RunProgram(#program_path, PageLinks.GetURL(PageLinks.active));
return false;
}
if (mouse.lkm) && (mouse.up) {
CursorPointer.Restore();
EventClickLink();
EventClickLink(PageLinks.GetURL(PageLinks.active));
return false;
}
if (mouse.pkm) && (mouse.up) {
/programs/cmm/browser/WebView.c
7,7 → 7,7
#endif
 
//libraries
#define MEMSIZE 1024 * 800
#define MEMSIZE 1024 * 850
#include "..\lib\gui.h"
#include "..\lib\draw_buf.h"
#include "..\lib\list_box.h"
29,9 → 29,7
#include "..\lib\patterns\simple_open_dialog.h"
 
#ifdef LANG_RUS
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 2.0 beta1";
#define T_LOADING "‡ £à㧪  áâà ­¨æë..."
#define T_RENDERING "¥­¤¥à¨­£..."
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 2.0 beta2";
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";
45,9 → 43,7
"Š®¯¨à®¢ âì áá뫪ã
‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
#else
char version[]="Text-based Browser 2.0 beta1";
#define T_LOADING "Loading..."
#define T_RENDERING "Rendering..."
char version[]="Text-based Browser 2.0 beta2";
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";
66,10 → 62,9
 
dword col_bg = 0xE3E2E2;
dword panel_color = 0xE3E2E2;
dword border_color = 0x8C8C8C;
dword border_color = 0x787878;
 
bool debug_mode = false;
bool open_in_a_new_window = false;
 
_http http = {0, 0, 0, 0, 0, 0, 0};
 
82,6 → 77,7
#define URL_SERVICE_HOMEPAGE "WebView:home"
#define URL_SERVICE_HELP "WebView:help"
 
#define TOOLBAR_GAPS 10
dword TOOLBAR_H = 40;
dword STATUSBAR_H = 15;
 
110,9 → 106,9
char default_dir[] = "/rd/1";
od_filter filter2 = { 16, "TXT\0HTM\0HTML\0\0" };
 
char URL[URL_SIZE];
char editURL[URL_SIZE];
edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,URL_SIZE-2,#editURL,0,NULL,19,19};
char editURL[URL_SIZE+1];
edit_box address_box = {NULL,TOOLBAR_GAPS+TOOLBAR_GAPS+51,10,0xffffff,0x94AECE,0xffffff,
0xffffff,0x10000000,URL_SIZE-2,#editURL,0,NULL,19,19};
 
#define SKIN_Y 24
 
136,12 → 132,12
ExitProcess();
} else if (!strncmp(#param, "-s ", 3)) {
source_mode = true;
strcpy(#URL, #param + 3);
history.add(#param + 3);
} else {
strcpy(#URL, #param);
history.add(#param);
}
} else {
strcpy(#URL, URL_SERVICE_HOMEPAGE);
history.add(URL_SERVICE_HOMEPAGE);
}
}
 
163,7 → 159,7
edit_box_mouse stdcall (#address_box);
mouse.get();
if (PageLinks.HoverAndProceed(mouse.x, WB1.list.first + mouse.y))
&& (bufsize) && (mouse.pkm) && (mouse.up) {
&& (mouse.pkm) && (mouse.up) {
if (WB1.list.MouseOver(mouse.x, mouse.y)) EventShowPageMenu(mouse.x, mouse.y);
break;
}
225,7 → 221,8
ProcessEvent(menu.cur_y);
menu.cur_y = 0;
}
DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0);
DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),
GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0);
GetProcessInfo(#Form, SelfInfo);
system.color.get();
col_bg = system.color.work;
239,7 → 236,6
if (http.transfer > 0) {
http.receive();
EventUpdateProgressBar();
DrawStatusBar(T_LOADING);
if (http.receive_result == 0) {
// Handle redirects
if (http.status_code >= 300) && (http.status_code < 400)
257,23 → 253,14
GetAbsoluteURL(#http.redirect_url);
debug("Redirect: "); debugln(#http.redirect_url);
history.back();
strcpy(#URL, #http.redirect_url);
strcpy(#editURL, #URL);
DrawOmnibox();
OpenPage();
//ProcessLink(history.current());
OpenPage(#http.redirect_url);
}
break;
}
redirect_count = 0;
// Loading the page is complete, free resources
history.add(#URL);
bufpointer = http.content_pointer;
bufsize = http.content_received;
http.free();
DrawStatusBar(T_RENDERING);
ShowPage();
DrawStatusBar(NULL);
LoadInternalPage(http.content_pointer, http.content_received);
}
}
}
283,7 → 270,7
{
address_box.top = TOOLBAR_H/2-10;
basic_line_h = calc(WB1.list.font_h * 130) / 100;
address_box.width = Form.cwidth - address_box.left - 50;
address_box.width = Form.cwidth - address_box.left - 55;
WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x,
Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h);
WB1.list.wheel_size = 7 * basic_line_h;
291,7 → 278,7
WB1.list.visible = WB1.list.h;
if (WB1.list.w!=WB1.DrawBuf.bufw) {
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 800*20);
ProcessEvent(REFRESH_BUTTON);
OpenPage(history.current());
}
}
 
303,17 → 290,16
DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
SetElementSizes();
DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 25,border_color);
DefineButton(address_box.left-52, address_box.top-2, 24, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
DefineButton(address_box.left-27, address_box.top-2, 24, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
img_draw stdcall(skin.image, address_box.left-53, address_box.top-3, 51, skin.h, 0, SKIN_Y);
DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
DefineButton(Form.cwidth-27, address_box.top-3, 23, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
img_draw stdcall(skin.image, Form.cwidth-24, address_box.top-3, 17, skin.h, 102, SKIN_Y);
DefineHiddenButton(TOOLBAR_GAPS, address_box.top-2, 24, skin.h-2, BACK_BUTTON);
DefineHiddenButton(TOOLBAR_GAPS+25, address_box.top-2, 24, skin.h-2, FORWARD_BUTTON);
img_draw stdcall(skin.image, TOOLBAR_GAPS-1, address_box.top-3, 51, skin.h, 0, SKIN_Y);
DefineHiddenButton(address_box.left+address_box.width-4, address_box.top-2, 20, skin.h-3, REFRESH_BUTTON);
DefineHiddenButton(Form.cwidth-31, address_box.top-3, 24, skin.h-1, SANDWICH_BUTTON);
img_draw stdcall(skin.image, Form.cwidth-27, address_box.top+1, 17, 18, 51, SKIN_Y);
DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
if (!header) {
OpenPage();
OpenPage(history.current());
WB1.DrawScroller();
}
else {
320,7 → 306,8
WB1.DrawPage();
DrawOmnibox();
}
DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x,
scroll_wv.size_y-1, scroll_wv.bckg_col);
DrawProgress();
}
 
335,14 → 322,12
case SCAN_CODE_BS:
case BACK_BUTTON:
if (history.back()) {
strcpy(#URL, history.current());
OpenPage();
OpenPage(history.current());
}
return;
case FORWARD_BUTTON:
if (history.forward()) {
strcpy(#URL, history.current());
OpenPage();
OpenPage(history.current());
}
return;
case GOTOURL_BUTTON:
350,12 → 335,12
EventSubmitOmnibox();
return;
case REFRESH_BUTTON:
if (http.transfer > 0)
{
if (http.transfer > 0) {
StopLoading();
draw_window();
} else {
OpenPage(history.current());
}
else OpenPage();
return;
case SANDWICH_BUTTON:
EventShowPageMenu(Form.cwidth - 215, TOOLBAR_H-6);
364,8 → 349,8
EventViewSource();
break;
case EDIT_SOURCE:
if (check_is_the_adress_local(#URL)) {
RunProgram("/rd/1/tinypad", #URL);
if (check_is_the_adress_local(history.current())) {
RunProgram("/rd/1/tinypad", history.current());
} else {
CreateFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
372,8 → 357,7
}
return;
case VIEW_HISTORY:
strcpy(#URL, URL_SERVICE_HISTORY);
OpenPage();
OpenPage(URL_SERVICE_HISTORY);
return;
case DOWNLOAD_MANAGER:
if (!downloader_opened) {
410,8 → 394,6
$pop EAX
free(EAX); // free data
http.transfer=0;
bufsize = 0;
bufpointer = free(bufpointer);
pause(10);
}
wv_progress_bar.value = 0;
418,227 → 400,214
DrawOmnibox();
}
 
/*
void ReplaceSpaceInUrl() {
int i;
strcpy(#editURL, #URL);
while (i = strchr(#URL, ' '))
char new_url[URL_SIZE];
strcpy(#new_url, history.current());
while (i = strchr(#new_url, ' '))
{
i -= #URL;
strlcpy(#URL+i+3, #editURL+i+1, sizeof(URL)-i-4);
i -= #new_url;
strlcpy(#new_url+i+3, #new_url+i+1, URL_SIZE);
URL[i] = '%';
URL[i+1] = '2';
URL[i+2] = '0';
}
strcpy(#editURL, #URL);
strcpy(#editURL, #new_url);
}
 
void OpenPage()
//bool strrpl(dword dst, from, to, dst_len); !!!!!!!!
 
*/
 
bool GetLocalFileData(dword _path)
{
char getUrl[sizeof(URL)];
StopLoading();
strcpy(#editURL, #URL);
history.add(#URL);
if (!strncmp(#URL,"WebView:",8))
{
if (!strcmp(#URL, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#homepage, sizeof(homepage));
else if (!strcmp(#URL, URL_SERVICE_HELP)) LoadInternalPage(#help, sizeof(help));
else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
else {bufsize=0; ShowPage();} //page not found
DrawOmnibox();
return;
dword data, size;
file_size stdcall (_path);
if (!EBX) {
return false;
} else {
size = EBX;
data = malloc(size);
ReadFile(0, size, data, _path);
LoadInternalPage(data, size);
free(data);
return true;
}
if (!strncmp(#URL,"http:",5)) || (!strncmp(#URL,"https://",8))
{
ReplaceSpaceInUrl();
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 68, SKIN_Y);
 
if (!strncmp(#URL,"http:",5)) {
http.get(#URL);
} else if (!strncmp(#URL,"https://",8)) {
sprintf(#getUrl, "http://gate.aspero.pro/?site=%s", #URL);
http.get(#getUrl);
}
 
if (!http.transfer)
void OpenPage(dword _open_URL)
{
char new_url[URL_SIZE+1];
 
StopLoading();
bufsize = 0;
bufpointer = free(bufpointer);
ShowPage();
return;
 
strcpy(#editURL, _open_URL);
DrawOmnibox();
 
strncpy(#new_url, _open_URL, URL_SIZE);
 
//Exclude # from the URL to the load page
//We will bring it back when we get the buffer
if (strrchr(#new_url, '#')) anchors.take_anchor_from(#new_url);
 
history.add(#new_url);
 
if (!strncmp(#new_url,"WebView:",8)) {
//INTERNAL PAGE
if (!strcmp(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#homepage, sizeof(homepage));
else if (!strcmp(#new_url, URL_SERVICE_HELP)) LoadInternalPage(#help, sizeof(help));
else if (!strcmp(#new_url, URL_SERVICE_HISTORY)) ShowHistory();
else LoadInternalPage(#page_not_found, sizeof(page_not_found));
} else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) {
//WEB PAGE
//ReplaceSpaceInUrl(); !!!!!!!!
img_draw stdcall(skin.image, address_box.left+address_box.width+1,
address_box.top-3, 17, skin.h, 85, SKIN_Y);
 
if (!strncmp(#new_url,"http:",5)) {
http.get(#new_url);
} else if (!strncmp(#new_url,"https://",8)) {
strcpy(#new_url, "http://gate.aspero.pro/?site=");
strncat(#new_url, _open_URL, URL_SIZE);
http.get(#new_url);
}
if (!http.transfer) {
StopLoading();
LoadInternalPage(#page_not_found, sizeof(page_not_found));
}
else
{
file_size stdcall (#URL);
if (EBX) {
bufsize = EBX;
free(bufpointer);
bufpointer = malloc(bufsize);
ReadFile(0, bufsize, bufpointer, #URL);
} else {
bufsize = bufpointer = 0;
//LOCAL PAGE
if (!GetLocalFileData(#new_url)) {
LoadInternalPage(#page_not_found, sizeof(page_not_found));
}
ShowPage();
}
}
 
void ProcessAnchor()
void EventClickLink(dword _click_URL)
{
char anchor[256];
dword anchor_pos;
char new_url[URL_SIZE];
anchor_pos = strrchr(#URL, '#')-1;
strlcpy(#anchor, #URL+anchor_pos, sizeof(anchor)-1);
URL[anchor_pos] = 0x00;
 
if (URL[0] == NULL) {
//case when URL consists of anchor only
if (anchors.get_pos_by_name(#anchor+1)!=-1) WB1.list.first = anchors.get_pos_by_name(#anchor+1);
strcpy(#URL, history.current());
} else {
GetAbsoluteURL(#URL);
OpenPage();
if (anchors.get_pos_by_name(#anchor+1)!=-1) WB1.list.first = anchors.get_pos_by_name(#anchor+1);
if (ESBYTE[_click_URL]=='#') {
if (anchors.get_pos_by_name(_click_URL+1)!=-1) {
WB1.list.first = anchors.get_pos_by_name(_click_URL+1);
WB1.list.CheckDoesValuesOkey();
}
 
strcpy(#editURL, history.current());
strcat(#editURL, _click_URL);
DrawOmnibox();
WB1.DrawPage();
strcpy(#editURL, #URL);
strcat(#editURL, #anchor);
DrawOmnibox();
return;
}
 
void EventSubmitOmnibox()
{
if (!editURL[0]) return;
if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/')
|| (!strncmp(#editURL,"https:",6)) || (!strncmp(#editURL,"WebView:",8))
{
strcpy(#URL, #editURL);
if (!strncmp(_click_URL,"mailto:", 7)) || (!strncmp(_click_URL,"tel:", 4)) {
notify(_click_URL);
return;
}
else
{
strlcpy(#URL,"http://",7);
strcat(#URL, #editURL);
}
OpenPage();
}
 
void EventClickLink()
{
strcpy(#URL, PageLinks.GetURL(PageLinks.active));
GetAbsoluteURL(#URL);
ProcessLink();
}
 
void ProcessLink()
{
if (http.transfer > 0)
{
if (http.transfer > 0) {
StopLoading();
history.back();
}
if (strrchr(#URL, '#')!=0) {
ProcessAnchor();
return;
}
strcpy(#new_url, _click_URL);
GetAbsoluteURL(#new_url);
 
if (!strncmp(#URL,"mailto:", 7)) || (!strncmp(#URL,"tel:", 4))
{
notify(#URL);
strcpy(#editURL, history.current());
strcpy(#URL, history.current());
if (strrchr(#new_url, '#')!=0) {
anchors.take_anchor_from(#new_url);
OpenPage(#new_url);
return;
}
 
if (!strncmp(#URL,"WebView:",8)) {
OpenPage();
if (!strncmp(#new_url,"WebView:",8)) {
OpenPage(#new_url);
return;
}
 
if (strncmp(#URL,"http://",7)!=0) && (strncmp(#URL,"https://",8)!=0)
if (strncmp(#new_url,"http://",7)!=0) && (strncmp(#new_url,"https://",8)!=0)
{
if (UrlExtIs(".htm")!=true) && (UrlExtIs(".html")!=true)
if (UrlExtIs(#new_url,".htm")!=true) && (UrlExtIs(#new_url,".html")!=true)
{
if (strchr(#URL, '|')) {
ESBYTE[strchr(#URL, '|')] = NULL;
RunProgram(#URL, strlen(#URL)+1+#URL);
if (strchr(#new_url, '|')) {
ESBYTE[strchr(#new_url, '|')] = NULL;
RunProgram(#new_url, strlen(#new_url)+1+#new_url);
} else {
RunProgram("/sys/@open", #new_url);
}
else {
RunProgram("/sys/@open", #URL);
}
strcpy(#editURL, history.current());
strcpy(#URL, history.current());
return;
}
}
else
{
if (UrlExtIs(".png")==true) || (UrlExtIs(".gif")==true) || (UrlExtIs(".jpg")==true)
|| (UrlExtIs(".zip")==true) || (UrlExtIs(".kex")==true) || (UrlExtIs(".pdf")==true)
|| (UrlExtIs(".7z")==true) {
} else {
if (UrlExtIs(#new_url,".png")==true) || (UrlExtIs(#new_url,".jpg")==true)
|| (UrlExtIs(#new_url,".zip")==true) || (UrlExtIs(#new_url,".kex")==true) || (UrlExtIs(#new_url,".pdf")==true)
|| (UrlExtIs(#new_url,".7z")==true) {
if (!downloader_opened) {
strcpy(#downloader_edit, #URL);
strcpy(#downloader_edit, #new_url);
CreateThread(#Downloader,#downloader_stak+4092);
strcpy(#editURL, history.current());
strcpy(#URL, history.current());
}
else notify("'WebView\nPlease, start a new download only when previous ended.'Et");
return;
}
}
if (open_in_a_new_window)
{
RunProgram(#program_path, #URL);
strcpy(#editURL, history.current());
strcpy(#URL, history.current());
OpenPage(#new_url);
}
else
 
void EventSubmitOmnibox()
{
OpenPage();
char new_url[URL_SIZE+1];
if (!editURL[0]) return;
if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/')
|| (!strncmp(#editURL,"https:",6)) || (!strncmp(#editURL,"WebView:",8)) {
OpenPage(#editURL);
} else {
strcpy(#new_url, "http://");
strncat(#new_url, #editURL, sizeof(new_url)-1);
OpenPage(#new_url);
}
open_in_a_new_window = false;
}
 
void DrawOmnibox()
{
int skin_x_offset;
DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 2, address_box.color);
DrawBar(address_box.left-2, address_box.top, 2, 22, address_box.color);
DrawRectangle(address_box.left-2, address_box.top-3, address_box.width+5, 25,border_color);
 
DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 1,0xD8DCD8);
DrawBar(address_box.left-2, address_box.top-1, address_box.width+3, 1, address_box.color);
img_draw stdcall(skin.image, address_box.left-2, address_box.top-3, 2, skin.h, 102, SKIN_Y);
if (address_box.flags & ed_focus) address_box.flags = ed_focus; else address_box.flags = 0;
EditBox_UpdateText(#address_box, address_box.flags);
edit_box_draw stdcall(#address_box);
if (http.transfer > 0) skin_x_offset = 68; else skin_x_offset = 51;
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y);
if (http.transfer > 0) skin_x_offset = 85; else skin_x_offset = 68;
img_draw stdcall(skin.image, address_box.left+address_box.width+1,
address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y);
}
 
void LoadInternalPage(dword _bufpos, _in_filesize){
bufsize = _in_filesize;
if (bufpointer!=_bufpos) free(bufpointer);
void LoadInternalPage(dword _bufdata, _in_bufsize){
if (!_bufdata) || (!_in_bufsize) {
LoadInternalPage(#page_not_found, sizeof(page_not_found));
} else if (source_mode) {
source_mode = false;
//WB1.ParseHtml();
ShowSource(_bufdata, _in_bufsize);
} else {
bufsize = _in_bufsize;
if (bufpointer!=_bufdata) free(bufpointer);
bufpointer = malloc(bufsize);
memmov(bufpointer, _bufpos, bufsize);
ShowPage();
}
 
void ShowPage()
{
memmov(bufpointer, _bufdata, bufsize);
WB1.list.first = 0; //scroll page to the top
DrawOmnibox();
if (!bufsize) || (!bufpointer) {
LoadInternalPage(#page_not_found, sizeof(page_not_found));
if(!strrchr(#editURL, '#')) {
strcat(#editURL, #anchors.current);
DrawOmnibox();
}
WB1.ParseHtml();
if (source_mode) {
source_mode = false;
ShowSource();
LoadInternalPage(bufpointer, bufsize);
WB1.DrawPage();
}
}
 
byte UrlExtIs(dword ext)
byte UrlExtIs(dword base, ext)
{
if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
if (!strcmpi(base + strlen(base) - strlen(ext), ext)) return true;
return false;
}
 
646,9 → 615,13
{
dword persent;
if (http.transfer == 0) return;
if (wv_progress_bar.max) persent = wv_progress_bar.value*100/wv_progress_bar.max; else persent = 10;
DrawBar(address_box.left-2, address_box.top+20, persent*address_box.width/100, 2, 0x72B7EB);
if (wv_progress_bar.max) {
persent = wv_progress_bar.value*100/wv_progress_bar.max;
} else {
persent = 10;
}
DrawBar(address_box.left-1, address_box.top+20, persent*address_box.width/100, 2, 0x72B7EB);
}
 
void EventShowPageMenu(dword _left, _top)
{
672,9 → 645,11
 
void EventSeachWeb()
{
sprintf(#URL, "https://www.google.com/search?q=%s", #editURL);
replace_char(#URL, ' ', '_', sizeof(URL));
ProcessLink();
char new_url[URL_SIZE+1];
replace_char(#editURL, ' ', '_', URL_SIZE);
strcpy(#new_url, "https://www.google.com/search?q=");
strncat(#new_url, #editURL, URL_SIZE);
OpenPage(#new_url);
}
 
void EventOpenDialog()
681,16 → 656,15
{
OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) {
strcpy(#URL, #openfile_path);
OpenPage();
OpenPage(#openfile_path);
}
}
 
void EventViewSource()
{
char source_view_param[sizeof(URL)+4];
char source_view_param[URL_SIZE+1];
strcpy(#source_view_param, "-s ");
strcat(#source_view_param, #URL);
strncat(#source_view_param, history.current(), URL_SIZE);
RunProgram(#program_path, #source_view_param);
}
 
/programs/cmm/browser/html/help_en.htm
9,6 → 9,7
<font bg="#C7CEE4">[CTRL + N or CTRL + T]</font> New window
<font bg="#C7CEE4">[CTRL + R or F5]</font> Refresh the current page
<font bg="#C7CEE4">[CTRL + O]</font> Start OpenDialog to open local file
<font bg="#C7CEE4">[CTRL + U]</font> View a web page's source code
<font bg="#C7CEE4">[CTRL + H]</font> Open browser history
<font bg="#C7CEE4">[CTRL + J]</font> Display the file downloader
/programs/cmm/browser/html/help_ru.htm
6,6 → 6,7
<body><pre><h1>‘¯à ¢ª  WebView</h1>
<font bg="#C7CEE4">[CTRL + N ¨«¨ CTRL + T]</font> ®¢®¥ ®ª­®
<font bg="#C7CEE4">[CTRL + R ¨«¨ F5]</font> ¥à¥§ £à㧨âì áâà ­¨æã
<font bg="#C7CEE4">[CTRL + O]</font> ‚맢 âì ¤¨ «®£ ¢ë¡®à  ä ©« 
<font bg="#C7CEE4">[CTRL + U]</font> ‘¬®âà¥âì ¨á室­ë© ª®¤ áâà ­¨æë
<font bg="#C7CEE4">[CTRL + H]</font> ‘¬®âà¥âì ¨áâ®à¨î ¯®á¥é¥­­ëå áâà ­¨æ
<font bg="#C7CEE4">[CTRL + J]</font> Žâªàëâì § £àã§ç¨ª ä ©«®¢
/programs/cmm/browser/show_src.h
1,8 → 1,10
enum { TAG=1, VALUE, TEXT, COMMENT, SCRIPT};
 
dword source_buf_start, source_buf_end;
int opened_font=0;
int opened_font_counter=0;
int mode;
 
dword source_buf_end;
 
void SourceBufAdd(dword _mode, src)
{
dword font_found_pointer, src_orig = src;
13,13 → 15,13
source_buf_end += strlen(source_buf_end);
 
if (font_found_pointer = strstr(src, "</font>")) {
opened_font--;
opened_font_counter--;
src = font_found_pointer+2;
}
 
src = src_orig;
if (font_found_pointer = strstr(src, "<font ")) {
opened_font++;
opened_font_counter++;
src = font_found_pointer+2;
}
}
26,17 → 28,18
 
void CloseAllOpenedFonts(dword _mode)
{
while (opened_font) SourceBufAdd(_mode, "</font>");
while (opened_font_counter) SourceBufAdd(_mode, "</font>");
}
 
enum { TAG=1, VALUE, TEXT, COMMENT, SCRIPT};
dword ShowSource()
dword ShowSource(dword _bufdata, _in_bufsize)
{
dword i, j;
bool activate_script_mode = false;
dword source_buf_start;
 
opened_font=0;
source_buf_start = source_buf_end = malloc(bufsize*5);
opened_font_counter=0;
source_buf_end = malloc(_in_bufsize*5);
source_buf_start = source_buf_end;
header[strrchr(#header, '-')-2]=0;
 
SourceBufAdd(TEXT, "<html><head><title>Source: ");
43,7 → 46,7
SourceBufAdd(TEXT, #header);
SourceBufAdd(TEXT, "</title><body><pre>");
 
for (i=bufpointer; i<bufpointer+bufsize; i++) switch (ESBYTE[i])
for (i=_bufdata; i<_bufdata+_in_bufsize; i++) switch (ESBYTE[i])
{
case '<':
if (!strncmp(i+1,"!--", 3)) SourceBufAdd(COMMENT, "<font color=#bbb>&lt;");
89,7 → 92,6
source_buf_end++;
}
ESBYTE[source_buf_end] = 0;
bufsize = source_buf_end - source_buf_start;
free(bufpointer);
bufpointer = source_buf_start;
LoadInternalPage(source_buf_start, _in_bufsize);
free(source_buf_start);
}
/programs/cmm/codeview/codeview.c
189,7 → 189,7
 
void OpenPage()
{
char getUrl[URL_SIZE];
char getUrl[URL_SIZE+1];
strcpy(#editURL, #URL);
history.add(#URL);
if (!strncmp(#URL,"CodeView:",8))
239,6 → 239,7
DrawEditBoxWebView();
if (!bufsize) LoadInternalPage(#page_not_found, sizeof(page_not_found));
WB1.ParseHtml();
WB1.DrawPage();
}
 
void DrawStatusBar() {return;};
/programs/cmm/lib/draw_buf.h
39,7 → 39,6
bufh = i_bufh;
buf_data = free(buf_data);
IncreaseBufSize();
//debugval("buf_data",buf_data);
if (!buf_data) return false;
ESDWORD[buf_data] = bufw;
ESDWORD[buf_data+4] = bufh;
/programs/cmm/liza/mail_box.c
362,7 → 362,10
void DrawLetter() {
bufsize = strlen(mdata);
bufpointer = mdata;
if (bufsize) && (bufpointer) WB1.ParseHtml();
if (bufsize) && (bufpointer) {
WB1.ParseHtml();
WB1.DrawPage();
}
DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, 0xFFFfff);
}
 
/programs/cmm/txtread/toolbar.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream