Rev 7866 | Rev 7914 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7866 | Rev 7893 | ||
---|---|---|---|
1 | //Copyright 2007-2020 by Veliant & Leency |
1 | //Copyright 2007-2020 by Veliant & Leency |
2 | //Asper, lev, Lrz, Barsuk, Nable, hidnplayr... |
2 | //Asper, lev, Lrz, Barsuk, Nable, hidnplayr... |
3 | 3 | ||
4 | //Licence restriction: compiling this app for WIN32 is forbidden. |
4 | //Licence restriction: compiling this app for WIN32 is forbidden. |
5 | 5 | ||
6 | #ifndef AUTOBUILD |
6 | #ifndef AUTOBUILD |
7 | #include "lang.h--" |
7 | #include "lang.h--" |
8 | #endif |
8 | #endif |
9 | 9 | ||
10 | //libraries |
10 | //libraries |
11 | #define MEMSIZE 1024 * 1000 |
11 | #define MEMSIZE 1024 * 1000 |
12 | #include "..\lib\gui.h" |
12 | #include "..\lib\gui.h" |
13 | #include "..\lib\draw_buf.h" |
13 | #include "..\lib\draw_buf.h" |
14 | #include "..\lib\list_box.h" |
14 | #include "..\lib\list_box.h" |
15 | #include "..\lib\cursor.h" |
15 | #include "..\lib\cursor.h" |
16 | #include "..\lib\collection.h" |
16 | #include "..\lib\collection.h" |
17 | #include "..\lib\random.h" |
17 | #include "..\lib\random.h" |
18 | #include "..\lib\clipboard.h" |
18 | #include "..\lib\clipboard.h" |
19 | 19 | ||
20 | // *.obj libraries |
20 | // *.obj libraries |
21 | #include "..\lib\obj\box_lib.h" |
21 | #include "..\lib\obj\box_lib.h" |
22 | #include "..\lib\obj\libio.h" |
22 | #include "..\lib\obj\libio.h" |
23 | #include "..\lib\obj\libimg.h" |
23 | #include "..\lib\obj\libimg.h" |
24 | #include "..\lib\obj\http.h" |
24 | #include "..\lib\obj\http.h" |
25 | #include "..\lib\obj\iconv.h" |
25 | #include "..\lib\obj\iconv.h" |
26 | #include "..\lib\obj\proc_lib.h" |
26 | #include "..\lib\obj\proc_lib.h" |
27 | 27 | ||
28 | //useful patterns |
28 | //useful patterns |
29 | #include "..\lib\patterns\history.h" |
29 | #include "..\lib\patterns\history.h" |
30 | #include "..\lib\patterns\http_downloader.h" |
30 | #include "..\lib\patterns\http_downloader.h" |
31 | #include "..\lib\patterns\simple_open_dialog.h" |
31 | #include "..\lib\patterns\simple_open_dialog.h" |
32 | #include "..\lib\patterns\toolbar_button.h" |
32 | #include "..\lib\patterns\toolbar_button.h" |
33 | 33 | ||
34 | #include "texts.h" |
34 | #include "texts.h" |
35 | #include "cache.h" |
35 | #include "cache.h" |
36 | #include "show_src.h" |
36 | #include "show_src.h" |
37 | #include "download_manager.h" |
37 | #include "download_manager.h" |
38 | 38 | ||
39 | bool debug_mode = false; |
39 | bool debug_mode = false; |
40 | 40 | ||
41 | enum { |
41 | enum { |
42 | NEW_TAB=600, |
42 | NEW_TAB=600, |
43 | ENCODINGS=700, |
43 | ENCODINGS=700, |
44 | BACK_BUTTON=800, |
44 | BACK_BUTTON=800, |
45 | FORWARD_BUTTON, |
45 | FORWARD_BUTTON, |
46 | REFRESH_BUTTON, |
46 | REFRESH_BUTTON, |
47 | GOTOURL_BUTTON, |
47 | GOTOURL_BUTTON, |
48 | CHANGE_ENCODING, |
48 | CHANGE_ENCODING, |
49 | SANDWICH_BUTTON, |
49 | SANDWICH_BUTTON, |
50 | VIEW_SOURCE, |
50 | VIEW_SOURCE, |
51 | EDIT_SOURCE, |
51 | EDIT_SOURCE, |
52 | OPEN_FILE, |
52 | OPEN_FILE, |
53 | NEW_WINDOW, |
53 | NEW_WINDOW, |
54 | VIEW_HISTORY, |
54 | VIEW_HISTORY, |
55 | DOWNLOAD_MANAGER, |
55 | DOWNLOAD_MANAGER, |
56 | CLEAR_CACHE, |
56 | CLEAR_CACHE, |
57 | UPDATE_BROWSER, |
57 | UPDATE_BROWSER, |
58 | IN_NEW_TAB, |
58 | IN_NEW_TAB, |
59 | IN_NEW_WINDOW, |
59 | IN_NEW_WINDOW, |
60 | COPY_LINK_URL, |
60 | COPY_LINK_URL, |
61 | DOWNLOAD_LINK_CONTENTS, |
61 | DOWNLOAD_LINK_CONTENTS, |
62 | TAB_ID, |
62 | TAB_ID, |
63 | TAB_CLOSE_ID = 900 |
63 | TAB_CLOSE_ID = 900 |
64 | }; |
64 | }; |
65 | 65 | ||
66 | #include "..\TWB\TWB.c" //HTML Parser, a core component |
66 | #include "..\TWB\TWB.c" //HTML Parser, a core component |
67 | 67 | ||
68 | TWebBrowser WB1; |
68 | TWebBrowser WB1; |
69 | _history history; |
69 | _history history; |
70 | 70 | ||
71 | #include "history.h" |
71 | #include "history.h" |
72 | 72 | ||
73 | #define PADDING 9 |
73 | #define PADDING 9 |
74 | #define TSZE 25 |
74 | #define TSZE 25 |
75 | #define STATUSBAR_H 15 |
75 | #define STATUSBAR_H 15 |
76 | #define TAB_H 20 |
76 | #define TAB_H 20 |
77 | dword TOOLBAR_H = PADDING+TSZE+PADDING+2; |
77 | dword TOOLBAR_H = PADDING+TSZE+PADDING+2; |
78 | 78 | ||
79 | #define URL_SIZE 4000 |
79 | #define URL_SIZE 4000 |
80 | 80 | ||
81 | int action_buf; |
81 | int action_buf; |
82 | 82 | ||
83 | _http http = 0; |
83 | _http http = 0; |
84 | 84 | ||
85 | bool source_mode = false; |
85 | bool source_mode = false; |
86 | 86 | ||
87 | progress_bar wv_progress_bar; |
87 | progress_bar wv_progress_bar; |
88 | char stak[4096]; |
88 | char stak[4096]; |
89 | proc_info Form; |
89 | proc_info Form; |
90 | 90 | ||
91 | int menu_id=NULL; |
91 | int menu_id=NULL; |
92 | 92 | ||
93 | #include "tabs.h" |
93 | #include "tabs.h" |
94 | 94 | ||
95 | char default_dir[] = "/rd/1"; |
95 | char default_dir[] = "/rd/1"; |
96 | od_filter filter2 = { 22, "TXT\0HTM\0HTML\0DOCX\0\0" }; |
96 | od_filter filter2 = { 22, "TXT\0HTM\0HTML\0DOCX\0\0" }; |
97 | 97 | ||
98 | char editURL[URL_SIZE+1]; |
98 | char editURL[URL_SIZE+1]; |
99 | edit_box address_box = {, PADDING+TSZE*2+PADDING+6, PADDING+3, 0xffffff, |
99 | edit_box address_box = {, PADDING+TSZE*2+PADDING+6, PADDING+3, 0xffffff, |
100 | 0x94AECE, 0xffffff, 0xffffff,0x10000000,URL_SIZE-2,#editURL,0,,19,19}; |
100 | 0x94AECE, 0xffffff, 0xffffff,0x10000000,URL_SIZE-2,#editURL,0,,19,19}; |
101 | 101 | ||
102 | char editbox_icons[] = FROM "editbox_icons.raw"; |
102 | char editbox_icons[] = FROM "editbox_icons.raw"; |
103 | 103 | ||
104 | 104 | ||
105 | void LoadLibraries() |
105 | void LoadLibraries() |
106 | { |
106 | { |
107 | load_dll(boxlib, #box_lib_init,0); |
107 | load_dll(boxlib, #box_lib_init,0); |
108 | load_dll(libio, #libio_init,1); |
108 | load_dll(libio, #libio_init,1); |
109 | load_dll(libimg, #libimg_init,1); |
109 | load_dll(libimg, #libimg_init,1); |
110 | load_dll(libHTTP, #http_lib_init,1); |
110 | load_dll(libHTTP, #http_lib_init,1); |
111 | load_dll(iconv_lib, #iconv_open,0); |
111 | load_dll(iconv_lib, #iconv_open,0); |
112 | load_dll(Proc_lib, #OpenDialog_init,0); |
112 | load_dll(Proc_lib, #OpenDialog_init,0); |
113 | OpenDialog_init stdcall (#o_dialog); |
113 | OpenDialog_init stdcall (#o_dialog); |
114 | } |
114 | } |
115 | 115 | ||
116 | void HandleParam() |
116 | void HandleParam() |
117 | { |
117 | { |
118 | if (param) { |
118 | if (param) { |
119 | if (!strncmp(#param, "-download_and_exit ", 19)) { |
119 | if (!strncmp(#param, "-download_and_exit ", 19)) { |
120 | download_and_exit = true; |
120 | download_and_exit = true; |
121 | strcpy(#downloader_edit, #param+19); |
121 | strcpy(#downloader_edit, #param+19); |
122 | Downloader(); |
122 | Downloader(); |
123 | ExitProcess(); |
123 | ExitProcess(); |
124 | } else if (!strncmp(#param, "-download ", 10)) { |
124 | } else if (!strncmp(#param, "-download ", 10)) { |
125 | strcpy(#downloader_edit, #param+10); |
125 | strcpy(#downloader_edit, #param+10); |
126 | //CreateThread(#Downloader,#downloader_stak+4092); |
126 | //CreateThread(#Downloader,#downloader_stak+4092); |
127 | Downloader(); |
127 | Downloader(); |
128 | ExitProcess(); |
128 | ExitProcess(); |
129 | } else if (!strncmp(#param, "-source ", 8)) { |
129 | } else if (!strncmp(#param, "-source ", 8)) { |
130 | source_mode = true; |
130 | source_mode = true; |
131 | history.add(#param + 8); |
131 | history.add(#param + 8); |
132 | } else { |
132 | } else { |
133 | history.add(#param); |
133 | history.add(#param); |
134 | } |
134 | } |
135 | } else { |
135 | } else { |
136 | history.add(URL_SERVICE_HOMEPAGE); |
136 | history.add(URL_SERVICE_HOMEPAGE); |
137 | } |
137 | } |
138 | } |
138 | } |
139 | 139 | ||
140 | void main() |
140 | void main() |
141 | { |
141 | { |
142 | int i, btn, redirect_count=0; |
142 | int i, btn, redirect_count=0; |
143 | LoadLibraries(); |
143 | LoadLibraries(); |
144 | CreateDir("/tmp0/1/Downloads"); |
144 | CreateDir("/tmp0/1/Downloads"); |
145 | //CreateDir("/tmp0/1/WebView_Cache"); |
145 | //CreateDir("/tmp0/1/WebView_Cache"); |
146 | HandleParam(); |
146 | HandleParam(); |
147 | WB1.list.SetFont(8, 14, 10011000b); |
147 | WB1.list.SetFont(8, 14, 10011000b); |
148 | WB1.list.no_selection = true; |
148 | WB1.list.no_selection = true; |
149 | WB1.custom_encoding = -1; |
149 | WB1.custom_encoding = -1; |
150 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK); |
150 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK); |
151 | loop() switch(WaitEvent()) |
151 | loop() switch(WaitEvent()) |
152 | { |
152 | { |
153 | case evMouse: |
153 | case evMouse: |
154 | edit_box_mouse stdcall (#address_box); |
154 | edit_box_mouse stdcall (#address_box); |
155 | mouse.get(); |
155 | mouse.get(); |
156 | if (PageLinks.HoverAndProceed(mouse.x, WB1.list.first + mouse.y, WB1.list.y, WB1.list.first)) |
156 | if (PageLinks.HoverAndProceed(mouse.x, WB1.list.first + mouse.y, WB1.list.y, WB1.list.first)) |
157 | && (mouse.pkm) && (mouse.up) { |
157 | && (mouse.pkm) && (mouse.up) { |
158 | if (WB1.list.MouseOver(mouse.x, mouse.y)) EventShowPageMenu(); |
158 | if (WB1.list.MouseOver(mouse.x, mouse.y)) EventShowPageMenu(); |
159 | break; |
159 | break; |
160 | } |
160 | } |
161 | if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage(); |
161 | if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage(); |
162 | scrollbar_v_mouse (#scroll_wv); |
162 | scrollbar_v_mouse (#scroll_wv); |
163 | if (WB1.list.first != scroll_wv.position) |
163 | if (WB1.list.first != scroll_wv.position) |
164 | { |
164 | { |
165 | WB1.list.first = scroll_wv.position; |
165 | WB1.list.first = scroll_wv.position; |
166 | WB1.DrawPage(); |
166 | WB1.DrawPage(); |
167 | break; |
167 | break; |
168 | } |
168 | } |
169 | if (mouse.up) && (! address_box.flags & ed_focus) && (address_box.flags & ed_shift_bac) |
169 | if (mouse.up) && (! address_box.flags & ed_focus) && (address_box.flags & ed_shift_bac) |
170 | { |
170 | { |
171 | DrawOmnibox(); //reset text selection |
171 | DrawOmnibox(); //reset text selection |
172 | } |
172 | } |
173 | break; |
173 | break; |
174 | 174 | ||
175 | case evButton: |
175 | case evButton: |
176 | btn = GetButtonID(); |
176 | btn = GetButtonID(); |
177 | if (1==btn) ExitProcess(); else ProcessEvent(btn); |
177 | if (1==btn) ExitProcess(); else ProcessEvent(btn); |
178 | break; |
178 | break; |
179 | 179 | ||
180 | case evKey: |
180 | case evKey: |
181 | GetKeys(); |
181 | GetKeys(); |
182 | //if (key_scancode == SCAN_CODE_F1) {DebugTabs();break;} |
182 | //if (key_scancode == SCAN_CODE_F1) {DebugTabs();break;} |
183 | 183 | ||
184 | if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) { |
184 | if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) { |
185 | if (key_scancode == SCAN_CODE_TAB) {EventActivatePreviousTab();break;} |
185 | if (key_scancode == SCAN_CODE_TAB) {EventActivatePreviousTab();break;} |
186 | } |
186 | } |
187 | 187 | ||
188 | if (ProcessCtrlKeyEvent()) break; |
188 | if (ProcessCtrlKeyEvent()) break; |
189 | 189 | ||
190 | if (key_scancode == SCAN_CODE_F5) ProcessEvent(REFRESH_BUTTON); |
190 | if (key_scancode == SCAN_CODE_F5) ProcessEvent(REFRESH_BUTTON); |
191 | 191 | ||
192 | if (address_box.flags & ed_focus) |
192 | if (address_box.flags & ed_focus) |
193 | { |
193 | { |
194 | if (key_scancode == SCAN_CODE_ENTER) { |
194 | if (key_scancode == SCAN_CODE_ENTER) { |
195 | ProcessEvent(key_scancode); |
195 | ProcessEvent(key_scancode); |
196 | } else { |
196 | } else { |
197 | EAX = key_editbox; |
197 | EAX = key_editbox; |
198 | edit_box_key stdcall(#address_box); |
198 | edit_box_key stdcall(#address_box); |
199 | } |
199 | } |
200 | } else { |
200 | } else { |
201 | #define KEY_SCROLL_N 11 |
201 | #define KEY_SCROLL_N 11 |
202 | if (SCAN_CODE_UP == key_scancode) for (i=0;i |
202 | if (SCAN_CODE_UP == key_scancode) for (i=0;i |
203 | if (SCAN_CODE_DOWN == key_scancode) for (i=0;i |
203 | if (SCAN_CODE_DOWN == key_scancode) for (i=0;i |
204 | if (key_scancode == SCAN_CODE_F6) {address_box.flags=ed_focus; DrawOmnibox();} |
204 | if (key_scancode == SCAN_CODE_F6) {address_box.flags=ed_focus; DrawOmnibox();} |
205 | if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage(); |
205 | if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage(); |
206 | else ProcessEvent(key_scancode); |
206 | else ProcessEvent(key_scancode); |
207 | } |
207 | } |
208 | break; |
208 | break; |
209 | 209 | ||
210 | case evReDraw: |
210 | case evReDraw: |
211 | DefineAndDrawWindow(GetScreenWidth()-800/2-random(80), //40 |
211 | DefineAndDrawWindow(GetScreenWidth()-800/2-random(80), //40 |
212 | GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0); |
212 | GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0); |
213 | GetProcessInfo(#Form, SelfInfo); |
213 | GetProcessInfo(#Form, SelfInfo); |
214 | ProcessMenuClick(); |
214 | ProcessMenuClick(); |
215 | sc.get(); |
215 | sc.get(); |
216 | if (Form.status_window>2) break; |
216 | if (Form.status_window>2) break; |
217 | if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; } |
217 | if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; } |
218 | if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; } |
218 | if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; } |
219 | draw_window(); |
219 | draw_window(); |
220 | break; |
220 | break; |
221 | 221 | ||
222 | case evNetwork: |
222 | case evNetwork: |
223 | if (http.transfer <= 0) break; |
223 | if (http.transfer <= 0) break; |
224 | http.receive(); |
224 | http.receive(); |
225 | EventUpdateProgressBar(); |
225 | EventUpdateProgressBar(); |
226 | if (http.receive_result != 0) break; |
226 | if (http.receive_result != 0) break; |
227 | if (http.status_code >= 300) && (http.status_code < 400) |
227 | if (http.status_code >= 300) && (http.status_code < 400) |
228 | { |
228 | { |
229 | // Handle redirects |
229 | // Handle redirects |
230 | if (redirect_count<=5) { |
230 | if (redirect_count<=5) { |
231 | redirect_count++; |
231 | redirect_count++; |
232 | http.handle_redirect(); |
232 | http.handle_redirect(); |
233 | http.free(); |
233 | http.free(); |
234 | GetAbsoluteURL(#http.redirect_url, history.current()); |
234 | GetAbsoluteURL(#http.redirect_url, history.current()); |
235 | history.back(); |
235 | history.back(); |
236 | OpenPage(#http.redirect_url); |
236 | OpenPage(#http.redirect_url); |
237 | } else { |
237 | } else { |
238 | notify("'Too many redirects.' -E"); |
238 | notify("'Too many redirects.' -E"); |
239 | StopLoading(); |
239 | StopLoading(); |
240 | redirect_count = 0; |
240 | redirect_count = 0; |
241 | } |
241 | } |
242 | } else { |
242 | } else { |
243 | // Loading the page is complete, free resources |
243 | // Loading the page is complete, free resources |
244 | redirect_count = 0; |
244 | redirect_count = 0; |
245 | http.free(); |
245 | http.free(); |
246 | pages_cache.add(history.current(), http.content_pointer, http.content_received); |
246 | pages_cache.add(history.current(), http.content_pointer, http.content_received); |
247 | LoadInternalPage(http.content_pointer, http.content_received); |
247 | LoadInternalPage(http.content_pointer, http.content_received); |
248 | } |
248 | } |
249 | } |
249 | } |
250 | } |
250 | } |
251 | 251 | ||
252 | bool ProcessCtrlKeyEvent() |
252 | bool ProcessCtrlKeyEvent() |
253 | { |
253 | { |
254 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) switch(key_scancode) |
254 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) switch(key_scancode) |
255 | { |
255 | { |
256 | case SCAN_CODE_KEY_O: |
256 | case SCAN_CODE_KEY_O: |
257 | EventOpenDialog(); |
257 | EventOpenDialog(); |
258 | return true; |
258 | return true; |
259 | case SCAN_CODE_KEY_H: |
259 | case SCAN_CODE_KEY_H: |
260 | ProcessEvent(VIEW_HISTORY); |
260 | ProcessEvent(VIEW_HISTORY); |
261 | return true; |
261 | return true; |
262 | case SCAN_CODE_KEY_U: |
262 | case SCAN_CODE_KEY_U: |
263 | EventViewSource(); |
263 | EventViewSource(); |
264 | return true; |
264 | return true; |
265 | case SCAN_CODE_KEY_T: |
265 | case SCAN_CODE_KEY_T: |
266 | EventOpenNewTab(URL_SERVICE_HOMEPAGE); |
266 | EventOpenNewTab(URL_SERVICE_HOMEPAGE); |
267 | return true; |
267 | return true; |
268 | case SCAN_CODE_KEY_N: |
268 | case SCAN_CODE_KEY_N: |
269 | RunProgram(#program_path, NULL); |
269 | RunProgram(#program_path, NULL); |
270 | return true; |
270 | return true; |
271 | case SCAN_CODE_KEY_J: |
271 | case SCAN_CODE_KEY_J: |
272 | ProcessEvent(DOWNLOAD_MANAGER); |
272 | ProcessEvent(DOWNLOAD_MANAGER); |
273 | return true; |
273 | return true; |
274 | case SCAN_CODE_KEY_R: |
274 | case SCAN_CODE_KEY_R: |
275 | ProcessEvent(REFRESH_BUTTON); |
275 | ProcessEvent(REFRESH_BUTTON); |
276 | return true; |
276 | return true; |
277 | case SCAN_CODE_ENTER: |
277 | case SCAN_CODE_ENTER: |
278 | EventSeachWeb(); |
278 | EventSeachWeb(); |
279 | return true; |
279 | return true; |
280 | case SCAN_CODE_LEFT: |
280 | case SCAN_CODE_LEFT: |
281 | ProcessEvent(BACK_BUTTON); |
281 | ProcessEvent(BACK_BUTTON); |
282 | return true; |
282 | return true; |
283 | case SCAN_CODE_RIGHT: |
283 | case SCAN_CODE_RIGHT: |
284 | ProcessEvent(FORWARD_BUTTON); |
284 | ProcessEvent(FORWARD_BUTTON); |
285 | return true; |
285 | return true; |
286 | case SCAN_CODE_KEY_W: |
286 | case SCAN_CODE_KEY_W: |
287 | EventCloseActiveTab(); |
287 | EventCloseActiveTab(); |
288 | return true; |
288 | return true; |
289 | case SCAN_CODE_TAB: |
289 | case SCAN_CODE_TAB: |
290 | EventActivateNextTab(); |
290 | EventActivateNextTab(); |
291 | return true; |
291 | return true; |
292 | } |
292 | } |
293 | return false; |
293 | return false; |
294 | } |
294 | } |
295 | 295 | ||
296 | void SetElementSizes() |
296 | void SetElementSizes() |
297 | { |
297 | { |
298 | address_box.width = Form.cwidth - address_box.left - 52 - 16; |
298 | address_box.width = Form.cwidth - address_box.left - 52 - 16; |
299 | WB1.list.SetSizes(0, TOOLBAR_H+TAB_H, Form.width - 10 - scroll_wv.size_x, |
299 | WB1.list.SetSizes(0, TOOLBAR_H+TAB_H, Form.width - 10 - scroll_wv.size_x, |
300 | Form.cheight - TOOLBAR_H - STATUSBAR_H - TAB_H, BASIC_LINE_H); |
300 | Form.cheight - TOOLBAR_H - STATUSBAR_H - TAB_H, BASIC_LINE_H); |
301 | WB1.list.wheel_size = 7 * BASIC_LINE_H; |
301 | WB1.list.wheel_size = 7 * BASIC_LINE_H; |
302 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w + 1; |
302 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w + 1; |
303 | WB1.list.visible = WB1.list.h; |
303 | WB1.list.visible = WB1.list.h; |
304 | } |
304 | } |
305 | 305 | ||
306 | 306 | ||
307 | void draw_window() |
307 | void draw_window() |
308 | { |
308 | { |
309 | int i; |
309 | int i; |
310 | SetElementSizes(); |
310 | SetElementSizes(); |
311 | 311 | ||
312 | DrawBar(0,0, Form.cwidth,PADDING, sc.work); |
312 | DrawBar(0,0, Form.cwidth,PADDING, sc.work); |
313 | DrawBar(0,PADDING+TSZE+1, Form.cwidth,PADDING-1, sc.work); |
313 | DrawBar(0,PADDING+TSZE+1, Form.cwidth,PADDING-1, sc.work); |
314 | DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, MixColors(sc.work_dark, sc.work, 180)); |
314 | DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, MixColors(sc.work_dark, sc.work, 180)); |
315 | DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, sc.work_graph); |
315 | DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, sc.work_graph); |
316 | DrawBar(0, PADDING, address_box.left-2, TSZE+1, sc.work); |
316 | DrawBar(0, PADDING, address_box.left-2, TSZE+1, sc.work); |
317 | DrawBar(address_box.left+address_box.width+18, PADDING, Form.cwidth-address_box.left-address_box.width-18, TSZE+1, sc.work); |
317 | DrawBar(address_box.left+address_box.width+18, PADDING, Form.cwidth-address_box.left-address_box.width-18, TSZE+1, sc.work); |
318 | 318 | ||
319 | DrawTopPanelButton(BACK_BUTTON, PADDING-1, PADDING, 30); |
319 | DrawTopPanelButton(BACK_BUTTON, PADDING-1, PADDING, 30); |
320 | DrawTopPanelButton(FORWARD_BUTTON, PADDING+TSZE+PADDING-2, PADDING, 31); |
320 | DrawTopPanelButton(FORWARD_BUTTON, PADDING+TSZE+PADDING-2, PADDING, 31); |
321 | DrawTopPanelButton(SANDWICH_BUTTON, Form.cwidth-PADDING-TSZE-3, PADDING, -1); //burger menu |
321 | DrawTopPanelButton(SANDWICH_BUTTON, Form.cwidth-PADDING-TSZE-3, PADDING, -1); //burger menu |
322 | 322 | ||
323 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, sc.work_graph); |
323 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, sc.work_graph); |
324 | 324 | ||
325 | DrawRectangle(WB1.list.x + WB1.list.w, WB1.list.y, scroll_wv.size_x, |
325 | DrawRectangle(WB1.list.x + WB1.list.w, WB1.list.y, scroll_wv.size_x, |
326 | WB1.list.h-1, scroll_wv.bckg_col); |
326 | WB1.list.h-1, scroll_wv.bckg_col); |
327 | 327 | ||
328 | if (!BrowserWidthChanged()) { |
328 | if (!BrowserWidthChanged()) { |
329 | WB1.DrawPage(); |
329 | WB1.DrawPage(); |
330 | DrawOmnibox(); |
330 | DrawOmnibox(); |
331 | } |
331 | } |
332 | DrawProgress(); |
332 | DrawProgress(); |
333 | DrawStatusBar(NULL); |
333 | DrawStatusBar(NULL); |
334 | DrawTabsBar(); |
334 | DrawTabsBar(); |
335 | } |
335 | } |
336 | 336 | ||
337 | bool BrowserWidthChanged() |
337 | bool BrowserWidthChanged() |
338 | { |
338 | { |
339 | dword source_mode_holder; |
339 | dword source_mode_holder; |
340 | if (WB1.list.w!=DrawBuf.bufw) { |
340 | if (WB1.list.w!=DrawBuf.bufw) { |
341 | DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 400*20); |
341 | DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 400*20); |
342 | if (!strncmp(history.current(),"http",4)) { |
342 | if (!strncmp(history.current(),"http",4)) { |
343 | //nihuya ne izyashnoe reshenie, no pust' poka butet tak |
343 | //nihuya ne izyashnoe reshenie, no pust' poka butet tak |
344 | source_mode_holder = source_mode; |
344 | source_mode_holder = source_mode; |
345 | LoadInternalPage(#loading_text, sizeof(loading_text)); |
345 | LoadInternalPage(#loading_text, sizeof(loading_text)); |
346 | source_mode = source_mode_holder; |
346 | source_mode = source_mode_holder; |
347 | } |
347 | } |
348 | OpenPage(history.current()); |
348 | OpenPage(history.current()); |
349 | return true; |
349 | return true; |
350 | } |
350 | } |
351 | return false; |
351 | return false; |
352 | } |
352 | } |
353 | 353 | ||
354 | 354 | ||
355 | void EventChangeEncodingAndLoadPage(int _new_encoding) |
355 | void EventChangeEncodingAndLoadPage(int _new_encoding) |
356 | { |
356 | { |
357 | dword newbuf, newsize; |
357 | dword newbuf, newsize; |
358 | WB1.custom_encoding = _new_encoding; |
358 | WB1.custom_encoding = _new_encoding; |
359 | newsize = strlen(WB1.o_bufpointer); |
359 | newsize = strlen(WB1.o_bufpointer); |
360 | newbuf = malloc(newsize); |
360 | newbuf = malloc(newsize); |
361 | memmov(newbuf, WB1.o_bufpointer, newsize); |
361 | memmov(newbuf, WB1.o_bufpointer, newsize); |
362 | LoadInternalPage(newbuf, newsize); |
362 | LoadInternalPage(newbuf, newsize); |
363 | free(newbuf); |
363 | free(newbuf); |
364 | } |
364 | } |
365 | 365 | ||
366 | 366 | ||
367 | void ProcessEvent(dword id__) |
367 | void ProcessEvent(dword id__) |
368 | { |
368 | { |
369 | switch (id__) |
369 | switch (id__) |
370 | { |
370 | { |
371 | case ENCODINGS...ENCODINGS+6: |
371 | case ENCODINGS...ENCODINGS+6: |
372 | EventChangeEncodingAndLoadPage(id__-ENCODINGS); |
372 | EventChangeEncodingAndLoadPage(id__-ENCODINGS); |
373 | return; |
373 | return; |
374 | case NEW_WINDOW: |
374 | case NEW_WINDOW: |
375 | RunProgram(#program_path, NULL); |
375 | RunProgram(#program_path, NULL); |
376 | return; |
376 | return; |
377 | case SCAN_CODE_BS: |
377 | case SCAN_CODE_BS: |
378 | case BACK_BUTTON: |
378 | case BACK_BUTTON: |
379 | if (history.back()) { |
379 | if (history.back()) { |
380 | OpenPage(history.current()); |
380 | OpenPage(history.current()); |
381 | } |
381 | } |
382 | return; |
382 | return; |
383 | case FORWARD_BUTTON: |
383 | case FORWARD_BUTTON: |
384 | if (history.forward()) { |
384 | if (history.forward()) { |
385 | OpenPage(history.current()); |
385 | OpenPage(history.current()); |
386 | } |
386 | } |
387 | return; |
387 | return; |
388 | case GOTOURL_BUTTON: |
388 | case GOTOURL_BUTTON: |
389 | case SCAN_CODE_ENTER: |
389 | case SCAN_CODE_ENTER: |
390 | EventSubmitOmnibox(); |
390 | EventSubmitOmnibox(); |
391 | return; |
391 | return; |
392 | case REFRESH_BUTTON: |
392 | case REFRESH_BUTTON: |
393 | if (http.transfer) { |
- | |
394 | StopLoading(); |
393 | EventRefreshPage(); |
395 | draw_window(); |
- | |
396 | } else { |
- | |
397 | OpenPage(history.current()); |
- | |
398 | } |
- | |
399 | return; |
394 | return; |
400 | case CHANGE_ENCODING: |
395 | case CHANGE_ENCODING: |
401 | EventShowEncodingsList(); |
396 | EventShowEncodingsList(); |
402 | return; |
397 | return; |
403 | case SANDWICH_BUTTON: |
398 | case SANDWICH_BUTTON: |
404 | EventShowMainMenu(); |
399 | EventShowMainMenu(); |
405 | return; |
400 | return; |
406 | case VIEW_SOURCE: |
401 | case VIEW_SOURCE: |
407 | EventViewSource(); |
402 | EventViewSource(); |
408 | break; |
403 | break; |
409 | case EDIT_SOURCE: |
404 | case EDIT_SOURCE: |
410 | if (check_is_the_adress_local(history.current())) { |
405 | if (check_is_the_adress_local(history.current())) { |
411 | RunProgram("/rd/1/tinypad", history.current()); |
406 | RunProgram("/rd/1/tinypad", history.current()); |
412 | } else { |
407 | } else { |
413 | CreateFile(WB1.bufsize, WB1.bufpointer, "/tmp0/1/WebView_tmp.htm"); |
408 | CreateFile(WB1.bufsize, WB1.bufpointer, "/tmp0/1/WebView_tmp.htm"); |
414 | if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm"); |
409 | if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm"); |
415 | } |
410 | } |
416 | return; |
411 | return; |
417 | case VIEW_HISTORY: |
412 | case VIEW_HISTORY: |
418 | OpenPage(URL_SERVICE_HISTORY); |
413 | OpenPage(URL_SERVICE_HISTORY); |
419 | return; |
414 | return; |
420 | case DOWNLOAD_MANAGER: |
415 | case DOWNLOAD_MANAGER: |
421 | if (!downloader_opened) { |
416 | if (!downloader_opened) { |
422 | downloader_edit = NULL; |
417 | downloader_edit = NULL; |
423 | CreateThread(#Downloader,#downloader_stak+4092); |
418 | CreateThread(#Downloader,#downloader_stak+4092); |
424 | } |
419 | } |
425 | return; |
420 | return; |
426 | case UPDATE_BROWSER: |
421 | case UPDATE_BROWSER: |
427 | EventUpdateBrowser(); |
422 | EventUpdateBrowser(); |
428 | return; |
423 | return; |
429 | case CLEAR_CACHE: |
424 | case CLEAR_CACHE: |
430 | pages_cache.clear(); |
425 | pages_cache.clear(); |
431 | notify(#clear_cache_ok); |
426 | notify(#clear_cache_ok); |
- | 427 | EventRefreshPage(); |
|
432 | return; |
428 | return; |
433 | case IN_NEW_TAB: |
429 | case IN_NEW_TAB: |
434 | open_new_tab = true; |
430 | open_new_tab = true; |
435 | EventClickLink(PageLinks.GetURL(PageLinks.active)); |
431 | EventClickLink(PageLinks.GetURL(PageLinks.active)); |
436 | open_new_tab = false; |
432 | open_new_tab = false; |
437 | return; |
433 | return; |
438 | case IN_NEW_WINDOW: |
434 | case IN_NEW_WINDOW: |
439 | open_new_window = true; |
435 | open_new_window = true; |
440 | EventClickLink(PageLinks.GetURL(PageLinks.active)); |
436 | EventClickLink(PageLinks.GetURL(PageLinks.active)); |
441 | open_new_window = false; |
437 | open_new_window = false; |
442 | return; |
438 | return; |
443 | case COPY_LINK_URL: |
439 | case COPY_LINK_URL: |
444 | Clipboard__CopyText(PageLinks.GetURL(PageLinks.active)); |
440 | Clipboard__CopyText(PageLinks.GetURL(PageLinks.active)); |
445 | notify("'URL copied to clipboard'O"); |
441 | notify("'URL copied to clipboard'O"); |
446 | return; |
442 | return; |
447 | case DOWNLOAD_LINK_CONTENTS: |
443 | case DOWNLOAD_LINK_CONTENTS: |
448 | if (!downloader_opened) { |
444 | if (!downloader_opened) { |
449 | strcpy(#downloader_edit, PageLinks.GetURL(PageLinks.active)); |
445 | strcpy(#downloader_edit, PageLinks.GetURL(PageLinks.active)); |
450 | CreateThread(#Downloader,#downloader_stak+4092); |
446 | CreateThread(#Downloader,#downloader_stak+4092); |
451 | } |
447 | } |
452 | return; |
448 | return; |
453 | case OPEN_FILE: |
449 | case OPEN_FILE: |
454 | EventOpenDialog(); |
450 | EventOpenDialog(); |
455 | return; |
451 | return; |
456 | case SCAN_CODE_F12: |
452 | case SCAN_CODE_F12: |
457 | debug_mode ^= 1; |
453 | debug_mode ^= 1; |
458 | if (debug_mode) notify("'Debug mode ON'-I"); |
454 | if (debug_mode) notify("'Debug mode ON'-I"); |
459 | else notify("'Debug mode OFF'-I"); |
455 | else notify("'Debug mode OFF'-I"); |
460 | return; |
456 | return; |
461 | case NEW_TAB: |
457 | case NEW_TAB: |
462 | if (http.transfer) break; |
458 | if (http.transfer) break; |
463 | EventOpenNewTab(URL_SERVICE_HOMEPAGE); |
459 | EventOpenNewTab(URL_SERVICE_HOMEPAGE); |
464 | return; |
460 | return; |
465 | case TAB_ID...TAB_ID+TABS_MAX: |
461 | case TAB_ID...TAB_ID+TABS_MAX: |
466 | if (http.transfer) break; |
462 | if (http.transfer) break; |
467 | if (mouse.mkm) { |
463 | if (mouse.mkm) { |
468 | EventTabClose(id__ - TAB_ID); |
464 | EventTabClose(id__ - TAB_ID); |
469 | } else { |
465 | } else { |
470 | EventTabClick(id__ - TAB_ID); |
466 | EventTabClick(id__ - TAB_ID); |
471 | } |
467 | } |
472 | return; |
468 | return; |
473 | case TAB_CLOSE_ID...TAB_CLOSE_ID+TABS_MAX: |
469 | case TAB_CLOSE_ID...TAB_CLOSE_ID+TABS_MAX: |
474 | EventTabClose(id__ - TAB_CLOSE_ID); |
470 | EventTabClose(id__ - TAB_CLOSE_ID); |
475 | return; |
471 | return; |
476 | } |
472 | } |
477 | } |
473 | } |
478 | 474 | ||
479 | void StopLoading() |
475 | void StopLoading() |
480 | { |
476 | { |
481 | if (http.transfer) |
477 | if (http.transfer) |
482 | { |
478 | { |
483 | EAX = http.transfer; |
479 | EAX = http.transfer; |
484 | EAX = EAX.http_msg.content_ptr; // get pointer to data |
480 | EAX = EAX.http_msg.content_ptr; // get pointer to data |
485 | $push EAX // save it on the stack |
481 | $push EAX // save it on the stack |
486 | http_free stdcall (http.transfer); // abort connection |
482 | http_free stdcall (http.transfer); // abort connection |
487 | $pop EAX |
483 | $pop EAX |
488 | free(EAX); // free data |
484 | free(EAX); // free data |
489 | http.transfer=0; |
485 | http.transfer=0; |
490 | pause(10); |
486 | pause(10); |
491 | } |
487 | } |
492 | wv_progress_bar.value = 0; |
488 | wv_progress_bar.value = 0; |
493 | DrawOmnibox(); |
489 | DrawOmnibox(); |
494 | } |
490 | } |
495 | 491 | ||
496 | //rewrite into |
492 | //rewrite into |
497 | //bool strrpl(dword dst, from, into, dst_len); |
493 | //bool strrpl(dword dst, from, into, dst_len); |
498 | bool ReplaceSpaceInUrl(dword url, size) { |
494 | bool ReplaceSpaceInUrl(dword url, size) { |
499 | unsigned int i, j; |
495 | unsigned int i, j; |
500 | bool was_changed=false; |
496 | bool was_changed=false; |
501 | for (i=url+size-3; i>url; i--) |
497 | for (i=url+size-3; i>url; i--) |
502 | { |
498 | { |
503 | if (ESBYTE[i]!=' ') continue; |
499 | if (ESBYTE[i]!=' ') continue; |
504 | for (j=url+size-3; j>=i; j--) { |
500 | for (j=url+size-3; j>=i; j--) { |
505 | ESBYTE[j+3]=ESBYTE[j+2]; |
501 | ESBYTE[j+3]=ESBYTE[j+2]; |
506 | ESBYTE[j+2]=ESBYTE[j+1]; |
502 | ESBYTE[j+2]=ESBYTE[j+1]; |
507 | ESBYTE[j+1]=ESBYTE[j]; |
503 | ESBYTE[j+1]=ESBYTE[j]; |
508 | } |
504 | } |
509 | ESBYTE[i] = '%'; |
505 | ESBYTE[i] = '%'; |
510 | ESBYTE[i+1] = '2'; |
506 | ESBYTE[i+1] = '2'; |
511 | ESBYTE[i+2] = '0'; |
507 | ESBYTE[i+2] = '0'; |
512 | was_changed = true; |
508 | was_changed = true; |
513 | } |
509 | } |
514 | return was_changed; |
510 | return was_changed; |
515 | } |
511 | } |
516 | 512 | ||
517 | bool HandleUrlFiles(dword _path, _data) |
513 | bool HandleUrlFiles(dword _path, _data) |
518 | { |
514 | { |
519 | dword url_from_file; |
515 | dword url_from_file; |
520 | if (!UrlExtIs(_path, "url")) return false; |
516 | if (!UrlExtIs(_path, "url")) return false; |
521 | url_from_file = strstri(_data, "URL="); |
517 | url_from_file = strstri(_data, "URL="); |
522 | if (url_from_file == -1) return false; |
518 | if (url_from_file == -1) return false; |
523 | replace_char(url_from_file, '\n', '\0', strlen(url_from_file)); |
519 | replace_char(url_from_file, '\n', '\0', strlen(url_from_file)); |
524 | OpenPage(url_from_file); |
520 | OpenPage(url_from_file); |
525 | } |
521 | } |
526 | 522 | ||
527 | bool GetLocalFileData(dword _path) |
523 | bool GetLocalFileData(dword _path) |
528 | { |
524 | { |
529 | dword data, size; |
525 | dword data, size; |
530 | file_size stdcall (_path); |
526 | file_size stdcall (_path); |
531 | if (!EBX) return false; |
527 | if (!EBX) return false; |
532 | 528 | ||
533 | size = EBX; |
529 | size = EBX; |
534 | data = malloc(size); |
530 | data = malloc(size); |
535 | ReadFile(0, size, data, _path); |
531 | ReadFile(0, size, data, _path); |
536 | if (!HandleUrlFiles(_path, data)) { |
532 | if (!HandleUrlFiles(_path, data)) { |
537 | LoadInternalPage(data, size); |
533 | LoadInternalPage(data, size); |
538 | } |
534 | } |
539 | free(data); |
535 | free(data); |
540 | return true; |
536 | return true; |
541 | } |
537 | } |
542 | 538 | ||
543 | void OpenPage(dword _open_URL) |
539 | void OpenPage(dword _open_URL) |
544 | { |
540 | { |
545 | char new_url[URL_SIZE+1]; |
541 | char new_url[URL_SIZE+1]; |
546 | int unz_id; |
542 | int unz_id; |
547 | 543 | ||
548 | StopLoading(); |
544 | StopLoading(); |
549 | 545 | ||
550 | if (open_new_tab) { |
546 | if (open_new_tab) { |
551 | open_new_tab = false; |
547 | open_new_tab = false; |
552 | EventOpenNewTab(_open_URL); |
548 | EventOpenNewTab(_open_URL); |
553 | return; |
549 | return; |
554 | } |
550 | } |
555 | 551 | ||
556 | SetOmniboxText(_open_URL); |
552 | SetOmniboxText(_open_URL); |
557 | 553 | ||
558 | strncpy(#new_url, _open_URL, URL_SIZE); |
554 | strncpy(#new_url, _open_URL, URL_SIZE); |
559 | 555 | ||
560 | //Exclude # from the URL to the load page |
556 | //Exclude # from the URL to the load page |
561 | //We will bring it back when we get the buffer |
557 | //We will bring it back when we get the buffer |
562 | if (strrchr(#new_url, '#')) anchors.take_anchor_from(#new_url); |
558 | if (strrchr(#new_url, '#')) anchors.take_anchor_from(#new_url); |
563 | 559 | ||
564 | history.add(#new_url); |
560 | history.add(#new_url); |
565 | 561 | ||
566 | if (pages_cache.has(#new_url)) { |
562 | if (pages_cache.has(#new_url)) { |
567 | //CACHED PAGE |
563 | //CACHED PAGE |
568 | LoadInternalPage(pages_cache.current_page_buf, pages_cache.current_page_size); |
564 | LoadInternalPage(pages_cache.current_page_buf, pages_cache.current_page_size); |
569 | 565 | ||
570 | } else if (!strncmp(#new_url,"WebView:",8)) { |
566 | } else if (!strncmp(#new_url,"WebView:",8)) { |
571 | //INTERNAL PAGE |
567 | //INTERNAL PAGE |
572 | if (!strcmp(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#homepage, sizeof(homepage)); |
568 | if (!strcmp(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#homepage, sizeof(homepage)); |
573 | else if (!strcmp(#new_url, URL_SERVICE_HELP)) LoadInternalPage(#help, sizeof(help)); |
569 | else if (!strcmp(#new_url, URL_SERVICE_HELP)) LoadInternalPage(#help, sizeof(help)); |
574 | else if (!strcmp(#new_url, URL_SERVICE_HISTORY)) ShowHistory(); |
570 | else if (!strcmp(#new_url, URL_SERVICE_HISTORY)) ShowHistory(); |
575 | else LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
571 | else LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
576 | 572 | ||
577 | } else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) { |
573 | } else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) { |
578 | //WEB PAGE |
574 | //WEB PAGE |
579 | if (ReplaceSpaceInUrl(#new_url, URL_SIZE)) { |
575 | if (ReplaceSpaceInUrl(#new_url, URL_SIZE)) { |
580 | strcpy(#editURL, #new_url); |
576 | strcpy(#editURL, #new_url); |
581 | } |
577 | } |
582 | 578 | ||
583 | if (!strncmp(#new_url,"http:",5)) { |
579 | if (!strncmp(#new_url,"http:",5)) { |
584 | http.get(#new_url); |
580 | http.get(#new_url); |
585 | } else if (!strncmp(#new_url,"https://",8)) { |
581 | } else if (!strncmp(#new_url,"https://",8)) { |
586 | strcpy(#new_url, "http://gate.aspero.pro/?site="); |
582 | strcpy(#new_url, "http://gate.aspero.pro/?site="); |
587 | strncat(#new_url, _open_URL, URL_SIZE); |
583 | strncat(#new_url, _open_URL, URL_SIZE); |
588 | http.get(#new_url); |
584 | http.get(#new_url); |
589 | } |
585 | } |
590 | 586 | ||
591 | DrawOmnibox(); |
587 | DrawOmnibox(); |
592 | 588 | ||
593 | if (!http.transfer) { |
589 | if (!http.transfer) { |
594 | StopLoading(); |
590 | StopLoading(); |
595 | LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
591 | LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
596 | } |
592 | } |
597 | } else { |
593 | } else { |
598 | //LOCAL PAGE |
594 | //LOCAL PAGE |
599 | if (UrlExtIs(#new_url,".docx")) { |
595 | if (UrlExtIs(#new_url,".docx")) { |
600 | DeleteFile("/tmp0/1/temp/word/document.xml"); |
596 | DeleteFile("/tmp0/1/temp/word/document.xml"); |
601 | CreateDir("/tmp0/1/temp"); |
597 | CreateDir("/tmp0/1/temp"); |
602 | unz_id = RunProgram("/sys/unz", sprintf(#param, "-o \"/tmp0/1/temp\" -h \"%s\"", #new_url)); |
598 | unz_id = RunProgram("/sys/unz", sprintf(#param, "-o \"/tmp0/1/temp\" -h \"%s\"", #new_url)); |
603 | while (GetProcessSlot(unz_id)) pause(2); |
599 | while (GetProcessSlot(unz_id)) pause(2); |
604 | strcpy(#new_url, "/tmp0/1/temp/word/document.xml"); |
600 | strcpy(#new_url, "/tmp0/1/temp/word/document.xml"); |
605 | } |
601 | } |
606 | if (!GetLocalFileData(#new_url)) { |
602 | if (!GetLocalFileData(#new_url)) { |
607 | LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
603 | LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
608 | } |
604 | } |
609 | } |
605 | } |
610 | } |
606 | } |
611 | 607 | ||
612 | void EventClickLink(dword _click_URL) |
608 | void EventClickLink(dword _click_URL) |
613 | { |
609 | { |
614 | char new_url[URL_SIZE+1]; |
610 | char new_url[URL_SIZE+1]; |
615 | 611 | ||
616 | if (open_new_window) { |
612 | if (open_new_window) { |
617 | strcpy(#new_url, _click_URL); |
613 | strcpy(#new_url, _click_URL); |
618 | GetAbsoluteURL(#new_url, history.current()); |
614 | GetAbsoluteURL(#new_url, history.current()); |
619 | RunProgram(#program_path, #new_url); |
615 | RunProgram(#program_path, #new_url); |
620 | return; |
616 | return; |
621 | } |
617 | } |
622 | 618 | ||
623 | if (ESBYTE[_click_URL]=='#') { |
619 | if (ESBYTE[_click_URL]=='#') { |
624 | if (anchors.get_pos_by_name(_click_URL+1)!=-1) { |
620 | if (anchors.get_pos_by_name(_click_URL+1)!=-1) { |
625 | WB1.list.first = anchors.get_pos_by_name(_click_URL+1); |
621 | WB1.list.first = anchors.get_pos_by_name(_click_URL+1); |
626 | WB1.list.CheckDoesValuesOkey(); |
622 | WB1.list.CheckDoesValuesOkey(); |
627 | } |
623 | } |
628 | strcpy(#editURL, history.current()); |
624 | strcpy(#editURL, history.current()); |
629 | strcat(#editURL, _click_URL); |
625 | strcat(#editURL, _click_URL); |
630 | DrawOmnibox(); |
626 | DrawOmnibox(); |
631 | WB1.DrawPage(); |
627 | WB1.DrawPage(); |
632 | return; |
628 | return; |
633 | } |
629 | } |
634 | 630 | ||
635 | if (!strncmp(_click_URL,"mailto:", 7)) || (!strncmp(_click_URL,"tel:", 4)) { |
631 | if (!strncmp(_click_URL,"mailto:", 7)) || (!strncmp(_click_URL,"tel:", 4)) { |
636 | notify(_click_URL); |
632 | notify(_click_URL); |
637 | return; |
633 | return; |
638 | } |
634 | } |
639 | 635 | ||
640 | if (http.transfer) { |
636 | if (http.transfer) { |
641 | StopLoading(); |
637 | StopLoading(); |
642 | history.back(); |
638 | history.back(); |
643 | } |
639 | } |
644 | 640 | ||
645 | strcpy(#new_url, _click_URL); |
641 | strcpy(#new_url, _click_URL); |
646 | GetAbsoluteURL(#new_url, history.current()); |
642 | GetAbsoluteURL(#new_url, history.current()); |
647 | 643 | ||
648 | if (strrchr(#new_url, '#')!=0) { |
644 | if (strrchr(#new_url, '#')!=0) { |
649 | anchors.take_anchor_from(#new_url); |
645 | anchors.take_anchor_from(#new_url); |
650 | OpenPage(#new_url); |
646 | OpenPage(#new_url); |
651 | return; |
647 | return; |
652 | } |
648 | } |
653 | 649 | ||
654 | if (!strncmp(#new_url,"WebView:",8)) { |
650 | if (!strncmp(#new_url,"WebView:",8)) { |
655 | OpenPage(#new_url); |
651 | OpenPage(#new_url); |
656 | return; |
652 | return; |
657 | } |
653 | } |
658 | 654 | ||
659 | if (strncmp(#new_url,"http://",7)!=0) && (strncmp(#new_url,"https://",8)!=0) |
655 | if (strncmp(#new_url,"http://",7)!=0) && (strncmp(#new_url,"https://",8)!=0) |
660 | { |
656 | { |
661 | if (UrlExtIs(#new_url,".htm")!=true) && (UrlExtIs(#new_url,".html")!=true) |
657 | if (UrlExtIs(#new_url,".htm")!=true) && (UrlExtIs(#new_url,".html")!=true) |
662 | { |
658 | { |
663 | if (strchr(#new_url, '|')) { |
659 | if (strchr(#new_url, '|')) { |
664 | ESBYTE[strchr(#new_url, '|')] = NULL; |
660 | ESBYTE[strchr(#new_url, '|')] = NULL; |
665 | RunProgram(#new_url, strlen(#new_url)+1+#new_url); |
661 | RunProgram(#new_url, strlen(#new_url)+1+#new_url); |
666 | } else { |
662 | } else { |
667 | RunProgram("/sys/@open", #new_url); |
663 | RunProgram("/sys/@open", #new_url); |
668 | } |
664 | } |
669 | return; |
665 | return; |
670 | } |
666 | } |
671 | } else { |
667 | } else { |
672 | if (UrlExtIs(#new_url,".png")==true) || (UrlExtIs(#new_url,".jpg")==true) |
668 | if (UrlExtIs(#new_url,".png")==true) || (UrlExtIs(#new_url,".jpg")==true) |
673 | || (UrlExtIs(#new_url,".zip")==true) || (UrlExtIs(#new_url,".kex")==true) || (UrlExtIs(#new_url,".pdf")==true) |
669 | || (UrlExtIs(#new_url,".zip")==true) || (UrlExtIs(#new_url,".kex")==true) || (UrlExtIs(#new_url,".pdf")==true) |
674 | || (UrlExtIs(#new_url,".7z")==true) { |
670 | || (UrlExtIs(#new_url,".7z")==true) { |
675 | if (!downloader_opened) { |
671 | if (!downloader_opened) { |
676 | strcpy(#downloader_edit, #new_url); |
672 | strcpy(#downloader_edit, #new_url); |
677 | CreateThread(#Downloader,#downloader_stak+4092); |
673 | CreateThread(#Downloader,#downloader_stak+4092); |
678 | } |
674 | } |
679 | else notify("'WebView\nPlease, start a new download only when previous ended.'Et"); |
675 | else notify("'WebView\nPlease, start a new download only when previous ended.'Et"); |
680 | return; |
676 | return; |
681 | } |
677 | } |
682 | } |
678 | } |
683 | OpenPage(#new_url); |
679 | OpenPage(#new_url); |
684 | } |
680 | } |
685 | 681 | ||
686 | void EventSubmitOmnibox() |
682 | void EventSubmitOmnibox() |
687 | { |
683 | { |
688 | char new_url[URL_SIZE+1]; |
684 | char new_url[URL_SIZE+1]; |
689 | if (!editURL[0]) return; |
685 | if (!editURL[0]) return; |
690 | if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/') |
686 | if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/') |
691 | || (!strncmp(#editURL,"https:",6)) || (!strncmp(#editURL,"WebView:",8)) { |
687 | || (!strncmp(#editURL,"https:",6)) || (!strncmp(#editURL,"WebView:",8)) { |
692 | OpenPage(#editURL); |
688 | OpenPage(#editURL); |
693 | } else { |
689 | } else { |
694 | strcpy(#new_url, "http://"); |
690 | strcpy(#new_url, "http://"); |
695 | strncat(#new_url, #editURL, sizeof(new_url)-1); |
691 | strncat(#new_url, #editURL, sizeof(new_url)-1); |
696 | OpenPage(#new_url); |
692 | OpenPage(#new_url); |
697 | } |
693 | } |
698 | } |
694 | } |
699 | 695 | ||
700 | void LoadInternalPage(dword _bufdata, _in_bufsize){ |
696 | void LoadInternalPage(dword _bufdata, _in_bufsize){ |
701 | if (!_bufdata) || (!_in_bufsize) { |
697 | if (!_bufdata) || (!_in_bufsize) { |
702 | LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
698 | LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
703 | } else { |
699 | } else { |
704 | WB1.list.first = 0; //scroll page to the top |
700 | WB1.list.first = 0; //scroll page to the top |
705 | DrawOmnibox(); |
701 | DrawOmnibox(); |
706 | if(!strrchr(#editURL, '#')) { |
702 | if(!strrchr(#editURL, '#')) { |
707 | strcat(#editURL, #anchors.current); |
703 | strcat(#editURL, #anchors.current); |
708 | DrawOmnibox(); |
704 | DrawOmnibox(); |
709 | } |
705 | } |
710 | WB1.ParseHtml(_bufdata, _in_bufsize); |
706 | WB1.ParseHtml(_bufdata, _in_bufsize); |
711 | DrawStatusBar(NULL); |
707 | DrawStatusBar(NULL); |
712 | DrawActiveTab(); |
708 | DrawActiveTab(); |
713 | if (source_mode) { |
709 | if (source_mode) { |
714 | source_mode = false; |
710 | source_mode = false; |
715 | WB1.custom_encoding = CH_CP866; |
711 | WB1.custom_encoding = CH_CP866; |
716 | ShowSource(WB1.bufpointer, _in_bufsize); |
712 | ShowSource(WB1.bufpointer, _in_bufsize); |
717 | } else { |
713 | } else { |
718 | WB1.DrawPage(); |
714 | WB1.DrawPage(); |
719 | } |
715 | } |
720 | } |
716 | } |
721 | } |
717 | } |
722 | 718 | ||
723 | bool UrlExtIs(dword base, ext) |
719 | bool UrlExtIs(dword base, ext) |
724 | { |
720 | { |
725 | if (!strcmpi(base + strlen(base) - strlen(ext), ext)) return true; |
721 | if (!strcmpi(base + strlen(base) - strlen(ext), ext)) return true; |
726 | return false; |
722 | return false; |
727 | } |
723 | } |
728 | 724 | ||
729 | void DrawProgress() |
725 | void DrawProgress() |
730 | { |
726 | { |
731 | dword persent; |
727 | dword persent; |
732 | if (http.transfer == 0) return; |
728 | if (http.transfer == 0) return; |
733 | if (wv_progress_bar.max) { |
729 | if (wv_progress_bar.max) { |
734 | persent = wv_progress_bar.value*100/wv_progress_bar.max; |
730 | persent = wv_progress_bar.value*100/wv_progress_bar.max; |
735 | } else { |
731 | } else { |
736 | persent = 10; |
732 | persent = 10; |
737 | } |
733 | } |
738 | DrawBar(address_box.left-1, address_box.top+20, persent*address_box.width+16/100, 2, 0x72B7EB); |
734 | DrawBar(address_box.left-1, address_box.top+20, persent*address_box.width+16/100, 2, 0x72B7EB); |
739 | } |
735 | } |
740 | 736 | ||
741 | void EventShowPageMenu() |
737 | void EventShowPageMenu() |
742 | { |
738 | { |
743 | open_lmenu(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, MENU_ALIGN_TOP_LEFT, NULL, #rmb_menu); |
739 | open_lmenu(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, MENU_ALIGN_TOP_LEFT, NULL, #rmb_menu); |
744 | menu_id = VIEW_SOURCE; |
740 | menu_id = VIEW_SOURCE; |
745 | } |
741 | } |
746 | 742 | ||
747 | void EventShowLinkMenu() |
743 | void EventShowLinkMenu() |
748 | { |
744 | { |
749 | open_lmenu(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, MENU_ALIGN_TOP_LEFT, NULL, #link_menu); |
745 | open_lmenu(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, MENU_ALIGN_TOP_LEFT, NULL, #link_menu); |
750 | menu_id = IN_NEW_TAB; |
746 | menu_id = IN_NEW_TAB; |
751 | } |
747 | } |
752 | 748 | ||
753 | void EventShowMainMenu() |
749 | void EventShowMainMenu() |
754 | { |
750 | { |
755 | open_lmenu(Form.left + Form.cwidth - PADDING, Form.top + skin_height + PADDING + TSZE + 3, |
751 | open_lmenu(Form.left + Form.cwidth - PADDING, Form.top + skin_height + PADDING + TSZE + 3, |
756 | MENU_ALIGN_TOP_RIGHT, NULL, #main_menu); |
752 | MENU_ALIGN_TOP_RIGHT, NULL, #main_menu); |
757 | menu_id = OPEN_FILE; |
753 | menu_id = OPEN_FILE; |
758 | } |
754 | } |
759 | 755 | ||
760 | void EventShowEncodingsList() |
756 | void EventShowEncodingsList() |
761 | { |
757 | { |
762 | open_lmenu(Form.left + Form.cwidth, Form.top + skin_height + status_text.start_y + 8, |
758 | open_lmenu(Form.left + Form.cwidth, Form.top + skin_height + status_text.start_y + 8, |
763 | MENU_ALIGN_BOT_RIGHT, WB1.cur_encoding + 1, "UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866"); |
759 | MENU_ALIGN_BOT_RIGHT, WB1.cur_encoding + 1, "UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866"); |
764 | menu_id = ENCODINGS; |
760 | menu_id = ENCODINGS; |
765 | } |
761 | } |
766 | 762 | ||
767 | void ProcessMenuClick() |
763 | void ProcessMenuClick() |
768 | { |
764 | { |
769 | int click_id; |
765 | int click_id; |
770 | if (menu_id) && (click_id = get_menu_click()) { |
766 | if (menu_id) && (click_id = get_menu_click()) { |
771 | click_id += menu_id - 1; |
767 | click_id += menu_id - 1; |
772 | menu_id = NULL; |
768 | menu_id = NULL; |
773 | ProcessEvent(click_id); |
769 | ProcessEvent(click_id); |
774 | } |
770 | } |
775 | } |
771 | } |
776 | 772 | ||
777 | void EventUpdateProgressBar() |
773 | void EventUpdateProgressBar() |
778 | { |
774 | { |
779 | wv_progress_bar.max = http.content_length; |
775 | wv_progress_bar.max = http.content_length; |
780 | if (wv_progress_bar.value != http.content_received) |
776 | if (wv_progress_bar.value != http.content_received) |
781 | { |
777 | { |
782 | wv_progress_bar.value = http.content_received; |
778 | wv_progress_bar.value = http.content_received; |
783 | DrawProgress(); |
779 | DrawProgress(); |
784 | } |
780 | } |
785 | } |
781 | } |
786 | 782 | ||
787 | void EventSeachWeb() |
783 | void EventSeachWeb() |
788 | { |
784 | { |
789 | char new_url[URL_SIZE+1]; |
785 | char new_url[URL_SIZE+1]; |
790 | replace_char(#editURL, ' ', '_', URL_SIZE); |
786 | replace_char(#editURL, ' ', '_', URL_SIZE); |
791 | strcpy(#new_url, "https://www.google.com/search?q="); |
787 | strcpy(#new_url, "https://www.google.com/search?q="); |
792 | strncat(#new_url, #editURL, URL_SIZE); |
788 | strncat(#new_url, #editURL, URL_SIZE); |
793 | OpenPage(#new_url); |
789 | OpenPage(#new_url); |
794 | } |
790 | } |
795 | 791 | ||
796 | void EventOpenDialog() |
792 | void EventOpenDialog() |
797 | { |
793 | { |
798 | OpenDialog_start stdcall (#o_dialog); |
794 | OpenDialog_start stdcall (#o_dialog); |
799 | if (o_dialog.status) { |
795 | if (o_dialog.status) { |
800 | OpenPage(#openfile_path); |
796 | OpenPage(#openfile_path); |
801 | } |
797 | } |
802 | } |
798 | } |
803 | 799 | ||
804 | void EventViewSource() |
800 | void EventViewSource() |
805 | { |
801 | { |
806 | char source_view_param[URL_SIZE+1]; |
802 | char source_view_param[URL_SIZE+1]; |
807 | //strcpy(#source_view_param, "-source "); |
803 | //strcpy(#source_view_param, "-source "); |
808 | //strncat(#source_view_param, history.current(), URL_SIZE); |
804 | //strncat(#source_view_param, history.current(), URL_SIZE); |
809 | //RunProgram(#program_path, #source_view_param); |
805 | //RunProgram(#program_path, #source_view_param); |
810 | source_mode = true; |
806 | source_mode = true; |
811 | EventOpenNewTab(history.current()); |
807 | EventOpenNewTab(history.current()); |
812 | } |
808 | } |
- | 809 | ||
- | 810 | void EventRefreshPage() |
|
- | 811 | { |
|
- | 812 | if (http.transfer) { |
|
- | 813 | StopLoading(); |
|
- | 814 | draw_window(); |
|
- | 815 | } else { |
|
- | 816 | OpenPage(history.current()); |
|
- | 817 | } |
|
- | 818 | } |
|
813 | 819 | ||
814 | dword GetFileSize(dword _path) |
820 | dword GetFileSize(dword _path) |
815 | { |
821 | { |
816 | BDVK bdvk; |
822 | BDVK bdvk; |
817 | if (GetFileInfo(_path, #bdvk)!=0) { |
823 | if (GetFileInfo(_path, #bdvk)!=0) { |
818 | return 0; |
824 | return 0; |
819 | } else { |
825 | } else { |
820 | return bdvk.sizelo; |
826 | return bdvk.sizelo; |
821 | } |
827 | } |
822 | } |
828 | } |
823 | 829 | ||
824 | void EventUpdateBrowser() |
830 | void EventUpdateBrowser() |
825 | { |
831 | { |
826 | dword downloader_id, slot_n; |
832 | dword downloader_id, slot_n; |
827 | dword current_size; |
833 | dword current_size; |
828 | dword new_size; |
834 | dword new_size; |
829 | int error; |
835 | int error; |
830 | 836 | ||
831 | draw_window(); |
837 | draw_window(); |
832 | 838 | ||
833 | downloader_id = RunProgram(#program_path, #update_param); |
839 | downloader_id = RunProgram(#program_path, #update_param); |
834 | do { |
840 | do { |
835 | slot_n = GetProcessSlot(downloader_id); |
841 | slot_n = GetProcessSlot(downloader_id); |
836 | pause(10); |
842 | pause(10); |
837 | } while (slot_n!=0); |
843 | } while (slot_n!=0); |
838 | 844 | ||
839 | current_size = GetFileSize(#program_path); |
845 | current_size = GetFileSize(#program_path); |
840 | new_size = GetFileSize("/tmp0/1/Downloads/WebView.com"); |
846 | new_size = GetFileSize("/tmp0/1/Downloads/WebView.com"); |
841 | 847 | ||
842 | if (!new_size) || (new_size<5000) { |
848 | if (!new_size) || (new_size<5000) { |
843 | notify(#update_download_error); |
849 | notify(#update_download_error); |
844 | return; |
850 | return; |
845 | } |
851 | } |
846 | 852 | ||
847 | if (current_size == new_size) { |
853 | if (current_size == new_size) { |
848 | notify(#update_is_current); |
854 | notify(#update_is_current); |
849 | return; |
855 | return; |
850 | } |
856 | } |
851 | 857 | ||
852 | if (error = CopyFileAtOnce(new_size, "/tmp0/1/Downloads/WebView.com", #program_path)) { |
858 | if (error = CopyFileAtOnce(new_size, "/tmp0/1/Downloads/WebView.com", #program_path)) { |
853 | notify(#update_can_not_copy); |
859 | notify(#update_can_not_copy); |
854 | } else { |
860 | } else { |
855 | notify(#update_ok); |
861 | notify(#update_ok); |
856 | RunProgram(#program_path, history.current()); |
862 | RunProgram(#program_path, history.current()); |
857 | ExitProcess(); |
863 | ExitProcess(); |
858 | } |
864 | } |
859 | } |
865 | } |
860 | 866 | ||
861 | void DrawStatusBar(dword _status_text) |
867 | void DrawStatusBar(dword _status_text) |
862 | { |
868 | { |
863 | status_text.font_color = sc.work_text; |
869 | status_text.font_color = sc.work_text; |
864 | status_text.start_x = 10; |
870 | status_text.start_x = 10; |
865 | status_text.start_y = Form.cheight - STATUSBAR_H + 4; |
871 | status_text.start_y = Form.cheight - STATUSBAR_H + 4; |
866 | status_text.area_size_x = Form.cwidth - status_text.start_x -3 - 70; |
872 | status_text.area_size_x = Form.cwidth - status_text.start_x -3 - 70; |
867 | //DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, sc.work); |
873 | //DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, sc.work); |
868 | DrawBar(0,Form.cheight - STATUSBAR_H+1, Form.cwidth,STATUSBAR_H-1, sc.work); |
874 | DrawBar(0,Form.cheight - STATUSBAR_H+1, Form.cwidth,STATUSBAR_H-1, sc.work); |
869 | if (_status_text) { |
875 | if (_status_text) { |
870 | status_text.text_pointer = _status_text; |
876 | status_text.text_pointer = _status_text; |
871 | PathShow_prepare stdcall(#status_text); |
877 | PathShow_prepare stdcall(#status_text); |
872 | PathShow_draw stdcall(#status_text); |
878 | PathShow_draw stdcall(#status_text); |
873 | } |
879 | } |
874 | DefineHiddenButton(status_text.start_x+status_text.area_size_x+10, status_text.start_y-3, |
880 | DefineHiddenButton(status_text.start_x+status_text.area_size_x+10, status_text.start_y-3, |
875 | 60, 12, CHANGE_ENCODING); |
881 | 60, 12, CHANGE_ENCODING); |
876 | WriteTextCenter(status_text.start_x+status_text.area_size_x+10, |
882 | WriteTextCenter(status_text.start_x+status_text.area_size_x+10, |
877 | status_text.start_y, 60, sc.work_text, WB1.cur_encoding*10+#charsets); |
883 | status_text.start_y, 60, sc.work_text, WB1.cur_encoding*10+#charsets); |
878 | } |
884 | } |
879 | 885 | ||
880 | void DrawOmnibox() |
886 | void DrawOmnibox() |
881 | { |
887 | { |
882 | int imgxoff; |
888 | int imgxoff; |
883 | 889 | ||
884 | DrawOvalBorder(address_box.left-2, address_box.top-3, address_box.width+18, 24, sc.work_graph, |
890 | DrawOvalBorder(address_box.left-2, address_box.top-3, address_box.width+18, 24, sc.work_graph, |
885 | sc.work_graph, sc.work_graph, sc.work_dark); |
891 | 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); |
892 | DrawBar(address_box.left-1, address_box.top-2, address_box.width+18, 1, 0xD8DCD8); |
887 | DrawBar(address_box.left-1, address_box.top-1, address_box.width+18, 1, address_box.color); |
893 | DrawBar(address_box.left-1, address_box.top-1, address_box.width+18, 1, address_box.color); |
888 | DrawBar(address_box.left-1, address_box.top, 1, 22, address_box.color); |
894 | DrawBar(address_box.left-1, address_box.top, 1, 22, address_box.color); |
889 | 895 | ||
890 | if (address_box.flags & ed_focus) address_box.flags = ed_focus; else address_box.flags = 0; |
896 | if (address_box.flags & ed_focus) address_box.flags = ed_focus; else address_box.flags = 0; |
891 | EditBox_UpdateText(#address_box, address_box.flags); |
897 | EditBox_UpdateText(#address_box, address_box.flags); |
892 | edit_box_draw stdcall(#address_box); |
898 | edit_box_draw stdcall(#address_box); |
893 | if (http.transfer) imgxoff = 16*23*3; else imgxoff = 0; |
899 | if (http.transfer) imgxoff = 16*23*3; else imgxoff = 0; |
894 | _PutImage(address_box.left+address_box.width+1, address_box.top-1, 16, 23, imgxoff + #editbox_icons); |
900 | _PutImage(address_box.left+address_box.width+1, address_box.top-1, 16, 23, imgxoff + #editbox_icons); |
895 | DefineHiddenButton(address_box.left+address_box.width-1, address_box.top-2, 17, 23, REFRESH_BUTTON); |
901 | DefineHiddenButton(address_box.left+address_box.width-1, address_box.top-2, 17, 23, REFRESH_BUTTON); |
896 | 902 | ||
897 | DrawProgress(); |
903 | DrawProgress(); |
898 | } |
904 | } |
899 | 905 | ||
900 | void SetOmniboxText(dword _text) |
906 | void SetOmniboxText(dword _text) |
901 | { |
907 | { |
902 | strcpy(#editURL, _text); |
908 | strcpy(#editURL, _text); |
903 | address_box.flags=0; |
909 | address_box.flags=0; |
904 | DrawOmnibox(); |
910 | DrawOmnibox(); |
905 | } |
911 | } |
906 | 912 | ||
907 | 913 | ||
908 | stop:5000)>=5)>>=>280)>120)> |
914 | stop:5000)>=5)>>=>280)>120)> |