📄 mmibookinputwindow.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: PhoneBook
$File: MmiBookInputWindow.h
$Revision: 1.0
$Author: Condat(UK)
$Date: 25/10/00
********************************************************************************
Description:
This module provides the functionality for the input window of the
phone book module.
********************************************************************************
$History: MmiBookInputWindow.h
25/10/00 Original Condat(UK) BMI version.
$End
*******************************************************************************/
/*******************************************************************************
Include Files
*******************************************************************************/
#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_sys.h"
#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_lng.h"
/* SPR#1428 - SH - New Editor changes */
#ifndef NEW_EDITOR
#include "mfw_edt.h"
#endif
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_tim.h"
#include "mfw_sim.h"
#include "mfw_cm.h"
#include "mfw_nm.h"
#include "mfw_phb.h"
#include "mfw_mme.h"
#include "mfw_sat.h"
#include "mfw_sms.h"
#include "dspl.h"
#include "ksd.h"
#include "psa.h"
#include "MmiMain.h"
#include "MmiBookController.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"
#include "MmiMenu.h"
#include "MmiCall.h"
#include "MmiIcons.h"
#include "MmiIdle.h"
#include "MmiSoftKeys.h"
#include "MmiSounds.h"
#include "MmiIdle.h"
#include "MmiNetwork.h"
#include "MmiSat_i.h"
#include "MmiAoc.h"
#include "gdi.h"
#include "audio.h"
#include "cus_aci.h"
#include "p_sim.h"
#include "mfw_ffs.h"
#include "MmiTimers.h"
#include "MmiBookShared.h"
#ifdef EASY_TEXT_ENABLED
#include "MmiChineseInput.h"
#endif
#include "mmiColours.h"
/* SPR#1428 - SH - New Editor
* This file is obsolete with new editor and should not be compiled */
#ifndef NEW_EDITOR
#define NAME 0
#define NUMBER 1
static int DoNextLongPress = FALSE;
static UBYTE UPPER_CASE = TRUE;
static UBYTE MODE;
extern int upCase;
/*******************************************************************************
Private Methods
*******************************************************************************/
/*******************************************************************************
$Function: bookInputDialog
$Description: Dialog function for the input window
$Returns: None
$Arguments: win, window handle
event, event to be handled
value, not used
parameter, not used
*******************************************************************************/
static void bookInputDialog( T_MFW_HND win, USHORT event, SHORT value, void *parameter )
{
T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data;
tBookStandard *data = (tBookStandard *) win_data->user;
tInputSpecifics *properties = (tInputSpecifics *) parameter;
TRACE_FUNCTION ("bookInputDialog()");
/* Handle the input event, ew only deal with initialise and
destroy of the window in here
*/
switch( event )
{
case INPUT_INIT:
{
/* Initialise the input window
*/
data->properties.abc = properties->abc;
data->properties.text = properties->text;
data->properties.edt_attr_input = properties->edt_attr_input;
data->properties.left_soft_key = properties->left_soft_key;
data->properties.right_soft_key = properties->right_soft_key;
data->properties.callback = properties->callback;
data->edt = edtCreate( data->win, data->properties.edt_attr_input, 0, 0 );
/* activate our editor, stopping any others before doing so
*/
editDeactivate();
editActivate( data->edt, properties->abc );
edtChar( data->edt, ecBottom );
/* show the window
*/
winShow( data->win );
}
break;
case INPUT_DESTROY:
{
/* destroy the input window
*/
bookInputDestroy( win );
}
break;
}
}
/*******************************************************************************
$Function: bookInputWindowCB
$Description: Window event handler
$Returns: MFW_CONSUMED for the visible event, MFW_PASSED otherwise
$Arguments: e, event, w, window handle
*******************************************************************************/
static int bookInputWindowCB( MfwEvt e, MfwWin *w )
{
tBookStandard *data = (tBookStandard *) w->user;
TRACE_FUNCTION ("bookInputWindowCB()");
/* Handle the visible event, otherwise return MFW_EVENT_PASSED
*/
switch( e )
{
case MfwWinVisible:
{
/* Window visible
*/
MmiBookShowDefault();
edtShow( data->edt );
PROMPT( MmiBookMenuArea().px, MmiBookMenuArea().py, 0, data->properties.text );
softKeys_displayId(data->properties.left_soft_key, data->properties.right_soft_key, 0, COLOUR_LIST_SUBMENU);
}
break;
default:
{
/* unabel to handle event, pass handling of event back up tree
*/
return MFW_EVENT_PASSED;
}
}
/* if we get here, we have handled the event
*/
return MFW_EVENT_CONSUMED;
}
/*******************************************************************************
$Function: bookInputKbdCB
$Description: Input window keyboard handler
$Returns: MFW_EVENT_CONSUMED always, this will pass LEFT, RIGHT and CLEAR
events back to the calling window using the installed callback
method
$Arguments: e, event, k, key handle
*******************************************************************************/
static int bookInputKbdCB( MfwEvt e, MfwKbd *k )
{
T_MFW_HND win = mfwParent( mfw_header() );
T_MFW_WIN *win_data = ((T_MFW_HDR *) win)->data;
tBookStandard *data = (tBookStandard *) win_data->user;
TRACE_FUNCTION ("bookInputKbdCB()");
/* make sure the active editor is ours
*/
if ( activeEditor() != data->edt )
editActivate( data->edt, data->properties.abc );
/* Handle the key press
*/
switch (k->code)
{
case KCD_MNUUP:
{
/* move right
*/
edtChar( data->edt, ecRight );
}
break;
case KCD_MNUDOWN:
{
/* move left
*/
edtChar( data->edt, ecLeft );
}
break;
case KCD_MNUSELECT:
case KCD_LEFT:
{
/* select the entry using the parent window callback
*/
data->properties.callback( data->parent_win, INPUT_LEFT );
}
break;
case KCD_HUP:
{
/* get edit control block
*/
MfwEdt *edt = ( (MfwHdr *) data->edt )->data;
data->properties.callback( data->parent_win, INPUT_CLEAR );
}
break;
case KCD_RIGHT:
{
MfwEdt *edt = ( (MfwHdr *) data->edt )->data;
/* select the entry using the parent windows callback
*/
//If we have any data input, delete the char before cursor
if ( edt->attr->text[0] )
edtChar( data->edt, ecBack );
else
{
data->properties.callback( data->parent_win, INPUT_RIGHT );
displaySoftKeys_edition (TxtNull, TxtNull ,TxtNull);
MODE = NUMBER;
}
}
break;
case KCD_HASH:
{
/* deal with hash key
*/
edtChar( data->edt, '#' );
}
break;
case KCD_STAR:
{
/* deal with star key
*/
edtChar( data->edt, '*' );
}
break;
default:
{
/* default handling for the key being pressed
*/
/*NM, p015a */
/* it is better to use these two function for different mode*/
if (data->properties.abc EQ TRUE)
editEventKey(e, k); /* alpha-mode*/
else
edtChar(data->edt ,editControls[k->code]); /*digit -mode*/
edtShow(data->edt);
/*p015a end */
}
break;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -