📄 mmieditor.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: MMI
$File: MmiEditor.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 22/02/01
********************************************************************************
Description:
********************************************************************************
$History: MmiMain.c
2003/11/10 sunsj fix can't insert char to text and add the function that return to idle
when close screen.
* ***************** Version 05.1 *****************
* zgz,2002.9.3
*when two or more editor in one window, add the KCD_MNUUP,KCD_MNUDOWN event to preve or next editor
*Send event to upper layer at any case when in phbk editing, user press KCD_LEFT
* ***************** Version 05.0 *****************
* zgz,2002.8.26
*add the code in editor_win_cb() to indicate upper layer to update
*
* ***************** Version 05.0 *****************
* zgz,2002.8.26
*update function editor_attr_init_only(), Add the handle of title attribute TITLE_TOP
*Add the right softkey handle. when no text in buffer, It displayed "back", else it is "del"
indicate upper layer to update
* ***************** Version 04.2 *****************
* zgz,2002.7.31
*update function editor_kbd_cb(), handle the KCD_RIGHT when no unicode chars(only 0x80) in the buffer
*
* ***************** Version 04.1 *****************
* zgz,2002.7.29
*update function editor_attr_init_only(), editor_attr_init_fullscr() for drawing frame line
*update editor_kbd_cb() for disable input_method update when only draw title
* ***************** Version 04 *****************
* zgz,2002.7.11
*change the editor for Mobile Innovation symbol input
*
* ***************** Version 03 *****************
* zgz,2002.7.2
*added function editor_attr_init_only(), editor_attr_init_fullscr(), getNextInputLen()
* update edtChar() by edtSymbol() for symbol input
* ***************** Version 02 *****************
* zgz,2002.06.24
* editor_kbd_cb() changed. Add the process for the key KCD_MNULEFT,KCD_MNURIGHT,KCD_VOLUP,KCD_VOLDOWN
*
25/10/00 Original Condat(UK) BMI version.
$End
*******************************************************************************/
#define ENTITY_MFW
////////////////////////////////////////////////////////////////////////////
//#define _ZGZ_EDITOR_DEBUG 1 // zgz,2002.7.4 define it for editor debug
/* includes */
#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"
#endif
#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_edt.h"
#include "mfw_tim.h"
#include "mfw_phb.h"
#include "mfw_sms.h"
#include "mfw_ss.h"
#include "mfw_icn.h"
//GW Removed T9 references
#include "mfw_mnu.h"
#include "mfw_lng.h"
#include "mfw_sat.h"
#include "mfw_kbd.h"
#include "mfw_nm.h"
#include "mfw_cm.h"
#include "dspl.h"
#include "ksd.h"
#include "psa.h"
#include "MmiMain.h"
#include "MmiDummy.h"
//#include "MmiLists.h"
#include "MmiMmi.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
//GW Removed T9 reference
#include "MmiIdle.h"
#include "MmiEditor.h"
#include "MmiEditor_i.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "mmiicons.h"
#include "mmibookshared.h"
#include "mmismsmenu.h"
#include "mfw_ffs.h"
#include "mmisymbol.h" // zgz,2002.7.6
#include "mmitextinput.h" /* 2003/12/04 sunsj */
#include "mmiusersymbolinput.h" // zgz,2002.7.6
#include "wstring.h" //zgz,2002.7.31
#include "mmisettings.h"
#include "mmistart.h"
#include "mmiSat_i.h" //zhaowm 2003.1.6
#include "mmismsmenu.h"
#ifdef EASY_TEXT_ENABLED
#include "MmiLatinPredText.h"
#include "MmiDictionary.h"
#endif
#include "mmiicons.h"
#include "mmi3dframe.h"
#ifndef MFW_EVENT_PASSED
#define MFW_EVENT_PASSED 0
#endif
#ifdef _ZGZ_EDITOR_DEBUG
#include "MmiLatinPredText.h"
#endif
//#define TDTRACE 1
#include "mmiutilapi.h"
#include "encrypt.h" // 2004.6.2 WYJ add
extern void ShowVersiondialog(T_MFW_HND win);/*2004/5/10, wangyan add*/
/*********************************************************************
**********************************************************************
DYNAMIC EDITOR WINDOW. DECLARATION
*********************************************************************
**********************************************************************/
/*
* Internal events
*/
static T_MFW_HND editor_create (T_MFW_HND parent);
//SH - static void editor_destroy (T_MFW_HND window);
static void editor_exec_cb (T_MFW_HND win,USHORT event, SHORT value, T_EDITOR_DATA * editor_data);
static int editor_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static int editor_kbd_cb (T_MFW_EVENT event, T_MFW_KBD * keyboard);
static int editor_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc);
//static void Setcursor(MfwEdt *edit,char *text,MfwRect win);
static char SymbolPrompt[40] = "123456789";
static int DoNextLongPress = FALSE;
static UBYTE UPPER_CASE = FALSE;
extern int upCase;
UBYTE AllowPredText = FALSE;
extern int SymbolChar;
extern INT8 g_norejectkeyflag;
/* 2003/10/13 sunsj mark for remove mmihz.c & mmihzapi.c */
//extern int editForChineseInput;
extern UINT8 g_pcsyncstatus ;//hxl add ,if pcsync run ,return,2003-2-13
#ifdef QQFUNC//hxl add for qq func switch,2003-3-24
extern uint8 In_QQ;//2003-2-28,indicate in qq menu
#endif
static const unsigned char TextIconeZiTextSmall[] =
{
0x03,
0x03,
0x18,
0x7c,
0xcc,
0x08,
0x10,
};
/* zhq, 2004/07/08, modified for we will use pin_outer_wait to init sub screen
and only refresh sub screen until main screen drawIdle. */
extern UBYTE main_sreen_init_complete;
/* internal used functions: */
static void editor_hideInit(T_EDITOR_INFO *data);
static void editor_hideInsert(T_EDITOR_INFO *data, U8 key);
static void editor_hideClear(T_EDITOR_INFO *data);
static void editor_hideClearAll(T_EDITOR_INFO *data);
static void editor_hideTerminate(T_EDITOR_INFO *data);
static int show_error_info(T_MFW_HND parent_win);
static void displayedtsoftkey(T_MFW_HND win);
/*********************************************************************
**********************************************************************
DYNAMIC EDITOR WINDOW. IMPLEMENTATION
*********************************************************************
**********************************************************************/
//KK011107 #ifndef WIN32 why is this undeffed?? it is used!!
/*******************************************************************************
$Function: editor_attr_init
$Description: initialize parameters in the edit buffer
$Returns: None.
$Arguments: None.
*******************************************************************************/
void editor_attr_init(MfwEdtAttr* attr, int zone_id, U8 mode, U8 *controls, char *text, U16 size )
{
attr->win.px = 0;
attr->win.py = 0;
attr->win.sx = SCREEN_SIZE_X;//120; /* 2003/12/22 sunsj modify for LCD width */
/* 2004/01/04 sunsj moidfy for different lcd size */
attr->win.sy = SCREEN_SIZE_Y-Mmi_layout_line_height() ; //zgz, attr->win.sy = 48-Mmi_layout_line_height() ;
attr->fgColor = 0xffffff;
attr->font = 0;
attr->mode = mode;
attr->controls = controls;
attr->text = text;
attr->size = size;
attr->title_id = 0;
AllowPredText = FALSE;
}
/*******************************************************************************
$Function: editor_attr_init_only
$Description: Just initialize parameters in the edit buffer, Not consider the softkey's display area
$Returns: None.
$Arguments:
$Author: zgz,2002.07.02
*******************************************************************************/
void editor_attr_init_only(MfwEdtAttr* attr, U16 px, U16 py, U16 sx, U16 sy, U8 titleMode, int title_id, char *text, U16 size,U8 mode ,char *textnum)
{
attr->win.px = px;
attr->win.py = py;
attr->win.sx = sx;
attr->win.sy = sy;
attr->titleMode = titleMode;
attr->title_id = title_id;
attr->text = text;
attr->size = size;
attr->mode = mode;
attr->textnum = textnum;
if( (titleMode == TITLE_ALL) || (titleMode == TITLE_ONLYTEXT) )
{
attr->win.py = py + Mmi_layout_line_height() + 1; // 1 means the frame line position
attr->win.sy = sy - Mmi_layout_line_height() - 1;
}
//set the default attribute
attr->fgColor = 0xffffff;
attr->font = 0;
}
/*******************************************************************************
$Function: editor_attr_init_fullscr
$Description: initialize parameters in the edit buffer, consider the softkey's display area, Set the editor area to full screen
$Returns: None.
$Arguments:
$Author: zgz,2002.07.02
*******************************************************************************/
void editor_attr_init_fullscr(MfwEdtAttr* attr, U8 titleMode, int title_id, char *text, U16 size , U8 mode)
{
/* 2004/02/11 sunsj modify editor area */
#if(MAIN_LCD_SIZE==3)
attr->win.px = 8;
attr->win.py = 0;
attr->win.sx = SCREEN_SIZE_X-4;//115;
attr->win.sy = SCREEN_SIZE_Y-Mmi_layout_line_height()-4 ;
#elif(MAIN_LCD_SIZE==4)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -