📄 periphgui.c
字号:
{
Message_Show(P_SPACEEMPTY);
//turn to CDROM
card2cd();
return -1;
}
else
{
Message_Show(PFUN_DELETE);
}
}
return 0;
}
/***************************************************************************
* Function Name: format_card *
* Purposes: the entry of formating the selected storage *
* Arguments: none *
* Returns: none *
**************************************************************************/
void format_card(void)
{
#ifdef CF_CARD_WRITE
// if(CardIdentify()!=0)//very important!!!
if(FSIdentify()!=0)//very important!!!
#else
if(!CARDIsPlugIn())
#endif
{
Message_Show(ERROR_MESSAGE);
show_switch(Select_Media);
}
else
{
sign_PFun=PFUN_FORMAT;//format card
// CardSchedule(0);
FSSchedule(0);
Message_Show(PFUN_FORMAT);
}
}
/***************************************************************************
* Function Name: rename_cardfile *
* Purposes: the entry of renaming the selected file *
* Arguments: none *
* Returns: none *
**************************************************************************/
void rename_cardfile(void)
{
#ifdef CF_CARD_WRITE
// if(CardIdentify()!=0)//very important!!!
if(FSIdentify()!=0)//very important!!!
#else
if(!CARDIsPlugIn())
#endif
{
Message_Show(ERROR_MESSAGE);
show_switch(Select_Media);
}
else
{
sign_PFun=PFUN_RENAME;//Create Dir
// CardSchedule(0);
FSSchedule(0);
Message_Show(PFUN_RENAME);
cd2card();//refresh the card
}
}
/***************************************************************************
* Function Name: switch_select *
* Purposes: select the function button to finish the request of the user *
* Arguments: none *
* Returns: none *
* Update: sunzhh 2004-11-10 *
**************************************************************************/
void switch_select(void)
{
BYTE i;
if(InfoGui_flag==1)
{
invalid_key();
return;
}
if(Switch_flag==1)
{
switch(SwitchID)
{
case BUTTON_UDISK:
Select_Media=Media_UDISK;
storage_type = USB_DEVICE;
break;
#ifdef CARD_SETUP_TYPE_3
case BUTTON_CF:
Select_Media=Media_CF;
storage_type = CF_CARD_DEVICE;
break;//if delete the last file, then convert to CD
#endif
case BUTTON_SD:
Select_Media=Media_SD;
storage_type = SD_CARD_DEVICE;
break;
case BUTTON_MS:
Select_Media=Media_MS;
storage_type = MS_CARD_DEVICE;
break;
#ifdef CARD_SETUP_TYPE_3
case BUTTON_SMC:
Select_Media=Media_SMC;
storage_type = SMC_CARD_DEVICE;
break;
#endif
}
show_switch(Select_Media);
}
else
{
if(input_flag==0)
{
switch(KeyID)
{
case BUTTON_COPY:
if(CopyID==1)
{
card_copy(COPY_ROOTDIR);
}
if((CopyID==2)||(CopyID==3))
{
input_page();
}
break;
case BUTTON_DELETE:
if(card_delete()==-1)
break;//if delete the last file, then convert to CD
case BUTTON_CD2P:
cd2card();
break;
case BUTTON_FORMAT:
format_card();
case BUTTON_P2CD:
card2cd();
break;
case BUTTON_RENAME:
input_page();
break;
case BUTTON_CAPACITY:
// osd_init();
// StorageGetCapacityInfo();
show_CapacityInfo();
break;
}
}
#ifndef NEW_INPUT_MENU
else if(input_flag==1)
{
for(i=0;i<8;i++)
{
if(getstring[i]!=32)
break;
else if(i==7)
{
Message_Show(P_INPUT);
xoffset=0;
input_page();
return;
}
}
if(KeyID == BUTTON_COPY)
{
switch(CopyID)
{
case COPY_EXISTING://copy to existing dir
card_copy(COPY_EXISTING);
break;
case COPY_NEWDIR://copy to created new folder
card_copy(COPY_NEWDIR);
break;
}
}
else if(KeyID == BUTTON_RENAME)//rename the selected file
{
rename_cardfile();
}
}
#endif
}
}
/***************************************************************
**Function: FSSchedule()
**Description: Schedule for getting the different function.
**return value: if -1, then no enough space for write
**Create: wuxiaofeng, 2003-9-15
**modified: add argument for three types of copy!
**lijd updating 2004-12-6 16:19
***************************************************************/
//int CardSchedule(BYTE copy_mode)
int FSSchedule(BYTE copy_mode)
{
#ifdef FAT_Write_File_System //added by wangwei,2004-11-9 9:10
if(storage_type == USB_DEVICE)
UsbTestReady();
#endif
UINT32 lba;
UINT32 assignlba;
int iRes=0;//lijd for udisk protect 2004-11-18 16:50
if (pFsJpeg->ControlArea == CNT_AREA_FILE)
{
GetOriginalFileMainName(0); //lijd 2004-12-6 16:19
}
else if(pFsJpeg->ControlArea == CNT_AREA_DIR)
{
GetAllFileNameFromCopyDir();
}
// lba=CardGetRoot();//get the card information
lba=FSGetRoot();//get the card information
if(sign_PFun==PFUN_WRITE)
{
switch(copy_mode)
{
case COPY_ROOTDIR:
// iRes=CardWriteFDB(lba);
iRes=FSStorageCopy(lba);
switch(iRes)
{
case -1:
return -1;
break;
case -2:
return -4;
break;
case -3:
return -5;
break;
case -4:
return -6;
break;
case -5:
return -7;
break;
default:
break;
}
break;
case COPY_EXSITING:
// assignlba=CardSearchDir(lba, getstring);
#ifdef NEW_INPUT_MENU
assignlba=FSSearchDir(lba, GetString);
#else
assignlba=FSSearchDir(lba, getstring);
#endif
if(assignlba==0)//have no matched dir
{
sign_PFun=PFUN_DEFAULT;//clear
return -2;
}
// iRes=CardWriteFDB(assignlba);
iRes=FSStorageCopy(assignlba);
switch(iRes)
{
case -1:
return -1;
break;
case -2:
return -4;
break;
case -3:
return -5;
break;
case -4:
return -6;
break;
case -5:
return -7;
break;
default:
break;
}
break;
case COPY_NEWDIR://only in root
// assignlba=CardCreateDir(getstring);
#ifdef NEW_INPUT_MENU
assignlba=FSCreateDir(lba,GetString);
#else
assignlba=FSCreateDir(lba,getstring);
#endif
if(assignlba==-1)//have same name with the existing dir
{
sign_PFun=PFUN_DEFAULT;//clear
return -3;//add 2003-12-22
}
// iRes=CardWriteFDB(assignlba);
iRes=FSStorageCopy(assignlba);
switch(iRes)
{
case -1:
return -1;
break;
case -2:
return -4;
break;
case -3:
return -5;
break;
case -4:
return -6;
break;
case -5:
return -7;
break;
default:
break;
}
break;
}
}
else if(sign_PFun==PFUN_DELETE)
{
// if(CardDeleteData()==-1)
if(FSDeleteData()==-1)
{
sign_PFun=PFUN_DEFAULT;//clear
return -1;
}
}
else if(sign_PFun==PFUN_FORMAT)
{
// CardFormat();
FSFormat();
}
else if(sign_PFun==PFUN_RENAME)
{
// CardRenameFile(getstring);//change to rename file 10-30
#ifdef NEW_INPUT_MENU
FSRenameFile(GetString);
#else
FSRenameFile(getstring);//change to rename file 10-30
#endif
}
sign_PFun=PFUN_DEFAULT;//clear
return 0;
}
#endif//defined(SPHE8202_USB_Write)||defined(CF_CARD_WRITE)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -