Subversion Repositories Kolibri OS

Rev

Rev 5768 | Rev 5773 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5768 Rev 5772
Line 7... Line 7...
7
	#include "lang.h--"
7
	#include "lang.h--"
8
#endif
8
#endif
Line 9... Line 9...
9
 
9
 
10
//libraries
10
//libraries
11
#define MEMSIZE 0x100000
-
 
12
#include "..\lib\strings.h"
11
#define MEMSIZE 0x100000
13
#include "..\lib\gui.h"
-
 
14
#include "..\lib\file_system.h"
-
 
15
#include "..\lib\mem.h"
12
#include "..\lib\gui.h"
16
#include "..\lib\draw_buf.h"
13
#include "..\lib\draw_buf.h"
17
#include "..\lib\list_box.h"
14
#include "..\lib\list_box.h"
Line 18... Line 15...
18
#include "..\lib\cursor.h"
15
#include "..\lib\cursor.h"
Line 28... Line 25...
28
#include "..\lib\patterns\libimg_load_skin.h"
25
#include "..\lib\patterns\libimg_load_skin.h"
Line 29... Line 26...
29
 
26
 
Line 30... Line 27...
30
char homepage[] = FROM "html\\homepage.htm";
27
char homepage[] = FROM "html\\homepage.htm";
31
 
28
 
32
#ifdef LANG_RUS
29
#ifdef LANG_RUS
33
	char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.31 UNSTABLE";
30
	char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.35";
34
	?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
31
	?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
35
	?define T_LAST_SLIDE "â® ¯®á«¥¤­¨© á« ©¤"
32
	?define T_LAST_SLIDE "â® ¯®á«¥¤­¨© á« ©¤"
36
	char loading[] = "‡ £à㧪  áâà ­¨æë...
";
33
	char loading[] = "‡ £à㧪  áâà ­¨æë...
";
37
	char page_not_found[] = FROM "html\page_not_found_ru.htm";
34
	char page_not_found[] = FROM "html\page_not_found_ru.htm";
38
	char accept_language[]= "Accept-Language: ru\n";
35
	char accept_language[]= "Accept-Language: ru\n";
39
#else
36
#else
40
	char version[]=" Text-based Browser 1.31 UNSTABLE";
37
	char version[]=" Text-based Browser 1.35";
41
	?define IMAGES_CACHE_CLEARED "Images cache cleared"
38
	?define IMAGES_CACHE_CLEARED "Images cache cleared"
42
	?define T_LAST_SLIDE "This slide is the last"
39
	?define T_LAST_SLIDE "This slide is the last"
43
	char loading[] = "Loading...
";
40
	char loading[] = "Loading...
";
Line 49... Line 46...
49
 
46
 
50
proc_info Form;
47
proc_info Form;
51
#define WIN_W 799
48
#define WIN_W 799
Line 52... Line 49...
52
#define WIN_H 559
49
#define WIN_H 559
53
 
50
 
54
char search_path[]="http://nigma.ru/index.php?s=";
51
//char search_path[]="http://nigma.ru/index.php?s=";
Line 55... Line 52...
55
char str_location[]="location\0";
52
char str_location[]="location\0";
Line 56... Line 53...
56
int redirected = 0;
53
int redirected = 0;
Line 57... Line 54...
57
 
54
 
58
char stak[4096];
55
char stak[4096];
Line 59... Line -...
59
 
-
 
60
int action_buf;
-
 
61
 
56
 
62
dword http_transfer = 0;
57
int action_buf;
63
dword http_buffer;
58
 
64
 
59
dword http_transfer = 0;
65
dword TAB_H = false; //19;
60
dword http_buffer;
Line 96... Line 91...
96
#include "network_get.h"
91
#include "network_get.h"
97
#include "downloader.h"
92
#include "downloader.h"
Line 98... Line 93...
98
 
93
 
99
char editURL[sizeof(URL)];
94
char editURL[sizeof(URL)];
100
int	mouse_twb;
95
int	mouse_twb;
Line 101... Line 96...
101
edit_box address_box = {250,55,34,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(URL),#editURL,#mouse_twb,2,19,19};
96
edit_box address_box = {250,56,34,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(URL),#editURL,#mouse_twb,2,19,19};
102
 
97
 
103
#define URL_SERVICE_HISTORY "WebView://history"
98
#define URL_SERVICE_HISTORY "WebView://history"
Line 104... Line -...
104
#define URL_SERVICE_HOME "WebView://home"
-
 
105
#define URL_SERVICE_SOURCE "WebView://source:"
99
#define URL_SERVICE_HOME "WebView://home"
Line 106... Line -...
106
 
-
 
107
 
-
 
108
libimg_image skin;
-
 
109
 
-
 
110
int SetSkinColors()
-
 
111
{
-
 
112
	dword image_data;
-
 
113
	image_data = DSDWORD[skin.image+24];
-
 
114
	col_bg = DSDWORD[image_data];
-
 
115
	panel_color  = DSDWORD[skin.w*4*4 + image_data];
-
 
116
	border_color = DSDWORD[skin.w*4*7 + image_data];
-
 
117
	wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data];
-
 
118
	$and col_bg, 0x00ffffff
-
 
119
	$and panel_color, 0x00ffffff
-
 
120
	$and border_color, 0x00ffffff
-
 
121
	$and wv_progress_bar.progress_color, 0x00ffffff
-
 
122
}
-
 
123
 
-
 
124
void DrawProgress()
-
 
125
{
-
 
126
	unsigned long btn;
-
 
127
	if (http_transfer == 0) return;
-
 
Line 128... Line 100...
128
	if (wv_progress_bar.max) btn = address_box.width*wv_progress_bar.value/wv_progress_bar.max; else btn = 30;
100
#define URL_SERVICE_SOURCE "WebView://source:"
129
	DrawBar(address_box.left-1, address_box.top+15, btn, 2, wv_progress_bar.progress_color);
101
 
130
}
102
libimg_image skin;
131
 
103
 
132
 
104
 
133
void main()
-
 
134
{
105
void main()
135
	dword btn;
106
{
136
	int half_scroll_size;
107
	dword btn;
137
	int scroll_used=0, show_menu;
108
	int half_scroll_size;
138
 
109
	int scroll_used=0, show_menu;
139
	CursorPointer.Load(#CursorFile);
110
	CursorPointer.Load(#CursorFile);
140
	load_dll(boxlib, #box_lib_init,0);
111
	load_dll(boxlib, #box_lib_init,0);
141
	load_dll(libio, #libio_init,1);
112
	load_dll(libio, #libio_init,1);
142
	load_dll(libimg, #libimg_init,1);
113
	load_dll(libimg, #libimg_init,1);
143
	load_dll(libHTTP, #http_lib_init,1);
-
 
-
 
114
	load_dll(libHTTP, #http_lib_init,1);
-
 
115
	load_dll(iconv_lib, #iconv_open,0);
144
	load_dll(iconv_lib, #iconv_open,0);
116
	//load_dll(kmenu, #akmenu_init,0);
145
	//load_dll(kmenu, #akmenu_init,0);
117
	Libimg_LoadImage(#skin, abspath("wv_skin.png"));
146
	Libimg_LoadImage(#skin, abspath("wv_skin.png"));
-
 
147
	SetSkinColors();
-
 
148
	
-
 
149
	WB1.DrawBuf.zoom = 1;
-
 
150
	WB1.list.SetFont(8, 14, 10111000b);
-
 
151
	Form.width=WIN_W;
-
 
152
	Form.height=WIN_H;
-
 
153
	SetElementSizes();
-
 
154
	if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME);
118
	SetSkinColors();
155
	OpenPage();
119
	CreateDir("/tmp0/1/downloads");
156
 
120
	if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME);
157
	CreateDir("/tmp0/1/downloads");
121
	WB1.DrawBuf.zoom = 1;
158
 
122
	WB1.list.SetFont(8, 14, 10111000b);
159
	SetEventMask(0xa7);
123
	SetEventMask(0xa7);
160
	BEGIN_LOOP_APPLICATION:
124
	BEGIN_LOOP_APPLICATION:
161
		WaitEventTimeout(2);
-
 
162
		switch(EAX & 0xFF)
125
		WaitEventTimeout(2);
163
		{
126
		switch(EAX & 0xFF)
164
			CASE evMouse:
-
 
165
				if (!CheckActiveProcess(Form.ID)) break;
-
 
166
				//Edit URL
-
 
167
				edit_box_mouse stdcall (#address_box);
127
		{
168
				mouse.get();
128
			CASE evMouse:
-
 
129
				if (!CheckActiveProcess(Form.ID)) break;
-
 
130
				edit_box_mouse stdcall (#address_box);
-
 
131
				mouse.get();
169
				//Links hover
132
				if (WB1.list.MouseOver(mouse.x, mouse.y))
170
				if (mouse.y>WB1.list.y) PageLinks.Hover(mouse.x, mouse.y, link_color_inactive, link_color_active, bg_color);
133
				{
-
 
134
					PageLinks.Hover(mouse.x, WB1.list.first*WB1.list.line_h + mouse.y, link_color_inactive, link_color_active, bg_color);
171
				//Menu
135
					if (bufsize) && (mouse.pkm) && (mouse.up) { CreateThread(#menu_rmb,#stak+4092); break; }
172
				if (mouse.y>WB1.list.y) && (mouse.y
136
					if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
173
				{
-
 
174
					if (mouse.pkm) && (mouse.up)
137
					if (mouse.down) && (PageLinks.active>=0) 
175
					{
-
 
176
						CreateThread(#menu_rmb,#stak+4092);
-
 
177
						break; 
-
 
178
					}
-
 
179
				}
138
					{
180
				//Mouse scroll
139
						DrawRectangle(PageLinks.links[PageLinks.active].x, PageLinks.links[PageLinks.active].y,
181
				if (mouse.vert)
140
						PageLinks.links[PageLinks.active].w, PageLinks.links[PageLinks.active].h, 0);
182
				{
141
						ClickLink();
183
					if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
142
					}
184
				}
143
				}
185
				//Drag scroller
144
				//Drag scroller
186
				scroll_wv.all_redraw = 0;
-
 
187
				if (!mouse.lkm) scroll_used=0;
-
 
188
				if (mouse.x>=scroll_wv.start_x) && (mouse.x<=scroll_wv.start_x+scroll_wv.size_x) 
-
 
189
				&& (mouse.y>=scroll_wv.start_y+scroll_wv.btn_height) && (-scroll_wv.btn_height+scroll_wv.start_y+scroll_wv.size_y>mouse.y)
145
				scroll_wv.all_redraw = 0;
190
				&& (WB1.list.count>WB1.list.visible) && (mouse.lkm)
146
				if (!mouse.lkm) scroll_used=0;
191
				{
147
				if (mouse.x>=scroll_wv.start_x) && (mouse.x<=scroll_wv.start_x+scroll_wv.size_x) 
192
					scroll_used=1;
148
				&& (mouse.y>=scroll_wv.start_y+scroll_wv.btn_height) && (-scroll_wv.btn_height+scroll_wv.start_y+scroll_wv.size_y>mouse.y)
193
				}				
149
				&& (WB1.list.count>WB1.list.visible) && (mouse.lkm) scroll_used=1;
Line 263... Line 219...
263
									DSBYTE[EDI-1]='\0';
219
									DSBYTE[EDI-1]='\0';
264
								}
220
								}
265
							}
221
							}
266
							else
222
							else
267
							{
223
							{
268
							//TODO: display error (too many redirects)
224
								notify("Too many redirects");
-
 
225
								StopLoading();
-
 
226
								break;
269
							}
227
							}
270
						} 
228
						} 
271
						else
229
						else
272
						{
230
						{
273
							redirected = 0;
231
							redirected = 0;
Line 290... Line 248...
290
							bufpointer = ESI.http_msg.content_ptr;
248
							bufpointer = ESI.http_msg.content_ptr;
291
							bufsize = ESI.http_msg.content_received;
249
							bufsize = ESI.http_msg.content_received;
292
							http_free stdcall (http_transfer);
250
							http_free stdcall (http_transfer);
293
							http_transfer=0;
251
							http_transfer=0;
294
							SetPageDefaults();
252
							SetPageDefaults();
295
							Draw_Window();		// stop button => refresh button
253
							ShowPage();
296
						}
254
						}
297
					}
255
					}
298
				}
256
				}
299
		}
257
		}
300
	goto BEGIN_LOOP_APPLICATION;
258
	goto BEGIN_LOOP_APPLICATION;
301
}
259
}
Line 302... Line 260...
302
 
260
 
303
void SetElementSizes()
261
void SetElementSizes()
304
{
262
{
305
	address_box.top = TOOLBAR_H-TAB_H/2-7+TAB_H;
263
	address_box.top = TOOLBAR_H/2-7;
306
	address_box.width = Form.cwidth - address_box.left - 25 - 22;
264
	address_box.width = Form.cwidth - address_box.left - 25 - 22;
307
	WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom, 
265
	WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom, 
308
		Form.cheight - TOOLBAR_H - STATUSBAR_H, WB1.list.font_h + WB1.DrawBuf.zoom + WB1.DrawBuf.zoom * WB1.DrawBuf.zoom);
266
		Form.cheight - TOOLBAR_H - STATUSBAR_H, WB1.list.font_h + WB1.DrawBuf.zoom + WB1.DrawBuf.zoom * WB1.DrawBuf.zoom);
309
	WB1.list.wheel_size = 7;
267
	WB1.list.wheel_size = 7;
310
	WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
268
	WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
311
	WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h;
269
	WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h;
312
	WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h * 20);
270
	if (WB1.list.w!=WB1.DrawBuf.bufw) WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h * 20);
Line 313... Line 271...
313
}
271
}
314
 
272
 
315
void Draw_Window()
-
 
316
{
-
 
317
	int img_off;
-
 
318
	// tab {
-
 
319
	/*
-
 
320
	if (TAB_H)
-
 
321
	{
-
 
322
		DrawBar(0, 0, TAB_W, TAB_H+1, panel_color);
-
 
323
		WriteText(5, 7, 0x80, 0xfdfdFd, "Index.htm");
-
 
324
		WriteText(4, 6, 0x80, 0, "Index.htm");		
-
 
325
		DrawBar(TAB_W,0, Form.cwidth-TAB_W,TAB_H, col_bg);
-
 
326
		DrawBar(TAB_W-1,TAB_H, Form.cwidth-TAB_W+1,1, border_color);
-
 
327
		img_draw stdcall(skin.image, TAB_W-13, 0, 30, skin.h, 101, 0);
-
 
328
	} 
-
 
329
	else */ DrawBar(0,0, Form.cwidth,1, col_bg);
273
void Draw_Window()
330
	// }
274
{
331
	DrawBar(0,TAB_H+1, Form.cwidth,TOOLBAR_H-TAB_H-3, panel_color);
275
	DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color);
332
	DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
276
	DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
333
	DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
277
	DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
334
	SetElementSizes();
-
 
335
	DrawRectangle(address_box.left-2, address_box.top-3, address_box.width+4, 20,border_color);
-
 
336
	DrawRectangle(address_box.left-1, address_box.top-2, address_box.width+2, 18,address_box.color);
-
 
337
	DrawRectangle(address_box.left-1, address_box.top-1, address_box.width+2, 16,address_box.color);
278
	SetElementSizes();
338
	// < / >
279
	DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 20,border_color);
339
	DefineButton(address_box.left-49, address_box.top-2, 23, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
280
	DefineButton(address_box.left-50, address_box.top-2, 23, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
340
	DefineButton(address_box.left-25, address_box.top-2, 23, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
-
 
341
	img_draw stdcall(skin.image, address_box.left-50, address_box.top-3, 48, skin.h, 3, 0);
281
	DefineButton(address_box.left-26, address_box.top-2, 23, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
342
	// refresh_BUTTON
-
 
343
	DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
-
 
344
	if (http_transfer > 0) img_off = 131; else img_off = 52;
-
 
345
	img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, img_off, 0);
282
	img_draw stdcall(skin.image, address_box.left-51, address_box.top-3, 48, skin.h, 3, 0);
346
	// config
283
	DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
347
	DefineButton(Form.cwidth-24, address_box.top-3, 19, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
-
 
348
	img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-3, 16, skin.h, 85, 0);
284
	DefineButton(Form.cwidth-24, address_box.top-3, 19, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
349
	//status bar
285
	img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-3, 16, skin.h, 85, 0);
350
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
286
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
351
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
287
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
352
	ShowPage();
288
	if (!header) OpenPage(); else { WB1.DrawPage(); DrawEditBox(); }
353
	DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
289
	DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
Line 354... Line 290...
354
	DrawProgress();
290
	DrawProgress();
355
}
291
}
356
 
292
 
357
 
-
 
358
void Scan(dword id__)
-
 
359
{
-
 
360
	action_buf=0;
-
 
361
	if (id__ >= 400) && (id__ < 1000)
-
 
362
	{
293
 
363
		ProcessLinks(id__);
294
void Scan(dword id__)
364
		return;
295
{
365
	}
296
	action_buf=0;
366
	switch (id__)
297
	switch (id__)
367
	{
298
	{
368
		case SCAN_CODE_BS:
299
		case SCAN_CODE_BS:
369
		case BACK_BUTTON:
-
 
370
			if (!BrowserHistory.GoBack()) return;
300
		case BACK_BUTTON:
371
			OpenPage();
301
			if (!BrowserHistory.GoBack()) return;
372
			return;
302
			OpenPage();
373
 
303
			return;
374
		case FORWARD_BUTTON:
-
 
375
			if (!BrowserHistory.GoForward()) return;
304
		case FORWARD_BUTTON:
376
			OpenPage();
305
			if (!BrowserHistory.GoForward()) return;
377
			return;
306
			OpenPage();
378
 
307
			return;
379
		case SCAN_CODE_HOME:
308
		case SCAN_CODE_HOME:
380
		case SCAN_CODE_END:
309
		case SCAN_CODE_END:
381
		case SCAN_CODE_PGUP:
-
 
382
		case SCAN_CODE_PGDN:
310
		case SCAN_CODE_PGUP:
383
			if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage();
311
		case SCAN_CODE_PGDN:
384
			return;
312
			if (WB1.list.ProcessKey(key_scancode)) WB1.DrawPage();
385
 
313
			return;
386
		case SCAN_CODE_UP:
314
		case SCAN_CODE_UP:
387
			if (WB1.list.first <= 0) return;
-
 
388
			WB1.list.first--;
315
			if (WB1.list.first <= 0) return;
389
			WB1.DrawPage();
316
			WB1.list.first--;
390
			return;
317
			WB1.DrawPage();
391
 
318
			return;
392
		case SCAN_CODE_DOWN:
319
		case SCAN_CODE_DOWN:
393
			if (WB1.list.visible + WB1.list.first >= WB1.list.count) return;
-
 
394
			WB1.list.first++;
320
			if (WB1.list.visible + WB1.list.first >= WB1.list.count) return;
395
			WB1.DrawPage();
321
			WB1.list.first++;
396
			return;
-
 
397
 
322
			WB1.DrawPage();
-
 
323
			return;
-
 
324
		case GOTOURL_BUTTON:
-
 
325
		case SCAN_CODE_ENTER:
398
		case GOTOURL_BUTTON:
326
			if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/') || (!strncmp(#editURL,"WebView:",9))
-
 
327
			{
399
		case SCAN_CODE_ENTER: //enter
328
				strcpy(#URL, #editURL);
400
			if (!editURL[0]) return;
329
			}
-
 
330
			else
401
			if (strncmp(#editURL,"http:",5)) && (editURL[0]!='/') && (strncmp(#editURL,"WebView:",9)) strncpy(#URL,"http://",7);
331
			{
402
			else
332
				strncpy(#URL,"http://",7);
403
				URL[0] = 0;
-
 
404
			strcat(#URL, #editURL);
333
				strcat(#URL, #editURL);
405
			OpenPage();
334
			}
406
			return;
335
			OpenPage();
407
 
336
			return;
408
		case 063: //F5
337
		case 063: //F5
409
			IF(address_box.flags & 0b10) return;
338
			IF(address_box.flags & 0b10) return;
410
		case REFRESH_BUTTON:
339
		case REFRESH_BUTTON:
411
			if (http_transfer > 0) 
340
			if (http_transfer > 0) 
412
			{
341
			{
413
				StopLoading();
342
				StopLoading();
414
				Draw_Window();
-
 
415
			}
343
				Draw_Window();
416
			else OpenPage();
344
			}
417
			return;
345
			else OpenPage();
418
 
346
			return;
419
		case SANDWICH_BUTTON:
347
		case SANDWICH_BUTTON:
420
			mouse.y = TOOLBAR_H-6;
-
 
421
			mouse.x = Form.cwidth - 167;
348
			mouse.y = TOOLBAR_H-6;
422
			CreateThread(#menu_rmb,#stak+4092);
349
			mouse.x = Form.cwidth - 167;
423
			return;
350
			CreateThread(#menu_rmb,#stak+4092);
424
 
351
			return;
425
		case VIEW_SOURCE:
352
		case VIEW_SOURCE:
426
			WB1.list.first = 0;
-
 
427
			ShowSource();
353
			WB1.list.first = 0;
428
			WB1.DrawPage();
354
			ShowSource();
429
			break;
355
			WB1.DrawPage();
430
 
356
			break;
431
		case EDIT_SOURCE:
357
		case EDIT_SOURCE:
432
			if (!strncmp(#URL,"http:",5)) 
358
			if (!strncmp(#URL,"http:",5)) 
433
			{
359
			{
434
				WriteFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
360
				WriteFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
435
				if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
-
 
436
			}
361
				if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
437
			else RunProgram("/rd/1/tinypad", #URL);
362
			}
438
			return;
363
			else RunProgram("/rd/1/tinypad", #URL);
439
 
364
			return;
440
		case FREE_IMG_CACHE:
365
		case FREE_IMG_CACHE:
441
			ImgCache.Free();
-
 
442
			notify(IMAGES_CACHE_CLEARED);
366
			ImgCache.Free();
443
			WB1.DrawPage();
367
			notify(IMAGES_CACHE_CLEARED);
444
			return;
368
			WB1.DrawPage();
445
 
369
			return;
446
		case VIEW_HISTORY:
-
 
447
			strcpy(#URL, URL_SERVICE_HISTORY);
370
		case VIEW_HISTORY:
448
			OpenPage();
371
			strcpy(#URL, URL_SERVICE_HISTORY);
449
			return;
372
			OpenPage();
450
 
373
			return;
451
		case DOWNLOAD_MANAGER:
374
		case DOWNLOAD_MANAGER:
452
			if (!downloader_opened) {
375
			if (!downloader_opened) {
453
				strncpy(#DL_URL, "http://",7);
-
 
454
				CreateThread(#Downloader,#downloader_stak+4092);
376
				strncpy(#DL_URL, "http://",7);
455
			}
377
				CreateThread(#Downloader,#downloader_stak+4092);
456
			return;
378
			}
457
/*
379
			return; /*
458
		case 020:
380
		case 020:
459
		case NEWTAB:
-
 
460
			MoveSize(190,80,OLD,OLD);
381
		case NEWTAB:
461
			RunProgram(#program_path, #URL);
382
			MoveSize(190,80,OLD,OLD);
462
			return;
383
			RunProgram(#program_path, #URL);
463
 
384
			return;
464
		case SEARCHWEB_BUTTON:
-
 
465
			sprintf(#URL,"%s%s",#search_path,#editURL);
385
		case SEARCHWEB_BUTTON:
466
			OpenPage();
386
			sprintf(#URL,"%s%s",#search_path,#editURL);
Line 467... Line 387...
467
			return;
387
			OpenPage();
468
*/
388
			return; */
469
	}
389
	}
470
}
390
}
471
 
391
 
472
 
392
 
473
 
393
 
Line 474... Line 394...
474
void ProcessLinks(int id)
394
void ClickLink()
475
{
395
{
476
	if (http_transfer > 0) 
396
	if (http_transfer > 0) 
477
	{
397
	{
478
		StopLoading();
398
		StopLoading();
479
		BrowserHistory.current--;
399
		BrowserHistory.current--;
Line 561... Line 481...
561
	if (!strncmp(#URL,"WebView:",8))
481
	if (!strncmp(#URL,"WebView:",8))
562
	{
482
	{
563
		SetPageDefaults();
483
		SetPageDefaults();
564
		if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
484
		if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
565
		else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
485
		else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
-
 
486
		DrawEditBox();
566
		return;
487
		return;
567
	}
488
	}
568
	if (!strncmp(#URL,"http:",5))
489
	if (!strncmp(#URL,"http:",5))
569
	{
490
	{
570
		img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 131, 0);
491
		img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 131, 0);
Line 594... Line 515...
594
	}
515
	}
595
}
516
}
Line 596... Line 517...
596
 
517
 
597
DrawEditBox()
518
DrawEditBox()
-
 
519
{
598
{
520
	DrawWideRectangle(address_box.left-2, address_box.top-2, address_box.width+3, 19, 2, address_box.color);
599
	address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
521
	address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
600
	address_box.offset = 0;
522
	address_box.offset = 0;
-
 
523
	edit_box_draw stdcall(#address_box);
-
 
524
	if (http_transfer > 0) EAX = 131; else EAX = 52;
601
	edit_box_draw stdcall(#address_box);
525
	img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, EAX, 0);
Line 602... Line 526...
602
}
526
}
603
 
527
 
Line 628... Line 552...
628
{
552
{
629
	if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
553
	if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
630
	return false;
554
	return false;
631
}
555
}
Line -... Line 556...
-
 
556
 
-
 
557
int SetSkinColors()
-
 
558
{
-
 
559
	dword image_data;
-
 
560
	image_data = DSDWORD[skin.image+24];
-
 
561
	col_bg = DSDWORD[image_data];
-
 
562
	panel_color  = DSDWORD[skin.w*4*4 + image_data];
-
 
563
	border_color = DSDWORD[skin.w*4*7 + image_data];
-
 
564
	wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data];
-
 
565
	$and col_bg, 0x00ffffff
-
 
566
	$and panel_color, 0x00ffffff
-
 
567
	$and border_color, 0x00ffffff
-
 
568
	$and wv_progress_bar.progress_color, 0x00ffffff
-
 
569
}
-
 
570
 
-
 
571
void DrawProgress()
-
 
572
{
-
 
573
	unsigned long btn;
-
 
574
	if (http_transfer == 0) return;
-
 
575
	if (wv_progress_bar.max) btn = address_box.width*wv_progress_bar.value/wv_progress_bar.max; else btn = 30;
-
 
576
	DrawBar(address_box.left-2, address_box.top+15, btn, 2, wv_progress_bar.progress_color);
Line 632... Line 577...
632
 
577
}
633
 
578
 
634
 
579