forked from KolibriOS/kolibrios
WebView 1.9: tweaks for better view, reworked source view
git-svn-id: svn://kolibrios.org@7746 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
4d5b6935a6
commit
8256819a57
@ -22,6 +22,8 @@ struct TWebBrowser {
|
|||||||
_style style;
|
_style style;
|
||||||
DrawBufer DrawBuf;
|
DrawBufer DrawBuf;
|
||||||
int zoom;
|
int zoom;
|
||||||
|
bool opened; //is this a "start tag" or "end tag"
|
||||||
|
void SetPageDefaults();
|
||||||
void Prepare();
|
void Prepare();
|
||||||
void SetStyle();
|
void SetStyle();
|
||||||
void DrawStyle();
|
void DrawStyle();
|
||||||
@ -36,7 +38,6 @@ struct TWebBrowser {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
link,
|
link,
|
||||||
ignor_text,
|
|
||||||
cur_encoding,
|
cur_encoding,
|
||||||
t_html,
|
t_html,
|
||||||
t_body;
|
t_body;
|
||||||
@ -112,8 +113,10 @@ void TWebBrowser::DrawStyle()
|
|||||||
if (style.s) DrawBuf.DrawBar(start_x, list.item_h / 2 - zoom + draw_y, line_length, zoom, text_colors[text_color_index]);
|
if (style.s) DrawBuf.DrawBar(start_x, list.item_h / 2 - zoom + draw_y, line_length, zoom, text_colors[text_color_index]);
|
||||||
if (style.u) DrawBuf.DrawBar(start_x, list.item_h - zoom - zoom + draw_y, line_length, zoom, text_colors[text_color_index]);
|
if (style.u) DrawBuf.DrawBar(start_x, list.item_h - zoom - zoom + draw_y, line_length, zoom, text_colors[text_color_index]);
|
||||||
if (link) {
|
if (link) {
|
||||||
DrawBuf.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, text_colors[text_color_index]);
|
if (streq[0]=' ') && (line[1]==NULL) {} else {
|
||||||
PageLinks.AddText(start_x, draw_y + list.y, line_length, list.item_h - calc(zoom*2), UNDERLINE, zoom); //TODO: set bigger underline_h for style.h
|
DrawBuf.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, text_colors[text_color_index]);
|
||||||
|
PageLinks.AddText(start_x, draw_y + list.y, line_length, list.item_h - calc(zoom*2), UNDERLINE, zoom);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
stolbec += stolbec_len;
|
stolbec += stolbec_len;
|
||||||
}
|
}
|
||||||
@ -125,14 +128,10 @@ void TWebBrowser::LoadInternalPage(dword bufpos, in_filesize){
|
|||||||
Prepare();
|
Prepare();
|
||||||
}
|
}
|
||||||
//============================================================================================
|
//============================================================================================
|
||||||
void TWebBrowser::Prepare(){
|
void TWebBrowser::SetPageDefaults()
|
||||||
word bukva[2];
|
{
|
||||||
dword j;
|
style.b = style.u = style.s = style.h = style.blq = t_html = t_body = style.pre =
|
||||||
byte ignor_param;
|
style.li = link = text_color_index = text_colors[0] = style.li_tab = false;
|
||||||
dword bufpos;
|
|
||||||
dword line_len;
|
|
||||||
style.b = style.u = style.s = style.h = style.blq = t_html = t_body =
|
|
||||||
style.li = link = ignor_text = text_color_index = text_colors[0] = style.li_tab = 0;
|
|
||||||
style.align = ALIGN_LEFT;
|
style.align = ALIGN_LEFT;
|
||||||
link_color_inactive = 0x0000FF;
|
link_color_inactive = 0x0000FF;
|
||||||
link_color_active = 0xFF0000;
|
link_color_active = 0xFF0000;
|
||||||
@ -141,26 +140,23 @@ void TWebBrowser::Prepare(){
|
|||||||
DrawBuf.Fill(0, page_bg);
|
DrawBuf.Fill(0, page_bg);
|
||||||
PageLinks.Clear();
|
PageLinks.Clear();
|
||||||
strcpy(#header, #version);
|
strcpy(#header, #version);
|
||||||
|
cur_encoding = CH_NULL;
|
||||||
draw_y = body_magrin;
|
draw_y = body_magrin;
|
||||||
stolbec = 0;
|
stolbec = 0;
|
||||||
line = 0;
|
line = 0;
|
||||||
zoom = 1;
|
zoom = 1;
|
||||||
//for plaint text use CP866 for other UTF
|
}
|
||||||
if (strstri(bufpointer, "html")!=-1)
|
//============================================================================================
|
||||||
{
|
void TWebBrowser::Prepare(){
|
||||||
debugln("<html> found");
|
word bukva[2];
|
||||||
style.pre = false;
|
dword j;
|
||||||
cur_encoding = CH_NULL;
|
bool ignor_param;
|
||||||
}
|
dword bufpos;
|
||||||
else
|
dword line_len;
|
||||||
{
|
SetPageDefaults();
|
||||||
debugln("no <html>");
|
if (strstri(bufpointer, "<html")==-1) style.pre = true; //show linebreaks for a plaint text
|
||||||
style.pre = true;
|
|
||||||
cur_encoding = CH_NULL;
|
|
||||||
}
|
|
||||||
for (bufpos=bufpointer ; (bufpos < bufpointer+bufsize) && (ESBYTE[bufpos]!=0) ; bufpos++;)
|
for (bufpos=bufpointer ; (bufpos < bufpointer+bufsize) && (ESBYTE[bufpos]!=0) ; bufpos++;)
|
||||||
{
|
{
|
||||||
if (ignor_text) && (ESBYTE[bufpos]!='<') continue;
|
|
||||||
bukva = ESBYTE[bufpos];
|
bukva = ESBYTE[bufpos];
|
||||||
switch (bukva)
|
switch (bukva)
|
||||||
{
|
{
|
||||||
@ -201,7 +197,7 @@ void TWebBrowser::Prepare(){
|
|||||||
{
|
{
|
||||||
bufpos++;
|
bufpos++;
|
||||||
}
|
}
|
||||||
bufpos+=3;
|
bufpos+=2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tag = attr = tagparam = ignor_param = NULL;
|
tag = attr = tagparam = ignor_param = NULL;
|
||||||
@ -216,18 +212,39 @@ void TWebBrowser::Prepare(){
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ignor_param = true;
|
ignor_param = true;
|
||||||
if (!ignor_text) && (strlen(#tagparam)+1<sizeof(tagparam)) strcat(#tagparam, #bukva);
|
if (strlen(#tagparam)+1<sizeof(tagparam)) strcat(#tagparam, #bukva);
|
||||||
}
|
}
|
||||||
bufpos++;
|
bufpos++;
|
||||||
}
|
}
|
||||||
strlwr(#tag);
|
strlwr(#tag);
|
||||||
|
|
||||||
|
// ignore text inside the next tags
|
||||||
|
if (istag("script")) || (istag("style")) || (istag("binary")) || (istag("select")) {
|
||||||
|
for (j=10; j>0; j--) tag[j]=tag[j-1];
|
||||||
|
tag[0] = '/';
|
||||||
|
j = strstri(bufpos, #tag);
|
||||||
|
if (j!=-1) {
|
||||||
|
bufpos = j;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/
|
if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/
|
||||||
if (tagparam) GetNextParam();
|
if (tagparam) GetNextParam();
|
||||||
Perenos();
|
|
||||||
DrawStyle();
|
if (tag[0] == '/')
|
||||||
line = NULL;
|
{
|
||||||
if (tag) SetStyle();
|
opened = 0;
|
||||||
|
strcpy(#tag, #tag+1);
|
||||||
|
}
|
||||||
|
else opened = 1;
|
||||||
|
|
||||||
|
if (tag) && (!istag("span")) && (!istag("i")) && (!istag("svg")) {
|
||||||
|
Perenos();
|
||||||
|
DrawStyle();
|
||||||
|
line = NULL;
|
||||||
|
if (tag) SetStyle();
|
||||||
|
}
|
||||||
strlcpy(#oldtag, #tag, sizeof(oldtag));
|
strlcpy(#oldtag, #tag, sizeof(oldtag));
|
||||||
tag = attr = tagparam = ignor_param = NULL;
|
tag = attr = tagparam = ignor_param = NULL;
|
||||||
break;
|
break;
|
||||||
@ -270,25 +287,15 @@ void TWebBrowser::Perenos()
|
|||||||
void TWebBrowser::SetStyle() {
|
void TWebBrowser::SetStyle() {
|
||||||
char img_path[4096];
|
char img_path[4096];
|
||||||
int left1 = body_magrin + list.x;
|
int left1 = body_magrin + list.x;
|
||||||
bool opened;
|
|
||||||
int meta_encoding;
|
int meta_encoding;
|
||||||
if (tag[0] == '/')
|
|
||||||
{
|
|
||||||
opened = 0;
|
|
||||||
strcpy(#tag, #tag+1);
|
|
||||||
}
|
|
||||||
else opened = 1;
|
|
||||||
if (istag("html")) {
|
if (istag("html")) {
|
||||||
t_html = opened;
|
t_html = opened;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (istag("script")) || (istag("style")) || (istag("binary")) || (istag("select")) { ignor_text = opened; return; }
|
|
||||||
if (istag("form")) if (!opened) ignor_text = false;
|
|
||||||
if(istag("title")) {
|
if(istag("title")) {
|
||||||
if (opened) header=NULL;
|
if (opened) header=NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ignor_text) return;
|
|
||||||
|
|
||||||
IF(istag("q"))
|
IF(istag("q"))
|
||||||
{
|
{
|
||||||
@ -360,14 +367,20 @@ void TWebBrowser::SetStyle() {
|
|||||||
else if (text_color_index > 0) text_color_index--;
|
else if (text_color_index > 0) text_color_index--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (istag("div")) || (istag("header")) || (istag("article")) || (istag("footer")) {
|
if (istag("div")) {
|
||||||
IF(oldtag[0] != 'h') NewLine();
|
if (streq(#oldtag,"div")) && (opened) return;
|
||||||
|
NewLine();
|
||||||
|
//IF (oldtag[0] != 'h')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (istag("header")) || (istag("article")) || (istag("footer")) || (istag("figure")) {
|
||||||
|
NewLine();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (istag("p")) {
|
if (istag("p")) {
|
||||||
IF(oldtag[0] == 'h') return;
|
IF (oldtag[0] == 'h') || (streq(#oldtag,"td")) || (streq(#oldtag,"p")) return;
|
||||||
NewLine();
|
NewLine();
|
||||||
IF(opened) NewLine();
|
//IF(opened) NewLine();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (istag("br")) { NewLine(); return; }
|
if (istag("br")) { NewLine(); return; }
|
||||||
@ -383,7 +396,9 @@ void TWebBrowser::SetStyle() {
|
|||||||
do{
|
do{
|
||||||
if (isattr("src=")) strcpy(#img_path, #val);
|
if (isattr("src=")) strcpy(#img_path, #val);
|
||||||
if (isattr("alt=")) sprintf(#line, "[%s]", #val);
|
if (isattr("alt=")) sprintf(#line, "[%s]", #val);
|
||||||
|
if (isattr("title=")) sprintf(#line, "[%s]", #val);
|
||||||
} while(GetNextParam());
|
} while(GetNextParam());
|
||||||
|
debugln(#val);
|
||||||
style.image = true;
|
style.image = true;
|
||||||
text_color_index++;
|
text_color_index++;
|
||||||
text_colors[text_color_index] = 0x9A6F29;
|
text_colors[text_color_index] = 0x9A6F29;
|
||||||
@ -455,8 +470,10 @@ void TWebBrowser::SetStyle() {
|
|||||||
$push edi;
|
$push edi;
|
||||||
NewLine();
|
NewLine();
|
||||||
$pop edi;
|
$pop edi;
|
||||||
|
draw_y += 10;
|
||||||
DrawBuf.DrawBar(5, draw_y - 1, list.w-10, 1, EDI);
|
DrawBuf.DrawBar(5, draw_y - 1, list.w-10, 1, EDI);
|
||||||
NewLine();
|
NewLine();
|
||||||
|
draw_y += 10;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (istag("meta")) || (istag("?xml")) {
|
if (istag("meta")) || (istag("?xml")) {
|
||||||
@ -477,7 +494,7 @@ void TWebBrowser::SetStyle() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//============================================================================================
|
||||||
void TWebBrowser::BufEncode(dword set_new_encoding)
|
void TWebBrowser::BufEncode(dword set_new_encoding)
|
||||||
{
|
{
|
||||||
if (cur_encoding == set_new_encoding) return;
|
if (cur_encoding == set_new_encoding) return;
|
||||||
|
@ -64,6 +64,7 @@ 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)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
if (!count) return true;
|
||||||
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)
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
bool GetNextParam() {
|
bool GetNextParam()
|
||||||
if (!old_tag_parser_mode)
|
|
||||||
return GetNextParam_NEW();
|
|
||||||
else
|
|
||||||
return GetNextParam_OLD();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetNextParam_NEW()
|
|
||||||
{
|
{
|
||||||
byte quotes = NULL;
|
byte quotes = NULL;
|
||||||
int i;
|
int i;
|
||||||
@ -74,44 +67,3 @@ bool GetNextParam_NEW()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int GetNextParam_OLD()
|
|
||||||
{
|
|
||||||
byte kavichki=0;
|
|
||||||
int i = strlen(#tagparam) - 1;
|
|
||||||
|
|
||||||
if (!tagparam) return 0;
|
|
||||||
|
|
||||||
WHILE((i > 0) && ((tagparam[i] == '"') || (tagparam[i] == ' ') || (tagparam[i] == '\'') || (tagparam[i] == '/')))
|
|
||||||
{
|
|
||||||
IF (tagparam[i] == '"') || (tagparam[i] == '\'') kavichki=tagparam[i];
|
|
||||||
tagparam[i] = 0x00;
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kavichki)
|
|
||||||
{
|
|
||||||
i = strrchr(#tagparam, kavichki);
|
|
||||||
strlcpy(#val, #tagparam + i, sizeof(val));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WHILE((i > 0) && (tagparam[i] <>'=')) i--; //i=strrchr(#tagparam, '=')+1;
|
|
||||||
i++;
|
|
||||||
strlcpy(#val, #tagparam + i, sizeof(val));
|
|
||||||
|
|
||||||
WHILE (val[0] == ' ') strcpy(#val, #val+1);
|
|
||||||
ESBYTE[strchr(#val, ' ')] = NULL;
|
|
||||||
}
|
|
||||||
tagparam[i] = 0x00;
|
|
||||||
|
|
||||||
FOR ( ; ((tagparam[i] <>' ') && (i > 0); i--)
|
|
||||||
{
|
|
||||||
IF (tagparam[i] == '=') //dirty fix (kludge)
|
|
||||||
tagparam[i + 1] = 0x00;
|
|
||||||
}
|
|
||||||
strlcpy(#attr, #tagparam + i + 1, sizeof(attr));
|
|
||||||
tagparam[i] = 0x00;
|
|
||||||
strlwr(#attr);
|
|
||||||
return 1;
|
|
||||||
}
|
|
@ -30,7 +30,7 @@ _http http = {0, 0, 0, 0, 0, 0, 0};
|
|||||||
|
|
||||||
|
|
||||||
#ifdef LANG_RUS
|
#ifdef LANG_RUS
|
||||||
char version[]="’¥ªáâ®¢ë© ¡à 㧥à 1.85";
|
char version[]="’¥ªáâ®¢ë© ¡à 㧥à 1.9";
|
||||||
?define IMAGES_CACHE_CLEARED "Šíè ª à⨮ª ®ç¨é¥"
|
?define IMAGES_CACHE_CLEARED "Šíè ª à⨮ª ®ç¨é¥"
|
||||||
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤¨© á« ©¤"
|
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤¨© á« ©¤"
|
||||||
char loading[] = "‡ £à㧪 áâà ¨æë...<br>";
|
char loading[] = "‡ £à㧪 áâà ¨æë...<br>";
|
||||||
@ -47,7 +47,7 @@ char link_menu[] =
|
|||||||
"Š®¯¨à®¢ âì áá뫪ã
|
"Š®¯¨à®¢ âì áá뫪ã
|
||||||
‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
|
‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
|
||||||
#else
|
#else
|
||||||
char version[]="Text-based Browser 1.85";
|
char version[]="Text-based Browser 1.9";
|
||||||
?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>";
|
||||||
@ -88,7 +88,6 @@ dword panel_color = 0xE3E2E2;
|
|||||||
dword border_color = 0x8C8C8C;
|
dword border_color = 0x8C8C8C;
|
||||||
|
|
||||||
bool debug_mode = false;
|
bool debug_mode = false;
|
||||||
bool old_tag_parser_mode = false;
|
|
||||||
|
|
||||||
progress_bar wv_progress_bar;
|
progress_bar wv_progress_bar;
|
||||||
bool souce_mode = false;
|
bool souce_mode = false;
|
||||||
@ -115,7 +114,7 @@ enum {
|
|||||||
#include "download_manager.h"
|
#include "download_manager.h"
|
||||||
|
|
||||||
char editURL[sizeof(URL)];
|
char editURL[sizeof(URL)];
|
||||||
edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(URL)-2,#editURL,0,2,19,19};
|
edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(URL)-2,#editURL,0,NULL,19,19};
|
||||||
|
|
||||||
#define SKIN_Y 24
|
#define SKIN_Y 24
|
||||||
|
|
||||||
@ -263,7 +262,7 @@ void SetElementSizes()
|
|||||||
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;
|
||||||
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 + 1;
|
||||||
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);
|
||||||
@ -377,11 +376,6 @@ void ProcessEvent(dword id__)
|
|||||||
if (debug_mode) notify("'Debug mode ON'-I");
|
if (debug_mode) notify("'Debug mode ON'-I");
|
||||||
else notify("'Debug mode OFF'-I");
|
else notify("'Debug mode OFF'-I");
|
||||||
return;
|
return;
|
||||||
case SCAN_CODE_F11:
|
|
||||||
old_tag_parser_mode ^= 1;
|
|
||||||
if (old_tag_parser_mode) notify("'Old tag parser ON'-I");
|
|
||||||
else notify("'Old tag parser OFF'-I");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,6 +392,7 @@ void StopLoading()
|
|||||||
http.transfer=0;
|
http.transfer=0;
|
||||||
bufsize = 0;
|
bufsize = 0;
|
||||||
bufpointer = free(bufpointer);
|
bufpointer = free(bufpointer);
|
||||||
|
pause(10);
|
||||||
}
|
}
|
||||||
wv_progress_bar.value = 0;
|
wv_progress_bar.value = 0;
|
||||||
DrawOmnibox();
|
DrawOmnibox();
|
||||||
|
@ -24,7 +24,7 @@ char save_to[4096] = "/tmp0/1/Downloads";
|
|||||||
proc_info DL_Form;
|
proc_info DL_Form;
|
||||||
char downloader_edit[10000];
|
char downloader_edit[10000];
|
||||||
char filepath[4096];
|
char filepath[4096];
|
||||||
edit_box ed = {NULL,57,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(downloader_edit)-2,#downloader_edit,0,2,19,19};
|
edit_box ed = {NULL,57,20,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(downloader_edit)-2,#downloader_edit,0,ed_focus,19,19};
|
||||||
progress_bar pb = {0, CONX, 58, 350, 17, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
|
progress_bar pb = {0, CONX, 58, 350, 17, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
|
||||||
//progress_bar pb = {0, 180, 55, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
|
//progress_bar pb = {0, 180, 55, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F};
|
||||||
//progress_bar: value, left, top, width, height, style, min, max, back_color, progress_color, frame_color;
|
//progress_bar: value, left, top, width, height, style, min, max, back_color, progress_color, frame_color;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
enum { TAG, OPTION_VALUE, TEXT, COMMENT, INLINE_COMMENT, CODE };
|
enum { TAG, OPTION_VALUE, TEXT, COMMENT, SCRIPT};
|
||||||
|
|
||||||
//you are butifull, you are butifull
|
|
||||||
dword ShowSource()
|
dword ShowSource()
|
||||||
{
|
{
|
||||||
dword new_buf, new_buf_start, i;
|
dword new_buf, new_buf_start, i, j;
|
||||||
int mode;
|
int opened_font=0;
|
||||||
|
int mode = TEXT;
|
||||||
|
|
||||||
if (souce_mode) return;
|
if (souce_mode) return;
|
||||||
souce_mode = true;
|
souce_mode = true;
|
||||||
@ -18,70 +18,81 @@ dword ShowSource()
|
|||||||
switch (ESBYTE[i])
|
switch (ESBYTE[i])
|
||||||
{
|
{
|
||||||
case '<':
|
case '<':
|
||||||
if (mode == COMMENT)
|
if (mode == TEXT) && (!strncmp(i+1,"script", 6)) {
|
||||||
{
|
mode = SCRIPT;
|
||||||
|
strcpy(new_buf, "<font color=#00f><script</font><font color=#994500>"); opened_font++;
|
||||||
|
new_buf+=54;
|
||||||
|
i+=6;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (mode == COMMENT) || (mode == SCRIPT) && (!strncmp(i+1,"/script>", 8)) {
|
||||||
|
mode = TEXT;
|
||||||
|
while (opened_font) {
|
||||||
|
strcpy(new_buf, "</font>"); opened_font--;
|
||||||
|
new_buf+=7;
|
||||||
|
}
|
||||||
|
strcpy(new_buf, "<font color=#00f></script></font>");
|
||||||
|
new_buf+=39;
|
||||||
|
i+=8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ESBYTE[i+1]=='!') && (ESBYTE[i+2]=='-') && (ESBYTE[i+3]=='-') {
|
||||||
|
mode = COMMENT;
|
||||||
|
strcpy(new_buf, "<font color=#bbb><"); opened_font++;
|
||||||
|
new_buf+=21;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (mode == TEXT) {
|
||||||
|
mode = TAG;
|
||||||
|
strcpy(new_buf, "<font color=#00f><"); opened_font++;
|
||||||
|
new_buf+=21;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (mode == COMMENT) || (mode == SCRIPT) {
|
||||||
strcpy(new_buf, "<");
|
strcpy(new_buf, "<");
|
||||||
new_buf+=4;
|
new_buf+=4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ESBYTE[i+1]=='!') && (ESBYTE[i+2]=='-') && (ESBYTE[i+3]=='-')
|
|
||||||
{
|
|
||||||
strcpy(new_buf, "<font color=#bbb><");
|
|
||||||
new_buf+=21;
|
|
||||||
mode = COMMENT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (mode != COMMENT)
|
|
||||||
{
|
|
||||||
strcpy(new_buf, "<font color=#00f><");
|
|
||||||
new_buf+=21;
|
|
||||||
mode = TAG;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case '>':
|
case '>':
|
||||||
if (mode == OPTION_VALUE) //fix non-closed quote in TAG
|
if (mode == OPTION_VALUE) { //fix non-closed quote in TAG
|
||||||
{
|
|
||||||
strcpy(new_buf, ""</font>");
|
|
||||||
new_buf+=13;
|
|
||||||
mode = TAG;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (mode == COMMENT) && (ESBYTE[i-1]=='-') && (ESBYTE[i-2]=='-')
|
|
||||||
{
|
|
||||||
strcpy(new_buf, "></font>");
|
|
||||||
new_buf+=11;
|
|
||||||
mode = TEXT;
|
mode = TEXT;
|
||||||
|
while (opened_font) {
|
||||||
|
strcpy(new_buf, ""</font>"); opened_font--;
|
||||||
|
new_buf+=13;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (mode == COMMENT)
|
if (mode == COMMENT) && (ESBYTE[i-1]=='-') && (ESBYTE[i-2]=='-') {
|
||||||
{
|
mode = TEXT;
|
||||||
|
strcpy(new_buf, "></font>"); opened_font--;
|
||||||
|
new_buf+=11;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (mode == COMMENT) || (mode == SCRIPT) {
|
||||||
strcpy(new_buf, ">");
|
strcpy(new_buf, ">");
|
||||||
new_buf+=4;
|
new_buf+=4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (mode == TAG)
|
if (mode == TAG) {
|
||||||
{
|
|
||||||
strcpy(new_buf, "></font>");
|
|
||||||
new_buf+=11;
|
|
||||||
mode = TEXT;
|
mode = TEXT;
|
||||||
|
strcpy(new_buf, "></font>"); opened_font--;
|
||||||
|
new_buf+=11;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '\"':
|
case '\"':
|
||||||
case '\'':
|
case '\'':
|
||||||
if (mode == TAG)
|
if (mode == TAG) {
|
||||||
{
|
|
||||||
strcpy(new_buf, "<font color=#f0f>'");
|
|
||||||
new_buf+=22;
|
|
||||||
mode = OPTION_VALUE;
|
mode = OPTION_VALUE;
|
||||||
|
strcpy(new_buf, "<font color=#F301F2>'"); opened_font++;
|
||||||
|
new_buf+=25;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (mode == OPTION_VALUE)
|
if (mode == OPTION_VALUE) {
|
||||||
{
|
|
||||||
strcpy(new_buf, "'</font>");
|
|
||||||
new_buf+=12;
|
|
||||||
mode = TAG;
|
mode = TAG;
|
||||||
|
strcpy(new_buf, "'</font>"); opened_font--;
|
||||||
|
new_buf+=12;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -96,6 +107,9 @@ dword ShowSource()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
enum { TAG, OPTION_VALUE, TEXT, COMMENT, INLINE_COMMENT, CODE };
|
||||||
|
|
||||||
char* C_HL_keywords[] = {
|
char* C_HL_keywords[] = {
|
||||||
"switch", "if", "while", "for", "break", "continue", "return", "else",
|
"switch", "if", "while", "for", "break", "continue", "return", "else",
|
||||||
"union", "typedef", "static", "class", "case", "#include",
|
"union", "typedef", "static", "class", "case", "#include",
|
||||||
|
@ -41,7 +41,6 @@ dword panel_color = 0xE3E2E2;
|
|||||||
dword border_color = 0x8C8C8C;
|
dword border_color = 0x8C8C8C;
|
||||||
|
|
||||||
bool debug_mode = false;
|
bool debug_mode = false;
|
||||||
bool old_tag_parser_mode = false;
|
|
||||||
|
|
||||||
bool open_in_a_new_window = false;
|
bool open_in_a_new_window = false;
|
||||||
|
|
||||||
|
@ -29,10 +29,12 @@ void test2()
|
|||||||
ci.add(1);
|
ci.add(1);
|
||||||
ci.add(2);
|
ci.add(2);
|
||||||
ci.add(3);
|
ci.add(3);
|
||||||
for (i=0; i<ci.count; i++) debugi(ci.get(i)); //-> 0 1 2 3
|
debugln("-> 0 1 2 3");
|
||||||
|
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i))); //-> 0 1 2 3
|
||||||
ci.count--;
|
ci.count--;
|
||||||
ci.count--;
|
ci.count--;
|
||||||
ci.add(4);
|
ci.add(4);
|
||||||
for (i=0; i<ci.count; i++) debugi(ci.get(i)); //-> 0 1 4
|
debugln("-> 0 1 4");
|
||||||
|
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i))); //-> 0 1 4
|
||||||
ci.drop();
|
ci.drop();
|
||||||
}
|
}
|
@ -42,18 +42,13 @@ inline fastcall void debugln( EDX)
|
|||||||
debugch(10);
|
debugch(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void debugi(dword d_int)
|
:void debugval(dword text,number)
|
||||||
{
|
{
|
||||||
char tmpch[12];
|
char tmpch[12];
|
||||||
itoa_(#tmpch, d_int);
|
debug(text);
|
||||||
|
debug(": ");
|
||||||
|
itoa_(#tmpch, number);
|
||||||
debugln(#tmpch);
|
debugln(#tmpch);
|
||||||
}
|
}
|
||||||
|
|
||||||
:void debugval(dword text,number)
|
|
||||||
{
|
|
||||||
debug(text);
|
|
||||||
debug(": ");
|
|
||||||
debugi(number);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -37,10 +37,9 @@ dword ChangeCharset(dword from_chs, to_chs, conv_buf)
|
|||||||
cd = EAX;
|
cd = EAX;
|
||||||
if (cd!=0)
|
if (cd!=0)
|
||||||
{
|
{
|
||||||
debugln("iconv: something is wrong with stdcall iconv()");
|
debugval("iconv: something is wrong with stdcall iconv()", cd);
|
||||||
debugi(cd);
|
debugval("in_len", in_len);
|
||||||
debug("in_len:"); debugi(in_len);
|
debugval("out_len", out_len);
|
||||||
debug("out_len:"); debugi(out_len);
|
|
||||||
new_buf = free(new_buf);
|
new_buf = free(new_buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ byte letter_icons[sizeof(file "img/letter_icons.raw")] = FROM "img/letter_icons.
|
|||||||
#include "img/letter_icons.h"
|
#include "img/letter_icons.h"
|
||||||
|
|
||||||
_http http = {0};
|
_http http = {0};
|
||||||
bool old_tag_parser_mode = false;
|
|
||||||
bool debug_mode = false;
|
bool debug_mode = false;
|
||||||
char accept_language[]= "Accept-Language: ru\n";
|
char accept_language[]= "Accept-Language: ru\n";
|
||||||
|
|
||||||
|
@ -107,15 +107,15 @@ void MailBoxNetworkProcess() {
|
|||||||
aim=NULL;
|
aim=NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
debug("mailsize: "); debugi(mailsize);
|
debugval("mailsize", mailsize);
|
||||||
aim = GET_ANSWER_RETR;
|
aim = GET_ANSWER_RETR;
|
||||||
debugln("goto GET_ANSWER_RETR");
|
debugln("goto GET_ANSWER_RETR");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GET_ANSWER_RETR:
|
case GET_ANSWER_RETR:
|
||||||
debug("mailsize: "); debugi(mailsize);
|
debugval("mailsize", mailsize);
|
||||||
debug("mailstart: "); debugi(mailstart);
|
debugval("mailstart", mailstart);
|
||||||
debug("mailend: "); debugi(mailend);
|
debugval("mailend", mailend);
|
||||||
ticks = Receive(socketnum, mailend, mailsize + mailstart - mailend, MSG_DONTWAIT);
|
ticks = Receive(socketnum, mailend, mailsize + mailstart - mailend, MSG_DONTWAIT);
|
||||||
if (ticks == 0xffffffff) break;
|
if (ticks == 0xffffffff) break;
|
||||||
mailend = mailend + ticks;
|
mailend = mailend + ticks;
|
||||||
|
@ -123,20 +123,16 @@ void ProcessBase64()
|
|||||||
int clean_mailstart;
|
int clean_mailstart;
|
||||||
|
|
||||||
b_start = strstr(mailstart, "?B?");
|
b_start = strstr(mailstart, "?B?");
|
||||||
debug("b_size");
|
debugval("b_size", b_start);
|
||||||
debugi(b_start);
|
|
||||||
if (b_start)
|
if (b_start)
|
||||||
{
|
{
|
||||||
b_end = strstr(b_start, "?=");
|
b_end = strstr(b_start, "?=");
|
||||||
debug("b_end");
|
debugval("b_end", b_end);
|
||||||
debugi(b_end);
|
|
||||||
b_size = b_end - b_start;
|
b_size = b_end - b_start;
|
||||||
debug("b_size");
|
debugval("b_size", b_size);
|
||||||
debugi(b_size);
|
|
||||||
b_buf = malloc(b_size);
|
b_buf = malloc(b_size);
|
||||||
strcpyb(mailstart, b_buf, "?B?", "?=");
|
strcpyb(mailstart, b_buf, "?B?", "?=");
|
||||||
debug("b_buf");
|
debugval("b_buf", b_buf);
|
||||||
debug(b_buf);
|
|
||||||
|
|
||||||
base64_decode stdcall (b_buf, b_buf, b_size-3);
|
base64_decode stdcall (b_buf, b_buf, b_size-3);
|
||||||
ConvertToDOS(b_buf, mailstart);
|
ConvertToDOS(b_buf, mailstart);
|
||||||
|
Loading…
Reference in New Issue
Block a user