Subversion Repositories Kolibri OS

Rev

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

Rev 4688 Rev 4692
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 2";
32
	char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.0 Beta 3";
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 2";
39
	char version[]=" Text-based Browser 1.0 Beta 3";
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 57... Line 57...
57
int action_buf;
57
int action_buf;
Line 58... Line 58...
58
 
58
 
59
dword http_transfer = 0;
59
dword http_transfer = 0;
Line 60... Line 60...
60
dword http_buffer;
60
dword http_buffer;
61
 
61
 
62
dword TAB_H = 19;
62
dword TAB_H = false; //19;
63
dword TAB_W = 150;
63
dword TAB_W = 150;
64
dword TOOLBAR_H = 50;
64
dword TOOLBAR_H = 31; //50;
65
dword STATUSBAR_H =18;
65
dword STATUSBAR_H =16;
66
dword col_bg = 0xE4DFE1;
66
dword col_bg = 0xE4DFE1;
Line 67... Line 67...
67
dword panel_color = 0xF1F1F1;
67
dword panel_color = 0xF1F1F1;
Line 268... Line 268...
268
{
268
{
269
	address_box.top = TOOLBAR_H-TAB_H/2-7+TAB_H;
269
	address_box.top = TOOLBAR_H-TAB_H/2-7+TAB_H;
270
	address_box.width = Form.cwidth - address_box.left - 25 - 22;
270
	address_box.width = Form.cwidth - address_box.left - 25 - 22;
271
	WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x, Form.cheight - TOOLBAR_H - STATUSBAR_H, 0, 10);
271
	WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x, Form.cheight - TOOLBAR_H - STATUSBAR_H, 0, 10);
272
	WB1.list.column_max = WB1.list.w - scroll_wv.size_x / 6;
272
	WB1.list.column_max = WB1.list.w - scroll_wv.size_x / 6;
273
	WB1.list.visible = WB1.list.h - 3 / WB1.list.line_h - 2;
273
	WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h;
274
	WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.line_h);
274
	WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.line_h);
275
}
275
}
Line 276... Line 276...
276
 
276
 
277
void Draw_Window()
277
void Draw_Window()
Line 281... Line 281...
281
	GetProcessInfo(#Form, SelfInfo);
281
	GetProcessInfo(#Form, SelfInfo);
282
	if (Form.status_window>2) { DrawTitle(#header); return; }
282
	if (Form.status_window>2) { DrawTitle(#header); return; }
283
	if (Form.height<120) MoveSize(OLD,OLD,OLD,120);
283
	if (Form.height<120) MoveSize(OLD,OLD,OLD,120);
284
	if (Form.width<280) MoveSize(OLD,OLD,280,OLD);
284
	if (Form.width<280) MoveSize(OLD,OLD,280,OLD);
285
	// tab {
285
	// tab {
-
 
286
	if (TAB_H)
-
 
287
	{
286
	DrawBar(0, 0, TAB_W, TAB_H+1, panel_color);
288
		DrawBar(0, 0, TAB_W, TAB_H+1, panel_color);
287
	WriteText(5, 7, 0x80, 0xfdfdFd, "Index.htm");
289
		WriteText(5, 7, 0x80, 0xfdfdFd, "Index.htm");
288
	WriteText(4, 6, 0x80, 0, "Index.htm");
290
		WriteText(4, 6, 0x80, 0, "Index.htm");		
289
	// }
-
 
290
	DrawBar(TAB_W,0, Form.cwidth-TAB_W,TAB_H, col_bg);
291
		DrawBar(TAB_W,0, Form.cwidth-TAB_W,TAB_H, col_bg);
291
	DrawBar(TAB_W-1,TAB_H, Form.cwidth-TAB_W+1,1, border_color);
292
		DrawBar(TAB_W-1,TAB_H, Form.cwidth-TAB_W+1,1, border_color);
-
 
293
		img_draw stdcall(skin.image, TAB_W-13, 0, 30, skin.h, 101, 0);
-
 
294
	} 
-
 
295
	else DrawBar(0,0, Form.cwidth,1, col_bg);
-
 
296
	// }
292
	DrawBar(0,TAB_H+1, Form.cwidth,TOOLBAR_H-TAB_H-3, panel_color);
297
	DrawBar(0,TAB_H+1, Form.cwidth,TOOLBAR_H-TAB_H-3, panel_color);
293
	DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xe9e9e9);
298
	DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xe9e9e9);
294
	DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
299
	DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
295
	img_draw stdcall(skin.image, TAB_W-13, 0, 30, skin.h, 101, 0);
-
 
296
 
-
 
297
	SetElementSizes();
300
	SetElementSizes();
298
	DrawRectangle(address_box.left-1, address_box.top-1, address_box.width+2, 16,address_box.color);
301
	DrawRectangle(address_box.left-1, address_box.top-1, address_box.width+2, 16,address_box.color);
299
	DrawRectangle(address_box.left-2, address_box.top-2, address_box.width+4, 18,border_color);
302
	DrawRectangle(address_box.left-2, address_box.top-2, address_box.width+4, 18,border_color);
300
	// < / >
303
	// < / >
301
	DefineButton(address_box.left-49, address_box.top-1, 23, skin.h-2, 300+BT_HIDE, 0);
304
	DefineButton(address_box.left-49, address_box.top-1, 23, skin.h-2, 300+BT_HIDE, 0);
Line 306... Line 309...
306
	if (http_transfer > 0) img_off = 131; else img_off = 52;
309
	if (http_transfer > 0) img_off = 131; else img_off = 52;
307
	img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, img_off, 0);
310
	img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, img_off, 0);
308
	// config
311
	// config
309
	DefineButton(Form.cwidth-23, address_box.top-2, 17, skin.h-1, 312+BT_HIDE, 0);
312
	DefineButton(Form.cwidth-23, address_box.top-2, 17, skin.h-1, 312+BT_HIDE, 0);
310
	img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-2, 16, skin.h, 85, 0);	
313
	img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-2, 16, skin.h, 85, 0);
