void CSelectLocation::HandleKeys( CRBXInput::KEYS _key, bool _pressed )
{
	if( _pressed ) return; /* handle it only if key released is */

	switch( _key )
	{
		case CRBXInput::POWER:
			break;
		case CRBXInput::PLAY:
			this->subhandler = new CPlayPLRandom( GetPlayList( g_settings.library_root + "/" + locations[menu_top + menu_selected] ) );
			break;
		case CRBXInput::SELECT:
			std::cout << "get locations[menu_top + menu_selected] " << g_settings.library_root + "/" + locations[menu_top + menu_selected] << std::endl;
			this->subhandler = new CPlayListEntries( GetPlayList( g_settings.library_root + "/" + locations[menu_top + menu_selected] ) );
			break;
		case CRBXInput::UP:
			menu_selected --;
			break;
		case CRBXInput::DOWN:
			menu_selected ++;
			break;
		case CRBXInput::MENU:
			remove = true;
			break;
		case CRBXInput::DISPLAY:
			this->subhandler = new CPlayListOptions( g_settings.library_root + "/" + locations[menu_top + menu_selected] );
			break;
		default:
			break;
	}

	if( menu_selected == (long)locations.size() || menu_selected == NUM_MENU_LINES )
	{
		if( NUM_MENU_LINES < locations.size() - menu_top )
		{
			menu_top++;
		}
	
		menu_selected = (locations.size() > NUM_MENU_LINES )?NUM_MENU_LINES-1:locations.size()-1;
	}
	else
	if( menu_selected < 0 )
	{
		if( 0 < menu_top )
		{
			menu_top--;
		}
	
		menu_selected = 0;
	}


}
Exemple #2
0
int main(void) {
    #if 1
    if(TextRead(file_path, &playHead) < 0) {
        printf("deal data fail\n");
        return -1;
    }
    #else
    if(GetPlayList(file_path, &playHead) < 0) {
        printf("get play list fail\n");
        return -1;
    }
    #endif
    //free(data);
    printf("\nget file end here\n");

    return 0;
}