⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ui_pop_up_list.c

📁 智原mp3 SDK 开发包 与巨力 有mp3 wma ogg decoder
💻 C
字号:
#include <string.h>
#include "api.h"
#include "lcd.h"
#include "key.h"
#include "res_show.h"
#include "res.h" 
#include "ui_pop_up_list.h"
#include "display.h"
#include "prefer.h"
//#include "mp3_utile.h"


code UINT8 menu_pos[6] = {POSITION_MENU2,POSITION_MENU3, 
		POSITION_MENU4, POSITION_MENU5, POSITION_MENU6, POSITION_MENU7}; 

UINT8 list_need_draw;
UINT8 list_list_need_drawall = 1;
UINT8 list_value_changed;	
UINT8 list_active,list_old_active;

pop_up_list_t globle_list;

void show_active_list1(int old_active, int active)
{
    	int tmp;           	
   	tmp = active%6;
   	gfx_bg_rectangle(2,menu_pos[tmp], 124, 16);
   	bResShowPic(MENUARR, menu_ptr_x_def,menu_pos[tmp]+2);  
   	fg_color = COLOR_SELECT;     	
	ResShowMultiString(globle_list.strid[active],tUserPreference.u8LanguageId, menu_str_x_def,menu_pos[tmp]);
	
	tmp = old_active%6;
	gfx_bg_rectangle(2,menu_pos[tmp], 124, 16);
	bResShowPic(MENURDOT, menu_ptr_x_def, menu_pos[tmp]+2);                                             
	fg_color = COLOR_UNSELECT;                                       
        ResShowMultiString(globle_list.strid[old_active],tUserPreference.u8LanguageId, menu_str_x_def,menu_pos[tmp]);
}

void screen_popup_list(UINT8 key)
{

	int i;
	int max_group;	
	int cur_group;	
	int n;	
	
	//total pages	
	max_group = globle_list.total / 6;
	if((globle_list.total % 6) == 0) max_group--;

	switch( key)
       	{
       	    case KEY_NEXT:    	        
       	        if(list_active < globle_list.total - 1)
       	        {
			list_active++;
			if(list_active/6==cur_group)
			{
				list_old_active=list_active-1;        	        	
       	        		list_value_changed=TRUE;
       	        	}
       	        	else 
       	        		list_list_need_drawall = TRUE;       	        	
       	        }
       	        else 
       	        {
       	        	list_active = 0;
       	        	list_list_need_drawall = TRUE;
       	        } 
       	        break;
        	        
       	    case KEY_PREV:
		if(list_active > 0)
        	{
			list_active--;
			if(list_active/6==cur_group)
			{
				list_old_active=list_active+1;        	        	
        	       		list_value_changed=TRUE;
        	       	}
        	       	else 
        	       		list_list_need_drawall = TRUE;       	        	      	        	
        	}
        	else
        	{
        	    	list_active = globle_list.total - 1;
        	      	list_list_need_drawall = TRUE;
        	}       	      		 
       
       	        break;        	   
        	    
            case KEY_MENU:    //确认退出
            	//globle_list.active = list_active;
            	globle_list.action(list_active);
                return;         	
    	}//while(1)
	
	if(list_list_need_drawall)
	{
		bResShowPic(MENUTWO,0,0);
		bResShowPic(MENU_TOP,0,140);
		fg_color = COLOR_UNSELECT;   
		bg_color = 0x8B75;
		gfx_set_bg(Color_MENU_def);	
		ResShowMultiString(globle_list.headid, tUserPreference.u8LanguageId, 
		list_str_x_def,123/*POSITION_MENU2+5*/);
		list_list_need_drawall=0;
		list_need_draw=1;
	}
	
	if(list_need_draw)
	{						
		//bg_color = COLOR_WHITE;
		bg_color = 0xF75F;
		gfx_set_bg(0xF75F);		
		list_old_active=list_active;
		cur_group = list_active / 6;
		n = cur_group*6;		
		for(i=0; i<6; i++)
		{
			if(n+i >= globle_list.total) break;	//处理不足5个的情况
			if(n+i==list_active)
			{
				bResShowPic(MENUARR, menu_ptr_x_def, menu_pos[i]+2);
				fg_color = COLOR_SELECT;			
				ResShowMultiString(globle_list.strid[list_active], tUserPreference.u8LanguageId, 
				menu_str_x_def, menu_pos[i]);
			}
			else
			{
				
				bResShowPic(MENURDOT, menu_ptr_x_def, menu_pos[i]+2);
				fg_color = COLOR_UNSELECT;
				ResShowMultiString(globle_list.strid[n+i], tUserPreference.u8LanguageId, 
				menu_str_x_def, menu_pos[i]);
			}
		}							
		list_need_draw = FALSE;
	}//need draw
       	if(list_value_changed)
       	{
       		show_active_list1(list_old_active,list_active);
       		list_value_changed=FALSE;
       	}
}

void ui_list_init(void)
{
	list_need_draw=1;
	list_list_need_drawall = 1;
	list_value_changed = 0;
	list_active = globle_list.active; 	
	bg_color = 0x0000F77F;
	gfx_set_bg(0x0000F77F);		
	screen_popup_list(KEY_PLAY);
}

⌨️ 快捷键说明

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