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

📄 mmibookmenuwindow.c

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

					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:		    MmiBookMenuWindow.c
 $Revision:		1.0                                                       
                                                                              
 $Author:		Condat(UK)                                                         
 $Date:		    25/10/00                                                      
                                                                               
********************************************************************************
                                                                              
 Description:

    Menu handling for the phone book
                        
********************************************************************************
 $History: MmiBookMenuWindow.c

	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 "MmiColours.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 "MmiSettings.h"  // for keypadlock
#include "MmiSounds.h"
#include "MmiIdle.h"

extern UBYTE HUPKeyOrigin;		// Variable to indicate that long end key press is coming from menu

/*******************************************************************************                       
                                External Function Prototype
                                                                              
*******************************************************************************/
/* Fix for the melody and volume settings. 3/4/01 MZ */
extern BOOL getScrollSelectMenuItem(void);
extern clearScrollSelectMenuItem(void);
extern void volMenuItemSelected(void);
extern USHORT getSoundsReason(void);
extern void startRingerVolSettingInactivityTimer(void);
extern void stopRingerVolSettingInactivityTimer(void);
extern void restartVolSettingInactivityTimer(void);

/*******************************************************************************
                                                                              
                                Private Methods
                                                                              
*******************************************************************************/



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

 $Function:    	bookMenuMenuCB

 $Description:	Menu handler for the menu window
 
 $Returns:		MFW_EVENT_CONSUMED if event handled, otherwise
				MFW_EVENT_PASSED

 $Arguments:	e, event, m, menu handle
 
*******************************************************************************/

static int bookMenuMenuCB( MfwEvt e, MfwMnu *m )
{
    T_MFW_HND       window		= mfwParent( mfw_header() );
	T_MFW_WIN		*win_data	= ((T_MFW_HDR *)window)->data;
	tBookStandard	*data		= (tBookStandard *) win_data->user;

	TRACE_FUNCTION( "bookMenuMenuCB()" );

	/* We only handle the ESCAPE event in here
	*/
	switch( e )
    {
        case E_MNU_ESCAPE:
		{
			/* Escape requested, we need to shut down this window
			*/
			if (data->Callback)
				(data->Callback) (data->parent_win, NULL, NULL);
			bookMenuDestroy( window );
			stopRingerVolSettingInactivityTimer();
		}
		break;

        default:
		{
			/* unknown event, pass it up the tree for handling elsewhere
			*/
            return MFW_EVENT_PASSED;
        }
		break;
	}

	/* We got here, event handled, prevent anyone else
	   dealing with it
	*/
	return MFW_EVENT_CONSUMED;
}






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

 $Function:    	bookMenuDialog

 $Description:	Menu window dialog function
 
 $Returns:		none

 $Arguments:	win, window handle
                event, event to be handled
				value, not used
				parameter, not used
 
*******************************************************************************/

void bookMenuDialog( 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;
	MfwMnu			*mnu;
	
	TRACE_FUNCTION( "bookMenuDialog()" );

	/* The menu dialog function has to deal with initialisation
	   and responses from the PIN2 validation methods
	*/
    switch( event )
	{
		case MENU_INIT:
		{
			/* On initialisation, we can create the menus and
			   display the window
			*/
			data->menu = mnuCreate( data->win, (MfwMnuAttr *) parameter, E_MNU_ESCAPE, (MfwCb) bookMenuMenuCB );
			mnuLang( data->menu, mainMmiLng );
			mnuUnhide( data->menu );
			winShow( data->win );

			if (value EQ PhbkMainMenu)
			{
		           // start the timer for the keypadlock
					tim_start (data->menu_tim);
		            data->status_of_timer = FALSE;
		     }
		     else
		     {
					data->status_of_timer = TRUE;
		     }
		     if(value == SettingVolume)
		     {
		     	/*
				  The ringer volume settings dialog has been invoked, create and start the
				  4 second time out.
		     	*/
		     	startRingerVolSettingInactivityTimer();
		     }
			
		}
		break;

		case ADD_CALLBACK:
		{
			/* Change the callback from the default menu callback to one specified
			 * in parameter */
			data->Callback = (T_VOID_FUNC)parameter;
		}
		break;

		case DEFAULT_OPTION:
		{
			/* Highlight an option in the menu when it is opened.  Parameter points to a UBYTE. */
			
			mnuChooseVisibleItem(data->menu, *((UBYTE *)parameter));
		}
		break;
		
		case PIN2_OK:
		{
			/* We have received a PIN2 authorisation, so we can execute the
			   the requested function
			*/
			
			TRACE_EVENT("PIN2_OK: Should carry on to perform phonebook op");
			(data->phbk->pin2_next)( data->phbk->menu, data->phbk->item);

		}
		break;
  		case E_MNU_ESCAPE:
		{
			/* Escape requested, we need to shut down this window
			*/
			bookMenuDestroy( win);
		}
		break;
		default:
		{
			/* In situations where a PIN2 abort is returned, we can handle it
			   as a default event, and just ignore it
			*/
			TRACE_EVENT("PIN2 not OK");
		}
		break;
	}
}



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

 $Function:    	bookMenuTimCB

 $Description:	Menu tim handler
 
 $Returns:		
				
 $Arguments:	
 
*******************************************************************************/

static int bookMenuTimCB (T_MFW_EVENT event, T_MFW_TIM *tc)
{
    T_MFW_HND       window		= mfwParent( mfw_header() );
	T_MFW_WIN		*win_data	= ((T_MFW_HDR *)window)->data;
	tBookStandard	*data		= (tBookStandard *) win_data->user;

	data->status_of_timer = TRUE;

}






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

 $Function:    	bookMenuWindowCB

 $Description:	Menu window handler
 
 $Returns:		MFW_EVENT_CONSUMED if event handled, otherwise
				MFW_EVENT_PASSED

 $Arguments:	e, event, m, window handle
 
*******************************************************************************/

static int bookMenuWindowCB( MfwEvt e, MfwWin *w )
{
	tBookStandard * data = (tBookStandard *)w->user;
	MfwMnu * mnu;

    TRACE_FUNCTION( "bookMenuWindowCB()" );

	if (!w)
	    return MFW_EVENT_PASSED;

	switch( e )
    {
        case MfwWinVisible:
		{
			dspl_ClearAll();	// sbh - clear screen before update
			mnu = (MfwMnu *) mfwControl( data->menu );

			/*
			**Check whether the data is valid, if not use 'sensible' default values
			*/
			if (mnu)
			{
				if (mnu->curAttr)
			softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, mnu->curAttr->mnuColour);
				else
					softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, COLOUR_LIST_SUBMENU);
					
			}
			else
				softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, COLOUR_LIST_SUBMENU);
		}
		break;

        default:
		{
			/* unknown event, pass it up the tree for handling elsewhere
			*/
            return MFW_EVENT_PASSED;
        }
		break;
	}

	/* We got here, event handled, prevent anyone else
	   dealing with it
	*/
    return MFW_EVENT_CONSUMED;
}






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

 $Function:    	bookMenuKbdCB

 $Description:	tbd
 
 $Returns:		MFW_EVENT_CONSUMED always

 $Arguments:	e, event, k, key handle
 
*******************************************************************************/

static int bookMenuKbdCB( MfwEvt e, MfwKbd *k )
{
	static BOOL storeSelectedItemToPcm=FALSE;
    T_MFW_HND      window		= mfwParent( mfw_header() );
	T_MFW_WIN		*win_data	= ((T_MFW_HDR *)window)->data;
	tBookStandard	*data		= (tBookStandard *) win_data->user;
	MfwMnu			*mnu;
	U8				keycode;	/* SPR#1608 - SH */

	TRACE_FUNCTION( "bookMenuKbdCB()" );

	/* handle the keypress
	*/
	switch (k->code)
    {
		case KCD_MNUUP:
		{
			// keypadLock will not activate anymore
			data->status_of_timer = TRUE;			
			/* Update the window with the previous element
			*/
            mnuUp( data->menu );
			/*
            Special case when setting up ringer volume, the current ringer 
            is played as user scrolls the volume settings Silent -> cresendo.
            MZ.
            */
            if(getScrollSelectMenuItem() == TRUE ||(getSoundsReason() == SettingVolume) )
            	{
            	 mnuSelect(data->menu);
            	 restartVolSettingInactivityTimer();
            	}
		}
        break;

		case KCD_MNUDOWN:
		{
			// keypadLock will not activate anymore

⌨️ 快捷键说明

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