📄 mmibooksearchwindow.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: MmiSearchWindow.c
$Revision: 1.0
$Author: Condat(UK)
$Date: 25/10/00
********************************************************************************
Description:
This module provides the phone book search window functionality for the
phone book module of the basic MMI
********************************************************************************
$History: MmiSearchWindow.c
25/10/00 Original Condat(UK) BMI version.
20/02/02 Reinstated editor when in Chinese language by removing
"if not Chinese" conditions SPR 1742
$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 "mfw_cnvt.h" //mfw_Gsm2SIMStr prototype
#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"
#include "mmiSmsMenu.h"
#include "MmiSmsSend.h"
#include "mmiLists.h"
#include "mmiSmsRead.h"
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
#include "ATBCommon.h"
#include "ATBDisplay.h"
#include "ATBEditor.h"
#include "AUIEditor.h"
#include "AUITextEntry.h"
#endif
typedef struct
{
T_MMI_CONTROL mmi_control;
T_MFW_HND chinese_search_win; /* MFW win handler */
T_MFW_HND parent;
ListMenuData * menu_list_data;
} T_CHINESE_SEARCH_INFO;
#include "mmicolours.h"
/*******************************************************************************
Private Methods
*******************************************************************************/
//#define TIME_TRACE_EVENT TRACE_EVENT
#ifndef TIME_TRACE_EVENT
#define TIME_TRACE_EVENT
#endif
/*******************************************************************************
$Function: bookSearchDialog
$Description: dialog handler for the search window functionality
$Returns: None
$Arguments: win, window handle
event, event to be handled
value, not used
parameter, not used
*******************************************************************************/
void bookSearchDialog( 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;
tMmiPhbData *Current = &data->phbk->current;
MfwMnu *mnu;
TRACE_FUNCTION( "bookSearchDialog()" );
switch( event )
{
case SEARCH_INIT:
{
/* No initialisation required
*/
}
break;
case SEARCH_SCROLL_UP:
{ /*MC SPR 1541, flag to show whether we've scrolled off-screen and need to
update the portion of the list displayed*/
BOOL get_new_screen = FALSE;
/* Scroll up
*/
if ( ( Current->index == 1 ) && ( Current->selectedName == 0 ) )
{
if ( Current->status.used_entries < MAX_SEARCH_NAME )
Current->selectedName = Current->status.used_entries - 1;
else
{ Current->selectedName = MAX_SEARCH_NAME - 1;
/*SPR 1541, we're scrolling up from the first item in the list and are to go to
the end*/
get_new_screen = TRUE;
}
Current->index = Current->status.used_entries - Current->selectedName;
}
else
{
if (Current->selectedName == 0)
{ Current->index--;
/*SPR 1541, we've just come off the top of the screen*/
get_new_screen = TRUE;
}
else
Current->selectedName--;
}
mnu = (MfwMnu *) mfwControl( data->menu );
mnu->lCursor[mnu->level] = Current->selectedName;
/*SPR 1541, only update the list if flag set*/
if (get_new_screen == TRUE)
bookFindName( MAX_SEARCH_NAME, &data->phbk->current );
}
break;
case SEARCH_SCROLL_DOWN:
{ /*MC SPR 1541, flag to show whether we've scrolled off-screen and need to
update the portion of the list displayed*/
BOOL get_new_screen = FALSE;
/* Scroll Down
*/
if ( ( Current->index + Current->selectedName ) == Current->status.used_entries )
{
Current->index = 1;
Current->selectedName = 0;
/*SPR 1541, we've come off the end of the list and are to go back to
the beginning*/
get_new_screen = TRUE;
}
else
{
if ( Current->selectedName == MAX_SEARCH_NAME - 1 )
{ Current->index++;
/*SPR 1541, we've just come off the bottom of the screen*/
get_new_screen = TRUE;
}
else
Current->selectedName++;
}
mnu = (MfwMnu *) mfwControl( data->menu );
mnu->lCursor[mnu->level] = Current->selectedName;
/*SPR 1541, only update the list if flag set*/
if (get_new_screen == TRUE)
bookFindName( MAX_SEARCH_NAME, &data->phbk->current );
}
break;
case SEARCH_STRING:
{
{
/* Find name
*/
Current->index = Current->index + Current->selectedName;
if ( bookSearchName( data->edtBuf, MAX_SEARCH_NAME, Current ) == MFW_PHB_OK )
{
if ( Current->index > ( Current->status.used_entries + 1 - MAX_SEARCH_NAME ) )
{
if ( Current->status.used_entries > MAX_SEARCH_NAME )
{
Current->selectedName = Current->index - Current->status.used_entries + MAX_SEARCH_NAME - 1;
Current->index = Current->index - Current->selectedName;
}
else
{
Current->selectedName = Current->index - 1;
Current->index=1;
}
/* go find the name
*/
bookFindName(MAX_SEARCH_NAME,&data->phbk->current);
}
else
Current->selectedName = 0;
/* update the menu
/* SPR881 - SH - Move name find to below */
}
/* update the menu
*/
/* SPR881 - SH - is necessary even when BookSearchName, above, fails */
mnu = (MfwMnu *) mfwControl( data->menu );
mnu->lCursor[mnu->level] = Current->selectedName;
/* go find the name
*/
bookFindName(MAX_SEARCH_NAME,&data->phbk->current);
}
}
break;
case SEARCH_UPDATE:
{
/* Update, actually an initialisation/reset phase
*/
Current->index = 1;
Current->selectedName = 0;
{
memset( data->edtBuf, '\0', sizeof( data->edtBuf ) );
/* SPR#1428 - SH - New Editor changes */
#ifdef NEW_EDITOR
ATB_edit_Reset( data->editor );
#else /* NEW_EDITOR */
edtReset( data->edt );
#endif /* NEW_EDITOR */
SEND_EVENT( win, SEARCH_STRING, 0, 0 );
}
}
break;
/* SPR#1428 - SH - New Editor: Add this to allow redraw of
* window on request. */
#ifdef NEW_EDITOR
case SEARCH_REDRAW:
SEND_EVENT(data->win, SEARCH_STRING, 0, 0);
win_show(data->win);
break;
#endif /* NEW_EDITOR */
default:
{
/*
*/
}
break;
}
}
/*******************************************************************************
$Function: bookSearchWindowCB
$Description: Window call back function
$Returns: MFW_EVENT_CONSUMED, or MFW_EVENT_PASSED
$Arguments: e, event, w, window handle
*******************************************************************************/
static int bookSearchWindowCB( MfwEvt e, MfwWin *w )
{
tBookStandard *data = (tBookStandard *) w->user;
tMmiPhbData *Current = &data->phbk->current;
int index;
char *pchr;
char pchr2[PHB_MAX_LEN*2 +4];/*mc, SPR 1442*/
TRACE_FUNCTION( "bookSearchWindowCB()" );
if(data->phbk->current.status.book == PHB_ADN)
data->phbk->current.status.book = PHB_ADN_FDN;
/* Deal with the visible event
*/
switch (e)
{
case MfwWinVisible:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -