Rev 8330 | Rev 8336 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8330 | Rev 8332 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | 3 | ||
4 | #ifndef AUTOBUILD |
4 | #ifndef AUTOBUILD |
5 | #include "lang.h--" |
5 | #include "lang.h--" |
Line -... | Line 6... | ||
- | 6 | #endif |
|
- | 7 | ||
- | 8 | //===================================================// |
|
- | 9 | // // |
|
- | 10 | // LIB // |
|
6 | #endif |
11 | // // |
7 | 12 | //===================================================// |
|
8 | //libraries |
13 | |
9 | #define MEMSIZE 1024 * 1000 |
14 | #define MEMSIZE 1024 * 1000 |
10 | #include "..\lib\gui.h" |
15 | #include "..\lib\gui.h" |
11 | #include "..\lib\draw_buf.h" |
16 | #include "..\lib\draw_buf.h" |
12 | #include "..\lib\list_box.h" |
17 | #include "..\lib\list_box.h" |
13 | #include "..\lib\cursor.h" |
18 | #include "..\lib\cursor.h" |
14 | #include "..\lib\collection.h" |
19 | #include "..\lib\collection.h" |
Line 15... | Line -... | ||
15 | #include "..\lib\random.h" |
- | |
16 | #include "..\lib\clipboard.h" |
20 | #include "..\lib\random.h" |
17 | 21 | #include "..\lib\clipboard.h" |
|
18 | // *.obj libraries |
22 | |
19 | #include "..\lib\obj\box_lib.h" |
23 | #include "..\lib\obj\box_lib.h" |
20 | #include "..\lib\obj\libio.h" |
24 | #include "..\lib\obj\libio.h" |
21 | #include "..\lib\obj\libimg.h" |
25 | #include "..\lib\obj\libimg.h" |
22 | #include "..\lib\obj\http.h" |
26 | #include "..\lib\obj\http.h" |
Line 23... | Line -... | ||
23 | #include "..\lib\obj\iconv.h" |
- | |
24 | #include "..\lib\obj\proc_lib.h" |
27 | #include "..\lib\obj\iconv.h" |
25 | #include "..\lib\obj\netcode.h" |
28 | #include "..\lib\obj\proc_lib.h" |
26 | 29 | #include "..\lib\obj\netcode.h" |
|
27 | //useful patterns |
30 | |
Line -... | Line 31... | ||
- | 31 | #include "..\lib\patterns\history.h" |
|
- | 32 | #include "..\lib\patterns\simple_open_dialog.h" |
|
- | 33 | #include "..\lib\patterns\toolbar_button.h" |
|
28 | #include "..\lib\patterns\history.h" |
34 | #include "..\lib\patterns\restart_process.h" |
- | 35 | ||
Line 29... | Line 36... | ||
29 | #include "..\lib\patterns\simple_open_dialog.h" |
36 | //===================================================// |
Line 30... | Line 37... | ||
30 | #include "..\lib\patterns\toolbar_button.h" |
37 | // // |
31 | #include "..\lib\patterns\restart_process.h" |
38 | // DATA // |
32 | 39 | // // |
|
Line 33... | Line 40... | ||
33 | char editbox_icons[] = FROM "res/editbox_icons.raw"; |
40 | //===================================================// |
34 | 41 | ||
Line 35... | Line -... | ||
35 | char version[]="WebView 2.8 ALPHA PREVIEW"; |
- | |
36 | - | ||
37 | #include "texts.h" |
- | |
38 | #include "cache.h" |
- | |
39 | #include "show_src.h" |
- | |
40 | - | ||
41 | bool debug_mode = false; |
- | |
42 | bool show_images = false; |
- | |
43 | - | ||
44 | enum { |
- | |
45 | NEW_TAB=600, |
- | |
46 | ENCODINGS=700, |
- | |
47 | BACK_BUTTON=800, |
- | |
48 | FORWARD_BUTTON, |
- | |
49 | REFRESH_BUTTON, |
- | |
50 | GOTOURL_BUTTON, |
- | |
51 | CHANGE_ENCODING, |
- | |
52 | SANDWICH_BUTTON, |
- | |
53 | VIEW_SOURCE, |
- | |
54 | EDIT_SOURCE, |
- | |
55 | OPEN_FILE, |
- | |
56 | NEW_WINDOW, |
- | |
57 | VIEW_HISTORY, |
- | |
58 | DOWNLOAD_MANAGER, |
- | |
59 | CLEAR_CACHE, |
- | |
60 | UPDATE_BROWSER, |
42 | char version[]="WebView 2.8 ALPHA PREVIEW"; |
Line 61... | Line 43... | ||
61 | IN_NEW_TAB, |
43 | |
Line 62... | Line 44... | ||
62 | IN_NEW_WINDOW, |
44 | #include "const.h" |
Line 96... | Line 78... | ||
96 | 78 | ||
97 | char default_dir[] = "/rd/1"; |
79 | char default_dir[] = "/rd/1"; |
Line 98... | Line 80... | ||
98 | od_filter filter2 = { 22, "TXT\0HTM\0HTML\0DOCX\0\0" }; |
80 | od_filter filter2 = { 22, "TXT\0HTM\0HTML\0DOCX\0\0" }; |
99 | 81 | ||
100 | char editURL[URL_SIZE+1]; |
82 | char editURL[URL_SIZE+1]; |
Line 101... | Line 83... | ||
101 | edit_box address_box = {, PADDING+TSZE*2+PADDING+6, PADDING+3, 0xffffff, |
83 | edit_box omnibox_edit = {, PADDING+TSZE*2+PADDING+6, PADDING+3, 0xffffff, |
Line 102... | Line 84... | ||
102 | 0x94AECE, 0xffffff, 0xffffff,0x10000000,URL_SIZE-2,#editURL,0,,19,19}; |
84 | 0x94AECE, 0xffffff, 0xffffff,0x10000000,URL_SIZE-2,#editURL,0,,19,19}; |
Line -... | Line 85... | ||
- | 85 | ||
- | 86 | dword shared_url; |
|
- | 87 | ||
- | 88 | dword http_get_type; |
|
- | 89 | ||
- | 90 | //===================================================// |
|
103 | 91 | // // |
|
104 | dword shared_url; |
92 | // CODE // |
105 | 93 | // // |
|
106 | dword http_get_type; |
94 | //===================================================// |
107 | 95 | ||
Line 141... | Line 129... | ||
141 | ESDWORD[shared_url] = '\0'; |
129 | ESDWORD[shared_url] = '\0'; |
142 | } |
130 | } |
Line 143... | Line 131... | ||
143 | 131 | ||
144 | void main() |
132 | void main() |
145 | { |
133 | { |
146 | int i, redirect_count=0; |
134 | int redirect_count=0; |
147 | LoadLibraries(); |
135 | LoadLibraries(); |
148 | HandleParam(); |
136 | HandleParam(); |
149 | WB1.list.SetFont(8, 14, 10011000b); |
137 | WB1.list.SetFont(8, 14, 10011000b); |
150 | WB1.list.no_selection = true; |
138 | WB1.list.no_selection = true; |
151 | WB1.custom_encoding = -1; |
139 | WB1.custom_encoding = -1; |
152 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK); |
140 | @SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK); |
153 | loop() switch(@WaitEventTimeout(30)) |
141 | loop() switch(@WaitEventTimeout(30)) |
154 | { |
142 | { |
155 | case evMouse: |
143 | case evMouse: |
156 | edit_box_mouse stdcall (#address_box); |
144 | edit_box_mouse stdcall (#omnibox_edit); |
Line 157... | Line 145... | ||
157 | mouse.get(); |
145 | mouse.get(); |
Line 158... | Line 146... | ||
158 | 146 | ||
Line 189... | Line 177... | ||
189 | } |
177 | } |
190 | } |
178 | } |
191 | break; |
179 | break; |
Line 192... | Line 180... | ||
192 | 180 | ||
193 | case evButton: |
181 | case evButton: |
194 | ProcessEvent( @GetButtonID() ); |
182 | ProcessButtonClick( @GetButtonID() ); |
Line 195... | Line 183... | ||
195 | break; |
183 | break; |
196 | 184 | ||
197 | case evKey: |
- | |
198 | GetKeys(); |
- | |
199 | - | ||
200 | if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) { |
- | |
201 | if (key_scancode == SCAN_CODE_TAB) {EventActivatePreviousTab();break;} |
- | |
202 | } |
- | |
203 | - | ||
204 | if (ProcessCtrlKeyEvent()) break; |
- | |
205 | - | ||
206 | if (key_scancode == SCAN_CODE_F5) ProcessEvent(REFRESH_BUTTON); |
- | |
207 | - | ||
208 | if (address_box.flags & ed_focus) |
- | |
209 | { |
- | |
210 | if (key_scancode == SCAN_CODE_ENTER) { |
- | |
211 | ProcessEvent(key_scancode); |
- | |
212 | } else { |
185 | case evKey: |
213 | EAX = key_editbox; |
- | |
214 | edit_box_key stdcall(#address_box); |
- | |
215 | } |
- | |
216 | } else { |
- | |
217 | #define KEY_SCROLL_N 11 |
- | |
218 | if (SCAN_CODE_UP == key_scancode) for (i=0;i |
- | |
219 | if (SCAN_CODE_DOWN == key_scancode) for (i=0;i |
- | |
220 | if (key_scancode == SCAN_CODE_F6) {address_box.flags=ed_focus; DrawOmnibox();} |
186 | @GetKeys(); |
221 | if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage(); |
- | |
222 | else ProcessEvent(key_scancode); |
187 | edit_box_key stdcall(#omnibox_edit); |
Line 223... | Line 188... | ||
223 | } |
188 | ProcessKeyEvent(); |
224 | break; |
189 | break; |
225 | 190 | ||
226 | case evReDraw: |
191 | case evReDraw: |
227 | DefineAndDrawWindow(GetScreenWidth()-800/2-random(80), //40 |
192 | DefineAndDrawWindow(GetScreenWidth()-800/2-random(80), |
228 | GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0); |
193 | GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0); |
229 | GetProcessInfo(#Form, SelfInfo); |
194 | GetProcessInfo(#Form, SelfInfo); |
Line 236... | Line 201... | ||
236 | break; |
201 | break; |
Line 237... | Line 202... | ||
237 | 202 | ||
238 | case evNetwork: |
203 | case evNetwork: |
239 | if (http.transfer <= 0) break; |
204 | if (http.transfer <= 0) break; |
240 | http.receive(); |
- | |
241 | EventUpdateProgressBar(); |
205 | http.receive(); |
- | 206 | if (http_get_type==PAGE) CheckContentType(); |
|
242 | if (http_get_type==PAGE) CheckContentType(); |
207 | EventUpdateProgressBar(); |
243 | if (http.receive_result != 0) break; |
208 | if (http.receive_result != 0) break; |
244 | if (http.status_code >= 300) && (http.status_code < 400) |
209 | if (http.status_code >= 300) && (http.status_code < 400) |
245 | { |
210 | { |
246 | // Handle redirects |
211 | // Handle redirects |
Line 274... | Line 239... | ||
274 | ActivateWindow(GetProcessSlot(Form.ID)); |
239 | ActivateWindow(GetProcessSlot(Form.ID)); |
275 | } |
240 | } |
276 | } |
241 | } |
277 | } |
242 | } |
Line -... | Line 243... | ||
- | 243 | ||
- | 244 | ||
- | 245 | //===================================================// |
|
- | 246 | // // |
|
- | 247 | // EVENTS // |
|
- | 248 | // // |
|
- | 249 | //===================================================// |
|
278 | 250 | ||
- | 251 | void ProcessButtonClick(dword id__) |
|
- | 252 | { |
|
279 | bool ProcessCtrlKeyEvent() |
253 | switch (id__) |
- | 254 | { |
|
- | 255 | case 1: ExitProcess(); |
|
- | 256 | case TAB_CLOSE_ID...TAB_CLOSE_ID+TABS_MAX: EventTabClose(id__ - TAB_CLOSE_ID); return; |
|
- | 257 | case TAB_ID...TAB_ID+TABS_MAX: EventAllTabsClick(id__ - TAB_ID); return; |
|
- | 258 | case ENCODINGS...ENCODINGS+6: EventChangeEncodingAndLoadPage(id__-ENCODINGS); return; |
|
- | 259 | case NEW_WINDOW: RunProgram(#program_path, NULL); return; |
|
- | 260 | case NEW_TAB: if (!http.transfer) EventOpenNewTab(URL_SERVICE_HOMEPAGE); return; |
|
- | 261 | case SCAN_CODE_BS: |
|
- | 262 | case BACK_BUTTON: if (history.back()) OpenPage(history.current()); return; |
|
- | 263 | case FORWARD_BUTTON: if (history.forward()) OpenPage(history.current()); return; |
|
- | 264 | case GOTOURL_BUTTON: EventSubmitOmnibox(); return; |
|
- | 265 | case REFRESH_BUTTON: EventRefreshPage(); return; |
|
- | 266 | case CHANGE_ENCODING: EventShowEncodingsList(); return; |
|
- | 267 | case SANDWICH_BUTTON: EventShowMainMenu(); return; |
|
- | 268 | case VIEW_SOURCE: EventViewSource(); return; |
|
- | 269 | case EDIT_SOURCE: EventEditSource(); return; |
|
- | 270 | case VIEW_HISTORY: OpenPage(URL_SERVICE_HISTORY); return; |
|
- | 271 | case DOWNLOAD_MANAGER: EventOpenDownloader(""); return; |
|
- | 272 | case UPDATE_BROWSER: EventUpdateBrowser(); return; |
|
- | 273 | case CLEAR_CACHE: EventClearCache(); return; |
|
- | 274 | case IN_NEW_TAB: EventClickLink(TARGET_NEW_TAB); return; |
|
- | 275 | case IN_NEW_WINDOW: EventClickLink(TARGET_NEW_WINDOW); return; |
|
- | 276 | case COPY_LINK_URL: EventCopyLinkToClipboard(); return; |
|
- | 277 | case DOWNLOAD_LINK_CT: EventOpenDownloader( GetAbsoluteActiveURL() ); return; |
|
- | 278 | case OPEN_FILE: EventOpenDialog(); return; |
|
- | 279 | } |
|
- | 280 | } |
|
- | 281 | ||
- | 282 | bool ProcessKeyEvent() |
|
- | 283 | { |
|
- | 284 | if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) |
|
- | 285 | { |
|
- | 286 | if (key_scancode == SCAN_CODE_TAB) {EventActivatePreviousTab();return;} |
|
- | 287 | } |
|
280 | { |
288 | |
281 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) switch(key_scancode) |
289 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) switch(key_scancode) |
282 | { |
290 | { |
283 | case SCAN_CODE_KEY_O: EventOpenDialog(); return true; |
291 | case SCAN_CODE_KEY_O: EventOpenDialog(); return true; |
284 | case SCAN_CODE_KEY_H: ProcessEvent(VIEW_HISTORY); return true; |
292 | case SCAN_CODE_KEY_H: ProcessButtonClick(VIEW_HISTORY); return true; |
285 | case SCAN_CODE_KEY_U: EventViewSource(); return true; |
293 | case SCAN_CODE_KEY_U: EventViewSource(); return true; |
286 | case SCAN_CODE_KEY_T: EventOpenNewTab(URL_SERVICE_HOMEPAGE); return true; |
294 | case SCAN_CODE_KEY_T: EventOpenNewTab(URL_SERVICE_HOMEPAGE); return true; |
287 | case SCAN_CODE_KEY_N: RunProgram(#program_path, NULL); return true; |
295 | case SCAN_CODE_KEY_N: RunProgram(#program_path, NULL); return true; |
288 | case SCAN_CODE_KEY_J: ProcessEvent(DOWNLOAD_MANAGER); return true; |
296 | case SCAN_CODE_KEY_J: ProcessButtonClick(DOWNLOAD_MANAGER); return true; |
289 | case SCAN_CODE_KEY_R: ProcessEvent(REFRESH_BUTTON); return true; |
297 | case SCAN_CODE_KEY_R: ProcessButtonClick(REFRESH_BUTTON); return true; |
290 | case SCAN_CODE_ENTER: EventSeachWeb(); return true; |
298 | case SCAN_CODE_ENTER: EventSeachWeb(); return true; |
291 | case SCAN_CODE_LEFT: ProcessEvent(BACK_BUTTON); return true; |
299 | case SCAN_CODE_LEFT: ProcessButtonClick(BACK_BUTTON); return true; |
292 | case SCAN_CODE_RIGHT: ProcessEvent(FORWARD_BUTTON); return true; |
300 | case SCAN_CODE_RIGHT: ProcessButtonClick(FORWARD_BUTTON); return true; |
293 | case SCAN_CODE_KEY_W: EventCloseActiveTab(); return true; |
301 | case SCAN_CODE_KEY_W: EventCloseActiveTab(); return true; |
294 | case SCAN_CODE_TAB: EventActivateNextTab(); return true; |
302 | case SCAN_CODE_TAB: EventActivateNextTab(); return true; |
295 | default: return false; |
303 | default: return false; |
- | 304 | } |
|
- | 305 | ||
- | 306 | switch(key_scancode) |
|
- | 307 | { |
|
- | 308 | case SCAN_CODE_UP: EventScrollUpAndDown(SCAN_CODE_UP); return; |
|
- | 309 | case SCAN_CODE_DOWN: EventScrollUpAndDown(SCAN_CODE_DOWN); return; |
|
- | 310 | case SCAN_CODE_F6: {omnibox_edit.flags=ed_focus; DrawOmnibox();} return; |
|
- | 311 | case SCAN_CODE_F5: EventRefreshPage(); return; |
|
- | 312 | case SCAN_CODE_ENTER: if (omnibox_edit.flags & ed_focus) EventSubmitOmnibox(); return; |
|
- | 313 | case SCAN_CODE_F12: EventToggleDebugMode(); return; |
|
- | 314 | case SCAN_CODE_F11: show_images^=1; EventClearCache(); return; |
|
- | 315 | default: if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage(); return; |
|
296 | } |
316 | } |
Line 297... | Line 317... | ||
297 | } |
317 | } |
298 | 318 | ||
299 | void SetElementSizes() |
319 | void SetElementSizes() |
300 | { |
320 | { |
301 | address_box.width = Form.cwidth - address_box.left - 52 - 16; |
321 | omnibox_edit.width = Form.cwidth - omnibox_edit.left - 52 - 16; |
302 | WB1.list.SetSizes(0, TOOLBAR_H+TAB_H, Form.width - 10 - scroll_wv.size_x, |
322 | WB1.list.SetSizes(0, TOOLBAR_H+TAB_H, Form.width - 10 - scroll_wv.size_x, |
303 | Form.cheight - TOOLBAR_H - STATUSBAR_H - TAB_H, BASIC_LINE_H); |
323 | Form.cheight - TOOLBAR_H - STATUSBAR_H - TAB_H, BASIC_LINE_H); |
304 | WB1.list.wheel_size = 7 * BASIC_LINE_H; |
324 | WB1.list.wheel_size = 7 * BASIC_LINE_H; |
305 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w + 1; |
325 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w + 1; |
Line 306... | Line 326... | ||
306 | WB1.list.visible = WB1.list.h; |
326 | WB1.list.visible = WB1.list.h; |
307 | } |
327 | } |
308 | - | ||
309 | 328 | ||
310 | void draw_window() |
329 | |
Line 311... | Line 330... | ||
311 | { |
330 | void draw_window() |
Line 312... | Line 331... | ||
312 | int i; |
331 | { |
313 | bool burger_active = false; |
332 | bool burger_active = false; |
314 | if (menu_id == OPEN_FILE) burger_active = true; |
333 | if (menu_id == OPEN_FILE) burger_active = true; |
315 | 334 | ||
316 | SetElementSizes(); |
335 | SetElementSizes(); |
317 | 336 | ||
Line 318... | Line 337... | ||
318 | DrawBar(0,0, Form.cwidth,PADDING, sc.work); |
337 | DrawBar(0,0, Form.cwidth,PADDING, sc.work); |
319 | DrawBar(0,PADDING+TSZE+1, Form.cwidth,PADDING-1, sc.work); |
338 | DrawBar(0,PADDING+TSZE+1, Form.cwidth,PADDING-1, sc.work); |
320 | DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, MixColors(sc.work_dark, sc.work, 180)); |
339 | DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, MixColors(sc.work_dark, sc.work, 180)); |
Line 368... | Line 387... | ||
368 | LoadInternalPage(newbuf, newsize); |
387 | LoadInternalPage(newbuf, newsize); |
369 | free(newbuf); |
388 | free(newbuf); |
370 | } |
389 | } |
Line 371... | Line 390... | ||
371 | 390 | ||
372 | - | ||
373 | void ProcessEvent(dword id__) |
- | |
374 | { |
391 | |
375 | switch (id__) |
392 | void EventScrollUpAndDown(int _direction) |
376 | { |
- | |
377 | case 1: ExitProcess(); |
- | |
378 | case TAB_CLOSE_ID...TAB_CLOSE_ID+TABS_MAX: EventTabClose(id__ - TAB_CLOSE_ID); return; |
- | |
379 | case TAB_ID...TAB_ID+TABS_MAX: EventAllTabsClick(id__ - TAB_ID); return; |
- | |
380 | case ENCODINGS...ENCODINGS+6: EventChangeEncodingAndLoadPage(id__-ENCODINGS); return; |
- | |
381 | case NEW_WINDOW: RunProgram(#program_path, NULL); return; |
- | |
382 | case NEW_TAB: if (!http.transfer) EventOpenNewTab(URL_SERVICE_HOMEPAGE); return; |
- | |
383 | case SCAN_CODE_BS: |
- | |
384 | case BACK_BUTTON: if (history.back()) OpenPage(history.current()); return; |
- | |
385 | case FORWARD_BUTTON: if (history.forward()) OpenPage(history.current()); return; |
- | |
386 | case GOTOURL_BUTTON: |
- | |
387 | case SCAN_CODE_ENTER: EventSubmitOmnibox(); return; |
- | |
388 | case REFRESH_BUTTON: EventRefreshPage(); return; |
393 | { |
389 | case CHANGE_ENCODING: EventShowEncodingsList(); return; |
- | |
390 | case SANDWICH_BUTTON: EventShowMainMenu(); return; |
- | |
391 | case VIEW_SOURCE: EventViewSource(); return; |
- | |
392 | case EDIT_SOURCE: EventEditSource(); return; |
- | |
393 | case VIEW_HISTORY: OpenPage(URL_SERVICE_HISTORY); return; |
- | |
394 | case DOWNLOAD_MANAGER: EventOpenDownloader(""); return; |
- | |
395 | case UPDATE_BROWSER: EventUpdateBrowser(); return; |
- | |
396 | case CLEAR_CACHE: EventClearCache(); return; |
- | |
397 | case IN_NEW_TAB: EventClickLink(TARGET_NEW_TAB); return; |
- | |
398 | case IN_NEW_WINDOW: EventClickLink(TARGET_NEW_WINDOW); return; |
- | |
399 | case COPY_LINK_URL: EventCopyLinkToClipboard(); return; |
394 | int i; |
400 | case DOWNLOAD_LINK_CT: EventOpenDownloader( GetAbsoluteActiveURL() ); return; |
- | |
401 | case OPEN_FILE: EventOpenDialog(); return; |
395 | for (i=0;i |
402 | case SCAN_CODE_F12: EventToggleDebugMode(); return; |
396 | if (_direction == SCAN_CODE_UP) WB1.list.KeyUp(); |
- | 397 | if (_direction == SCAN_CODE_DOWN) WB1.list.KeyDown(); |
|
403 | case SCAN_CODE_F11: show_images^=1; return; |
398 | } |
Line 404... | Line 399... | ||
404 | } |
399 | WB1.DrawPage(); |
405 | } |
400 | } |
406 | 401 | ||
Line 727... | Line 722... | ||
727 | { |
722 | { |
728 | dword pct; |
723 | dword pct; |
729 | if (!http.transfer) return; |
724 | if (!http.transfer) return; |
730 | if (http_get_type==PAGE) && (prbar.max) pct = prbar.value*30/prbar.max; else pct = 10; |
725 | if (http_get_type==PAGE) && (prbar.max) pct = prbar.value*30/prbar.max; else pct = 10; |
731 | if (http_get_type==IMG) pct = WB1.page_img.getid * 70 / WB1.page_img.url.count + 30; |
726 | if (http_get_type==IMG) pct = WB1.page_img.getid * 70 / WB1.page_img.url.count + 30; |
732 | DrawBar(address_box.left-1, address_box.top+20, pct*address_box.width+16/100, 2, 0x72B7EB); |
727 | DrawBar(omnibox_edit.left-1, omnibox_edit.top+20, pct*omnibox_edit.width+16/100, 2, 0x72B7EB); |
733 | } |
728 | } |
Line 734... | Line 729... | ||
734 | 729 | ||
735 | void EventShowPageMenu() |
730 | void EventShowPageMenu() |
736 | { |
731 | { |
Line 763... | Line 758... | ||
763 | { |
758 | { |
764 | int click_id; |
759 | int click_id; |
765 | if (menu_id) { |
760 | if (menu_id) { |
766 | if (click_id = get_menu_click()) { |
761 | if (click_id = get_menu_click()) { |
767 | click_id += menu_id - 1; |
762 | click_id += menu_id - 1; |
768 | ProcessEvent(click_id); |
763 | ProcessButtonClick(click_id); |
769 | } |
764 | } |
770 | if (!menu_process_id) menu_id = NULL; |
765 | if (!menu_process_id) menu_id = NULL; |
771 | } |
766 | } |
772 | } |
767 | } |
Line 815... | Line 810... | ||
815 | } |
810 | } |
Line 816... | Line 811... | ||
816 | 811 | ||
817 | dword GetFileSize(dword _path) |
812 | dword GetFileSize(dword _path) |
818 | { |
813 | { |
819 | BDVK bdvk; |
814 | BDVK bdvk; |
820 | if (GetFileInfo(_path, #bdvk)!=0) { |
- | |
821 | return 0; |
- | |
822 | } else { |
815 | if (GetFileInfo(_path, #bdvk)!=0) return 0; |
823 | return bdvk.sizelo; |
- | |
824 | } |
816 | else return bdvk.sizelo; |
Line 825... | Line 817... | ||
825 | } |
817 | } |
826 | 818 | ||
827 | void EventUpdateBrowser() |
819 | void EventUpdateBrowser() |
828 | { |
820 | { |
829 | dword downloader_id, slot_n; |
821 | dword downloader_id, slot_n; |
830 | dword current_size; |
- | |
Line 831... | Line 822... | ||
831 | dword new_size; |
822 | dword current_size; |
Line 832... | Line 823... | ||
832 | int error; |
823 | dword new_size; |
833 | 824 | ||
Line 850... | Line 841... | ||
850 | if (current_size == new_size) { |
841 | if (current_size == new_size) { |
851 | notify(#update_is_current); |
842 | notify(#update_is_current); |
852 | return; |
843 | return; |
853 | } |
844 | } |
Line 854... | Line 845... | ||
854 | 845 | ||
855 | if (error = CopyFileAtOnce(new_size, "/tmp0/1/Downloads/WebView.com", #program_path)) { |
846 | if (CopyFileAtOnce(new_size, "/tmp0/1/Downloads/WebView.com", #program_path)) { |
856 | notify(#update_can_not_copy); |
847 | notify(#update_can_not_copy); |
857 | } else { |
848 | } else { |
858 | notify(#update_ok); |
849 | notify(#update_ok); |
859 | RunProgram(#program_path, history.current()); |
850 | RunProgram(#program_path, history.current()); |
Line 879... | Line 870... | ||
879 | 870 | ||
880 | void DrawOmnibox() |
871 | void DrawOmnibox() |
881 | { |
872 | { |
Line 882... | Line 873... | ||
882 | int imgxoff; |
873 | int imgxoff; |
883 | 874 | ||
884 | DrawOvalBorder(address_box.left-2, address_box.top-3, address_box.width+18, 24, sc.work_graph, |
875 | DrawOvalBorder(omnibox_edit.left-2, omnibox_edit.top-3, omnibox_edit.width+18, 24, sc.work_graph, |
885 | sc.work_graph, sc.work_graph, sc.work_dark); |
876 | sc.work_graph, sc.work_graph, sc.work_dark); |
886 | DrawBar(address_box.left-1, address_box.top-2, address_box.width+18, 1, 0xD8DCD8); |
877 | DrawBar(omnibox_edit.left-1, omnibox_edit.top-2, omnibox_edit.width+18, 1, 0xD8DCD8); |
887 | DrawBar(address_box.left-1, address_box.top-1, address_box.width+18, 1, address_box.color); |
878 | DrawBar(omnibox_edit.left-1, omnibox_edit.top-1, omnibox_edit.width+18, 1, omnibox_edit.color); |
888 | DrawBar(address_box.left-1, address_box.top, 1, 22, address_box.color); |
879 | DrawBar(omnibox_edit.left-1, omnibox_edit.top, 1, 22, omnibox_edit.color); |
889 | 880 | ||
890 | if (address_box.flags & ed_focus) address_box.flags = ed_focus; else address_box.flags = 0; |
881 | if (omnibox_edit.flags & ed_focus) omnibox_edit.flags = ed_focus; else omnibox_edit.flags = 0; |
891 | EditBox_UpdateText(#address_box, address_box.flags); |
882 | EditBox_UpdateText(#omnibox_edit, omnibox_edit.flags); |
892 | edit_box_draw stdcall(#address_box); |
883 | edit_box_draw stdcall(#omnibox_edit); |
893 | if (http.transfer) imgxoff = 16*23*3; else imgxoff = 0; |
884 | if (http.transfer) imgxoff = 16*23*3; else imgxoff = 0; |
Line 894... | Line 885... | ||
894 | _PutImage(address_box.left+address_box.width+1, address_box.top-1, 16, 23, imgxoff + #editbox_icons); |
885 | _PutImage(omnibox_edit.left+omnibox_edit.width+1, omnibox_edit.top-1, 16, 23, imgxoff + #editbox_icons); |
895 | DefineHiddenButton(address_box.left+address_box.width-1, address_box.top-2, 17, 23, REFRESH_BUTTON); |
886 | DefineHiddenButton(omnibox_edit.left+omnibox_edit.width-1, omnibox_edit.top-2, 17, 23, REFRESH_BUTTON); |
Line 896... | Line 887... | ||
896 | 887 | ||
897 | DrawProgress(); |
888 | DrawProgress(); |
898 | } |
889 | } |
899 | 890 | ||
900 | void SetOmniboxText(dword _text) |
891 | void SetOmniboxText(dword _text) |
901 | { |
892 | { |
Line 902... | Line 893... | ||
902 | strcpy(#editURL, _text); |
893 | strcpy(#editURL, _text); |
903 | address_box.flags=0; |
894 | omnibox_edit.flags=0; |