📄 mmilatinpredtext.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
$Module: MMI
$File: MmiLatinPredText.c
$Revision: 1.0
$Author: Condat(UK)
$Date:
********************************************************************************
Description: Latin alphabet predictiev text editor. English-only for the moment.
********************************************************************************
$History: MmLatinPredText.c
$End
*******************************************************************************/
#include <stdio.h>
#include <string.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
#if 0
#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"
#include "stddefs.h" // needed for mfw_mfw.h
#endif //ganchh 2002/7/30
#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 "MmiMmi.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMenu.h"
#include "MmiSoftKeys.h"
#include "MmiIdle.h"
#include "MmiEditor.h"
#include "MmiEditor_i.h"
//GW Removed T9 reference
#include "MmiDictionary.h"
#include "cus_aci.h"
#include "p_sim.h"
#ifndef MFW_EVENT_PASSED
#define MFW_EVENT_PASSED 0
#endif
//data structure for punctuation symbols selection screen
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND parent;
T_MFW_HND edt_win;
T_MFW_HND edt_edt;
T_MFW_HND edt_kbd;
T_MFW_HND edt_kbd_long;
T_MFW_HND edt_tim; // c015 rsa
T_MFW_HND edt_input; // RM 25-08
T_EDITOR_DATA editor_data;
UBYTE cursor_position;
char* output_symbol;
}
T_SYMBOL_INFO;
//events in main editor screen
typedef enum
{
EDITOR_INIT,
EDITOR_DEINIT,
EDITOR_UPDATE
} editor_events;
/*********************************************************************
**********************************************************************
DYNAMIC EDITOR WINDOW. DECLARATION
*********************************************************************
**********************************************************************/
//protoypes
static T_MFW_HND SymbolScreencreate (T_MFW_HND parent);
static int SymbolScreenwin_cb (T_MFW_EVENT event, T_MFW_WIN * win);
static int SymbolScreenkbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard);
static void SymbolScreenexec_cb (T_MFW_HND win, USHORT event, SHORT value, char * symbol);
//global variables
//static int DoNextLongPress = FALSE;
//static UBYTE UPPER_CASE = FALSE;
//extern int upCase;
char SymbolChar;
//char TestBuffer[162];
//static char capitalise = TRUE;
//static int len =0;
/*******************************************************************************
$Function: SymbolScreendestroy
$Description: Destroy thesymbol screen
$Returns: None.
$Arguments: window handle
*******************************************************************************/
void SymbolScreendestroy (T_MFW_HND window)
{
T_MFW_WIN * win = ((T_MFW_HDR *)window)->data;
T_SYMBOL_INFO * data = (T_SYMBOL_INFO *)win->user;
char Punctuation_symbol = *data->output_symbol;
TRACE_FUNCTION ("SymbolScreendestroy()");
SEND_EVENT (data->parent, EDITOR_UPDATE,(short)Punctuation_symbol, NULL);
if (data)
{
/*
* Delete WIN Handler
*/
win_delete (data->edt_win);
/*
* Free Memory
*/
FREE_MEMORY ((void *)data, sizeof (T_SYMBOL_INFO));
}
else
{
TRACE_EVENT ("SymbolScreendestroy() called twice");
return ;
}
}
/*******************************************************************************
$Function: SymbolScreenstart
$Description: Starts the symbol screen
$Returns: handle
$Arguments: parent window, editor data
*******************************************************************************/
T_MFW_HND SymbolScreenstart (T_MFW_HND parent, char * symbol)
{
T_MFW_HND win;
TRACE_FUNCTION ("SymbolScreenstart()");
win = SymbolScreencreate (parent);
if (win NEQ NULL)
{
SEND_EVENT (win, E_EDITOR_INIT, 0, 0);
}
return win;
}
/*******************************************************************************
$Function: LatinEditorcreate
$Description: Creation of a symbol screen
$Returns: handle of new window
$Arguments: parent window
*******************************************************************************/
static T_MFW_HND SymbolScreencreate (T_MFW_HND parent)
{
T_SYMBOL_INFO * data = (T_SYMBOL_INFO *)ALLOC_MEMORY (sizeof (T_SYMBOL_INFO));
T_MFW_WIN * win;
TRACE_FUNCTION ("SymbolScreencreate()");
/*
* Create window handler
*/
data->edt_win = win_create (parent, 0, E_WIN_VISIBLE, (T_MFW_CB)SymbolScreenwin_cb);
if (data->edt_win EQ NULL)
{
return NULL;
}
/*
* connect the dialog data to the MFW-window
*/
data->mmi_control.dialog = (T_DIALOG_FUNC)SymbolScreenexec_cb;
data->mmi_control.data = data;
data->parent = parent;
win = ((T_MFW_HDR *)data->edt_win)->data;
win->user = (void *)data;
return data->edt_win;
}
/*******************************************************************************
$Function: SymbolScreenexec_cb
$Description: handles events for symbol window
$Returns: None.
$Arguments: window, event, value, editor data
*******************************************************************************/
static void SymbolScreenexec_cb (T_MFW_HND win, USHORT event, SHORT value, char * symbol)
{
T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
T_SYMBOL_INFO * data = (T_SYMBOL_INFO *)win_data->user;
T_MFW_HND parent_win = data->parent;
USHORT Identifier = data->editor_data.Identifier;
T_EDIT_CB Callback = data->editor_data.Callback;
char debug[20];
char* symStr = ".,?!:;-+#*()\'\"_@&$
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -