Subversion Repositories Kolibri OS

Rev

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

Rev 4551 Rev 4554
Line 41... Line 41...
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...
";
43
	unsigned char page_not_found[] = FROM "html\page_not_found_en.htm";
43
	unsigned char page_not_found[] = FROM "html\page_not_found_en.htm";
44
#endif
44
#endif
Line -... Line 45...
-
 
45
 
-
 
46
byte native_http=0;
45
 
47
 
46
proc_info Form;
48
proc_info Form;
47
#define WIN_W 640
49
#define WIN_W 640
Line 48... Line 50...
48
#define WIN_H 480
50
#define WIN_H 480
Line 169... Line 171...
169
				if (action_buf) { Scan(action_buf); action_buf=0;}
171
				if (action_buf) { Scan(action_buf); action_buf=0;}
170
				Draw_Window();
172
				Draw_Window();
171
				break;
173
				break;
Line 172... Line 174...
172
				
174
				
173
			case evNetwork:
-
 
174
				return;
-
 
175
				http_get stdcall (#search_path, 0);	
-
 
176
				http_transfer = EAX;
-
 
177
				IF (http_transfer < 0) notify("Error from HTTP lib");
-
 
178
 
175
			case evNetwork:
179
				if (http_transfer > 0) {
176
				if (http_transfer > 0) {
180
					http_process stdcall (http_transfer);
177
					http_process stdcall (http_transfer);
181
					$push EAX
178
					$push EAX
182
					ESI = http_transfer;
179
					ESI = http_transfer;
183
					bufpointer = ESI.http_msg.content_ptr;
-
 
184
					debug(bufpointer);	
180
					bufpointer = ESI.http_msg.content_ptr;
185
					//bufsize = ESI.http_msg.content_received;
-
 
186
					bufsize = strlen(bufpointer)-2;
-
 
187
					debugi(bufsize);
181
					bufsize = ESI.http_msg.content_received;
-
 
182
					WB1.Parse(bufpointer, bufsize);
188
					WB1.Parse(bufpointer, bufsize);
183
					
189
					$pop EAX	
184
					$pop EAX	
-
 
185
					if (EAX == 0) {	
190
					if (EAX == 0) {			
186
						// Loading the page is complete, free resources
191
						http_free stdcall (http_transfer);
187
						http_free stdcall (http_transfer);
-
 
188
						http_transfer=0;	
-
 
189
						Draw_Window();		// stop button => refresh button
-
 
190
					} else {
-
 
191
						// We are still loading the page, this means that because of crappy memory manager,
-
 
192
						// the address of the HTTP data may change. 
-
 
193
						// Because this would result in pagefault when redrawing window while loading, we disable this possibility.
192
						http_transfer=0;				
194
						bufsize = 0;
193
					}
-
 
194
					pause(10);
195
					}
195
				}
196
				}
196
			default:
197
			default:
197
				if (downloader_id<>0)
198
				if (downloader_id<>0)
198
				{
199
				{
Line 229... Line 230...
229
	}
230
	}
230
	if (Form.height<120) MoveSize(OLD,OLD,OLD,120);
231
	if (Form.height<120) MoveSize(OLD,OLD,OLD,120);
231
	if (Form.width<280) MoveSize(OLD,OLD,280,OLD);
232
	if (Form.width<280) MoveSize(OLD,OLD,280,OLD);
Line 232... Line 233...
232
	
233
	
233
	PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal);
234
	PutPaletteImage(#toolbar,200,42,0,0,8,#toolbar_pal);
Line 234... Line 235...
234
	if (GetProcessSlot(downloader_id)<>0) _PutImage(88,10, 24,24, #stop_btn);
235
	if (GetProcessSlot(downloader_id)<>0) || (http_transfer > 0) _PutImage(88,10, 24,24, #stop_btn);
235
	
236
	
236
	DrawBar(200,0,Form.cwidth-200,43,0xE4DFE1);
237
	DrawBar(200,0,Form.cwidth-200,43,0xE4DFE1);
237
	DrawBar(0,42,Form.cwidth,1,0xE2DBDC);
238
	DrawBar(0,42,Form.cwidth,1,0xE2DBDC);
Line 303... Line 304...
303
		case 054: //F5
304
		case 054: //F5
304
			IF(address_box.flags & 0b10) WB1.Parse(bufpointer, bufsize);
305
			IF(address_box.flags & 0b10) WB1.Parse(bufpointer, bufsize);
305
			return;
306
			return;
Line 306... Line 307...
306
 
307
 
-
 
308
		case REFRESH:
-
 
309
			if (http_transfer<>0)
-
 
310
			{
-
 
311
				EAX = http_transfer;
-
 
312
				EAX = EAX.http_msg.content_ptr;		// get pointer to data
-
 
313
				$push	EAX							// save it on the stack
-
 
314
				http_free stdcall (http_transfer);	// abort connection
-
 
315
				$pop	EAX							
-
 
316
				mem_Free(EAX);						// free data
-
 
317
				http_transfer=0;
-
 
318
				bufsize = 0;
307
		case REFRESH:
319
			}
308
			if (GetProcessSlot(downloader_id)<>0)
320
			if (GetProcessSlot(downloader_id)<>0)
309
			{
321
			{
310
				KillProcess(downloader_id);
322
				KillProcess(downloader_id);
311
				pause(20);
323
				pause(20);
Line 442... Line 454...
442
	BrowserHistory.AddUrl();
454
	BrowserHistory.AddUrl();
443
	strcpy(#header, #version);
455
	strcpy(#header, #version);
444
	pre_text =0;
456
	pre_text =0;
445
	if (!strncmp(#URL,"http:",5))
457
	if (!strncmp(#URL,"http:",5))
446
	{
458
	{
-
 
459
		if (native_http)
-
 
460
		{
-
 
461
			http_get stdcall (#URL, 0);	
-
 
462
			http_transfer = EAX;
-
 
463
			IF (http_transfer < 0) notify("Error from HTTP lib");
-
 
464
		}
-
 
465
		else
-
 
466
		{
447
		KillProcess(downloader_id);
467
			KillProcess(downloader_id);
448
		DeleteFile(#download_path);
468
			DeleteFile(#download_path);
449
		downloader_id = RunProgram("/sys/network/downloader", #URL);
469
			downloader_id = RunProgram("/sys/network/downloader", #URL);
450
		IF (downloader_id<0) notify("Error running Downloader. Internet unavilable.");
470
			IF (downloader_id<0) notify("Error running Downloader. Internet unavilable.");
-
 
471
		}
451
		Draw_Window();
472
		Draw_Window();
452
		return;
473
		return;
453
	}
474
	}
454
	WB1.list.first = WB1.list.count =0;
475
	WB1.list.first = WB1.list.count =0;
455
	WB1.ReadHtml(_WIN);
476
	WB1.ReadHtml(_WIN);