/programs/cmm/TWB/TWB.c |
---|
10,6 → 10,7 |
struct TWebBrowser { |
llist list; |
dword draw_line_height, draw_line_width, draw_list_height; |
DrawBufer DrawBuf; |
void Prepare(); |
void Parse(); |
61,7 → 62,7 |
void TWebBrowser::DrawPage() |
{ |
int start_x, start_y, line_length, stolbec_len, magrin_left=5; |
int start_x, start_y, zstart_x, zstart_y, line_length, zline_length, stolbec_len, magrin_left=5; |
if (!header) |
{ |
77,18 → 78,21 |
{ |
start_x = stolbec * 6 + list.x + magrin_left; |
start_y = stroka * list.line_h + list.y + magrin_left; |
zstart_x = stolbec * 6 + magrin_left * DrawBuf.zoomf + list.x; |
zstart_y = stroka * list.line_h * DrawBuf.zoomf + magrin_left + list.y; |
stolbec_len = strlen(#line); |
line_length = stolbec_len * 6; |
zline_length = stolbec_len * 6 * DrawBuf.zoomf; |
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-1, line_length + 3, 10, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
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) { |
DrawBuf.DrawBar(start_x, 8, line_length, 1, text_colors[text_color_index]); |
PageLinks.AddText(#line, line_length, list.line_h, UNDERLINE); |
UnsafeDefineButton(zstart_x-2, zstart_y-1, zline_length + 3, DrawBuf.zoomf * 10, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
PageLinks.AddText(#line, zline_length, draw_line_height, UNDERLINE); |
} |
stolbec += stolbec_len; |
} |
145,6 → 149,10 |
stolbec = 0; |
line = 0; |
draw_line_height = list.line_h * DrawBuf.zoomf; |
draw_line_width = list.w * DrawBuf.zoomf; |
draw_list_height = list.h * DrawBuf.zoomf; |
if (pre_text<>2) |
{ |
pre_text=0; |
247,7 → 255,7 |
if (stolbec + strlen(#line) > list.column_max) Perenos(); |
DrawPage(); |
line = NULL; |
if (tag) SetTextStyle(list.x + 5, stroka * list.line_h + list.y + 5); //îáðàáîòêà òåãîâ |
if (tag) SetTextStyle(WB1.DrawBuf.zoomf * 5 + list.x, stroka * draw_line_height + list.y + 5); //îáðàáîòêà òåãîâ |
tag = parametr = tagparam = ignor_param = NULL; |
break; |
default: |
265,8 → 273,8 |
} |
DrawPage(); |
NewLine(); |
DrawBar(list.x, stroka * list.line_h + list.y + 5, list.w, -stroka * list.line_h + list.h - 5, bg_color); |
DrawBar(list.x, list.visible * list.line_h + list.y + 4, list.w, -list.visible * list.line_h + list.h - 4, bg_color); |
DrawBar(list.x, stroka * draw_line_height + list.y + 5, draw_line_width, -stroka * draw_line_height + draw_list_height - 5, bg_color); |
DrawBar(list.x, list.visible * draw_line_height + list.y + 4, draw_line_width, -list.visible * draw_line_height + draw_list_height - 4, bg_color); |
if (list.first == 0) list.count = stroka; |
if (anchor) //åñëè ïîñðåäè òåêñòà ïîÿâèòñÿ íîâûé ÿêîðü - áóäåò áåñêîíå÷íûé öèêë |
{ |
380,7 → 388,7 |
link = 1; |
text_colors[text_color_index] = link_color_inactive; |
PageLinks.AddLink(#options, stolbec*6+left1, top1-2); |
PageLinks.AddLink(#options, DrawBuf.zoomf * stolbec*6+left1, top1-2); |
} |
if (anchor) && (!strcmp(#parametr, "name=")) |
{ |
548,7 → 556,7 |
if (opened) |
{ |
NewLine(); |
if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + left1 - 5, list.line_h/2-2, 2, 2, 0x555555); |
if (stroka > -1) && (stroka - 2 < list.visible) DrawBuf.DrawBar(li_tab * 5 * 6 + list.x, list.line_h/2-2, 2, 2, 0x555555); |
} |
return; |
} |
609,8 → 617,10 |
scroll_wv.all_redraw=0; |
scroll_wv.start_x = list.x + list.w; |
scroll_wv.start_y = list.y; |
scroll_wv.size_y=list.h; |
scroll_wv.size_y = list.h * DrawBuf.zoomf; |
scroll_wv.start_x = list.w * DrawBuf.zoomf + list.x; |
scrollbar_v_draw(#scroll_wv); |
} |
617,12 → 627,12 |
void TWebBrowser::NewLine() |
{ |
int onleft; |
int ontop; |
int onleft, ontop, zontop; |
onleft = list.x + 5; |
ontop = stroka * list.line_h + list.y + 5; |
if (!stroka) DrawBar(list.x, list.y, list.w, 5, bg_color); |
zontop = stroka * list.line_h * DrawBuf.zoomf + list.y + 5; |
if (!stroka) DrawBar(list.x, list.y, draw_line_width, 5, bg_color); |
if (t_html) && (!t_body) return; |
if (ontop>=list.y) && ( ontop < list.h+list.y-10) && (!anchor) |
{ |
629,6 → 639,7 |
if (text_align == ALIGN_CENTER) DrawBuf.AlignCenter(onleft,ontop,list.w,list.line_h,stolbec * 6); |
if (text_align == ALIGN_RIGHT) DrawBuf.AlignRight(onleft,ontop,list.w,list.line_h,stolbec * 6); |
DrawBuf.bufy = ontop; |
DrawBuf.zbufy = zontop; |
DrawBuf.Show(); |
DrawBuf.Fill(bg_color); |
} |
/programs/cmm/TWB/links.h |
---|
76,10 → 76,10 |
{ |
if (active==i) return; |
CursorPointer.Set(); |
if (links[active].underline) DrawBar(links[active].x,links[active].y+10,links[active].w,1, link_col_in); |
if (links[i].underline) DrawBar(links[i].x,links[i].y+10,links[i].w,1, bg_col); |
if (links[active].underline) DrawBar(links[active].x, WB1.list.line_h - WB1.DrawBuf.zoomf * WB1.DrawBuf.zoomf + links[active].y,links[active].w, WB1.DrawBuf.zoomf, link_col_in); |
if (links[i].underline) DrawBar(links[i].x, WB1.list.line_h - WB1.DrawBuf.zoomf * WB1.DrawBuf.zoomf + links[i].y,links[i].w, WB1.DrawBuf.zoomf, bg_col); |
active = i; |
status_text.start_x = progress_bar.left+progress_bar.width+10; |
status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10; |
status_text.start_y = Form.cheight-STATUSBAR_H+3; |
status_text.area_size_x = Form.cwidth - status_text.start_x -3; |
DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
92,7 → 92,7 |
if (active!=-1) |
{ |
CursorPointer.Restore(); |
if (links[active].underline) DrawBar(links[active].x,links[active].y+10,links[active].w,1, link_col_in); |
if (links[active].underline) DrawBar(links[active].x, WB1.list.line_h - WB1.DrawBuf.zoomf * WB1.DrawBuf.zoomf + links[active].y,links[active].w, WB1.DrawBuf.zoomf, link_col_in); |
DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
active = -1; |
} |
/programs/cmm/browser/History.txt |
---|
File deleted |
/programs/cmm/browser/WebView.c |
---|
32,7 → 32,7 |
char homepage[] = FROM "html\\homepage.htm"; |
#ifdef LANG_RUS |
char version[]=" ¥ªáâ®¢ë© ¡à 㧥à 1.0"; |
char version[]=" ¥ªáâ®¢ë© ¡à 㧥à 1.1"; |
?define IMAGES_CACHE_CLEARED "íè ª à⨮ª ®ç¨é¥" |
?define T_LAST_SLIDE "â® ¯®á«¥¤¨© á« ©¤" |
char loading[] = " £à㧪 áâà ¨æë...<br>"; |
39,7 → 39,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.0"; |
char version[]=" Text-based Browser 1.1"; |
?define IMAGES_CACHE_CLEARED "Images cache cleared" |
?define T_LAST_SLIDE "This slide is the last" |
char loading[] = "Loading...<br>"; |
48,8 → 48,8 |
#endif |
proc_info Form; |
#define WIN_W 640 |
#define WIN_H 480 |
#define WIN_W 799 |
#define WIN_H 559 |
char search_path[]="http://nigma.ru/index.php?s="; |
char str_location[]="location\0"; |
70,7 → 70,7 |
dword panel_color; |
dword border_color; |
progress_bar progress_bar = {0, 10, 83, 150, 12, 0, 0, 100, 0xeeeEEE, 8072B7EBh, 0x9F9F9F}; |
progress_bar wv_progress_bar = {0, 10, 83, 150, 12, 0, 0, 100, 0xeeeEEE, 8072B7EBh, 0x9F9F9F}; |
byte souce_mode = false; |
#include "..\TWB\TWB.c" |
98,21 → 98,21 |
col_bg = DSDWORD[image_data]; |
panel_color = DSDWORD[skin.w*4*4 + image_data]; |
border_color = DSDWORD[skin.w*4*7 + image_data]; |
progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data]; |
wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data]; |
$and col_bg, 0x00ffffff |
$and panel_color, 0x00ffffff |
$and border_color, 0x00ffffff |
$and progress_bar.progress_color, 0x00ffffff |
$and wv_progress_bar.progress_color, 0x00ffffff |
} |
void DrawProgress() |
{ |
unsigned long btn; |
//progressbar_draw stdcall(#progress_bar); |
progress_bar.width = progress_bar.left = 0; |
//progressbar_draw stdcall(#wv_progress_bar); |
wv_progress_bar.width = wv_progress_bar.left = 0; |
if (http_transfer == 0) return; |
if (progress_bar.max) btn = address_box.width*progress_bar.value/progress_bar.max; else btn = 30; |
DrawBar(address_box.left-1, address_box.top+14, btn, 2, progress_bar.progress_color); |
if (wv_progress_bar.max) btn = address_box.width*wv_progress_bar.value/wv_progress_bar.max; else btn = 30; |
DrawBar(address_box.left-1, address_box.top+14, btn, 2, wv_progress_bar.progress_color); |
} |
131,6 → 131,7 |
Libimg_LoadImage(#skin, abspath("wv_skin.png")); |
SetSkinColors(); |
WB1.DrawBuf.zoomf = 1; |
Form.width=WIN_W; |
Form.height=WIN_H; |
SetElementSizes(); |
183,6 → 184,7 |
} |
if (scroll_used) |
{ |
m.y = m.y / WB1.DrawBuf.zoomf + 5; |
half_scroll_size = WB1.list.h - 16 * WB1.list.visible / WB1.list.count - 3 /2; |
if (half_scroll_size+WB1.list.y>m.y) || (m.y<0) || (m.y>4000) m.y=half_scroll_size+WB1.list.y; |
btn=WB1.list.first; |
200,7 → 202,7 |
key = GetKey(); |
if (address_box.flags & 0b10) SWITCH(key) |
{ CASE 52: CASE 53: CASE 54: CASE 180: CASE 181: goto _EDIT_MARK; } |
{ CASE 52: CASE 53: CASE 54: CASE 180: CASE 181: CASE 122: goto _EDIT_MARK; } |
Scan(key); |
222,10 → 224,10 |
http_process stdcall (http_transfer); |
$push EAX |
ESI = http_transfer; |
progress_bar.max = ESI.http_msg.content_length; |
if (progress_bar.value != ESI.http_msg.content_received) |
wv_progress_bar.max = ESI.http_msg.content_length; |
if (wv_progress_bar.value != ESI.http_msg.content_received) |
{ |
progress_bar.value = ESI.http_msg.content_received; |
wv_progress_bar.value = ESI.http_msg.content_received; |
DrawProgress(); |
} |
$pop EAX |
288,7 → 290,7 |
{ |
address_box.top = TOOLBAR_H-TAB_H/2-7+TAB_H; |
address_box.width = Form.cwidth - address_box.left - 25 - 22; |
WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x, Form.cheight - TOOLBAR_H - STATUSBAR_H, 0, 11); |
WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoomf, Form.cheight - TOOLBAR_H - STATUSBAR_H / WB1.DrawBuf.zoomf, 0, 11); |
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / 6; |
WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h; |
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.line_h); |
329,7 → 331,7 |
//status bar |
DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg); |
DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color); |
progress_bar.top = Form.cheight - STATUSBAR_H + 4; |
wv_progress_bar.top = Form.cheight - STATUSBAR_H + 4; |
ShowPage(); |
DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col); |
DrawProgress(); |
380,8 → 382,10 |
return; |
case 006: //download manager |
DL_URL[0] = 0; |
if (!downloader_opened) { |
strcpy(#DL_URL, "http://"); |
CreateThread(#Downloader,#downloader_stak+4092); |
} |
return; |
case BACK: |
485,6 → 489,10 |
m.y = TOOLBAR_H-6; |
m.x = Form.cwidth - 167; |
CreateThread(#menu_rmb,#stak+4092); |
return; |
case 122: |
if (WB1.DrawBuf.zoomf==1) WB1.DrawBuf.zoomf=2; else WB1.DrawBuf.zoomf=1; |
Draw_Window(); |
} |
} |
530,11 → 538,11 |
PageLinks.GetAbsoluteURL(#URL); |
if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1) |
if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1) || (UrlExtIs(".kex")==1) |
|| (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1) |
{ |
//notify(#URL); |
if (strcmpn(#URL,"http://:", 8)==0) |
if (strcmpn(#URL,"http://", 7)==0) |
{ |
strcpy(#DL_URL, #URL); |
CreateThread(#Downloader,#downloader_stak+4092); |
572,7 → 580,7 |
bufsize = 0; |
bufpointer = mem_Free(bufpointer); |
} |
progress_bar.value = 0; |
wv_progress_bar.value = 0; |
img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, 52, 0); |
} |
/programs/cmm/browser/downloader.h |
---|
1,33 → 1,40 |
#ifdef LANG_RUS |
#define DL_WINDOW_HEADER "Download Manager" |
#define START_DOWNLOADING "Start downloading" |
#define STOP_DOWNLOADING "Stop downloading" |
#define FILE_SAVED_AS "'Download manager\nFile saved as " |
#define DOWNLOADING_COMPLETE "Downloading complete." |
#define DL_WINDOW_HEADER "¥¥¤¦¥à § £à㧮ª" |
#define START_DOWNLOADING " ç âì § ª çªã" |
#define STOP_DOWNLOADING "áâ ®¢¨âì ᪠稢 ¨¥" |
#define SHOW_IN_FOLDER "®ª § âì ¢ ¯ ¯ª¥" |
#define OPEN_FILE "âªàëâì ä ©«" |
#define FILE_SAVED_AS "'¥¥¤¦¥à § £à㧮ª\n ©« á®åà ¥ ª ª " |
#define KB_RECEIVED " ¯®«ã祮" |
#else |
#define DL_WINDOW_HEADER "Download Manager" |
#define START_DOWNLOADING "Start downloading" |
#define STOP_DOWNLOADING "Stop downloading" |
#define SHOW_IN_FOLDER "Show in folder" |
#define OPEN_FILE "Open file" |
#define FILE_SAVED_AS "'Download manager\nFile saved as " |
#define DOWNLOADING_COMPLETE "Downloading complete." |
#define KB_RECEIVED " received" |
#endif |
proc_info DL_Form; |
system_colors sc; |
char DL_URL[10000]; |
dword DL_bufpointer; |
dword DL_bufsize; |
dword DL_http_transfer; |
dword DL_http_buffer; |
dword DL_bufpointer, DL_bufsize, DL_http_transfer, DL_http_buffer; |
char filepath[4096]; |
int downloaded_size, full_size; |
int mouse_twbi; |
edit_box DL_address_box = {250,20,20,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(DL_URL),#DL_URL,#mouse_twbi,2,19,19}; |
progress_bar DL_progress_bar = {0, 170, 51, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F}; |
char save_to[4096] = "/tmp0/1/Downloads/"; |
byte cleft = 10; |
byte cleft = 15; |
byte downloader_opened; |
byte download_state; |
enum { STATE_NOT_STARTED, STATE_IN_PROGRESS, STATE_COMPLETED }; |
void Downloader() |
{ |
int key, btn; |
41,6 → 48,7 |
DL_address_box.size = DL_address_box.pos = DL_address_box.shift = DL_address_box.shift_old = strlen(#DL_URL); |
downloaded_size = full_size = 0; |
downloader_opened = 1; |
SetEventMask(0x27); |
loop() |
55,7 → 63,6 |
case evButton: |
btn=GetButtonID(); |
if (btn==1) ExitProcess(); |
DL_Scan(btn); |
break; |
71,7 → 78,7 |
case evReDraw: |
sc.get(); |
DefineAndDrawWindow(215, 100, 420, 150, 0x74, sc.work, DL_WINDOW_HEADER, 0); |
DefineAndDrawWindow(215, 100, 420, 120, 0x74, sc.work, DL_WINDOW_HEADER, 0); |
GetProcessInfo(#DL_Form, SelfInfo); |
if (DL_Form.status_window>2) break; |
if (DL_Form.height<120) MoveSize(OLD,OLD,OLD,120); |
80,9 → 87,17 |
break; |
default: |
if (DL_Form.width==0) break; |
if (DL_http_transfer <= 0) break; |
if (DL_Form.width==0) || (DL_http_transfer <= 0) break; |
http_process stdcall (DL_http_transfer); |
$push EAX |
ESI = DL_http_transfer; |
DL_progress_bar.max = ESI.http_msg.content_length; |
if (DL_progress_bar.value != ESI.http_msg.content_received) |
{ |
DL_progress_bar.value = ESI.http_msg.content_received; |
progressbar_draw stdcall(#DL_progress_bar); |
} |
$pop EAX |
if (EAX == 0) { |
ESI = DL_http_transfer; |
DL_bufpointer = ESI.http_msg.content_ptr; |
105,7 → 120,9 |
} |
notify(#notify_message); |
DL_address_box.color = DL_address_box.blur_border_color = DL_address_box.focus_border_color = 0xFFFfff; |
download_state = STATE_COMPLETED; |
DL_Draw_Window(); |
break; |
} |
ESI = DL_http_transfer; |
downloaded_size = ESI.http_msg.content_received; |
115,50 → 132,26 |
} |
} |
void DrawDownloading() |
{ |
dword tmp; |
char bytes_received[70], percent[30]; |
percent[0]=0; |
if (DL_http_transfer > 0) |
{ |
strcpy(#bytes_received, "Downloading... "); |
tmp = ConvertSizeToKb(downloaded_size); |
strcat(#bytes_received, tmp); |
strcat(#bytes_received, " received."); |
if (full_size>0) |
{ |
tmp = itoa(downloaded_size * 100 / full_size); |
strcpy(#percent, tmp); |
strcat(#percent, " \x25"); |
} |
} |
else |
{ |
strcpy(#bytes_received, DOWNLOADING_COMPLETE); |
} |
DrawBar(cleft, 90, DL_Form.cwidth - cleft, 9, sc.work); |
WriteText(cleft, 90, 0x80, sc.work_text, #bytes_received); |
WriteText(DL_Form.cwidth - 50, 90, 0x80, sc.work_text, #percent); |
} |
void DL_Draw_Window() |
{ |
DrawBar(0,0,DL_Form.cwidth,DL_Form.cheight,sc.work); //bg |
if (DL_http_transfer <= 0) |
DrawBar(0,0, DL_Form.cwidth, DL_Form.cheight, sc.work); |
DeleteButton(305); |
DeleteButton(306); |
if (download_state == STATE_NOT_STARTED) || (download_state == STATE_COMPLETED) |
{ |
DrawCaptButton(cleft, 50, 120, 20, 301, sc.work_button, sc.work_button_text, START_DOWNLOADING); |
DrawCaptButton(cleft, 50, 130, 27, 301, sc.work_button, sc.work_button_text, START_DOWNLOADING); |
} |
else |
if (download_state == STATE_IN_PROGRESS) |
{ |
DrawCaptButton(cleft, 50, 120, 20, 302, sc.work_button, sc.work_button_text, STOP_DOWNLOADING); |
DrawCaptButton(cleft, 50, 140, 27, 302, sc.work_button, sc.work_button_text, STOP_DOWNLOADING); |
DrawDownloading(); |
} |
if (DL_http_transfer <= 0) |
if (download_state == STATE_COMPLETED) |
{ |
DrawCaptButton(cleft+130, 50, 120, 20, 305, sc.work_button, sc.work_button_text, "Show in folder"); |
DrawCaptButton(cleft+260, 50, 120, 20, 306, sc.work_button, sc.work_button_text, "Open file"); |
DrawCaptButton(cleft+140, 50, 110, 27, 305, sc.work_button, sc.work_button_text, SHOW_IN_FOLDER); |
DrawCaptButton(cleft+260, 50, 120, 27, 306, sc.work_button, sc.work_button_text, OPEN_FILE); |
} |
WriteText(cleft, DL_address_box.top + 4, 0x80, sc.work_text, "URL:"); |
DL_address_box.left = strlen("URL:")*6 + 10 + cleft; |
166,13 → 159,33 |
DL_address_box.offset=0; |
edit_box_draw stdcall(#DL_address_box); |
DrawRectangle(DL_address_box.left-1, DL_address_box.top-1, DL_address_box.width+2, 16,DL_address_box.color); |
DrawRectangle(DL_address_box.left-2, DL_address_box.top-2, DL_address_box.width+4, 18,sc.work_graph); |
DrawRectangle(DL_address_box.left-2, DL_address_box.top-2, DL_address_box.width+4, 18, border_color); |
} |
DrawDownloading(); |
void DrawDownloading() |
{ |
dword tmp; |
char bytes_received[70]; |
tmp = ConvertSizeToKb(downloaded_size); |
strcpy(#bytes_received, tmp); |
strcat(#bytes_received, KB_RECEIVED); |
DrawBar(DL_progress_bar.left, DL_progress_bar.top + 17, DL_Form.cwidth - DL_progress_bar.left, 9, sc.work); |
WriteText(DL_progress_bar.left, DL_progress_bar.top + 17, 0x80, sc.work_text, #bytes_received); |
progressbar_draw stdcall(#DL_progress_bar); |
} |
void DL_Scan(int id) |
{ |
if (id==001) { |
downloader_opened=0; |
StopDownloading(); |
ExitProcess(); |
} |
if (id==301) && (DL_http_transfer <= 0) StartDownloading(); |
if (id==302) StopDownloading(); |
if (id==305) RunProgram("/sys/File managers/Eolite", #save_to); |
182,6 → 195,7 |
void StopDownloading() |
{ |
download_state = STATE_NOT_STARTED; |
if (DL_http_transfer<>0) |
{ |
EAX = DL_http_transfer; |
204,9 → 218,11 |
StopDownloading(); |
if (strncmp(#DL_URL,"http:",5)==0) |
{ |
DL_address_box.color = DL_address_box.blur_border_color = DL_address_box.focus_border_color = 0xededed; |
download_state = STATE_IN_PROGRESS; |
DL_address_box.color = DL_address_box.blur_border_color = DL_address_box.focus_border_color = 0xdddDDD; |
http_get stdcall (#DL_URL, #accept_language); |
DL_http_transfer = EAX; |
DL_progress_bar.value = 0; |
DL_Draw_Window(); |
if (DL_http_transfer == 0) |
{ |
/programs/cmm/browser/menu_rmb.h |
---|
6,6 → 6,7 |
"KOI Ctrl+K",11, |
"UTF Ctrl+U",21, |
#ifdef LANG_RUS |
"Zoom 2x Z",122, |
"®á¬®âà¥âì ¨á室¨ª F3",52, |
"¥¤ ªâ¨à®¢ âì ¨á室¨ª F4",53, |
"ç¨áâ¨âì ªíè ª à⨮ª" ,02, |
12,6 → 13,7 |
"áâ®à¨ï" ,03, |
"¥¥¤¦¥à § £à㧮ª" ,06, |
#else |
"Zoom 2x Z",122, |
"View source F3",52, |
"Edit source F4",53, |
"Free image cache" ,09, |
78,8 → 80,9 |
WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]); |
} |
if (cur_encoding!=_DEFAULT) |
{ |
DrawBar(7, cur_encoding*menu.line_h+9, 4, 4, 0x444444); //show current encoding |
WriteText(5, cur_encoding*menu.line_h+7, 0x80, 0x777777, "\x10"); //show current encoding |
else |
WriteText(5, _DOS*menu.line_h+7, 0x80, 0x777777, "\x10"); //show current encoding |
if (WB1.DrawBuf.zoomf == 2) DrawBar(6, 4*menu.line_h+8, 6, 6, 0x777777); |
} |
else DrawBar(7, _DOS*menu.line_h+9, 4, 4, 0x444444); //show current encoding |
} |
/programs/cmm/lib/draw_buf.h |
---|
1,8 → 1,12 |
dword buf_data; |
dword zbuf_data; |
struct DrawBufer { |
int bufx, bufy, bufw, bufh; |
int zbufx, zbufy, zbufw, zbufh; |
byte zoomf; |
void Init(); |
void Show(); |
12,6 → 16,7 |
void PutPixel(); |
void AlignCenter(); |
void AlignRight(); |
void Zoom2x(); |
}; |
void DrawBufer::Init(int i_bufx, i_bufy, i_bufw, i_bufh) |
21,15 → 26,22 |
bufw = i_bufw; |
bufh = i_bufh; |
free(buf_data); |
buf_data = malloc(bufw * bufh * 4 + 8); //+1 for good luck |
buf_data = malloc(bufw * bufh * 4 + 8); |
ESDWORD[buf_data] = bufw; |
ESDWORD[buf_data+4] = bufh; |
} |
void DrawBufer::Show() |
if (zoomf != 1) |
{ |
PutPaletteImage(buf_data+8, bufw, bufh, bufx, bufy, 32,0); |
zbufx = bufx; |
zbufy = bufy; |
zbufw = bufw * zoomf; |
zbufh = bufh * zoomf; |
free(zbuf_data); |
zbuf_data = malloc(zbufw * zbufh * 4 + 8); |
ESDWORD[zbuf_data] = zbufw; |
ESDWORD[zbuf_data+4] = zbufh; |
} |
} |
void DrawBufer::Fill(dword fill_color) |
{ |
91,4 → 103,49 |
} |
void DrawBufer::Zoom2x() |
{ |
int i, s; |
dword point_x, max_i, zline_w, s_inc; |
point_x = 0; |
max_i = bufw * bufh * 4 + buf_data+8; |
s_inc = zoomf * 4; |
zline_w = zbufw * 4; |
for (i=buf_data+8, s=zbuf_data+8; i<max_i; i+=4, s+= s_inc) { |
ESDWORD[s] = ESDWORD[i]; |
ESDWORD[s+4] = ESDWORD[i]; |
ESDWORD[s+zline_w] = ESDWORD[i]; |
ESDWORD[s+zline_w+4] = ESDWORD[i]; |
if (zoomf==3) |
{ |
ESDWORD[s+8] = ESDWORD[i]; |
ESDWORD[zline_w+s+8] = ESDWORD[i]; |
ESDWORD[zline_w*2+s] = ESDWORD[i]; |
ESDWORD[zline_w*2+s+4] = ESDWORD[i]; |
ESDWORD[zline_w*2+s+8] = ESDWORD[i]; |
} |
point_x++; |
if (point_x >= bufw) |
{ |
s += zoomf - 1 * zline_w; |
point_x = 0; |
} |
} |
} |
void DrawBufer::Show() |
{ |
if (zoomf == 1) |
{ |
PutPaletteImage(buf_data+8, bufw, bufh, bufx, bufy, 32, 0); |
} |
else |
{ |
Zoom2x(); |
PutPaletteImage(zbuf_data+8, zbufw, zbufh, zbufx, zbufy, 32, 0); |
} |
} |
/programs/cmm/lib/gui.h |
---|
29,13 → 29,13 |
WriteText(-strlen(text)*6+w/2+x+1,y,0x80,color_t,text); |
} |
:void DrawCircle(int x, y, r) |
:void DrawCircle(int x, y, r, color) |
{ |
int i; |
float px=0, py=r, ii = r * 3.1415926 * 2; |
FOR (i = 0; i < ii; i++) |
{ |
PutPixel(px + x, y - py, 0); |
PutPixel(px + x, y - py, color); |
px = py / r + px; |
py = -px / r + py; |
} |