forked from KolibriOS/kolibrios
fix searchapp
git-svn-id: svn://kolibrios.org@7756 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
f608182ea2
commit
7b61a5afa1
@ -39,29 +39,25 @@ struct TWebBrowser {
|
|||||||
void BufEncode();
|
void BufEncode();
|
||||||
} WB1;
|
} WB1;
|
||||||
|
|
||||||
|
dword page_bg;
|
||||||
|
#include "..\TWB\img_cache.h"
|
||||||
|
|
||||||
dword link_color_inactive;
|
dword link_color_inactive;
|
||||||
dword link_color_active;
|
dword link_color_active;
|
||||||
dword page_bg;
|
|
||||||
|
|
||||||
bool
|
bool link, cur_encoding, t_html, t_body;
|
||||||
link,
|
|
||||||
cur_encoding,
|
|
||||||
t_html,
|
|
||||||
t_body;
|
|
||||||
|
|
||||||
#include "..\TWB\img_cache.h"
|
|
||||||
#include "..\TWB\links.h"
|
#include "..\TWB\links.h"
|
||||||
|
|
||||||
dword bufpointer=0;
|
dword bufpointer=0;
|
||||||
dword bufsize=0;
|
dword bufsize=0;
|
||||||
|
|
||||||
|
char header[150];
|
||||||
|
|
||||||
int body_magrin=6;
|
int body_magrin=6;
|
||||||
int basic_line_h=22;
|
int basic_line_h=22;
|
||||||
|
|
||||||
char header[150];
|
scroll_bar scroll_wv = { 15,NULL,NULL,NULL,0,2,NULL,15,0,0xeeeeee,0xBBBbbb,0xeeeeee};
|
||||||
char oldtag[100];
|
|
||||||
|
|
||||||
scroll_bar scroll_wv = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
|
|
||||||
|
|
||||||
//============================================================================================
|
//============================================================================================
|
||||||
void TWebBrowser::DrawStyle()
|
void TWebBrowser::DrawStyle()
|
||||||
@ -251,7 +247,6 @@ void TWebBrowser::ParseHtml(){
|
|||||||
DrawStyle();
|
DrawStyle();
|
||||||
if (tag.name) SetStyle();
|
if (tag.name) SetStyle();
|
||||||
}
|
}
|
||||||
strncpy(#oldtag, #tag.name, sizeof(oldtag)-1);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
AddCharToTheLine(ESBYTE[bufpos]);
|
AddCharToTheLine(ESBYTE[bufpos]);
|
||||||
@ -375,9 +370,8 @@ void TWebBrowser::SetStyle() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tag.is("div")) {
|
if (tag.is("div")) {
|
||||||
if (streq(#oldtag,"div")) && (tag.opened) return;
|
if (streq(#tag.prior,"div")) && (tag.opened) return;
|
||||||
NewLine();
|
NewLine();
|
||||||
//IF (oldtag[0] != 'h')
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tag.is("header")) || (tag.is("article")) || (tag.is("footer")) || (tag.is("figure")) {
|
if (tag.is("header")) || (tag.is("article")) || (tag.is("footer")) || (tag.is("figure")) {
|
||||||
@ -385,9 +379,8 @@ void TWebBrowser::SetStyle() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tag.is("p")) {
|
if (tag.is("p")) {
|
||||||
IF (oldtag[0] == 'h') || (streq(#oldtag,"td")) || (streq(#oldtag,"p")) return;
|
IF (tag.prior[0] == 'h') || (streq(#tag.prior,"td")) || (streq(#tag.prior,"p")) return;
|
||||||
NewLine();
|
NewLine();
|
||||||
//IF(tag.opened) NewLine();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tag.is("br")) { NewLine(); return; }
|
if (tag.is("br")) { NewLine(); return; }
|
||||||
|
@ -69,12 +69,14 @@ void ImageCache::Images(dword left1, top1, width1)
|
|||||||
img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first);
|
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(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);
|
DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, page_bg);
|
||||||
|
/*
|
||||||
if (link)
|
if (link)
|
||||||
{
|
{
|
||||||
//UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
|
UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
|
||||||
//PageLinks.AddText(0, imgw, imgh-1, NOLINE, 1);
|
PageLinks.AddText(0, imgw, imgh-1, NOLINE, 1);
|
||||||
//WB1.DrawPage();
|
WB1.DrawPage();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageCache ImgCache;
|
ImageCache ImgCache;
|
@ -2,6 +2,7 @@
|
|||||||
struct _tag
|
struct _tag
|
||||||
{
|
{
|
||||||
char name[32];
|
char name[32];
|
||||||
|
char prior[32];
|
||||||
char params[5000];
|
char params[5000];
|
||||||
bool opened;
|
bool opened;
|
||||||
collection attributes;
|
collection attributes;
|
||||||
@ -25,12 +26,11 @@ bool _tag::is(dword _text)
|
|||||||
bool _tag::reset()
|
bool _tag::reset()
|
||||||
{
|
{
|
||||||
if (!name) return false;
|
if (!name) return false;
|
||||||
|
strcpy(#prior, #name);
|
||||||
name = NULL;
|
name = NULL;
|
||||||
opened = true;
|
opened = true;
|
||||||
attributes.drop();
|
attributes.drop();
|
||||||
values.drop();
|
values.drop();
|
||||||
attributes.add("ZERO");
|
|
||||||
values.add("NULL");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ char link_menu[] =
|
|||||||
Download link contents";
|
Download link contents";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define URL_SIZE 4000;
|
#define URL_SIZE 4000
|
||||||
|
|
||||||
dword col_bg = 0xE3E2E2;
|
dword col_bg = 0xE3E2E2;
|
||||||
dword panel_color = 0xE3E2E2;
|
dword panel_color = 0xE3E2E2;
|
||||||
@ -400,25 +400,23 @@ void StopLoading()
|
|||||||
DrawOmnibox();
|
DrawOmnibox();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
//rewrite into
|
||||||
void ReplaceSpaceInUrl() {
|
|
||||||
int i;
|
|
||||||
char new_url[URL_SIZE];
|
|
||||||
strcpy(#new_url, history.current());
|
|
||||||
while (i = strchr(#new_url, ' '))
|
|
||||||
{
|
|
||||||
i -= #new_url;
|
|
||||||
strlcpy(#new_url+i+3, #new_url+i+1, URL_SIZE);
|
|
||||||
URL[i] = '%';
|
|
||||||
URL[i+1] = '2';
|
|
||||||
URL[i+2] = '0';
|
|
||||||
}
|
|
||||||
strcpy(#editURL, #new_url);
|
|
||||||
}
|
|
||||||
|
|
||||||
//bool strrpl(dword dst, from, to, dst_len); !!!!!!!!
|
//bool strrpl(dword dst, from, to, dst_len); !!!!!!!!
|
||||||
|
void ReplaceSpaceInUrl(dword url, size) {
|
||||||
*/
|
unsigned int i, j;
|
||||||
|
for (i=size-3; i>0; i--)
|
||||||
|
{
|
||||||
|
if (ESBYTE[i]!=' ') continue;
|
||||||
|
for (j=size-3; j>i; j--) {
|
||||||
|
ESBYTE[j+2]=ESBYTE[j+1];
|
||||||
|
ESBYTE[j+1]=ESBYTE[j];
|
||||||
|
}
|
||||||
|
ESBYTE[i] = '%';
|
||||||
|
ESBYTE[i+1] = '2';
|
||||||
|
ESBYTE[i+2] = '0';
|
||||||
|
}
|
||||||
|
debugln(url);
|
||||||
|
}
|
||||||
|
|
||||||
bool GetLocalFileData(dword _path)
|
bool GetLocalFileData(dword _path)
|
||||||
{
|
{
|
||||||
@ -461,10 +459,10 @@ void OpenPage(dword _open_URL)
|
|||||||
else LoadInternalPage(#page_not_found, sizeof(page_not_found));
|
else LoadInternalPage(#page_not_found, sizeof(page_not_found));
|
||||||
} else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) {
|
} else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) {
|
||||||
//WEB PAGE
|
//WEB PAGE
|
||||||
//ReplaceSpaceInUrl(); !!!!!!!!
|
|
||||||
img_draw stdcall(skin.image, address_box.left+address_box.width+1,
|
img_draw stdcall(skin.image, address_box.left+address_box.width+1,
|
||||||
address_box.top-3, 17, skin.h, 85, SKIN_Y);
|
address_box.top-3, 17, skin.h, 85, SKIN_Y);
|
||||||
|
|
||||||
|
//ReplaceSpaceInUrl(#new_url, URL_SIZE);
|
||||||
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)) {
|
||||||
@ -486,7 +484,7 @@ void OpenPage(dword _open_URL)
|
|||||||
|
|
||||||
void EventClickLink(dword _click_URL)
|
void EventClickLink(dword _click_URL)
|
||||||
{
|
{
|
||||||
char new_url[URL_SIZE];
|
char new_url[URL_SIZE+1];
|
||||||
|
|
||||||
if (ESBYTE[_click_URL]=='#') {
|
if (ESBYTE[_click_URL]=='#') {
|
||||||
if (anchors.get_pos_by_name(_click_URL+1)!=-1) {
|
if (anchors.get_pos_by_name(_click_URL+1)!=-1) {
|
||||||
@ -585,10 +583,6 @@ void DrawOmnibox()
|
|||||||
void LoadInternalPage(dword _bufdata, _in_bufsize){
|
void LoadInternalPage(dword _bufdata, _in_bufsize){
|
||||||
if (!_bufdata) || (!_in_bufsize) {
|
if (!_bufdata) || (!_in_bufsize) {
|
||||||
LoadInternalPage(#page_not_found, sizeof(page_not_found));
|
LoadInternalPage(#page_not_found, sizeof(page_not_found));
|
||||||
} else if (source_mode) {
|
|
||||||
source_mode = false;
|
|
||||||
//WB1.ParseHtml();
|
|
||||||
ShowSource(_bufdata, _in_bufsize);
|
|
||||||
} else {
|
} else {
|
||||||
bufsize = _in_bufsize;
|
bufsize = _in_bufsize;
|
||||||
if (bufpointer!=_bufdata) free(bufpointer);
|
if (bufpointer!=_bufdata) free(bufpointer);
|
||||||
@ -600,6 +594,12 @@ void LoadInternalPage(dword _bufdata, _in_bufsize){
|
|||||||
strcat(#editURL, #anchors.current);
|
strcat(#editURL, #anchors.current);
|
||||||
DrawOmnibox();
|
DrawOmnibox();
|
||||||
}
|
}
|
||||||
|
if (source_mode) {
|
||||||
|
source_mode = false;
|
||||||
|
WB1.ParseHtml();
|
||||||
|
ShowSource(bufpointer, bufsize);
|
||||||
|
return;
|
||||||
|
}
|
||||||
WB1.ParseHtml();
|
WB1.ParseHtml();
|
||||||
WB1.DrawPage();
|
WB1.DrawPage();
|
||||||
}
|
}
|
||||||
|
@ -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; i++)
|
for (i=0; i<history.items.count-1; i++)
|
||||||
{
|
{
|
||||||
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));
|
||||||
|
@ -40,11 +40,8 @@ dword ShowSource(dword _bufdata, _in_bufsize)
|
|||||||
opened_font_counter=0;
|
opened_font_counter=0;
|
||||||
source_buf_end = malloc(_in_bufsize*5);
|
source_buf_end = malloc(_in_bufsize*5);
|
||||||
source_buf_start = source_buf_end;
|
source_buf_start = source_buf_end;
|
||||||
header[strrchr(#header, '-')-2]=0;
|
|
||||||
|
|
||||||
SourceBufAdd(TEXT, "<html><head><title>Source: ");
|
SourceBufAdd(TEXT, "<html><head><title>View Source</title><body><pre>");
|
||||||
SourceBufAdd(TEXT, #header);
|
|
||||||
SourceBufAdd(TEXT, "</title><body><pre>");
|
|
||||||
|
|
||||||
for (i=_bufdata; i<_bufdata+_in_bufsize; i++) switch (ESBYTE[i])
|
for (i=_bufdata; i<_bufdata+_in_bufsize; i++) switch (ESBYTE[i])
|
||||||
{
|
{
|
||||||
|
@ -54,8 +54,8 @@ enum {
|
|||||||
#include "..\TWB\TWB.c"
|
#include "..\TWB\TWB.c"
|
||||||
#include "show_src.h"
|
#include "show_src.h"
|
||||||
|
|
||||||
char URL[URL_SIZE];
|
char URL[URL_SIZE+1];
|
||||||
char editURL[URL_SIZE];
|
char editURL[URL_SIZE+1];
|
||||||
int mouse_twb;
|
int mouse_twb;
|
||||||
edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,URL_SIZE-2,#editURL,#mouse_twb,2,19,19};
|
edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,URL_SIZE-2,#editURL,#mouse_twb,2,19,19};
|
||||||
|
|
||||||
|
@ -105,9 +105,16 @@ START:
|
|||||||
jmp .convert
|
jmp .convert
|
||||||
.converted:
|
.converted:
|
||||||
mov [delay], ecx
|
mov [delay], ecx
|
||||||
|
;--------------------------------------
|
||||||
|
DEBUGF 1, "Searchap: get basic file\n"
|
||||||
|
call load_file ; download the master file
|
||||||
|
xor eax,eax
|
||||||
|
cmp [fs_error],eax
|
||||||
|
jne exit
|
||||||
|
mov eax,[fileinfo.size]
|
||||||
|
mov [basic_file_size],eax
|
||||||
.params_done:
|
.params_done:
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
;mcall 5,[delay] ;first mount attempt without delay
|
|
||||||
mov ebx,start_dir
|
mov ebx,start_dir
|
||||||
mov ax,[ebx]
|
mov ax,[ebx]
|
||||||
mov ebx,read_folder_name
|
mov ebx,read_folder_name
|
||||||
@ -117,15 +124,6 @@ START:
|
|||||||
call device_detect_f70
|
call device_detect_f70
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
call print_retrieved_devices_table
|
call print_retrieved_devices_table
|
||||||
DEBUGF 1, "Searchap: get basic file\n"
|
|
||||||
;--------------------------------------
|
|
||||||
call load_file ; download the master file
|
|
||||||
xor eax,eax
|
|
||||||
cmp [fs_error],eax
|
|
||||||
jne exit
|
|
||||||
mov eax,[fileinfo.size]
|
|
||||||
mov [basic_file_size],eax
|
|
||||||
|
|
||||||
call search_and_load_pointer_file_label
|
call search_and_load_pointer_file_label
|
||||||
;---------------------------------------------------------------------
|
;---------------------------------------------------------------------
|
||||||
exit:
|
exit:
|
||||||
@ -137,6 +135,7 @@ exit:
|
|||||||
cmp [mount_attempt], 1
|
cmp [mount_attempt], 1
|
||||||
je @f
|
je @f
|
||||||
mov [mount_attempt], 1 ;second mount attempt with delay
|
mov [mount_attempt], 1 ;second mount attempt with delay
|
||||||
|
DEBUGF 2, "Searchap: second attempt after 5 seconds!\n"
|
||||||
mcall 5,[delay]
|
mcall 5,[delay]
|
||||||
jmp START.params_done
|
jmp START.params_done
|
||||||
@@:
|
@@:
|
||||||
@ -329,7 +328,8 @@ search_and_load_pointer_file_label:
|
|||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
ret
|
ret
|
||||||
.sucess:
|
.sucess:
|
||||||
call compare_files_and_mount
|
;call compare_files_and_mount
|
||||||
|
call compare_files_and_mount.mount_now ;no need to compare files content
|
||||||
cmp [compare_flag],byte 0
|
cmp [compare_flag],byte 0
|
||||||
jne @b
|
jne @b
|
||||||
cmp [mount_dir],1
|
cmp [mount_dir],1
|
||||||
@ -352,8 +352,9 @@ compare_files_and_mount:
|
|||||||
jne .not_match
|
jne .not_match
|
||||||
dec ecx
|
dec ecx
|
||||||
jnz .next_char
|
jnz .next_char
|
||||||
mov [compare_flag],byte 0
|
|
||||||
pop esi ecx
|
pop esi ecx
|
||||||
|
.mount_now:
|
||||||
|
mov [compare_flag],byte 0
|
||||||
;--------------------------------------
|
;--------------------------------------
|
||||||
DEBUGF 2, "Searchap: compare files - success!\n"
|
DEBUGF 2, "Searchap: compare files - success!\n"
|
||||||
DEBUGF 2, "Searchap: mount directory: %s\n",esi
|
DEBUGF 2, "Searchap: mount directory: %s\n",esi
|
||||||
|
Loading…
Reference in New Issue
Block a user