/programs/cmm/lib/obj/iconv.h |
---|
29,9 → 29,9 |
iconv_open stdcall (from_chs, to_chs); //CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5 |
if (EAX==-1) |
{ |
debugln(from_chs); |
debugln(to_chs); |
debugln("iconv: wrong charset,\nuse only CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5"); |
debug(from_chs); |
debug(to_chs); |
debug("iconv: wrong charset,\nuse only CP866, CP1251, CP1252, KOI8-RU, UTF-8, ISO8859-5"); |
return 0; |
} |
cd = EAX; |
42,10 → 42,12 |
cd = EAX; |
if (cd!=0) |
{ |
debugln("iconv: something is wrong with stdcall iconv()"); |
debug("iconv: something is wrong with stdcall iconv()"); |
debugi(cd); |
debug("in_len:"); debugi(in_len); |
debug("out_len:"); debugi(out_len); |
debug("in_len"); |
debugi(in_len); |
debug("out_len"); |
debugi(out_len); |
new_buf = free(new_buf); |
return 0; |
} |
/programs/cmm/TWB/TWB.c |
---|
135,12 → 135,12 |
if (strstri(bufpointer, "html")) |
{ |
style.pre = 0; |
cur_encoding = CH_NULL; |
cur_encoding = CH_UTF8; |
} |
else |
{ |
style.pre = 1; |
cur_encoding = CH_NULL; |
cur_encoding = CH_CP866; |
} |
for (bufpos=bufpointer ; (bufpos < bufpointer+bufsize) && (ESBYTE[bufpos]!=0) ; bufpos++;) |
{ |
368,7 → 368,7 |
if (opened) |
{ |
WB1.DrawBuf.zoom=2; |
WB1.list.font_type |= 10011001b; |
WB1.list.font_type |= 10111001b; |
if (isattr("align=")) && (isval("center")) style.align = ALIGN_CENTER; |
if (isattr("align=")) && (isval("right")) style.align = ALIGN_RIGHT; |
if (stroka>1) NewLine(); |
376,7 → 376,7 |
else |
{ |
WB1.DrawBuf.zoom=1; |
WB1.list.font_type = 10011000b; |
WB1.list.font_type = 10111000b; |
style.align = ALIGN_LEFT; |
} |
return; |
416,7 → 416,6 |
return; |
} |
if (istag("meta")) || (istag("?xml")) { |
meta_encoding = CH_NULL; |
do{ |
if (isattr("charset=")) || (isattr("content=")) || (isattr("encoding=")) |
{ |
427,9 → 426,10 |
else if (isval("windows-1251")) || (isval("windows1251")) meta_encoding = CH_CP1251; |
else if (isval("iso-8859-5")) || (isval("iso8859-5")) meta_encoding = CH_ISO8859_5; |
else if (isval("dos")) || (isval("cp-866")) meta_encoding = CH_CP866; |
if (cur_encoding!=meta_encoding) BufEncode(meta_encoding); |
return; |
} |
} while(GetNextParam()); |
if (meta_encoding!=CH_NULL) BufEncode(meta_encoding); |
return; |
} |
} |
437,6 → 437,7 |
void TWebBrowser::BufEncode(int set_new_encoding) |
{ |
int bufpointer_realsize; |
cur_encoding = set_new_encoding; |
if (o_bufpointer==0) |
{ |
o_bufpointer = malloc(bufsize); |
446,12 → 447,7 |
{ |
strcpy(bufpointer, o_bufpointer); |
} |
if (cur_encoding!=set_new_encoding) { |
cur_encoding = set_new_encoding; |
debugln(charsets[cur_encoding]); |
bufpointer = ChangeCharset(charsets[cur_encoding], "CP866", bufpointer); |
} |
} |
//============================================================================================ |
void TWebBrowser::DrawScroller() |
{ |
/programs/cmm/browser/WebView.c |
---|
15,7 → 15,6 |
#include "..\lib\cursor.h" |
#include "..\lib\collection.h" |
#include "..\lib\font.h" |
#include "..\lib\menu.h" |
//*.obj libraries |
#include "..\lib\obj\box_lib.h" |
30,31 → 29,19 |
char homepage[] = FROM "html\\homepage.htm"; |
#ifdef LANG_RUS |
char version[]=" ¥ªáâ®¢ë© ¡à 㧥à 1.48"; |
char version[]=" ¥ªáâ®¢ë© ¡à 㧥à 1.42"; |
?define IMAGES_CACHE_CLEARED "íè ª à⨮ª ®ç¨é¥" |
?define T_LAST_SLIDE "â® ¯®á«¥¤¨© á« ©¤" |
char loading[] = " £à㧪 áâà ¨æë...<br>"; |
char page_not_found[] = FROM "html\page_not_found_ru.htm"; |
char accept_language[]= "Accept-Language: ru\n"; |
char rmb_menu[] = |
"®á¬®âà¥âì ¨á室¨ª |
¥¤ ªâ¨à®¢ âì ¨á室¨ª |
áâ®à¨ï |
ç¨áâ¨âì ªíè ª à⨮ª |
¥¥¤¦¥à § £à㧮ª"; |
#else |
char version[]=" Text-based Browser 1.48"; |
char version[]=" Text-based Browser 1.42"; |
?define IMAGES_CACHE_CLEARED "Images cache cleared" |
?define T_LAST_SLIDE "This slide is the last" |
char loading[] = "Loading...<br>"; |
char page_not_found[] = FROM "html\page_not_found_en.htm"; |
char accept_language[]= "Accept-Language: en\n"; |
char rmb_menu[] = |
"View source |
Edit source |
History |
Free image cache |
Download Manager"; |
#endif |
#define URL_SERVICE_HISTORY "WebView://history" |
99,6 → 86,7 |
}; |
#include "..\TWB\TWB.c" |
#include "menu.h" |
#include "history.h" |
#include "show_src.h" |
#include "http_downloader.h" |
120,12 → 108,13 |
load_dll(libimg, #libimg_init,1); |
load_dll(libHTTP, #http_lib_init,1); |
load_dll(iconv_lib, #iconv_open,0); |
//load_dll(kmenu, #akmenu_init,0); |
Libimg_LoadImage(#skin, abspath("wv_skin.png")); |
SetSkinColors(); |
CreateDir("/tmp0/1/downloads"); |
if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME); |
WB1.DrawBuf.zoom = 1; |
WB1.list.SetFont(8, 14, 10011000b); |
WB1.list.SetFont(8, 14, 10111000b); |
WB1.list.no_selection = true; |
label.init(DEFAULT_FONT); |
SetEventMask(0xa7); |
140,10 → 129,7 |
if (WB1.list.MouseOver(mouse.x, mouse.y)) |
{ |
PageLinks.Hover(mouse.x, WB1.list.first*WB1.list.item_h + mouse.y, link_color_inactive, link_color_active, bg_color); |
if (bufsize) && (mouse.pkm) && (mouse.up) { |
menu.show(Form.left+mouse.x-6,Form.top+mouse.y+skin_height+3, 180, #rmb_menu, VIEW_SOURCE); |
break; |
} |
if (bufsize) && (mouse.pkm) && (mouse.up) { CreateThread(#menu_rmb,#stak+4092); break; } |
if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage(); |
} |
scrollbar_v_mouse (#scroll_wv); |
175,10 → 161,7 |
break; |
case evReDraw: |
if (menu.list.cur_y) { |
Scan(menu.list.cur_y); |
menu.list.cur_y = 0; |
} |
if (action_buf) Scan(action_buf); |
DefineAndDrawWindow(GetScreenWidth()-800/2,GetScreenHeight()-600/2,800,600,0x73,col_bg,0,0); |
GetProcessInfo(#Form, SelfInfo); |
if (Form.status_window>2) { DrawTitle(#header); break; } |
266,11 → 249,8 |
WB1.list.wheel_size = 7; |
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w; |
WB1.list.visible = WB1.list.h - 5 / WB1.list.item_h; |
if (WB1.list.w!=WB1.DrawBuf.bufw) { |
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h * 30); |
Scan(REFRESH_BUTTON); |
if (WB1.list.w!=WB1.DrawBuf.bufw) WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h * 30); |
} |
} |
352,7 → 332,7 |
case SANDWICH_BUTTON: |
mouse.y = TOOLBAR_H-6; |
mouse.x = Form.cwidth - 167; |
menu.show(Form.left+mouse.x-6,Form.top+mouse.y+skin_height+3, 180, #rmb_menu, VIEW_SOURCE); |
CreateThread(#menu_rmb,#stak+4092); |
return; |
case VIEW_SOURCE: |
WB1.list.first = 0; |
/programs/cmm/browser/history.h |
---|
8,7 → 8,7 |
history_pointer = malloc(history.items.data_size+256); |
strcat(history_pointer, "<html><head><title>History</title></head><body><h1>History</h1>"); |
strcat(history_pointer, "<h2>Visited pages</h2><blockquote><br>"); |
for (i=0; i<history.items.count; i++) |
for (i=1; i<history.items.count; i++) |
{ |
strcat(history_pointer, " <a href='"); |
strcat(history_pointer, history.items.get(i)); |
/programs/cmm/browser/menu.h |
---|
0,0 → 1,77 |
//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; |
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: |
GetKeys(); |
if (key_scancode==SCAN_CODE_ESC) ExitProcess(); |
if (key_scancode==SCAN_CODE_ENTER) ItemClick(); |
if (menu.ProcessKey(key_scancode)) 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.cur_y) |
DrawBar(menu.x, N*menu.item_h+menu.y, menu.w-3, menu.item_h, 0x94AECE); |
else |
{ |
DrawBar(menu.x, N*menu.item_h+menu.y, menu.w-3, menu.item_h, col_bg); |
WriteText(19,N*menu.item_h+9,0x80,0xf2f2f2,ITEMS_LIST[N]); |
} |
WriteText(18,N*menu.item_h+8,0x80,0x000000,ITEMS_LIST[N]); |
} |
} |
void ItemClick() |
{ |
action_buf = VIEW_SOURCE + menu.cur_y; |
ExitProcess(); |
} |