ui_playlist2.c

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

C
176
字号
/*
*******************************************************************************
*                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"
#include "list.h"
#define Color_BULE_Scroll_def  0x00000210//深蓝
#pragma memory=dataseg(IDM_COM_FSL_D)
char com_fname[5][LISTNAME_DISP_LENNGTH];    //可存放地址为页6的6000H-6FFFH
#pragma memory=default
//extern const char menu_pos_menu[6];
extern const char menu_pos_list[6];
extern char    PlayListFileName[12];

extern region_t PlayListScrollRegion;
extern BYTE ScrollFlag;
extern void Scroll_PlayList( char * scrollstr, bool mode ,char language,region_t *scroll);
//向IDM数组写数据
BOOL write_idm_data_playlist(char *name, int count)
{
     byte status;
     status = input8(0x05);
     output8(0x05, 0xf6);
     memcpy( com_fname[count], name, LISTNAME_DISP_LENNGTH);
     output8(0x05, status);

}

//取一屏数据到IDM数组中
void reinit_idm_buf_playlist(int top, int bottom, char *Longnamebuf, BYTE string_id,BOOL direction)
{
    int i;
    for(i = top; i <= bottom; i++)
    {
          if( fselGetCurGroupL(Longnamebuf,LISTNAME_DISP_LENNGTH) )
        {
            unitochar(Longnamebuf,LISTNAME_DISP_LENNGTH,string_id);   //   
        }
          if(direction)  
            write_idm_data_playlist(Longnamebuf, i - top);
          else
            write_idm_data_playlist(Longnamebuf, bottom-i);   
          if(direction)       
            fselGetNextGroup(Longnamebuf);            // 取下页数据
          else 
               fselGetPrevGroup(Longnamebuf);           // 取上页数据
    }

}

//读数据到数组name中
void read_idm_data_playlist(char *name, int count)
{
     byte status;
     status = input8(0x05);
     output8(0x05 ,0xf6);
     memcpy(name, com_fname[count], LISTNAME_DISP_LENNGTH);
     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,char *Longnamebuf,BYTE string_id,BYTE ScrollMode)
{

    int i,tmp;
    SetAsciiFont(FONT_TYPE_LARGE);
    SetTextOutMode(1);
    PlayListScrollRegion.x=32;
    PlayListScrollRegion.width=158;
    PlayListScrollRegion.height=16;
    if(!ScrollMode)        //只需要滚动活动的项目
    {
        SetTextOutMode(0);
        SetBackgdColor(Color_BULE_Scroll_def);
        Scroll_PlayList(Longnamebuf, FALSE,string_id,&PlayListScrollRegion);
        SetTextOutMode(1); 
    }            
    else            //需要初始化活动项,判断是否需要滚动
    {    
 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);                                //取列表名
     PlayListScrollRegion.y= menu_pos_list[tmp+1]-2;
         
             SetBackgdColor(Color_BULE_Scroll_def);
             Scroll_PlayList(Longnamebuf, TRUE,string_id,&PlayListScrollRegion);
             if(strlen(Longnamebuf)<13)
                 ScrollFlag=0;
             else
                 ScrollFlag=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);
            PutS(PlayListFileName, 8);              //显示列表名
      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);
     }
             read_idm_data_playlist(Longnamebuf,active-top);
             PlayListScrollRegion.y= menu_pos_list[active-top+1]-2;
             SetBackgdColor(Color_BULE_Scroll_def);
             Scroll_PlayList(Longnamebuf, TRUE,string_id,&PlayListScrollRegion);
             if(strlen(Longnamebuf)<13)
                 ScrollFlag=0;
             else
                 ScrollFlag=1;           
  } //else
    }
// SetAsciiFont(FONT_TYPE_SMALL);
}

⌨️ 快捷键说明

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