Subversion Repositories Kolibri OS

Rev

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

Rev 5825 Rev 5978
Line 11... Line 11...
11
#define MEMSIZE 0x100000
11
#define MEMSIZE 0x100000
12
#include "..\lib\gui.h"
12
#include "..\lib\gui.h"
13
#include "..\lib\draw_buf.h"
13
#include "..\lib\draw_buf.h"
14
#include "..\lib\list_box.h"
14
#include "..\lib\list_box.h"
15
#include "..\lib\cursor.h"
15
#include "..\lib\cursor.h"
-
 
16
#include "..\lib\collection.h"
16
//*.obj libraries
17
//*.obj libraries
17
#include "..\lib\obj\box_lib.h"
18
#include "..\lib\obj\box_lib.h"
18
#include "..\lib\obj\libio_lib.h"
19
#include "..\lib\obj\libio_lib.h"
19
#include "..\lib\obj\libimg_lib.h"
20
#include "..\lib\obj\libimg_lib.h"
20
#include "..\lib\obj\http.h"
21
#include "..\lib\obj\http.h"
21
#include "..\lib\obj\iconv.h"
22
#include "..\lib\obj\iconv.h"
22
//useful patterns
23
//useful patterns
23
#include "..\lib\patterns\libimg_load_skin.h"
24
#include "..\lib\patterns\libimg_load_skin.h"
-
 
25
#include "..\lib\patterns\history.h"
Line 24... Line 26...
24
 
26
 
Line 25... Line 27...
25
char homepage[] = FROM "html\\homepage.htm";
27
char homepage[] = FROM "html\\homepage.htm";
26
 
28
 
Line 212... Line 214...
212
						if (redirected>0)
214
						if (redirected>0)
