⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmieditor.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 5 页
字号:
/*******************************************************************************

          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

  25/10/00      Original Condat(UK) BMI version.
 $End

*******************************************************************************/

#define ENTITY_MFW

/* 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"
#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"

#include "cus_aci.h"
#include "p_sim.h"
#include "pcm.h"
#include "mmiicons.h"
#include "mmibookshared.h"
#include "mmismsmenu.h"
#include "mfw_ffs.h"
#ifdef EASY_TEXT_ENABLED
#include "MmiLatinPredText.h"
#include "MmiDictionary.h"
#endif /* EASY_TEXT_ENABLED */

#include "mmiColours.h"

#ifndef MFW_EVENT_PASSED
#define MFW_EVENT_PASSED 0
#endif


/*********************************************************************
**********************************************************************

                                 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 char SymbolPrompt[40] = "123456789";
static int DoNextLongPress = FALSE;

static UBYTE UPPER_CASE = FALSE;
extern int upCase;
static UBYTE over_length_label = FALSE;

static UBYTE AllowPredText = FALSE;
extern int SymbolChar;
static const unsigned char TextIconeZiTextSmall[] =
{
  0x03,
  0x03,
  0x18,
  0x7c,
  0xcc,
  0x08,
	0x10,
	0x0c
};

/* 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);


/*********************************************************************
**********************************************************************

                                DYNAMIC EDITOR WINDOW. IMPLEMENTATION

*********************************************************************
**********************************************************************/

void editor_data_init( T_EDITOR_DATA* editor_info, T_EDIT_CB callback,USHORT lsk, USHORT rsk, USHORT txtId, USHORT min_num_char, UBYTE mode, ULONG timeout)
{

	editor_info->LeftSoftKey   	= lsk;	    
	editor_info->RightSoftKey 	= rsk;
	editor_info->TextId      	= txtId;
	editor_info->mode			= mode;
	editor_info->Callback     		= callback;
	editor_info->min_enter   		= min_num_char;
	editor_info->timeout    		= timeout;

	//Set-up default values
	editor_info->AlternateLeftSoftKey	= TxtNull;
	editor_info->Identifier				= 0;  /* optional */

	editor_info->FormatString		= NULL;
	editor_info->formatIndex		= 0;
	editor_info->fieldIndex			= 0;	    
	
	//Set-up default values - the defaults may change depending on what other editors do
	editor_info->hide         		= FALSE;
	editor_info->TextString 		= NULL;
	editor_info->destroyEditor		= TRUE;

}

/*******************************************************************************

 $Function:     calculateWindow

 $Description:	initialises the size of the editor based on the screen size and the 'zone_id'
 				which controls what part of the screen the editor should be in.

 $Returns:    	An updated 'attr' with values for the editor window position and size

 $Arguments:  	zone_id - bitmapped word which defines the editor size and position
 				The definitions are in MMIEditor.h
 				The most common sizes are
	 				full screen
 					full screen with softkkeys
 					full screen with title and softkeys
 				but the macros also support part screens (with/without icons/titles/softkeys) eg.
 					left screen :-	middle width screen	right screen 
 						xxxx----	--xxxx--			----xxxx
 						xxxx----	--xxxx--			----xxxx
 						xxxx----	--xxxx--			----xxxx
 						xxxx----	--xxxx--			----xxxx
 					top screen :-	middle ht screen	bottom screen 
 						xxxxxxxx	--------			---------
 						xxxxxxxx	xxxxxxxx			---------
 						--------	xxxxxxxx			xxxxxxxxx
 						--------	--------			xxxxxxxxx
 				or any combination of width/height.
 				An Id of 0 is assumed to be undefined and is treated as full screen plus softkeys.
*******************************************************************************/
#ifndef LSCREEN
//Sizes defined for CSAMPLE editore
#define BOOKDETAILS_EDITOR_SIZE 		0, 0, SCREEN_SIZE_X-4, Mmi_layout_line(LAST_LINE_TOP)
#define NUMBER_EDITOR_SIZE				0, 12, SCREEN_SIZE_X , MNU3LINE
#define PHONEBOOK_DLG_EDITOR_SIZE		4, Mmi_layout_line(3)+2, SCREEN_SIZE_X-4, SCREEN_SIZE_Y-(Mmi_layout_line(3)+2)
#define BOOKSDN_EDITOR_SIZE 			34, Mmi_layout_line(3)+2, 50, Mmi_layout_line(1)+2

//MMICall
#define CALL_EDITOR_SIZE				4,28,SCREEN_SIZE_X-4, 20
#define CALLSCRATCHPAD_EDITOR_SIZE		6, Mmi_layout_line(2),SCREEN_SIZE_X-6, 16

//MMIServices
#define SERVICE_CREATE_EDITOR_SIZE		4,Mmi_layout_line(1)+2,SCREEN_SIZE_X-4, MNU3LINE
#define PASSWORD_EDITOR_SIZE			0, 12, SCREEN_SIZE_X , 13

//From MMIIdle
//GW Changed window height from 30 (27?) to 24.
#define WIN_DIALLING_SIZE				0,Mmi_layout_line_icons(2), SCREEN_SIZE_X,24
#define WIN_DIALLING_C_SIZE 			0,Mmi_layout_line_icons(1),SCREEN_SIZE_X,32

//Positions for editor windows in mmismssend
#define PHNO_EDITOR_SIZE 				0, (Mmi_layout_line(1)+2), SCREEN_SIZE_X, 20

