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

📄 mmibookmenuwindow.c

📁 GSM手机设计软件代码
💻 C
📖 第 1 页 / 共 2 页
字号:
			data->status_of_timer = TRUE;			
			/* Update the window with the next element
			*/
            mnuDown( 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_MNUSELECT:
        case KCD_LEFT:
		{
			// keypadLock will not activate anymore
			data->status_of_timer = TRUE;	

			// Select this element
			mnuSelect( data->menu );
			mnu = (MfwMnu *) mfwControl( data->menu );

			if (mnu != NULL)
			{
				if (mnu->curAttr != NULL)
				{
					// API - 24-01-03 - 1606 - Soft Key updating add this win Focus check
					if( winIsFocussed(window) )
						softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, mnu->curAttr->mnuColour);
				}
			}
			
			// A volume or tone setting menu has been entered. MZ 2/4/01
			if((getScrollSelectMenuItem() == TRUE) || (getSoundsReason() == SettingVolume))
			{
				/* 
				   First time pcm flag is false, subsequent selection of menu item
				   will select and terminate the volume settings menu. 3/4/01 MZ.
				*/
				if(storeSelectedItemToPcm ==TRUE || getSoundsReason() == SettingVolume )
				{
					clearScrollSelectMenuItem();
					volMenuItemSelected();
					storeSelectedItemToPcm =FALSE;
					mnuEscape( data->menu );
					if(getSoundsReason() == SettingVolume)
					{
					   	setSoundsReason(SoundsNone);
						stopRingerVolSettingInactivityTimer();
					}
					break;
				}
				  /*
				  	Second time the left soft key is used, store the setting in pcm and terminate the 
				  	volume settings menu.
				  */
				storeSelectedItemToPcm =TRUE;
				
			}
		}
        break;

		// POWER key takes us to idle screen.
        case KCD_POWER:
			data->status_of_timer = TRUE;	
			
			HUPKeyOrigin = 0; // sbh - we're coming from the menu screen, so don't shut down right away

        	//return to idle screen
        	
			if (data->Callback)
				(data->Callback) (data->parent_win, NULL, NULL);
			
			bookMenuDestroy(data->win);
			stopRingerVolSettingInactivityTimer();
			
        	SEND_EVENT(idle_get_window(), IDLE_UPDATE, 0, 0);
        break;
        	
        case KCD_RIGHT:
        case KCD_HUP:
		{
			// keypadLock will not activate anymore
			data->status_of_timer = TRUE;

			HUPKeyOrigin = 0; // sbh - we're coming from the menu screen, so don't shut down right away
			
			/* get us out of here
			*/
            mnuEscape( data->menu );
			mnu = (MfwMnu *) mfwControl( data->menu );
			if (mnu != NULL)
			{
				if (mnu->curAttr != NULL)
				{
					// API - 24-01-03 - 1606 - Soft Key updating add this win Focus check
					if( winIsFocussed(window) )				
						softKeys_displayId( TxtSoftSelect, TxtSoftBack, 0, mnu->curAttr->mnuColour);
				}
			}
			
			// Return the menu scroll behavior to normal.
			if(getScrollSelectMenuItem() == TRUE)
			{
				clearScrollSelectMenuItem();
		}
			/*
				If user exits the volume settings menu from the Idle or Incoming call screen.
				clear the soundsReason.
			*/ 
			if(getSoundsReason() == SettingVolume)
				setSoundsReason(SoundsNone);
            
		}
        break;
        
        case KCD_STAR:
		{	
		
			/*
             * Keypadlock will lock only 
             * within two seconds by press "*"
             */	
             
			if(data->status_of_timer EQ FALSE)
			{
	            TRACE_EVENT ("activate KEYpadLOCK");
    	        mnuEscape( data->menu );
				settingsKeyPadLockOn ();
			}
			
			/* SPR#1608 - SH - Otherwise, send '*' keypress to idle screen */
			
            else if (window == data->phbk->menu_main_win)
			{		
	        	/* Number key presses in phonebook menu returns user to idle screen, 
	               add key press to Idle edit screen. */

				keycode = k->code;

				bookMenuDestroy(data->win);

		        SEND_EVENT(idle_get_window(), IDLE_START_DIALLING_NUMBER, 0, &keycode);
			}
		}
        break;

        case KCD_HASH:
		{	
			/*
             * Keypadlock will lock only 
             * within two seconds by press "*"
             */			
			if(data->status_of_timer EQ FALSE)
			{
	            TRACE_EVENT ("activate Silent mode");

				if(FFS_flashData.settings_status & SettingsSilentMode)
				{
					settingsSilentModeOff();
				}
				else
				{
					settingsSilentModeOn();
				}
				mnuEscape( data->menu );
			}

			/* SPR#1608 - SH - Otherwise, send '#' keypress to idle screen */
			
            else if (window == data->phbk->menu_main_win)
			{		
	        	/* Number key presses in phonebook menu returns user to idle screen, 
	               add key press to Idle edit screen. */

				keycode = k->code;

				bookMenuDestroy(data->win);

		        SEND_EVENT(idle_get_window(), IDLE_START_DIALLING_NUMBER, 0, &keycode);
			}
		}
        break;
        
        default:
		{
			TRACE_EVENT("bookMenuKbdCb - DEFAULT!");
			/* SH - only allow dialling if we are in the main menu */
			if (window == data->phbk->menu_main_win)
			{
				/* keypadLock will not activate anymore */
				data->status_of_timer = TRUE;		

	        	/* Number key presses in phonebook menu returns user to idle screen, 
	               add key press to Idle edit screen. */

				keycode = k->code;

				bookMenuDestroy(data->win);

				if ((k->code>=KCD_0 && k->code<=KCD_9))
				{
					TRACE_EVENT("Idle Editor Start!");
		        	SEND_EVENT(idle_get_window(), IDLE_START_DIALLING_NUMBER, 0, &keycode);
				}	
			}
		}
        break;
	}

	/* always consume the event
	*/
    return MFW_EVENT_CONSUMED;
}







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

 $Function:    	bookMenuKbdLongCB

 $Description:	keyboard long press event handler
 
 $Returns:		MFW_EVENT_CONSUMED always

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

