📄 mmimemo.c
字号:
/*******************************************************************************
CONDAT (UK)
********************************************************************************
This software product is the property of Condat (UK) Ltd and may not be
disclosed to any third party without the express permission of the owner.
$Project name: Basic MMI
$Project code: BMI (6349)
$Module: memo
$File: Mmimemo.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 25/10/00
********************************************************************************
Description
This provides the main calculator functionality
********************************************************************************
$History: MmiToolkit.c
25/10/00 Original Condat(UK) BMI version.
26/11/02 gdy add
$End
*******************************************************************************/
/******************************************************************************
Include Files
*******************************************************************************/
#define ENTITY_MFW
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#if defined (NEW_FRAME)
#include "typedefs.h"
#include "vsi.h"
#include "pei.h"
#include "custom.h"
#include "gsm.h"
#else
#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"
#include "GameDisplay.h"
#endif
#include "MmiBookShared.h"
#include "MmiEditor.h"
#include "Mfw_edt.h"
#include "MmiDialogs.h"
#include "p_sim.h"
#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_edt.h"
#include "mfw_tim.h"
#include "mfw_phb.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_lng.h"
#include "mfw_sat.h"
#include "mfw_kbd.h"
#include "mfw_nm.h"
#include "mfw_sms.h"
#include "dspl.h"
#include "MmiMmi.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiIdle.h"
#include "MmiSoftkeys.h"
#include "MmiIcons.h"
#include "MmiMenu.h"
#include "MmiMain.h"
#include "MmiStart.h"
#include "MmiPins.h"
#include "MmiSettings.h"
#include "MmiEditor.h"
#include "MmiBookShared.h"
#include "MmiSmsMenu.h"
//#include "MmiStopwatch.h"
#include "Mmieditor.h"
#include "Mmieditor_i.h"
#include "Mmisounds.h"
#include "Mmilists.h"
//#include "Mminote.h"
#include "gdi.h"
#include "Audio.h"
#include "MmiSounds.h"
#include "MmiResources.h"
#include "Td.h"
#include "mfw_ffs.h"
#include "GameDisplay.h"
#include "Mmismssend.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "Mmimemo.h"
//#include "bmieastapi.h"
#include "mmiusersymbolinput.h"
#include "mmitextinput.h" /* 2003/12/04 sunsj */
#include "mmiiconresource.h"/* 2004/06 sunsj modify for icon manage */
#define MemoIndexNumber 30
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND win;
T_MFW_HND kbd;
T_MFW_HND editor_win;
T_EDITOR_DATA editor_data;
USHORT event;
uint8 text[MEMO_LEN];
}MemoData;
typedef enum
{
MEMO_INIT=MemoIndexNumber,
MEMO_COVER,
MEMO_DELETEALL,
MEMO_EXIT
}MEMOTYPE;
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND win;
T_MFW_HND kbd;
T_MFW_HND editor_win;
T_EDITOR_DATA editor_data;
ListMenuData* menu_list_data;
int event;
UBYTE position;
int numberOfRecords;
}memoBrowseData;
typedef enum
{
MEMOBROWSE_INIT=MemoIndexNumber+4,
MEMOBROWSE_DELETE,
MEMOBROWSE_EXIT
}MEMOBROWSE_TYPE;
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent_win;
T_MFW_HND win;
T_MFW_HND editor_win;
T_EDITOR_DATA editor_data;
char string[MEMO_LEN];
}MemoChangeData;
typedef enum
{
MEMOCHANGE_INIT=MemoIndexNumber+7,
MEMOCHANGE_EXIT
}MEMOCHANGE_TYPE;
typedef struct
{
int position;
}MemoIndexData;
typedef struct
{
MemoIndexData Item[10];
}MemoIndex;
typedef struct
{
char string[13];
}StringData;
typedef struct
{
StringData item[10];
}String10;
String10 string_data;
static MfwMnuAttr memo_menuAttrib =
{
0,
&melody_menuArea,
MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
-1, /* use default font */
NULL, /* with these items */
0 /* number of items */
};
T_MFW_HND memo_win=NULL;
MemoIndex MemoDataIndex;
static int position=0;
extern stopw_menuAttrib;
extern const unsigned char backgroundBit[];
extern const unsigned char iconRequire[];
extern T_call call_data;
static T_MFW_HND memo_create(MfwHnd parent_win);
static void Memo_DialogCB(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
void MemoSetEditor(T_MFW_HND win);
static void MemoCB( T_MFW_HND win,USHORT Identifier,UBYTE reason);
void Memo_destroy(T_MFW_HND own_window);
static int cover_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard);
static T_MFW_HND memoBrowse_create(MfwHnd parent_win);
static void MemoBrowse_DialogCB(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
void memoBrowse_destroy(T_MFW_HND own_window);
static void MemoChangeCB( T_MFW_HND win,USHORT Identifier,UBYTE reason);
void MemoList_cb(T_MFW_HND Parent, ListMenuData * ListData);
void MemoChangeSetEditor(T_MFW_HND win);
static void MemoChange_DialogCB(T_MFW_HND win, USHORT event, SHORT value, void * parameter);
static int MemoChange_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static T_MFW_HND MemoChange_create(MfwHnd parent_win);
static int memoBrowse_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
void MemoDelete_dialog_cb(T_MFW_HND win, USHORT event, UBYTE reason);
void positionChange();
void MemoChange_destroy(T_MFW_HND own_window);
void memo_dialog_cb(T_MFW_HND win, USHORT event, UBYTE reason);
void memoBrowse_destroy1(T_MFW_HND own_window);
void MemoIndexInit();
int memoAdd(MfwMnu* m, MfwMnuItem* i)
{
T_MFW_HND parent_win = mfwParent( mfw_header());
T_MFW_HND win = memo_create(parent_win);
TRACE_EVENT("memoAdd");
if( win NEQ NULL )
{
if( call_data.win )
{
call_data.win_memo=win;//zy 2003-04-01 if in call add memo
}
SEND_EVENT (win, MEMO_INIT, 0, 0);
}
return MFW_EVENT_CONSUMED;
}
/* "增加"项 "全部删除"项 窗口创建 */
static T_MFW_HND memo_create(MfwHnd parent_win)
{
MemoData* data = (MemoData *)ALLOC_MEMORY (sizeof (MemoData));
T_MFW_WIN * win;
TRACE_EVENT("memo_create");
if( data EQ NULL )
{
return NULL;
}
// Create window handler
data->win = win_create (parent_win, 0, E_WIN_VISIBLE, 0);//(T_MFW_CB)browse_win_cb);
if( data->win EQ NULL )
{
return NULL;
}
// connect the dialog data to the MFW-window
data->mmi_control.dialog = (T_DIALOG_FUNC)Memo_DialogCB;
data->mmi_control.data = data;
win = ((T_MFW_HDR *)data->win)->data;
win->user = (void *)data;
data->parent_win = parent_win;
return data->win;
}
/* "增加" "全部删除" 窗口的事件处理函数 */
static void Memo_DialogCB(T_MFW_HND win, USHORT event, SHORT value, void * parameter)
{
T_MFW_WIN * win_data = ( (T_MFW_HDR *) win )->data;
MemoData * data = (MemoData *) win_data->user;
int old_color,i,number;
T_DISPLAY_DATA display_info;
game_Line line;
data->event=event;
data->kbd=kbd_create(data->win,KEY_ALL,(T_MFW_CB)cover_kbd_cb);
switch( event )
{
case MEMO_INIT: //增加窗口的初始化
MemoSetEditor(win);//set editor with default attribute values
data->editor_data.Callback = (T_EDIT_CB)MemoCB;
/* 2003/12/04 sunsj modify for new editor mode */
if( data->editor_data.mode == TEXTINPUT_MODE )
{
data->editor_win = text_input(win, &(data->editor_data));
}
else
{
data->editor_win = editor_start(win, &(data->editor_data));
}
// winShow(win);
break;
case MEMO_COVER: //覆盖第一条,编辑窗口的回调函数发送
// 2004.3.10 WYJ modify embedded popup dialog
draw_popup_background();
/* 2004/05/25 sunsj modify */
draw_icon_require();
//dialog_drawPopIcon(POP_ICONREQUIRE);
/* 2004/05/25 sunsj modify */
ALIGNED_PROMPT(CENTER, DIALOG_FIRST_LINE, DSPL_TXTATTR_TRANSPARENT, TxtCover);
displaySoftKeys(TxtSoftOK, TxtSoftBack);
#if(MAIN_LCD_SIZE==3)
draw_softkeybar_updown_arrow();//jhxu720
#endif
break;
case MEMO_DELETEALL: //全部删除窗口的初始化
number=0;
for( i=0;i<10;i++ )
{
if( (FFS_MemoData.item[i].text[0]!=0)&&(FFS_MemoData.item[i].position!=0) )
number++;
}
if( !number )
{
dialog_info_init(&display_info);
display_info.TextId2 =TxtNorecord;
display_info.Time = FOREVER;
display_info.iconindex =REMIND_NORECORD;
/*
* Call Info Screen
*/
info_dialog(win, &display_info);
Memo_destroy(win);
break;
}
// 2004.3.10 WYJ modify embedded popup dialog
draw_popup_background();
/* 2004/05/25 sunsj modify */
draw_icon_require();
//dialog_drawPopIcon(POP_ICONREQUIRE);
#if(MAIN_LCD_SIZE==4)
ALIGNED_PROMPT(CENTER, DIALOG_FIRST_LINE, DSPL_TXTATTR_TRANSPARENT, TxtDeleteAll);
#elif(MAIN_LCD_SIZE==3)
ALIGNED_PROMPT(CENTER_RIGHT, DIALOG_HALF_FIRSTSECOND, DSPL_TXTATTR_TRANSPARENT, TxtDeleteAll);
#endif
displaySoftKeys(TxtSoftOK,TxtSoftBack); /*2003/12/12, wangyan modify*/
#if(MAIN_LCD_SIZE==3)
draw_softkeybar_updown_arrow();//jhxu720
#endif
break;
case MEMO_EXIT:
Memo_destroy(win);
break;
}
}
/* "增加" "全部删除"确认键处理函数 */
static int cover_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard)
{
T_MFW_HND win = mfw_parent (mfw_header());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -