ui_playlist2.c

来自「MP3 整个 SDK」· C语言 代码 · 共 161 行

C
161
字号
/*
*******************************************************************************
*                ACTOS AP
*        ap common lib, directory control file
*
*        (c) Copyright, Actions Co,Ld.
*             All Right Reserved
*
*  $Id: ui_playlist2.c,v 1.1.1.1 2006/05/22 03:23:59 selina Exp $
*******************************************************************************
*/
#pragma codeseg(COM_PLAYLIST)

#include "ap_common.h"
#pragma memory=dataseg(IDM_COM_FSL_D)
char com_fname[5][30];
#pragma memory=default
//extern const char menu_pos_menu[6];
extern const char menu_pos_list[6];
extern char    PlayListFileName[12];

//向IDM数组写数据
BOOL write_idm_data_playlist(char *name, int count)
{
     byte status;
     status = input8(0x05);
     output8(0x05, 0x26);
     memcpy( com_fname[count], name, 30);
     output8(0x05, status);

}

//取一屏数据到IDM数组中
void reinit_idm_buf_playlist(int top, int bottom, char *Namebuf, BYTE string_id,BOOL direction)
{
    int i,NameNum;
    char name_buf[28];
    char Longnamebuf[30];
    memcpy(name_buf,Namebuf,12);
    for(i = top; i <= bottom; i++)
    {
      if( fselGetCurGroupL(Longnamebuf,28) )
        {
            unitochar(Longnamebuf,14*2+2,string_id);   //   
          if(direction)  
            write_idm_data_playlist(Longnamebuf, i - top);
          else
            write_idm_data_playlist(Longnamebuf, bottom-i);   
        }
        else 
          { 
            if(direction)              
              write_idm_data_playlist(name_buf, i - top);     
            else   
              write_idm_data_playlist(name_buf, bottom-i); 
          }     
           
     if(direction)       
       fselGetNextGroup(name_buf);            // 取下页数据
     else 
       fselGetPrevGroup(name_buf);           // 取上页数据
    }

}

//读数据到数组name中
void read_idm_data_playlist(char *name, int count)
{
     byte status;
     status = input8(0x05);
     output8(0x05 ,0x26);
     memcpy(name, com_fname[count], 30);
     output8(0x05, status);
}


/********************************************************************************
* Description : show the directory.
*
* Arguments  :
*            location: get thedisk type
*            Invpath: the "\" or name
*            Namebuf:the string you will display
*            type : show file kind
*            string_id: language type
* Returns     :
*            other:    Successful
*            0:    Fail, detail information in fselError
* Notes       :  only display the valid directory
*
********************************************************************************/
void ShowPlaylist(BYTE top,BYTE bottom,BYTE Old_active,BYTE active,BYTE string_id)
{

    int i,tmp;
    char        Longnamebuf[30];
    char        Playlist[8];
//    SetAsciiFont(FONT_TYPE_LARGE);
    SetTextOutMode(1);

 if(Old_active!=active)

  {
 //清除旧的活动列表项
     tmp=Old_active%5; 
     ResShowPic(MENUBCK5-tmp ,menu_bck_x_def, menu_pos_list[tmp+1]-4);            //分段刷新背景
     ResShowPic(DHT,194,8);
     ResShowPic(MFILE, explorer_pic_x_def, menu_pos_list[tmp+1]-1);
     SetTextPos(explorer_str_x_def, menu_pos_list[tmp+1]-2);
     read_idm_data_playlist(Longnamebuf,tmp);   
     SetPenColor(Color_WHITE_def);                              //取列表名
     PutS(Longnamebuf, -1);

 //显示当前活动项
     tmp=active%5;
     ResShowPic(MFILE, explorer_pic_x_def, menu_pos_list[tmp+1]-1);
     ResShowPic(FILEBCK, explorer_str_x_def-2, menu_pos_list[tmp+1]-4);
     ResShowPic(DHTHK,194,menu_pos_list[tmp+1]+6);
     SetTextPos(explorer_str_x_def, menu_pos_list[tmp+1]-2);
     read_idm_data_playlist(Longnamebuf,tmp); 
     SetPenColor(Color_WHITE_def);                                //取列表名
     PutS(Longnamebuf, -1);
  }


 else  //if(Old_active==active)               刷新一页屏

  {
    ResShowPic(MENUTWO,0,0);
    ResShowPic(DHT,194,8);
    SetPenColor(Color_WHITE_def);
    //ResShowMultiString( VSTOPM1,string_id, 3, 110);
    ResShowPic(MDIR, 10, POSITION_MENU6-4);
    SetTextPos(menu_str_x_def, POSITION_MENU6-2);
    SetPenColor(Color_WHITE_def);
    memcpy(Playlist,PlayListFileName,8);
    Playlist[8]=0;
    PutS(Playlist, -1);              //显示列表名
      for(i=top;i<=bottom;i++)
      {
       if(i==active)
         {
            ResShowPic(FILEBCK,  explorer_str_x_def-2, menu_pos_list[i-top+1]-4);
            ResShowPic(DHTHK,194, menu_pos_list[i-top+1]+6);
            SetPenColor(Color_WHITE_def);
         }
       else
         SetPenColor(Color_WHITE_def);
      output8(0x4e,input8(0x4e) | 0x08);
      read_idm_data_playlist(Longnamebuf,i-top);  
      ResShowPic(MFILE,explorer_pic_x_def,menu_pos_list[i-top+1]-1);     
      SetTextPos(explorer_str_x_def, menu_pos_list[i-top+1]-2);
      PutS(Longnamebuf,-1);
     }

  } //else

// SetAsciiFont(FONT_TYPE_SMALL);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?