Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7750 → Rev 7749

/programs/cmm/TWB/TWB.c
29,8 → 29,9
void DrawStyle();
void DrawPage();
void DrawScroller();
void LoadInternalPage();
void NewLine();
bool CheckForLineBreak();
void Perenos();
void BufEncode();
} WB1;
 
96,11 → 97,11
line_length = stolbec_len * list.font_w;
 
if (debug_mode) {
DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h, 0xDDDddd);
DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h-1, 0xDDDddd);
}
 
if (style.bg_color!=page_bg) {
DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h, style.bg_color);
DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h-1, style.bg_color);
}
 
if (style.image) {
117,16 → 118,20
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 (line[0]==' ') && (line[1]==NULL) {} else {
DrawBuf.DrawBar(start_x, draw_y + list.item_h - calc(zoom*2), line_length, zoom, link_color_inactive);
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;
if (debug_mode) debug(#line);
line = NULL;
}
}
//============================================================================================
void TWebBrowser::LoadInternalPage(dword bufpos, in_filesize){
bufsize = in_filesize;
bufpointer = bufpos;
Prepare();
}
//============================================================================================
void TWebBrowser::SetPageDefaults()
{
style.b = style.u = style.s = style.h = style.blq = t_html = t_body = style.pre =
166,6 → 171,7
if (style.pre)
{
DrawStyle();
line = NULL;
NewLine();
break;
}
187,11 → 193,10
}
if (bukva = GetUnicodeSymbol(#tag)) {
bufpos += j;
CheckForLineBreak();
} else {
bukva = '&';
}
goto DEFAULT_MARK;
}
break;
case '<':
bufpos++;
218,7 → 223,6
{
ignor_param = true;
if (strlen(#tagparam)+1<sizeof(tagparam)) strcat(#tagparam, #bukva);
// chrncat(#tagparam, bukva, sizeof(tagparam)-1);
}
bufpos++;
}
246,11 → 250,12
else opened = 1;
 
if (tag) && (!istag("span")) && (!istag("i")) && (!istag("svg")) {
CheckForLineBreak();
Perenos();
DrawStyle();
line = NULL;
if (tag) SetStyle();
}
strlcpy(#oldtag, #tag, sizeof(oldtag)-1);
strlcpy(#oldtag, #tag, sizeof(oldtag));
tag = attr = tagparam = ignor_param = NULL;
break;
default:
263,7 → 268,7
if (!stolbec) && (!line) break; //no paces at the beginning of the line
}
if (line_len < sizeof(line)) chrcat(#line, bukva);
CheckForLineBreak();
Perenos();
}
}
DrawStyle();
272,27 → 277,21
DrawPage();
}
//============================================================================================
bool TWebBrowser::CheckForLineBreak()
void TWebBrowser::Perenos()
{
int line_break_pos;
int perenos_num;
char new_line_text[4096];
if (strlen(#line)*zoom + stolbec < list.column_max) return false;
line_break_pos = strrchr(#line, ' ');
if (line_break_pos*zoom + stolbec > list.column_max) {
line_break_pos = list.column_max/zoom - stolbec;
while(line_break_pos) && (line[line_break_pos]!=' ') line_break_pos--;
}
if (!line_break_pos) && (strlen(#line)*zoom>list.column_max) {
line_break_pos=list.column_max/zoom;
if (strlen(#line)*zoom + stolbec < list.column_max) return;
perenos_num = strrchr(#line, ' ');
if (!perenos_num) && (strlen(#line)*zoom>list.column_max) {
perenos_num=list.column_max/zoom;
if (!stolbec)&&(style.pre) draw_y-=list.item_h; //hack to fix https://prnt.sc/rk3kyt
}
strcpy(#new_line_text, #line + line_break_pos);
line[line_break_pos] = 0x00;
strcpy(#new_line_text, #line + perenos_num);
line[perenos_num] = 0x00;
DrawStyle();
strcpy(#line, #new_line_text);
NewLine();
//if (strlen(#line)*zoom + stolbec > list.column_max)CheckForLineBreak();
return true;
}
//============================================================================================
void TWebBrowser::SetStyle() {
310,11 → 309,7
IF(istag("q"))
{
if (opened) {
meta_encoding = strlen(#line);
if (line[meta_encoding-1] != ' ') chrcat(#line, ' ');
chrcat(#line, '\"');
}
if (opened) strcat(#line, " \"");
if (!opened) strcat(#line, "\" ");
return;
}
409,11 → 404,11
if (istag("pre")) || (istag("code")) { style.pre = opened; return; }
if (istag("img")) {
do{
if (isattr("src=")) strlcpy(#img_path, #val, sizeof(img_path)-1);
if (isattr("src=")) strncpy(#img_path, #val, sizeof(img_path)-1);
if (isattr("title=")) && (strlen(#val)<sizeof(line)-3) && (val) sprintf(#line, "[%s]", #val);
if (isattr("alt=")) && (strlen(#val)<sizeof(line)-3) && (val) sprintf(#line, "[%s]", #val);
} while(GetNextParam());
if (!img_path) { line=0; return; }
if (!img_path) return;
style.image = true;
text_color_index++;
text_colors[text_color_index] = 0x9A6F29;
423,8 → 418,9
sprintf(#line, "[%s]", #img_path+strrchr(#img_path, '/'));
line[50]= NULL;
}
while (CheckForLineBreak()) {};
if (strlen(#line) + stolbec > list.column_max) Perenos();
DrawStyle();
line=0;
text_color_index--;
style.image = false;
//ImgCache.Images( left1, draw_y, WB1.list.w);
563,7 → 559,6
draw_y += list.item_h;
if (style.blq) stolbec = 6; else stolbec = 0;
if (style.li) stolbec = style.li_tab * 5;
if (debug_mode) debugln(NULL);
}
//============================================================================================
bool istag(dword text) { if (!strcmp(#tag,text)) return true; else return false; }
/programs/cmm/TWB/unicode_tags.h
65,11 → 65,11
0};
 
 
unsigned char unicode_chars[] = "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯àáâãäåæçèéêëìíîïðñh£\243i\105\244\0";
byte unicode_chars[] = "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯àáâãäåæçèéêëìíîïðñh£\243i\105\244\0";
 
bool GetUnicodeSymbol(dword in_tag)
{
int j, specia1040;
int j;
for (j=0; unicode_tags[j]!=0; j+=2;)
{
80,19 → 80,10
}
}
 
specia1040 = atoi(in_tag + 1) - 1040;
if (tag[1] == '1') && (specia1040>=0)
&& (specia1040<=72) && (strlen(in_tag) == 5)
j = atoi(in_tag + 1) - 1040;
if (tag[1] == '1') && (j>=0) && (j<=72) && (strlen(in_tag) == 5)
{
if (strlen(#line)<sizeof(line)-2) {
/*
j = strlen(#line);
line[j] = unicode_chars[specia1040];
line[j+1] = EOS;
*/
chrcat(#line, unicode_chars[specia1040]);
}
chrcat(#line, unicode_chars[j]);
return true;
}
 
/programs/cmm/TWB/parce_tag.h
6,7 → 6,6
if (!tagparam) return false;
 
if (debug_mode) {
debug("tag: "); debugln(#tag);
debug("tagparam: "); debugln(#tagparam);
}
24,7 → 23,7
 
//find VAL start and copy
i = strrchr(#tagparam, quotes);
strlcpy(#val, #tagparam + i, sizeof(val)-1);
strlcpy(#val, #tagparam + i, sizeof(val));
tagparam[i] = '\0'; i--;
 
//find ATTR end
39,8 → 38,8
//find VAL start and copy
while (i > 0) && (tagparam[i] != '=') i--;
i++;
strlcpy(#val, #tagparam + i, sizeof(val)-1);
// tagparam[i] = '\0';
strlcpy(#val, #tagparam + i, sizeof(val));
tagparam[i] = '\0';
 
//find ATTR end
//already have
48,23 → 47,21
 
//find ATTR start and copy
while (i>0) && (!__isWhite(tagparam[i])) i--;
strlcpy(#attr, #tagparam + i + 1, sizeof(attr)-1);
strlcpy(#attr, #tagparam + i + 1, sizeof(attr));
tagparam[i] = '\0';
//fix case: src=./images/KolibriOS_logo2.jpg?sid=e8ece8b38b
i = strchr(#attr,'=');
if (!quotes) && (i) {
strlcpy(#val, i+1, sizeof(val)-1);
ESBYTE[i+1] = '\0';
}
 
strlwr(#attr);
 
if (debug_mode) {
debug("val: "); debugln(#val);
debug("attr: "); debugln(#attr);
debugln(" ");
if (quotes) {
debug("quote: "); debugch(quotes); debugln(" ");
}
else {
debugln("unquoted text");
}
sprintf(#param, "val: %s\nattr: %s\n\n", #val, #attr);
debug(#param);
}
 
return true;
}
/programs/cmm/TWB/absolute_url.h
14,8 → 14,9
 
IF (!strncmp(in_URL,"//", 2))
{
strcpy(#newurl, "http:");
strcat(#newurl, in_URL);
//strcpy(#newurl, "http:");
//strcat(#newurl, in_URL);
sprintf(#newurl, "http:%s", in_URL);
strcpy(orig_URL, #newurl);
return;
}
/programs/cmm/browser/WebView.c
28,8 → 28,11
#include "..\lib\patterns\http_downloader.h"
#include "..\lib\patterns\simple_open_dialog.h"
 
_http http = {0, 0, 0, 0, 0, 0, 0};
 
 
#ifdef LANG_RUS
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.94";
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.93";
#define T_LOADING "‡ £à㧪  áâà ­¨æë..."
#define T_RENDERING "¥­¤¥à¨­£..."
char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0";
45,7 → 48,7
"Š®¯¨à®¢ âì áá뫪ã
‘ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨";
#else
char version[]="Text-based Browser 1.94";
char version[]="Text-based Browser 1.93";
#define T_LOADING "Loading..."
#define T_RENDERING "Rendering..."
char page_not_found[] = FROM "html\\page_not_found_en.htm""\0";
62,35 → 65,32
Download link contents";
#endif
 
dword col_bg = 0xE3E2E2;
dword panel_color = 0xE3E2E2;
dword border_color = 0x8C8C8C;
 
bool debug_mode = false;
bool open_in_a_new_window = false;
#define URL_SERVICE_HISTORY "WebView://history"
#define URL_SERVICE_HOMEPAGE "WebView://home"
#define URL_SERVICE_HELP "WebView://help"
#define URL_SERVICE_SOURCE "WebView://source:"
 
_http http = {0, 0, 0, 0, 0, 0, 0};
proc_info Form;
 
#include "..\TWB\TWB.c"
#include "history.h"
#include "show_src.h"
#include "download_manager.h"
char stak[4096];
 
#define URL_SERVICE_HISTORY "WebView:history"
#define URL_SERVICE_HOMEPAGE "WebView:home"
#define URL_SERVICE_HELP "WebView:help"
int action_buf;
 
dword TOOLBAR_H = 40;
dword STATUSBAR_H = 15;
 
int action_buf;
dword col_bg = 0xE3E2E2;
dword panel_color = 0xE3E2E2;
dword border_color = 0x8C8C8C;
 
bool source_mode = false;
bool debug_mode = false;
 
progress_bar wv_progress_bar;
char stak[4096];
proc_info Form;
 
bool souce_mode = false;
bool open_in_a_new_window = false;
 
enum {
BACK_BUTTON=1000,
FORWARD_BUTTON,
97,14 → 97,19
REFRESH_BUTTON,
GOTOURL_BUTTON,
SANDWICH_BUTTON,
VIEW_SOURCE,
VIEW_SOURCE=1100,
EDIT_SOURCE,
VIEW_HISTORY,
DOWNLOAD_MANAGER,
COPY_LINK_URL,
COPY_LINK_URL=1200,
DOWNLOAD_LINK_CONTENTS,
};
 
#include "..\TWB\TWB.c"
#include "history.h"
#include "show_src.h"
#include "download_manager.h"
 
char default_dir[] = "/rd/1";
od_filter filter2 = { 16, "TXT\0HTM\0HTML\0\0" };
 
127,13 → 132,10
void HandleParam()
{
if (param) {
if (!strncmp(#param, "-d ", 3)) {
if (param[0]=='-') && (param[1]=='d') {
strcpy(#downloader_edit, #param+3);
CreateThread(#Downloader,#downloader_stak+4092);
ExitProcess();
} else if (!strncmp(#param, "-s ", 3)) {
source_mode = true;
strcpy(#URL, #param + 3);
} else {
strcpy(#URL, #param);
}
183,7 → 185,7
if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) {
if (key_scancode == SCAN_CODE_KEY_O) EventOpenDialog();
if (key_scancode == SCAN_CODE_KEY_H) ProcessEvent(VIEW_HISTORY);
if (key_scancode == SCAN_CODE_KEY_U) EventViewSource();
if (key_scancode == SCAN_CODE_KEY_U) ProcessEvent(VIEW_SOURCE);
if (key_scancode == SCAN_CODE_KEY_T)
|| (key_scancode == SCAN_CODE_KEY_N) RunProgram(#program_path, NULL);
if (key_scancode == SCAN_CODE_KEY_W) ExitProcess();
222,7 → 224,7
ProcessEvent(menu.cur_y);
menu.cur_y = 0;
}
DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0);
DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),GetScreenHeight()-600/2-random(80),800,600,0x73,0,0,0);
GetProcessInfo(#Form, SelfInfo);
system.color.get();
col_bg = system.color.work;
357,15 → 359,17
EventShowPageMenu(Form.cwidth - 215, TOOLBAR_H-6);
return;
case VIEW_SOURCE:
EventViewSource();
WB1.list.first = 0;
ShowSource();
WB1.LoadInternalPage(bufpointer, bufsize);
break;
case EDIT_SOURCE:
if (check_is_the_adress_local(#URL)) {
RunProgram("/rd/1/tinypad", #URL);
} else {
if (!strncmp(#URL,"http",4))
{
CreateFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
}
else RunProgram("/rd/1/tinypad", #URL);
return;
case VIEW_HISTORY:
strcpy(#URL, URL_SERVICE_HISTORY);
440,13 → 444,14
{
char getUrl[sizeof(URL)];
StopLoading();
souce_mode = false;
strcpy(#editURL, #URL);
history.add(#URL);
if (!strncmp(#URL,"WebView:",8))
{
SetPageDefaults();
if (!strcmp(#URL, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#homepage, sizeof(homepage)-1);
else if (!strcmp(#URL, URL_SERVICE_HELP)) LoadInternalPage(#help, sizeof(help)-1);
if (!strcmp(#URL, URL_SERVICE_HOMEPAGE)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
else if (!strcmp(#URL, URL_SERVICE_HELP)) WB1.LoadInternalPage(#help, sizeof(help));
else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
else {bufsize=0; ShowPage();} //page not found
DrawOmnibox();
495,7 → 500,7
int anchor_pos;
anchor_pos = strrchr(#URL, '#')-1;
strlcpy(#anchor, #URL+anchor_pos, sizeof(anchor)-1);
strlcpy(#anchor, #URL+anchor_pos, sizeof(anchor));
URL[anchor_pos] = 0x00;
 
//#1
621,7 → 626,8
int skin_x_offset;
DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 2, address_box.color);
DrawBar(address_box.left-2, address_box.top, 2, 22, address_box.color);
if (address_box.flags & ed_focus) address_box.flags = ed_focus; else address_box.flags = 0;
//address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
//address_box.offset = 0;
EditBox_UpdateText(#address_box, address_box.flags);
edit_box_draw stdcall(#address_box);
if (http.transfer > 0) skin_x_offset = 68; else skin_x_offset = 51;
628,23 → 634,17
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y);
}
 
void LoadInternalPage(dword bufpos, in_filesize){
bufsize = in_filesize;
bufpointer = bufpos;
ShowPage();
}
 
void ShowPage()
{
DrawOmnibox();
if (!bufsize) || (!bufpointer) {
LoadInternalPage(#page_not_found, sizeof(page_not_found)-1);
if (!bufsize)
{
WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
}
else
{
WB1.Prepare();
if (source_mode) {
source_mode = false;
ShowSource();
LoadInternalPage(bufpointer, bufsize);
}
}
 
698,14 → 698,6
}
}
 
void EventViewSource()
{
char source_view_param[sizeof(URL)+4];
strcpy(#source_view_param, "-s ");
strcat(#source_view_param, #URL);
RunProgram(#program_path, #source_view_param);
}
 
void DrawStatusBar(dword _status_text)
{
status_text.start_x = 10;
/programs/cmm/browser/show_src.h
1,95 → 1,231
enum { TAG, OPTION_VALUE, TEXT, COMMENT, SCRIPT};
 
dword source_buf_start, source_buf_end;
int opened_font=0;
int mode;
 
void SourceBufAdd(dword _mode, src)
{
dword font_found_pointer, src_orig = src;
 
if (_mode) mode = _mode;
 
strcpy(source_buf_end, src);
source_buf_end += strlen(source_buf_end);
 
if (font_found_pointer = strstr(src, "</font>")) {
opened_font--;
src = font_found_pointer+2;
}
 
src = src_orig;
if (font_found_pointer = strstr(src, "<font ")) {
opened_font++;
src = font_found_pointer+2;
}
}
 
void CloseAllOpenedFonts(dword _mode)
{
while (opened_font) SourceBufAdd(_mode, "</font>");
}
 
enum { TAG=1, VALUE, TEXT, COMMENT, SCRIPT};
dword ShowSource()
{
dword i, j;
bool activate_script_mode = false;
dword new_buf, new_buf_start, i, j;
int opened_font=0;
int mode = TEXT;
 
opened_font=0;
source_buf_start = source_buf_end = malloc(bufsize*5);
if (souce_mode) return;
souce_mode = true;
new_buf = malloc(bufsize*5);
new_buf_start = new_buf;
header[strrchr(#header, '-')-2]=0;
 
SourceBufAdd(TEXT, "<html><head><title>Source: ");
SourceBufAdd(TEXT, #header);
SourceBufAdd(TEXT, "</title><body><pre>");
 
for (i=bufpointer; i<bufpointer+bufsize; i++) switch (ESBYTE[i])
sprintf(new_buf,"<html><head><title>Source: %s</title><body><pre>",#header);
new_buf += strlen(new_buf);
for (i=bufpointer; i<bufpointer+bufsize; i++)
{
switch (ESBYTE[i])
{
case '<':
if (!strncmp(i+1,"!--", 3)) SourceBufAdd(COMMENT, "<font color=#bbb>&lt;");
else if (SCRIPT == mode) {
if (!strncmp(i+1,"/script>", 8)) {
CloseAllOpenedFonts(NULL);
SourceBufAdd(TAG, "<font color=#00f>&lt;");
if (mode == TEXT) && (!strncmp(i+1,"script", 6)) {
mode = SCRIPT;
strcpy(new_buf, "<font color=#00f>&lt;script</font><font color=#994500>"); opened_font++;
new_buf+=54;
i+=6;
break;
}
else SourceBufAdd(NULL, "&lt;");
if (mode == COMMENT) || (mode == SCRIPT) && (!strncmp(i+1,"/script>", 8)) {
mode = TEXT;
while (opened_font) {
strcpy(new_buf, "</font>"); opened_font--;
new_buf+=7;
}
else if (COMMENT == mode) {
SourceBufAdd(NULL, "&lt;");
strcpy(new_buf, "<font color=#00f>&lt;/script&gt;</font>");
new_buf+=39;
i+=8;
break;
}
else if (TEXT == mode) {
if (!strncmp(i+1,"script", 6)) activate_script_mode = true;
SourceBufAdd(TAG, "<font color=#00f>&lt;");
if (ESBYTE[i+1]=='!') && (ESBYTE[i+2]=='-') && (ESBYTE[i+3]=='-') {
mode = COMMENT;
strcpy(new_buf, "<font color=#bbb>&lt;"); opened_font++;
new_buf+=21;
break;
}
if (mode == TEXT) {
mode = TAG;
strcpy(new_buf, "<font color=#00f>&lt;"); opened_font++;
new_buf+=21;
break;
}
if (mode == COMMENT) || (mode == SCRIPT) {
strcpy(new_buf, "&lt;");
new_buf+=4;
break;
}
break;
case '>':
if (TAG == mode) && (activate_script_mode) {
activate_script_mode = false;
SourceBufAdd(SCRIPT, "&gt;</font><font color=#994500>");
if (mode == OPTION_VALUE) { //fix non-closed quote in TAG
mode = TEXT;
while (opened_font) {
strcpy(new_buf, "&quot;</font>"); opened_font--;
new_buf+=13;
}
else if (VALUE == mode) CloseAllOpenedFonts(TEXT);
else if (COMMENT == mode) && (!strncmp(i-2,"--", 2)) {
SourceBufAdd(TEXT, "&gt;");
CloseAllOpenedFonts(TEXT);
break;
}
else if (COMMENT == mode) || (SCRIPT == mode) SourceBufAdd(NULL, "&gt;");
else if (TAG == mode) SourceBufAdd(TEXT, "&gt;</font>");
if (mode == COMMENT) && (ESBYTE[i-1]=='-') && (ESBYTE[i-2]=='-') {
mode = TEXT;
strcpy(new_buf, "&gt;</font>"); opened_font--;
new_buf+=11;
break;
case '&':
SourceBufAdd(NULL, "&amp;");
}
if (mode == COMMENT) || (mode == SCRIPT) {
strcpy(new_buf, "&gt;");
new_buf+=4;
break;
}
if (mode == TAG) {
mode = TEXT;
strcpy(new_buf, "&gt;</font>"); opened_font--;
new_buf+=11;
break;
}
break;
case '\"':
case '\'':
if (TAG == mode) SourceBufAdd(VALUE, "<font color=#F301F2>&#39;");
else if (VALUE == mode) SourceBufAdd(TAG, "&#39;</font>");
else SourceBufAdd(NULL, "&#39;");
if (mode == TAG) {
mode = OPTION_VALUE;
strcpy(new_buf, "<font color=#F301F2>&#39;"); opened_font++;
new_buf+=25;
break;
}
if (mode == OPTION_VALUE) {
mode = TAG;
strcpy(new_buf, "&#39;</font>"); opened_font--;
new_buf+=12;
break;
}
default:
ESBYTE[source_buf_end] = ESBYTE[i];
source_buf_end++;
ESBYTE[new_buf] = ESBYTE[i];
new_buf++;
}
ESBYTE[source_buf_end] = 0;
bufsize = source_buf_end - source_buf_start;
}
ESBYTE[new_buf] = 0;
bufsize = new_buf - new_buf_start;
free(bufpointer);
bufpointer = source_buf_start;
bufpointer = new_buf_start;
}
 
/*
 
enum { TAG, OPTION_VALUE, TEXT, COMMENT, INLINE_COMMENT, CODE };
 
char* C_HL_keywords[] = {
"switch", "if", "while", "for", "break", "continue", "return", "else",
"union", "typedef", "static", "class", "case", "#include",
"volatile", "register", "sizeof", "typedef", "union", "goto", "const", "auto",
"#define", "#endif", "#error", "#ifdef", "#ifndef", "#undef", "#if", "#else",
"inline",
 
"int ", "dword ", "long ", "double ", "float ", "char ", "unsigned ", "signed ",
"void ", "bool ", "enum ", "byte ", "word ", "struct ", "NULL", "loop", "stdcall ",
":void ", ":int ", ":bool ", ":dword ", NULL
};
 
dword ShowCodeSource()
{
dword new_buf, new_buf_start, i;
int mode = CODE;
 
char spstr[64];
dword keylen;
dword keyn;
dword keycolor;
 
new_buf = malloc(bufsize*10);
new_buf_start = new_buf;
sprintf(new_buf,"<html><head><title>C/C++/C-- source: %s</title><body><pre>",#URL);
new_buf += strlen(new_buf);
for (i=bufpointer; i<bufpointer+bufsize; i++)
{
if ('<' == ESBYTE[i]) {
strcpy(new_buf, "&lt;");
new_buf+=4;
continue;
}
if ('>' == ESBYTE[i]) {
strcpy(new_buf, "&gt;");
new_buf+=4;
continue;
}
if (ESBYTE[i] >= '0') && (ESBYTE[i] <= '9') && (CODE == mode) {
strcpy(new_buf, "<font color=#CF00FF>?</font>");
ESBYTE[new_buf+20] = ESBYTE[i];
new_buf+=28;
if (ESBYTE[i+1] == 'x') {
strcpy(new_buf, "<font color=#CF00FF>x</font>");
new_buf+=28;
i++;
}
continue;
}
 
if (CODE == mode) && ('\"' == ESBYTE[i]) {
mode = TEXT;
strcpy(new_buf, "<font color=#080>\"");
new_buf+=18;
continue;
}
if (TEXT == mode) && ('\"' == ESBYTE[i]) {
mode = CODE;
strcpy(new_buf, "\"</font>");
new_buf+=8;
continue;
}
 
if (! strncmp(i, "//", 2) ) && (mode == CODE) {
mode = INLINE_COMMENT;
strcpy(new_buf, "<font color=#777>//");
new_buf+=19;
i++;
continue;
}
 
if (INLINE_COMMENT == mode) {
if (13 == ESBYTE[i]) {
mode = CODE;
strcpy(new_buf, "\13</font>");
new_buf+=8;
continue;
}
}
 
if (! strncmp(i, "/*", 2) ) {
mode = COMMENT;
strcpy(new_buf, "<font color=#665>/*");
new_buf+=19;
i++;
continue;
}
if (! strncmp(i, "*/", 2) ) {
mode = CODE;
strcpy(new_buf, "*/</font>");
new_buf+=9;
i++;
continue;
}
 
if (CODE == mode) for (keyn=0; C_HL_keywords[keyn]!=NULL; keyn++)
{
keylen = strlen(C_HL_keywords[keyn]);
if (! strncmp(i, C_HL_keywords[keyn], keylen) ) {
 
if (keyn<31) keycolor="#f00"; else keycolor="#00f";
sprintf(#spstr, "<font color=%s>%s</font>", keycolor, C_HL_keywords[keyn]);
strcpy(new_buf, #spstr);
 
new_buf += keylen + 24;
i += keylen-1;
goto _CONTINUE;
}
}
ESBYTE[new_buf] = ESBYTE[i];
new_buf++;
_CONTINUE:
}
ESBYTE[new_buf] = 0;
bufsize = new_buf - new_buf_start;
free(bufpointer);
bufpointer = new_buf_start;
}
*/
/programs/cmm/browser/history.h
55,5 → 55,5
}
*/
strcat(history_pointer, "</body></html>");
LoadInternalPage(history_pointer, strlen(history_pointer));
WB1.LoadInternalPage(history_pointer, strlen(history_pointer));
}
/programs/cmm/browser/html/homepage_ru.htm
9,7 → 9,7
3. <a href="http://store.kolibri-n.org">Kolibri Store</a>
 
<font color="#555555">„«ï ¯®¨áª  ¢ Google ­ ¡¥à¨â¥ â¥áâ ¢  ¤à¥á­®© áâப¥
¨ ­ ¦¬¨â¥ Ctrl+Enter. …áâì â ª¦¥ ¤à㣨¥ <a href="WebView:help"><font color="#555555">ƒ®àï稥 ª« ¢¨è¨</font></a>.</font>
¨ ­ ¦¬¨â¥ Ctrl+Enter. …áâì â ª¦¥ ¤à㣨¥ <a href="WebView://help"><font color="#555555">ƒ®àï稥 ª« ¢¨è¨</font></a>.</font>
 
 
</pre>
/programs/cmm/lib/strings.h
395,23 → 395,37
}
}
 
:void strncat(dword dst, src, dword len)
:void strncat(dword text1, text2, signed len)
signed o1,o2;
char s;
{
while (ESBYTE[dst]) dst++;
while (ESBYTE[src]) && (len) {
ESBYTE[dst] = ESBYTE[src];
dst++;
src++;
len--;
s = DSBYTE[text1];
while(s){
$inc text1
s = DSBYTE[text1];
}
o1 = len/4;
o2 = len-4*o1;
while(o1){
DSDWORD[text1] = DSDWORD[text2];
text1 += 4;
text2 += 4;
$dec o1
}
while(o2){
DSBYTE[text1] = DSBYTE[text2];
$inc text1
$inc text2
$dec o2
}
DSBYTE[text1] = 0;
}
 
inline fastcall void chrcat(ESI, DI)
inline fastcall void chrcat(ESI, BL)
{
while (ESBYTE[ESI]) ESI++;
ESBYTE[ESI] = DI;
ESI++;
ESBYTE[ESI] = 0;
EDI = strlen(ESI);
ESBYTE[ESI+EDI] = BL;
ESBYTE[ESI+EDI+1] = 0;
}
 
inline dword strchr(dword shb;char s)
/programs/cmm/lib/kolibri.h
28,7 → 28,6
#define bool int
 
#define NULL 0
#define EOS 0
#define OLD -1
#define true 1
#define false 0
/programs/cmm/codeview/codeview.c
193,7 → 193,7
if (!strncmp(#URL,"CodeView:",8))
{
SetPageDefaults();
if (!strcmp(#URL, URL_SERVICE_HOME)) LoadInternalPage(#homepage, sizeof(homepage));
if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
DrawEditBoxWebView();
return;
}
208,7 → 208,7
SetPageDefaults();
ReadFile(0, bufsize, bufpointer, #URL);
ShowCodeSource();
LoadInternalPage(bufpointer, bufsize);
WB1.LoadInternalPage(bufpointer, bufsize);
}
ShowPage();
}
226,18 → 226,19
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y);
}
 
void LoadInternalPage(dword bufpos, in_filesize){
bufsize = in_filesize;
bufpointer = bufpos;
ShowPage();
}
 
void ShowPage()
{
DrawEditBoxWebView();
if (!bufsize) LoadInternalPage(#page_not_found, sizeof(page_not_found));
if (!bufsize)
{
WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
}
else
{
WB1.Prepare();
}
}
 
void DrawStatusBar() {return;};
void EventClickLink() {return;};
/programs/cmm/dicty/dicty.c
154,7 → 154,7
{
int y_pos=TOPH+1;
char draw_buf[4096];
strlcpy(#draw_buf, #translate_result, sizeof(draw_buf)-1);
strlcpy(#draw_buf, #translate_result, sizeof(draw_buf));
DrawBar(0, y_pos, Form.width-9, Form.cheight - y_pos, 0xFFFFFF);
strttl(#draw_buf);