📄 copy_delete_ui.c
字号:
//******************************************************************//
// //
// //
// //
// //
//******************************************************************//
//------------------------------------START------------------------------------//
#include "user_init.h"
#include "global.h"
#include "cust_def.h"
#include "osd_drv.h"
#include "fsNAV.h"
#include "osd.h"
#include "copy_delete_ui.h"
#include "Ircmd.h"
#include "osd_AppAPI.h"
#include "Card_main.h"
#include "osd_drv.h"
#include "osd_palette.h"
#include "fs_new.h"
#include "fs_new_app.h"
#include "fs_show.h"
//-------------------------------func-----------------------------------//
void copy_delete_left(void);
void copy_delete_right(void);
void copy_delete_select(void);
void draw_copy_delete_ui_background(void);
void draw_copy_delete_ui_string(void);
void draw_copy_delete_ui_string_ui1(void);
void show_copy_delete_hl(UINT32 xStart1, UINT32 yStart1, const BYTE *str,BYTE color, BYTE color2, BYTE r);
void draw_copy_delete_ui_string_ui2(void);
void draw_copy_delete_ui_string_ui3(void);
void copy_delete_ui_main(void);
void flag_reset(void);
void polling_copy_delete(void);
void copy_delete_execute(void);
void show_copy_delete_ui(void);
int fs_init_device_ui(UINT32 device,UINT8 device_ui);
int fs_check_device_ui(UINT32 device,UINT8 device_ui);
int do_check_device_ui(UINT8 device_ui);
void fs_activate_copy_ui(UINT8 device_ui);
void selete_device(void);
//-------------------------------extern-----------------------------------//
extern int fs_is_activated_copy(void);
extern void DispFadeOut(void);
extern void ircmd_null(void);
extern void init_copy_delete_ui(void);
//-------------------------------ir entry-----------------------------------//
void ircmd_copy_delete(void)
{
#if (defined(SUPPORT_FILE_COPYING) ||defined(SUPPORT_FILE_DELETING))
#ifdef COPY_DELETE_USE_UI
if (full_scrn & SETUP)
ExitSetupPage(1);
DispFadeOut();
if (full_scrn & 0x01)
{//end
full_scrn =0x00;
osd_init();
if((pFsJpeg->gifsFuncBtn==FS_FUNC_MP3)||(pFsJpeg->gifsFuncBtn==FS_FUNC_JPEG))
{
play_state=VCD_STATE_NORMAL;
if(pFsJpeg->gifsFuncBtn==FS_FUNC_MP3)
ircmd_play();
}
copy_delete_execute_flag=EXECUTE_OFF;
copy_delete_flag_ui=0;
}
else
{//start
full_scrn =0x01;
if((pFsJpeg->gifsFuncBtn==FS_FUNC_JPEG)||(pFsJpeg->gifsFuncBtn==FS_FUNC_OTHER))
{
}
else
{
AVD_SetMediaInterrupt();
play_state=VCD_STATE_STOP;//liuhao modify for bug A05
}
copy_delete_ui_main();//entry
}
#endif
#endif
}
//-------------------------------main-----------------------------------//
void show_copy_delete_ui(void)
{
draw_copy_delete_ui_background();
draw_copy_delete_ui_string();
}
void copy_delete_ui_main(void)
{
init_copy_delete_ui();//init region
flag_reset();//reset va
show_copy_delete_ui();//draw ui
}
//-------------------------reset for default value----------------------------//
void flag_reset(void)
{
//ui layer and item
ui_string_layer=LAY_ONE;
ui_string_layer_item1=COPY_ITEM;
ui_string_layer_item_delete=1;
ui_string_layer_item_copy=1;
//execute flag
copy_delete_execute_flag=EXECUTE_OFF;
copy_delete_ui_time=100;
//copy device type
detect_type_number=0;
detect_type_number_switch1=0;
detect_type_number_switch2=0;
refresh_copy_ui_flag=REFRESH_ONCE;
no_disk_to_copy=0;
//detect device
Detect_Card_Storage();
printf_w("detect_type==%d\n",detect_type);
selete_device();
//coordinate
copy_ui1.x=6;
copy_ui1.y=24;
copy_ui_text.x=3;
copy_ui_text.y=10;
if(detect_type_number==1)
{
copy_ui2.x=15;
copy_ui2.y=24;
ui_show_no.x=15;
ui_show_no.y=24;
}
else if(detect_type_number==2)
{
copy_ui2.x=11;
copy_ui2.y=24;
ui_show_no.x=16;
ui_show_no.y=24;
}
else
{
copy_ui2.x=13;
copy_ui2.y=24;
}
}
/*
#define USB_DEVICE 0x01
#define CF_CARD_DEVICE 0x02
#define SD_CARD_DEVICE 0x04
#define MS_CARD_DEVICE 0x08
#define SMC_CARD_DEVICE 0x10
*/
void selete_device(void)
{
if(detect_type>0)
{
static int test;
UINT8 detect_type_temp=detect_type&(~storage_type);
printf_w("detect_type_temp==%d\n",detect_type_temp);
for(test=1;test<6;test++)//for detect device
{
if(detect_type_temp&(0x01<<(test-1)))
{
detect_type_number++;
if(!detect_type_number_switch3)
{
if((detect_type_number_switch2)&&(detect_type_number_switch1))
{
detect_type_number_switch3=test;
}
}
if(!detect_type_number_switch2)
{
if(detect_type_number_switch1)
detect_type_number_switch2=test;
}
if(!detect_type_number_switch1)
detect_type_number_switch1=test;
}
}
//specially
printf_w("storage_type==%d\n",storage_type);
if(detect_type_number==0)
no_disk_to_copy=1;//only one device can no copy
printf_w("detect_type_number_switch1==%d\ndetect_type_number_switch2==%d\ndetect_type_number==%d\n",detect_type_number_switch1,detect_type_number_switch2,detect_type_number);
}
}
//-------------------------IR----------------------------//
void copy_delete_left(void)
{
printf_w("copy_delete_left in\n");
if(ui_string_layer==LAY_ONE)//layer1 left
{
ui_string_layer_item1--;
if((ui_string_layer_item1>2)||(ui_string_layer_item1<1))
ui_string_layer_item1=DELETE_ITEM;
}
else if((ui_string_layer==LAY_TWO)&&(ui_string_layer_item1==COPY_ITEM))//copy
{
ui_string_layer_item_copy--;
if((ui_string_layer_item_copy>(detect_type_number+1))||(ui_string_layer_item_copy<1))
ui_string_layer_item_copy=(detect_type_number+1);
}
else if((ui_string_layer==LAY_TWO)&&(ui_string_layer_item1==DELETE_ITEM))//delete
{
ui_string_layer_item_delete--;
if((ui_string_layer_item_delete>2)||(ui_string_layer_item_delete<1))
ui_string_layer_item_delete=2;
}
refresh_copy_ui_flag=REFRESH_ONCE;
}
void copy_delete_right(void)
{
printf_w("copy_delete_right in\n");
if(ui_string_layer==LAY_ONE)
{
ui_string_layer_item1++;
if((ui_string_layer_item1>2)||(ui_string_layer_item1<1))
ui_string_layer_item1=COPY_ITEM;
}
else if((ui_string_layer==LAY_TWO)&&(ui_string_layer_item1==COPY_ITEM))//copy
{
ui_string_layer_item_copy++;
if((ui_string_layer_item_copy>(detect_type_number+1))||(ui_string_layer_item_copy<1))
ui_string_layer_item_copy=1;
}
else if((ui_string_layer==LAY_TWO)&&(ui_string_layer_item1==DELETE_ITEM))//delete
{
ui_string_layer_item_delete++;
if((ui_string_layer_item_delete>2)||(ui_string_layer_item_delete<1))
ui_string_layer_item_delete=1;
}
refresh_copy_ui_flag=REFRESH_ONCE;
}
void copy_delete_select(void)
{
printf_w("ui_string_layer_item_copy==%d\n,ui_string_layer==%d\ncopy_delete_execute_flag==%d\n",ui_string_layer_item_copy,ui_string_layer,copy_delete_execute_flag);
if((ui_string_layer==LAY_TWO)&&(ui_string_layer_item_delete==1)&&(ui_string_layer_item1==DELETE_ITEM))//delete
{
copy_delete_execute_flag=EXECUTE_ON;
refresh_copy_ui_flag=REFRESH_ONCE;
copy_delete_switch_flag=DELETE_EXECUTE;
}
else if((ui_string_layer==LAY_TWO)&&((ui_string_layer_item_delete==2)||((ui_string_layer_item_copy==3)&&(detect_type_number==2))||((ui_string_layer_item_copy==2)&&(detect_type_number==1))))// show NO
{
printf_w("selete NO---------------------\n");
ircmd_copy_delete();
}
else if((ui_string_layer==LAY_TWO)&&(ui_string_layer_item1==COPY_ITEM)&&(((ui_string_layer_item_copy==1)&&(detect_type_number==1))||((ui_string_layer_item_copy==2)&&(detect_type_number==2))||((ui_string_layer_item_copy==1)&&(detect_type_number==2))))//for execute
{
if(detect_type_number==1)
targetDevice_ui=detect_type_number_switch1;
else if(detect_type_number==2)
{
if(ui_string_layer_item_copy==1)
targetDevice_ui=detect_type_number_switch1;
else if(ui_string_layer_item_copy==2)
targetDevice_ui=detect_type_number_switch2;
}
copy_delete_switch_flag=COPY_EXECUTE;
copy_delete_execute_flag=EXECUTE_ON;
refresh_copy_ui_flag=REFRESH_ONCE;
}
if(ui_string_layer==LAY_ONE)
{
if(ui_string_layer_item1==COPY_ITEM)
{
if(no_disk_to_copy)
{
return;
}
else
{
ui_string_layer_item_delete=1;
ui_string_layer=2;
}
}
if(ui_string_layer_item1==DELETE_ITEM)
{
ui_string_layer_item_copy=1;
ui_string_layer=2;
}
refresh_copy_ui_flag=REFRESH_ONCE;
copy_delete_ui_time=0;
}
if(copy_delete_execute_flag)
{
copy_delete_execute();
}
}
//-------------------------show UI----------------------------//
const _t_osd_hdr osd_DeleteConfirmGUI[] = {
{DELETE_WIDTH, DELETE_HEIGHT, DELETE_START_X, DELETE_START_Y, SETUP_HEADER, OSD_FORMAT_16COLOR, OSD_INTERLACED}, // 3
{64*3*2, (OSD_FONT_HEIGHT)*2, 80, 48, SETUP_HEADER, OSD_FORMAT_16COLOR, OSD_INTERLACED}, // 2
{36*4*4, OSD_FONT_HEIGHT, 32, 34, NORMAL_HEADER, OSD_FORMAT_4COLOR, OSD_INTERLACED}, // 1
{38*8*2, OSD_FONT_HEIGHT, 26, 20, SETUP_HEADER, OSD_FORMAT_16COLOR, OSD_INTERLACED} // 0
};
void init_copy_delete_ui(void)
{
osd_init_regions( sizeof(osd_DeleteConfirmGUI)/sizeof(osd_DeleteConfirmGUI[0]), (_t_osd_hdr *)&osd_DeleteConfirmGUI);
}
void draw_copy_delete_ui_background(void)
{
osd_draw_region_rect(0, 0, DELETE_WIDTH, DELETE_HEIGHT, COLOR_LBLUE, DELETE_REGION);
osd_DrawRegionLine(0, 0, DELETE_WIDTH-1, 0, COLOR_WHITE, 1, DELETE_REGION);
osd_DrawRegionLine(0, 0, 0, DELETE_HEIGHT-1, COLOR_WHITE, 1, DELETE_REGION);
osd_DrawRegionLine(DELETE_WIDTH-1, 0, DELETE_WIDTH-1, DELETE_HEIGHT, COLOR_GRAY,1, DELETE_REGION);
osd_DrawRegionLine(0, DELETE_HEIGHT-1, DELETE_WIDTH, DELETE_HEIGHT-1, COLOR_GRAY, 1, DELETE_REGION);
}
void draw_copy_delete_ui_string(void)
{
if(ui_string_layer==LAY_ONE)
draw_copy_delete_ui_string_ui1();
else if(ui_string_layer==LAY_TWO)
draw_copy_delete_ui_string_ui2();
else if(ui_string_layer==3)
draw_copy_delete_ui_string_ui3();
}
void draw_copy_delete_ui_string_ui1(void)
{
if(ui_string_layer_item1==COPY_ITEM)//copy
{
osd_DrawRegionString(copy_ui1.x,copy_ui1.y,CopyDeleteMsgStr[ui_string_layer][0],COLOR_WHITE,COLOR_HL,DELETE_REGION);
osd_DrawRegionString((copy_ui1.x+7),copy_ui1.y,CopyDeleteMsgStr[ui_string_layer][1],COLOR_WHITE,COLOR_LBLUE,DELETE_REGION);
show_copy_delete_hl(copy_ui1.x,copy_ui1.y,CopyDeleteMsgStr[ui_string_layer][0],COLOR_WHITE,COLOR_GRAY,DELETE_REGION);
}
else if(ui_string_layer_item1==DELETE_ITEM)//delete
{
osd_DrawRegionString(copy_ui1.x,copy_ui1.y,CopyDeleteMsgStr[ui_string_layer][0],COLOR_WHITE,COLOR_LBLUE,DELETE_REGION);
osd_DrawRegionString((copy_ui1.x+7),copy_ui1.y,CopyDeleteMsgStr[ui_string_layer][1],COLOR_WHITE,COLOR_HL,DELETE_REGION);
show_copy_delete_hl((copy_ui1.x+7),copy_ui1.y,CopyDeleteMsgStr[ui_string_layer][1],COLOR_WHITE,COLOR_GRAY,DELETE_REGION);
}
if(copy_delete_ui_time)
{
if(no_disk_to_copy)
{
osd_DrawRegionString(copy_ui_text.x-1,copy_ui_text.y,"NO TARGET COPY DEVICE",COLOR_WHITE,COLOR_LBLUE,DELETE_REGION);
}
osd_DrawRegionString(copy_ui_text.x+2+1,copy_ui_text.y+7*3,"S WILL RETURN",COLOR_WHITE,COLOR_LBLUE,DELETE_REGION);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -