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