311
 
-
 
312
	ShowPage();
-
 
313
	DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
-
 
314
	//status bar
314
	//status bar
315
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
315
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
316
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
316
	DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
317
	progress_bar.top = Form.cheight - STATUSBAR_H + 4;
317
	progress_bar.top = Form.cheight - STATUSBAR_H + 4;
318
	DrawProgress();
318
	DrawProgress();
-
 
319
	ShowPage();
-
 
320
	DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
319
}
321
}
Line 320... Line 322...
320
 
322
 
321
 
323
 
Line 400... Line 402...
400
			
402
			
401
		case HOME:
403
		case HOME:
402
			strcpy(#editURL, "http://kolibrios.org/");
404
			strcpy(#editURL, "http://kolibrios.org/");
403
		case GOTOURL:
405
		case GOTOURL:
404
		case 0x0D: //enter
406
		case 0x0D: //enter
-
 
407
			if ((strncmp(#editURL,"http:",5)!=0) && (editURL[0]!='/') && ((strncmp(#editURL,"WebView:",8)!=0))
-
 
408
			{
-
 
409
				strcpy(#URL,"http://");
-
 
410
			} 
-
 
411
			else
405
			if ((strstr(#editURL,"ttp://")==0) && (editURL[0]!='/')) strcpy(#URL,"http://"); else URL[0] = 0;
412
				URL[0] = 0;
406
			strcat(#URL, #editURL);
413
			strcat(#URL, #editURL);
407
			OpenPage();
414
			OpenPage();
408
			return;
415
			return;
409
		case SEARCHWEB:
416
		case SEARCHWEB:
Line 552... Line 559...
552
void OpenPage()
559
void OpenPage()
553
{
560
{
554
	StopLoading();
561
	StopLoading();
555
	strcpy(#editURL, #URL);
562
	strcpy(#editURL, #URL);
556
	BrowserHistory.AddUrl();
563
	BrowserHistory.AddUrl();
557
	if (strncmp(#URL,"WebView:",8)==0) return;
564
	if (strncmp(#URL,"WebView:",8)==0)
-
 
565
	{
-
 
566
		SetPageDefaults();
-
 
567
		if (strcmp(#URL, URL_SERVICE_HOME)==0) 
-
 
568
		{
-
 
569
			WB1.Prepare(#homepage, sizeof(homepage));
-
 
570
		}
-
 
571
		if (strcmp(#URL, URL_SERVICE_HISTORY)==0)
-
 
572
		{
-
 
573
			ShowHistory();
-
 
574
		}
-
 
575
		return;
-
 
576
	}
558
	if (strncmp(#URL,"http:",5)==0)
577
	if (strncmp(#URL,"http:",5)==0)
559
	{
578
	{
560
		img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, 131, 0);
579
		img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-2, 17, skin.h, 131, 0);
561
		http_get stdcall (#URL, #accept_language);
580
		http_get stdcall (#URL, #accept_language);
562
		http_transfer = EAX;
581
		http_transfer = EAX;
Line 588... Line 607...
588
{
607
{
589
	address_box.size = address_box.pos = strlen(#editURL);
608
	address_box.size = address_box.pos = strlen(#editURL);
590
	address_box.offset=0;
609
	address_box.offset=0;
591
	edit_box_draw stdcall(#address_box);
610
	edit_box_draw stdcall(#address_box);
Line 592... Line -...
592
 
-
 
593
	if (strcmp(#URL, URL_SERVICE_HOME)==0) WB1.Prepare(#homepage, sizeof(homepage)); else
-
 
594
	if (strcmp(#URL, URL_SERVICE_HISTORY)==0) ShowHistory(); else
611
 
595
	if (!bufsize)
612
	if (!bufsize)
596
	{
613
	{
597
		PageLinks.Clear();
614
		PageLinks.Clear();
598
		if (http_transfer<>0)
615
		if (http_transfer<>0)