📄 guicallback.c
字号:
/***************************************************************************
*
* Pollex Mobile Platform
*
* Copyright (c) 2004 by Pollex Mobile Software Co., Ltd.
* All Rights Reserved
*
* Module : in browser, callback functions for gui
*
* Purpose :
*
\**************************************************************************/
#include "wgui_categories_inputs.h"
#include "PWBE.h"
#include "MMI_features.h"
#include "kal_non_specific_general_types.h" /* include this for kal data type */
#if defined(MMI_ON_HARDWARE_P)
#include "kal_release.h"
#endif
#include "lcd_if.h"
#include "lcd_sw_rnd.h"
#include "gdi_include.h"
#include "gui.h"
//#include "Conversions.h"
#include "CommonScreens.h"
#include "settingProfile.h"
#include "settingProt.h"
#include "AudioInc.h"
#include "aud_defs.h"
#include "FileMgr.h" // for FMGR_MAX_INPUT_FILE_LEN
#include "../Main/PlxDefs.h"
#include "plxBrowPublic.h"
#include "plxBrowDefs.h"
#include "plxbrow.h"
#include "guicallback.h"
#include "PlxBrowPush.h"
#include "../public/PlxPublic.h"
#include "plxBrowHistory.h"
#include "plxBrowSetting.h"
/********************/
/*
typedef struct tag_PWB_PEN{
enum WB_PENSTYLE penStyle;
unsigned long color;
}PWBPEN;
typedef struct tag_PWB_BRUSH{
enum WB_PENSTYLE bushStyle;
unsigned long color;
}PWBBRUSH;
*/
#define PWBCB_EDIT_TEXT_BUFFER_SIZE (1024 + 2)
typedef struct tag_PWB_EditTxt{
long bufSize;
ECHO_FINISHEDITTEXT pFinishProc;
char *pBuf;
char *pUtf8;
S16 inputFormat;
long utf8Size;
int nCharMaxNum;
}PWBEDITTXT;
typedef struct tag_PWB_NotifyInfo{
BOOL IsHangUpEnable;
BOOL IsStopEnable;
BOOL IsPageSaveEnable;
BOOL IsImageSaveEnable;
BOOL IsBGSoundSaveEnable;
BOOL IsPrevPageEnable;
BOOL IsNextPageEnable;
BOOL IsCurrFocusLink;
unsigned int nEngineState;
}PWBENotifyInfo, *PPWBENotifyInfo;
static PWBENotifyInfo g_plxBrowNotifyInfo = {0};
//static PWBPEN curPWBPen = {WBPS_SOLID, 0}; //remember current pen
//static PWBBRUSH curPWBBrush = {WBPS_SOLID, 0}; //remember current brush
static PWBEDITTXT pwbEditText = {0};
static WB_SELTYPE bSelType;
static PU8 *pSelItems;
static int nItemsInSel;
static U8 *pSelItemStat;
static S32 markLastSel;
static WB_OPTIONDATA *pSelOptionData;
static ECHO_FINISHSELECT pFuncFinishSel;
extern BROWINFO plxBrowInfo;
////////////////////////////////////////////////
#ifdef __PLXBROW_FONT_SUPPORT_
typedef struct TextStyleInfo_{
stFontAttribute stFont;
color clColor;
//stFontAttribute stSavedSetFont; //last set font
//color clSavedSetColor; //last set color
}TEXTSTYLEINFO, *PTEXTSTYLEINFO;
static TEXTSTYLEINFO TextStyleInfo = {0};
// --MTK对27号的大字体显示规则是:
//数字和个别字符如 p w + 等能按27号显示,
//其他字符过滤掉不显示,
//文字按当前默认大小显示--16或14号
#define GUICB_LARGE_FONT_SIZE_UP_LIMIT 50//24
#define GUICB_MEDIUM_FONT_SIZE_UP_LIMIT 16
#define GUICB_MEDIUM_FONT_SIZE_LOW_LIMIT 10
extern stFontAttribute wgui_dialer_box_f1;
extern color UI_current_text_color;
#else
static WB_FONT curFont = {0};
static unsigned long curColor = 0;
#endif //__PLXBROW_FONT_SUPPORT_
static BOOL bInWaitingEchoCB = FALSE;
//static BOOL bIsExteriorKeyEndPressed = FALSE;
//ring callback
typedef struct tag_AudioPlayFlag
{
BOOL bPlayWav;
BOOL bPlayMIDI;
BOOL bPlayOther;
}AUDIOPLAYFLAG;
static AUDIOPLAYFLAG apf = {0};
/// permit callback
typedef struct tagPermitInfo_{
void* pParam;
char* strInfo;
char* strOk;
char* strCancel;
ECHO_FINISHPERMITPROC pFuncCB;
}PERMITINFO ,*PPERMITINFO;
static PERMITINFO PermitInfo = { 0 };
static void DestroyPermitInfo(void);
void PermitConfirmCB(PLIBEVENT event);
//Prompt callback
#define PWBCB_PROMPT_EDIT_BUFFER_SIZE 450 //mtk max buffer size in fullscreen edit mode
typedef struct tagPromptInfo_{
void * pParam;
char* pWideTitle;
char* pWideDefResult;
//char* pWideInput;
char szInputBuffer[PWBCB_PROMPT_EDIT_BUFFER_SIZE];
ECHO_FINISHPROMPTPROC pFuncCB;
} PROMPTINFO, *PPROMPTINFO;
static PROMPTINFO PromptBoxInfo = { 0 };
static unsigned short nCurrPropmtHiliteItem = 0;
static void DestroyPromptBoxInfo(void);
static void EntryPWBCBPromptScreen(void);
static void ExitPWBCBPromptScreen(void);
static void PropmtFullScreenEdit(void);
static void FillPromptInlineItemInfo(void);
static void PromptHiliteHandler(S32 item_index);
static void PromptLskFunc(void);
static void PromptRskFunc(void);
static void PromptRskConfirmCB(PLIBEVENT event);
//GetAuth callback
typedef struct tagGetAuthInfo_{
void* pParam;
char* pRealm;
char* pRoot;
int Type;
char* pUser;
char* pPwd;
int nMaxAuthLen;
int nMaxPwdLen;
int nInlineItems;
ECHO_FINISHAUTHINPUTPROC pFuncCB;
} AUTHBOXINFO, *PAUTHBOXINFO;
static AUTHBOXINFO AuthBoxInfo = { 0 };
static unsigned short nCurrGetAuthHiliteItem = 0;
static void DestroyAuthBoxInfo(void);
static void EntryPWBCBGetAuthScreen(void);
static void ExitPWBCBGetAuthScreen(void);
static void FillGetAuthInlineItemInfo(void);
static void GetAuthHiliteHandler(S32 item_index);
static void GetAuthLskConfirm(void);
static void GetAuthConfirmCB(PLIBEVENT event);
static void GetAuthLskFunc(void);
static void GetAuthRskFunc(void);
//make call
typedef struct MakeCallInfo_{
void *pParam;
int nNumLen;
char *pWideNum;
ECHO_PROCESSOVER pFuncCB;
}MAKECALLINFO ,*PMAKECALLINFO;
static MAKECALLINFO MakeCallInfo = { 0 };
static void DestroyMakeCallInfo(void);
//static void ExitMakeCallConfirmScreen(void);
static void MakeCallEventCB(PLIBCALLEVENT event);
static void DoMakeCall(void);
//static void MakeCallConfirmCB(PLIBEVENT event);
//save download data
static void SaveDownloadDataCB(PLIBEVENT event);
// add phone book
typedef struct AddPoneBookInfo_{
void * pParam;
char *pWideNum;
int nNumLen;
char *pWideName;
int nNameLen;
ECHO_PROCESSOVER pFuncCB;
} ADDPHONEBOOKINFO, *PADDPHONEBOOKINFO;
static ADDPHONEBOOKINFO AddPhoneBookInfo = { 0 };
static void DestroyAddPhoneBookInfo(void);
//static void ExitAddPhoneBookComfirm(void);
static void DoAddOneNewPhoneBook(void);
//static void AddPhoneBookConfirmCB(PLIBEVENT event);
//////////////////////////////////////////
static void FillPolygon(const WB_POINT *lpPoints, int nCount, unsigned long color);
static void EnterEditTextScreen(void);
static void EnterEditTextOK (void);
static void DestroyEditTextInfo(void);
static void EditTextOK(void);
static void EditTextCancel(void);
static void QuaereUserJump(void);
static void UserJumpConfirmCB(PLIBEVENT event );
//static void UnitPaintRect(long x1, long y1, long x2, long y2, WB_RECT *pRc);
//static int PointInRect(long x, long y, WB_RECT *pRc);
static void MulSelCheckItem(void);
static S16 ParseInputFormat(const char *inputFormat);
#define PLXBROW_WEBPAGE_TITLE_MAX_LEN 128
char pWebPageTitle[PLXBROW_WEBPAGE_TITLE_MAX_LEN] = {0};
void PWBEnterSelectScreen(void);
void PWBCancelSelectScreen(void);
void PWBSelHighlightHandler(S32 nSel);
void PWBSelDone(void);
void PWBSelFree(void);
void PWBDrawStatusBar(WB_RECT *prcBar, U16 strInfoID);
//key end hander
void GuiCallbackKeyEndHander(void);
static void GuiCallbackKeyEndhanderFunc(void);
static void GuiCallbackKeyEndOK(void);
//static void GuiCBKeyEndExitConfirmCB(PLIBEVENT event);
void GUICBExteriorKeyEndHandler(void);
void DeInitPlxBrowGuiCBData(void);
extern void SetActiveScreenId (U16 scrnId);
extern void PAPP_OpenWapPage(char * szUtf8Url);
#ifdef __PLXBROW_DEBUG_
extern void PlxTrace(const char* fmt, ...);
extern void WAP_DataOut(const unsigned char * pData, unsigned short Length, const unsigned char * pName);
#endif
#define PLXBROW_GETCOLOR(color) \
((COLOR_INVALID == (color)) ? \
GDI_RGB_TO_BUFFER_FORMAT(TextStyleInfo.clColor.r, TextStyleInfo.clColor.g,TextStyleInfo.clColor.b) \
: GDI_RGB_TO_BUFFER_FORMAT(GETRVALUE(color), GETGVALUE(color), GETBVALUE(color)))
/* Define struct for rect */
typedef struct tagCLIPLINERECT
{
int x1;
int y1;
int x2;
int y2;
}CLIPLINERECT, *PCLIPLINERECT;
/* Define struct for line drawing */
typedef struct LineData
{
int x1; /* start x */
int y1; /* start y */
int x2; /* end x */
int y2; /* end y */
} LINEDATA, *PLINEDATA;
typedef struct
{
int type; /* control variable */
int start_x; /* start point of X */
int start_y; /* start point of Y */
int end_x; /* end value of X */
int end_y; /* end value of Y */
int dir; /* direction of Y or X */
int delta; /* delta value */
int step; /* step value */
int remain; /* remainder */
int cliped; /* the points have been cliped of the origin line */
} LINEDRAW;
#define LINE_NONE 0 //No line to be drawn
#define LINE_HORIZONTAL 1 //Horizontal line
#define LINE_VERTICAL 2 //Vertical line
#define LINE_CTRLX 3 //control variable is X
#define LINE_CTRLY 4 //control variable is Y
#define EXCHANGE(a,b) \
do{ \
int temp; \
temp = a; \
a = b; \
b = temp; \
}while(0)
#ifndef MAX
#define MAX(a,b) ((a)>(b))? (a):(b)
#endif
#ifndef MIN
#define MIN(a,b) ((a)<(b))? (a):(b)
#endif
#define ABS(val) ((val) > 0 ? (val) : (-(val)))
#define DIV_CEILING(a, b) (((a) * 2 + (b)) / ((b) * 2))
typedef enum{
NORM_DIR,
REVR_DIR,
};
/*********************************************************************\
* Function ClipLine
* Purpose : Clip line and get LINEDRAW struct, in LINEDRAW struct, the
* start_x and end_x have not been exchanged. It's different
* with the old version.
* 06/20/2002
* Params
pLineData Pointer to the origin line data.
pClipRect Pointer to the clip rect.
pLineDraw Pointer to the cliped line data.
* Return
LINE_NONE 0 No line to be drawn
LINE_HORIZONTAL 1 Horizontal line
LINE_VERTICAL 2 Vertical line
LINE_CTRLX 3 control variable is X
LINE_CTRLY 4 control variable is Y
* Remarks
**********************************************************************/
static int ClipLine(PLINEDATA pLineData, PCLIPLINERECT pClipRect,
LINEDRAW* pLineDraw)
{
int x1, x2, y1, y2;
int tx1, tx2, ty1, ty2; /* The clip result of slope line */
int dx, dy, twodx, twody; /* Used to calculate the clip result */
int reverse = 0; /* Flag the coordinates exchanged */
x1 = pLineData->x1;
x2 = pLineData->x2;
y1 = pLineData->y1;
y2 = pLineData->y2;
/* Horizontal line */
if (y1 == y2)
{
/* Out of clip rectangle */
if (y1 < pClipRect->y1 || y1 >= pClipRect->y2)
return LINE_NONE;
if (x1 < x2)
x2--;
else
{
x2++;
EXCHANGE(x1, x2);
reverse = 1;
}
x1 = MAX(x1, pClipRect->x1);
x2 = MIN(x2, pClipRect->x2 - 1);
if (x1 > x2)
return LINE_NONE;
/* The LINEDRAW struct store the line that has been cliped with the
** origin direction. And the cliped data item is used to store the
** number of cliped points from the start point.
** So the DrawLine function can get all information of the origin
** line and can draw the part of line as same as the origin part.
*/
if (reverse)
{
pLineDraw->start_x = x2;
pLineDraw->start_y = y1;
pLineDraw->end_x = x1;
pLineDraw->end_y = y2;
pLineDraw->cliped = pLineData->x1 - x2;
}
else
{
pLineDraw->start_x = x1;
pLineDraw->start_y = y1;
pLineDraw->end_x = x2;
pLineDraw->end_y = y2;
pLineDraw->cliped = x1 - pLineData->x1;
}
pLineData->x1 = x1;
pLineData->y1 = y1;
pLineData->x2 = x2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -