forked from KolibriOS/kolibrios
WebView images support (temporary is off, press F11 to enable)
git-svn-id: svn://kolibrios.org@8330 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
7b4bf97ec8
commit
67d3c20b4e
@ -1,142 +0,0 @@
|
||||
|
||||
struct _img
|
||||
{
|
||||
collection url;
|
||||
collection_int xywh;
|
||||
int getid;
|
||||
|
||||
void clear();
|
||||
dword add_pos();
|
||||
bool set_size();
|
||||
|
||||
dword current_url();
|
||||
bool next_url();
|
||||
|
||||
void draw_all();
|
||||
bool draw();
|
||||
};
|
||||
|
||||
void _img::clear()
|
||||
{
|
||||
url.drop();
|
||||
xywh.drop();
|
||||
getid = 0;
|
||||
}
|
||||
|
||||
dword _img::add_pos(dword _path, _x, _y)
|
||||
{
|
||||
char full_path[URL_SIZE];
|
||||
strncpy(#full_path, _path, URL_SIZE);
|
||||
get_absolute_url(#full_path, history.current());
|
||||
|
||||
url.add(#full_path);
|
||||
xywh.add(_x);
|
||||
xywh.add(_y);
|
||||
xywh.add(NULL);
|
||||
xywh.add(NULL);
|
||||
return full_path;
|
||||
}
|
||||
|
||||
bool _img::set_size(dword _buf, _size)
|
||||
{
|
||||
char vvv[1000];
|
||||
int w, h;
|
||||
img_decode stdcall (_buf, _size, 0);
|
||||
if (EAX) {
|
||||
EDI = EAX;
|
||||
w = ESDWORD[EDI+4];
|
||||
h = ESDWORD[EDI+8];
|
||||
xywh.set(getid*4+2, ESDWORD[EDI+4]);
|
||||
xywh.set(getid*4+3, ESDWORD[EDI+8]);
|
||||
sprintf(#vvv, "%s w:%i h:%i", current_url(), w, h);
|
||||
debugln(#vvv);
|
||||
}
|
||||
}
|
||||
|
||||
dword _img::current_url()
|
||||
{
|
||||
return url.get(getid);
|
||||
}
|
||||
|
||||
bool _img::next_url()
|
||||
{
|
||||
if (getid < url.count-1) {
|
||||
getid++;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _img::draw_all(int _x, _y, _start, _height)
|
||||
{
|
||||
int i, img_y;
|
||||
|
||||
for (i=0; i<url.count; i++)
|
||||
{
|
||||
img_y = xywh.get(i*4 + 1);
|
||||
|
||||
if (img_y > _start) && (img_y < _start + _height)
|
||||
&& (cache.has(url.get(i))) draw(_x, _y, _start, i);
|
||||
}
|
||||
}
|
||||
|
||||
bool _img::draw(int _x, _y, _start, i)
|
||||
{
|
||||
libimg_image im;
|
||||
img_decode stdcall (cache.current_buf, cache.current_size, 0);
|
||||
if (EAX) {
|
||||
im.image = EAX;
|
||||
im.draw(xywh.get(i*4) + _x, xywh.get(i*4+1) - _start + _y, im.w, im.h, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
void ImageCache::Images(dword left1, top1, width1)
|
||||
{
|
||||
dword image;
|
||||
dword imgw=0, imgh=0, img_lines_first=0, cur_pic=0;
|
||||
|
||||
//getting abs url from (#img_path);
|
||||
//cur_pic = GetImage(#img_path);
|
||||
|
||||
if (!pics[cur_pic].image)
|
||||
{
|
||||
//cur_pic = GetImage("/sys/network/noimg.png");
|
||||
return;
|
||||
}
|
||||
|
||||
imgw = DSWORD[pics[cur_pic].image+4];
|
||||
imgh = DSWORD[pics[cur_pic].image+8];
|
||||
if (imgw > width1) imgw = width1;
|
||||
|
||||
draw_y += imgh + 5; TEMPORARY TURN OFF!!!
|
||||
|
||||
if (top1+imgh<WB1.list.y) || (top1>WB1.list.y+WB1.list.h-10) return; //if all image is out of visible area
|
||||
if (top1<WB1.list.y) //if image partly visible (at the top)
|
||||
{
|
||||
img_lines_first=WB1.list.y-top1;
|
||||
imgh=imgh-img_lines_first;
|
||||
top1=WB1.list.y;
|
||||
}
|
||||
if (top1>WB1.list.y+WB1.list.h-imgh-5) //if image partly visible (at the bottom)
|
||||
{
|
||||
imgh=WB1.list.y+WB1.list.h-top1-5;
|
||||
}
|
||||
if (imgh<=0) return;
|
||||
|
||||
img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first);
|
||||
DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, page_bg);
|
||||
DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, page_bg);
|
||||
if (link)
|
||||
{
|
||||
UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, links.count + 400 + BT_HIDE, 0xB5BFC9);
|
||||
links.AddText(0, imgw, imgh-1, NOLINE, 1);
|
||||
WB1.DrawPage();
|
||||
}
|
||||
}
|
||||
|
||||
ImageCache ImgCache;
|
||||
|
||||
*/
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "..\TWB\colors.h"
|
||||
#include "..\TWB\anchors.h"
|
||||
#include "..\TWB\parse_tag.h"
|
||||
#include "..\TWB\special.h"
|
||||
#include "..\TWB\img.h"
|
||||
#include "..\TWB\tag_list.h"
|
||||
#include "TWB\colors.h"
|
||||
#include "TWB\anchors.h"
|
||||
#include "TWB\parse_tag.h"
|
||||
#include "TWB\special.h"
|
||||
#include "TWB\img.h"
|
||||
#include "TWB\tag_list.h"
|
||||
dword page_bg;
|
||||
dword link_color_default;
|
||||
dword link_color_active;
|
||||
#include "..\TWB\links.h"
|
||||
#include "TWB\links.h"
|
||||
|
||||
#define BODY_MARGIN 6
|
||||
#define BASIC_LINE_H 18
|
||||
@ -189,8 +189,8 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
||||
}
|
||||
for (bufpos=bufpointer ; (bufpos < bufpointer+bufsize) && (ESBYTE[bufpos]!=0) ; bufpos++;)
|
||||
{
|
||||
bukva = ESBYTE[bufpos];
|
||||
switch (bukva)
|
||||
//bukva = ESBYTE[bufpos];
|
||||
switch (ESBYTE[bufpos])
|
||||
{
|
||||
case 0x0a:
|
||||
if (style.pre) {
|
||||
@ -223,11 +223,22 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
||||
}
|
||||
break;
|
||||
case '<':
|
||||
if (!is_html) goto _default;
|
||||
if (!is_html) goto _DEFAULT;
|
||||
bufpos++;
|
||||
switch (ESBYTE[bufpos]) {
|
||||
case '!':
|
||||
case '/':
|
||||
case 'a'...'z':
|
||||
case 'A'...'Z':
|
||||
goto _TAG;
|
||||
default:
|
||||
goto _DEFAULT;
|
||||
}
|
||||
_TAG:
|
||||
if (!strncmp(bufpos,"!--",3))
|
||||
{
|
||||
bufpos+=3;
|
||||
//STRSTR
|
||||
while (strncmp(bufpos,"-->",3)!=0) && (bufpos < bufpointer + bufsize)
|
||||
{
|
||||
bufpos++;
|
||||
@ -245,13 +256,10 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
||||
while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
|
||||
{
|
||||
bukva = ESBYTE[bufpos];
|
||||
if (bukva == '\x9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
|
||||
if (!ignor_param) && (bukva <>' ')
|
||||
{
|
||||
if (__isWhite(bukva)) bukva = ' ';
|
||||
if (!ignor_param) && (bukva <>' ') {
|
||||
if (strlen(#tag.name)+1<sizeof(tag.name)) chrcat(#tag.name, bukva);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ignor_param = true;
|
||||
if (strlen(#tag.params)+1<sizeof(tag.params)) strcat(#tag.params, #bukva);
|
||||
//chrncat(#tag.params, bukva, sizeof(tag.params)-1);
|
||||
@ -277,7 +285,7 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_default:
|
||||
_DEFAULT:
|
||||
AddCharToTheLine(ESBYTE[bufpos]);
|
||||
}
|
||||
}
|
||||
@ -441,13 +449,44 @@ void TWebBrowser::SetStyle() {
|
||||
style.pre = tag.opened; return;
|
||||
}
|
||||
if (tag.is("img")) {
|
||||
if (value = tag.get_value_of("src=")) strlcpy(#img_path, value, sizeof(img_path)-1);
|
||||
value = tag.get_value_of("src=");
|
||||
|
||||
/*
|
||||
if (streqrp(value, "data:")) {
|
||||
EAX = strstr(value, "base64,");
|
||||
if (value == EAX) return;
|
||||
value = EAX;
|
||||
//cache.add(history.current(), http.content_pointer, http.content_received, PAGE);
|
||||
base64_decode stdcall (#pass_b64, value, strlen(value));
|
||||
} else
|
||||
*/
|
||||
strlcpy(#img_path, value, sizeof(img_path)-1);
|
||||
|
||||
if (!img_path) { line=0; return; }
|
||||
|
||||
value = page_img.add_pos(#img_path, stolbec+1*list.font_w+3, draw_y);
|
||||
|
||||
if (cache.has(value)) {
|
||||
if (page_img.set_size(page_img.url.count-1, cache.current_buf, cache.current_size)) {
|
||||
|
||||
if (link) links.add_text(
|
||||
stolbec * list.font_w + BODY_MARGIN + list.x,
|
||||
draw_y + list.y,
|
||||
page_img.xywh.get(page_img.url.count-1*4+2),
|
||||
page_img.xywh.get(page_img.url.count-1*4+3),
|
||||
0);
|
||||
|
||||
stolbec += page_img.xywh.get(page_img.url.count-1*4+2) / 6 + 1;
|
||||
//if (stolbec > list.column_max) NewLine();
|
||||
value = page_img.xywh.get(page_img.url.count-1*4+3);
|
||||
if (value > list.item_h) {draw_y += value - list.item_h; NewLine();}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (value = tag.get_value_of("title=")) && (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; }
|
||||
style.image = true;
|
||||
page_img.add_pos(#img_path, stolbec+1*list.font_w+3, draw_y);
|
||||
text_colors.add(0x9A6F29);
|
||||
if (!line) {
|
||||
if (!strncmp(#img_path, "data:", 5)) img_path=0;
|
||||
replace_char(#img_path, '?', NULL, strlen(#img_path));
|
||||
@ -455,9 +494,12 @@ void TWebBrowser::SetStyle() {
|
||||
line[50]= NULL;
|
||||
}
|
||||
while (CheckForLineBreak()) {};
|
||||
|
||||
text_colors.add(0x9A6F29);
|
||||
style.image = true;
|
||||
Paint();
|
||||
text_colors.pop();
|
||||
style.image = false;
|
||||
text_colors.pop();
|
||||
return;
|
||||
}
|
||||
if (tag.is("h4")) {
|
||||
@ -607,6 +649,6 @@ void TWebBrowser::NewLine()
|
||||
void TWebBrowser::DrawPage()
|
||||
{
|
||||
PutPaletteImage(list.first * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0);
|
||||
page_img.draw_all(list.x, list.y, list.first, list.h);
|
||||
page_img.draw_all(list.x, list.y, list.w, list.h, list.first);
|
||||
DrawScroller();
|
||||
}
|
98
programs/cmm/browser/TWB/img.h
Normal file
98
programs/cmm/browser/TWB/img.h
Normal file
@ -0,0 +1,98 @@
|
||||
|
||||
struct _img
|
||||
{
|
||||
collection url;
|
||||
collection_int xywh;
|
||||
int getid;
|
||||
|
||||
void clear();
|
||||
dword add_pos();
|
||||
bool set_size();
|
||||
|
||||
dword current_url();
|
||||
bool next_url();
|
||||
|
||||
void draw_all();
|
||||
bool draw();
|
||||
};
|
||||
|
||||
void _img::clear()
|
||||
{
|
||||
url.drop();
|
||||
xywh.drop();
|
||||
getid = 0;
|
||||
}
|
||||
|
||||
dword _img::add_pos(dword _path, _x, _y)
|
||||
{
|
||||
char full_path[URL_SIZE];
|
||||
strncpy(#full_path, _path, URL_SIZE);
|
||||
get_absolute_url(#full_path, history.current());
|
||||
|
||||
url.add(#full_path);
|
||||
xywh.add(_x);
|
||||
xywh.add(_y);
|
||||
xywh.add(NULL);
|
||||
xywh.add(NULL);
|
||||
return #full_path;
|
||||
}
|
||||
|
||||
bool _img::set_size(dword _id, _buf, _size)
|
||||
{
|
||||
img_decode stdcall (_buf, _size, 0);
|
||||
if (EAX) {
|
||||
EDI = EAX;
|
||||
xywh.set(_id*4+2, ESDWORD[EDI+4]);
|
||||
xywh.set(_id*4+3, ESDWORD[EDI+8]);
|
||||
free(EDI);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//DELTE!!!!!11111111111111111111111111111111111111
|
||||
dword _img::current_url()
|
||||
{
|
||||
return url.get(getid);
|
||||
}
|
||||
|
||||
//DELTE!!!!!11111111111111111111111111111111111111
|
||||
bool _img::next_url()
|
||||
{
|
||||
if (getid < url.count-1) {
|
||||
getid++;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _img::draw_all(int _x, _y, _w, _h, _start)
|
||||
{
|
||||
int i, img_y;
|
||||
|
||||
for (i=0; i<url.count; i++)
|
||||
{
|
||||
img_y = xywh.get(i*4 + 1);
|
||||
|
||||
if (img_y > _start) && (img_y < _start + _h)
|
||||
&& (cache.has(url.get(i))) draw(_x, _y, _w, _h, _start, i);
|
||||
}
|
||||
}
|
||||
|
||||
bool _img::draw(int _x, _y, _w, _h, _start, i)
|
||||
{
|
||||
int img_x, img_y, img_w, img_h;
|
||||
img_decode stdcall (cache.current_buf, cache.current_size, 0);
|
||||
if (EAX) {
|
||||
EDI = EAX;
|
||||
|
||||
img_x = xywh.get(i*4+0);
|
||||
img_y = xywh.get(i*4+1);
|
||||
img_w = math.min(xywh.set(getid*4+2, ESDWORD[EDI+4]), _w - img_x);
|
||||
img_h = math.min(xywh.set(getid*4+3, ESDWORD[EDI+8]), _h + _start - img_y);
|
||||
|
||||
|
||||
img_draw stdcall(EDI, img_x + _x, img_y - _start + _y, img_w, img_h, 0, 0);
|
||||
free(EDI);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
CustomCursor CursorPointer;
|
||||
dword CursorFile = FROM "../TWB/pointer.cur";
|
||||
dword CursorFile = FROM "TWB/pointer.cur";
|
||||
#include "..\lib\collection.h"
|
||||
|
||||
struct PAGE_LINKS {
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
@ -22,6 +22,7 @@
|
||||
#include "..\lib\obj\http.h"
|
||||
#include "..\lib\obj\iconv.h"
|
||||
#include "..\lib\obj\proc_lib.h"
|
||||
#include "..\lib\obj\netcode.h"
|
||||
|
||||
//useful patterns
|
||||
#include "..\lib\patterns\history.h"
|
||||
@ -31,13 +32,14 @@
|
||||
|
||||
char editbox_icons[] = FROM "res/editbox_icons.raw";
|
||||
|
||||
char version[]="WebView 2.7e";
|
||||
char version[]="WebView 2.8 ALPHA PREVIEW";
|
||||
|
||||
#include "texts.h"
|
||||
#include "cache.h"
|
||||
#include "show_src.h"
|
||||
|
||||
bool debug_mode = false;
|
||||
bool show_images = false;
|
||||
|
||||
enum {
|
||||
NEW_TAB=600,
|
||||
@ -68,7 +70,7 @@ _history history;
|
||||
|
||||
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;
|
||||
|
||||
@ -84,7 +86,7 @@ _http http = 0;
|
||||
|
||||
bool source_mode = false;
|
||||
|
||||
progress_bar wv_progress_bar;
|
||||
progress_bar prbar;
|
||||
char stak[4096];
|
||||
proc_info Form;
|
||||
|
||||
@ -110,6 +112,7 @@ void LoadLibraries()
|
||||
load_dll(libimg, #libimg_init,1);
|
||||
load_dll(libHTTP, #http_lib_init,1);
|
||||
load_dll(iconv_lib, #iconv_open,0);
|
||||
load_dll(netcode_lib, #base64_encode,0);
|
||||
load_dll(Proc_lib, #OpenDialog_init,0);
|
||||
OpenDialog_init stdcall (#o_dialog);
|
||||
}
|
||||
@ -156,7 +159,7 @@ void main()
|
||||
if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
|
||||
|
||||
scrollbar_v_mouse (#scroll_wv);
|
||||
if (scroll_wv.delta) {
|
||||
if (scroll_wv.delta2) {
|
||||
WB1.list.first = scroll_wv.position;
|
||||
WB1.DrawPage();
|
||||
break;
|
||||
@ -164,24 +167,24 @@ void main()
|
||||
|
||||
if (links.hover(WB1.list.y, WB1.list.first))
|
||||
{
|
||||
if (mouse.mkm) {
|
||||
if (mouse.key&MOUSE_MIDDLE) && (mouse.up) {
|
||||
if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) {
|
||||
EventClickLink(TARGET_NEW_WINDOW);
|
||||
} else {
|
||||
EventClickLink(TARGET_NEW_TAB);
|
||||
}
|
||||
}
|
||||
if (mouse.lkm) {
|
||||
if (mouse.key&MOUSE_LEFT) && (mouse.up) {
|
||||
CursorPointer.Restore();
|
||||
EventClickLink(TARGET_SAME_TAB);
|
||||
}
|
||||
if (mouse.pkm) {
|
||||
if (mouse.key&MOUSE_RIGHT) && (mouse.up) {
|
||||
CursorPointer.Restore();
|
||||
EventShowLinkMenu();
|
||||
}
|
||||
} else {
|
||||
CursorPointer.Restore();
|
||||
if (mouse.pkm) && (WB1.list.MouseOver(mouse.x, mouse.y)) {
|
||||
if (mouse.key&MOUSE_RIGHT) && (mouse.up) && (WB1.list.MouseOver(mouse.x, mouse.y)) {
|
||||
EventShowPageMenu();
|
||||
}
|
||||
}
|
||||
@ -259,7 +262,7 @@ void main()
|
||||
}
|
||||
else if (http_get_type==IMG) {
|
||||
cache.add(WB1.page_img.current_url(), http.content_pointer, http.content_received, IMG);
|
||||
WB1.page_img.set_size(http.content_pointer, http.content_received);
|
||||
WB1.page_img.set_size(WB1.page_img.getid, http.content_pointer, http.content_received);
|
||||
GetImg();
|
||||
}
|
||||
}
|
||||
@ -397,6 +400,7 @@ void ProcessEvent(dword id__)
|
||||
case DOWNLOAD_LINK_CT: EventOpenDownloader( GetAbsoluteActiveURL() ); return;
|
||||
case OPEN_FILE: EventOpenDialog(); return;
|
||||
case SCAN_CODE_F12: EventToggleDebugMode(); return;
|
||||
case SCAN_CODE_F11: show_images^=1; return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -420,10 +424,10 @@ void EventAllTabsClick(dword _n)
|
||||
void EventEditSource()
|
||||
{
|
||||
if (check_is_the_adress_local(history.current())) {
|
||||
RunProgram("/rd/1/tinypad", history.current());
|
||||
RunProgram("/rd/1/quark", history.current());
|
||||
} else {
|
||||
CreateFile(WB1.bufsize, WB1.bufpointer, "/tmp0/1/WebView_tmp.htm");
|
||||
if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
|
||||
if (!EAX) RunProgram("/rd/1/quark", "/tmp0/1/WebView_tmp.htm");
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,7 +447,7 @@ void EventCopyLinkToClipboard()
|
||||
void StopLoading()
|
||||
{
|
||||
if (http.stop()) pause(10);
|
||||
wv_progress_bar.value = 0;
|
||||
prbar.value = 0;
|
||||
DrawOmnibox();
|
||||
}
|
||||
|
||||
@ -494,10 +498,22 @@ bool GetLocalFileData(dword _path)
|
||||
return true;
|
||||
}
|
||||
|
||||
void GetUrl(dword _http_url)
|
||||
{
|
||||
char new_url_full[URL_SIZE+1];
|
||||
|
||||
if (!strncmp(_http_url,"http:",5)) {
|
||||
http.get(_http_url);
|
||||
} else if (!strncmp(_http_url,"https://",8)) {
|
||||
strcpy(#new_url_full, "http://gate.aspero.pro/?site=");
|
||||
strncat(#new_url_full, _http_url, URL_SIZE);
|
||||
http.get(#new_url_full);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenPage(dword _open_URL)
|
||||
{
|
||||
char new_url[URL_SIZE+1];
|
||||
char new_url_full[URL_SIZE+1];
|
||||
int unz_id;
|
||||
|
||||
StopLoading();
|
||||
@ -542,13 +558,7 @@ void OpenPage(dword _open_URL)
|
||||
}
|
||||
|
||||
http_get_type = PAGE;
|
||||
if (!strncmp(#new_url,"http:",5)) {
|
||||
http.get(#new_url);
|
||||
} else if (!strncmp(#new_url,"https://",8)) {
|
||||
strcpy(#new_url_full, "http://gate.aspero.pro/?site=");
|
||||
strncat(#new_url_full, #new_url, URL_SIZE);
|
||||
http.get(#new_url_full);
|
||||
}
|
||||
GetUrl(#new_url);
|
||||
|
||||
DrawOmnibox();
|
||||
|
||||
@ -703,7 +713,7 @@ void LoadInternalPage(dword _bufdata, _in_bufsize){
|
||||
} else {
|
||||
WB1.DrawPage();
|
||||
}
|
||||
//GetImg();
|
||||
GetImg();
|
||||
}
|
||||
}
|
||||
|
||||
@ -715,14 +725,11 @@ bool UrlExtIs(dword base, ext)
|
||||
|
||||
void DrawProgress()
|
||||
{
|
||||
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-1, address_box.top+20, persent*address_box.width+16/100, 2, 0x72B7EB);
|
||||
dword pct;
|
||||
if (!http.transfer) return;
|
||||
if (http_get_type==PAGE) && (prbar.max) pct = prbar.value*30/prbar.max; else pct = 10;
|
||||
if (http_get_type==IMG) pct = WB1.page_img.getid * 70 / WB1.page_img.url.count + 30;
|
||||
DrawBar(address_box.left-1, address_box.top+20, pct*address_box.width+16/100, 2, 0x72B7EB);
|
||||
}
|
||||
|
||||
void EventShowPageMenu()
|
||||
@ -766,10 +773,10 @@ void ProcessMenuClick()
|
||||
|
||||
void EventUpdateProgressBar()
|
||||
{
|
||||
wv_progress_bar.max = http.content_length;
|
||||
if (wv_progress_bar.value != http.content_received)
|
||||
prbar.max = http.content_length;
|
||||
if (prbar.value != http.content_received)
|
||||
{
|
||||
wv_progress_bar.value = http.content_received;
|
||||
prbar.value = http.content_received;
|
||||
DrawProgress();
|
||||
}
|
||||
}
|
||||
@ -925,21 +932,24 @@ void HandleRedirect()
|
||||
char redirect_url[URL_SIZE];
|
||||
http.header_field("location", #redirect_url, URL_SIZE);
|
||||
get_absolute_url(#redirect_url, history.current());
|
||||
history.back();
|
||||
if (http_get_type==PAGE) history.back();
|
||||
http.hfree();
|
||||
if (http_get_type==PAGE) OpenPage(#redirect_url);
|
||||
else if (http_get_type==IMG) http.get(#redirect_url);
|
||||
else if (http_get_type==IMG) GetUrl(#redirect_url);
|
||||
}
|
||||
|
||||
dword GetImg()
|
||||
{
|
||||
if (!show_images) return;
|
||||
while (WB1.page_img.next_url()) {
|
||||
DrawProgress();
|
||||
if (cache.has(WB1.page_img.current_url())) continue;
|
||||
http_get_type = IMG;
|
||||
http.get(WB1.page_img.current_url());
|
||||
GetUrl(WB1.page_img.current_url());
|
||||
return;
|
||||
}
|
||||
DrawOmnibox();
|
||||
WB1.ParseHtml(WB1.o_bufpointer, WB1.bufsize);
|
||||
WB1.DrawPage();
|
||||
}
|
||||
|
||||
|
@ -42,16 +42,10 @@ ShowHistory()
|
||||
strcat(history_pointer, "<br><b>Cached images</b><br>");
|
||||
for (i=1; i<cache.url.count; i++) if (cache.type.get(i) == IMG)
|
||||
{
|
||||
strcat(history_pointer, "<a href='");
|
||||
strcat(history_pointer, cache.url.get(i));
|
||||
strcat(history_pointer, "'>");
|
||||
strcat(history_pointer, "<img src='");
|
||||
strcat(history_pointer, cache.url.get(i));
|
||||
strcat(history_pointer, "</a><br>");
|
||||
|
||||
// strcat(history_pointer, "<img src='");
|
||||
// strcat(history_pointer, #pics[i].path);
|
||||
// strcat(history_pointer, "'><br>");
|
||||
// strcat(history_pointer, #pics[i].path);
|
||||
strcat(history_pointer, "'><br>");
|
||||
}
|
||||
|
||||
strcat(history_pointer, "</body></html>");
|
||||
|
@ -16,7 +16,7 @@ struct collection_int
|
||||
void alloc();
|
||||
void add();
|
||||
dword get();
|
||||
void set();
|
||||
dword set();
|
||||
void swap();
|
||||
dword len();
|
||||
dword get_last();
|
||||
@ -47,10 +47,11 @@ struct collection_int
|
||||
}
|
||||
|
||||
|
||||
:void collection_int::set(dword pos, _in) {
|
||||
:dword collection_int::set(dword pos, _in) {
|
||||
while (pos >= count) add(0);
|
||||
EAX = pos * sizeof(dword) + buf;
|
||||
ESDWORD[EAX] = _in;
|
||||
return ESDWORD[EAX];
|
||||
}
|
||||
|
||||
:void collection_int::swap(dword pos1, pos2) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
#define MOUSE_LEFT 001b
|
||||
#define MOUSE_RIGHT 010b
|
||||
#define MOUSE_LR 011b
|
||||
#define MOUSE_CENTER 100b
|
||||
#define MOUSE_MIDDLE 100b
|
||||
|
||||
/**
|
||||
* The structure of the MOUSE
|
||||
|
Loading…
Reference in New Issue
Block a user