Rev 5509 | Rev 5530 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5509 | Rev 5519 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | #include "..\lib\patterns\libimg_load_skin.h" |
30 | #include "..\lib\patterns\libimg_load_skin.h" |
Line 31... | Line 31... | ||
31 | 31 | ||
Line 32... | Line 32... | ||
32 | char homepage[] = FROM "html\\homepage.htm"; |
32 | char homepage[] = FROM "html\\homepage.htm"; |
33 | 33 | ||
34 | #ifdef LANG_RUS |
34 | #ifdef LANG_RUS |
35 | char version[]=" ¥ªáâ®¢ë© ¡à 㧥à 1.0"; |
35 | char version[]=" ¥ªáâ®¢ë© ¡à 㧥à 1.1"; |
36 | ?define IMAGES_CACHE_CLEARED "íè ª à⨮ª ®ç¨é¥" |
36 | ?define IMAGES_CACHE_CLEARED "íè ª à⨮ª ®ç¨é¥" |
37 | ?define T_LAST_SLIDE "â® ¯®á«¥¤¨© á« ©¤" |
37 | ?define T_LAST_SLIDE "â® ¯®á«¥¤¨© á« ©¤" |
38 | char loading[] = " £à㧪 áâà ¨æë... |
38 | char loading[] = " £à㧪 áâà ¨æë... |
39 | char page_not_found[] = FROM "html\page_not_found_ru.htm"; |
39 | char page_not_found[] = FROM "html\page_not_found_ru.htm"; |
40 | char accept_language[]= "Accept-Language: ru\n"; |
40 | char accept_language[]= "Accept-Language: ru\n"; |
41 | #else |
41 | #else |
42 | char version[]=" Text-based Browser 1.0"; |
42 | char version[]=" Text-based Browser 1.1"; |
43 | ?define IMAGES_CACHE_CLEARED "Images cache cleared" |
43 | ?define IMAGES_CACHE_CLEARED "Images cache cleared" |
44 | ?define T_LAST_SLIDE "This slide is the last" |
44 | ?define T_LAST_SLIDE "This slide is the last" |
45 | char loading[] = "Loading... |
45 | char loading[] = "Loading... |
46 | char page_not_found[] = FROM "html\page_not_found_en.htm"; |
46 | char page_not_found[] = FROM "html\page_not_found_en.htm"; |
Line 47... | Line 47... | ||
47 | char accept_language[]= "Accept-Language: en\n"; |
47 | char accept_language[]= "Accept-Language: en\n"; |
48 | #endif |
48 | #endif |
49 | 49 | ||
Line 50... | Line 50... | ||
50 | proc_info Form; |
50 | proc_info Form; |
51 | #define WIN_W 640 |
51 | #define WIN_W 799 |
52 | #define WIN_H 480 |
52 | #define WIN_H 559 |
Line 68... | Line 68... | ||
68 | dword STATUSBAR_H =15; |
68 | dword STATUSBAR_H = 15; |
69 | dword col_bg; |
69 | dword col_bg; |
70 | dword panel_color; |
70 | dword panel_color; |
71 | dword border_color; |
71 | dword border_color; |
Line 72... | Line 72... | ||
72 | 72 | ||
73 | progress_bar progress_bar = {0, 10, 83, 150, 12, 0, 0, 100, 0xeeeEEE, 8072B7EBh, 0x9F9F9F}; |
73 | progress_bar wv_progress_bar = {0, 10, 83, 150, 12, 0, 0, 100, 0xeeeEEE, 8072B7EBh, 0x9F9F9F}; |
Line 74... | Line 74... | ||
74 | byte souce_mode = false; |
74 | byte souce_mode = false; |
75 | 75 | ||
76 | #include "..\TWB\TWB.c" |
76 | #include "..\TWB\TWB.c" |
Line 96... | Line 96... | ||
96 | dword image_data; |
96 | dword image_data; |
97 | image_data = DSDWORD[skin.image+24]; |
97 | image_data = DSDWORD[skin.image+24]; |
98 | col_bg = DSDWORD[image_data]; |
98 | col_bg = DSDWORD[image_data]; |
99 | panel_color = DSDWORD[skin.w*4*4 + image_data]; |
99 | panel_color = DSDWORD[skin.w*4*4 + image_data]; |
100 | border_color = DSDWORD[skin.w*4*7 + image_data]; |
100 | border_color = DSDWORD[skin.w*4*7 + image_data]; |
101 | progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data]; |
101 | wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data]; |
102 | $and col_bg, 0x00ffffff |
102 | $and col_bg, 0x00ffffff |
103 | $and panel_color, 0x00ffffff |
103 | $and panel_color, 0x00ffffff |
104 | $and border_color, 0x00ffffff |
104 | $and border_color, 0x00ffffff |
105 | $and progress_bar.progress_color, 0x00ffffff |
105 | $and wv_progress_bar.progress_color, 0x00ffffff |
106 | } |
106 | } |
Line 107... | Line 107... | ||
107 | 107 | ||
108 | void DrawProgress() |
108 | void DrawProgress() |
109 | { |
109 | { |
110 | unsigned long btn; |
110 | unsigned long btn; |
111 | //progressbar_draw stdcall(#progress_bar); |
111 | //progressbar_draw stdcall(#wv_progress_bar); |
112 | progress_bar.width = progress_bar.left = 0; |
112 | wv_progress_bar.width = wv_progress_bar.left = 0; |
113 | if (http_transfer == 0) return; |
113 | if (http_transfer == 0) return; |
114 | if (progress_bar.max) btn = address_box.width*progress_bar.value/progress_bar.max; else btn = 30; |
114 | if (wv_progress_bar.max) btn = address_box.width*wv_progress_bar.value/wv_progress_bar.max; else btn = 30; |
115 | DrawBar(address_box.left-1, address_box.top+14, btn, 2, progress_bar.progress_color); |
115 | DrawBar(address_box.left-1, address_box.top+14, btn, 2, wv_progress_bar.progress_color); |
Line 116... | Line 116... | ||
116 | } |
116 | } |
117 | 117 | ||
Line 129... | Line 129... | ||
129 | if (load_dll2(libimg, #libimg_init,1)!=0) notify("Error: library doesn't exists - libimg"); |
129 | if (load_dll2(libimg, #libimg_init,1)!=0) notify("Error: library doesn't exists - libimg"); |
130 | if (load_dll2(libHTTP, #http_lib_init,1)!=0) notify("Error: library doesn't exists - http"); |
130 | if (load_dll2(libHTTP, #http_lib_init,1)!=0) notify("Error: library doesn't exists - http"); |
131 | Libimg_LoadImage(#skin, abspath("wv_skin.png")); |
131 | Libimg_LoadImage(#skin, abspath("wv_skin.png")); |
132 | SetSkinColors(); |
132 | SetSkinColors(); |
Line -... | Line 133... | ||
- | 133 | ||
133 | 134 | WB1.DrawBuf.zoomf = 1; |
|
134 | Form.width=WIN_W; |
135 | Form.width=WIN_W; |
135 | Form.height=WIN_H; |
136 | Form.height=WIN_H; |
136 | SetElementSizes(); |
137 | SetElementSizes(); |
137 | if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME); |
138 | if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME); |
Line 181... | Line 182... | ||
181 | { |
182 | { |
182 | scroll_used=1; |
183 | scroll_used=1; |
183 | } |
184 | } |
184 | if (scroll_used) |
185 | if (scroll_used) |
185 | { |
186 | { |
- | 187 | m.y = m.y / WB1.DrawBuf.zoomf + 5; |
|
186 | half_scroll_size = WB1.list.h - 16 * WB1.list.visible / WB1.list.count - 3 /2; |
188 | half_scroll_size = WB1.list.h - 16 * WB1.list.visible / WB1.list.count - 3 /2; |
187 | if (half_scroll_size+WB1.list.y>m.y) || (m.y<0) || (m.y>4000) m.y=half_scroll_size+WB1.list.y; |
189 | if (half_scroll_size+WB1.list.y>m.y) || (m.y<0) || (m.y>4000) m.y=half_scroll_size+WB1.list.y; |
188 | btn=WB1.list.first; |
190 | btn=WB1.list.first; |
189 | WB1.list.first = m.y -half_scroll_size -WB1.list.y * WB1.list.count / WB1.list.h; |
191 | WB1.list.first = m.y -half_scroll_size -WB1.list.y * WB1.list.count / WB1.list.h; |
190 | if (WB1.list.visible+WB1.list.first>WB1.list.count) WB1.list.first=WB1.list.count-WB1.list.visible; |
192 | if (WB1.list.visible+WB1.list.first>WB1.list.count) WB1.list.first=WB1.list.count-WB1.list.visible; |
Line 198... | Line 200... | ||
198 | break; |
200 | break; |
199 | case evKey: |
201 | case evKey: |
200 | key = GetKey(); |
202 | key = GetKey(); |
Line 201... | Line 203... | ||
201 | 203 | ||
202 | if (address_box.flags & 0b10) SWITCH(key) |
204 | if (address_box.flags & 0b10) SWITCH(key) |
Line 203... | Line 205... | ||
203 | { CASE 52: CASE 53: CASE 54: CASE 180: CASE 181: goto _EDIT_MARK; } |
205 | { CASE 52: CASE 53: CASE 54: CASE 180: CASE 181: CASE 122: goto _EDIT_MARK; } |
Line 204... | Line 206... | ||
204 | 206 | ||
205 | Scan(key); |
207 | Scan(key); |
Line 220... | Line 222... | ||
220 | case evNetwork: |
222 | case evNetwork: |
221 | if (http_transfer > 0) { |
223 | if (http_transfer > 0) { |
222 | http_process stdcall (http_transfer); |
224 | http_process stdcall (http_transfer); |
223 | $push EAX |
225 | $push EAX |
224 | ESI = http_transfer; |
226 | ESI = http_transfer; |
225 | progress_bar.max = ESI.http_msg.content_length; |
227 | wv_progress_bar.max = ESI.http_msg.content_length; |
226 | if (progress_bar.value != ESI.http_msg.content_received) |
228 | if (wv_progress_bar.value != ESI.http_msg.content_received) |
227 | { |
229 | { |
228 | progress_bar.value = ESI.http_msg.content_received; |
230 | wv_progress_bar.value = ESI.http_msg.content_received; |
229 | DrawProgress(); |
231 | DrawProgress(); |
230 | } |
232 | } |
231 | $pop EAX |
233 | $pop EAX |
232 | if (EAX == 0) { |
234 | if (EAX == 0) { |
233 | ESI = http_transfer; |
235 | ESI = http_transfer; |
Line 286... | Line 288... | ||
286 | 288 | ||
287 | void SetElementSizes() |
289 | void SetElementSizes() |
288 | { |
290 | { |
289 | address_box.top = TOOLBAR_H-TAB_H/2-7+TAB_H; |
291 | address_box.top = TOOLBAR_H-TAB_H/2-7+TAB_H; |
290 | address_box.width = Form.cwidth - address_box.left - 25 - 22; |
292 | address_box.width = Form.cwidth - address_box.left - 25 - 22; |
291 | WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x, Form.cheight - TOOLBAR_H - STATUSBAR_H, 0, 11); |
293 | 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); |
292 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / 6; |
294 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / 6; |
293 | WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h; |
295 | WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h; |
294 | WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.line_h); |
296 | WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.line_h); |
Line 327... | Line 329... | ||
327 | DefineButton(Form.cwidth-23, address_box.top-2, 17, skin.h-1, 312+BT_HIDE, 0); |
329 | DefineButton(Form.cwidth-23, address_box.top-2, 17, skin.h-1, 312+BT_HIDE, 0); |
328 | img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-2, 16, skin.h, 85, 0); |
330 | img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-2, 16, skin.h, 85, 0); |
329 | //status bar |
331 | //status bar |
330 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg); |
332 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg); |
331 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color); |
333 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color); |
332 | progress_bar.top = Form.cheight - STATUSBAR_H + 4; |
334 | wv_progress_bar.top = Form.cheight - STATUSBAR_H + 4; |
333 | ShowPage(); |
335 | ShowPage(); |
334 | DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col); |
336 | DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col); |
335 | DrawProgress(); |
337 | DrawProgress(); |
336 | } |
338 | } |
Line 378... | Line 380... | ||
378 | strcpy(#URL, URL_SERVICE_HISTORY); |
380 | strcpy(#URL, URL_SERVICE_HISTORY); |
379 | OpenPage(); |
381 | OpenPage(); |
380 | return; |
382 | return; |
Line 381... | Line 383... | ||
381 | 383 | ||
- | 384 | case 006: //download manager |
|
382 | case 006: //download manager |
385 | if (!downloader_opened) { |
383 | DL_URL[0] = 0; |
386 | strcpy(#DL_URL, "http://"); |
- | 387 | CreateThread(#Downloader,#downloader_stak+4092); |
|
384 | CreateThread(#Downloader,#downloader_stak+4092); |
388 | } |
Line 385... | Line 389... | ||
385 | return; |
389 | return; |
386 | 390 | ||
387 | case BACK: |
391 | case BACK: |
Line 483... | Line 487... | ||
483 | case 312: |
487 | case 312: |
484 | SwitchToAnotherThread(); |
488 | SwitchToAnotherThread(); |
485 | m.y = TOOLBAR_H-6; |
489 | m.y = TOOLBAR_H-6; |
486 | m.x = Form.cwidth - 167; |
490 | m.x = Form.cwidth - 167; |
487 | CreateThread(#menu_rmb,#stak+4092); |
491 | CreateThread(#menu_rmb,#stak+4092); |
- | 492 | return; |
|
- | 493 | case 122: |
|
- | 494 | if (WB1.DrawBuf.zoomf==1) WB1.DrawBuf.zoomf=2; else WB1.DrawBuf.zoomf=1; |
|
- | 495 | Draw_Window(); |
|
488 | } |
496 | } |
489 | } |
497 | } |
Line 528... | Line 536... | ||
528 | URL[strrchr(#URL, '#')-1] = 0x00; |
536 | URL[strrchr(#URL, '#')-1] = 0x00; |
529 | } |
537 | } |
Line 530... | Line 538... | ||
530 | 538 | ||
Line 531... | Line 539... | ||
531 | PageLinks.GetAbsoluteURL(#URL); |
539 | PageLinks.GetAbsoluteURL(#URL); |
532 | 540 | ||
533 | if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1) |
541 | if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1) || (UrlExtIs(".kex")==1) |
534 | || (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1) |
542 | || (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1) |
535 | { |
543 | { |
536 | //notify(#URL); |
544 | //notify(#URL); |
537 | if (strcmpn(#URL,"http://:", 8)==0) |
545 | if (strcmpn(#URL,"http://", 7)==0) |
538 | { |
546 | { |
539 | strcpy(#DL_URL, #URL); |
547 | strcpy(#DL_URL, #URL); |
540 | CreateThread(#Downloader,#downloader_stak+4092); |
548 | CreateThread(#Downloader,#downloader_stak+4092); |
Line 570... | Line 578... | ||
570 | mem_Free(EAX); // free data |
578 | mem_Free(EAX); // free data |
571 | http_transfer=0; |
579 | http_transfer=0; |
572 | bufsize = 0; |
580 | bufsize = 0; |
573 | bufpointer = mem_Free(bufpointer); |
581 | bufpointer = mem_Free(bufpointer); |
574 | } |
582 | } |
575 | progress_bar.value = 0; |
583 | wv_progress_bar.value = 0; |
576 | img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, 52, 0); |
584 | img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, 52, 0); |
577 | } |
585 | } |
Line 578... | Line 586... | ||
578 | 586 | ||
579 | void SetPageDefaults() |
587 | void SetPageDefaults() |