📄 mfw_mnu.c
字号:
/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) $Workfile:: mfw_mnu.c $|
| $Author: jhxu $ CONDAT GmbH $Revision: 1.16 $|
| CREATED: 24.11.98 $Modtime:: 24.02.00 8:07 $|
| STATE : code |
+--------------------------------------------------------------------+
MODULE : MFW_MNU
PURPOSE : menu handling functions
EXPORT :
TO DO :
$History:: mfw_mnu.c $
****************************************************
*User:Ganchh Date:12.06.2002 Time 14:58
*Updated in MenuShow() add the dspl_Enable() function to make sure
*refresh display after the data updated completely.
*
* ***************** Version 18 *****************
* User: Kk Date: 28.02.00 Time: 10:33
* Updated in $/GSM/Condat/MS/SRC/MFW
* font usage corrected for page and list menus. free menus still
* need rework.
*
* ***************** Version 17 *****************
* User: Es Date: 17.01.00 Time: 17:37
* Updated in $/GSM/Condat/MS/SRC/MFW
* menu mode handling bug (uses only first level settings)
|
| ***************** Version 16 *****************
| User: Le Date: 6.01.00 Time: 9:23
| Updated in $/GSM/Condat/MS/SRC/MFW
| Alignment of MFW versions
*
* ***************** Version 2 *****************
* User: Es Date: 22.11.99 Time: 10:29
* Updated in $/GSM/Condat/SND-MMI/MFW
*
* ***************** Version 1 *****************
* User: Es Date: 18.11.99 Time: 16:35
* Created in $/GSM/Condat/SND-MMI/MFW
* Initial
*/
/****************************************************
history: mfw_mnu.c
21/06/02 zy
change:change the viewlistmenusetting for display the mainmenu
icons
****************************************************/
/****************************************************
history: mfw_mnu.c
27/06/02 zy
change:add the key action mnu:up,down line by line and left,right
****************************************************/
/**********************************************************
12/07/02 zy Mobile Innovation add static char * ListMenuTitleString;
static int ListMneuFlag;
static void SetTitleStr(char * ListMenuTitleStr);
static void SetListFlag(int flag);
mnuListCreate()
and change drawListMenu()
for add listmenu title
$End
****************************************************/
/****************************************************
history: mfw_mnu.c
22/07/02 zy
change:make the dynamic menu flag to zero if menuescape
****************************************************/
/****************************************************
history: mfw_mnu.c
04/08/02 zy change pagemenu
01/08/02 zy change:add drawlistIconMenu() and change flagFunc() return value
13/08/02 zy change mnupageup and mnupagedown and display right in ascall drawlisticonmenu
and drawlistmenu
03/09/02 zy change add dynamiclistmnuflg in mnuattr and mnudown
10/09/02 zy change base gch's listmenu,and menu data
11/04/03 talcon add function:DomnuPageDown,DomnuPageUp for main mnu pagedown and pageup
****************************************************/
#include <stdio.h>
#include <string.h>
#define ENTITY_MFW
#if defined (NEW_FRAME)
#include "typedefs.h"
#include "vsi.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_kbd.h"
#include "mfw_tim.h"
#include "gdi.h"
#include "dspl.h"
#include "mfw_lng.h"
#include "mfw_edt.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_ffs.h"
#include "mfw_win.h"
/*
#include "MmiResources.h" kk
*///JVJE
#include "aci_cmh.h"
//#include "mmirender.h"
//Mobile Innovation ganchh 2002/7/30
//#include "BmiEastAPI.h"
#include "..\bmi\mmisettings.h"//zy add 04/08/02
#include "..\bmi\Mmimain.h"//zy add 04/08/02
#include "..\bmi\Mmiicons.h"//zy add 04/08/02
#include "..\bmi\Mmi3dframe.h"
#include "..\bmi\mmiQQSwitch.h" //hxl add for check qq func
#include "..\bmi\mmicoordinate.h"/* 2004/01/13 sunsj */
//#include "rle.c"//2003/10/27,talcon add for decompressing
// 2004.4.9 wyj add
#include "..\bmi\mmisounds_defs.h"
#include "..\bmi\mmiiconresource.h"/* 2004/06 sunsj modify for icon manage */
#include "..\bmi\icons\mainmenuicn.h"//jhxu720
#include "..\bmi\icons\ListIcn.h"//jhxu720
//#define TDTRACE 1
#include "..\bmi\mmiutilapi.h"
#define mainmenu_timeout 350
#define listmnu_timeout 350
#define listmnu_PaoMa_Base 3
/*#include "rvf_api.h"
#include "r2d.h"*/
//2004.1.14 WYJ ADD
extern void StartPlayingMelody2( UBYTE melody_id, UBYTE count );
extern void StopPlayingMelody2(void);
static int menuIsEmpty (MfwMnu *m, MfwMnuAttr *ma);
static int countVisible (MfwMnu *m, MfwMnuAttr *ma, int start);
static void drawPageMenu (MfwMnu *mnu);
static void drawListMenu (MfwMnu *m);
static void drawFreeMenu (MfwMnu *m);
static void drawListIconMenu(MfwMnu *m);//zy add for list menu has icons each items
static int mnuCommand (U32 cmd, void *h);
static void drawViewListMenu (MfwMnu *mnu);
static int mainmenu_timer_cb(MfwEvt e, MfwTim *t);
/**************************************************/
void playMainMnuTone(U8 uIdx);
void stopMainMnuTone();
/* glowing : add 2003-10-29 */
char * GetMenuTitleString( MfwMnu *mnu, MfwMnuAttr *attr );
extern GLOBAL int get_StringWidth(char *string);
static MfwHnd mainmenutimer = NULL;
static MfwHnd menuTxtAnimtimer = NULL;
//extern T_R2D_GC_PTR r2d_g_lcd_gc;
/*.................................zy change for dynamic listmenu has title.......................................*/
//----------------ganchh 2002/9/6 menu browse action
static MfwMnuBrowseAction MenuBrowseAction=BrowseInit;
/* 2003/11/01,talcon add */
static MfwMnuAnim mfwmnuanim_t;
extern U16 mmiScrX, mmiScrY;
/*talcon 2003/10/31,talcon add */
U8 DomnuPageDown (MfwMnu *mnu);
U8 DomnuPageUp (MfwMnu *mnu);
/*2003//11/05,talcon add */
static void drawListMenuItem (MfwMnu *mnu,int nIdx,int nLines,int posY,char *szPlaceStr);
/*2003//11/08,talcon add */
void drawListMenuItem2(MfwMnu* mnu,int nIdx);
//void drawMnuIcnSel(MfwMnu* mnu);
//public
void drawAnimTimerIcn(MfwMnu* mnu,MfwHnd timer);
/*2003/11/10,talcon add */
static int listmenu_timer_cb(MfwEvt e, MfwTim *t);
extern U16 mmiScrX, mmiScrY;
/* 2004.1.30 WYJ add */
extern int gPlayKeytoneFlag;
extern const MfwIcnAttr currentbarIcon[2];
#if(MAIN_LCD_SIZE==3)
extern BOOL phonebook_search_flag;
#endif
/*................................end of zy change for listmenu has title.......................................*/
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_MNU |
| STATE : code ROUTINE : mnuInit |
+--------------------------------------------------------------------+
PURPOSE : initialize menu handler
*/
MfwRes mnuInit (void)
{
mfwCommand[MfwTypMnu] = (MfwCb) mnuCommand;
/*2003/11/10,talcon add */
memset(&mfwmnuanim_t,0,sizeof(mfwmnuanim_t) );
mfwmnuanim_t.nMainMnuIdx = 0xff;
return MfwResOk;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_MNU |
| STATE : code ROUTINE : mnuExit |
+--------------------------------------------------------------------+
PURPOSE : finalize menu handler
*/
MfwRes mnuExit (void)
{
mfwCommand[MfwTypMnu] = 0;
return MfwResOk;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_MNU |
| STATE : code ROUTINE : mnuCreate |
+--------------------------------------------------------------------+
PURPOSE : create menu control
GW 05/10/01 - Changed single value 'lng' to 2 values indicating if ID's should be
used (useStrID) and if the strings are ascii or unicode (uesDefLang).
*/
MfwHnd mnuCreate (MfwHnd w, MfwMnuAttr *a, MfwEvt e, MfwCb f)
{
MfwHdr *hdr = (MfwHdr *) mfwAlloc(sizeof(MfwHdr));
MfwMnu *mnu = (MfwMnu *) mfwAlloc(sizeof(MfwMnu));
if( !hdr || !mnu )
return 0;
mnu->mask = e;
mnu->flags = 0;
mnu->handler = f;
mnu->attr = a;
mnu->curAttr = a;
mnu->useStrID = 0;
mnu->useDefLang = 0;
mnu->level = 0;
mnu->listmnuflag=0;
memset(mnu->lCursor,UNUSED,sizeof(mnu->lCursor));
memset(mnu->lShift,1,sizeof(mnu->lShift));
mnu->lCursor[0] = 0;
// mnu->scrollMode = 1;
mnu->scrollMode = 0;
/*
if ((mnu->curAttr->mode & MNU_DISPLAY) == MNU_VIEWLIST)
{
mnu->ani_timer = timCreate ( w, mainmenu_timeout, (MfwCb)mainmenu_timer_cb);
//mnu->ani_timer = NULL;
mnu->iconIndex = 0;
//mnu->scrollMode = 1;
}
*/
#ifndef FOR_FTA_CTA
mainmenutimer = timCreate ( w, mainmenu_timeout, (MfwCb)mainmenu_timer_cb);
//menuTxtAnimtimer = timCreate ( w, 200, (MfwCb)menuTxtAnim_timer_cb);
//mnu->iconIndex = 0;
/*2003/11/11 ,talcon add */
if( mfwmnuanim_t.nDepListMnu++ == 0 )
{
mfwmnuanim_t.listmnulicontimer = timCreate ( w, 200, (MfwCb)listmenu_timer_cb);
}
#endif
mfwmnuanim_t.nMainMnuIdx = 0xff;
hdr->data = mnu;
hdr->type = MfwTypMnu;
MenuBrowseAction=BrowseNew; //ganchh 2002/9/13
return mfwInsert(w,hdr);
}
/*********************************************
$History
******2003/11/08,talcon modify
******2003/11/10,talcon modify
************************************************/
static int mainmenu_timer_cb(MfwEvt e, MfwTim *t)
{
MfwHnd win = mfwParent (mfwHeader());
MfwHdr *win_data = ( MfwHdr * )mfwHeader( );
MfwMnu *data = (MfwMnu *)win_data->data;
MfwWin * win1 = (MfwWin *) ((MfwHdr *)win)->data ;
MfwMnu *m=(MfwMnu *) ((MfwHdr *) win1 ->elems ) ->data;
U8 uMode;
timStop( mainmenutimer );
if( !winIsFocussed(win) )
{
return 0;
}
//
/* if ((m->curAttr->mode & MNU_DISPLAY) == MNU_OVERLAPPED )
{
drawAnimTimerIcn(m,mainmenutimer);
}
else*/if( (m->curAttr->mode & MNU_DISPLAY) == MNU_VIEWLIST )
{
winShow(win);
if( mfwmnuanim_t.MainMnuIcnAnimIdx == 0xff )
{
mfwmnuanim_t.MainMnuIcnAnimIdx = 0;
timStop( mainmenutimer );
}
}
// timStart(data->ani_timer);
// timStart( mainmenutimer );
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_MNU |
| STATE : code ROUTINE : mnuListCreate |
+--------------------------------------------------------------------+
PURPOSE : create list menu control//zy add for display listmenu has tittle and word
GW 05/10/01 - Changed single value 'lng' to 2 values indicating if ID's should be
used (useStrID) and if the strings are ascii or unicode (uesDefLang).
*/
MfwHnd mnuListCreate (MfwHnd w, MfwMnuAttr *a, MfwEvt e, MfwCb f, char * ListMenuTitleStr)
{
MfwHdr *hdr = (MfwHdr *) mfwAlloc(sizeof(MfwHdr));
MfwMnu *mnu = (MfwMnu *) mfwAlloc(sizeof(MfwMnu));
if( !hdr || !mnu )
return 0;
mnu->mask = e;
mnu->flags = 0;
mnu->handler = f;
mnu->attr = a;
mnu->curAttr = a;
mnu->useStrID = 0;
mnu->useDefLang = 0;
mnu->level = 0;
mnu->listmnuflag=1;
mnu->titlestr=ListMenuTitleStr;// zy add 0918
// mnu->curAttr->items[mnu->lCursor[99]].str=ListMenuTitleStr;
memset(mnu->lCursor,UNUSED,sizeof(mnu->lCursor));
memset(mnu->lShift,1,sizeof(mnu->lShift));
mnu->lCursor[0] = 0;
// mnu->scrollMode = 1;
mnu->scrollMode = 0; //ganchh 2002/9/13
hdr->data = mnu;
hdr->type = MfwTypMnu;
MenuBrowseAction=BrowseNew; //ganchh 2002/9/13
/*2003/11/10 ,talcon add */
#ifndef FOR_FTA_CTA
if( mfwmnuanim_t.nDepListMnu++ == 0 )
{
mfwmnuanim_t.listmnulicontimer = timCreate ( w, 200, (MfwCb)listmenu_timer_cb);
}
#endif
return mfwInsert(w,hdr);
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_MNU |
| STATE : code ROUTINE : mnuDelete |
+--------------------------------------------------------------------+
PURPOSE : delete menu control
*/
MfwRes mnuDelete (MfwHnd m)
{
MfwRes res;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -