Rev 7720 | Rev 7739 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7720 | Rev 7738 | ||
---|---|---|---|
1 | //HTML Viewer in C-- |
1 | //HTML Viewer in C-- |
2 | //Copyright 2007-2019 by Veliant & Leency |
2 | //Copyright 2007-2019 by Veliant & Leency |
3 | //Asper, lev, Lrz, Barsuk, Nable, hidnplayr... |
3 | //Asper, lev, Lrz, Barsuk, Nable, hidnplayr... |
4 | 4 | ||
5 | #ifndef AUTOBUILD |
5 | #ifndef AUTOBUILD |
6 | #include "lang.h--" |
6 | #include "lang.h--" |
7 | #endif |
7 | #endif |
8 | 8 | ||
9 | //libraries |
9 | //libraries |
10 | #define MEMSIZE 4096 * 200 |
10 | #define MEMSIZE 1024 * 800 |
11 | #include "..\lib\gui.h" |
11 | #include "..\lib\gui.h" |
12 | #include "..\lib\draw_buf.h" |
12 | #include "..\lib\draw_buf.h" |
13 | #include "..\lib\list_box.h" |
13 | #include "..\lib\list_box.h" |
14 | #include "..\lib\cursor.h" |
14 | #include "..\lib\cursor.h" |
15 | #include "..\lib\collection.h" |
15 | #include "..\lib\collection.h" |
16 | #include "..\lib\random.h" |
16 | #include "..\lib\random.h" |
17 | #include "..\lib\clipboard.h" |
17 | #include "..\lib\clipboard.h" |
18 | 18 | ||
19 | // *.obj libraries |
19 | // *.obj libraries |
20 | #include "..\lib\obj\box_lib.h" |
20 | #include "..\lib\obj\box_lib.h" |
21 | #include "..\lib\obj\libio.h" |
21 | #include "..\lib\obj\libio.h" |
22 | #include "..\lib\obj\libimg.h" |
22 | #include "..\lib\obj\libimg.h" |
23 | #include "..\lib\obj\http.h" |
23 | #include "..\lib\obj\http.h" |
24 | #include "..\lib\obj\iconv.h" |
24 | #include "..\lib\obj\iconv.h" |
25 | //useful patterns |
25 | //useful patterns |
26 | #include "..\lib\patterns\history.h" |
26 | #include "..\lib\patterns\history.h" |
27 | #include "..\lib\patterns\http_downloader.h" |
27 | #include "..\lib\patterns\http_downloader.h" |
28 | 28 | ||
29 | _http http = {0, 0, 0, 0, 0, 0, 0}; |
29 | _http http = {0, 0, 0, 0, 0, 0, 0}; |
30 | 30 | ||
31 | char homepage[] = FROM "html\\homepage.htm""\0"; |
31 | char homepage[] = FROM "html\\homepage.htm""\0"; |
32 | 32 | ||
33 | #ifdef LANG_RUS |
33 | #ifdef LANG_RUS |
34 | char version[]="¥ªáâ®¢ë© ¡à 㧥à 1.8d"; |
34 | char version[]="¥ªáâ®¢ë© ¡à 㧥à 1.82"; |
35 | ?define IMAGES_CACHE_CLEARED "íè ª à⨮ª ®ç¨é¥" |
35 | ?define IMAGES_CACHE_CLEARED "íè ª à⨮ª ®ç¨é¥" |
36 | ?define T_LAST_SLIDE "â® ¯®á«¥¤¨© á« ©¤" |
36 | ?define T_LAST_SLIDE "â® ¯®á«¥¤¨© á« ©¤" |
37 | char loading[] = " £à㧪 áâà ¨æë... |
37 | char loading[] = " £à㧪 áâà ¨æë... |
38 | char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0"; |
38 | char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0"; |
39 | char accept_language[]= "Accept-Language: ru\n"; |
39 | char accept_language[]= "Accept-Language: ru\n"; |
40 | char rmb_menu[] = |
40 | char rmb_menu[] = |
41 | "®á¬®âà¥âì ¨á室¨ª |
41 | "®á¬®âà¥âì ¨á室¨ª |
42 | ¥¤ ªâ¨à®¢ âì ¨á室¨ª |
42 | ¥¤ ªâ¨à®¢ âì ¨á室¨ª |
43 | áâ®à¨ï |
43 | áâ®à¨ï |
44 | ¥¥¤¦¥à § £à㧮ª"; |
44 | ¥¥¤¦¥à § £à㧮ª"; |
45 | char link_menu[] = |
45 | char link_menu[] = |
46 | "®¯¨à®¢ âì áá뫪ã |
46 | "®¯¨à®¢ âì áá뫪ã |
47 | ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨"; |
47 | ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨"; |
48 | #else |
48 | #else |
49 | char version[]="Text-based Browser 1.8d"; |
49 | char version[]="Text-based Browser 1.82"; |
50 | ?define IMAGES_CACHE_CLEARED "Images cache cleared" |
50 | ?define IMAGES_CACHE_CLEARED "Images cache cleared" |
51 | ?define T_LAST_SLIDE "This slide is the last" |
51 | ?define T_LAST_SLIDE "This slide is the last" |
52 | char loading[] = "Loading... |
52 | char loading[] = "Loading... |
53 | char page_not_found[] = FROM "html\\page_not_found_en.htm""\0"; |
53 | char page_not_found[] = FROM "html\\page_not_found_en.htm""\0"; |
54 | char accept_language[]= "Accept-Language: en\n"; |
54 | char accept_language[]= "Accept-Language: en\n"; |
55 | char rmb_menu[] = |
55 | char rmb_menu[] = |
56 | "View source |
56 | "View source |
57 | Edit source |
57 | Edit source |
58 | History |
58 | History |
59 | Download Manager"; |
59 | Download Manager"; |
60 | char link_menu[] = |
60 | char link_menu[] = |
61 | "Copy link |
61 | "Copy link |
62 | Download link contents"; |
62 | Download link contents"; |
63 | #endif |
63 | #endif |
64 | 64 | ||
65 | 65 | ||
66 | #define URL_SERVICE_HISTORY "WebView://history" |
66 | #define URL_SERVICE_HISTORY "WebView://history" |
67 | #define URL_SERVICE_HOME "WebView://home" |
67 | #define URL_SERVICE_HOME "WebView://home" |
68 | #define URL_SERVICE_SOURCE "WebView://source:" |
68 | #define URL_SERVICE_SOURCE "WebView://source:" |
69 | 69 | ||
70 | proc_info Form; |
70 | proc_info Form; |
71 | 71 | ||
72 | //char search_path[]="http://nigma.ru/index.php?s="; |
72 | //char search_path[]="http://nigma.ru/index.php?s="; |
73 | int redirected = 0; |
73 | int redirected = 0; |
74 | 74 | ||
75 | char stak[4096]; |
75 | char stak[4096]; |
76 | 76 | ||
77 | int action_buf; |
77 | int action_buf; |
78 | 78 | ||
79 | dword TOOLBAR_H = 40; |
79 | dword TOOLBAR_H = 40; |
80 | dword STATUSBAR_H = 15; |
80 | dword STATUSBAR_H = 15; |
81 | 81 | ||
82 | dword col_bg = 0xE3E2E2; |
82 | dword col_bg = 0xE3E2E2; |
83 | dword panel_color = 0xE3E2E2; |
83 | dword panel_color = 0xE3E2E2; |
84 | dword border_color = 0x8C8C8C; |
84 | dword border_color = 0x8C8C8C; |
85 | 85 | ||
86 | bool debug_mode = false; |
86 | bool debug_mode = false; |
87 | bool old_tag_parser_mode = false; |
87 | bool old_tag_parser_mode = false; |
88 | 88 | ||
89 | progress_bar wv_progress_bar; |
89 | progress_bar wv_progress_bar; |
90 | bool souce_mode = false; |
90 | bool souce_mode = false; |
91 | bool open_in_a_new_window = false; |
91 | bool open_in_a_new_window = false; |
92 | 92 | ||
93 | enum { |
93 | enum { |
94 | BACK_BUTTON=1000, |
94 | BACK_BUTTON=1000, |
95 | FORWARD_BUTTON, |
95 | FORWARD_BUTTON, |
96 | REFRESH_BUTTON, |
96 | REFRESH_BUTTON, |
97 | GOTOURL_BUTTON, |
97 | GOTOURL_BUTTON, |
98 | SANDWICH_BUTTON, |
98 | SANDWICH_BUTTON, |
99 | VIEW_SOURCE=1100, |
99 | VIEW_SOURCE=1100, |
100 | EDIT_SOURCE, |
100 | EDIT_SOURCE, |
101 | VIEW_HISTORY, |
101 | VIEW_HISTORY, |
102 | //FREE_IMG_CACHE, |
102 | //FREE_IMG_CACHE, |
103 | DOWNLOAD_MANAGER, |
103 | DOWNLOAD_MANAGER, |
104 | COPY_LINK_URL=1200, |
104 | COPY_LINK_URL=1200, |
105 | DOWNLOAD_LINK_CONTENTS, |
105 | DOWNLOAD_LINK_CONTENTS, |
106 | }; |
106 | }; |
107 | 107 | ||
108 | #include "..\TWB\TWB.c" |
108 | #include "..\TWB\TWB.c" |
109 | #include "history.h" |
109 | #include "history.h" |
110 | #include "show_src.h" |
110 | #include "show_src.h" |
111 | #include "download_manager.h" |
111 | #include "download_manager.h" |
112 | 112 | ||
113 | char editURL[sizeof(URL)]; |
113 | char editURL[sizeof(URL)]; |
114 | edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(URL)-2,#editURL,0,2,19,19}; |
114 | edit_box address_box = {250,60,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(URL)-2,#editURL,0,2,19,19}; |
115 | 115 | ||
116 | #define SKIN_Y 24 |
116 | #define SKIN_Y 24 |
117 | 117 | ||
118 | void main() |
118 | void main() |
119 | { |
119 | { |
120 | int i; |
120 | int i; |
121 | load_dll(boxlib, #box_lib_init,0); |
121 | load_dll(boxlib, #box_lib_init,0); |
122 | load_dll(libio, #libio_init,1); |
122 | load_dll(libio, #libio_init,1); |
123 | load_dll(libimg, #libimg_init,1); |
123 | load_dll(libimg, #libimg_init,1); |
124 | load_dll(libHTTP, #http_lib_init,1); |
124 | load_dll(libHTTP, #http_lib_init,1); |
125 | load_dll(iconv_lib, #iconv_open,0); |
125 | load_dll(iconv_lib, #iconv_open,0); |
126 | Libimg_LoadImage(#skin, "/sys/toolbar.png"); |
126 | Libimg_LoadImage(#skin, "/sys/toolbar.png"); |
127 | skin.h = 26; |
127 | skin.h = 26; |
128 | wv_progress_bar.progress_color = 0x72B7EB; |
128 | wv_progress_bar.progress_color = 0x72B7EB; |
129 | CreateDir("/tmp0/1/downloads"); |
129 | CreateDir("/tmp0/1/downloads"); |
130 | if (param) && (param[0]=='-') && (param[1]=='d') { |
130 | if (param) && (param[0]=='-') && (param[1]=='d') { |
131 | strcpy(#downloader_edit, #param+3); |
131 | strcpy(#downloader_edit, #param+3); |
132 | CreateThread(#Downloader,#downloader_stak+4092); |
132 | CreateThread(#Downloader,#downloader_stak+4092); |
133 | ExitProcess(); |
133 | ExitProcess(); |
134 | } |
134 | } |
135 | else if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME); |
135 | else if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME); |
136 | WB1.list.SetFont(8, 14, 10011000b); |
136 | WB1.list.SetFont(8, 14, 10011000b); |
137 | WB1.list.no_selection = true; |
137 | WB1.list.no_selection = true; |
138 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK); |
138 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK); |
139 | loop() switch(WaitEvent()) |
139 | loop() switch(WaitEvent()) |
140 | { |
140 | { |
141 | case evMouse: |
141 | case evMouse: |
142 | edit_box_mouse stdcall (#address_box); |
142 | edit_box_mouse stdcall (#address_box); |
143 | mouse.get(); |
143 | mouse.get(); |
144 | if (PageLinks.HoverAndProceed(mouse.x, WB1.list.first + mouse.y)) |
144 | if (PageLinks.HoverAndProceed(mouse.x, WB1.list.first + mouse.y)) |
145 | && (bufsize) && (mouse.pkm) && (mouse.up) { |
145 | && (bufsize) && (mouse.pkm) && (mouse.up) { |
146 | if (WB1.list.MouseOver(mouse.x, mouse.y)) EventShowPageMenu(mouse.x, mouse.y); |
146 | if (WB1.list.MouseOver(mouse.x, mouse.y)) EventShowPageMenu(mouse.x, mouse.y); |
147 | break; |
147 | break; |
148 | } |
148 | } |
149 | if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage(); |
149 | if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage(); |
150 | scrollbar_v_mouse (#scroll_wv); |
150 | scrollbar_v_mouse (#scroll_wv); |
151 | if (WB1.list.first != scroll_wv.position) |
151 | if (WB1.list.first != scroll_wv.position) |
152 | { |
152 | { |
153 | WB1.list.first = scroll_wv.position; |
153 | WB1.list.first = scroll_wv.position; |
154 | WB1.DrawPage(); |
154 | WB1.DrawPage(); |
155 | break; |
155 | break; |
156 | } |
156 | } |
157 | break; |
157 | break; |
158 | 158 | ||
159 | case evButton: |
159 | case evButton: |
160 | ProcessEvent(GetButtonID()); |
160 | ProcessEvent(GetButtonID()); |
161 | break; |
161 | break; |
162 | 162 | ||
163 | case evKey: |
163 | case evKey: |
164 | GetKeys(); |
164 | GetKeys(); |
165 | if (address_box.flags & ed_focus) |
165 | if (address_box.flags & ed_focus) |
166 | { |
166 | { |
167 | if (key_ascii == ASCII_KEY_ENTER) ProcessEvent(key_scancode); else { |
167 | if (key_ascii == ASCII_KEY_ENTER) ProcessEvent(key_scancode); else { |
168 | EAX = key_editbox; |
168 | EAX = key_editbox; |
169 | edit_box_key stdcall(#address_box); |
169 | edit_box_key stdcall(#address_box); |
170 | } |
170 | } |
171 | } |
171 | } |
172 | else |
172 | else |
173 | { |
173 | { |
174 | #define KEY_SCROLL_N 11 |
174 | #define KEY_SCROLL_N 11 |
175 | if (SCAN_CODE_UP == key_scancode) for (i=0;i |
175 | if (SCAN_CODE_UP == key_scancode) for (i=0;i |
176 | if (SCAN_CODE_DOWN == key_scancode) for (i=0;i |
176 | if (SCAN_CODE_DOWN == key_scancode) for (i=0;i |
177 | if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage(); |
177 | if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage(); |
178 | else ProcessEvent(key_scancode); |
178 | else ProcessEvent(key_scancode); |
179 | } |
179 | } |
180 | break; |
180 | break; |
181 | 181 | ||
182 | case evReDraw: |
182 | case evReDraw: |
183 | if (menu.cur_y) { |
183 | if (menu.cur_y) { |
184 | ProcessEvent(menu.cur_y); |
184 | ProcessEvent(menu.cur_y); |
185 | menu.cur_y = 0; |
185 | menu.cur_y = 0; |
186 | } |
186 | } |
187 | DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),GetScreenHeight()-600/2-random(80),800,600,0x73,col_bg,0,0); |
187 | DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),GetScreenHeight()-600/2-random(80),800,600,0x73,col_bg,0,0); |
188 | GetProcessInfo(#Form, SelfInfo); |
188 | GetProcessInfo(#Form, SelfInfo); |
189 | if (Form.status_window>2) { DrawTitle(#header); break; } |
189 | if (Form.status_window>2) { DrawTitle(#header); break; } |
190 | if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; } |
190 | if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; } |
191 | if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; } |
191 | if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; } |
192 | Draw_Window(); |
192 | Draw_Window(); |
193 | break; |
193 | break; |
194 | 194 | ||
195 | case evNetwork: |
195 | case evNetwork: |
196 | if (http.transfer > 0) { |
196 | if (http.transfer > 0) { |
197 | http.receive(); |
197 | http.receive(); |
198 | EventUpdateProgressBar(); |
198 | EventUpdateProgressBar(); |
199 | if (http.receive_result == 0) { |
199 | if (http.receive_result == 0) { |
200 | // Handle redirects |
200 | // Handle redirects |
201 | if (http.status_code >= 300) && (http.status_code < 400) |
201 | if (http.status_code >= 300) && (http.status_code < 400) |
202 | { |
202 | { |
203 | redirected++; |
203 | redirected++; |
204 | if (redirected>5) |
204 | if (redirected>5) |
205 | { |
205 | { |
206 | notify("'Too many redirects.' -E"); |
206 | notify("'Too many redirects.' -E"); |
207 | StopLoading(); |
207 | StopLoading(); |
208 | } |
208 | } |
209 | else |
209 | else |
210 | { |
210 | { |
211 | http.handle_redirect(); |
211 | http.handle_redirect(); |
212 | http.free(); |
212 | http.free(); |
213 | GetAbsoluteURL(#http.redirect_url); |
213 | GetAbsoluteURL(#http.redirect_url); |
214 | history.back(); |
214 | history.back(); |
215 | strcpy(#editURL, #URL); |
215 | strcpy(#editURL, #URL); |
216 | DrawEditBoxWebView(); |
216 | DrawEditBoxWebView(); |
217 | OpenPage(); |
217 | OpenPage(); |
218 | } |
218 | } |
219 | break; |
219 | break; |
220 | } |
220 | } |
221 | redirected = 0; |
221 | redirected = 0; |
222 | // Loading the page is complete, free resources |
222 | // Loading the page is complete, free resources |
223 | history.add(#URL); |
223 | history.add(#URL); |
224 | bufpointer = http.content_pointer; |
224 | bufpointer = http.content_pointer; |
225 | bufsize = http.content_received; |
225 | bufsize = http.content_received; |
226 | http.free(); |
226 | http.free(); |
227 | SetPageDefaults(); |
227 | SetPageDefaults(); |
228 | ShowPage(); |
228 | ShowPage(); |
229 | } |
229 | } |
230 | } |
230 | } |
231 | } |
231 | } |
232 | } |
232 | } |
233 | 233 | ||
234 | void SetElementSizes() |
234 | void SetElementSizes() |
235 | { |
235 | { |
236 | address_box.top = TOOLBAR_H/2-10; |
236 | address_box.top = TOOLBAR_H/2-10; |
237 | basic_line_h = calc(WB1.list.font_h * 130) / 100; |
237 | basic_line_h = calc(WB1.list.font_h * 130) / 100; |
238 | address_box.width = Form.cwidth - address_box.left - 50; |
238 | address_box.width = Form.cwidth - address_box.left - 50; |
239 | WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x, |
239 | WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x, |
240 | Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h); |
240 | Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h); |
241 | WB1.list.wheel_size = 7 * basic_line_h; |
241 | WB1.list.wheel_size = 7 * basic_line_h; |
242 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w; |
242 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w; |
243 | WB1.list.visible = WB1.list.h; |
243 | WB1.list.visible = WB1.list.h; |
244 | if (WB1.list.w!=WB1.DrawBuf.bufw) { |
244 | if (WB1.list.w!=WB1.DrawBuf.bufw) { |
245 | WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 32700); |
245 | WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 800*20); |
246 | ProcessEvent(REFRESH_BUTTON); |
246 | ProcessEvent(REFRESH_BUTTON); |
247 | } |
247 | } |
248 | } |
248 | } |
249 | 249 | ||
250 | 250 | ||
251 | 251 | ||
252 | void Draw_Window() |
252 | void Draw_Window() |
253 | { |
253 | { |
254 | DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color); |
254 | DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color); |
255 | DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3); |
255 | DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3); |
256 | DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color); |
256 | DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color); |
257 | SetElementSizes(); |
257 | SetElementSizes(); |
258 | DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 25,border_color); |
258 | DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 25,border_color); |
259 | DefineButton(address_box.left-52, address_box.top-2, 24, skin.h-2, BACK_BUTTON+BT_HIDE, 0); |
259 | DefineButton(address_box.left-52, address_box.top-2, 24, skin.h-2, BACK_BUTTON+BT_HIDE, 0); |
260 | DefineButton(address_box.left-27, address_box.top-2, 24, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0); |
260 | DefineButton(address_box.left-27, address_box.top-2, 24, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0); |
261 | img_draw stdcall(skin.image, address_box.left-53, address_box.top-3, 51, skin.h, 0, SKIN_Y); |
261 | img_draw stdcall(skin.image, address_box.left-53, address_box.top-3, 51, skin.h, 0, SKIN_Y); |
262 | DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0); |
262 | DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0); |
263 | DefineButton(Form.cwidth-27, address_box.top-3, 23, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0); |
263 | DefineButton(Form.cwidth-27, address_box.top-3, 23, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0); |
264 | img_draw stdcall(skin.image, Form.cwidth-24, address_box.top-3, 17, skin.h, 102, SKIN_Y); |
264 | img_draw stdcall(skin.image, Form.cwidth-24, address_box.top-3, 17, skin.h, 102, SKIN_Y); |
265 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg); |
265 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg); |
266 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color); |
266 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color); |
267 | if (!header) |
267 | if (!header) |
268 | OpenPage(); |
268 | OpenPage(); |
269 | else { |
269 | else { |
270 | WB1.DrawPage(); |
270 | WB1.DrawPage(); |
271 | DrawEditBoxWebView(); |
271 | DrawEditBoxWebView(); |
272 | } |
272 | } |
273 | DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col); |
273 | DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col); |
274 | DrawProgress(); |
274 | DrawProgress(); |
275 | } |
275 | } |
276 | 276 | ||
277 | 277 | ||
278 | void ProcessEvent(dword id__) |
278 | void ProcessEvent(dword id__) |
279 | { |
279 | { |
280 | switch (id__) |
280 | switch (id__) |
281 | { |
281 | { |
282 | case 1: |
282 | case 1: |
283 | ExitProcess(); |
283 | ExitProcess(); |
284 | return; |
284 | return; |
285 | case SCAN_CODE_BS: |
285 | case SCAN_CODE_BS: |
286 | case BACK_BUTTON: |
286 | case BACK_BUTTON: |
287 | if (history.back()) { |
287 | if (history.back()) { |
288 | strcpy(#URL, history.current()); |
288 | strcpy(#URL, history.current()); |
289 | OpenPage(); |
289 | OpenPage(); |
290 | } |
290 | } |
291 | return; |
291 | return; |
292 | case FORWARD_BUTTON: |
292 | case FORWARD_BUTTON: |
293 | if (history.forward()) { |
293 | if (history.forward()) { |
294 | strcpy(#URL, history.current()); |
294 | strcpy(#URL, history.current()); |
295 | OpenPage(); |
295 | OpenPage(); |
296 | } |
296 | } |
297 | return; |
297 | return; |
298 | case GOTOURL_BUTTON: |
298 | case GOTOURL_BUTTON: |
299 | case SCAN_CODE_ENTER: |
299 | case SCAN_CODE_ENTER: |
300 | if (!editURL[0]) { |
300 | if (!editURL[0]) { |
301 | strcpy(#URL, URL_SERVICE_HOME); |
301 | strcpy(#URL, URL_SERVICE_HOME); |
302 | } |
302 | } |
303 | else if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/') |
303 | else if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/') |
304 | || (!strncmp(#editURL,"https:",6)) || (!strncmp(#editURL,"WebView:",8)) |
304 | || (!strncmp(#editURL,"https:",6)) || (!strncmp(#editURL,"WebView:",8)) |
305 | { |
305 | { |
306 | strcpy(#URL, #editURL); |
306 | strcpy(#URL, #editURL); |
307 | } |
307 | } |
308 | else |
308 | else |
309 | { |
309 | { |
310 | strlcpy(#URL,"http://",7); |
310 | strlcpy(#URL,"http://",7); |
311 | strcat(#URL, #editURL); |
311 | strcat(#URL, #editURL); |
312 | } |
312 | } |
313 | OpenPage(); |
313 | OpenPage(); |
314 | return; |
314 | return; |
315 | case REFRESH_BUTTON: |
315 | case REFRESH_BUTTON: |
316 | if (http.transfer > 0) |
316 | if (http.transfer > 0) |
317 | { |
317 | { |
318 | StopLoading(); |
318 | StopLoading(); |
319 | Draw_Window(); |
319 | Draw_Window(); |
320 | } |
320 | } |
321 | else OpenPage(); |
321 | else OpenPage(); |
322 | return; |
322 | return; |
323 | case SANDWICH_BUTTON: |
323 | case SANDWICH_BUTTON: |
324 | EventShowPageMenu(Form.cwidth - 215, TOOLBAR_H-6); |
324 | EventShowPageMenu(Form.cwidth - 215, TOOLBAR_H-6); |
325 | return; |
325 | return; |
326 | case VIEW_SOURCE: |
326 | case VIEW_SOURCE: |
327 | WB1.list.first = 0; |
327 | WB1.list.first = 0; |
328 | ShowSource(); |
328 | ShowSource(); |
329 | WB1.LoadInternalPage(bufpointer, bufsize); |
329 | WB1.LoadInternalPage(bufpointer, bufsize); |
330 | break; |
330 | break; |
331 | case EDIT_SOURCE: |
331 | case EDIT_SOURCE: |
332 | if (!strncmp(#URL,"http",4)) |
332 | if (!strncmp(#URL,"http",4)) |
333 | { |
333 | { |
334 | CreateFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm"); |
334 | CreateFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm"); |
335 | if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm"); |
335 | if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm"); |
336 | } |
336 | } |
337 | else RunProgram("/rd/1/tinypad", #URL); |
337 | else RunProgram("/rd/1/tinypad", #URL); |
338 | return; |
338 | return; |
339 | // case FREE_IMG_CACHE: |
339 | // case FREE_IMG_CACHE: |
340 | // ImgCache.Free(); |
340 | // ImgCache.Free(); |
341 | // notify(IMAGES_CACHE_CLEARED); |
341 | // notify(IMAGES_CACHE_CLEARED); |
342 | // WB1.DrawPage(); |
342 | // WB1.DrawPage(); |
343 | // return; |
343 | // return; |
344 | case VIEW_HISTORY: |
344 | case VIEW_HISTORY: |
345 | strcpy(#URL, URL_SERVICE_HISTORY); |
345 | strcpy(#URL, URL_SERVICE_HISTORY); |
346 | OpenPage(); |
346 | OpenPage(); |
347 | return; |
347 | return; |
348 | case DOWNLOAD_MANAGER: |
348 | case DOWNLOAD_MANAGER: |
349 | if (!downloader_opened) { |
349 | if (!downloader_opened) { |
350 | downloader_edit = NULL; |
350 | downloader_edit = NULL; |
351 | CreateThread(#Downloader,#downloader_stak+4092); |
351 | CreateThread(#Downloader,#downloader_stak+4092); |
352 | } |
352 | } |
353 | return; |
353 | return; |
354 | case COPY_LINK_URL: |
354 | case COPY_LINK_URL: |
355 | Clipboard__CopyText(PageLinks.GetURL(PageLinks.active)); |
355 | Clipboard__CopyText(PageLinks.GetURL(PageLinks.active)); |
356 | notify("'URL copied to clipboard'O"); |
356 | notify("'URL copied to clipboard'O"); |
357 | return; |
357 | return; |
358 | case DOWNLOAD_LINK_CONTENTS: |
358 | case DOWNLOAD_LINK_CONTENTS: |
359 | if (!downloader_opened) { |
359 | if (!downloader_opened) { |
360 | strcpy(#downloader_edit, PageLinks.GetURL(PageLinks.active)); |
360 | strcpy(#downloader_edit, PageLinks.GetURL(PageLinks.active)); |
361 | CreateThread(#Downloader,#downloader_stak+4092); |
361 | CreateThread(#Downloader,#downloader_stak+4092); |
362 | } |
362 | } |
363 | return; |
363 | return; |
364 | case SCAN_CODE_F12: |
364 | case SCAN_CODE_F12: |
365 | debug_mode ^= 1; |
365 | debug_mode ^= 1; |
366 | if (debug_mode) notify("'Debug mode ON'-I"); |
366 | if (debug_mode) notify("'Debug mode ON'-I"); |
367 | else notify("'Debug mode OFF'-I"); |
367 | else notify("'Debug mode OFF'-I"); |
368 | return; |
368 | return; |
369 | case SCAN_CODE_F11: |
369 | case SCAN_CODE_F11: |
370 | old_tag_parser_mode ^= 1; |
370 | old_tag_parser_mode ^= 1; |
371 | if (old_tag_parser_mode) notify("'Old tag parser ON'-I"); |
371 | if (old_tag_parser_mode) notify("'Old tag parser ON'-I"); |
372 | else notify("'Old tag parser OFF'-I"); |
372 | else notify("'Old tag parser OFF'-I"); |
373 | return; |
373 | return; |
374 | } |
374 | } |
375 | } |
375 | } |
376 | 376 | ||
377 | void StopLoading() |
377 | void StopLoading() |
378 | { |
378 | { |
379 | if (http.transfer) |
379 | if (http.transfer) |
380 | { |
380 | { |
381 | EAX = http.transfer; |
381 | EAX = http.transfer; |
382 | EAX = EAX.http_msg.content_ptr; // get pointer to data |
382 | EAX = EAX.http_msg.content_ptr; // get pointer to data |
383 | $push EAX // save it on the stack |
383 | $push EAX // save it on the stack |
384 | http_free stdcall (http.transfer); // abort connection |
384 | http_free stdcall (http.transfer); // abort connection |
385 | $pop EAX |
385 | $pop EAX |
386 | free(EAX); // free data |
386 | free(EAX); // free data |
387 | http.transfer=0; |
387 | http.transfer=0; |
388 | bufsize = 0; |
388 | bufsize = 0; |
389 | bufpointer = free(bufpointer); |
389 | bufpointer = free(bufpointer); |
390 | } |
390 | } |
391 | wv_progress_bar.value = 0; |
391 | wv_progress_bar.value = 0; |
392 | DrawEditBoxWebView(); |
392 | DrawEditBoxWebView(); |
393 | } |
393 | } |
394 | 394 | ||
395 | void SetPageDefaults() |
395 | void SetPageDefaults() |
396 | { |
396 | { |
397 | strcpy(#header, #version); |
397 | strcpy(#header, #version); |
398 | WB1.list.count = WB1.list.first = 0; |
398 | WB1.list.count = WB1.list.first = 0; |
399 | cur_encoding = CH_NULL; |
399 | cur_encoding = CH_NULL; |
400 | if (o_bufpointer) o_bufpointer = free(o_bufpointer); |
400 | if (o_bufpointer) o_bufpointer = free(o_bufpointer); |
401 | } |
401 | } |
402 | 402 | ||
403 | void ReplaceSpaceInUrl() { |
403 | void ReplaceSpaceInUrl() { |
404 | int i; |
404 | int i; |
405 | strcpy(#editURL, #URL); |
405 | strcpy(#editURL, #URL); |
406 | while (i = strchr(#URL, ' ')) |
406 | while (i = strchr(#URL, ' ')) |
407 | { |
407 | { |
408 | i -= #URL; |
408 | i -= #URL; |
409 | strlcpy(#URL+i+3, #editURL+i+1, sizeof(URL)-i-4); |
409 | strlcpy(#URL+i+3, #editURL+i+1, sizeof(URL)-i-4); |
410 | URL[i] = '%'; |
410 | URL[i] = '%'; |
411 | URL[i+1] = '2'; |
411 | URL[i+1] = '2'; |
412 | URL[i+2] = '0'; |
412 | URL[i+2] = '0'; |
413 | } |
413 | } |
414 | strcpy(#editURL, #URL); |
414 | strcpy(#editURL, #URL); |
415 | } |
415 | } |
416 | 416 | ||
417 | void OpenPage() |
417 | void OpenPage() |
418 | { |
418 | { |
419 | char getUrl[sizeof(URL)]; |
419 | char getUrl[sizeof(URL)]; |
420 | StopLoading(); |
420 | StopLoading(); |
421 | souce_mode = false; |
421 | souce_mode = false; |
422 | strcpy(#editURL, #URL); |
422 | strcpy(#editURL, #URL); |
423 | history.add(#URL); |
423 | history.add(#URL); |
424 | if (!strncmp(#URL,"WebView:",8)) |
424 | if (!strncmp(#URL,"WebView:",8)) |
425 | { |
425 | { |
426 | SetPageDefaults(); |
426 | SetPageDefaults(); |
427 | if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage)); |
427 | if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage)); |
428 | else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory(); |
428 | else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory(); |
429 | DrawEditBoxWebView(); |
429 | DrawEditBoxWebView(); |
430 | return; |
430 | return; |
431 | } |
431 | } |
432 | if (!strncmp(#URL,"http:",5)) || (!strncmp(#URL,"https://",8)) |
432 | if (!strncmp(#URL,"http:",5)) || (!strncmp(#URL,"https://",8)) |
433 | { |
433 | { |
434 | ReplaceSpaceInUrl(); |
434 | ReplaceSpaceInUrl(); |
435 | img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 68, SKIN_Y); |
435 | img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 68, SKIN_Y); |
436 | 436 | ||
437 | if (!strncmp(#URL,"http:",5)) { |
437 | if (!strncmp(#URL,"http:",5)) { |
438 | http.get(#URL); |
438 | http.get(#URL); |
439 | } |
439 | } |
440 | if (!strncmp(#URL,"https://",8)) { |
440 | if (!strncmp(#URL,"https://",8)) { |
441 | sprintf(#getUrl, "http://gate.aspero.pro/?site=%s", #URL); |
441 | sprintf(#getUrl, "http://gate.aspero.pro/?site=%s", #URL); |
442 | http.get(#getUrl); |
442 | http.get(#getUrl); |
443 | } |
443 | } |
444 | //http.get(#URL); |
444 | //http.get(#URL); |
445 | if (!http.transfer) |
445 | if (!http.transfer) |
446 | { |
446 | { |
447 | StopLoading(); |
447 | StopLoading(); |
448 | bufsize = 0; |
448 | bufsize = 0; |
449 | bufpointer = free(bufpointer); |
449 | bufpointer = free(bufpointer); |
450 | ShowPage(); |
450 | ShowPage(); |
451 | return; |
451 | return; |
452 | } |
452 | } |
453 | } |
453 | } |
454 | else |
454 | else |
455 | { |
455 | { |
456 | file_size stdcall (#URL); |
456 | file_size stdcall (#URL); |
457 | bufsize = EBX; |
457 | bufsize = EBX; |
458 | if (bufsize) |
458 | if (bufsize) |
459 | { |
459 | { |
460 | free(bufpointer); |
460 | free(bufpointer); |
461 | bufpointer = malloc(bufsize); |
461 | bufpointer = malloc(bufsize); |
462 | SetPageDefaults(); |
462 | SetPageDefaults(); |
463 | ReadFile(0, bufsize, bufpointer, #URL); |
463 | ReadFile(0, bufsize, bufpointer, #URL); |
464 | } |
464 | } |
465 | ShowPage(); |
465 | ShowPage(); |
466 | } |
466 | } |
467 | } |
467 | } |
468 | 468 | ||
469 | DrawEditBoxWebView() |
469 | DrawEditBoxWebView() |
470 | { |
470 | { |
471 | int skin_x_offset; |
471 | int skin_x_offset; |
472 | DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 2, address_box.color); |
472 | DrawBar(address_box.left-2, address_box.top-2, address_box.width+3, 2, address_box.color); |
473 | DrawBar(address_box.left-2, address_box.top, 2, 22, address_box.color); |
473 | DrawBar(address_box.left-2, address_box.top, 2, 22, address_box.color); |
474 | //address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL); |
474 | //address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL); |
475 | //address_box.offset = 0; |
475 | //address_box.offset = 0; |
476 | EditBox_UpdateText(#address_box, address_box.flags); |
476 | EditBox_UpdateText(#address_box, address_box.flags); |
477 | edit_box_draw stdcall(#address_box); |
477 | edit_box_draw stdcall(#address_box); |
478 | if (http.transfer > 0) skin_x_offset = 68; else skin_x_offset = 51; |
478 | if (http.transfer > 0) skin_x_offset = 68; else skin_x_offset = 51; |
479 | img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y); |
479 | img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, skin_x_offset, SKIN_Y); |
480 | } |
480 | } |
481 | 481 | ||
482 | 482 | ||
483 | void ShowPage() |
483 | void ShowPage() |
484 | { |
484 | { |
485 | DrawEditBoxWebView(); |
485 | DrawEditBoxWebView(); |
486 | if (!bufsize) |
486 | if (!bufsize) |
487 | { |
487 | { |
488 | if (http.transfer) WB1.LoadInternalPage(#loading, sizeof(loading)); |
488 | if (http.transfer) WB1.LoadInternalPage(#loading, sizeof(loading)); |
489 | else WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
489 | else WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
490 | } |
490 | } |
491 | else |
491 | else |
492 | { |
492 | { |
493 | WB1.Prepare(); |
493 | WB1.Prepare(); |
494 | } |
494 | } |
495 | } |
495 | } |
496 | 496 | ||
497 | byte UrlExtIs(dword ext) |
497 | byte UrlExtIs(dword ext) |
498 | { |
498 | { |
499 | if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true; |
499 | if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true; |
500 | return false; |
500 | return false; |
501 | } |
501 | } |
502 | 502 | ||
503 | void DrawProgress() |
503 | void DrawProgress() |
504 | { |
504 | { |
505 | dword persent; |
505 | dword persent; |
506 | if (http.transfer == 0) return; |
506 | if (http.transfer == 0) return; |
507 | if (wv_progress_bar.max) persent = wv_progress_bar.value*100/wv_progress_bar.max; else persent = 10; |
507 | if (wv_progress_bar.max) persent = wv_progress_bar.value*100/wv_progress_bar.max; else persent = 10; |
508 | DrawBar(address_box.left-2, address_box.top+20, persent*address_box.width/100, 2, wv_progress_bar.progress_color); |
508 | DrawBar(address_box.left-2, address_box.top+20, persent*address_box.width/100, 2, wv_progress_bar.progress_color); |
509 | } |
509 | } |
510 | 510 | ||
511 | 511 | ||
512 | char anchor[256]; |
512 | char anchor[256]; |
513 | void ClickLink() |
513 | void ClickLink() |
514 | { |
514 | { |
515 | if (http.transfer > 0) |
515 | if (http.transfer > 0) |
516 | { |
516 | { |
517 | StopLoading(); |
517 | StopLoading(); |
518 | history.back(); |
518 | history.back(); |
519 | } |
519 | } |
520 | strcpy(#URL, PageLinks.GetURL(PageLinks.active)); |
520 | strcpy(#URL, PageLinks.GetURL(PageLinks.active)); |
521 | ReplaceSpaceInUrl(); |
521 | ReplaceSpaceInUrl(); |
522 | //#1 |
522 | //#1 |
523 | if (URL[0] == '#') |
523 | if (URL[0] == '#') |
524 | { |
524 | { |
525 | if (URL[1] == NULL) { |
525 | if (URL[1] == NULL) { |
526 | WB1.list.first = 0; |
526 | WB1.list.first = 0; |
527 | strcpy(#URL, history.current()); |
- | |
528 | } |
527 | } |
529 | else { |
528 | else { |
530 | strlcpy(#anchor, #URL+strrchr(#URL, '#'), sizeof(anchor)); |
529 | if (anchors.get_anchor_pos(#URL+1)!=-1) WB1.list.first = anchors.get_anchor_pos(#URL+1); |
531 | strcpy(#URL, history.current()); |
- | |
532 | } |
530 | } |
- | 531 | strlcpy(#anchor, #URL, sizeof(anchor)); |
|
- | 532 | strcpy(#URL, history.current()); |
|
- | 533 | strcpy(#editURL, #URL); |
|
- | 534 | strcat(#editURL, #anchor); |
|
- | 535 | DrawEditBoxWebView(); |
|
533 | ShowPage(); |
536 | WB1.DrawPage(); |
534 | return; |
537 | return; |
535 | } |
538 | } |
536 | //liner.ru#1 |
539 | //liner.ru#1 |
537 | if (strrchr(#URL, '#')!=0) |
540 | if (strrchr(#URL, '#')!=0) |
538 | { |
541 | { |
539 | strlcpy(#anchor, #URL+strrchr(#URL, '#'), sizeof(anchor)); |
542 | strlcpy(#anchor, #URL+strrchr(#URL, '#'), sizeof(anchor)); |
540 | URL[strrchr(#URL, '#')-1] = 0x00; |
543 | URL[strrchr(#URL, '#')-1] = 0x00; |
541 | } |
544 | } |
542 | 545 | ||
543 | if (!strncmp(#URL,"mailto:", 7)) |
546 | if (!strncmp(#URL,"mailto:", 7)) |
544 | { |
547 | { |
545 | notify(#URL); |
548 | notify(#URL); |
546 | strcpy(#editURL, history.current()); |
549 | strcpy(#editURL, history.current()); |
547 | strcpy(#URL, history.current()); |
550 | strcpy(#URL, history.current()); |
548 | return; |
551 | return; |
549 | } |
552 | } |
550 | 553 | ||
551 | GetAbsoluteURL(#URL); |
554 | GetAbsoluteURL(#URL); |
552 | 555 | ||
553 | if (strncmp(#URL,"http://",7)!=0) && (strncmp(#URL,"https://",8)!=0) |
556 | if (strncmp(#URL,"http://",7)!=0) && (strncmp(#URL,"https://",8)!=0) |
554 | { |
557 | { |
555 | if (UrlExtIs(".htm")!=true) && (UrlExtIs(".html")!=true) |
558 | if (UrlExtIs(".htm")!=true) && (UrlExtIs(".html")!=true) |
556 | { |
559 | { |
557 | if (strchr(#URL, '|')) { |
560 | if (strchr(#URL, '|')) { |
558 | ESBYTE[strchr(#URL, '|')] = NULL; |
561 | ESBYTE[strchr(#URL, '|')] = NULL; |
559 | RunProgram(#URL, strlen(#URL)+1+#URL); |
562 | RunProgram(#URL, strlen(#URL)+1+#URL); |
560 | } |
563 | } |
561 | else { |
564 | else { |
562 | RunProgram("/sys/@open", #URL); |
565 | RunProgram("/sys/@open", #URL); |
563 | } |
566 | } |
564 | strcpy(#editURL, history.current()); |
567 | strcpy(#editURL, history.current()); |
565 | strcpy(#URL, history.current()); |
568 | strcpy(#URL, history.current()); |
566 | return; |
569 | return; |
567 | } |
570 | } |
568 | } |
571 | } |
569 | else |
572 | else |
570 | { |
573 | { |
571 | if (UrlExtIs(".png")==true) || (UrlExtIs(".gif")==true) || (UrlExtIs(".jpg")==true) |
574 | if (UrlExtIs(".png")==true) || (UrlExtIs(".gif")==true) || (UrlExtIs(".jpg")==true) |
572 | || (UrlExtIs(".zip")==true) || (UrlExtIs(".kex")==true) || (UrlExtIs(".pdf")==true) |
575 | || (UrlExtIs(".zip")==true) || (UrlExtIs(".kex")==true) || (UrlExtIs(".pdf")==true) |
573 | || (UrlExtIs(".7z")==true) { |
576 | || (UrlExtIs(".7z")==true) { |
574 | if (!downloader_opened) { |
577 | if (!downloader_opened) { |
575 | strcpy(#downloader_edit, #URL); |
578 | strcpy(#downloader_edit, #URL); |
576 | CreateThread(#Downloader,#downloader_stak+4092); |
579 | CreateThread(#Downloader,#downloader_stak+4092); |
577 | strcpy(#editURL, history.current()); |
580 | strcpy(#editURL, history.current()); |
578 | strcpy(#URL, history.current()); |
581 | strcpy(#URL, history.current()); |
579 | } |
582 | } |
580 | else notify("'WebView\nPlease, start a new download only when previous ended.'Et"); |
583 | else notify("'WebView\nPlease, start a new download only when previous ended.'Et"); |
581 | return; |
584 | return; |
582 | } |
585 | } |
583 | } |
586 | } |
584 | if (open_in_a_new_window) |
587 | if (open_in_a_new_window) |
585 | { |
588 | { |
586 | RunProgram(#program_path, #URL); |
589 | RunProgram(#program_path, #URL); |
587 | strcpy(#editURL, history.current()); |
590 | strcpy(#editURL, history.current()); |
588 | strcpy(#URL, history.current()); |
591 | strcpy(#URL, history.current()); |
589 | } |
592 | } |
590 | else |
593 | else |
591 | { |
594 | { |
592 | OpenPage(); |
595 | OpenPage(); |
593 | } |
596 | } |
594 | open_in_a_new_window = false; |
597 | open_in_a_new_window = false; |
595 | } |
598 | } |
596 | 599 | ||
597 | void EventShowPageMenu(dword _left, _top) |
600 | void EventShowPageMenu(dword _left, _top) |
598 | { |
601 | { |
599 | menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #rmb_menu, VIEW_SOURCE); |
602 | menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #rmb_menu, VIEW_SOURCE); |
600 | } |
603 | } |
601 | 604 | ||
602 | void EventShowLinkMenu(dword _left, _top) |
605 | void EventShowLinkMenu(dword _left, _top) |
603 | { |
606 | { |
604 | menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #link_menu, COPY_LINK_URL); |
607 | menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #link_menu, COPY_LINK_URL); |
605 | } |
608 | } |
606 | 609 | ||
607 | void EventUpdateProgressBar() |
610 | void EventUpdateProgressBar() |
608 | { |
611 | { |
609 | wv_progress_bar.max = http.content_length; |
612 | wv_progress_bar.max = http.content_length; |
610 | if (wv_progress_bar.value != http.content_received) |
613 | if (wv_progress_bar.value != http.content_received) |
611 | { |
614 | { |
612 | wv_progress_bar.value = http.content_received; |
615 | wv_progress_bar.value = http.content_received; |
613 | DrawProgress(); |
616 | DrawProgress(); |
614 | } |
617 | } |
615 | } |
618 | } |
616 | 619 | ||
617 | DrawStatusBar(dword _status_text) |
620 | DrawStatusBar(dword _status_text) |
618 | { |
621 | { |
619 | status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10; |
622 | status_text.start_x = wv_progress_bar.left + wv_progress_bar.width + 10; |
620 | status_text.start_y = Form.cheight - STATUSBAR_H + 3; |
623 | status_text.start_y = Form.cheight - STATUSBAR_H + 3; |
621 | status_text.area_size_x = Form.cwidth - status_text.start_x -3; |
624 | status_text.area_size_x = Form.cwidth - status_text.start_x -3; |
622 | DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
625 | DrawBar(status_text.start_x, status_text.start_y, status_text.area_size_x, 9, col_bg); |
623 | status_text.text_pointer = _status_text; |
626 | status_text.text_pointer = _status_text; |
624 | PathShow_prepare stdcall(#status_text); |
627 | PathShow_prepare stdcall(#status_text); |
625 | PathShow_draw stdcall(#status_text); |
628 | PathShow_draw stdcall(#status_text); |
626 | } |
629 | } |
627 | 630 | ||
628 | stop:>280)>120)> |
631 | stop:>280)>120)> |