Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4474 → Rev 4475

/programs/cmm/TWB/draw_buf.h
File deleted
\ No newline at end of file
/programs/cmm/TWB/TWB.c
1,3 → 1,4
#include "..\lib\draw_buf.h"
 
int downloader_id;
 
19,16 → 20,17
 
char download_path[]="/rd/1/.download";
 
 
struct TWebBrowser {
llist list; //need #include "..\lib\list_box.h"
DrawBufer DrawBuf;
void GetNewUrl();
void ReadHtml(byte);
void ReadHtml();
void ShowPage();
void ParseHTML(dword);
void WhatTextStyle(int left1, top1, width1);
void ParseHTML();
void WhatTextStyle();
void DrawPage();
void DrawScroller();
void TextGoDown();
};
TWebBrowser WB1;
 
36,6 → 38,7
link, ignor_text, cur_encoding, text_align;
byte condition_text_active, condition_text_val, condition_href, condition_max;
 
 
enum { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT};
 
dword text_colors[300];
61,8 → 64,9
#include "..\TWB\img_cache.h"
#include "..\TWB\some_code.h"
#include "..\TWB\parce_tag.h"
#include "..\TWB\draw_buf.h"
 
 
 
//=======================================================================
 
 
85,14 → 89,14
start_y = stroka * 10 + list.y + magrin_left;
line_length = strlen(#line) * 6;
 
WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, drawbuf);
IF (b_text) WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, drawbuf);
IF (i_text) DrawBufSkew(start_x, 0, line_length, list.line_h);
IF (s_text) DrawBufBar(start_x, 4, line_length, 1, text_colors[text_color_index]);
IF (u_text) DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
WriteBufText(start_x, 0, 0x88, text_colors[text_color_index], #line, buf_data);
IF (b_text) WriteBufText(start_x+1, 0, 0x88, text_colors[text_color_index], #line, buf_data);
IF (i_text) { stolbec++; DrawBuf.Skew(start_x, 0, line_length, list.line_h); }
IF (s_text) DrawBuf.DrawBar(start_x, 4, line_length, 1, text_colors[text_color_index]);
IF (u_text) DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
IF (link) {
UnsafeDefineButton(start_x-2, start_y, line_length + 3, 9, blink + BT_HIDE, 0xB5BFC9);
DrawBufBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]);
}
stolbec += strlen(#line);
}
204,11 → 208,11
b_text = i_text = u_text = s_text = blq_text =
li_text = link = ignor_text = text_color_index = text_colors[0] = li_tab =
condition_text_val = condition_text_active = 0; //îáíóëÿåì òåãè
condition_max = 10;
condition_max = 255;
text_align = ALIGN_LEFT;
link_color = 0x0000FF;
bg_color = 0xFFFFFF;
DrawBufFill();
DrawBuf.Fill(bg_color);
strcpy(#page_links,"|");
strcpy(#header, #version);
stroka = -list.first;
416,13 → 420,13
if (!chTag("body"))
{
do{
if (!strcmp(#parametr, "condition_max=")) { condition_max = options[0]-'0'; debugi(condition_max); }
if (!strcmp(#parametr, "condition_max=")) { condition_max = atoi(#options); debugi(condition_max); }
if (!strcmp(#parametr, "link=")) link_color = GetColor(#options);
if (!strcmp(#parametr, "text=")) text_colors[0]=GetColor(#options);
if (!strcmp(#parametr, "bgcolor="))
{
bg_color=GetColor(#options);
DrawBufFill();
DrawBuf.Fill(bg_color);
}
} while(GetNextParam());
return;
496,6 → 500,7
IF(rez) TextGoDown(left1, top1 + 10, width1);
return;
}
/*
if (!chTag("center"))
{
if (rez) text_align = ALIGN_CENTER;
516,6 → 521,7
}
return;
}
*/
if (!chTag("h1")) || (!chTag("h2")) || (!chTag("h3")) || (!chTag("h4")) {
TextGoDown(left1, top1, width1);
if (rez) && (stroka>1) TextGoDown(left1, top1 + 10, width1);
563,7 → 569,7
if (rez)
{
TextGoDown(left1, top1, width1);
if (stroka > -1) && (stroka - 2 < list.visible) DrawBufBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555);
if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-3, 2, 2, 0x555555);
}
return;
}
587,7 → 593,7
}
if (strcmp(#parametr, "color=") == 0) hr_color = GetColor(#options); else hr_color = 0x999999;
TextGoDown(left1, top1, width1);
DrawBufBar(5, WB1.list.line_h/2, WB1.list.w-10, 1, hr_color);
DrawBuf.DrawBar(5, WB1.list.line_h/2, WB1.list.w-10, 1, hr_color);
TextGoDown(left1, top1+WB1.list.line_h, width1);
}
if (!chTag("img"))
611,7 → 617,6
}
 
 
 
void TWebBrowser::DrawScroller() //íå îïòèìàëüíàÿ îòðèñîâêà, íî çàòî â îäíîì ìåñòå
{
scroll_wv.max_area = list.count;
625,3 → 630,18
scrollbar_v_draw(#scroll_wv);
}
 
 
void TWebBrowser::TextGoDown(int left1, top1, width1)
{
if (!stroka) DrawBar(WB1.list.x, WB1.list.y, WB1.list.w, 5, bg_color); //çàêðàøèâàåì ôîí íàä ïåðâîé ñòðîêîé
if (top1>=WB1.list.y) && ( top1 < WB1.list.h+WB1.list.y-10) && (!anchor)
{
if (text_align == ALIGN_CENTER) DrawBuf.AlignCenter(left1,top1,WB1.list.w,WB1.list.line_h,stolbec * 6);
if (text_align == ALIGN_RIGHT) DrawBuf.AlignRight(left1,top1,WB1.list.w,WB1.list.line_h,stolbec * 6);
PutPaletteImage(buf_data+8, WB1.list.w, WB1.list.line_h, left1-5, top1, 32,0);
DrawBuf.Fill(bg_color);
}
stroka++;
if (blq_text) stolbec = 8; else stolbec = 0;
if (li_text) stolbec = li_tab * 5;
}
/programs/cmm/browser/HTMLv.c
26,11 → 26,11
#include "img\URLgoto.txt";
 
#ifdef LANG_RUS
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 0.99.5";
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 0.99.6";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "â® ¯®á«¥¤­¨© á« ©¤"
#else
char version[]=" Text-based Browser 0.99.5";
char version[]=" Text-based Browser 0.99.6";
?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last"
#endif
178,7 → 178,7
WB1.list.SetSizes(0, 44, Form.width - 10 - scroll_wv.size_x, Form.cheight - 44, 0, 10);
WB1.list.column_max = WB1.list.w - 30 / 6;
WB1.list.visible = WB1.list.h - 3 / WB1.list.line_h - 2;
DrawBufInit();
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h, WB1.list.line_h);
}
 
 
/programs/cmm/lib/draw_buf.h
0,0 → 1,81
dword buf_data;
 
struct DrawBufer {
int bufx, bufy, bufw, bufh, buf_line_h;
 
void Init();
void Fill();
void Skew();
void DrawBar();
void AlignCenter();
void AlignRight();
};
 
void DrawBufer::Init(int i_bufx, i_bufy, i_bufw, i_bufh, i_buf_line_h)
{
bufx = i_bufx;
bufy = i_bufy;
bufw = i_bufw;
bufh = i_bufh;
buf_line_h = i_buf_line_h;
free(buf_data);
buf_data = malloc(bufw * buf_line_h +4 * 4 + 8); //+1 for good luck
ESDWORD[buf_data] = bufw;
ESDWORD[buf_data+4] = buf_line_h;
}
 
void DrawBufer::Fill(dword fill_color)
{
int i;
int max_i = bufw * buf_line_h + 4 * 4 + buf_data;
for (i=buf_data; i<max_i; i+=4) ESDWORD[i+8] = fill_color;
}
 
void DrawBufer::DrawBar(dword x, y, w, h, color)
{
int i, j;
for (j=0; j<h; j++)
{
for (i = y+j*bufw+x*4; i<y+j*bufw+x+w*4 ; i+=4) ESDWORD[buf_data+i+8] = color;
}
}
 
char shift[]={8,8,4,4};
void DrawBufer::Skew(dword x, y, w, h)
{
int i, j;
for (j=0; j<=3; j++)
{
for (i = y+j*bufw+x+w+h*4; i>y+j*bufw+x+h-12*4 ; i-=4)
ESDWORD[buf_data+i+8] = ESDWORD[-shift[j]+buf_data+i+8];
}
}
 
void DrawBufer::AlignRight(dword x,y,w,h, content_width)
{
int i, j, l;
int content_left = w - content_width / 2;
for (j=0; j<h; j++)
{
for (i=j*w+w-x*4, l=j*w+content_width+x*4; (i>=j*w+content_left*4) && (l>=j*w*4); i-=4, l-=4)
{
ESDWORD[buf_data+8+i] >< ESDWORD[buf_data+8+l];
}
}
}
 
void DrawBufer::AlignCenter(dword x,y,w,h, content_width)
{
int i, j, l;
int content_left = w - content_width / 2;
for (j=0; j<h; j++)
{
for (i=j*w+content_width+content_left*4, l=j*w+content_width+x*4; (i>=j*w+content_left*4) && (l>=j*w*4); i-=4, l-=4)
{
ESDWORD[buf_data+8+i] >< ESDWORD[buf_data+8+l];
}
}
}