ui_playlist.c
来自「MP3 整个 SDK」· C语言 代码 · 共 187 行
C
187 行
/*
*******************************************************************************
* ACTOS AP
* ap common lib, directory control file
*
* (c) Copyright, Actions Co,Ld.
* All Right Reserved
*
* $Id: ui_playlist.c,v 1.1.1.1 2006/05/22 03:23:59 selina Exp $
*******************************************************************************
*/
#pragma codeseg(COM_PLAYLIST)
#include "ap_common.h"
#include "filesys.h"
WORD playlist_active,cur_grouplist; //目录总数,文件总数和浏览项数,浏览活动项
extern BYTE PlaylistClass;
extern BYTE PlaylistClassTotal;
#pragma memory=dataseg(RCODE)
#pragma memory=default
void ShowPlaylist(BYTE top,BYTE bottom,BYTE Old_active,BYTE active,BYTE string_id);
void reinit_idm_buf_playlist(int top, int bottom, char *Namebuf, BYTE string_id, BOOL direct);
/********************************************************************************
* Description : select the directory.
*
* Arguments :
* location: get thedisk type
* type : show file kind
* string_id: language type
* Returns :
* other: Successful
* 0: Fail, detail information in fselError
* Notes : only select the valid directory
*
********************************************************************************/
int ui_playlist(file_location_t *location, BYTE type,BYTE string_id)
{
char Strname[28];
BYTE PriInv;
char key;
int top, bottom;
if ( !fselSetLocation(location) )
{
//return RESULT_IGNORE;
}
if (PlaylistClassTotal == 0)
return RESULT_IGNORE;
memset(Strname, 0x00, 28);
while(PlaylistClass) //返回根目录
{
fselGetPrevGroup(Strname);
}
// fselGetNextGroup(Strname);
top=0;
bottom=4;
playlist_active=0;
cur_grouplist=0;
if(PlaylistClassTotal<5)
bottom=PlaylistClassTotal-1;
FSELGetLocation(location); //保存location
reinit_idm_buf_playlist(top, bottom, Strname, string_id,TRUE);
FSELSetLocation(location);
ShowPlaylist(top,bottom,playlist_active,playlist_active,string_id);
while(ap_get_message()!=0) {;} //丢掉多余按键
ap_message_init(NULL);
while(1)
{
//handle msg
key = ap_get_message();
switch(key)
{
case AP_KEY_NEXT:
case AP_KEY_NEXT | AP_KEY_HOLD:
if(playlist_active<PlaylistClassTotal -1 ) //当前项小于总列表数
{
fselGetNextGroup(Strname);
playlist_active++;
if(playlist_active/5==cur_grouplist)
{
ShowPlaylist(top,bottom,playlist_active-1,playlist_active,string_id);
}
else
{
cur_grouplist=cur_grouplist+1;
top=(playlist_active/5)*5; //顶的序号
bottom=top+4; //底的序号
if(bottom>(PlaylistClassTotal-1))
bottom=PlaylistClassTotal-1;
FSELGetLocation(location);
reinit_idm_buf_playlist(top, bottom, Strname, string_id,TRUE); //换页要重新初始化IDM数据
FSELSetLocation(location);
ShowPlaylist(top,bottom,playlist_active,playlist_active,string_id);
}
}
// else
// {
// ShowPlaylist(top,bottom,playlist_active-1,playlist_active,string_id);
// }
while(ap_get_message() != 0);
break;
case AP_KEY_PREV:
case AP_KEY_PREV | AP_KEY_HOLD :
//if(PlaylistClass==1) //第一个列表
// break;
//fselGetPrevGroup(Strname); //选择上一个列表
if(playlist_active >0)
{
fselGetPrevGroup(Strname);
playlist_active--;
if(playlist_active/5==cur_grouplist)
{
ShowPlaylist(top,bottom,playlist_active+1,playlist_active,string_id);
}
else
{
cur_grouplist=cur_grouplist-1;
top=(playlist_active/5)*5; //顶的序号
bottom=top+4; //底的序号
// if(bottom>(PlaylistClassTotal-1)
// bottom=lPlaylistClassTotal-1;
FSELGetLocation(location);
reinit_idm_buf_playlist(top, bottom, Strname, string_id,FALSE); //换页要重新初始化IDM数据
FSELSetLocation(location);
ShowPlaylist(top,bottom,playlist_active,playlist_active,string_id);
}
}
while(ap_get_message() != 0);
break;
case AP_KEY_PLAY | AP_KEY_UP:
FSELSetLocation(location);
return RESULT_IGNORE;
break;
case AP_KEY_MODE | AP_KEY_LONG:
//if ( Strname[0] != '\\' )
//{
if (FSELGetLocation(location))
return RESULT_NULL;
else
return RESULT_IGNORE;
//}
break;
case AP_KEY_MODE | AP_KEY_UP:
break;
case AP_MSG_WAIT_TIMEOUT:
if (FSELGetLocation(location))
return RESULT_NULL;
else
return RESULT_IGNORE;
break;
//}
case AP_MSG_SD_OUT:
//如在游览SD卡,但SD卡又被拔出,就返回拔出信号
if (location->disk == 'H')
{
return RESULT_SD_OUT;
}
break;
case AP_MSG_SD_IN:
break;
default:
key=ap_handle_hotkey(key);
if(key == RESULT_REDRAW)
{
ShowPlaylist(top,bottom,playlist_active,playlist_active,string_id);
}
else if(key != 0)
{
FSELGetLocation(location);
return key;
}
} //switch()
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?