213
						{
215
						{
214
							http_free stdcall (http_transfer);
216
							http_free stdcall (http_transfer);
215
							http_transfer=0;
217
							http_transfer=0;
216
							PageLinks.GetAbsoluteURL(#URL);
218
							PageLinks.GetAbsoluteURL(#URL);
217
							BrowserHistory.cur_y--;
219
							History.back();
218
							strcpy(#editURL, #URL);
220
							strcpy(#editURL, #URL);
219
							DrawEditBox();
221
							DrawEditBox();
220
							OpenPage();
222
							OpenPage();
221
						}
223
						}
222
						else
224
						else
223
						{
225
						{
224
							BrowserHistory.AddUrl();
226
							History.add(#URL);
225
							ESI = http_transfer;
227
							ESI = http_transfer;
226
							bufpointer = ESI.http_msg.content_ptr;
228
							bufpointer = ESI.http_msg.content_ptr;
227
							bufsize = ESI.http_msg.content_received;
229
							bufsize = ESI.http_msg.content_received;
228
							http_free stdcall (http_transfer);
230
							http_free stdcall (http_transfer);
229
							http_transfer=0;
231
							http_transfer=0;
Line 275... Line 277...
275
	if (WB1.list.ProcessKey(id__)) WB1.DrawPage();
277
	if (WB1.list.ProcessKey(id__)) WB1.DrawPage();
276
	else switch (id__)
278
	else switch (id__)
277
	{
279
	{
278
		case SCAN_CODE_BS:
280
		case SCAN_CODE_BS:
279
		case BACK_BUTTON:
281
		case BACK_BUTTON:
280
			if (!BrowserHistory.GoBack()) return;
282
			if (History.back()) {
-
 
283
				strcpy(#URL, History.current());
281
			OpenPage();
284
				OpenPage();
-
 
285
			}
282
			return;
286
			return;
283
		case FORWARD_BUTTON:
287
		case FORWARD_BUTTON:
284
			if (!BrowserHistory.GoForward()) return;
288
			if (History.forward()) {
-
 
289
				strcpy(#URL, History.current());
285
			OpenPage();
290
				OpenPage();
-
 
291
			}
286
			return;
292
			return;
287
		case GOTOURL_BUTTON:
293
		case GOTOURL_BUTTON:
288
		case SCAN_CODE_ENTER:
294
		case SCAN_CODE_ENTER:
289
			if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/') || (!strncmp(#editURL,"WebView:",9))
295
			if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/') || (!strncmp(#editURL,"WebView:",9))
290
			{
296
			{
Line 385... Line 391...
385
void OpenPage()
391
void OpenPage()
386
{
392
{
387
	StopLoading();
393
	StopLoading();
388
	souce_mode = false;
394
	souce_mode = false;
389
	strcpy(#editURL, #URL);
395
	strcpy(#editURL, #URL);
390
	BrowserHistory.AddUrl();
396
	History.add(#URL);
391
	if (!strncmp(#URL,"WebView:",8))
397
	if (!strncmp(#URL,"WebView:",8))
392
	{
398
	{
393
		SetPageDefaults();
399
		SetPageDefaults();
394
		if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
400
		if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
395
		else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
401
		else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
Line 446... Line 452...
446
	}
452
	}
447
	else
453
	else
448
	{
454
	{
449
		WB1.Prepare();
455
		WB1.Prepare();
450
	}
456
	}
451
 
-
 
452
	//if (!header) strcpy(#header, #version);
457
	//if (!header) strcpy(#header, #version);
453
	if (!strcmp(#version, #header)) DrawTitle(#header);
458
	if (!strcmp(#version, #header)) DrawTitle(#header);
454
}
459
}
Line 455... Line 460...
455
 
460
 
Line 484... Line 489...
484
void ClickLink()
489
void ClickLink()
485
{
490
{
486
	if (http_transfer > 0) 
491
	if (http_transfer > 0) 
487
	{
492
	{
488
		StopLoading();
493
		StopLoading();
489
		BrowserHistory.cur_y--;
494
		History.back();
490
	}
495
	}
Line 491... Line 496...
491
 
496
 
492
	strcpy(#URL, PageLinks.GetURL(PageLinks.active));	
497
	strcpy(#URL, PageLinks.GetURL(PageLinks.active));	
493
	//#1
498
	//#1
494
	if (URL[0] == '#')
499
	if (URL[0] == '#')
495
	{
500
	{
496
		strcpy(#anchor, #URL+strrchr(#URL, '#'));		
501
		strcpy(#anchor, #URL+strrchr(#URL, '#'));		
497
		strcpy(#URL, BrowserHistory.CurrentUrl());
502
		strcpy(#URL, History.current());
498
		WB1.list.first=WB1.list.count-WB1.list.visible;
503
		WB1.list.first=WB1.list.count-WB1.list.visible;
499
		ShowPage();
504
		ShowPage();
500
		return;
505
		return;
501
	}
506
	}
Line 516... Line 521...
516
		{
521
		{
517
			strcpy(#DL_URL, #URL);
522
			strcpy(#DL_URL, #URL);
518
			CreateThread(#Downloader,#downloader_stak+4092);
523
			CreateThread(#Downloader,#downloader_stak+4092);
519
		}
524
		}
520
		else RunProgram("@open", #URL);
525
		else RunProgram("@open", #URL);
521
		strcpy(#editURL, BrowserHistory.CurrentUrl());
526
		strcpy(#editURL, History.current());
522
		strcpy(#URL, BrowserHistory.CurrentUrl());
527
		strcpy(#URL, History.current());
523
		return;
528
		return;
524
	}
529
	}
525
	if (!strncmp(#URL,"mailto:", 7))
530
	if (!strncmp(#URL,"mailto:", 7))
526
	{
531
	{
527
		notify(#URL);
532
		notify(#URL);
528
		strcpy(#editURL, BrowserHistory.CurrentUrl());
533
		strcpy(#editURL, History.current());
529
		strcpy(#URL, BrowserHistory.CurrentUrl());
534
		strcpy(#URL, History.current());
530
		return;
535
		return;
531
	}
536
	}
532
	OpenPage();
537
	OpenPage();
533
	return;
538
	return;
534
}
539
}