Пример #1
0
void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p)
{
	int devicetype;
	
	if( diskIsCDROM(device) )
		devicetype = iDeviceCDROM;				// Use CDROM icon
	else
	{	
		switch (device->part_type)
		{
			case kPartitionTypeHFS:

				// TODO: add apple raid icon choices
				
				devicetype = iDeviceHFS;		// Use HFS icon
				break;
				
			case kPartitionTypeHPFS:
				devicetype = iDeviceNTFS;		// Use HPFS / NTFS icon
				break;
				
			case kPartitionTypeFAT16:
				devicetype = iDeviceFAT16;		// Use FAT16 icon
				break;
				
			case kPartitionTypeFAT32:
				devicetype = iDeviceFAT32;		// Use FAT32 icon
				break;
				
			case kPartitionTypeEXT3:
				devicetype = iDeviceEXT3;		// Use EXT2/3 icon
				break;
				
			default:
				devicetype = iDeviceGeneric;	// Use Generic icon
				break;
		}
	}
	
	// draw icon
	blend( images[devicetype].image, buffer, centeredAt( images[devicetype].image, p ));
	
	p.y += (images[iSelection].image->height / 2) + font_console.chars[0]->height;
	
	// draw volume label 
	drawStrCenteredAt( device->label, &font_small, buffer, p);	

}
Пример #2
0
static int countdown( const char * msg, int row, int timeout )
{
    unsigned long time;
    int ch  = 0;
    int col = strlen(msg) + 1;
	
    flushKeyboardBuffer();

	if( bootArgs->Video.v_display == VGA_TEXT_MODE )
	{
		moveCursor( 0, row );
		printf(msg);

	} else {

		position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) );
	
		char dummy[80];
		getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true );
		drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true );
		drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos );
		
		// make this screen the new background
		memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );
		
	}

	int multi_buff = 18 * (timeout);
    int multi = ++multi_buff;

    int lasttime=0;

    for ( time = time18(), timeout++; timeout > 0; )
    {
		if( time18() > lasttime)
		{
			multi--; 
			lasttime=time18();
		}		
  
        if (ch = readKeyboardStatus())
            break;

        // Count can be interrupted by holding down shift,
        // control or alt key
        if ( ( readKeyboardShiftFlags() & 0x0F ) != 0 )
		{
            ch = 1;
            break;
        }

        if ( time18() >= time )
        {
            time += 18;
            timeout--;

			if( bootArgs->Video.v_display == VGA_TEXT_MODE )
			{
				moveCursor( col, row );
				printf("(%d) ", timeout);
			}
        }
	
		if( bootArgs->Video.v_display == GRAPHICS_MODE )
		{
			drawProgressBar( gui.screen.pixmap, 100, gui.progressbar.pos , ( multi * 100 / multi_buff ) );
			gui.redraw = true;
			updateVRAM();
		}

    }

    flushKeyboardBuffer();

    return ch;
}