forked from KolibriOS/kolibrios
WevView 1.35: fix links, remove tabs, refactoring
git-svn-id: svn://kolibrios.org@5772 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5387a45d03
commit
1b46e09ba6
@ -102,7 +102,6 @@ void TWebBrowser::DrawStyle()
|
|||||||
if (style.u) DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]);
|
if (style.u) DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]);
|
||||||
if (link) {
|
if (link) {
|
||||||
DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]);
|
DrawBuf.DrawBar(start_x, list.line_h - DrawBuf.zoom - DrawBuf.zoom + start_y, line_length, DrawBuf.zoom, text_colors[text_color_index]);
|
||||||
UnsafeDefineButton(start_x-2, start_y-1 + list.y, line_length + 3, DrawBuf.zoom * list.font_h, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
|
|
||||||
PageLinks.AddText(#line, line_length, list.line_h, UNDERLINE);
|
PageLinks.AddText(#line, line_length, list.line_h, UNDERLINE);
|
||||||
}
|
}
|
||||||
stolbec += stolbec_len;
|
stolbec += stolbec_len;
|
||||||
@ -312,7 +311,6 @@ void TWebBrowser::SetStyle(int left1, top1) {
|
|||||||
do{
|
do{
|
||||||
if (isattr("href="))
|
if (isattr("href="))
|
||||||
{
|
{
|
||||||
if (stroka - 1 > list.visible) || (stroka < -2) return;
|
|
||||||
text_color_index++;
|
text_color_index++;
|
||||||
text_colors[text_color_index] = text_colors[text_color_index-1];
|
text_colors[text_color_index] = text_colors[text_color_index-1];
|
||||||
link = 1;
|
link = 1;
|
||||||
|
@ -4,20 +4,17 @@ dword CursorFile = FROM "../TWB/pointer.cur";
|
|||||||
#define NOLINE 0
|
#define NOLINE 0
|
||||||
#define UNDERLINE 1
|
#define UNDERLINE 1
|
||||||
|
|
||||||
|
|
||||||
struct array_link {
|
struct array_link {
|
||||||
dword link, text;
|
dword link, text;
|
||||||
int x,y,w,h;
|
int x,y,w,h;
|
||||||
int underline;
|
int underline;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LinksArray
|
struct LinksArray {
|
||||||
{
|
array_link links[400];
|
||||||
array_link links[200];
|
|
||||||
char page_links[64000];
|
char page_links[64000];
|
||||||
dword buflen;
|
dword buflen;
|
||||||
int count, active;
|
int count, active;
|
||||||
|
|
||||||
void Hover();
|
void Hover();
|
||||||
void AddLink();
|
void AddLink();
|
||||||
void AddText();
|
void AddText();
|
||||||
@ -27,14 +24,14 @@ struct LinksArray
|
|||||||
int UrlAbsolute();
|
int UrlAbsolute();
|
||||||
} PageLinks;
|
} PageLinks;
|
||||||
|
|
||||||
void LinksArray::AddLink(dword new_link, int link_x, link_y)
|
void LinksArray::AddLink(dword lpath, int link_x, link_y)
|
||||||
{
|
{
|
||||||
links[count].x = link_x;
|
links[count].x = link_x;
|
||||||
links[count].y = link_y;
|
links[count].y = link_y;
|
||||||
|
|
||||||
links[count].link = buflen;
|
links[count].link = buflen;
|
||||||
strcpy(buflen, new_link);
|
strcpy(buflen, lpath);
|
||||||
buflen += strlen(new_link)+1;
|
buflen += strlen(lpath)+1;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,14 +68,15 @@ PathShow_data status_text = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, 0, #temp, 0
|
|||||||
void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col)
|
void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
signed int WBY = -WB1.list.first*WB1.list.line_h + WB1.list.line_h - WB1.DrawBuf.zoom;
|
||||||
for (i=0; i<count; i++)
|
for (i=0; i<count; i++)
|
||||||
{
|
{
|
||||||
if (mx>links[i].x) && (my>links[i].y) && (mx<links[i].x+links[i].w) && (my<links[i].y+links[i].h)
|
if (mx>links[i].x) && (my>links[i].y) && (mx<links[i].x+links[i].w) && (my<links[i].y+links[i].h)
|
||||||
{
|
{
|
||||||
if (active==i) return;
|
if (active==i) return;
|
||||||
CursorPointer.Set();
|
CursorPointer.Set();
|
||||||
if (links[active].underline) DrawBar(links[active].x, WB1.list.line_h - WB1.DrawBuf.zoom + links[active].y,links[active].w, WB1.DrawBuf.zoom, link_col_in);
|
if (links[active].underline) DrawBar(links[active].x, WBY + links[active].y,links[active].w, WB1.DrawBuf.zoom, link_col_in);
|
||||||
if (links[i].underline) DrawBar(links[i].x, WB1.list.line_h - WB1.DrawBuf.zoom + links[i].y,links[i].w, WB1.DrawBuf.zoom, bg_col);
|
if (links[i].underline) DrawBar(links[i].x, WBY + links[i].y,links[i].w, WB1.DrawBuf.zoom, bg_col);
|
||||||
active = i;
|
active = i;
|
||||||
status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10;
|
status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10;
|
||||||
status_text.start_y = Form.cheight - STATUSBAR_H + 3;
|
status_text.start_y = Form.cheight - STATUSBAR_H + 3;
|
||||||
@ -93,7 +91,7 @@ void LinksArray::Hover(dword mx, my, link_col_in, link_col_a, bg_col)
|
|||||||
if (active!=-1)
|
if (active!=-1)
|
||||||
{
|
{
|
||||||
CursorPointer.Restore();
|
CursorPointer.Restore();
|
||||||
if (links[active].underline) DrawBar(links[active].x, WB1.list.line_h - WB1.DrawBuf.zoom + links[active].y,links[active].w, WB1.DrawBuf.zoom, link_col_in);
|
if (links[active].underline) DrawBar(links[active].x, WBY + links[active].y,links[active].w, WB1.DrawBuf.zoom, link_col_in);
|
||||||
DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
|
DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg);
|
||||||
active = -1;
|
active = -1;
|
||||||
}
|
}
|
||||||
@ -163,4 +161,3 @@ void LinksArray::GetAbsoluteURL(dword in_URL)
|
|||||||
strcpy(orig_URL, #newurl);
|
strcpy(orig_URL, #newurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,10 +9,7 @@
|
|||||||
|
|
||||||
//libraries
|
//libraries
|
||||||
#define MEMSIZE 0x100000
|
#define MEMSIZE 0x100000
|
||||||
#include "..\lib\strings.h"
|
|
||||||
#include "..\lib\gui.h"
|
#include "..\lib\gui.h"
|
||||||
#include "..\lib\file_system.h"
|
|
||||||
#include "..\lib\mem.h"
|
|
||||||
#include "..\lib\draw_buf.h"
|
#include "..\lib\draw_buf.h"
|
||||||
#include "..\lib\list_box.h"
|
#include "..\lib\list_box.h"
|
||||||
#include "..\lib\cursor.h"
|
#include "..\lib\cursor.h"
|
||||||
@ -30,14 +27,14 @@
|
|||||||
char homepage[] = FROM "html\\homepage.htm";
|
char homepage[] = FROM "html\\homepage.htm";
|
||||||
|
|
||||||
#ifdef LANG_RUS
|
#ifdef LANG_RUS
|
||||||
char version[]=" ’¥ªáâ®¢ë© ¡à 㧥à 1.31 UNSTABLE";
|
char version[]=" ’¥ªáâ®¢ë© ¡à 㧥à 1.35";
|
||||||
?define IMAGES_CACHE_CLEARED "Šíè ª à⨮ª ®ç¨é¥"
|
?define IMAGES_CACHE_CLEARED "Šíè ª à⨮ª ®ç¨é¥"
|
||||||
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤¨© á« ©¤"
|
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤¨© á« ©¤"
|
||||||
char loading[] = "‡ £à㧪 áâà ¨æë...<br>";
|
char loading[] = "‡ £à㧪 áâà ¨æë...<br>";
|
||||||
char page_not_found[] = FROM "html\page_not_found_ru.htm";
|
char page_not_found[] = FROM "html\page_not_found_ru.htm";
|
||||||
char accept_language[]= "Accept-Language: ru\n";
|
char accept_language[]= "Accept-Language: ru\n";
|
||||||
#else
|
#else
|
||||||
char version[]=" Text-based Browser 1.31 UNSTABLE";
|
char version[]=" Text-based Browser 1.35";
|
||||||
?define IMAGES_CACHE_CLEARED "Images cache cleared"
|
?define IMAGES_CACHE_CLEARED "Images cache cleared"
|
||||||
?define T_LAST_SLIDE "This slide is the last"
|
?define T_LAST_SLIDE "This slide is the last"
|
||||||
char loading[] = "Loading...<br>";
|
char loading[] = "Loading...<br>";
|
||||||
@ -51,7 +48,7 @@ proc_info Form;
|
|||||||
#define WIN_W 799
|
#define WIN_W 799
|
||||||
#define WIN_H 559
|
#define WIN_H 559
|
||||||
|
|
||||||
char search_path[]="http://nigma.ru/index.php?s=";
|
//char search_path[]="http://nigma.ru/index.php?s=";
|
||||||
char str_location[]="location\0";
|
char str_location[]="location\0";
|
||||||
int redirected = 0;
|
int redirected = 0;
|
||||||
|
|
||||||
@ -62,9 +59,7 @@ int action_buf;
|
|||||||
dword http_transfer = 0;
|
dword http_transfer = 0;
|
||||||
dword http_buffer;
|
dword http_buffer;
|
||||||
|
|
||||||
dword TAB_H = false; //19;
|
dword TOOLBAR_H = 33;
|
||||||
dword TAB_W = 150;
|
|
||||||
dword TOOLBAR_H = 31; //50;
|
|
||||||
dword STATUSBAR_H = 15;
|
dword STATUSBAR_H = 15;
|
||||||
dword col_bg;
|
dword col_bg;
|
||||||
dword panel_color;
|
dword panel_color;
|
||||||
@ -98,44 +93,20 @@ enum {
|
|||||||
|
|
||||||
char editURL[sizeof(URL)];
|
char editURL[sizeof(URL)];
|
||||||
int mouse_twb;
|
int mouse_twb;
|
||||||
edit_box address_box = {250,55,34,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(URL),#editURL,#mouse_twb,2,19,19};
|
edit_box address_box = {250,56,34,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(URL),#editURL,#mouse_twb,2,19,19};
|
||||||
|
|
||||||
#define URL_SERVICE_HISTORY "WebView://history"
|
#define URL_SERVICE_HISTORY "WebView://history"
|
||||||
#define URL_SERVICE_HOME "WebView://home"
|
#define URL_SERVICE_HOME "WebView://home"
|
||||||
#define URL_SERVICE_SOURCE "WebView://source:"
|
#define URL_SERVICE_SOURCE "WebView://source:"
|
||||||
|
|
||||||
|
|
||||||
libimg_image skin;
|
libimg_image skin;
|
||||||
|
|
||||||
int SetSkinColors()
|
|
||||||
{
|
|
||||||
dword image_data;
|
|
||||||
image_data = DSDWORD[skin.image+24];
|
|
||||||
col_bg = DSDWORD[image_data];
|
|
||||||
panel_color = DSDWORD[skin.w*4*4 + image_data];
|
|
||||||
border_color = DSDWORD[skin.w*4*7 + image_data];
|
|
||||||
wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data];
|
|
||||||
$and col_bg, 0x00ffffff
|
|
||||||
$and panel_color, 0x00ffffff
|
|
||||||
$and border_color, 0x00ffffff
|
|
||||||
$and wv_progress_bar.progress_color, 0x00ffffff
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawProgress()
|
|
||||||
{
|
|
||||||
unsigned long btn;
|
|
||||||
if (http_transfer == 0) return;
|
|
||||||
if (wv_progress_bar.max) btn = address_box.width*wv_progress_bar.value/wv_progress_bar.max; else btn = 30;
|
|
||||||
DrawBar(address_box.left-1, address_box.top+15, btn, 2, wv_progress_bar.progress_color);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
dword btn;
|
dword btn;
|
||||||
int half_scroll_size;
|
int half_scroll_size;
|
||||||
int scroll_used=0, show_menu;
|
int scroll_used=0, show_menu;
|
||||||
|
|
||||||
CursorPointer.Load(#CursorFile);
|
CursorPointer.Load(#CursorFile);
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
load_dll(boxlib, #box_lib_init,0);
|
||||||
load_dll(libio, #libio_init,1);
|
load_dll(libio, #libio_init,1);
|
||||||
@ -145,17 +116,10 @@ void main()
|
|||||||
//load_dll(kmenu, #akmenu_init,0);
|
//load_dll(kmenu, #akmenu_init,0);
|
||||||
Libimg_LoadImage(#skin, abspath("wv_skin.png"));
|
Libimg_LoadImage(#skin, abspath("wv_skin.png"));
|
||||||
SetSkinColors();
|
SetSkinColors();
|
||||||
|
CreateDir("/tmp0/1/downloads");
|
||||||
|
if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME);
|
||||||
WB1.DrawBuf.zoom = 1;
|
WB1.DrawBuf.zoom = 1;
|
||||||
WB1.list.SetFont(8, 14, 10111000b);
|
WB1.list.SetFont(8, 14, 10111000b);
|
||||||
Form.width=WIN_W;
|
|
||||||
Form.height=WIN_H;
|
|
||||||
SetElementSizes();
|
|
||||||
if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME);
|
|
||||||
OpenPage();
|
|
||||||
|
|
||||||
CreateDir("/tmp0/1/downloads");
|
|
||||||
|
|
||||||
SetEventMask(0xa7);
|
SetEventMask(0xa7);
|
||||||
BEGIN_LOOP_APPLICATION:
|
BEGIN_LOOP_APPLICATION:
|
||||||
WaitEventTimeout(2);
|
WaitEventTimeout(2);
|
||||||
@ -163,34 +127,26 @@ void main()
|
|||||||
{
|
{
|
||||||
CASE evMouse:
|
CASE evMouse:
|
||||||
if (!CheckActiveProcess(Form.ID)) break;
|
if (!CheckActiveProcess(Form.ID)) break;
|
||||||
//Edit URL
|
|
||||||
edit_box_mouse stdcall (#address_box);
|
edit_box_mouse stdcall (#address_box);
|
||||||
mouse.get();
|
mouse.get();
|
||||||
//Links hover
|
if (WB1.list.MouseOver(mouse.x, mouse.y))
|
||||||
if (mouse.y>WB1.list.y) PageLinks.Hover(mouse.x, mouse.y, link_color_inactive, link_color_active, bg_color);
|
|
||||||
//Menu
|
|
||||||
if (mouse.y>WB1.list.y) && (mouse.y<Form.height) && (bufsize)
|
|
||||||
{
|
|
||||||
if (mouse.pkm) && (mouse.up)
|
|
||||||
{
|
|
||||||
CreateThread(#menu_rmb,#stak+4092);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Mouse scroll
|
|
||||||
if (mouse.vert)
|
|
||||||
{
|
{
|
||||||
|
PageLinks.Hover(mouse.x, WB1.list.first*WB1.list.line_h + mouse.y, link_color_inactive, link_color_active, bg_color);
|
||||||
|
if (bufsize) && (mouse.pkm) && (mouse.up) { CreateThread(#menu_rmb,#stak+4092); break; }
|
||||||
if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
|
if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
|
||||||
|
if (mouse.down) && (PageLinks.active>=0)
|
||||||
|
{
|
||||||
|
DrawRectangle(PageLinks.links[PageLinks.active].x, PageLinks.links[PageLinks.active].y,
|
||||||
|
PageLinks.links[PageLinks.active].w, PageLinks.links[PageLinks.active].h, 0);
|
||||||
|
ClickLink();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//Drag scroller
|
//Drag scroller
|
||||||
scroll_wv.all_redraw = 0;
|
scroll_wv.all_redraw = 0;
|
||||||
if (!mouse.lkm) scroll_used=0;
|
if (!mouse.lkm) scroll_used=0;
|
||||||
if (mouse.x>=scroll_wv.start_x) && (mouse.x<=scroll_wv.start_x+scroll_wv.size_x)
|
if (mouse.x>=scroll_wv.start_x) && (mouse.x<=scroll_wv.start_x+scroll_wv.size_x)
|
||||||
&& (mouse.y>=scroll_wv.start_y+scroll_wv.btn_height) && (-scroll_wv.btn_height+scroll_wv.start_y+scroll_wv.size_y>mouse.y)
|
&& (mouse.y>=scroll_wv.start_y+scroll_wv.btn_height) && (-scroll_wv.btn_height+scroll_wv.start_y+scroll_wv.size_y>mouse.y)
|
||||||
&& (WB1.list.count>WB1.list.visible) && (mouse.lkm)
|
&& (WB1.list.count>WB1.list.visible) && (mouse.lkm) scroll_used=1;
|
||||||
{
|
|
||||||
scroll_used=1;
|
|
||||||
}
|
|
||||||
if (scroll_used)
|
if (scroll_used)
|
||||||
{
|
{
|
||||||
mouse.y = mouse.y + 5;
|
mouse.y = mouse.y + 5;
|
||||||
@ -265,7 +221,9 @@ void main()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//TODO: display error (too many redirects)
|
notify("Too many redirects");
|
||||||
|
StopLoading();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -292,7 +250,7 @@ void main()
|
|||||||
http_free stdcall (http_transfer);
|
http_free stdcall (http_transfer);
|
||||||
http_transfer=0;
|
http_transfer=0;
|
||||||
SetPageDefaults();
|
SetPageDefaults();
|
||||||
Draw_Window(); // stop button => refresh button
|
ShowPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,54 +260,32 @@ void main()
|
|||||||
|
|
||||||
void SetElementSizes()
|
void SetElementSizes()
|
||||||
{
|
{
|
||||||
address_box.top = TOOLBAR_H-TAB_H/2-7+TAB_H;
|
address_box.top = TOOLBAR_H/2-7;
|
||||||
address_box.width = Form.cwidth - address_box.left - 25 - 22;
|
address_box.width = Form.cwidth - address_box.left - 25 - 22;
|
||||||
WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom,
|
WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom,
|
||||||
Form.cheight - TOOLBAR_H - STATUSBAR_H, WB1.list.font_h + WB1.DrawBuf.zoom + WB1.DrawBuf.zoom * WB1.DrawBuf.zoom);
|
Form.cheight - TOOLBAR_H - STATUSBAR_H, WB1.list.font_h + WB1.DrawBuf.zoom + WB1.DrawBuf.zoom * WB1.DrawBuf.zoom);
|
||||||
WB1.list.wheel_size = 7;
|
WB1.list.wheel_size = 7;
|
||||||
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
|
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
|
||||||
WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h;
|
WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h;
|
||||||
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h * 20);
|
if (WB1.list.w!=WB1.DrawBuf.bufw) WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h * 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw_Window()
|
void Draw_Window()
|
||||||
{
|
{
|
||||||
int img_off;
|
DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color);
|
||||||
// tab {
|
|
||||||
/*
|
|
||||||
if (TAB_H)
|
|
||||||
{
|
|
||||||
DrawBar(0, 0, TAB_W, TAB_H+1, panel_color);
|
|
||||||
WriteText(5, 7, 0x80, 0xfdfdFd, "Index.htm");
|
|
||||||
WriteText(4, 6, 0x80, 0, "Index.htm");
|
|
||||||
DrawBar(TAB_W,0, Form.cwidth-TAB_W,TAB_H, col_bg);
|
|
||||||
DrawBar(TAB_W-1,TAB_H, Form.cwidth-TAB_W+1,1, border_color);
|
|
||||||
img_draw stdcall(skin.image, TAB_W-13, 0, 30, skin.h, 101, 0);
|
|
||||||
}
|
|
||||||
else */ DrawBar(0,0, Form.cwidth,1, col_bg);
|
|
||||||
// }
|
|
||||||
DrawBar(0,TAB_H+1, Form.cwidth,TOOLBAR_H-TAB_H-3, panel_color);
|
|
||||||
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-2, address_box.top-3, address_box.width+4, 20,border_color);
|
DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 20,border_color);
|
||||||
DrawRectangle(address_box.left-1, address_box.top-2, address_box.width+2, 18,address_box.color);
|
DefineButton(address_box.left-50, address_box.top-2, 23, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
|
||||||
DrawRectangle(address_box.left-1, address_box.top-1, address_box.width+2, 16,address_box.color);
|
DefineButton(address_box.left-26, address_box.top-2, 23, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
|
||||||
// < / >
|
img_draw stdcall(skin.image, address_box.left-51, address_box.top-3, 48, skin.h, 3, 0);
|
||||||
DefineButton(address_box.left-49, address_box.top-2, 23, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
|
|
||||||
DefineButton(address_box.left-25, address_box.top-2, 23, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
|
|
||||||
img_draw stdcall(skin.image, address_box.left-50, address_box.top-3, 48, skin.h, 3, 0);
|
|
||||||
// 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);
|
DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
|
||||||
if (http_transfer > 0) img_off = 131; else img_off = 52;
|
|
||||||
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, img_off, 0);
|
|
||||||
// config
|
|
||||||
DefineButton(Form.cwidth-24, address_box.top-3, 19, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
|
DefineButton(Form.cwidth-24, address_box.top-3, 19, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
|
||||||
img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-3, 16, skin.h, 85, 0);
|
img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-3, 16, skin.h, 85, 0);
|
||||||
//status bar
|
|
||||||
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);
|
||||||
ShowPage();
|
if (!header) OpenPage(); else { WB1.DrawPage(); DrawEditBox(); }
|
||||||
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();
|
||||||
}
|
}
|
||||||
@ -358,11 +294,6 @@ void Draw_Window()
|
|||||||
void Scan(dword id__)
|
void Scan(dword id__)
|
||||||
{
|
{
|
||||||
action_buf=0;
|
action_buf=0;
|
||||||
if (id__ >= 400) && (id__ < 1000)
|
|
||||||
{
|
|
||||||
ProcessLinks(id__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (id__)
|
switch (id__)
|
||||||
{
|
{
|
||||||
case SCAN_CODE_BS:
|
case SCAN_CODE_BS:
|
||||||
@ -370,41 +301,39 @@ void Scan(dword id__)
|
|||||||
if (!BrowserHistory.GoBack()) return;
|
if (!BrowserHistory.GoBack()) return;
|
||||||
OpenPage();
|
OpenPage();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case FORWARD_BUTTON:
|
case FORWARD_BUTTON:
|
||||||
if (!BrowserHistory.GoForward()) return;
|
if (!BrowserHistory.GoForward()) return;
|
||||||
OpenPage();
|
OpenPage();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SCAN_CODE_HOME:
|
case SCAN_CODE_HOME:
|
||||||
case SCAN_CODE_END:
|
case SCAN_CODE_END:
|
||||||
case SCAN_CODE_PGUP:
|
case SCAN_CODE_PGUP:
|
||||||
case SCAN_CODE_PGDN:
|
case SCAN_CODE_PGDN:
|
||||||
if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage();
|
if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SCAN_CODE_UP:
|
case SCAN_CODE_UP:
|
||||||
if (WB1.list.first <= 0) return;
|
if (WB1.list.first <= 0) return;
|
||||||
WB1.list.first--;
|
WB1.list.first--;
|
||||||
WB1.DrawPage();
|
WB1.DrawPage();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SCAN_CODE_DOWN:
|
case SCAN_CODE_DOWN:
|
||||||
if (WB1.list.visible + WB1.list.first >= WB1.list.count) return;
|
if (WB1.list.visible + WB1.list.first >= WB1.list.count) return;
|
||||||
WB1.list.first++;
|
WB1.list.first++;
|
||||||
WB1.DrawPage();
|
WB1.DrawPage();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case GOTOURL_BUTTON:
|
case GOTOURL_BUTTON:
|
||||||
case SCAN_CODE_ENTER: //enter
|
case SCAN_CODE_ENTER:
|
||||||
if (!editURL[0]) return;
|
if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/') || (!strncmp(#editURL,"WebView:",9))
|
||||||
if (strncmp(#editURL,"http:",5)) && (editURL[0]!='/') && (strncmp(#editURL,"WebView:",9)) strncpy(#URL,"http://",7);
|
{
|
||||||
|
strcpy(#URL, #editURL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
URL[0] = 0;
|
{
|
||||||
strcat(#URL, #editURL);
|
strncpy(#URL,"http://",7);
|
||||||
|
strcat(#URL, #editURL);
|
||||||
|
}
|
||||||
OpenPage();
|
OpenPage();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 063: //F5
|
case 063: //F5
|
||||||
IF(address_box.flags & 0b10) return;
|
IF(address_box.flags & 0b10) return;
|
||||||
case REFRESH_BUTTON:
|
case REFRESH_BUTTON:
|
||||||
@ -415,19 +344,16 @@ void Scan(dword id__)
|
|||||||
}
|
}
|
||||||
else OpenPage();
|
else OpenPage();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SANDWICH_BUTTON:
|
case SANDWICH_BUTTON:
|
||||||
mouse.y = TOOLBAR_H-6;
|
mouse.y = TOOLBAR_H-6;
|
||||||
mouse.x = Form.cwidth - 167;
|
mouse.x = Form.cwidth - 167;
|
||||||
CreateThread(#menu_rmb,#stak+4092);
|
CreateThread(#menu_rmb,#stak+4092);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case VIEW_SOURCE:
|
case VIEW_SOURCE:
|
||||||
WB1.list.first = 0;
|
WB1.list.first = 0;
|
||||||
ShowSource();
|
ShowSource();
|
||||||
WB1.DrawPage();
|
WB1.DrawPage();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDIT_SOURCE:
|
case EDIT_SOURCE:
|
||||||
if (!strncmp(#URL,"http:",5))
|
if (!strncmp(#URL,"http:",5))
|
||||||
{
|
{
|
||||||
@ -436,42 +362,36 @@ void Scan(dword id__)
|
|||||||
}
|
}
|
||||||
else RunProgram("/rd/1/tinypad", #URL);
|
else RunProgram("/rd/1/tinypad", #URL);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case FREE_IMG_CACHE:
|
case FREE_IMG_CACHE:
|
||||||
ImgCache.Free();
|
ImgCache.Free();
|
||||||
notify(IMAGES_CACHE_CLEARED);
|
notify(IMAGES_CACHE_CLEARED);
|
||||||
WB1.DrawPage();
|
WB1.DrawPage();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case VIEW_HISTORY:
|
case VIEW_HISTORY:
|
||||||
strcpy(#URL, URL_SERVICE_HISTORY);
|
strcpy(#URL, URL_SERVICE_HISTORY);
|
||||||
OpenPage();
|
OpenPage();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case DOWNLOAD_MANAGER:
|
case DOWNLOAD_MANAGER:
|
||||||
if (!downloader_opened) {
|
if (!downloader_opened) {
|
||||||
strncpy(#DL_URL, "http://",7);
|
strncpy(#DL_URL, "http://",7);
|
||||||
CreateThread(#Downloader,#downloader_stak+4092);
|
CreateThread(#Downloader,#downloader_stak+4092);
|
||||||
}
|
}
|
||||||
return;
|
return; /*
|
||||||
/*
|
|
||||||
case 020:
|
case 020:
|
||||||
case NEWTAB:
|
case NEWTAB:
|
||||||
MoveSize(190,80,OLD,OLD);
|
MoveSize(190,80,OLD,OLD);
|
||||||
RunProgram(#program_path, #URL);
|
RunProgram(#program_path, #URL);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SEARCHWEB_BUTTON:
|
case SEARCHWEB_BUTTON:
|
||||||
sprintf(#URL,"%s%s",#search_path,#editURL);
|
sprintf(#URL,"%s%s",#search_path,#editURL);
|
||||||
OpenPage();
|
OpenPage();
|
||||||
return;
|
return; */
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ProcessLinks(int id)
|
void ClickLink()
|
||||||
{
|
{
|
||||||
if (http_transfer > 0)
|
if (http_transfer > 0)
|
||||||
{
|
{
|
||||||
@ -479,7 +399,7 @@ void ProcessLinks(int id)
|
|||||||
BrowserHistory.current--;
|
BrowserHistory.current--;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(#URL, PageLinks.GetURL(id-401));
|
strcpy(#URL, PageLinks.GetURL(PageLinks.active));
|
||||||
//#1
|
//#1
|
||||||
if (URL[0] == '#')
|
if (URL[0] == '#')
|
||||||
{
|
{
|
||||||
@ -563,6 +483,7 @@ void OpenPage()
|
|||||||
SetPageDefaults();
|
SetPageDefaults();
|
||||||
if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
|
if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
|
||||||
else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
|
else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
|
||||||
|
DrawEditBox();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!strncmp(#URL,"http:",5))
|
if (!strncmp(#URL,"http:",5))
|
||||||
@ -596,9 +517,12 @@ void OpenPage()
|
|||||||
|
|
||||||
DrawEditBox()
|
DrawEditBox()
|
||||||
{
|
{
|
||||||
|
DrawWideRectangle(address_box.left-2, address_box.top-2, address_box.width+3, 19, 2, address_box.color);
|
||||||
address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
|
address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
|
||||||
address_box.offset = 0;
|
address_box.offset = 0;
|
||||||
edit_box_draw stdcall(#address_box);
|
edit_box_draw stdcall(#address_box);
|
||||||
|
if (http_transfer > 0) EAX = 131; else EAX = 52;
|
||||||
|
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, EAX, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -630,6 +554,27 @@ byte UrlExtIs(dword ext)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SetSkinColors()
|
||||||
|
{
|
||||||
|
dword image_data;
|
||||||
|
image_data = DSDWORD[skin.image+24];
|
||||||
|
col_bg = DSDWORD[image_data];
|
||||||
|
panel_color = DSDWORD[skin.w*4*4 + image_data];
|
||||||
|
border_color = DSDWORD[skin.w*4*7 + image_data];
|
||||||
|
wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data];
|
||||||
|
$and col_bg, 0x00ffffff
|
||||||
|
$and panel_color, 0x00ffffff
|
||||||
|
$and border_color, 0x00ffffff
|
||||||
|
$and wv_progress_bar.progress_color, 0x00ffffff
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawProgress()
|
||||||
|
{
|
||||||
|
unsigned long btn;
|
||||||
|
if (http_transfer == 0) return;
|
||||||
|
if (wv_progress_bar.max) btn = address_box.width*wv_progress_bar.value/wv_progress_bar.max; else btn = 30;
|
||||||
|
DrawBar(address_box.left-2, address_box.top+15, btn, 2, wv_progress_bar.progress_color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char downloader_stak[4096];
|
char downloader_stak[4096];
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Loading…
Reference in New Issue
Block a user