Rev 7757 | Rev 7759 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7757 | Rev 7758 | ||
---|---|---|---|
Line 28... | Line 28... | ||
28 | #include "..\lib\patterns\history.h" |
28 | #include "..\lib\patterns\history.h" |
29 | #include "..\lib\patterns\http_downloader.h" |
29 | #include "..\lib\patterns\http_downloader.h" |
30 | #include "..\lib\patterns\simple_open_dialog.h" |
30 | #include "..\lib\patterns\simple_open_dialog.h" |
Line 31... | Line 31... | ||
31 | 31 | ||
32 | #include "show_src.h" |
- | |
33 | _http http = {0, 0, 0, 0, 0, 0, 0}; |
32 | #include "show_src.h" |
34 | #include "download_manager.h" |
33 | #include "download_manager.h" |
35 | _history history; |
34 | _history history; |
36 | #include "history.h" |
- | |
37 | 35 | #include "history.h" |
|
38 | bool debug_mode = false; |
- | |
39 | dword col_bg = 0xE3E2E2; |
- | |
40 | dword panel_color = 0xE3E2E2; |
- | |
41 | dword border_color = 0x787878; |
36 | bool debug_mode = false; |
Line -... | Line 37... | ||
- | 37 | #include "..\TWB\TWB.c" |
|
- | 38 | ||
42 | #include "..\TWB\TWB.c" |
39 | char version[]="WebView 2.0 Gold"; |
43 | - | ||
44 | #ifdef LANG_RUS |
40 | |
45 | char version[]="¥ªáâ®¢ë© ¡à 㧥à 2.0 beta4"; |
41 | #ifdef LANG_RUS |
46 | char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0"; |
42 | char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0"; |
47 | char homepage[] = FROM "html\\homepage_ru.htm""\0"; |
43 | char homepage[] = FROM "html\\homepage_ru.htm""\0"; |
48 | char help[] = FROM "html\\help_ru.htm""\0"; |
44 | char help[] = FROM "html\\help_ru.htm""\0"; |
49 | char accept_language[]= "Accept-Language: ru\n"; |
45 | char accept_language[]= "Accept-Language: ru\n"; |
50 | char rmb_menu[] = |
46 | char rmb_menu[] = |
- | 47 | "®á¬®âà¥âì ¨á室¨ª |
|
- | 48 | ¥¤ ªâ¨à®¢ âì ¨á室¨ª"; |
|
- | 49 | char main_menu[] = |
|
51 | "®á¬®âà¥âì ¨á室¨ª |
50 | "âªàëâì ä ©« |
52 | ¥¤ ªâ¨à®¢ âì ¨á室¨ª |
51 | ®¢®¥ ®ª® |
53 | áâ®à¨ï |
52 | áâ®à¨ï |
54 | ¥¥¤¦¥à § £à㧮ª"; |
53 | ¥¥¤¦¥à § £à㧮ª"; |
55 | char link_menu[] = |
54 | char link_menu[] = |
- | 55 | "®¯¨à®¢ âì áá뫪ã |
|
56 | "®¯¨à®¢ âì áá뫪ã |
56 | ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨"; |
57 | ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨"; |
- | |
58 | #else |
57 | char loading_text[] = " £à㧪 ..."; |
59 | char version[]="Text-based Browser 2.0 beta4"; |
58 | #else |
60 | char page_not_found[] = FROM "html\\page_not_found_en.htm""\0"; |
59 | char page_not_found[] = FROM "html\\page_not_found_en.htm""\0"; |
61 | char homepage[] = FROM "html\\homepage_en.htm""\0"; |
60 | char homepage[] = FROM "html\\homepage_en.htm""\0"; |
62 | char help[] = FROM "html\\help_en.htm""\0"; |
61 | char help[] = FROM "html\\help_en.htm""\0"; |
63 | char accept_language[]= "Accept-Language: en\n"; |
62 | char accept_language[]= "Accept-Language: en\n"; |
64 | char rmb_menu[] = |
63 | char rmb_menu[] = |
- | 64 | "View source |
|
- | 65 | Edit source"; |
|
- | 66 | char main_menu[] = |
|
65 | "View source |
67 | "Open local file |
66 | Edit source |
68 | New window |
67 | History |
69 | History |
68 | Download Manager"; |
70 | Download Manager"; |
69 | char link_menu[] = |
71 | char link_menu[] = |
- | 72 | "Copy link |
|
70 | "Copy link |
73 | Download link contents"; |
Line 71... | Line 74... | ||
71 | Download link contents"; |
74 | char loading_text[] = "Loading..."; |
Line 72... | Line 75... | ||
72 | #endif |
75 | #endif |
73 | 76 | ||
74 | #define URL_SIZE 4000 |
77 | #define URL_SIZE 4000 |
Line -... | Line 78... | ||
- | 78 | ||
75 | 79 | #define URL_SERVICE_HISTORY "WebView:history" |
|
- | 80 | #define URL_SERVICE_HOMEPAGE "WebView:home" |
|
76 | #define URL_SERVICE_HISTORY "WebView:history" |
81 | #define URL_SERVICE_HELP "WebView:help" |
77 | #define URL_SERVICE_HOMEPAGE "WebView:home" |
82 | |
Line 78... | Line 83... | ||
78 | #define URL_SERVICE_HELP "WebView:help" |
83 | #define PADDING 9 |
Line -... | Line 84... | ||
- | 84 | #define SKIN_Y 24 |
|
- | 85 | #define TSZE 25 |
|
79 | 86 | dword TOOLBAR_H = PADDING+TSZE+PADDING+2; |
|
Line 80... | Line 87... | ||
80 | #define TOOLBAR_GAPS 10 |
87 | dword STATUSBAR_H = 15; |
81 | dword TOOLBAR_H = 40; |
88 | |
82 | dword STATUSBAR_H = 15; |
89 | int action_buf; |
Line 95... | Line 102... | ||
95 | REFRESH_BUTTON, |
102 | REFRESH_BUTTON, |
96 | GOTOURL_BUTTON, |
103 | GOTOURL_BUTTON, |
97 | SANDWICH_BUTTON, |
104 | SANDWICH_BUTTON, |
98 | VIEW_SOURCE, |
105 | VIEW_SOURCE, |
99 | EDIT_SOURCE, |
106 | EDIT_SOURCE, |
- | 107 | OPEN_FILE, |
|
- | 108 | NEW_WINDOW, |
|
100 | VIEW_HISTORY, |
109 | VIEW_HISTORY, |
101 | DOWNLOAD_MANAGER, |
110 | DOWNLOAD_MANAGER, |
102 | COPY_LINK_URL, |
111 | COPY_LINK_URL, |
103 | DOWNLOAD_LINK_CONTENTS, |
112 | DOWNLOAD_LINK_CONTENTS, |
104 | }; |
113 | }; |
Line 105... | Line 114... | ||
105 | 114 | ||
106 | char default_dir[] = "/rd/1"; |
115 | char default_dir[] = "/rd/1"; |
Line 107... | Line 116... | ||
107 | od_filter filter2 = { 16, "TXT\0HTM\0HTML\0\0" }; |
116 | od_filter filter2 = { 16, "TXT\0HTM\0HTML\0\0" }; |
108 | 117 | ||
109 | char editURL[URL_SIZE+1]; |
118 | char editURL[URL_SIZE+1]; |
Line 110... | Line -... | ||
110 | edit_box address_box = {NULL,TOOLBAR_GAPS+TOOLBAR_GAPS+51,10,0xffffff,0x94AECE,0xffffff, |
- | |
Line 111... | Line 119... | ||
111 | 0xffffff,0x10000000,URL_SIZE-2,#editURL,0,NULL,19,19}; |
119 | edit_box address_box = {, PADDING+TSZE*2+PADDING+6, PADDING+3, 0xffffff, |
112 | 120 | 0x94AECE, 0xffffff, 0xffffff,0x10000000,URL_SIZE-2,#editURL,0,,19,19}; |
|
113 | #define SKIN_Y 24 |
121 | |
114 | 122 | ||
Line 141... | Line 149... | ||
141 | } |
149 | } |
142 | } |
150 | } |
Line 143... | Line 151... | ||
143 | 151 | ||
144 | void main() |
152 | void main() |
145 | { |
153 | { |
146 | int redirect_count = 0; |
- | |
147 | int i; |
154 | int i, btn, redirect_count=0; |
148 | LoadLibraries(); |
155 | LoadLibraries(); |
149 | CreateDir("/tmp0/1/downloads"); |
156 | CreateDir("/tmp0/1/downloads"); |
150 | Libimg_LoadImage(#skin, "/sys/toolbar.png"); |
157 | Libimg_LoadImage(#skin, "/sys/toolbar.png"); |
151 | HandleParam(); |
158 | HandleParam(); |
Line 169... | Line 176... | ||
169 | { |
176 | { |
170 | WB1.list.first = scroll_wv.position; |
177 | WB1.list.first = scroll_wv.position; |
171 | WB1.DrawPage(); |
178 | WB1.DrawPage(); |
172 | break; |
179 | break; |
173 | } |
180 | } |
- | 181 | if (mouse.up) && (! address_box.flags & ed_focus) && (address_box.flags & ed_shift_bac) |
|
- | 182 | { |
|
- | 183 | DrawOmnibox(); //reset text selection |
|
- | 184 | } |
|
174 | break; |
185 | break; |
Line 175... | Line 186... | ||
175 | 186 | ||
176 | case evButton: |
187 | case evButton: |
- | 188 | btn = GetButtonID(); |
|
177 | ProcessEvent(GetButtonID()); |
189 | if (1==btn) ExitProcess(); else ProcessEvent(btn); |
Line 178... | Line 190... | ||
178 | break; |
190 | break; |
179 | 191 | ||
180 | case evKey: |
192 | case evKey: |
Line 223... | Line 235... | ||
223 | } |
235 | } |
224 | DefineAndDrawWindow(GetScreenWidth()-800/2-random(80), |
236 | DefineAndDrawWindow(GetScreenWidth()-800/2-random(80), |
225 | GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0); |
237 | GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0); |
226 | GetProcessInfo(#Form, SelfInfo); |
238 | GetProcessInfo(#Form, SelfInfo); |
227 | system.color.get(); |
239 | system.color.get(); |
228 | col_bg = system.color.work; |
- | |
229 | if (Form.status_window>2) { DrawTitle(#header); break; } |
240 | if (Form.status_window>2) { DrawTitle(#header); break; } |
230 | if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; } |
241 | if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; } |
231 | if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; } |
242 | if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; } |
232 | draw_window(); |
243 | draw_window(); |
233 | break; |
244 | break; |
Line 234... | Line 245... | ||
234 | 245 | ||
235 | case evNetwork: |
246 | case evNetwork: |
236 | if (http.transfer > 0) { |
247 | if (http.transfer <= 0) break; |
237 | http.receive(); |
248 | http.receive(); |
238 | EventUpdateProgressBar(); |
249 | EventUpdateProgressBar(); |
239 | if (http.receive_result == 0) { |
- | |
240 | // Handle redirects |
250 | if (http.receive_result != 0) break; |
241 | if (http.status_code >= 300) && (http.status_code < 400) |
251 | if (http.status_code >= 300) && (http.status_code < 400) |
- | 252 | { |
|
- | 253 | // Handle redirects |
|
242 | { |
254 | if (redirect_count<=5) { |
243 | redirect_count++; |
- | |
244 | if (redirect_count>5) |
- | |
245 | { |
- | |
246 | notify("'Too many redirects.' -E"); |
- | |
247 | StopLoading(); |
- | |
248 | } |
- | |
249 | else |
- | |
250 | { |
255 | redirect_count++; |
251 | http.handle_redirect(); |
256 | http.handle_redirect(); |
252 | http.free(); |
257 | http.free(); |
253 | GetAbsoluteURL(#http.redirect_url, history.current()); |
- | |
254 | debug("Redirect: "); debugln(#http.redirect_url); |
258 | GetAbsoluteURL(#http.redirect_url, history.current()); |
255 | history.back(); |
259 | history.back(); |
- | 260 | OpenPage(#http.redirect_url); |
|
- | 261 | } else { |
|
- | 262 | notify("'Too many redirects.' -E"); |
|
256 | OpenPage(#http.redirect_url); |
263 | StopLoading(); |
257 | } |
264 | } |
258 | break; |
- | |
259 | } |
- | |
260 | redirect_count = 0; |
265 | } else { |
- | 266 | // Loading the page is complete, free resources |
|
261 | // Loading the page is complete, free resources |
267 | redirect_count = 0; |
262 | http.free(); |
268 | http.free(); |
263 | LoadInternalPage(http.content_pointer, http.content_received); |
269 | LoadInternalPage(http.content_pointer, http.content_received); |
264 | } |
270 | } |
265 | } |
271 | } |
266 | } |
- | |
Line 267... | Line 272... | ||
267 | } |
272 | } |
268 | 273 | ||
269 | void SetElementSizes() |
- | |
270 | { |
274 | void SetElementSizes() |
271 | address_box.top = TOOLBAR_H/2-10; |
275 | { |
272 | basic_line_h = calc(WB1.list.font_h * 130) / 100; |
276 | basic_line_h = calc(WB1.list.font_h * 130) / 100; |
273 | address_box.width = Form.cwidth - address_box.left - 55; |
277 | address_box.width = Form.cwidth - address_box.left - 52 - 16; |
274 | WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x, |
278 | WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x, |
275 | Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h); |
279 | Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h); |
276 | WB1.list.wheel_size = 7 * basic_line_h; |
280 | WB1.list.wheel_size = 7 * basic_line_h; |
277 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w + 1; |
- | |
278 | WB1.list.visible = WB1.list.h; |
- | |
279 | if (WB1.list.w!=WB1.DrawBuf.bufw) { |
- | |
280 | WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 400*20); |
- | |
281 | OpenPage(history.current()); |
281 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w + 1; |
Line 282... | Line 282... | ||
282 | } |
282 | WB1.list.visible = WB1.list.h; |
283 | } |
283 | } |
284 | - | ||
285 | 284 | ||
286 | - | ||
287 | void draw_window() |
285 | |
- | 286 | ||
- | 287 | void draw_window() |
|
- | 288 | { |
|
288 | { |
289 | int i; |
289 | DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color); |
290 | SetElementSizes(); |
290 | DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3); |
291 | |
291 | DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color); |
292 | DrawBar(0,0, Form.cwidth,PADDING, system.color.work); |
- | 293 | DrawBar(0,PADDING+TSZE+1, Form.cwidth,PADDING-1, system.color.work); |
|
- | 294 | DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, system.color.work_dark); |
|
- | 295 | DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, system.color.work_graph); |
|
292 | SetElementSizes(); |
296 | DrawBar(0, PADDING, address_box.left-2, TSZE+1, system.color.work); |
293 | DefineHiddenButton(TOOLBAR_GAPS, address_box.top-2, 24, skin.h-2, BACK_BUTTON); |
297 | DrawBar(address_box.left+address_box.width+18, PADDING, Form.cwidth-address_box.left-address_box.width-18, TSZE+1, system.color.work); |
- | 298 | ||
294 | DefineHiddenButton(TOOLBAR_GAPS+25, address_box.top-2, 24, skin.h-2, FORWARD_BUTTON); |
299 | DrawTopPanelButton(BACK_BUTTON, PADDING-1, 30); |
295 | img_draw stdcall(skin.image, TOOLBAR_GAPS-1, address_box.top-3, 51, skin.h, 0, SKIN_Y); |
300 | DrawTopPanelButton(FORWARD_BUTTON, PADDING+TSZE+PADDING-2, 31); |
- | 301 | DrawTopPanelButton(SANDWICH_BUTTON, Form.cwidth-PADDING-TSZE-3, -1); |
|
- | 302 | for (i=0; i<=2; i++) DrawBar(Form.cwidth-PADDING-TSZE+3, i*5+PADDING+7, 15, 3, system.color.work_graph); |
|
- | 303 | ||
- | 304 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, system.color.work); |
|
- | 305 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, system.color.work_graph); |
|
- | 306 | ||
- | 307 | DrawRectangle(WB1.list.x + WB1.list.w, WB1.list.y, scroll_wv.size_x, |
|
- | 308 | WB1.list.h-1, scroll_wv.bckg_col); |
|
- | 309 | ||
- | 310 | if (WB1.list.w!=WB1.DrawBuf.bufw) { |
|
- | 311 | WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 400*20); |
|
296 | DefineHiddenButton(address_box.left+address_box.width-4, address_box.top-2, 20, skin.h-3, REFRESH_BUTTON); |
312 | if (!strncmp(history.current(),"http",4)) { |
- | 313 | //nihuya ne izyachnoe reshenie, no pust' poka butet tak |
|
- | 314 | i=source_mode; |
|
297 | DefineHiddenButton(Form.cwidth-31, address_box.top-3, 24, skin.h-1, SANDWICH_BUTTON); |
315 | debugval("source_mode", source_mode); |
298 | img_draw stdcall(skin.image, Form.cwidth-27, address_box.top+1, 17, 18, 51, SKIN_Y); |
- | |
299 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg); |
316 | LoadInternalPage(#loading_text, sizeof(loading_text)); |
300 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color); |
317 | source_mode=i; |
301 | if (!header) { |
318 | debugval("source_mode", source_mode); |
302 | OpenPage(history.current()); |
- | |
303 | WB1.DrawScroller(); |
- | |
304 | } else { |
319 | } |
305 | WB1.DrawPage(); |
320 | OpenPage(history.current()); |
306 | DrawOmnibox(); |
321 | } else { |
Line 307... | Line 322... | ||
307 | DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, |
322 | WB1.DrawPage(); |
308 | scroll_wv.size_y-1, scroll_wv.bckg_col); |
323 | DrawOmnibox(); |
309 | } |
324 | } |
310 | DrawProgress(); |
325 | DrawProgress(); |
311 | } |
326 | } |
312 | 327 | ||
313 | 328 | ||
314 | void ProcessEvent(dword id__) |
329 | void ProcessEvent(dword id__) |
315 | { |
330 | { |
316 | switch (id__) |
331 | switch (id__) |
317 | { |
332 | { |
Line 340... | Line 355... | ||
340 | } else { |
355 | } else { |
341 | OpenPage(history.current()); |
356 | OpenPage(history.current()); |
342 | } |
357 | } |
343 | return; |
358 | return; |
344 | case SANDWICH_BUTTON: |
359 | case SANDWICH_BUTTON: |
345 | EventShowPageMenu(Form.cwidth - 215, TOOLBAR_H-6); |
360 | EventShowMainMenu(Form.cwidth - 215, TOOLBAR_H-6); |
346 | return; |
361 | return; |
347 | case VIEW_SOURCE: |
362 | case VIEW_SOURCE: |
348 | EventViewSource(); |
363 | EventViewSource(); |
349 | break; |
364 | break; |
350 | case EDIT_SOURCE: |
365 | case EDIT_SOURCE: |
Line 372... | Line 387... | ||
372 | if (!downloader_opened) { |
387 | if (!downloader_opened) { |
373 | strcpy(#downloader_edit, PageLinks.GetURL(PageLinks.active)); |
388 | strcpy(#downloader_edit, PageLinks.GetURL(PageLinks.active)); |
374 | CreateThread(#Downloader,#downloader_stak+4092); |
389 | CreateThread(#Downloader,#downloader_stak+4092); |
375 | } |
390 | } |
376 | return; |
391 | return; |
- | 392 | case OPEN_FILE: |
|
- | 393 | EventOpenDialog(); |
|
- | 394 | return; |
|
377 | case SCAN_CODE_F12: |
395 | case SCAN_CODE_F12: |
378 | debug_mode ^= 1; |
396 | debug_mode ^= 1; |
379 | if (debug_mode) notify("'Debug mode ON'-I"); |
397 | if (debug_mode) notify("'Debug mode ON'-I"); |
380 | else notify("'Debug mode OFF'-I"); |
398 | else notify("'Debug mode OFF'-I"); |
381 | return; |
399 | return; |
Line 441... | Line 459... | ||
441 | char new_url[URL_SIZE+1]; |
459 | char new_url[URL_SIZE+1]; |
Line 442... | Line 460... | ||
442 | 460 | ||
Line 443... | Line 461... | ||
443 | StopLoading(); |
461 | StopLoading(); |
- | 462 | ||
444 | 463 | strcpy(#editURL, _open_URL); |
|
Line 445... | Line 464... | ||
445 | strcpy(#editURL, _open_URL); |
464 | address_box.flags=0; |
Line 446... | Line 465... | ||
446 | DrawOmnibox(); |
465 | DrawOmnibox(); |
Line 459... | Line 478... | ||
459 | else if (!strcmp(#new_url, URL_SERVICE_HELP)) LoadInternalPage(#help, sizeof(help)); |
478 | else if (!strcmp(#new_url, URL_SERVICE_HELP)) LoadInternalPage(#help, sizeof(help)); |
460 | else if (!strcmp(#new_url, URL_SERVICE_HISTORY)) ShowHistory(); |
479 | else if (!strcmp(#new_url, URL_SERVICE_HISTORY)) ShowHistory(); |
461 | else LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
480 | else LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
462 | } else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) { |
481 | } else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) { |
463 | //WEB PAGE |
482 | //WEB PAGE |
464 | img_draw stdcall(skin.image, address_box.left+address_box.width+1, |
- | |
465 | address_box.top-3, 17, skin.h, 85, SKIN_Y); |
- | |
466 | - | ||
467 | if (ReplaceSpaceInUrl(#new_url, URL_SIZE)) { |
483 | if (ReplaceSpaceInUrl(#new_url, URL_SIZE)) { |
468 | strcpy(#editURL, #new_url); |
484 | strcpy(#editURL, #new_url); |
469 | DrawOmnibox(); |
- | |
470 | } |
485 | } |
Line 471... | Line 486... | ||
471 | 486 | ||
472 | if (!strncmp(#new_url,"http:",5)) { |
487 | if (!strncmp(#new_url,"http:",5)) { |
473 | http.get(#new_url); |
488 | http.get(#new_url); |
474 | } else if (!strncmp(#new_url,"https://",8)) { |
489 | } else if (!strncmp(#new_url,"https://",8)) { |
475 | strcpy(#new_url, "http://gate.aspero.pro/?site="); |
490 | strcpy(#new_url, "http://gate.aspero.pro/?site="); |
476 | strncat(#new_url, _open_URL, URL_SIZE); |
491 | strncat(#new_url, _open_URL, URL_SIZE); |
477 | http.get(#new_url); |
492 | http.get(#new_url); |
- | 493 | } |
|
- | 494 | ||
- | 495 | DrawOmnibox(); |
|
478 | } |
496 | |
479 | if (!http.transfer) { |
497 | if (!http.transfer) { |
480 | StopLoading(); |
498 | StopLoading(); |
481 | LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
499 | LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
482 | } |
500 | } |
Line 490... | Line 508... | ||
490 | 508 | ||
491 | void EventClickLink(dword _click_URL) |
509 | void EventClickLink(dword _click_URL) |
492 | { |
510 | { |
Line -... | Line 511... | ||
- | 511 | char new_url[URL_SIZE+1]; |
|
- | 512 | ||
- | 513 | if (open_new_window) { |
|
- | 514 | strcpy(#new_url, _click_URL); |
|
- | 515 | GetAbsoluteURL(#new_url, history.current()); |
|
- | 516 | RunProgram(#program_path, #new_url); |
|
- | 517 | return; |
|
493 | char new_url[URL_SIZE+1]; |
518 | } |
494 | 519 | ||
495 | if (ESBYTE[_click_URL]=='#') { |
520 | if (ESBYTE[_click_URL]=='#') { |
496 | if (anchors.get_pos_by_name(_click_URL+1)!=-1) { |
521 | if (anchors.get_pos_by_name(_click_URL+1)!=-1) { |
497 | WB1.list.first = anchors.get_pos_by_name(_click_URL+1); |
522 | WB1.list.first = anchors.get_pos_by_name(_click_URL+1); |
Line 567... | Line 592... | ||
567 | strncat(#new_url, #editURL, sizeof(new_url)-1); |
592 | strncat(#new_url, #editURL, sizeof(new_url)-1); |
568 | OpenPage(#new_url); |
593 | OpenPage(#new_url); |
569 | } |
594 | } |
570 | } |
595 | } |
Line 571... | Line -... | ||
571 | - | ||
572 | void DrawOmnibox() |
- | |
573 | { |
- | |
574 | int skin_x_offset; |
- | |
575 | - | ||
576 | DrawRectangle(address_box.left-2, address_box.top-3, address_box.width+5, 25,border_color); |
- | |
577 | - | ||
578 | DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 1,0xD8DCD8); |
- | |
579 | DrawBar(address_box.left-2, address_box.top-1, address_box.width+3, 1, address_box.color); |
- | |
580 | img_draw stdcall(skin.image, address_box.left-2, address_box.top-3, 2, skin.h, 102, SKIN_Y); |
- | |
581 | if (address_box.flags & ed_focus) address_box.flags = ed_focus; else address_box.flags = 0; |
- | |
582 | EditBox_UpdateText(#address_box, address_box.flags); |
- | |
583 | edit_box_draw stdcall(#address_box); |
- | |
584 | if (http.transfer > 0) skin_x_offset = 85; else skin_x_offset = 68; |
- | |
585 | img_draw stdcall(skin.image, address_box.left+address_box.width+1, |
- | |
586 | address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y); |
- | |
587 | } |
- | |
588 | 596 | ||
589 | void LoadInternalPage(dword _bufdata, _in_bufsize){ |
597 | void LoadInternalPage(dword _bufdata, _in_bufsize){ |
590 | if (!_bufdata) || (!_in_bufsize) { |
598 | if (!_bufdata) || (!_in_bufsize) { |
591 | LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
599 | LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
592 | } else { |
600 | } else { |
Line 623... | Line 631... | ||
623 | if (wv_progress_bar.max) { |
631 | if (wv_progress_bar.max) { |
624 | persent = wv_progress_bar.value*100/wv_progress_bar.max; |
632 | persent = wv_progress_bar.value*100/wv_progress_bar.max; |
625 | } else { |
633 | } else { |
626 | persent = 10; |
634 | persent = 10; |
627 | } |
635 | } |
628 | DrawBar(address_box.left-1, address_box.top+20, persent*address_box.width/100, 2, 0x72B7EB); |
636 | DrawBar(address_box.left-1, address_box.top+20, persent*address_box.width+16/100, 2, 0x72B7EB); |
629 | } |
637 | } |
Line 630... | Line 638... | ||
630 | 638 | ||
631 | void EventShowPageMenu(dword _left, _top) |
639 | void EventShowPageMenu(dword _left, _top) |
632 | { |
640 | { |
633 | menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #rmb_menu, VIEW_SOURCE); |
641 | menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #rmb_menu, VIEW_SOURCE); |
Line -... | Line 642... | ||
- | 642 | } |
|
- | 643 | ||
- | 644 | void EventShowMainMenu(dword _left, _top) |
|
- | 645 | { |
|
- | 646 | menu.show(Form.left+_left-6+77,Form.top+_top+skin_height-3, 140, #main_menu, OPEN_FILE); |
|
634 | } |
647 | } |
635 | 648 | ||
636 | void EventShowLinkMenu(dword _left, _top) |
649 | void EventShowLinkMenu(dword _left, _top) |
637 | { |
650 | { |
Line 676... | Line 689... | ||
676 | void DrawStatusBar(dword _status_text) |
689 | void DrawStatusBar(dword _status_text) |
677 | { |
690 | { |
678 | status_text.start_x = 10; |
691 | status_text.start_x = 10; |
679 | status_text.start_y = Form.cheight - STATUSBAR_H + 3; |
692 | status_text.start_y = Form.cheight - STATUSBAR_H + 3; |
680 | status_text.area_size_x = Form.cwidth - status_text.start_x -3; |
693 | status_text.area_size_x = Form.cwidth - status_text.start_x -3; |
681 | DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
694 | DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, system.color.work); |
682 | status_text.text_pointer = _status_text; |
695 | status_text.text_pointer = _status_text; |
683 | PathShow_prepare stdcall(#status_text); |
696 | PathShow_prepare stdcall(#status_text); |
684 | PathShow_draw stdcall(#status_text); |
697 | PathShow_draw stdcall(#status_text); |
685 | } |
698 | } |
Line -... | Line 699... | ||
- | 699 | ||
- | 700 | ||
- | 701 | void DrawOvalBorder(dword x,y,w,h, light,dark,right,dots) |
|
- | 702 | { |
|
- | 703 | DrawBar(x+1, y, w, 1, light); |
|
- | 704 | DrawBar(x+1, y+h+1, w, 1, dark); |
|
- | 705 | DrawBar(x, y+1, 1, h-1, light); |
|
- | 706 | DrawBar(x+w+1, y+2, 1, h-2, right); |
|
- | 707 | ||
- | 708 | PutPixel(x, y, dots); |
|
- | 709 | PutPixel(x+w+1, y+h+1, dots); |
|
- | 710 | PutPixel(x, y+h+1, dots); |
|
- | 711 | PutPixel(x+w+1, y, dots); |
|
- | 712 | ||
- | 713 | PutPixel(x, y+h, dark); |
|
- | 714 | PutPixel(x+w+1, y+1, light); |
|
- | 715 | PutPixel(x+w+1, y+h, dark); |
|
- | 716 | } |
|
- | 717 | ||
- | 718 | libimg_image top_icons; |
|
- | 719 | libimg_image left_icons; |
|
- | 720 | ||
- | 721 | void DrawTopPanelButton(dword _button_id, _x, signed int _icon_n) |
|
- | 722 | { |
|
- | 723 | static dword semi_white=0, bg_col, bg_col_light, bg_col_dark, bg_dark; |
|
- | 724 | if (!semi_white) { |
|
- | 725 | bg_col = system.color.work; |
|
- | 726 | if (GrayScaleImage(#bg_col,1,1)<65) bg_dark=true; else bg_dark=false; |
|
- | 727 | Libimg_LoadImage(#top_icons, "/sys/icons16.png"); |
|
- | 728 | Libimg_LoadImage(#left_icons, "/sys/icons16.png"); |
|
- | 729 | ||
- | 730 | semi_white = MixColors(system.color.work, 0xFFFfff, bg_dark*90 + 96); |
|
- | 731 | bg_col_dark = MixColors(system.color.work, system.color.work_graph, 90); |
|
- | 732 | bg_col_light = MixColors(semi_white, 0xFFFfff, bg_dark*90 + 10); |
|
- | 733 | ||
- | 734 | Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffFFFfff, semi_white); |
|
- | 735 | Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffCACBD6, MixColors(semi_white, 0, 220)); |
|
- | 736 | ||
- | 737 | Libimg_ReplaceColor(left_icons.image, left_icons.w, left_icons.h, 0xffFFFfff, system.color.work); |
|
- | 738 | Libimg_ReplaceColor(left_icons.image, left_icons.w, left_icons.h, 0xffCACBD6, MixColors(system.color.work, 0, 200)); |
|
- | 739 | } |
|
- | 740 | ||
- | 741 | DrawWideRectangle(_x+1, PADDING+1, TSZE, TSZE, 5, semi_white); |
|
- | 742 | DrawOvalBorder(_x, PADDING, TSZE, TSZE, bg_col_light, bg_col_dark, semi_white, system.color.work); |
|
- | 743 | ||
- | 744 | DefineHiddenButton(_x, PADDING, TSZE+1, TSZE+1, _button_id); |
|
- | 745 | if (_icon_n==-1) { |
|
- | 746 | DrawBar(_x+6, PADDING+5, 16, 16, semi_white); |
|
- | 747 | } else { |
|
- | 748 | img_draw stdcall(top_icons.image, _x+6, PADDING+5, 16, 16, 0, _icon_n*16); |
|
- | 749 | } |
|
- | 750 | } |
|
- | 751 | ||
- | 752 | void DrawOmnibox() |
|
- | 753 | { |
|
- | 754 | int skin_x_offset; |
|
- | 755 | ||
- | 756 | DrawOvalBorder(address_box.left-2, address_box.top-3, address_box.width+18, 24, system.color.work_graph, system.color.work_graph, system.color.work_graph, system.color.work_dark); |
|
- | 757 | DrawBar(address_box.left-1, address_box.top-2, address_box.width+18, 1, 0xD8DCD8); |
|
- | 758 | DrawBar(address_box.left-1, address_box.top-1, address_box.width+18, 1, address_box.color); |
|
- | 759 | DrawBar(address_box.left-1, address_box.top, 1, 22, address_box.color); |
|
- | 760 | ||
- | 761 | if (address_box.flags & ed_focus) address_box.flags = ed_focus; else address_box.flags = 0; |
|
- | 762 | EditBox_UpdateText(#address_box, address_box.flags); |
|
- | 763 | edit_box_draw stdcall(#address_box); |
|
- | 764 | if (http.transfer > 0) skin_x_offset = 85; else skin_x_offset = 68; |
|
- | 765 | img_draw stdcall(skin.image, address_box.left+address_box.width+1, |
|
- | 766 | address_box.top-1, 16, skin.h-3, skin_x_offset, SKIN_Y+2); |
|
- | 767 | DefineHiddenButton(address_box.left+address_box.width-1, address_box.top-2, 17, skin.h-3, REFRESH_BUTTON); |
|
- | 768 | ||
- | 769 | DrawProgress(); |
|
- | 770 | } |
|
- | 771 | ||
686 | 772 | ||
687 | stop:>280)>120)> |
773 | stop:65)>=2;>=5)>>=>280)>120)> |