forked from KolibriOS/kolibrios
WebView:
- fix unclosed <font> tag - use collection_int for colors - download images, no draw yet git-svn-id: svn://kolibrios.org@8016 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
fd10632095
commit
5ea0b92f65
@ -18,6 +18,7 @@ char line[500];
|
|||||||
struct _style {
|
struct _style {
|
||||||
bool
|
bool
|
||||||
b, u, s, h,
|
b, u, s, h,
|
||||||
|
font,
|
||||||
pre,
|
pre,
|
||||||
blq,
|
blq,
|
||||||
button,
|
button,
|
||||||
@ -30,6 +31,7 @@ struct _style {
|
|||||||
struct TWebBrowser {
|
struct TWebBrowser {
|
||||||
llist list;
|
llist list;
|
||||||
_style style;
|
_style style;
|
||||||
|
_img page_img;
|
||||||
dword draw_y, stolbec;
|
dword draw_y, stolbec;
|
||||||
int zoom;
|
int zoom;
|
||||||
dword o_bufpointer;
|
dword o_bufpointer;
|
||||||
@ -95,8 +97,8 @@ void TWebBrowser::Paint()
|
|||||||
DrawBuf.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, 0x999999);
|
DrawBuf.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, 0x999999);
|
||||||
}
|
}
|
||||||
|
|
||||||
text_color__ = text_colors[text_color_index];
|
text_color__ = text_colors.get_last();
|
||||||
if (link) && (text_colors[text_color_index]==text_colors[0]) text_color__ = link_color_default;
|
if (link) && (text_color__ == text_colors.get(0)) text_color__ = link_color_default;
|
||||||
|
|
||||||
DrawBuf.WriteText(start_x, draw_y, list.font_type, text_color__, #line, NULL);
|
DrawBuf.WriteText(start_x, draw_y, list.font_type, text_color__, #line, NULL);
|
||||||
if (style.b) DrawBuf.WriteText(start_x+1, draw_y, list.font_type, text_color__, #line, NULL);
|
if (style.b) DrawBuf.WriteText(start_x+1, draw_y, list.font_type, text_color__, #line, NULL);
|
||||||
@ -117,7 +119,7 @@ void TWebBrowser::Paint()
|
|||||||
void TWebBrowser::SetPageDefaults()
|
void TWebBrowser::SetPageDefaults()
|
||||||
{
|
{
|
||||||
style.b = style.u = style.s = style.h = style.blq = t_html = t_body = style.pre =
|
style.b = style.u = style.s = style.h = style.blq = t_html = t_body = style.pre =
|
||||||
link = text_color_index = text_colors[0] = style.tag_title = false;
|
link = style.tag_title = style.font = false;
|
||||||
style.tag_list.reset();
|
style.tag_list.reset();
|
||||||
link_color_default = 0x0000FF;
|
link_color_default = 0x0000FF;
|
||||||
link_color_active = 0xFF0000;
|
link_color_active = 0xFF0000;
|
||||||
@ -126,6 +128,9 @@ void TWebBrowser::SetPageDefaults()
|
|||||||
DrawBuf.Fill(0, page_bg);
|
DrawBuf.Fill(0, page_bg);
|
||||||
links.clear();
|
links.clear();
|
||||||
anchors.clear();
|
anchors.clear();
|
||||||
|
page_img.clear();
|
||||||
|
text_colors.drop();
|
||||||
|
text_colors.add(0);
|
||||||
header = NULL;
|
header = NULL;
|
||||||
cur_encoding = CH_CP866;
|
cur_encoding = CH_CP866;
|
||||||
draw_y = BODY_MARGIN;
|
draw_y = BODY_MARGIN;
|
||||||
@ -339,7 +344,7 @@ void TWebBrowser::SetStyle() {
|
|||||||
t_body = tag.opened;
|
t_body = tag.opened;
|
||||||
if (value = tag.get_value_of("link=")) link_color_default = GetColor(value);
|
if (value = tag.get_value_of("link=")) link_color_default = GetColor(value);
|
||||||
if (value = tag.get_value_of("alink=")) link_color_active = GetColor(value);
|
if (value = tag.get_value_of("alink=")) link_color_active = GetColor(value);
|
||||||
if (value = tag.get_value_of("text=")) text_colors[0]=GetColor(value);
|
if (value = tag.get_value_of("text=")) text_colors.set(0, GetColor(value));
|
||||||
if (value = tag.get_value_of("bgcolor=")) {
|
if (value = tag.get_value_of("bgcolor=")) {
|
||||||
style.bg_color = page_bg = GetColor(value);
|
style.bg_color = page_bg = GetColor(value);
|
||||||
DrawBuf.Fill(0, page_bg);
|
DrawBuf.Fill(0, page_bg);
|
||||||
@ -384,19 +389,23 @@ void TWebBrowser::SetStyle() {
|
|||||||
NewLine();
|
NewLine();
|
||||||
}
|
}
|
||||||
if (tag.is("font")) {
|
if (tag.is("font")) {
|
||||||
|
style.font = tag.opened;
|
||||||
style.bg_color = page_bg;
|
style.bg_color = page_bg;
|
||||||
if (tag.opened)
|
if (tag.opened)
|
||||||
{
|
{
|
||||||
text_color_index++;
|
|
||||||
text_colors[text_color_index] = text_colors[text_color_index-1];
|
|
||||||
if (value = tag.get_value_of("color=")) text_colors[text_color_index] = GetColor(value);
|
|
||||||
if (value = tag.get_value_of("bg=")) style.bg_color = GetColor(value);
|
if (value = tag.get_value_of("bg=")) style.bg_color = GetColor(value);
|
||||||
|
if (value = tag.get_value_of("color=")) {
|
||||||
|
text_colors.add(GetColor(value));
|
||||||
|
} else {
|
||||||
|
text_colors.add(text_colors.get_last());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (text_color_index > 0) text_color_index--;
|
else text_colors.pop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tag.is("div")) {
|
if (tag.is("div")) {
|
||||||
if (streq(#tag.prior,"div")) && (tag.opened) return;
|
if (streq(#tag.prior,"div")) && (tag.opened) return;
|
||||||
|
if (!tag.opened) && (style.font) text_colors.pop();
|
||||||
NewLine();
|
NewLine();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -435,8 +444,8 @@ void TWebBrowser::SetStyle() {
|
|||||||
if (value = tag.get_value_of("alt=")) && (strlen(value)<sizeof(line)-3) && (value) sprintf(#line, "[%s]", value);
|
if (value = tag.get_value_of("alt=")) && (strlen(value)<sizeof(line)-3) && (value) sprintf(#line, "[%s]", value);
|
||||||
if (!img_path) { line=0; return; }
|
if (!img_path) { line=0; return; }
|
||||||
style.image = true;
|
style.image = true;
|
||||||
text_color_index++;
|
page_img.add(#img_path, stolbec+1*list.font_w+3, draw_y);
|
||||||
text_colors[text_color_index] = 0x9A6F29;
|
text_colors.add(0x9A6F29);
|
||||||
if (!line) {
|
if (!line) {
|
||||||
if (!strncmp(#img_path, "data:", 5)) img_path=0;
|
if (!strncmp(#img_path, "data:", 5)) img_path=0;
|
||||||
replace_char(#img_path, '?', NULL, strlen(#img_path));
|
replace_char(#img_path, '?', NULL, strlen(#img_path));
|
||||||
@ -445,9 +454,8 @@ void TWebBrowser::SetStyle() {
|
|||||||
}
|
}
|
||||||
while (CheckForLineBreak()) {};
|
while (CheckForLineBreak()) {};
|
||||||
Paint();
|
Paint();
|
||||||
text_color_index--;
|
text_colors.pop();
|
||||||
style.image = false;
|
style.image = false;
|
||||||
//ImgCache.Images( list.x, draw_y, list.w);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tag.is("h4")) {
|
if (tag.is("h4")) {
|
||||||
@ -590,6 +598,7 @@ void TWebBrowser::NewLine()
|
|||||||
//============================================================================================
|
//============================================================================================
|
||||||
void TWebBrowser::DrawPage()
|
void TWebBrowser::DrawPage()
|
||||||
{
|
{
|
||||||
PutPaletteImage(list.first * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0);
|
PutPaletteImage(list.first * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0);
|
||||||
|
page_img.draw(list.x, list.y, list.first, list.h);
|
||||||
DrawScroller();
|
DrawScroller();
|
||||||
}
|
}
|
@ -6,8 +6,7 @@ struct color_spec {
|
|||||||
int rgb;
|
int rgb;
|
||||||
};
|
};
|
||||||
|
|
||||||
dword text_colors[300];
|
collection_int text_colors;
|
||||||
dword text_color_index;
|
|
||||||
|
|
||||||
struct color_spec color_specs[] = {
|
struct color_spec color_specs[] = {
|
||||||
"aliceblue", 0xF0F8FF,
|
"aliceblue", 0xF0F8FF,
|
||||||
@ -159,7 +158,7 @@ dword StrToCol(char* htmlcolor)
|
|||||||
textlen=0;
|
textlen=0;
|
||||||
char ch=0x00;
|
char ch=0x00;
|
||||||
|
|
||||||
if (ESBYTE[htmlcolor]<>'#') return text_colors[0];
|
if (ESBYTE[htmlcolor]<>'#') return text_colors.get(0);
|
||||||
|
|
||||||
textlen = strlen(htmlcolor);
|
textlen = strlen(htmlcolor);
|
||||||
|
|
||||||
@ -177,7 +176,7 @@ dword StrToCol(char* htmlcolor)
|
|||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
return text_colors[0];
|
return text_colors.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
dword GetColor(char* color_str)
|
dword GetColor(char* color_str)
|
||||||
@ -192,5 +191,5 @@ dword GetColor(char* color_str)
|
|||||||
if (!strcmpi(color_str, color_specs[ii].name)) return color_specs[ii].rgb;
|
if (!strcmpi(color_str, color_specs[ii].name)) return color_specs[ii].rgb;
|
||||||
}
|
}
|
||||||
|
|
||||||
return text_colors[0];
|
return text_colors.get(0);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,86 @@
|
|||||||
struct img
|
struct _img
|
||||||
{
|
{
|
||||||
collection src;
|
collection url;
|
||||||
collection_int data;
|
|
||||||
collection_int xywh;
|
collection_int xywh;
|
||||||
void drop();
|
collection_int data;
|
||||||
|
int getid;
|
||||||
|
dword add();
|
||||||
|
void clear();
|
||||||
|
dword current_url();
|
||||||
|
bool next_url();
|
||||||
|
void set_data();
|
||||||
|
void draw();
|
||||||
};
|
};
|
||||||
|
|
||||||
void img::drop()
|
dword _img::add(dword _path, _x, _y)
|
||||||
{
|
{
|
||||||
src.drop();
|
char full_path[URL_SIZE];
|
||||||
|
strncpy(#full_path, _path, URL_SIZE);
|
||||||
|
GetAbsoluteURL(#full_path, history.current());
|
||||||
|
|
||||||
|
url.add(#full_path);
|
||||||
|
xywh.add(_x);
|
||||||
|
xywh.add(_y);
|
||||||
|
xywh.add(0);
|
||||||
|
xywh.add(0);
|
||||||
|
return full_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _img::clear()
|
||||||
|
{
|
||||||
|
url.drop();
|
||||||
|
xywh.drop();
|
||||||
data.drop();
|
data.drop();
|
||||||
|
getid = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dword _img::current_url()
|
||||||
|
{
|
||||||
|
return url.get(getid);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _img::next_url()
|
||||||
|
{
|
||||||
|
if (getid < url.count-1) {
|
||||||
|
getid++;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _img::set_data(dword _data, _data_len)
|
||||||
|
{
|
||||||
|
data.set(getid, _data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawLibimgImage(dword _x, _y, _data, _data_len)
|
||||||
|
{
|
||||||
|
libimg_image im;
|
||||||
|
img_decode stdcall (_data, _data_len, 0);
|
||||||
|
$or eax, eax
|
||||||
|
$jz __ERROR__
|
||||||
|
|
||||||
|
im.image = EAX;
|
||||||
|
im.set_vars();
|
||||||
|
im.draw(_x, _y, im.w, im.h, 0, 0);
|
||||||
|
__ERROR__:
|
||||||
|
}
|
||||||
|
|
||||||
|
void _img::draw(int _x, _y, _start, _height)
|
||||||
|
{
|
||||||
|
int i, img_x, img_y;
|
||||||
|
|
||||||
|
for (i=0; i<url.count; i++)
|
||||||
|
{
|
||||||
|
img_x = xywh.get(i*4);
|
||||||
|
img_y = xywh.get(i*4 + 1);
|
||||||
|
|
||||||
|
if (img_y > _start) && (img_y < _start + _height)
|
||||||
|
{
|
||||||
|
if (cache.has(url.get(i)))
|
||||||
|
DrawLibimgImage(img_x + _x, img_y-_start + _y, cache.current_buf, cache.current_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
//Copyright 2007-2020 by Veliant & Leency
|
//Copyright 2007-2020 by Veliant & Leency
|
||||||
//Asper, lev, Lrz, Barsuk, Nable, hidnplayr...
|
//Asper, lev, Lrz, Barsuk, Nable, hidnplayr...
|
||||||
|
|
||||||
//Licence restriction: compiling this app for WIN32 is forbidden.
|
|
||||||
|
|
||||||
#ifndef AUTOBUILD
|
#ifndef AUTOBUILD
|
||||||
#include "lang.h--"
|
#include "lang.h--"
|
||||||
#endif
|
#endif
|
||||||
@ -32,6 +30,10 @@
|
|||||||
#include "..\lib\patterns\toolbar_button.h"
|
#include "..\lib\patterns\toolbar_button.h"
|
||||||
#include "..\lib\patterns\restart_process.h"
|
#include "..\lib\patterns\restart_process.h"
|
||||||
|
|
||||||
|
#define URL_SIZE 4000
|
||||||
|
|
||||||
|
char version[]="WebView 2.65";
|
||||||
|
|
||||||
#include "texts.h"
|
#include "texts.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "show_src.h"
|
#include "show_src.h"
|
||||||
@ -64,12 +66,13 @@ enum {
|
|||||||
TAB_CLOSE_ID = 900
|
TAB_CLOSE_ID = 900
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_history history;
|
||||||
|
|
||||||
enum { TARGET_SAME_TAB, TARGET_NEW_WINDOW, TARGET_NEW_TAB };
|
enum { TARGET_SAME_TAB, TARGET_NEW_WINDOW, TARGET_NEW_TAB };
|
||||||
|
|
||||||
#include "..\TWB\TWB.c" //HTML Parser, a core component
|
#include "..\TWB\TWB.c" //HTML Parser, a core component
|
||||||
|
|
||||||
TWebBrowser WB1;
|
TWebBrowser WB1;
|
||||||
_history history;
|
|
||||||
|
|
||||||
#include "history.h"
|
#include "history.h"
|
||||||
|
|
||||||
@ -79,10 +82,6 @@ _history history;
|
|||||||
#define TAB_H 20
|
#define TAB_H 20
|
||||||
dword TOOLBAR_H = PADDING+TSZE+PADDING+2;
|
dword TOOLBAR_H = PADDING+TSZE+PADDING+2;
|
||||||
|
|
||||||
#define URL_SIZE 4000
|
|
||||||
|
|
||||||
int action_buf;
|
|
||||||
|
|
||||||
_http http = 0;
|
_http http = 0;
|
||||||
|
|
||||||
bool source_mode = false;
|
bool source_mode = false;
|
||||||
@ -106,6 +105,8 @@ char editbox_icons[] = FROM "editbox_icons.raw";
|
|||||||
|
|
||||||
dword shared_url;
|
dword shared_url;
|
||||||
|
|
||||||
|
dword http_get_type;
|
||||||
|
|
||||||
void LoadLibraries()
|
void LoadLibraries()
|
||||||
{
|
{
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
load_dll(boxlib, #box_lib_init,0);
|
||||||
@ -202,7 +203,7 @@ void main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case evButton:
|
case evButton:
|
||||||
ProcessEvent( GetButtonID() );
|
ProcessEvent( @GetButtonID() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case evKey:
|
case evKey:
|
||||||
@ -260,7 +261,8 @@ void main()
|
|||||||
http.free();
|
http.free();
|
||||||
GetAbsoluteURL(#http.redirect_url, history.current());
|
GetAbsoluteURL(#http.redirect_url, history.current());
|
||||||
history.back();
|
history.back();
|
||||||
OpenPage(#http.redirect_url);
|
if (http_get_type==PAGE) OpenPage(#http.redirect_url);
|
||||||
|
else if (http_get_type==IMG) http.get(#http.redirect_url);
|
||||||
} else {
|
} else {
|
||||||
notify("'Too many redirects.' -E");
|
notify("'Too many redirects.' -E");
|
||||||
StopLoading();
|
StopLoading();
|
||||||
@ -270,8 +272,15 @@ void main()
|
|||||||
// Loading the page is complete, free resources
|
// Loading the page is complete, free resources
|
||||||
redirect_count = 0;
|
redirect_count = 0;
|
||||||
http.free();
|
http.free();
|
||||||
pages_cache.add(history.current(), http.content_pointer, http.content_received);
|
if (http_get_type==PAGE) {
|
||||||
LoadInternalPage(http.content_pointer, http.content_received);
|
cache.add(history.current(), http.content_pointer, http.content_received, PAGE);
|
||||||
|
LoadInternalPage(http.content_pointer, http.content_received);
|
||||||
|
}
|
||||||
|
else if (http_get_type==IMG) {
|
||||||
|
cache.add(WB1.page_img.current_url(), http.content_pointer, http.content_received, IMG);
|
||||||
|
WB1.page_img.set_data(cache.data.get_last(), http.content_received);
|
||||||
|
GetImg();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -287,44 +296,20 @@ bool ProcessCtrlKeyEvent()
|
|||||||
{
|
{
|
||||||
if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) switch(key_scancode)
|
if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) switch(key_scancode)
|
||||||
{
|
{
|
||||||
case SCAN_CODE_KEY_O:
|
case SCAN_CODE_KEY_O: EventOpenDialog(); return true;
|
||||||
EventOpenDialog();
|
case SCAN_CODE_KEY_H: ProcessEvent(VIEW_HISTORY); return true;
|
||||||
return true;
|
case SCAN_CODE_KEY_U: EventViewSource(); return true;
|
||||||
case SCAN_CODE_KEY_H:
|
case SCAN_CODE_KEY_T: EventOpenNewTab(URL_SERVICE_HOMEPAGE); return true;
|
||||||
ProcessEvent(VIEW_HISTORY);
|
case SCAN_CODE_KEY_N: RunProgram(#program_path, NULL); return true;
|
||||||
return true;
|
case SCAN_CODE_KEY_J: ProcessEvent(DOWNLOAD_MANAGER); return true;
|
||||||
case SCAN_CODE_KEY_U:
|
case SCAN_CODE_KEY_R: ProcessEvent(REFRESH_BUTTON); return true;
|
||||||
EventViewSource();
|
case SCAN_CODE_ENTER: EventSeachWeb(); return true;
|
||||||
return true;
|
case SCAN_CODE_LEFT: ProcessEvent(BACK_BUTTON); return true;
|
||||||
case SCAN_CODE_KEY_T:
|
case SCAN_CODE_RIGHT: ProcessEvent(FORWARD_BUTTON); return true;
|
||||||
EventOpenNewTab(URL_SERVICE_HOMEPAGE);
|
case SCAN_CODE_KEY_W: EventCloseActiveTab(); return true;
|
||||||
return true;
|
case SCAN_CODE_TAB: EventActivateNextTab(); return true;
|
||||||
case SCAN_CODE_KEY_N:
|
default: return false;
|
||||||
RunProgram(#program_path, NULL);
|
|
||||||
return true;
|
|
||||||
case SCAN_CODE_KEY_J:
|
|
||||||
ProcessEvent(DOWNLOAD_MANAGER);
|
|
||||||
return true;
|
|
||||||
case SCAN_CODE_KEY_R:
|
|
||||||
ProcessEvent(REFRESH_BUTTON);
|
|
||||||
return true;
|
|
||||||
case SCAN_CODE_ENTER:
|
|
||||||
EventSeachWeb();
|
|
||||||
return true;
|
|
||||||
case SCAN_CODE_LEFT:
|
|
||||||
ProcessEvent(BACK_BUTTON);
|
|
||||||
return true;
|
|
||||||
case SCAN_CODE_RIGHT:
|
|
||||||
ProcessEvent(FORWARD_BUTTON);
|
|
||||||
return true;
|
|
||||||
case SCAN_CODE_KEY_W:
|
|
||||||
EventCloseActiveTab();
|
|
||||||
return true;
|
|
||||||
case SCAN_CODE_TAB:
|
|
||||||
EventActivateNextTab();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetElementSizes()
|
void SetElementSizes()
|
||||||
@ -462,7 +447,7 @@ void ProcessEvent(dword id__)
|
|||||||
EventUpdateBrowser();
|
EventUpdateBrowser();
|
||||||
return;
|
return;
|
||||||
case CLEAR_CACHE:
|
case CLEAR_CACHE:
|
||||||
pages_cache.clear();
|
cache.clear();
|
||||||
notify(#clear_cache_ok);
|
notify(#clear_cache_ok);
|
||||||
EventRefreshPage();
|
EventRefreshPage();
|
||||||
return;
|
return;
|
||||||
@ -603,9 +588,9 @@ void OpenPage(dword _open_URL)
|
|||||||
and then halndle it in the propper way.
|
and then halndle it in the propper way.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (pages_cache.has(#new_url)) {
|
if (cache.has(#new_url)) {
|
||||||
//CACHED PAGE
|
//CACHED PAGE
|
||||||
LoadInternalPage(pages_cache.current_page_buf, pages_cache.current_page_size);
|
LoadInternalPage(cache.current_buf, cache.current_size);
|
||||||
|
|
||||||
} else if (!strncmp(#new_url,"WebView:",8)) {
|
} else if (!strncmp(#new_url,"WebView:",8)) {
|
||||||
//INTERNAL PAGE
|
//INTERNAL PAGE
|
||||||
@ -620,6 +605,7 @@ void OpenPage(dword _open_URL)
|
|||||||
strcpy(#editURL, #new_url);
|
strcpy(#editURL, #new_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
http_get_type = PAGE;
|
||||||
if (!strncmp(#new_url,"http:",5)) {
|
if (!strncmp(#new_url,"http:",5)) {
|
||||||
http.get(#new_url);
|
http.get(#new_url);
|
||||||
} else if (!strncmp(#new_url,"https://",8)) {
|
} else if (!strncmp(#new_url,"https://",8)) {
|
||||||
@ -777,8 +763,9 @@ void LoadInternalPage(dword _bufdata, _in_bufsize){
|
|||||||
WB1.custom_encoding = CH_CP866;
|
WB1.custom_encoding = CH_CP866;
|
||||||
ShowSource(WB1.bufpointer, _in_bufsize);
|
ShowSource(WB1.bufpointer, _in_bufsize);
|
||||||
} else {
|
} else {
|
||||||
WB1.DrawPage();
|
WB1.DrawPage();
|
||||||
}
|
}
|
||||||
|
//GetImg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -941,6 +928,9 @@ void DrawStatusBar()
|
|||||||
ESI = math.min(status_w/6, strlen(links.active_url));
|
ESI = math.min(status_w/6, strlen(links.active_url));
|
||||||
WriteText(10, status_y, 0, sc.work_text, links.active_url);
|
WriteText(10, status_y, 0, sc.work_text, links.active_url);
|
||||||
}
|
}
|
||||||
|
if (http.transfer>0) && (http_get_type==IMG) {
|
||||||
|
//
|
||||||
|
}
|
||||||
DefineHiddenButton(status_w+20, status_y-3, 60, 12, CHANGE_ENCODING);
|
DefineHiddenButton(status_w+20, status_y-3, 60, 12, CHANGE_ENCODING);
|
||||||
WriteTextCenter(status_w+20, status_y, 60, sc.work_text, WB1.cur_encoding*10+#charsets);
|
WriteTextCenter(status_w+20, status_y, 60, sc.work_text, WB1.cur_encoding*10+#charsets);
|
||||||
}
|
}
|
||||||
@ -983,4 +973,16 @@ dword GetAbsoluteActiveURL()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dword GetImg()
|
||||||
|
{
|
||||||
|
while (WB1.page_img.next_url()) {
|
||||||
|
if (cache.has(WB1.page_img.current_url())) continue;
|
||||||
|
http_get_type = IMG;
|
||||||
|
http.get(WB1.page_img.current_url());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DrawOmnibox();
|
||||||
|
WB1.DrawPage();
|
||||||
|
}
|
||||||
|
|
||||||
stop:
|
stop:
|
@ -1,17 +1,21 @@
|
|||||||
|
enum {
|
||||||
|
PAGE=1, IMG
|
||||||
|
};
|
||||||
|
|
||||||
struct PAGES_CACHE
|
struct _cache
|
||||||
{
|
{
|
||||||
dword current_page_buf;
|
dword current_buf;
|
||||||
dword current_page_size;
|
dword current_size;
|
||||||
collection url;
|
collection url;
|
||||||
collection_int data;
|
collection_int data;
|
||||||
collection_int size;
|
collection_int size;
|
||||||
|
collection_int type;
|
||||||
void add();
|
void add();
|
||||||
bool has();
|
bool has();
|
||||||
void clear();
|
void clear();
|
||||||
} pages_cache=0;
|
} cache=0;
|
||||||
|
|
||||||
void PAGES_CACHE::add(dword _url, _data, _size)
|
void _cache::add(dword _url, _data, _size, _type)
|
||||||
{
|
{
|
||||||
dword data_pointer;
|
dword data_pointer;
|
||||||
data_pointer = malloc(_size);
|
data_pointer = malloc(_size);
|
||||||
@ -20,25 +24,26 @@ void PAGES_CACHE::add(dword _url, _data, _size)
|
|||||||
|
|
||||||
url.add(_url);
|
url.add(_url);
|
||||||
size.add(_size);
|
size.add(_size);
|
||||||
|
type.add(_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PAGES_CACHE::has(dword _link)
|
bool _cache::has(dword _link)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
pos = url.get_pos_by_name(_link);
|
pos = url.get_pos_by_name(_link);
|
||||||
if (pos != -1) {
|
if (pos != -1) {
|
||||||
current_page_buf = data.get(pos);
|
current_buf = data.get(pos);
|
||||||
current_page_size = size.get(pos);
|
current_size = size.get(pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PAGES_CACHE::clear()
|
void _cache::clear()
|
||||||
{
|
{
|
||||||
url.drop();
|
url.drop();
|
||||||
data.drop();
|
data.drop();
|
||||||
size.drop();
|
size.drop();
|
||||||
current_page_buf = NULL;
|
current_buf = NULL;
|
||||||
current_page_size = NULL;
|
current_size = NULL;
|
||||||
}
|
}
|
@ -30,7 +30,7 @@ ShowHistory()
|
|||||||
free(history_pointer);
|
free(history_pointer);
|
||||||
history_pointer = malloc(history.items.data_size+256);
|
history_pointer = malloc(history.items.data_size+256);
|
||||||
strcat(history_pointer, HISTORY_HEADER);
|
strcat(history_pointer, HISTORY_HEADER);
|
||||||
for (i=0; i<history.items.count-1; i++)
|
for (i=0; i<history.items.count-1; i++) //if (cache.type.get(i) == PAGE)
|
||||||
{
|
{
|
||||||
strcat(history_pointer, "\t<a href='");
|
strcat(history_pointer, "\t<a href='");
|
||||||
strcat(history_pointer, history.items.get(i));
|
strcat(history_pointer, history.items.get(i));
|
||||||
@ -38,14 +38,14 @@ ShowHistory()
|
|||||||
strcat(history_pointer, history.items.get(i));
|
strcat(history_pointer, history.items.get(i));
|
||||||
strcat(history_pointer, "</a><br>");
|
strcat(history_pointer, "</a><br>");
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
strcat(history_pointer, "<br><b>Cached images</b><br>");
|
strcat(history_pointer, "<br><b>Cached images</b><br>");
|
||||||
for (i=1; i<ImgCache.pics_count; i++)
|
for (i=1; i<cache.url.count; i++) if (cache.type.get(i) == IMG)
|
||||||
{
|
{
|
||||||
strcat(history_pointer, "<a href='");
|
strcat(history_pointer, "<a href='");
|
||||||
strcat(history_pointer, #pics[i].path);
|
strcat(history_pointer, cache.url.get(i));
|
||||||
strcat(history_pointer, "'>");
|
strcat(history_pointer, "'>");
|
||||||
strcat(history_pointer, #pics[i].path);
|
strcat(history_pointer, cache.url.get(i));
|
||||||
strcat(history_pointer, "</a><br>");
|
strcat(history_pointer, "</a><br>");
|
||||||
|
|
||||||
// strcat(history_pointer, "<img src='");
|
// strcat(history_pointer, "<img src='");
|
||||||
@ -53,7 +53,7 @@ ShowHistory()
|
|||||||
// strcat(history_pointer, "'><br>");
|
// strcat(history_pointer, "'><br>");
|
||||||
// strcat(history_pointer, #pics[i].path);
|
// strcat(history_pointer, #pics[i].path);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
strcat(history_pointer, "</body></html>");
|
strcat(history_pointer, "</body></html>");
|
||||||
LoadInternalPage(history_pointer, strlen(history_pointer));
|
LoadInternalPage(history_pointer, strlen(history_pointer));
|
||||||
}
|
}
|
@ -1,5 +1,3 @@
|
|||||||
char version[]="WebView 2.61b";
|
|
||||||
|
|
||||||
#ifdef LANG_RUS
|
#ifdef LANG_RUS
|
||||||
char buidin_page_error[] = FROM "buidin_pages\\page_not_found_ru.htm""\0";
|
char buidin_page_error[] = FROM "buidin_pages\\page_not_found_ru.htm""\0";
|
||||||
char buidin_page_home[] = FROM "buidin_pages\\homepage_ru.htm""\0";
|
char buidin_page_home[] = FROM "buidin_pages\\homepage_ru.htm""\0";
|
||||||
|
Loading…
Reference in New Issue
Block a user