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