Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5767 → Rev 5768

/programs/cmm/TWB/TWB.c
6,7 → 6,7
 
struct _style {
byte
b, i, u, s,
b, i, u, s, h,
pre,
blq,
li,
17,7 → 17,6
struct TWebBrowser {
llist list;
_style style;
dword draw_line_width;
DrawBufer DrawBuf;
void Prepare();
void SetStyle();
59,9 → 58,10
char line[500];
char tagparam[10000];
char tag[100];
char oldtag[100];
char attr[1200];
char val[4096];
char anchor[256];
char anchor[256]=0;
 
#include "..\TWB\history.h"
#include "..\TWB\links.h"
91,9 → 91,10
{
start_x = stolbec * list.font_w + body_magrin * DrawBuf.zoom + list.x;
start_y = stroka * list.line_h + body_magrin;
stolbec_len = utf8_strlen(#line);
line_length = stolbec_len * list.font_w * DrawBuf.zoom;
stolbec_len = utf8_strlen(#line) * DrawBuf.zoom;
line_length = stolbec_len * list.font_w;
 
if (style.h) stroka++;
WriteBufText(start_x, start_y, list.font_type, text_colors[text_color_index], #line, buf_data);
if (style.b) WriteBufText(start_x+1, start_y, list.font_type, text_colors[text_color_index], #line, buf_data);
if (style.i) { stolbec++; DrawBuf.Skew(start_x, start_y, line_length, list.line_h); } // bug with zoom>1
122,7 → 123,7
dword bufpos = bufpointer;
int line_len;
style.b = style.i = style.u = style.s = style.blq = t_html = t_body =
style.b = style.i = 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;
link_color_inactive = 0x0000FF;
135,22 → 136,16
stolbec = 0;
line = 0;
 
draw_line_width = list.w * DrawBuf.zoom;
 
//for plaint text use CP866 for other UTF
if (strstri(bufpointer, "html"))
{
style.pre = 0;
cur_encoding = CH_CP866;
//WB1.list.SetFont(8, 14, 10111000b);
//list.line_h = list.font_h + 4;
}
else
{
style.pre = 1;
cur_encoding = CH_UTF8;
//WB1.list.SetFont(8, 14, 10001000b);
//list.line_h = list.font_h + 4;
}
for ( ; (bufpointer+bufsize > bufpos) && (ESBYTE[bufpos]!=0); bufpos++;)
189,24 → 184,12
break;
case '<':
bufpos++;
tag = attr = tagparam = ignor_param = NULL;
if (ESBYTE[bufpos] == '!') //ôèëüòðàöèÿ âíóòðè <!-- -->, äåðçêî
if (!strncmp(bufpos,"!--",3))
{
if (!strncmp(bufpos,"-->",3)) || (bufpointer + bufsize <= bufpos) break;
bufpos++;
if (ESBYTE[bufpos] == '-')
{
HH_:
do
{
bufpos++;
if (bufpointer + bufsize <= bufpos) break 2;
}
while (ESBYTE[bufpos] <>'-');
bufpos++;
if (ESBYTE[bufpos] <>'-') goto HH_;
}
}
tag = attr = tagparam = ignor_param = NULL;
while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
{
bukva = ESBYTE[bufpos];
227,10 → 210,11
if (tag[strlen(#tag)-1]=='/') tag[strlen(#tag)-1]=NULL; //for br/
if (tagparam) GetNextParam();
 
if (stolbec + utf8_strlen(#line) > list.column_max) Perenos();
Perenos();
DrawStyle();
line = NULL;
if (tag) SetStyle(WB1.DrawBuf.zoom * 5 + list.x, stroka * list.line_h + list.y + 5); //îáðàáîòêà òåãîâ
strcpy(#oldtag, #tag);
tag = attr = tagparam = ignor_param = NULL;
break;
default:
243,7 → 227,7
if (!stolbec) && (!line) break; //no paces at the beginning of the line
}
if (line_len < sizeof(line)) chrcat(#line, bukva);
if (stolbec + line_len > list.column_max) Perenos();
Perenos();
}
}
DrawStyle();
262,6 → 246,7
{
int perenos_num;
char new_line_text[4096];
if (stolbec + utf8_strlen(#line) < list.column_max) return;
perenos_num = strrchr(#line, ' ');
if (!perenos_num) && (utf8_strlen(#line)>list.column_max) perenos_num=list.column_max;
strcpy(#new_line_text, #line + perenos_num);
271,7 → 256,6
NewLine();
}
//============================================================================================
char oldtag[100];
void TWebBrowser::SetStyle(int left1, top1) {
dword hr_color;
byte opened;
388,47 → 372,25
if (istag("blockquote")) { style.blq = opened; return; }
if (istag("pre")) || (istag("code")) { style.pre = opened; return; }
if (istag("img")) { ImgCache.Images( left1, top1, WB1.list.w); return; }
/*
if (istag("center"))
{
if (opened) style.align = ALIGN_CENTER;
if (!opened)
{
NewLine();
style.align = ALIGN_LEFT;
}
return;
}
if (istag("right"))
{
if (opened) style.align = ALIGN_RIGHT;
if (!opened)
{
NewLine();
style.align = ALIGN_LEFT;
}
return;
}
*/
if (istag("h1")) || (istag("h2")) || (istag("h3")) || (istag("h4")) || (istag("caption")) {
style.h = opened;
NewLine();
if (opened) && (stroka>1) NewLine();
strcpy(#oldtag, #tag);
if (opened)
{
WB1.DrawBuf.zoom=2;
WB1.list.SetFont(8, 14, 10111001b);
if (isattr("align=")) && (isval("center")) style.align = ALIGN_CENTER;
if (isattr("align=")) && (isval("right")) style.align = ALIGN_RIGHT;
style.b = 1;
if (stroka>1) NewLine();
}
if (!opened)
else
{
WB1.DrawBuf.zoom=1;
WB1.list.SetFont(8, 14, 10111000b);
style.align = ALIGN_LEFT;
style.b = 0;
}
return;
}
else
oldtag=NULL;
if (istag("dt")) {
style.li = opened;
if (opened) NewLine();
/programs/cmm/browser/menu_rmb.h
File deleted
\ No newline at end of file
/programs/cmm/browser/WebView.c
30,7 → 30,7
char homepage[] = FROM "html\\homepage.htm";
 
#ifdef LANG_RUS
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.3 UNSTABLE";
char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.31 UNSTABLE";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
37,7 → 37,7
char page_not_found[] = FROM "html\page_not_found_ru.htm";
char accept_language[]= "Accept-Language: ru\n";
#else
char version[]=" Text-based Browser 1.3 UNSTABLE";
char version[]=" Text-based Browser 1.31 UNSTABLE";
?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>";
78,13 → 78,11
FORWARD_BUTTON,
REFRESH_BUTTON,
GOTOURL_BUTTON,
SEARCHWEB_BUTTON,
SANDWICH_BUTTON
};
 
enum {
ZOOM2x=1100,
VIEW_SOURCE,
VIEW_SOURCE=1100,
EDIT_SOURCE,
VIEW_HISTORY,
FREE_IMG_CACHE,
92,7 → 90,7
};
 
#include "..\TWB\TWB.c"
#include "menu_rmb.h"
#include "menu.h"
#include "history.h"
#include "show_src.h"
#include "network_get.h"
424,20 → 422,6
CreateThread(#menu_rmb,#stak+4092);
return;
 
case ZOOM2x:
if (WB1.DrawBuf.zoom==2)
{
WB1.DrawBuf.zoom=1;
WB1.list.SetFont(8, 14, 10111000b);
}
else
{
WB1.DrawBuf.zoom=2;
WB1.list.SetFont(8, 14, 10111001b);
}
Draw_Window();
return;
 
case VIEW_SOURCE:
WB1.list.first = 0;
ShowSource();
605,7 → 589,6
bufpointer = malloc(bufsize);
SetPageDefaults();
ReadFile(0, bufsize, bufpointer, #URL);
//ShowSource();
}
ShowPage();
}
633,7 → 616,9
WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
}
else
{
WB1.Prepare();
}
 
if (!header) strcpy(#header, #version);
if (!strcmp(#version, #header)) DrawTitle(#header);
/programs/cmm/browser/menu.h
0,0 → 1,79
//Leency - 2012-2013
 
char *ITEMS_LIST[]={
#ifdef LANG_RUS
"®á¬®âà¥âì ¨á室­¨ª",
"¥¤ ªâ¨à®¢ âì ¨á室­¨ª",
"ˆáâ®à¨ï",
"Žç¨áâ¨âì ªíè ª à⨭®ª",
"Œ¥­¥¤¦¥à § £à㧮ª",
#else
"View source",
"Edit source",
"History",
"Free image cache",
"Download Manager",
#endif
0};
 
llist menu;
 
void menu_rmb()
{
proc_info MenuForm;
int key;
 
menu.ClearList();
while (ITEMS_LIST[menu.count]) menu.count++;
menu.SetSizes(2,2,177,menu.count*19,19);
SetEventMask(100111b);
 
_BEGIN_APPLICATION_MENU:
switch(WaitEvent())
{
case evMouse:
GetProcessInfo(#MenuForm, SelfInfo);
if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
 
mouse.get();
if (menu.ProcessMouse(mouse.x, mouse.y)) DrawMenuList();
if (mouse.lkm)&&(mouse.up) ItemClick();
break;
case evKey:
key = GetKey();
if (key==27) ExitProcess();
if (key==13) ItemClick();
if (menu.ProcessKey(key)) DrawMenuList();
break;
case evReDraw:
DefineAndDrawWindow(Form.left+mouse.x-6,Form.top+mouse.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
DrawPopup(0,0,menu.w,menu.h+3,0, col_bg,border_color);
DrawMenuList();
}
goto _BEGIN_APPLICATION_MENU;
}
 
void DrawMenuList()
{
int N;
 
for (N=0; N<menu.count; N++;)
{
if (N==menu.current)
DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, 0x94AECE);
else
{
DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, col_bg);
WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N]);
}
WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N]);
}
}
 
void ItemClick()
{
action_buf = VIEW_SOURCE + menu.current;
ExitProcess();
}