Subversion Repositories Kolibri OS

Rev

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

Rev 4677 Rev 4686
Line 27... Line 27...
27
#include "..\lib\lib.obj\http.h"
27
#include "..\lib\lib.obj\http.h"
Line 28... Line 28...
28
 
28
 
Line 29... Line 29...
29
char homepage[] = FROM "html\homepage.htm";
29
char homepage[] = FROM "html\homepage.htm";
30
 
30
 
31
#ifdef LANG_RUS
31
#ifdef LANG_RUS
32
	char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.0 Beta 1";
32
	char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.0 Beta 2";
33
	?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
33
	?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
34
	?define T_LAST_SLIDE "â® ¯®á«¥¤­¨© á« ©¤"
34
	?define T_LAST_SLIDE "â® ¯®á«¥¤­¨© á« ©¤"
35
	char loading[] = "‡ £à㧪  áâà ­¨æë...
";
35
	char loading[] = "‡ £à㧪  áâà ­¨æë...
";
36
	char page_not_found[] = FROM "html\page_not_found_ru.htm";
36
	char page_not_found[] = FROM "html\page_not_found_ru.htm";
37
	char accept_language[]= "Accept-Language: ru\n";
37
	char accept_language[]= "Accept-Language: ru\n";
38
#else
38
#else
39
	char version[]=" Text-based Browser 1.0 Beta 1";
39
	char version[]=" Text-based Browser 1.0 Beta 2";
40
	?define IMAGES_CACHE_CLEARED "Images cache cleared"
40
	?define IMAGES_CACHE_CLEARED "Images cache cleared"
41
	?define T_LAST_SLIDE "This slide is the last"
41
	?define T_LAST_SLIDE "This slide is the last"
42
	char loading[] = "Loading...
";
42
	char loading[] = "Loading...
";
Line 65... Line 65...
65
dword STATUSBAR_H =18;
65
dword STATUSBAR_H =18;
66
dword col_bg = 0xE4DFE1;
66
dword col_bg = 0xE4DFE1;
67
dword panel_color = 0xF1F1F1;
67
dword panel_color = 0xF1F1F1;
68
dword border_color = 0x9F9F9F;
68
dword border_color = 0x9F9F9F;
Line 69... Line 69...
69
 
69
 
Line 70... Line 70...
70
pb progress_bar = {0, 10, 83, 150, 13, 0, 0, 100, 0xeeeEEE, 8072B7EBh, 0x9F9F9F};
70
pb progress_bar = {0, 10, 83, 150, 12, 0, 0, 100, 0xeeeEEE, 8072B7EBh, 0x9F9F9F};
71
 
71
 
72
#include "..\TWB\TWB.c"
72
#include "..\TWB\TWB.c"
Line 87... Line 87...
87
} skin;
87
} skin;
Line 88... Line 88...
88
 
88
 
89
int LoadSkin()
89
int LoadSkin()
90
{
90
{
-
 
91
	skin.image = load_image(abspath("wv_skin.png"));
91
	skin.image = load_image(abspath("wv_skin.png"));
92
	if (!skin.image) notify("WebView skin file 'wv_skin.png' not found, program will terminate");
92
	skin.w = DSWORD[skin.image+4];
93
	skin.w = DSWORD[skin.image+4];
93
	skin.h = DSWORD[skin.image+8];
94
	skin.h = DSWORD[skin.image+8];
Line -... Line 95...
-
 
95
}
-
 
96
 
-
 
97
void DrawProgress()
-
 
98
{
-
 
99
	unsigned long btn;
-
 
100
	//progressbar_draw stdcall(#progress_bar);
-
 
101
	progress_bar.width = progress_bar.left = 0;
-
 
102
	if (http_transfer == 0) return;
-
 
103
	if (progress_bar.max) btn = address_box.width*progress_bar.value/progress_bar.max; else btn = 30;
-
 
104
	DrawBar(address_box.left-1, address_box.top+14, btn, 2, progress_bar.progress_color);
94
}
105
}
95
 
106
 
96
void main()
107
void main()
97
{
108
{
98
	int key, btn;
109
	unsigned long key, btn;
Line 99... Line 110...
99
	int half_scroll_size;
110
	int half_scroll_size;
100
	int scroll_used=0, show_menu;
111
	int scroll_used=0, show_menu;
101
	
112
	
102
	mem_Init();
113
	mem_Init();
103
	CursorPointer.Load(#CursorFile);
114
	CursorPointer.Load(#CursorFile);
104
	if (load_dll2(boxlib, #box_lib_init,0)!=0) {notify("System Error: library doesn't exists /rd/1/lib/box_lib.obj"); ExitProcess();}
115
	if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("System Error: library doesn't exists /rd/1/lib/box_lib.obj");
105
	if (load_dll2(libio, #libio_init,1)!=0) notify("Error: library doesn't exists - libio");
116
	if (load_dll2(libio, #libio_init,1)!=0) notify("Error: library doesn't exists - libio");
Line 190... Line 201...
190
				if (http_transfer > 0) {
201
				if (http_transfer > 0) {
191
					http_process stdcall (http_transfer);
202
					http_process stdcall (http_transfer);
192
					$push EAX
203
					$push EAX
193
					ESI = http_transfer;
204
					ESI = http_transfer;
194
					progress_bar.max = ESI.http_msg.content_length;
205
					progress_bar.max = ESI.http_msg.content_length;
-
 
206
					if (progress_bar.value != ESI.http_msg.content_received)
-
 
207
					{
195
					progress_bar.value = ESI.http_msg.content_received;
208
						progress_bar.value = ESI.http_msg.content_received;	
196
					progressbar_draw stdcall(#progress_bar);
209
						DrawProgress();
-
 
210
					}
197
					$pop EAX
211
					$pop EAX
198
					if (EAX == 0) {
212
					if (EAX == 0) {
199
						ESI = http_transfer;
213
						ESI = http_transfer;
200
						// Handle redirects
214
						// Handle redirects
201
						if (ESI.http_msg.status >= 300) && (ESI.http_msg.status < 400)
215
						if (ESI.http_msg.status >= 300) && (ESI.http_msg.status < 400)
Line 226... Line 240...
226
						// Loading the page is complete, free resources
240
						// Loading the page is complete, free resources
227
						if (redirected>0)
241
						if (redirected>0)
228
						{
242
						{
229
							http_free stdcall (http_transfer);
243
							http_free stdcall (http_transfer);
230
							http_transfer=0;
244
							http_transfer=0;
231
							WB1.GetNewUrl();
245
							PageLinks.GetAbsoluteURL(#URL);
232
							strcpy(#editURL, #URL);
246
							strcpy(#editURL, #URL);
233
							BrowserHistory.current--;
-
 
234
							OpenPage();
247
							OpenPage();
235
						}
248
						}
236
						else
249
						else
237
						{
250
						{
-
 
251
							BrowserHistory.AddUrl();
238
							ESI = http_transfer;
252
							ESI = http_transfer;
239
							bufpointer = ESI.http_msg.content_ptr;
253
							bufpointer = ESI.http_msg.content_ptr;
240
							bufsize = ESI.http_msg.content_received;
254
							bufsize = ESI.http_msg.content_received;
241
							http_free stdcall (http_transfer);
255
							http_free stdcall (http_transfer);
242
							http_transfer=0;
256
							http_transfer=0;
Line 272... Line 286...
272
	WriteText(5, 7, 0x80, 0xfdfdFd, "Index.htm");
286
	WriteText(5, 7, 0x80, 0xfdfdFd, "Index.htm");
273
	WriteText(4, 6, 0x80, 0, "Index.htm");
287
	WriteText(4, 6, 0x80, 0, "Index.htm");
274
	// }
288
	// }
275
	DrawBar(TAB_W,0, Form.cwidth-TAB_W,TAB_H, col_bg);
289
	DrawBar(TAB_W,0, Form.cwidth-TAB_W,TAB_H, col_bg);
276
	DrawBar(TAB_W-1,TAB_H, Form.cwidth-TAB_W+1,1, border_color);
290
	DrawBar(TAB_W-1,TAB_H, Form.cwidth-TAB_W+1,1, border_color);
277
	DrawBar(0,TAB_H+1, Form.cwidth,TOOLBAR_H-TAB_H-2, panel_color);
291
	DrawBar(0,TAB_H+1, Form.cwidth,TOOLBAR_H-TAB_H-3, panel_color);
-
 
292
	DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xe9e9e9);
278
	DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
293
	DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
279
	img_draw stdcall(skin.image, TAB_W-13, 0, 30, skin.h, 101, 0);
294
	img_draw stdcall(skin.image, TAB_W-13, 0, 30, skin.h, 101, 0);
Line 280... Line 295...
280
 
295
 
281
	SetElementSizes();
296
	SetElementSizes();
Line 297... Line 312...
297
	DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
312
	DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
298
	//status bar
313
	//status bar
299
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
314
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
300
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
315
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
301
	progress_bar.top = Form.cheight - STATUSBAR_H + 4;
316
	progress_bar.top = Form.cheight - STATUSBAR_H + 4;
302
	progressbar_draw stdcall(#progress_bar);
317
	DrawProgress();
303
}
318
}
Line 304... Line 319...
304
 
319
 
305
 
320
 
Line 476... Line 491...
476
	{
491
	{
477
		strcpy(#anchor, #URL+strrchr(#URL, '#'));
492
		strcpy(#anchor, #URL+strrchr(#URL, '#'));
478
		URL[strrchr(#URL, '#')-1] = 0x00;
493
		URL[strrchr(#URL, '#')-1] = 0x00;
479
	}
494
	}
Line 480... Line 495...
480
	
495
	
Line 481... Line 496...
481
	WB1.GetNewUrl();
496
	PageLinks.GetAbsoluteURL(#URL);
482
	
497
	
483
	if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg"))
498
	if (!strcmp(#URL + strlen(#URL) - 4, ".gif")) || (!strcmp(#URL + strlen(#URL) - 4, ".png")) || (!strcmp(#URL + strlen(#URL) - 4, ".jpg"))
484
	{
499
	{
Line 531... Line 546...
531
 
546
 
532
void OpenPage()
547
void OpenPage()
533
{
548
{
534
	StopLoading();
549
	StopLoading();
535
	strcpy(#editURL, #URL);
-
 
536
	BrowserHistory.AddUrl();
550
	strcpy(#editURL, #URL);
537
	if (strncmp(#URL,"WebView:",8)==0) return;
551
	if (strncmp(#URL,"WebView:",8)==0) return;
538
	if (strncmp(#URL,"http:",5)==0)
552
	if (strncmp(#URL,"http:",5)==0)
539
	{
553
	{
540
		img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, 131, 0);
554
		img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, 131, 0);
Line 549... Line 563...
549
			return;
563
			return;
550
		}
564
		}
551
	}
565
	}
552
	else
566
	else
553
	{
567
	{
-
 
568
		BrowserHistory.AddUrl();
554
		file_size stdcall (#URL);
569
		file_size stdcall (#URL);
555
		bufsize = EBX;
570
		bufsize = EBX;
556
		if (bufsize)
571
		if (bufsize)
557
		{
572
		{
558
			bufpointer = mem_Free(bufpointer);
573
			bufpointer = mem_Free(bufpointer);