/data/Tupfile.lua |
---|
646,7 → 646,6 |
{"NETWORK/WEBVIEW", PROGS .. "/cmm/browser/WebView.com"}, |
}) |
tup.append_table(extra_files, { |
{"kolibrios/develop/utils/codeview", PROGS .. "/cmm/codeview/codeview.com"}, |
{"kolibrios/drivers/drvinst.kex", PROGS .. "/cmm/drvinst/drvinst.com"}, |
{"kolibrios/games/pig/pigex", PROGS .. "/cmm/examples/pigex.com"}, |
{"kolibrios/games/the_bus/the_bus", PROGS .. "/cmm/the_bus/the_bus.com"}, |
/programs/cmm/codeview/compile_en.bat |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/codeview/highlight_c.h |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/codeview/html/homepage.htm |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/codeview/html/page_not_found_en.htm |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/codeview/codeview.c |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/codeview/Tupfile.lua |
---|
File deleted |
/programs/cmm/TWB/TWB.c |
---|
446,7 → 446,7 |
if (value = tag.get_value_of("alt=")) && (strlen(value)<sizeof(line)-3) && (value) sprintf(#line, "[%s]", value); |
if (!img_path) { line=0; return; } |
style.image = true; |
page_img.add(#img_path, stolbec+1*list.font_w+3, draw_y); |
page_img.add_pos(#img_path, stolbec+1*list.font_w+3, draw_y); |
text_colors.add(0x9A6F29); |
if (!line) { |
if (!strncmp(#img_path, "data:", 5)) img_path=0; |
607,6 → 607,6 |
void TWebBrowser::DrawPage() |
{ |
PutPaletteImage(list.first * DrawBuf.bufw * 4 + buf_data+8, DrawBuf.bufw, list.h, DrawBuf.bufx, DrawBuf.bufy, 32, 0); |
page_img.draw(list.x, list.y, list.first, list.h); |
page_img.draw_all(list.x, list.y, list.first, list.h); |
DrawScroller(); |
} |
/programs/cmm/TWB/img.h |
---|
3,19 → 3,27 |
{ |
collection url; |
collection_int xywh; |
collection_int data; |
int getid; |
dword add(); |
void clear(); |
dword add_pos(); |
bool set_size(); |
dword current_url(); |
bool next_url(); |
void set_data(); |
void draw(); |
void draw_all(); |
bool draw(); |
}; |
#ifndef NO_IMG |
void _img::clear() |
{ |
url.drop(); |
xywh.drop(); |
getid = 0; |
} |
dword _img::add(dword _path, _x, _y) |
dword _img::add_pos(dword _path, _x, _y) |
{ |
char full_path[URL_SIZE]; |
strncpy(#full_path, _path, URL_SIZE); |
24,18 → 32,26 |
url.add(#full_path); |
xywh.add(_x); |
xywh.add(_y); |
xywh.add(0); |
xywh.add(0); |
xywh.add(NULL); |
xywh.add(NULL); |
return full_path; |
} |
void _img::clear() |
bool _img::set_size(dword _buf, _size) |
{ |
url.drop(); |
xywh.drop(); |
data.drop(); |
getid = 0; |
char vvv[1000]; |
int w, h; |
img_decode stdcall (_buf, _size, 0); |
if (EAX) { |
EDI = EAX; |
w = ESDWORD[EDI+4]; |
h = ESDWORD[EDI+8]; |
xywh.set(getid*4+2, ESDWORD[EDI+4]); |
xywh.set(getid*4+3, ESDWORD[EDI+8]); |
sprintf(#vvv, "%s w:%i h:%i", current_url(), w, h); |
debugln(#vvv); |
} |
} |
dword _img::current_url() |
{ |
51,40 → 67,28 |
return 0; |
} |
void _img::set_data(dword _data, _data_len) |
void _img::draw_all(int _x, _y, _start, _height) |
{ |
data.set(getid, _data); |
} |
int i, img_y; |
void _img::draw(int _x, _y, _start, _height) |
{ |
int i, img_x, img_y; |
for (i=0; i<url.count; i++) |
{ |
img_x = xywh.get(i*4); |
img_y = xywh.get(i*4 + 1); |
if (img_y > _start) && (img_y < _start + _height) |
{ |
if (cache.has(url.get(i))) |
DrawLibimgImage(img_x + _x, img_y-_start + _y, cache.current_buf, cache.current_size); |
&& (cache.has(url.get(i))) draw(_x, _y, _start, i); |
} |
} |
} |
void DrawLibimgImage(dword _x, _y, _data, _data_len) |
bool _img::draw(int _x, _y, _start, i) |
{ |
libimg_image im; |
img_decode stdcall (_data, _data_len, 0); |
$or eax, eax |
$jz __ERROR__ |
img_decode stdcall (cache.current_buf, cache.current_size, 0); |
if (EAX) { |
im.image = EAX; |
im.set_vars(); |
im.draw(_x, _y, im.w, im.h, 0, 0); |
__ERROR__: |
im.draw(xywh.get(i*4) + _x, xywh.get(i*4+1) - _start + _y, im.w, im.h, 0, 0); |
} |
} |
/* |
136,12 → 140,3 |
*/ |
#else |
dword _img::add(dword _path, _x, _y) {}; |
void _img::clear() {}; |
dword _img::current_url() {}; |
bool _img::next_url() {}; |
void _img::set_data(dword _data, _data_len) {}; |
void _img::draw(int _x, _y, _start, _height) {}; |
#endif |
/programs/cmm/browser/WebView.c |
---|
31,7 → 31,7 |
char editbox_icons[] = FROM "res/editbox_icons.raw"; |
char version[]="WebView 2.7c"; |
char version[]="WebView 2.7e"; |
#include "texts.h" |
#include "cache.h" |
236,7 → 236,7 |
if (http.transfer <= 0) break; |
http.receive(); |
EventUpdateProgressBar(); |
CheckContentType(); |
if (http_get_type==PAGE) CheckContentType(); |
if (http.receive_result != 0) break; |
if (http.status_code >= 300) && (http.status_code < 400) |
{ |
259,7 → 259,7 |
} |
else if (http_get_type==IMG) { |
cache.add(WB1.page_img.current_url(), http.content_pointer, http.content_received, IMG); |
WB1.page_img.set_data(cache.data.get_last(), http.content_received); |
WB1.page_img.set_size(http.content_pointer, http.content_received); |
GetImg(); |
} |
} |
/programs/cmm/browser/res/highlight_c.h |
---|
0,0 → 1,121 |
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 _bufpointer, _bufsize) |
{ |
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>%s</title><body><pre>",#current_path); |
new_buf += strlen(new_buf); |
for (i=_bufpointer; i<_bufpointer+_bufsize; i++) |
{ |
if ('<' == ESBYTE[i]) { |
strcpy(new_buf, "<"); |
new_buf+=4; |
continue; |
} |
if ('>' == ESBYTE[i]) { |
strcpy(new_buf, ">"); |
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=#999>//"); |
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=#999>/*"); |
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; |
LoadInternalPage(new_buf_start, new_buf - new_buf_start); |
free(new_buf_start); |
} |