static int bookMenuKbdLongCB( MfwEvt e, MfwKbd *k )
{
    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( "bookMenuKbdLongCB()" );

	if ( ( e & KEY_CLEAR ) && ( e & KEY_LONG ) )
	{	mnuEscape( data->menu );
		return MFW_EVENT_CONSUMED;
	}
	/*if long press on END key*/
	 if ( ( e & KEY_HUP) && ( e & KEY_LONG ) )      
		{
			U8 keycode;
			U8 uMode;			
			uMode = dspl_Enable(0);

			// keypadLock will not activate anymore
			data->status_of_timer = TRUE;		

        	//return to idle screen

			keycode = k->code;
        	
			if (data->Callback)
				(data->Callback) (data->parent_win, NULL, NULL);
			
			bookMenuDestroy(data->win);
			stopRingerVolSettingInactivityTimer();
			
        	SEND_EVENT(idle_get_window(), IDLE_UPDATE, 0, &keycode);
        			
			dspl_Enable(uMode);
		}
			
	return MFW_EVENT_CONSUMED;
}






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

 $Function:    	bookMenuCreate

 $Description:	Create the menu window
 
 $Returns:		handle of newly created window, or NULL if error

 $Arguments:	parent, handle of the parent window
 
*******************************************************************************/

static T_MFW_HND bookMenuCreate( MfwHnd parent )
{
	T_MFW_WIN		*parent_win_data = ( (T_MFW_HDR *) parent )->data;
	T_phbk			*phbk = (T_phbk *)parent_win_data->user;
	T_MFW_WIN		*win_data;
	tBookStandard	*data;

	TRACE_FUNCTION( "bookMenuCreate()" );

	/* allocate memory for our control block
	*/
	if ( ( data = (tBookStandard *) ALLOC_MEMORY( sizeof( tBookStandard ) ) ) == NULL )
		return NULL;

	/* Create the window if we can
	*/
	if ( ( data->win = win_create( parent, 0, E_WIN_VISIBLE, (T_MFW_CB) bookMenuWindowCB ) ) == NULL )
	{
		FREE_MEMORY( (void *)data, sizeof( tBookStandard ) );
		return NULL;
	}

	/* Okay, we have created the control block and the window, so
	   we now need to configure the dialog and data pointers
	*/
    data->mmi_control.dialog	= (T_DIALOG_FUNC) bookMenuDialog;
    data->mmi_control.data		= data;
    win_data					= ((T_MFW_HDR *)data->win)->data;
 	win_data->user				= (void *) data;
	data->phbk					= phbk;
	data->parent_win			= parent;

	/* create keyboards and menus for our window
	*/
	data->kbd		= kbdCreate  ( data->win, KEY_ALL,            (MfwCb) bookMenuKbdCB );
    data->kbd_long	= kbdCreate  ( data->win, KEY_ALL | KEY_LONG, (MfwCb) bookMenuKbdLongCB );
    data->menu_tim  = tim_create (data->win, THREE_SECS,          (MfwCb) bookMenuTimCB);

	data->Callback = NULL;						// Use standard menu callback (changed by sending event ADD_CALLBACK)
	
	/* And return the handle of the newly created window
	*/
    return data->win;
}





