Exemple #1
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;
}
Exemple #2
0
void drawDeviceList (int start, int end, int selection)
{
	int i;
	position_t p, p_prev, p_next;

	//uint8_t	maxDevices = MIN( gui.maxdevices, menucount );
		
	fillPixmapWithColor( gui.devicelist.pixmap, gui.devicelist.bgcolor);

	makeRoundedCorners( gui.devicelist.pixmap);

	switch (gui.layout)
	{

		case VerticalLayout:
			p.x = (gui.devicelist.width /2);
			p.y =  ( ( images[iSelection].image->height / 2 ) + images[iDeviceScrollPrev].image->height + gui.devicelist.iconspacing );

			// place scroll indicators at top & bottom edges
			p_prev = pos ( gui.devicelist.width / 2 , gui.devicelist.iconspacing );
			p_next = pos ( p_prev.x, gui.devicelist.height - gui.devicelist.iconspacing );
			
			break;
			
		default:	// use Horizontal layout as the default

		case HorizontalLayout:
			p.x = (gui.devicelist.width - ( gui.devicelist.width / gui.maxdevices ) * gui.maxdevices ) / 2 + ( images[iSelection].image->width / 2) + images[iDeviceScrollPrev].image->width + gui.devicelist.iconspacing;
			p.y = ((gui.devicelist.height - font_console.chars[0]->height ) - images[iSelection].image->height) / 2 + ( images[iSelection].image->height / 2 );

			// place scroll indicators at left & right edges
			p_prev = pos ( images[iDeviceScrollPrev].image->width / 2  + gui.devicelist.iconspacing / 2, gui.devicelist.height / 2 );
			p_next = pos ( gui.devicelist.width - ( images[iDeviceScrollNext].image->width / 2 + gui.devicelist.iconspacing / 2), gui.devicelist.height / 2 );
			
			break;
			
	}
	
	// draw visible device icons
	for ( i=0; i < gui.maxdevices; i++ )
	{
		BVRef param = menuItems[start+i].param;

		if((start+i) == selection)
		{
			 if(param->flags & kBVFlagNativeBoot)
				infoMenuNativeBoot = YES;
			 else
			 {
				infoMenuNativeBoot = NO;
				if(infoMenuSelection >= INFOMENU_NATIVEBOOT_START && infoMenuSelection <= INFOMENU_NATIVEBOOT_END)
				infoMenuSelection = 0;
			 }
			 
			if(gui.menu.draw)
				drawInfoMenuItems();
			 
			blend( images[iSelection].image, gui.devicelist.pixmap, centeredAt( images[iSelection].image, p ) );
			
#if DEBUG
			gui.debug.cursor = pos( 10, 100);
			dprintf( &gui.screen, "label     %s\n",   param->label );
			dprintf( &gui.screen, "biosdev   0x%x\n", param->biosdev );
			dprintf( &gui.screen, "type      0x%x\n", param->type );
			dprintf( &gui.screen, "flags     0x%x\n", param->flags );
			dprintf( &gui.screen, "part_no   %d\n",   param->part_no );
			dprintf( &gui.screen, "part_boff 0x%x\n", param->part_boff );
			dprintf( &gui.screen, "part_type 0x%x\n", param->part_type );
			dprintf( &gui.screen, "bps       0x%x\n", param->bps );
			dprintf( &gui.screen, "name      %s\n",   param->name );
			dprintf( &gui.screen, "type_name %s\n",   param->type_name );
			dprintf( &gui.screen, "modtime   %d\n",   param->modTime );
#endif
		}
		
		drawDeviceIcon( param, gui.devicelist.pixmap, p );
		
		if (gui.layout == HorizontalLayout)
		{
			p.x += images[iSelection].image->width + gui.devicelist.iconspacing; 
		}
		if (gui.layout == VerticalLayout)
		{
			p.y += ( images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing ); 
		}
	}

	// draw prev indicator
	if(start)
		blend( images[iDeviceScrollPrev].image, gui.devicelist.pixmap, centeredAt( images[iDeviceScrollPrev].image, p_prev ) );

	// draw next indicator
	if( end < gDeviceCount - 1 )
		blend( images[iDeviceScrollNext].image, gui.devicelist.pixmap, centeredAt( images[iDeviceScrollNext].image, p_next ) );

	gui.redraw = YES;
	
	updateVRAM();
	
}