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