📄 mmivoicememo.c
字号:
TRACE_EVENT("glowing: voice_memo_tim_cb -- enter VM_RECORD");
data->time++;
//if (data->time < 20)
if( data->time == MAX_RECORD_SECONDS )
{
/* 2004/06 sunsj modify for picture manage */
#if(MAIN_LCD_SIZE==4)
DRAW_ICON_ATTRIBUTE(ICON_VOICEMEMO_WIN, 19+3*(data->time-1), 55, 2, ICON_LOCATION);
#elif (MAIN_LCD_SIZE==3)
DRAW_ICON_ATTRIBUTE(ICON_VOICEMEMO_WIN, 19+3*(data->time-1), 27, 2, ICON_LOCATION);
#endif
}
if( data->time < MAX_RECORD_SECONDS )
{
TRACE_EVENT("glowing: voice_memo_tim_cb -- enter VM_RECORD 1");
/* 2004/05/18 yhf modify */
#if ( MAIN_LCD_SIZE==2 )
// 2004.3.16 WYJ modify icon display
dspl_BitBlt(recordIcons[data->time%6].area.px, recordIcons[data->time%6].area.py, recordIcons[data->time%6].area.sx,
recordIcons[data->time%6].area.sy, 0, (void *)recordIcons[data->time%6].icons, 0);
dspl_BitBlt(0, 51, 102, 14, 0, (void *)gImage_bar, 0);
sprintf(data->elapsed_time,"%02d sec", data->time);
displayAlignedText(CENTER, 52, DSPL_TXTATTR_TRANSPARENT, data->elapsed_time);
#endif
sprintf(data->elapsed_time,"%02d sec", data->time);
#if (MAIN_LCD_SIZE==3)
DRAW_ICON_SEL(ICON_RECORDICON,data->time%3);//徐建华
#endif
#if(MAIN_LCD_SIZE==4)
DRAW_ICON_ATTRIBUTE(ICON_VOICEMEMO_WIN, 19+3*(data->time-1), 55, 2, ICON_LOCATION);
#elif (MAIN_LCD_SIZE==3)
DRAW_ICON_ATTRIBUTE(ICON_VOICEMEMO_WIN, 19+3*(data->time-1), 27, 2, ICON_LOCATION);
#endif
displayAlignedText(CENTER, Mmi_layout_second_line(), 0, data->elapsed_time);
tim_start (data->info_tim);
}
else
{
TRACE_EVENT("glowing: voice_memo_tim_cb -- enter VM_RECORD 2");
StopVmRecord(VmRecordCB);
/* 2004/05/18 yhf modify */
#if ( MAIN_LCD_SIZE==2 )
// 2004.3.16 WYJ modify icon display
dspl_BitBlt(recordIcons[data->time%6].area.px, recordIcons[data->time%6].area.py, recordIcons[data->time%6].area.sx,
recordIcons[data->time%6].area.sy, 0, (void *)recordIcons[data->time%6].icons, 0);
dspl_BitBlt(0, 51, 102, 14, 0, (void *)gImage_bar, 0);
sprintf(data->elapsed_time,"%02d sec", data->time);
displayAlignedText(CENTER, 52, DSPL_TXTATTR_TRANSPARENT, data->elapsed_time);
#endif
sprintf(data->elapsed_time,"%02d sec", data->time);
displayAlignedText(CENTER, Mmi_layout_second_line(), 0, data->elapsed_time);
tim_stop (data->info_tim);
tim_stop (data->animation_timer);/* 2004/05/18 yhf add */
if( RTC_GetDateTime(&T_DateTime)==RV_OK )
{
memcpy(FFS_VMData.VM[data->index].vm_name,vm_name[data->index],PHB_name_len);
/* glowing: add the record time from 20 seconds to 30 seconds */
//FFS_VMData.VM[data->index].length=data->time+1>20?20:data->time+1;
FFS_VMData.VM[data->index].length=data->time+1>MAX_RECORD_SECONDS?MAX_RECORD_SECONDS:data->time+1;
FFS_VMData.VM[data->index].hour =T_DateTime.hour;
FFS_VMData.VM[data->index].minute =T_DateTime.minute;
FFS_VMData.VM[data->index].day =T_DateTime.day;
FFS_VMData.VM[data->index].year =T_DateTime.year;
FFS_VMData.VM[data->index].month =T_DateTime.month;
FFS_VMData.VM[data->index].PM_flag =T_DateTime.PM_flag;
FFS_VMData.VM[data->index].mode_12_hour =T_DateTime.mode_12_hour;
flash_VMwrite("VM");
bookShowInformation( win, TxtAddSucceed, NULL,(T_VOID_FUNC)voice_Information_cb);//录音成功
}
else
{
//read rtc error!
}
}
}
break;
case VM_RECORDCALL:
{
TRACE_EVENT("glowing: voice_memo_tim_cb -- enter VM_RECORDCALL");
data->time++;
TRACE_EVENT_P1("glowing: voice_memo_tim_cb -- data->time=%d", data->time);
// if (data->time < 20)
if( data->time == MAX_RECORD_SECONDS )
{
/* 2004/06 sunsj modify for picture manage */
#if(MAIN_LCD_SIZE==4)
DRAW_ICON_ATTRIBUTE(ICON_VOICEMEMO_WIN, 19+3*(data->time-1), 55, 2, ICON_LOCATION);
#elif (MAIN_LCD_SIZE==3)
DRAW_ICON_ATTRIBUTE(ICON_VOICEMEMO_WIN, 19+3*(data->time-1), 27, 2, ICON_LOCATION);
#endif
//dspl_BitBlt(19+3*(data->time-1), 55, 3, 5, 0, (void *)record_play, 0);/* 2004/05/18 yhf modify */
}
if( data->time < MAX_RECORD_SECONDS )
{
// 2004.4.24 WYJ modify icon display
if( data->time < MAX_RECORD_SECONDS )
{
/* 2004/06 sunsj modify for picture manage */
#if(MAIN_LCD_SIZE==4)
DRAW_ICON_ATTRIBUTE(ICON_VOICEMEMO_WIN, 19+3*(data->time-1), 55, 2, ICON_LOCATION);
#elif (MAIN_LCD_SIZE==3)
DRAW_ICON_ATTRIBUTE(ICON_VOICEMEMO_WIN, 19+3*(data->time-1), 27, 2, ICON_LOCATION);
#endif
//dspl_BitBlt(19+3*(data->time-1), 55, 3, 5, 0, (void *)record_play, 0);
}
sprintf(data->elapsed_time,"%02d sec", data->time);
displayAlignedText(CENTER, Mmi_layout_second_line(), 0, data->elapsed_time);
tim_start (data->info_tim);
recordcall_completed = false; /* glowing: add it to fix the record call bug */
}
else
{
TRACE_EVENT("glowing: voice_memo_tim_cb -- enter VM_RECORDCALL -- 2");
StopVmRecord(VmRecordCB);
sprintf(data->elapsed_time,"%02d sec", data->time);
displayAlignedText(CENTER, Mmi_layout_second_line(), 0, data->elapsed_time);
tim_stop (data->info_tim);
tim_stop (data->animation_timer);
/*end yhf modify*/
if( RTC_GetDateTime(&T_DateTime)==RV_OK )
{
memcpy(FFS_VMData.VM[data->index].vm_name,vm_name[data->index],PHB_name_len);
//FFS_VMData.VM[data->index].length=data->time+1>20?20:data->time+1;
FFS_VMData.VM[data->index].length=data->time+1>MAX_RECORD_SECONDS?MAX_RECORD_SECONDS:data->time+1;
FFS_VMData.VM[data->index].hour =T_DateTime.hour;
FFS_VMData.VM[data->index].minute =T_DateTime.minute;
FFS_VMData.VM[data->index].day =T_DateTime.day;
FFS_VMData.VM[data->index].year=T_DateTime.year;
FFS_VMData.VM[data->index].month =T_DateTime.month;
FFS_VMData.VM[data->index].PM_flag =T_DateTime.PM_flag;
FFS_VMData.VM[data->index].mode_12_hour =T_DateTime.mode_12_hour;
flash_VMwrite("VM");
bookShowInformation( win, TxtAddSucceed, NULL,(T_VOID_FUNC)voice_Information_cb);//录音成功
}
else
{
//read rtc error!
}
recordcall_completed = true; /* glowing: add it to fix the record call bug */
}
}
break;
default: break;
}
TRACE_EVENT("glowing: voice_memo_tim_cb -- leave voice_memo_tim_cb");
//winShow(win);
return 0;
}
/*******************************************************************************
$Function: voice_memo_kbd_cb
$Description: Keyboard event handler
$Returns: status int
$Arguments: window handle event, keyboard control block
*******************************************************************************/
static int voice_memo_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard)
{
T_MFW_HND win = mfw_parent (mfw_header());
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_voice_memo * data = (T_voice_memo *)win_data->user;
USHORT Identifier = data->Identifier;
T_RTC_DATE_TIME T_DateTime;
char buf[40];
TRACE_FUNCTION("voice_memo_kbd_cb");
switch( keyboard->code )
{
case KCD_HUP:
case KCD_RIGHT:
if( Identifier EQ VM_RECORD )
{
StopVmRecord(VmRecordCB);
SEND_EVENT (win, VM_DESTROY, 0, 0);
}
else if( Identifier EQ VM_RECORDCALL )
{
StopVmRecord(VmRecordCB);
SEND_EVENT (win, VM_DESTROY, 0, 0);
recordcall_completed = true; /* glowing: add it to fix the record call bug */
}
break;
case KCD_LEFT:
case KCD_OK:
{
StopVmRecord(VmRecordCB);
tim_stop (data->info_tim);
tim_stop (data->animation_timer);/* 2004/05/19 yhf add*/
if( RTC_GetDateTime(&T_DateTime)==RV_OK )
{
memcpy(FFS_VMData.VM[data->index].vm_name,vm_name[data->index],PHB_name_len);
if( data->Identifier==VM_RECORD )
//FFS_VMData.VM[data->index].length=(data->time+1)>20?20:(data->time+1);
FFS_VMData.VM[data->index].length=(data->time+1)>MAX_RECORD_SECONDS?MAX_RECORD_SECONDS:(data->time+1);
else if( data->Identifier==VM_RECORDCALL )
//FFS_VMData.VM[data->index].length=data->time+1>20?20:data->time+1;
FFS_VMData.VM[data->index].length=data->time+1>MAX_RECORD_SECONDS?MAX_RECORD_SECONDS:data->time+1;
FFS_VMData.VM[data->index].hour =T_DateTime.hour;
FFS_VMData.VM[data->index].minute =T_DateTime.minute;
FFS_VMData.VM[data->index].day =T_DateTime.day;
FFS_VMData.VM[data->index].year =T_DateTime.year;
FFS_VMData.VM[data->index].month =T_DateTime.month;
FFS_VMData.VM[data->index].PM_flag =T_DateTime.PM_flag;
FFS_VMData.VM[data->index].mode_12_hour =T_DateTime.mode_12_hour;
flash_VMwrite("VM");
bookShowInformation( win, TxtAddSucceed, NULL,(T_VOID_FUNC)voice_Information_cb);//录音成功
}
else
{
//read rtc error!
}
}
recordcall_completed = true; /* glowing: add it to fix the record call bug */
break;
default:break;
}
return MFW_EVENT_CONSUMED;
}
static void VmRecordCB (void* parameter)
{
playover=1;
rvf_free_buf (parameter);
return;
}
GLOBAL int voice_memo_browser (MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND win = mfw_parent(mfw_header());
TRACE_FUNCTION ("voice_memo_Browser()");
voice_memo_start (win, VM_BROWSER);
return ;
}
GLOBAL int voice_memo_record (MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND win = mfw_parent(mfw_header());
TRACE_FUNCTION ("voice_memo_record()");
voice_memo_start (win, VM_RECORD);
return ;
}
#if 0
GLOBAL int voice_memo_DeleteAll (MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND win = mfw_parent(mfw_header());
U8 j;
TRACE_FUNCTION ("voice_memo_DeleteAll()");
for( j=0;j<VM_file;j++ )
{
if( FFS_VMData.VM[j].vm_name[0]!='\0' )
{
FFS_VMData.VM[j].vm_name[0]='\0';
FFS_VMData.VM[j].month=0;
FFS_VMData.VM[j].day=0;
FFS_VMData.VM[j].year=0;
FFS_VMData.VM[j].hour=0;
FFS_VMData.VM[j].minute=0;
FFS_VMData.VM[j].length=0;
}
}
flash_VMwrite("VM");
bookShowInformation( win, TxtDeleted, NULL,NULL);
return;
}
#endif
/* 2003/10/29, wangyan, modify dialog delete style*/
static T_MFW_HND Voicememo_create(MfwHnd parent_window)
{
T_VOICEMEMO_INFO * data = (T_VOICEMEMO_INFO *)ALLOC_MEMORY (sizeof(T_VOICEMEMO_INFO));
T_MFW_WIN * win;
if( data EQ NULL )
{
return NULL;
}
data->recentvoice_win = win_create (parent_window, 0, E_WIN_VISIBLE, NULL);
if( data->recentvoice_win EQ NULL )
{
return NULL;
}
data->mmi_control.dialog = (T_DIALOG_FUNC)NULL;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->recentvoice_win)->data;
win->user = (T_VOICEMEMO_INFO *)data;
data->parent = parent_window;
return data->recentvoice_win;
}
void Voicememo_destroy(MfwHnd win)
{
T_MFW_WIN * win_data;
T_VOICEMEMO_INFO * data ;
if( win )
{
win_data = ((T_MFW_HDR *)win)->data;
if( win_data != NULL )
data = ( T_VOICEMEMO_INFO *)win_data->user;
if( data )
{
TRACE_FUNCTION ("Voicememo_destroy()");
win_delete (data->recentvoice_win);
FREE_MEMORY (( void *)data, sizeof( T_VOICEMEMO_INFO));
}
else
{
TRACE_EVENT ("Voicememo_destroy() called twice");
}
}
}
static int Voicememo_delete_OK_cb(T_MFW_HND win, USHORT Identifier, USHORT Reason)
{
U8 j;
switch( Reason )
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -