forked from KolibriOS/kolibrios
WebView 2.0 beta 2: WebView.c refactoring
git-svn-id: svn://kolibrios.org@7755 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
6a00fc624a
commit
f608182ea2
@ -260,7 +260,8 @@ void TWebBrowser::ParseHtml(){
|
|||||||
DrawStyle();
|
DrawStyle();
|
||||||
NewLine();
|
NewLine();
|
||||||
list.count = draw_y;
|
list.count = draw_y;
|
||||||
DrawPage();
|
list.CheckDoesValuesOkey();
|
||||||
|
anchors.current = NULL;
|
||||||
}
|
}
|
||||||
//============================================================================================
|
//============================================================================================
|
||||||
bool TWebBrowser::CheckForLineBreak()
|
bool TWebBrowser::CheckForLineBreak()
|
||||||
@ -292,6 +293,14 @@ void TWebBrowser::SetStyle() {
|
|||||||
|
|
||||||
dword value;
|
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")) {
|
if (tag.is("html")) {
|
||||||
t_html = tag.opened;
|
t_html = tag.opened;
|
||||||
return;
|
return;
|
||||||
@ -311,9 +320,6 @@ void TWebBrowser::SetStyle() {
|
|||||||
if (!tag.opened) strcat(#line, "\" ");
|
if (!tag.opened) strcat(#line, "\" ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (value = tag.get_value_of("name=")) || (value = tag.get_value_of("id=")) {
|
|
||||||
anchors.add(value, draw_y);
|
|
||||||
}
|
|
||||||
if (tag.is("body")) {
|
if (tag.is("body")) {
|
||||||
t_body = tag.opened;
|
t_body = tag.opened;
|
||||||
if (value = tag.get_value_of("link=")) link_color_inactive = GetColor(value);
|
if (value = tag.get_value_of("link=")) link_color_inactive = GetColor(value);
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
|
|
||||||
void GetAbsoluteURL(dword in_URL)
|
dword GetAbsoluteURL(dword in_URL)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
dword orig_URL = in_URL;
|
dword orig_URL = in_URL;
|
||||||
char newurl[URL_SIZE];
|
char newurl[URL_SIZE+1];
|
||||||
|
|
||||||
while (i=strstr(in_URL, "&"))
|
while (i=strstr(in_URL, "&"))
|
||||||
{
|
{
|
||||||
strcpy(i+1, i+5);
|
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))
|
IF (!strncmp(in_URL,"//", 2))
|
||||||
{
|
{
|
||||||
strcpy(#newurl, "http:");
|
strcpy(#newurl, "http:");
|
||||||
strcat(#newurl, in_URL);
|
strcat(#newurl, in_URL);
|
||||||
strcpy(orig_URL, #newurl);
|
strcpy(orig_URL, #newurl);
|
||||||
return;
|
return orig_URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
IF (!strncmp(in_URL,"./", 2)) in_URL+=2;
|
IF (!strncmp(in_URL,"./", 2)) in_URL+=2;
|
||||||
@ -55,5 +55,6 @@ void GetAbsoluteURL(dword in_URL)
|
|||||||
|
|
||||||
strcat(#newurl, in_URL);
|
strcat(#newurl, in_URL);
|
||||||
strcpy(orig_URL, #newurl);
|
strcpy(orig_URL, #newurl);
|
||||||
|
return orig_URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
|
|
||||||
struct _anchors {
|
struct _anchors {
|
||||||
|
char current[256];
|
||||||
collection anchor_name;
|
collection anchor_name;
|
||||||
collection anchor_position;
|
collection anchor_position;
|
||||||
void add();
|
void add();
|
||||||
int get_pos_by_name();
|
int get_pos_by_name();
|
||||||
void clear();
|
void clear();
|
||||||
|
void take_anchor_from();
|
||||||
} anchors;
|
} anchors;
|
||||||
|
|
||||||
void _anchors::add(dword _name, _pos)
|
void _anchors::add(dword _name, _pos)
|
||||||
@ -30,3 +32,12 @@ void _anchors::clear()
|
|||||||
anchor_position.drop();
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -58,8 +58,7 @@ void LinksArray::Clear()
|
|||||||
CursorPointer.Restore();
|
CursorPointer.Restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
char temp[URL_SIZE];
|
PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, NULL, 0};
|
||||||
PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0};
|
|
||||||
|
|
||||||
bool LinksArray::HoverAndProceed(dword mx, my)
|
bool LinksArray::HoverAndProceed(dword mx, my)
|
||||||
{
|
{
|
||||||
@ -77,13 +76,12 @@ bool LinksArray::HoverAndProceed(dword mx, my)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mouse.mkm) && (mouse.up) {
|
if (mouse.mkm) && (mouse.up) {
|
||||||
open_in_a_new_window = true;
|
RunProgram(#program_path, PageLinks.GetURL(PageLinks.active));
|
||||||
EventClickLink();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mouse.lkm) && (mouse.up) {
|
if (mouse.lkm) && (mouse.up) {
|
||||||
CursorPointer.Restore();
|
CursorPointer.Restore();
|
||||||
EventClickLink();
|
EventClickLink(PageLinks.GetURL(PageLinks.active));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mouse.pkm) && (mouse.up) {
|
if (mouse.pkm) && (mouse.up) {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//libraries
|
//libraries
|
||||||
#define MEMSIZE 1024 * 800
|
#define MEMSIZE 1024 * 850
|
||||||
#include "..\lib\gui.h"
|
#include "..\lib\gui.h"
|
||||||
#include "..\lib\draw_buf.h"
|
#include "..\lib\draw_buf.h"
|
||||||
#include "..\lib\list_box.h"
|
#include "..\lib\list_box.h"
|
||||||
@ -29,9 +29,7 @@
|
|||||||
#include "..\lib\patterns\simple_open_dialog.h"
|
#include "..\lib\patterns\simple_open_dialog.h"
|
||||||
|
|
||||||
#ifdef LANG_RUS
|
#ifdef LANG_RUS
|
||||||
char version[]="’¥ªáâ®¢ë© ¡à 㧥à 2.0 beta1";
|
char version[]="’¥ªáâ®¢ë© ¡à 㧥à 2.0 beta2";
|
||||||
#define T_LOADING "‡ £à㧪 áâà ¨æë..."
|
|
||||||
#define T_RENDERING "<22>¥¤¥à¨£..."
|
|
||||||
char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0";
|
char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0";
|
||||||
char homepage[] = FROM "html\\homepage_ru.htm""\0";
|
char homepage[] = FROM "html\\homepage_ru.htm""\0";
|
||||||
char help[] = FROM "html\\help_ru.htm""\0";
|
char help[] = FROM "html\\help_ru.htm""\0";
|
||||||
@ -45,9 +43,7 @@ char link_menu[] =
|
|||||||
"Š®¯¨à®¢ âì áá뫪ã
|
"Š®¯¨à®¢ âì áá뫪ã
|
||||||
‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
|
‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
|
||||||
#else
|
#else
|
||||||
char version[]="Text-based Browser 2.0 beta1";
|
char version[]="Text-based Browser 2.0 beta2";
|
||||||
#define T_LOADING "Loading..."
|
|
||||||
#define T_RENDERING "Rendering..."
|
|
||||||
char page_not_found[] = FROM "html\\page_not_found_en.htm""\0";
|
char page_not_found[] = FROM "html\\page_not_found_en.htm""\0";
|
||||||
char homepage[] = FROM "html\\homepage_en.htm""\0";
|
char homepage[] = FROM "html\\homepage_en.htm""\0";
|
||||||
char help[] = FROM "html\\help_en.htm""\0";
|
char help[] = FROM "html\\help_en.htm""\0";
|
||||||
@ -66,10 +62,9 @@ Download link contents";
|
|||||||
|
|
||||||
dword col_bg = 0xE3E2E2;
|
dword col_bg = 0xE3E2E2;
|
||||||
dword panel_color = 0xE3E2E2;
|
dword panel_color = 0xE3E2E2;
|
||||||
dword border_color = 0x8C8C8C;
|
dword border_color = 0x787878;
|
||||||
|
|
||||||
bool debug_mode = false;
|
bool debug_mode = false;
|
||||||
bool open_in_a_new_window = false;
|
|
||||||
|
|
||||||
_http http = {0, 0, 0, 0, 0, 0, 0};
|
_http http = {0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
@ -82,6 +77,7 @@ _http http = {0, 0, 0, 0, 0, 0, 0};
|
|||||||
#define URL_SERVICE_HOMEPAGE "WebView:home"
|
#define URL_SERVICE_HOMEPAGE "WebView:home"
|
||||||
#define URL_SERVICE_HELP "WebView:help"
|
#define URL_SERVICE_HELP "WebView:help"
|
||||||
|
|
||||||
|
#define TOOLBAR_GAPS 10
|
||||||
dword TOOLBAR_H = 40;
|
dword TOOLBAR_H = 40;
|
||||||
dword STATUSBAR_H = 15;
|
dword STATUSBAR_H = 15;
|
||||||
|
|
||||||
@ -110,9 +106,9 @@ enum {
|
|||||||
char default_dir[] = "/rd/1";
|
char default_dir[] = "/rd/1";
|
||||||
od_filter filter2 = { 16, "TXT\0HTM\0HTML\0\0" };
|
od_filter filter2 = { 16, "TXT\0HTM\0HTML\0\0" };
|
||||||
|
|
||||||
char URL[URL_SIZE];
|
char editURL[URL_SIZE+1];
|
||||||
char editURL[URL_SIZE];
|
edit_box address_box = {NULL,TOOLBAR_GAPS+TOOLBAR_GAPS+51,10,0xffffff,0x94AECE,0xffffff,
|
||||||
edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,URL_SIZE-2,#editURL,0,NULL,19,19};
|
0xffffff,0x10000000,URL_SIZE-2,#editURL,0,NULL,19,19};
|
||||||
|
|
||||||
#define SKIN_Y 24
|
#define SKIN_Y 24
|
||||||
|
|
||||||
@ -136,12 +132,12 @@ void HandleParam()
|
|||||||
ExitProcess();
|
ExitProcess();
|
||||||
} else if (!strncmp(#param, "-s ", 3)) {
|
} else if (!strncmp(#param, "-s ", 3)) {
|
||||||
source_mode = true;
|
source_mode = true;
|
||||||
strcpy(#URL, #param + 3);
|
history.add(#param + 3);
|
||||||
} else {
|
} else {
|
||||||
strcpy(#URL, #param);
|
history.add(#param);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strcpy(#URL, URL_SERVICE_HOMEPAGE);
|
history.add(URL_SERVICE_HOMEPAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +159,7 @@ void main()
|
|||||||
edit_box_mouse stdcall (#address_box);
|
edit_box_mouse stdcall (#address_box);
|
||||||
mouse.get();
|
mouse.get();
|
||||||
if (PageLinks.HoverAndProceed(mouse.x, WB1.list.first + mouse.y))
|
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);
|
if (WB1.list.MouseOver(mouse.x, mouse.y)) EventShowPageMenu(mouse.x, mouse.y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -225,7 +221,8 @@ void main()
|
|||||||
ProcessEvent(menu.cur_y);
|
ProcessEvent(menu.cur_y);
|
||||||
menu.cur_y = 0;
|
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);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
system.color.get();
|
system.color.get();
|
||||||
col_bg = system.color.work;
|
col_bg = system.color.work;
|
||||||
@ -239,7 +236,6 @@ void main()
|
|||||||
if (http.transfer > 0) {
|
if (http.transfer > 0) {
|
||||||
http.receive();
|
http.receive();
|
||||||
EventUpdateProgressBar();
|
EventUpdateProgressBar();
|
||||||
DrawStatusBar(T_LOADING);
|
|
||||||
if (http.receive_result == 0) {
|
if (http.receive_result == 0) {
|
||||||
// Handle redirects
|
// Handle redirects
|
||||||
if (http.status_code >= 300) && (http.status_code < 400)
|
if (http.status_code >= 300) && (http.status_code < 400)
|
||||||
@ -257,23 +253,14 @@ void main()
|
|||||||
GetAbsoluteURL(#http.redirect_url);
|
GetAbsoluteURL(#http.redirect_url);
|
||||||
debug("Redirect: "); debugln(#http.redirect_url);
|
debug("Redirect: "); debugln(#http.redirect_url);
|
||||||
history.back();
|
history.back();
|
||||||
strcpy(#URL, #http.redirect_url);
|
OpenPage(#http.redirect_url);
|
||||||
strcpy(#editURL, #URL);
|
|
||||||
DrawOmnibox();
|
|
||||||
OpenPage();
|
|
||||||
//ProcessLink(history.current());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
redirect_count = 0;
|
redirect_count = 0;
|
||||||
// Loading the page is complete, free resources
|
// Loading the page is complete, free resources
|
||||||
history.add(#URL);
|
|
||||||
bufpointer = http.content_pointer;
|
|
||||||
bufsize = http.content_received;
|
|
||||||
http.free();
|
http.free();
|
||||||
DrawStatusBar(T_RENDERING);
|
LoadInternalPage(http.content_pointer, http.content_received);
|
||||||
ShowPage();
|
|
||||||
DrawStatusBar(NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,7 +270,7 @@ void SetElementSizes()
|
|||||||
{
|
{
|
||||||
address_box.top = TOOLBAR_H/2-10;
|
address_box.top = TOOLBAR_H/2-10;
|
||||||
basic_line_h = calc(WB1.list.font_h * 130) / 100;
|
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,
|
WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x,
|
||||||
Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h);
|
Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h);
|
||||||
WB1.list.wheel_size = 7 * basic_line_h;
|
WB1.list.wheel_size = 7 * basic_line_h;
|
||||||
@ -291,7 +278,7 @@ void SetElementSizes()
|
|||||||
WB1.list.visible = WB1.list.h;
|
WB1.list.visible = WB1.list.h;
|
||||||
if (WB1.list.w!=WB1.DrawBuf.bufw) {
|
if (WB1.list.w!=WB1.DrawBuf.bufw) {
|
||||||
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 800*20);
|
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 800*20);
|
||||||
ProcessEvent(REFRESH_BUTTON);
|
OpenPage(history.current());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,24 +290,24 @@ void draw_window()
|
|||||||
DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
|
DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
|
||||||
DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
|
DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
|
||||||
SetElementSizes();
|
SetElementSizes();
|
||||||
DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 25,border_color);
|
DefineHiddenButton(TOOLBAR_GAPS, address_box.top-2, 24, skin.h-2, BACK_BUTTON);
|
||||||
DefineButton(address_box.left-52, address_box.top-2, 24, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
|
DefineHiddenButton(TOOLBAR_GAPS+25, address_box.top-2, 24, skin.h-2, FORWARD_BUTTON);
|
||||||
DefineButton(address_box.left-27, address_box.top-2, 24, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
|
img_draw stdcall(skin.image, TOOLBAR_GAPS-1, address_box.top-3, 51, skin.h, 0, SKIN_Y);
|
||||||
img_draw stdcall(skin.image, address_box.left-53, 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);
|
||||||
DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
|
DefineHiddenButton(Form.cwidth-31, address_box.top-3, 24, skin.h-1, SANDWICH_BUTTON);
|
||||||
DefineButton(Form.cwidth-27, address_box.top-3, 23, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
|
img_draw stdcall(skin.image, Form.cwidth-27, address_box.top+1, 17, 18, 51, SKIN_Y);
|
||||||
img_draw stdcall(skin.image, Form.cwidth-24, address_box.top-3, 17, skin.h, 102, SKIN_Y);
|
|
||||||
DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
|
DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
|
||||||
DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
|
DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
|
||||||
if (!header) {
|
if (!header) {
|
||||||
OpenPage();
|
OpenPage(history.current());
|
||||||
WB1.DrawScroller();
|
WB1.DrawScroller();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
WB1.DrawPage();
|
WB1.DrawPage();
|
||||||
DrawOmnibox();
|
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();
|
DrawProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,14 +322,12 @@ void ProcessEvent(dword id__)
|
|||||||
case SCAN_CODE_BS:
|
case SCAN_CODE_BS:
|
||||||
case BACK_BUTTON:
|
case BACK_BUTTON:
|
||||||
if (history.back()) {
|
if (history.back()) {
|
||||||
strcpy(#URL, history.current());
|
OpenPage(history.current());
|
||||||
OpenPage();
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case FORWARD_BUTTON:
|
case FORWARD_BUTTON:
|
||||||
if (history.forward()) {
|
if (history.forward()) {
|
||||||
strcpy(#URL, history.current());
|
OpenPage(history.current());
|
||||||
OpenPage();
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case GOTOURL_BUTTON:
|
case GOTOURL_BUTTON:
|
||||||
@ -350,12 +335,12 @@ void ProcessEvent(dword id__)
|
|||||||
EventSubmitOmnibox();
|
EventSubmitOmnibox();
|
||||||
return;
|
return;
|
||||||
case REFRESH_BUTTON:
|
case REFRESH_BUTTON:
|
||||||
if (http.transfer > 0)
|
if (http.transfer > 0) {
|
||||||
{
|
|
||||||
StopLoading();
|
StopLoading();
|
||||||
draw_window();
|
draw_window();
|
||||||
|
} else {
|
||||||
|
OpenPage(history.current());
|
||||||
}
|
}
|
||||||
else OpenPage();
|
|
||||||
return;
|
return;
|
||||||
case SANDWICH_BUTTON:
|
case SANDWICH_BUTTON:
|
||||||
EventShowPageMenu(Form.cwidth - 215, TOOLBAR_H-6);
|
EventShowPageMenu(Form.cwidth - 215, TOOLBAR_H-6);
|
||||||
@ -364,16 +349,15 @@ void ProcessEvent(dword id__)
|
|||||||
EventViewSource();
|
EventViewSource();
|
||||||
break;
|
break;
|
||||||
case EDIT_SOURCE:
|
case EDIT_SOURCE:
|
||||||
if (check_is_the_adress_local(#URL)) {
|
if (check_is_the_adress_local(history.current())) {
|
||||||
RunProgram("/rd/1/tinypad", #URL);
|
RunProgram("/rd/1/tinypad", history.current());
|
||||||
} else {
|
} else {
|
||||||
CreateFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
|
CreateFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
|
||||||
if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
|
if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case VIEW_HISTORY:
|
case VIEW_HISTORY:
|
||||||
strcpy(#URL, URL_SERVICE_HISTORY);
|
OpenPage(URL_SERVICE_HISTORY);
|
||||||
OpenPage();
|
|
||||||
return;
|
return;
|
||||||
case DOWNLOAD_MANAGER:
|
case DOWNLOAD_MANAGER:
|
||||||
if (!downloader_opened) {
|
if (!downloader_opened) {
|
||||||
@ -410,235 +394,220 @@ void StopLoading()
|
|||||||
$pop EAX
|
$pop EAX
|
||||||
free(EAX); // free data
|
free(EAX); // free data
|
||||||
http.transfer=0;
|
http.transfer=0;
|
||||||
bufsize = 0;
|
|
||||||
bufpointer = free(bufpointer);
|
|
||||||
pause(10);
|
pause(10);
|
||||||
}
|
}
|
||||||
wv_progress_bar.value = 0;
|
wv_progress_bar.value = 0;
|
||||||
DrawOmnibox();
|
DrawOmnibox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
void ReplaceSpaceInUrl() {
|
void ReplaceSpaceInUrl() {
|
||||||
int i;
|
int i;
|
||||||
strcpy(#editURL, #URL);
|
char new_url[URL_SIZE];
|
||||||
while (i = strchr(#URL, ' '))
|
strcpy(#new_url, history.current());
|
||||||
|
while (i = strchr(#new_url, ' '))
|
||||||
{
|
{
|
||||||
i -= #URL;
|
i -= #new_url;
|
||||||
strlcpy(#URL+i+3, #editURL+i+1, sizeof(URL)-i-4);
|
strlcpy(#new_url+i+3, #new_url+i+1, URL_SIZE);
|
||||||
URL[i] = '%';
|
URL[i] = '%';
|
||||||
URL[i+1] = '2';
|
URL[i+1] = '2';
|
||||||
URL[i+2] = '0';
|
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)];
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenPage(dword _open_URL)
|
||||||
|
{
|
||||||
|
char new_url[URL_SIZE+1];
|
||||||
|
|
||||||
StopLoading();
|
StopLoading();
|
||||||
strcpy(#editURL, #URL);
|
|
||||||
history.add(#URL);
|
strcpy(#editURL, _open_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();
|
DrawOmnibox();
|
||||||
return;
|
|
||||||
}
|
|
||||||
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)) {
|
strncpy(#new_url, _open_URL, URL_SIZE);
|
||||||
http.get(#URL);
|
|
||||||
} else if (!strncmp(#URL,"https://",8)) {
|
|
||||||
sprintf(#getUrl, "http://gate.aspero.pro/?site=%s", #URL);
|
|
||||||
http.get(#getUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!http.transfer)
|
//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();
|
StopLoading();
|
||||||
bufsize = 0;
|
LoadInternalPage(#page_not_found, sizeof(page_not_found));
|
||||||
bufpointer = free(bufpointer);
|
|
||||||
ShowPage();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
file_size stdcall (#URL);
|
|
||||||
if (EBX) {
|
|
||||||
bufsize = EBX;
|
|
||||||
free(bufpointer);
|
|
||||||
bufpointer = malloc(bufsize);
|
|
||||||
ReadFile(0, bufsize, bufpointer, #URL);
|
|
||||||
} else {
|
} 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];
|
char new_url[URL_SIZE];
|
||||||
dword anchor_pos;
|
|
||||||
|
|
||||||
anchor_pos = strrchr(#URL, '#')-1;
|
if (ESBYTE[_click_URL]=='#') {
|
||||||
strlcpy(#anchor, #URL+anchor_pos, sizeof(anchor)-1);
|
if (anchors.get_pos_by_name(_click_URL+1)!=-1) {
|
||||||
URL[anchor_pos] = 0x00;
|
WB1.list.first = anchors.get_pos_by_name(_click_URL+1);
|
||||||
|
WB1.list.CheckDoesValuesOkey();
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
strcpy(#editURL, history.current());
|
||||||
|
strcat(#editURL, _click_URL);
|
||||||
|
DrawOmnibox();
|
||||||
WB1.DrawPage();
|
WB1.DrawPage();
|
||||||
strcpy(#editURL, #URL);
|
return;
|
||||||
strcat(#editURL, #anchor);
|
|
||||||
DrawOmnibox();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EventSubmitOmnibox()
|
|
||||||
{
|
|
||||||
if (!editURL[0]) return;
|
|
||||||
if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/')
|
|
||||||
|| (!strncmp(#editURL,"https:",6)) || (!strncmp(#editURL,"WebView:",8))
|
|
||||||
{
|
|
||||||
strcpy(#URL, #editURL);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if (!strncmp(_click_URL,"mailto:", 7)) || (!strncmp(_click_URL,"tel:", 4)) {
|
||||||
strlcpy(#URL,"http://",7);
|
notify(_click_URL);
|
||||||
strcat(#URL, #editURL);
|
return;
|
||||||
}
|
}
|
||||||
OpenPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EventClickLink()
|
if (http.transfer > 0) {
|
||||||
{
|
|
||||||
strcpy(#URL, PageLinks.GetURL(PageLinks.active));
|
|
||||||
GetAbsoluteURL(#URL);
|
|
||||||
ProcessLink();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessLink()
|
|
||||||
{
|
|
||||||
if (http.transfer > 0)
|
|
||||||
{
|
|
||||||
StopLoading();
|
StopLoading();
|
||||||
history.back();
|
history.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strrchr(#URL, '#')!=0) {
|
strcpy(#new_url, _click_URL);
|
||||||
ProcessAnchor();
|
GetAbsoluteURL(#new_url);
|
||||||
|
|
||||||
|
if (strrchr(#new_url, '#')!=0) {
|
||||||
|
anchors.take_anchor_from(#new_url);
|
||||||
|
OpenPage(#new_url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strncmp(#URL,"mailto:", 7)) || (!strncmp(#URL,"tel:", 4))
|
if (!strncmp(#new_url,"WebView:",8)) {
|
||||||
{
|
OpenPage(#new_url);
|
||||||
notify(#URL);
|
|
||||||
strcpy(#editURL, history.current());
|
|
||||||
strcpy(#URL, history.current());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strncmp(#URL,"WebView:",8)) {
|
if (strncmp(#new_url,"http://",7)!=0) && (strncmp(#new_url,"https://",8)!=0)
|
||||||
OpenPage();
|
{
|
||||||
|
if (UrlExtIs(#new_url,".htm")!=true) && (UrlExtIs(#new_url,".html")!=true)
|
||||||
|
{
|
||||||
|
if (strchr(#new_url, '|')) {
|
||||||
|
ESBYTE[strchr(#new_url, '|')] = NULL;
|
||||||
|
RunProgram(#new_url, strlen(#new_url)+1+#new_url);
|
||||||
|
} else {
|
||||||
|
RunProgram("/sys/@open", #new_url);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
if (strncmp(#URL,"http://",7)!=0) && (strncmp(#URL,"https://",8)!=0)
|
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)
|
||||||
if (UrlExtIs(".htm")!=true) && (UrlExtIs(".html")!=true)
|
|| (UrlExtIs(#new_url,".7z")==true) {
|
||||||
{
|
|
||||||
if (strchr(#URL, '|')) {
|
|
||||||
ESBYTE[strchr(#URL, '|')] = NULL;
|
|
||||||
RunProgram(#URL, strlen(#URL)+1+#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) {
|
|
||||||
if (!downloader_opened) {
|
if (!downloader_opened) {
|
||||||
strcpy(#downloader_edit, #URL);
|
strcpy(#downloader_edit, #new_url);
|
||||||
CreateThread(#Downloader,#downloader_stak+4092);
|
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");
|
else notify("'WebView\nPlease, start a new download only when previous ended.'Et");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (open_in_a_new_window)
|
OpenPage(#new_url);
|
||||||
{
|
}
|
||||||
RunProgram(#program_path, #URL);
|
|
||||||
strcpy(#editURL, history.current());
|
void EventSubmitOmnibox()
|
||||||
strcpy(#URL, history.current());
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
OpenPage();
|
|
||||||
}
|
|
||||||
open_in_a_new_window = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawOmnibox()
|
void DrawOmnibox()
|
||||||
{
|
{
|
||||||
int skin_x_offset;
|
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;
|
if (address_box.flags & ed_focus) address_box.flags = ed_focus; else address_box.flags = 0;
|
||||||
EditBox_UpdateText(#address_box, address_box.flags);
|
EditBox_UpdateText(#address_box, address_box.flags);
|
||||||
edit_box_draw stdcall(#address_box);
|
edit_box_draw stdcall(#address_box);
|
||||||
if (http.transfer > 0) skin_x_offset = 68; else skin_x_offset = 51;
|
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);
|
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){
|
void LoadInternalPage(dword _bufdata, _in_bufsize){
|
||||||
bufsize = _in_filesize;
|
if (!_bufdata) || (!_in_bufsize) {
|
||||||
if (bufpointer!=_bufpos) free(bufpointer);
|
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);
|
bufpointer = malloc(bufsize);
|
||||||
memmov(bufpointer, _bufpos, bufsize);
|
memmov(bufpointer, _bufdata, bufsize);
|
||||||
ShowPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShowPage()
|
|
||||||
{
|
|
||||||
WB1.list.first = 0; //scroll page to the top
|
WB1.list.first = 0; //scroll page to the top
|
||||||
DrawOmnibox();
|
DrawOmnibox();
|
||||||
if (!bufsize) || (!bufpointer) {
|
if(!strrchr(#editURL, '#')) {
|
||||||
LoadInternalPage(#page_not_found, sizeof(page_not_found));
|
strcat(#editURL, #anchors.current);
|
||||||
|
DrawOmnibox();
|
||||||
}
|
}
|
||||||
WB1.ParseHtml();
|
WB1.ParseHtml();
|
||||||
if (source_mode) {
|
WB1.DrawPage();
|
||||||
source_mode = false;
|
|
||||||
ShowSource();
|
|
||||||
LoadInternalPage(bufpointer, bufsize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -646,8 +615,12 @@ void DrawProgress()
|
|||||||
{
|
{
|
||||||
dword persent;
|
dword persent;
|
||||||
if (http.transfer == 0) return;
|
if (http.transfer == 0) return;
|
||||||
if (wv_progress_bar.max) persent = wv_progress_bar.value*100/wv_progress_bar.max; else persent = 10;
|
if (wv_progress_bar.max) {
|
||||||
DrawBar(address_box.left-2, address_box.top+20, persent*address_box.width/100, 2, 0x72B7EB);
|
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)
|
void EventShowPageMenu(dword _left, _top)
|
||||||
@ -672,25 +645,26 @@ void EventUpdateProgressBar()
|
|||||||
|
|
||||||
void EventSeachWeb()
|
void EventSeachWeb()
|
||||||
{
|
{
|
||||||
sprintf(#URL, "https://www.google.com/search?q=%s", #editURL);
|
char new_url[URL_SIZE+1];
|
||||||
replace_char(#URL, ' ', '_', sizeof(URL));
|
replace_char(#editURL, ' ', '_', URL_SIZE);
|
||||||
ProcessLink();
|
strcpy(#new_url, "https://www.google.com/search?q=");
|
||||||
|
strncat(#new_url, #editURL, URL_SIZE);
|
||||||
|
OpenPage(#new_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventOpenDialog()
|
void EventOpenDialog()
|
||||||
{
|
{
|
||||||
OpenDialog_start stdcall (#o_dialog);
|
OpenDialog_start stdcall (#o_dialog);
|
||||||
if (o_dialog.status) {
|
if (o_dialog.status) {
|
||||||
strcpy(#URL, #openfile_path);
|
OpenPage(#openfile_path);
|
||||||
OpenPage();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventViewSource()
|
void EventViewSource()
|
||||||
{
|
{
|
||||||
char source_view_param[sizeof(URL)+4];
|
char source_view_param[URL_SIZE+1];
|
||||||
strcpy(#source_view_param, "-s ");
|
strcpy(#source_view_param, "-s ");
|
||||||
strcat(#source_view_param, #URL);
|
strncat(#source_view_param, history.current(), URL_SIZE);
|
||||||
RunProgram(#program_path, #source_view_param);
|
RunProgram(#program_path, #source_view_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
<font bg="#C7CEE4">[CTRL + N or CTRL + T]</font> New window
|
<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 + 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 + U]</font> View a web page's source code
|
||||||
<font bg="#C7CEE4">[CTRL + H]</font> Open browser history
|
<font bg="#C7CEE4">[CTRL + H]</font> Open browser history
|
||||||
<font bg="#C7CEE4">[CTRL + J]</font> Display the file downloader
|
<font bg="#C7CEE4">[CTRL + J]</font> Display the file downloader
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<body><pre><h1>‘¯à ¢ª WebView</h1>
|
<body><pre><h1>‘¯à ¢ª WebView</h1>
|
||||||
<font bg="#C7CEE4">[CTRL + N ¨«¨ CTRL + T]</font> <20>®¢®¥ ®ª®
|
<font bg="#C7CEE4">[CTRL + N ¨«¨ CTRL + T]</font> <20>®¢®¥ ®ª®
|
||||||
<font bg="#C7CEE4">[CTRL + R ¨«¨ F5]</font> <20>¥à¥§ £à㧨âì áâà ¨æã
|
<font bg="#C7CEE4">[CTRL + R ¨«¨ F5]</font> <20>¥à¥§ £à㧨âì áâà ¨æã
|
||||||
|
<font bg="#C7CEE4">[CTRL + O]</font> ‚맢 âì ¤¨ «®£ ¢ë¡®à ä ©«
|
||||||
<font bg="#C7CEE4">[CTRL + U]</font> ‘¬®âà¥âì ¨áå®¤ë© ª®¤ áâà ¨æë
|
<font bg="#C7CEE4">[CTRL + U]</font> ‘¬®âà¥âì ¨áå®¤ë© ª®¤ áâà ¨æë
|
||||||
<font bg="#C7CEE4">[CTRL + H]</font> ‘¬®âà¥âì ¨áâ®à¨î ¯®á¥é¥ëå áâà ¨æ
|
<font bg="#C7CEE4">[CTRL + H]</font> ‘¬®âà¥âì ¨áâ®à¨î ¯®á¥é¥ëå áâà ¨æ
|
||||||
<font bg="#C7CEE4">[CTRL + J]</font> Žâªàëâì § £àã§ç¨ª ä ©«®¢
|
<font bg="#C7CEE4">[CTRL + J]</font> Žâªàëâì § £àã§ç¨ª ä ©«®¢
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
enum { TAG=1, VALUE, TEXT, COMMENT, SCRIPT};
|
||||||
|
|
||||||
dword source_buf_start, source_buf_end;
|
int opened_font_counter=0;
|
||||||
int opened_font=0;
|
|
||||||
int mode;
|
int mode;
|
||||||
|
|
||||||
|
dword source_buf_end;
|
||||||
|
|
||||||
void SourceBufAdd(dword _mode, src)
|
void SourceBufAdd(dword _mode, src)
|
||||||
{
|
{
|
||||||
dword font_found_pointer, src_orig = src;
|
dword font_found_pointer, src_orig = src;
|
||||||
@ -13,37 +15,38 @@ void SourceBufAdd(dword _mode, src)
|
|||||||
source_buf_end += strlen(source_buf_end);
|
source_buf_end += strlen(source_buf_end);
|
||||||
|
|
||||||
if (font_found_pointer = strstr(src, "</font>")) {
|
if (font_found_pointer = strstr(src, "</font>")) {
|
||||||
opened_font--;
|
opened_font_counter--;
|
||||||
src = font_found_pointer+2;
|
src = font_found_pointer+2;
|
||||||
}
|
}
|
||||||
|
|
||||||
src = src_orig;
|
src = src_orig;
|
||||||
if (font_found_pointer = strstr(src, "<font ")) {
|
if (font_found_pointer = strstr(src, "<font ")) {
|
||||||
opened_font++;
|
opened_font_counter++;
|
||||||
src = font_found_pointer+2;
|
src = font_found_pointer+2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseAllOpenedFonts(dword _mode)
|
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 _bufdata, _in_bufsize)
|
||||||
dword ShowSource()
|
|
||||||
{
|
{
|
||||||
dword i, j;
|
dword i, j;
|
||||||
bool activate_script_mode = false;
|
bool activate_script_mode = false;
|
||||||
|
dword source_buf_start;
|
||||||
|
|
||||||
opened_font=0;
|
opened_font_counter=0;
|
||||||
source_buf_start = source_buf_end = malloc(bufsize*5);
|
source_buf_end = malloc(_in_bufsize*5);
|
||||||
|
source_buf_start = source_buf_end;
|
||||||
header[strrchr(#header, '-')-2]=0;
|
header[strrchr(#header, '-')-2]=0;
|
||||||
|
|
||||||
SourceBufAdd(TEXT, "<html><head><title>Source: ");
|
SourceBufAdd(TEXT, "<html><head><title>Source: ");
|
||||||
SourceBufAdd(TEXT, #header);
|
SourceBufAdd(TEXT, #header);
|
||||||
SourceBufAdd(TEXT, "</title><body><pre>");
|
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 '<':
|
case '<':
|
||||||
if (!strncmp(i+1,"!--", 3)) SourceBufAdd(COMMENT, "<font color=#bbb><");
|
if (!strncmp(i+1,"!--", 3)) SourceBufAdd(COMMENT, "<font color=#bbb><");
|
||||||
@ -89,7 +92,6 @@ dword ShowSource()
|
|||||||
source_buf_end++;
|
source_buf_end++;
|
||||||
}
|
}
|
||||||
ESBYTE[source_buf_end] = 0;
|
ESBYTE[source_buf_end] = 0;
|
||||||
bufsize = source_buf_end - source_buf_start;
|
LoadInternalPage(source_buf_start, _in_bufsize);
|
||||||
free(bufpointer);
|
free(source_buf_start);
|
||||||
bufpointer = source_buf_start;
|
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ void SetPageDefaults()
|
|||||||
|
|
||||||
void OpenPage()
|
void OpenPage()
|
||||||
{
|
{
|
||||||
char getUrl[URL_SIZE];
|
char getUrl[URL_SIZE+1];
|
||||||
strcpy(#editURL, #URL);
|
strcpy(#editURL, #URL);
|
||||||
history.add(#URL);
|
history.add(#URL);
|
||||||
if (!strncmp(#URL,"CodeView:",8))
|
if (!strncmp(#URL,"CodeView:",8))
|
||||||
@ -239,6 +239,7 @@ void ShowPage()
|
|||||||
DrawEditBoxWebView();
|
DrawEditBoxWebView();
|
||||||
if (!bufsize) LoadInternalPage(#page_not_found, sizeof(page_not_found));
|
if (!bufsize) LoadInternalPage(#page_not_found, sizeof(page_not_found));
|
||||||
WB1.ParseHtml();
|
WB1.ParseHtml();
|
||||||
|
WB1.DrawPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawStatusBar() {return;};
|
void DrawStatusBar() {return;};
|
||||||
|
@ -39,7 +39,6 @@ bool DrawBufer::Init(dword i_bufx, i_bufy, i_bufw, i_bufh)
|
|||||||
bufh = i_bufh;
|
bufh = i_bufh;
|
||||||
buf_data = free(buf_data);
|
buf_data = free(buf_data);
|
||||||
IncreaseBufSize();
|
IncreaseBufSize();
|
||||||
//debugval("buf_data",buf_data);
|
|
||||||
if (!buf_data) return false;
|
if (!buf_data) return false;
|
||||||
ESDWORD[buf_data] = bufw;
|
ESDWORD[buf_data] = bufw;
|
||||||
ESDWORD[buf_data+4] = bufh;
|
ESDWORD[buf_data+4] = bufh;
|
||||||
|
@ -362,7 +362,10 @@ void InitTWB() {
|
|||||||
void DrawLetter() {
|
void DrawLetter() {
|
||||||
bufsize = strlen(mdata);
|
bufsize = strlen(mdata);
|
||||||
bufpointer = 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);
|
DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, 0xFFFfff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 984 B |
Loading…
Reference in New Issue
Block a user