static void init_movefile_info() { char file_path[FULL_PATH_SIZE], str_buff[10]; UINT16 offset; TEXT_FIELD *pTxt; POBJLIST pOl; get_file_list_info(win_move_dirlist, &movefile_dirnum, &movefile_filenum, file_path); if(!STRCMP(file_path, FS_ROOT_DIR)) { offset = 0; } else { offset = 1; } pOl = &ol_mpmove; OSD_SetObjListCount(pOl,(movefile_dirnum + movefile_filenum + offset)); OSD_SetObjListNewPoint(pOl,0); OSD_SetObjListCurPoint(pOl,0); OSD_SetObjListTop(pOl,0); pTxt = &mpmove_dir_txt; win_get_display_dirname(str_buff, file_path); OSD_SetTextFieldContent(pTxt,STRING_UTF8,(UINT32)str_buff);//show current dir name pTxt = &mpmove_dev_name; win_get_display_devicename(str_buff, movefile_cur_device); sprintf(str_buff,"%s",str_buff); OSD_SetTextFieldContent(pTxt,STRING_ANSI,(UINT32)str_buff);//show current device name }
BOOL win_check_openroot(FileListHandle file_list) { char file_path[MAX_FILE_NAME_SIZE + 1]; get_file_list_info(file_list, NULL, NULL, file_path); if(!STRCMP(file_path, FS_ROOT_DIR)) { return TRUE; } else { return FALSE; } }
static PRESULT movefile_unkown_act_proc(VACTION act) { PRESULT ret_proc = PROC_PASS; UINT8 bRoot; UINT8 back_saved; switch(act) { case VACT_UP_DIR: ret_proc = movefile_item_enter(0);//exit to up dir break; case VACT_COPY: bRoot = win_check_openroot(win_move_dirlist); if(bRoot) { win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_frame(200, 200, 200, 100); win_compopup_set_msg(NULL, NULL,RS_MSG_COPY_INVALID_PATH); win_compopup_open_ext(&back_saved); osal_task_sleep(1000); win_compopup_smsg_restoreback(); break; } else { get_file_list_info(win_move_dirlist, &movefile_dirnum, &movefile_filenum, copyfile_dest_path); move_file_flag = 1; ret_proc = PROC_LEAVE; } break; case VACT_CHG_DEVL: case VACT_CHG_DEVR: if(get_stroage_device_number(STORAGE_TYPE_ALL) == 1 ) { break; } ret_proc = movefile_change_storage(act); break; case VACT_HELP: break; default: break; } return ret_proc; }
static PRESULT movefile_change_storage(VACTION act) { PRESULT ret = PROC_LOOP; TEXT_FIELD *pTxt; OBJLIST *pOl; char str_buff[10]; if(act == VACT_CHG_DEVL) { if(RET_FAILURE == win_get_next_device(movefile_cur_device, movefile_cur_device,TRUE)) { return ret; } } else { if(RET_FAILURE == win_get_next_device(movefile_cur_device, movefile_cur_device,FALSE)) { return ret; } } file_list_change_device(win_move_dirlist,movefile_cur_device); pTxt = &mpmove_dev_name; win_get_display_devicename(str_buff, movefile_cur_device); sprintf(str_buff,"%s",str_buff); OSD_SetTextFieldContent(pTxt,STRING_ANSI,(UINT32)str_buff);//show current device name //OSD_DrawObject((POBJECT_HEAD)pTxt,C_UPDATE_ALL); OSD_DrawObject((POBJECT_HEAD)&mpmove_dev_con,C_UPDATE_ALL); /* pTxt = &mpmove_dir_txt; sprintf(str_buff,"%s","Root"); OSD_SetTextFieldContent(pTxt,STRING_ANSI,(UINT32)str_buff); OSD_DrawObject((POBJECT_HEAD)pTxt,C_UPDATE_ALL); */ pOl = &ol_mpmove; get_file_list_info(win_move_dirlist, &movefile_dirnum, &movefile_filenum, NULL); OSD_SetObjListCurPoint(pOl, 0); OSD_SetObjListNewPoint(pOl, 0); OSD_SetObjListTop(pOl, 0); OSD_SetObjListCount(pOl, movefile_dirnum+movefile_filenum); OSD_TrackObject((POBJECT_HEAD)pOl, C_UPDATE_ALL | C_DRAW_SIGN_EVN_FLG); return ret; }
UINT32 win_get_file_idx(FileListHandle file_list, char *file_name) { UINT32 uIdx,uTotal; FileInfo file_node; char full_name[MAX_FILE_NAME_SIZE]; unsigned int dir_num,file_num; get_file_list_info(file_list, &dir_num, &file_num, NULL); uTotal = dir_num+file_num; for(uIdx=0; uIdx<uTotal; uIdx++) { get_file_from_file_list(file_list, uIdx+1, &file_node); win_get_fullname(full_name, file_node.path, file_node.name); if(STRCMP(file_name, full_name) == 0) break; } if(uIdx == uTotal) uIdx = (UINT16)(~0); return uIdx; }
static PRESULT movefile_item_enter(UINT16 uIdx) { PRESULT ret = PROC_LOOP; BOOL bRoot; char str_name[FULL_PATH_SIZE],str_txt[FULL_PATH_SIZE]; FileInfo file_node; POBJLIST pOl; TEXT_FIELD *pTxt; UINT8 back_saved; bRoot = win_check_openroot(win_move_dirlist); if((uIdx == 0) && (bRoot == FALSE)) {//TODO:Exit to up dir get_file_list_info(win_move_dirlist, &movefile_dirnum, &movefile_filenum, str_name); win_get_parent_dirname(str_txt, str_name); win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_frame(200, 200, 200, 100); win_compopup_set_msg(NULL, NULL,RS_DISPLAY_PLEASE_WAIT); win_compopup_open_ext(&back_saved); read_folder_to_file_list(win_move_dirlist, str_txt); win_compopup_smsg_restoreback(); bRoot = win_check_openroot(win_move_dirlist); if(bRoot) { file_list_change_device(win_move_dirlist, movefile_cur_device); } movefile_curidx = win_get_file_idx(win_move_dirlist, str_name); if(movefile_curidx == (UINT16)(~0)) movefile_curidx = 0; get_file_list_info(win_move_dirlist, &movefile_dirnum, &movefile_filenum, str_name); pTxt = &mpmove_dir_txt; win_get_display_dirname(str_txt, str_name);//get dirname to show OSD_SetTextFieldContent(pTxt,STRING_UTF8,(UINT32)str_txt); OSD_DrawObject((POBJECT_HEAD)pTxt,C_UPDATE_ALL); pOl = &ol_mpmove; movefile_curidx = movefile_curidx + (bRoot?0:1); OSD_SetObjListCurPoint(pOl, movefile_curidx); OSD_SetObjListNewPoint(pOl, movefile_curidx); OSD_SetObjListTop(pOl, movefile_curidx); if(bRoot == TRUE) OSD_SetObjListCount(pOl, (movefile_dirnum + movefile_filenum));//to show it's child dir else OSD_SetObjListCount(pOl, (movefile_dirnum + movefile_filenum + 1));//to show it's child dir if(OSD_GetObjListCount(pOl) <= MV_ITEM_CNT) OSD_SetObjListTop(pOl, 0); OSD_TrackObject((POBJECT_HEAD)pOl, C_UPDATE_ALL | C_DRAW_SIGN_EVN_FLG); return ret; } if(!bRoot) { uIdx--; } get_file_from_file_list(win_move_dirlist, uIdx+1, &file_node); if(file_node.filetype == F_DIR) { //TODO: Enter child directory & retrive items,set not_root flag win_get_fullname(str_name, file_node.path, file_node.name); win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_frame(200, 200, 200, 100); win_compopup_set_msg(NULL, NULL,RS_DISPLAY_PLEASE_WAIT); win_compopup_open_ext(&back_saved); read_folder_to_file_list(win_move_dirlist, str_name); win_compopup_smsg_restoreback(); get_file_list_info(win_move_dirlist, &movefile_dirnum, &movefile_filenum, str_name); pTxt = &mpmove_dir_txt; win_get_display_dirname(str_txt, str_name);//get dirname to show OSD_SetTextFieldContent(pTxt,STRING_UTF8,(UINT32)str_txt); OSD_DrawObject((POBJECT_HEAD)pTxt,C_UPDATE_ALL); movefile_curidx = 0; pOl = &ol_mpmove; OSD_SetObjListCount(pOl, (movefile_dirnum + movefile_filenum + 1));//to show it's child dir OSD_SetObjListCurPoint(pOl, movefile_curidx); OSD_SetObjListNewPoint(pOl, movefile_curidx); OSD_SetObjListTop(pOl, movefile_curidx); OSD_TrackObject((POBJECT_HEAD)pOl, C_UPDATE_ALL | C_DRAW_SIGN_EVN_FLG); } else { //TODO:soc_printf("not dir!!\n"); } return ret; }