/*******************************************************************************
                                                                              
                                Public Methods
                                                                              
*******************************************************************************/

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

 $Function:     bookMenuStart

 $Description:	tbd
 
 $Returns:		tbd

 $Arguments:	tbd
 
*******************************************************************************/

T_MFW_HND bookMenuStart( MfwHnd parent, MfwMnuAttr *menuAttr,SHORT reason )
{
	T_MFW_HND win;

	win = bookMenuCreate( parent );

    if ( win != NULL )
        SEND_EVENT( win, MENU_INIT, reason, (MfwMnuAttr *) menuAttr );
    return win;
}



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

 $Function:    	bookMenuDestroy

 $Description:	Destroy the menu window 
 
 $Returns:		none

 $Arguments:	window, handle of the window being destroyed
 
*******************************************************************************/

void bookMenuDestroy( MfwHnd window )
{
	T_MFW_WIN		*win_data	= ((T_MFW_HDR *)window)->data;
	tBookStandard	*data		= (tBookStandard *) win_data->user;
	char			test_string[40];

	TRACE_FUNCTION( "bookMenuDestroy()" );

	if (window == NULL)
	{
		TRACE_EVENT ("Error : Called with NULL Pointer");
		return;
	}

	if ( data )
	{

		/* If we have the root window here then we use the main phone
		   book destroy method
		*/
		if ( data->phbk->root_win == window )
		{
			bookPhonebookDestroy( data->phbk->win );
			return;
		}

		/* Otherwise clear down our pointers and free the current
		   menu window structures
		*/
		if ( data->phbk->search_win == window )
			data->phbk->search_win = 0;
		if ( data->phbk->menu_main_win == window )
			data->phbk->menu_main_win = 0;
		if ( data->phbk->menu_options_win == window )
			data->phbk->menu_options_win = 0;
		if ( data->phbk->menu_options_win_2 == window )
			data->phbk->menu_options_win_2 = 0;
		if ( data->phbk->menu_call_options_win == window )
			data->phbk->menu_call_options_win = 0;
		if ( data->phbk->menu_call_options_win_2 == window )
			data->phbk->menu_call_options_win_2 = 0;

		winDelete( data->win );
		FREE_MEMORY( (void *)data, sizeof( tBookStandard ) );
		sprintf(test_string, "Bookmenudestroy: %d", mfwCheckMemoryLeft());
		TRACE_EVENT(test_string);
	}

}






/*******************************************************************************
                                                                              
                                End of File
                                                                              
*******************************************************************************/

⌨️ 快捷键说明

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