//NB defines below used twice, second time START/SIZE_Y was same as START/SIZE_Y above 
#define CENTRE_EDITOR_SIZE				0, Mmi_layout_line(1), SCREEN_SIZE_X, MNU3LINE+3

//And for MMIServices - moved here from mmiservices.c
#define SAT_EDITOR_SIZE	 				6,30,SCREEN_SIZE_X-6, 20

#define RPWD_EDITOR_SIZE				0,12,SCREEN_SIZE_X,13

//MMIBookCallDetails
#define PHB_EDITOR_SIZE  				4,0,SCREEN_SIZE_X-4, ALLBUT2LINE

//MMIPins
#define PIN_EDIT_RESET_SIZE 			12,20,84-12,16

//MMITimeDate
#define TIMEDATE_EDITOR_AREA_SIZE 0,10,70,10
#endif
void setSize(MfwRect *win, int px, int py, int sx, int sy)
{
	win->px = px;	win->py = py;
	win->sx = sx;	win->sy = sy;
}

void getSpecificWindowSize(MfwEdtAttr* attr, int zone_id )
{
	switch (zone_id)
	{
	case ZONE_SMALL_EDITOR:
		attr->win.px = 6;
		attr->win.py = Mmi_layout_IconHeight()*2;
		attr->win.sx = SCREEN_SIZE_X-attr->win.px;
		attr->win.sy = Mmi_layout_line_height()*2+4;
		break;
	case ZONE_BOTTOM_LINE:
		attr->win.px = 0;
		attr->win.py = SCREEN_SIZE_Y - Mmi_layout_line_height() - Mmi_layout_softkeyHeight();
		attr->win.sx = SCREEN_SIZE_X-attr->win.px;
		attr->win.sy = Mmi_layout_line_height();
		break;
	case ZONE_BOTTOM_LINE_FIND: //used for phonebook search
		attr->win.px = dspl_GetTextExtent(MmiRsrcGetText(TxtFind),0); 
		attr->win.py = SCREEN_SIZE_Y - Mmi_layout_line_height() - Mmi_layout_softkeyHeight();
		attr->win.sx = SCREEN_SIZE_X-attr->win.px;
		attr->win.sy = Mmi_layout_line_height();
		break;
		
#ifndef LSCREEN
	case BOOKDETAILS_EDITOR: 		setSize(&attr->win,BOOKDETAILS_EDITOR_SIZE);		break;
	case NUMBER_EDITOR:			 	setSize(&attr->win,NUMBER_EDITOR_SIZE);				break;
	case PHONEBOOK_DLG_EDITOR:		setSize(&attr->win,PHONEBOOK_DLG_EDITOR_SIZE);		break;
	case BOOKSDN_EDITOR:			setSize(&attr->win,BOOKSDN_EDITOR_SIZE);			break;
	case CALL_EDITOR: 			 	setSize(&attr->win,CALL_EDITOR_SIZE);				break;
	case CALLSCRATCHPAD_EDITOR:		setSize(&attr->win,CALLSCRATCHPAD_EDITOR_SIZE);		break;
	case SERVICE_CREATE_EDITOR:		setSize(&attr->win,SERVICE_CREATE_EDITOR_SIZE);		break;
	case PASSWORD_EDITOR:			setSize(&attr->win,PASSWORD_EDITOR_SIZE);			break;
	
	case WIN_DIALLING:				
	case WIN_DIALLING_CB:				
			if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
				setSize(&attr->win,WIN_DIALLING_C_SIZE);
			else
				setSize(&attr->win,WIN_DIALLING_SIZE);
			break;
	case WIN_DIALLING_SMS:		 	
			if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
			{
				setSize(&attr->win,0,Mmi_layout_line_icons(1),84,24);
			}
			else
				setSize(&attr->win,WIN_DIALLING_SIZE);
			break;
	case WIN_DIALLING_SAT:		 	
			if (Mmi_getCurrentLanguage() == CHINESE_LANGUAGE)
				setSize(&attr->win,WIN_DIALLING_C_SIZE);
			else
				setSize(&attr->win,WIN_DIALLING_SIZE);
			break;
	
	case PHNO_EDITOR:			 	setSize(&attr->win,PHNO_EDITOR_SIZE);				break;
	case CENTRE_EDITOR:				setSize(&attr->win,CENTRE_EDITOR_SIZE);				break;
	case SAT_EDITOR	:			 	setSize(&attr->win,SAT_EDITOR_SIZE);				break;
	case RPWD_EDITOR:			 	setSize(&attr->win,RPWD_EDITOR_SIZE);				break;
	case PHB_EDITOR: 			 	setSize(&attr->win,PHB_EDITOR_SIZE);				break;
	case PIN_EDIT_RESET:			setSize(&attr->win,PIN_EDIT_RESET_SIZE);			break;
	case TIMEDATE_EDITOR_AREA:		setSize(&attr->win,TIMEDATE_EDITOR_AREA_SIZE);		break;
#endif	
		default:
			break;
	}
}

void calculateWindow(MfwEdtAttr* attr, int zone_id )
{
	attr->win.px = 0;
	attr->win.py = 0;
	attr->win.sx = SCREEN_SIZE_X;
	attr->win.sy = SCREEN_SIZE_Y;
	if (zone_id == ZONE_BORDER_EDITOR)
	{	//Leave border on left/right of screen.
		attr->win.px = 4;
		attr->win.sx = attr->win.sx - 2*attr->win.px;
		zone_id = ZONE_FULLSOFTKEYS;
	}
	else if ((zone_id != 0x0000) && ((zone_id &0xF000)==0xF000))
 	{
		getSpecificWindowSize(attr,zone_id);
	    return;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -