/programs/cmm/TWB/TWB.c |
---|
17,7 → 17,7 |
DrawBufer DrawBuf; |
void GetNewUrl(); |
void ReadHtml(); |
void ParseHTML(); |
void Parse(); |
void WhatTextStyle(); |
void DrawPage(); |
void DrawScroller(); |
90,7 → 90,7 |
IF (link) { |
UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
PageLinks.AddText(#line, line_length, list.line_h); |
PageLinks.AddText(#line, line_length, list.line_h, UNDERLINE); |
} |
stolbec += strlen(#line); |
} |
166,12 → 166,13 |
} |
void TWebBrowser::ParseHTML(dword bufpos){ |
void TWebBrowser::Parse(dword bufpos, in_filesize){ |
word bukva[2]; |
int j, perenos_num; |
byte ignor_param; |
char temp[768]; |
dword bufstart = bufpos; |
bufsize = in_filesize; |
bufpointer = bufpos; |
b_text = i_text = u_text = s_text = blq_text = |
li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab = |
195,7 → 196,7 |
if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1; |
} |
for ( ; bufstart+bufsize > bufpos; bufpos++;) |
for ( ; bufpointer+bufsize > bufpos; bufpos++;) |
{ |
bukva = ESBYTE[bufpos]; |
if (ignor_text) && (bukva!='<') continue; |
253,7 → 254,7 |
do |
{ |
bufpos++; |
if (bufstart + bufsize <= bufpos) break 2; |
if (bufpointer + bufsize <= bufpos) break 2; |
} |
while (ESBYTE[bufpos] <>'-'); |
261,7 → 262,7 |
if (ESBYTE[bufpos] <>'-') goto HH_; |
} |
} |
while (ESBYTE[bufpos] !='>') && (bufpos < bufstart + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû |
while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû |
{ |
bukva = ESBYTE[bufpos]; |
if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; |
299,8 → 300,8 |
} |
DrawPage(); |
line=NULL; |
if (tag) WhatTextStyle(list.x + 5, stroka * 10 + list.y + 5, list.w - 20); //îáðàáîòêà òåãîâ |
line=NULL; |
tag = parametr = tagparam = ignor_param = NULL; |
break; |
341,7 → 342,7 |
{ |
anchor=NULL; |
list.first=anchor_line_num; |
ParseHTML(bufstart); |
Parse(bufpointer, bufsize); |
} |
DrawScroller(); |
} |
/programs/cmm/TWB/img_cache.h |
---|
25,7 → 25,7 |
int ImageCache::GetImageNumber(dword i_path) |
{ |
int i; |
for (i=0; i<pics_count; i++) if (!strcmp(#pics[i].path, i_path)) return i; //image exists |
for (i=0; i<=pics_count; i++) if (!strcmp(#pics[i].path, i_path)) return i; //image exists |
// Load image and add it to Cache |
pics_count++; |
pics[pics_count].image = load_image(i_path); |
95,7 → 95,12 |
img_draw stdcall (pics[cur_pic].image, left1-5, top1, w, h,0,img_lines_first); |
DrawBar(left1+w - 5, top1, WB1.list.w-w, h, bg_color); |
IF (link) UnsafeDefineButton(left1 - 5, top1, w, h-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
IF (link) |
{ |
UnsafeDefineButton(left1 - 5, top1, w, h-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
PageLinks.AddText(0, w, h-1, NOLINE); |
// WB1.DrawPage(); |
} |
} |
ImageCache ImgCache; |
/programs/cmm/TWB/links.h |
---|
1,9 → 1,14 |
CustomCursor CursorPointer; |
dword CursorFile = FROM "../TWB/pointer.cur"; |
#define NOLINE 0 |
#define UNDERLINE 1 |
struct array_link { |
dword link, text; |
int x,y,w,h; |
int underline; |
}; |
struct LinksArray |
31,11 → 36,12 |
count++; |
} |
void LinksArray::AddText(dword new_text, int link_w, link_h) |
void LinksArray::AddText(dword new_text, int link_w, link_h, link_underline) |
{ |
if (count<1) return; |
links[count-1].w = link_w; |
links[count-1].h = link_h; |
links[count-1].underline = link_underline; |
links[count-1].text = buflen; |
strcpy(buflen, new_text); |
67,8 → 73,8 |
{ |
if (active==i) return; |
CursorPointer.Set(); |
DrawBar(links[active].x,links[active].y+8,links[active].w,1, link_col_in); |
DrawBar(links[i].x,links[i].y+8,links[i].w,1, bg_col); |
if (links[active].underline) DrawBar(links[active].x,links[active].y+8,links[active].w,1, link_col_in); |
if (links[i].underline) DrawBar(links[i].x,links[i].y+8,links[i].w,1, bg_col); |
active = i; |
return; |
} |
76,7 → 82,7 |
if (active!=-1) |
{ |
CursorPointer.Restore(); |
DrawBar(links[active].x,links[active].y+8,links[active].w,1, link_col_in); |
if (links[active].underline) DrawBar(links[active].x,links[active].y+8,links[active].w,1, link_col_in); |
active = -1; |
} |
} |