📄 mfw_win.c
字号:
+--------------------------------------------------------------------+
PURPOSE :yq add for focus and show the window (for testing purposes only)
*/
MfwRes winFocusShow (MfwHnd w)
{
MfwCb f;
MfwHdr *e, *t, *r;
MfwRes res;
MfwWin *win;
U8 uMode;
/*NM, p012a*/
/* U8 uMode;
p012a end*/
TRACE_FUNCTION("win_delete()");
if (!w)
return MfwResIllHnd;
if (((MfwHdr *) w)->type != MfwTypWin)
return MfwResIllHnd; /* element is not a window */
e = ((MfwHdr *) w)->data;
if (!e)
return MfwResErr;
e = ((MfwWin *) e)->elems;
if (!e)
return MfwResErr;
r=e;
// zgzTraceDataFunc("win->element:",(unsigned short)e);
while (e && e->type != MfwTypMax) /* try to delete all elems */
{
t = e->next;
if (e->data)
{
if (mfwSignallingMethod != 0 && e->type == MfwTypWin)
{
mfwRemove(e); /* move up child window */
yq_free(e);
}
}
e = t;
}
freeAll();
winFocus (w);
winShow(w);
mfwFocus = r;
return MfwResOk;
}
/********************zy use zym fuction add for trace int data*************************/
void TraceInt(int i){
char buf[40];
sprintf (buf, "data: %d",i);
TRACE_EVENT(buf);
}
/******************end of zy change*********************************************/
MfwHdr* getHdr( MfwHnd win)
{
return((MfwHdr *) win);
}
MfwWin* getWinData( MfwHnd win)
{
// T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
MfwHdr* winHdr;
winHdr = getHdr(win);
return (winHdr->data);
}
/* glowing,2004-06-10, comment it, for it was not referenced by other code */
#if 0
/* Marcus: Issue 1245: 10/10/2002
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_WIN |
| STATE : code ROUTINE : winObscured |
+--------------------------------------------------------------------+
PURPOSE : check if window is obscured
*/
int winObscured(MfwWin *win)
{
MfwHdr *elems;
int obscured = FALSE;
if (win && (mfwSignallingMethod == 1))
{
elems = win->elems;
while ((obscured == FALSE) && elems && (elems->type > MfwTypNone) && (elems->type < MfwTypMax))
{
/* We have a further overlay window */
if (elems->type == MfwTypWin)
{
obscured = TRUE;
}
else
{
elems = elems->next;
}
}
}
return obscured;
}
#endif
/* glowing,2004-06-10, import from TCS2112 */
#define TWH_MAX_STR_LEN 90
#define TWH_MAX_SINGLE_SIZE 21 // This is the length of the Level, Address, Type and Callback in hex plus a zero terminator
static unsigned char trc_lvl;
static char mfw_twh_str[TWH_MAX_STR_LEN];
static unsigned int mfw_twh_strlen;
static void mfw_twhNext(MfwHdr *next);
static char *mfw_twhType(MfwTyp type);
static void mfw_twhOut(void *ptr, MfwTyp typ);
static void mfw_twhCb(void *ptr);
static void mfw_twh_str_purge(void);
#include <string.h>
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : MFW_WIN |
| STATE : code ROUTINE : mfw_traceWinHdrs |
+--------------------------------------------------------------------+
PURPOSE : This function will trace out the entire window tree.
: EXTREME care should be taken using this function as it will cause a
: massive overhead on the CPU and processing WILL be affected!!!!
*/
void mfw_traceWinHdrs(void)
{
TRACE_FUNCTION(">>>>> mfw_traceWinHdrs");
trc_lvl = 0;
TRACE_EVENT("mfwRoot");
if (mfwRoot)
mfw_twhNext(mfwRoot);
/*
** Trace out the last remaining line (there will always be one)
*/
mfw_twh_str_purge();
TRACE_FUNCTION("<<<<< mfw_traceWinHdrs");
return;
}
static void mfw_twhNext(MfwHdr *next)
{
while (next)
{
if (next->type != MfwTypMax)
{
/*
** Trace out this address, and its Type
*/
mfw_twhOut(next, next->type);
/*
** If this type is a Window, then it may have sub-elements
** Trace them out before continuing the tree on this level
*/
if (next->type == MfwTypWin)
{
MfwWin *win_ptr = (MfwWin *)next->data;
if (win_ptr)
{
MfwHdr *win_elems = win_ptr->elems;
/*
** Add the Callback Address before doing the sub-elements
*/
mfw_twhCb((void *)win_ptr->handler);
trc_lvl++;
mfw_twhNext(win_elems);
trc_lvl--;
}
}
if (next->next == NULL)
{
mfw_twhOut(0, 0);
}
next = next->next;
}
else
{
/*
** Trace out this address, and its Type
*/
mfw_twhOut(next, next->type);
next = NULL;
}
}
return;
}
static char *mfw_twhType(MfwTyp type)
{
switch (type)
{
case MfwTypNone: /* no element (first !!) */
return("MfwTypNone");
break;
case MfwTypWin: /* window */
return("MfwTypWin");
break;
case MfwTypEdt: /* editor */
return("MfwTypEdt");
break;
case MfwTypMnu: /* menu handler */
return("MfwTypMnu");
break;
case MfwTypIcn: /* icon handler */
return("MfwTypIcn");
break;
case MfwTypKbd: /* keyboard */
return("MfwTypKbd");
break;
case MfwTypTim: /* timer */
return("MfwTypTim");
break;
case MfwTypMme: /* misc. mobile equipment */
return("MfwTypMme");
break;
case MfwTypVmm: /* MDL virtual machine */
return("MfwTypVmm");
break;
case MfwTypNm: /* network */
return("MfwTypNm");
break;
case MfwTypSim: /* SIM card */
return("MfwTypSim");
break;
case MfwTypCm: /* call handling */
return("MfwTypCm");
break;
case MfwTypPhb: /* phonebook handling */
return("MfwTypPhb");
break;
case MfwTypSms: /* short message handling */
return("MfwTypSms");
break;
case MfwTypSs: /* supl. services handling */
return("MfwTypSs");
break;
case MfwTypSat: /* SIM Toolkit handling */
return("MfwTypSat");
break;
case MfwTypLng: /* language handling */
return("MfwTypLng");
break;
case MfwTypInp: /* input handling */
return("MfwTypInp");
break;
case MfwTypNode: /* node element */
return("MfwTypNode");
break;
case MfwTypCphs: /* CPHS element */
return("MfwTypCphs");
break;
case MfwTypGprs: /* GPRS handling */
return("MfwTypGprs");
break;
case MfwTypEm: /*MC, SPR 1209 Eng Mode handling*/
return("MfwTypEm");
break;
#ifdef BT_INTERFACE
case MfwTypBt: /* bluetooth handling */
return("MfwTypBt");
break;
#endif
case MfwTypMax: /* end of types (last !!) */
return("MfwTypMax");
break;
default:
return("Not Known");
}
}
static void mfw_twhOut(void *ptr, MfwTyp typ)
{
unsigned char i;
char fmt_str[30];
memset(fmt_str, 0, 30);
#if 0
/* The code here will output the information in hex format which will need
** more decoding, but which may be necessary if the amount of information
** being output causes problems in the BMI. Change the above #if to be '#if 1'
** to use this format
*/
sprintf(fmt_str,"%02x%08lx%02x", trc_lvl, ptr, typ);
/*
** Determine whether a new string is required
*/
if (mfw_twh_strlen > (TWH_MAX_STR_LEN - TWH_MAX_SINGLE_SIZE))
{
/*
** Need to output the previous trace and start a new line
*/
mfw_twh_str_purge();
}
strcat(mfw_twh_str, fmt_str);
mfw_twh_strlen += 12;
#else
memset(mfw_twh_str, 0, TWH_MAX_STR_LEN);
for (i=0; i<trc_lvl; i++)
{
strcat(mfw_twh_str, " ");
}
strcat(mfw_twh_str, "-> ");
sprintf(fmt_str,"N:%08lx T:%s", ptr, mfw_twhType(typ));
strcat(mfw_twh_str, fmt_str);
if (typ != MfwTypWin)
{
/*
** Trace out the details - There will be no callback
*/
TRACE_EVENT(mfw_twh_str);
}
#endif
return;
}
static void mfw_twhCb(void *ptr)
{
char fmt_str[20];
memset(fmt_str, 0, 20);
#if 0
/* The code here will output the information in hex format which will need
** more decoding, but which may be necessary if the amount of information
** being output causes problems in the BMI. Change the above #if to be '#if 1'
** to use this format
*/
/*
** No Need to test whether there is enough space for the callback ...already checked in mfw_twhOut()
*/
sprintf(fmt_str,"%08lx", ptr);
strcat(mfw_twh_str, fmt_str);
mfw_twh_strlen += 8;
#else
/*
** No Need to test whether there is enough space for the callback ...already checked in mfw_twhOut()
*/
sprintf(fmt_str," Cb:%08lx", ptr);
strcat(mfw_twh_str, fmt_str);
TRACE_EVENT(mfw_twh_str);
#endif
return;
}
static void mfw_twh_str_purge(void)
{
#if 0
/* The code here is needed when using the hex format output which will need
** more decoding, but which may be necessary if the amount of information
** being output causes problems in the BMI. Change the above #if to be '#if 1'
** to use this format
*/
TRACE_EVENT(mfw_twh_str);
memset(mfw_twh_str, 0, TWH_MAX_STR_LEN);
mfw_twh_strlen = 0;
vsi_t_sleep(VSI_CALLER 10);
#endif
return;
}
/* glowing,2004-06-10, end of import */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -