📄 plxbrowbookmark.c
字号:
* Function void plxBrowSetBMEditInlineItems(void)
* Purpose init the inline items of bookmark edit screen
* Params
* Return
* Remarks
\****************************************************************************/
void plxBrowSetBMEditInlineItems(void)
{
const char *pszUtf8Url;
int nUtf8UrlLen;
if(FALSE == g_bSelBooMarkChanged)
{
// if(0 == pfnUnicodeStrcmp((const S8 *)g_plxBrowBooKMarks[g_curHiliteBookMarkID].szBMName,(const S8*)get_string(STR_ID_PLX_BROW_BOOKMARK_DEFAULT_BMNAME)))
// pfnUnicodeStrcpy((S8*)g_szPlxBrowBMEditInputName,"");
// else
pfnUnicodeStrcpy((S8*)g_szPlxBrowBMEditInputName,(const S8*)g_plxBrowBooKMarks[g_curHiliteBookMarkID].szBMName);
if(NULL != g_plxBrowBooKMarks[g_curHiliteBookMarkID].szBMUrl)
pfnUnicodeStrcpy((S8*)g_szPlxBrowBMEditInputURL,g_plxBrowBooKMarks[g_curHiliteBookMarkID].szBMUrl);
else
{
pszUtf8Url = PWBE_GetCurURLName( PlxBrowGetBrowserHandle());
if(NULL != pszUtf8Url)
{
nUtf8UrlLen = strlen(pszUtf8Url);
PlxUTF82UCS2(g_szPlxBrowBMEditInputURL,(char*)pszUtf8Url,nUtf8UrlLen, PLXBROW_URL_NAME_LEN*2);
}
else
// memset(g_szPlxBrowBMEditInputURL,0x0,PLXBROW_URL_NAME_LEN*2);
AnsiiToUnicodeString((S8*)g_szPlxBrowBMEditInputURL,(S8*)"http://");
}
}
SetInlineItemCaption(&(wgui_inline_items[PLXBROW_BOOKMARK_EDIT_NAMELABEL]),(U8*)get_string(STR_ID_PLX_BROW_BOOKMARK_BMNAME));
SetInlineItemActivation(&(wgui_inline_items[PLXBROW_BOOKMARK_EDIT_NAMEINPUT]),INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT,0);
SetInlineItemDisplayOnly(&(wgui_inline_items[PLXBROW_BOOKMARK_EDIT_NAMEINPUT]), (U8*) g_szPlxBrowBMEditInputName); //use Unicode
SetInlineItemCaption(&(wgui_inline_items[PLXBROW_BOOKMARK_EDIT_URLLABEL]),(U8*)get_string(STR_ID_PLX_BROW_BOOKMARK_BMURL));
SetInlineItemActivation(&(wgui_inline_items[PLXBROW_BOOKMARK_EDIT_URLINPUT]),INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT,0);
SetInlineItemDisplayOnly(&(wgui_inline_items[PLXBROW_BOOKMARK_EDIT_URLINPUT]), (U8*)g_szPlxBrowBMEditInputURL);//use Unicode
}
/****************************************************************************
* Function static void plxBrowBMEditHiliteInlineItem(S32 index)
* Purpose the handle of hilite inline item of bookmark edit
* Params
* Return
* Remarks
\****************************************************************************/
static void plxBrowBMEditHiliteInlineItem(S32 index)
{
g_curHiliteBMEditInputID = index;
//for adding to bookmark
/* if(TRUE == g_bIsAddBookMark)
{ ChangeLeftSoftkey(STR_ID_PLX_BROW_OPTION,IMG_GLOBAL_OK);
SetLeftSoftkeyFunction(EntryPlxBrowBookMarkEditMenu,KEY_EVENT_UP);
}
else
*/ {
ChangeLeftSoftkey(STR_GLOBAL_EDIT,IMG_GLOBAL_OK);
SetLeftSoftkeyFunction(EntryOfBMEditInput,KEY_EVENT_UP);
if(TRUE == g_bSelBooMarkChanged)
ChangeRightSoftkey(STR_GLOBAL_DONE,IMG_GLOBAL_BACK) ;
SetRightSoftkeyFunction(plxBrowBookMarkEditRskFunc,KEY_EVENT_UP);
}
}
/****************************************************************************
* Function static void ExitPlxBrowBookMarkEditScreen(void)
* Purpose exit the bookmark edit screen
* Params
* Return
* Remarks
\****************************************************************************/
static void ExitPlxBrowBookMarkEditScreen(void)
{
history ScrDA; /* Variable to hold the history data*/
S16 nHistory=0;
U16 size;
CloseCategory57Screen();
ScrDA.scrnID = SCR_ID_PLX_BROW_BOOKMARK_EDIT;
ScrDA.entryFuncPtr = EntryPlxBrowBookMarkEditScreen;
pfnUnicodeStrcpy((S8*)ScrDA.inputBuffer,(S8*)&nHistory);
GetCategoryHistory(ScrDA.guiBuffer);
size = (U16)GetCategory57DataSize();
GetCategory57Data ((U8*)ScrDA.inputBuffer );
AddNHistory(ScrDA,size);
}
/****************************************************************************
* Function static void plxBrowBookMarkEditLskFunc(void)
* Purpose the right soft key handle of bookmark edit screen
* Params
* Return
* Remarks
\****************************************************************************/
static void plxBrowBookMarkEditLskFunc(void)
{
CloseCategory57Screen();
plxBrowLazySaveBookMarkEdited();
}
/****************************************************************************
* Function static void plxBrowBookMarkEditRskFunc(void)
* Purpose the right soft key handle of bookmark edit screen
* Params
* Return
* Remarks
\****************************************************************************/
static void plxBrowBookMarkEditRskFunc(void)
{
int nToneId = WARNING_TONE;
CloseCategory57Screen();
//for adding to bookmark
/* if(TRUE == g_bIsAddBookMark)
{
DeInitPlxBrowBookMark();
GoBackHistory();
}
else
*/ {
// ExitPlxBrowBookMarkEditScreen();
if(FALSE == g_bSelBooMarkChanged)
{
if(g_SavedCurHiliteBMID != -1)//restore the saved focus
{
g_curHiliteBookMarkID = g_SavedCurHiliteBMID;
g_SavedCurHiliteBMID = -1;
}
GoBack2TheHistory();
}
else
{
PLIB_ConfirmBox(NULL, (const WCHAR *)get_string(STR_ID_PLX_BROW_SAVE_SAVEORNOT_CONFIRM), NULL,NULL,NULL, 0, (void *)&nToneId,0 , BMSaveComfirmCB);
SetKeyHandler(BookMarkKeyEndHandler,KEY_END,KEY_EVENT_DOWN);
}
}
}
/****************************************************************************
* Function static void BMSaveComfirmCB(PLIBEVENT event)
* Purpose
* Params
* Return
* Remarks
\****************************************************************************/
static void BMSaveComfirmCB(PLIBEVENT event)
{
if(PEVENT_POSITIVE == event)
{
g_SavedCurHiliteBMID = -1; //no use the saved focus
GoBackHistory();
plxBrowLazySaveBookMarkEdited();
}
else if(PEVENT_NEGTIVE == event)
{
g_bSelBooMarkChanged = FALSE;
if(g_SavedCurHiliteBMID != -1)//restore the saved focus
{
g_curHiliteBookMarkID = g_SavedCurHiliteBMID;
g_SavedCurHiliteBMID = -1;
}
GoBackToHistory(SCR_ID_PLX_BROW_BOOKMARK);
}
}
/****************************************************************************
* Function EntryOfBMEditInput
* Purpose
* Params
* Return
* Remarks
\****************************************************************************/
static void EntryOfBMEditInput(void)
{
if(g_curHiliteBMEditInputID ==PLXBROW_BOOKMARK_EDIT_NAMEINPUT)
{
pfnUnicodeStrcpy((S8*)g_szTempInputName, (const S8*)g_szPlxBrowBMEditInputName);
}
else if(g_curHiliteBMEditInputID ==PLXBROW_BOOKMARK_EDIT_URLINPUT)
{
pfnUnicodeStrcpy((S8*)jumpToBuffer, (const S8*)g_szPlxBrowBMEditInputURL);
}
EntryPlxBrowBMEditInputScreen();
}
/****************************************************************************
* Function static void EntryPlxBrowBMEditInputScreen(void)
* Purpose entry the bookmark edit input screen
* Params
* Return
* Remarks
\****************************************************************************/
static void EntryPlxBrowBMEditInputScreen(void)
{
U8* guiBuffer;
S16 nInputType;
EntryNewScreen(SCR_ID_PLX_BROW_BOOKMARK_EDIT_INPUT, NULL, EntryPlxBrowBMEditInputScreen, NULL);
SetParentHandler(0);
guiBuffer = GetCurrGuiBuffer(SCR_ID_PLX_BROW_BOOKMARK_EDIT_INPUT);
if(g_curHiliteBMEditInputID ==PLXBROW_BOOKMARK_EDIT_NAMEINPUT)
{
ShowCategory5Screen(STR_ID_PLX_BROW_BOOKMARK_BMNAME,IMG_ID_PLX_BROW_BOOKMARK,
STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
INPUT_TYPE_ALPHANUMERIC_LOWERCASE,
(U8*)g_szTempInputName,
PLXBROW_BMNAME_MAX_LEN , guiBuffer);
}
else if(g_curHiliteBMEditInputID ==PLXBROW_BOOKMARK_EDIT_URLINPUT)
{
#ifndef _PLXBROW_INPUT_TYPE_
nInputType = INPUT_TYPE_ALPHANUMERIC_LOWERCASE|INPUT_TYPE_OVERRIDE_DEFAULT|INPUT_TYPE_USE_ONLY_ENGLISH_MODES;
#else
nInputType = INPUT_TYPE_ALPHANUMERIC_LOWERCASE|INPUT_TYPE_OVERRIDE_DEFAULT;
#endif //_PLXBROW_INPUT_TYPE_
ShowCategory5Screen(STR_ID_PLX_BROW_BOOKMARK_BMURL,IMG_ID_PLX_BROW_BOOKMARK,
STR_GLOBAL_OPTIONS, IMG_GLOBAL_OPTIONS,
STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
nInputType,
(U8*)jumpToBuffer,
PLXBROW_URL_NAME_LEN, guiBuffer);
}
SetLeftSoftkeyFunction(EnterBMEditInputOK,KEY_EVENT_UP);
SetCategory5RightSoftkeyFunction(plxBrowBMEditInputRskFunc,KEY_EVENT_UP);
// SetKeyHandler(EnterBMEditInputOK,KEY_ENTER, KEY_EVENT_UP);
// ClearKeyHandler(KEY_END,KEY_EVENT_DOWN);
SetKeyHandler(BookMarkKeyEndHandler,KEY_END,KEY_EVENT_DOWN);
SetDelScrnIDCallbackHandler(SCR_ID_PLX_BROW_BOOKMARK_EDIT_INPUT, BookmarkHistoryDelCB);
bBMWaitExKeyEndFlag = TRUE;
}
/****************************************************************************
* Function EnterBMEditInputOK
* Purpose when left softkey (ok) is pressed
* Params
* Return
* Remarks
\****************************************************************************/
static void EnterBMEditInputOK (void)
{
PLIB_RegisterIMEDoneNotify (plxBrowBMEditInputLskFunc);
PLIB_IMEOptionEntry ();
SetKeyHandler(BookMarkKeyEndHandler,KEY_END,KEY_EVENT_DOWN);
}
/****************************************************************************
* Function void plxBrowBMEditInputLskFunc(void)
* Purpose the left soft key handle of bookmark edit input screen
* Params
* Return
* Remarks
\****************************************************************************/
void plxBrowBMEditInputLskFunc(void)
{
if(g_curHiliteBMEditInputID ==PLXBROW_BOOKMARK_EDIT_NAMEINPUT)
{
if(0 == pfnUnicodeStrlen((const S8*)g_szTempInputName))
{
GoBackHistory();
PLIB_MessageBox(PMBTYPE_WARNING,NULL, (const WCHAR *)get_string(STR_ID_PLX_BROW_BOOKMARK_ERR_SAVE_NULL_NAME),UI_POPUP_NOTIFYDURATION_TIME);
return ;
}
if(0 != pfnUnicodeStrcmp((const S8*)g_szPlxBrowBMEditInputName,(const S8*)g_szTempInputName))
g_bSelBooMarkChanged = TRUE;
pfnUnicodeStrcpy((S8*)g_szPlxBrowBMEditInputName,(const S8*)g_szTempInputName);
}
else if (g_curHiliteBMEditInputID ==PLXBROW_BOOKMARK_EDIT_URLINPUT)
{
if(0 == pfnUnicodeStrlen((const S8*)jumpToBuffer))
{
GoBackHistory();
PLIB_MessageBox(PMBTYPE_WARNING,NULL, (const WCHAR *)get_string(STR_ID_PLX_BROW_BOOKMARK_ERR_SAVE_NULL_URL),UI_POPUP_NOTIFYDURATION_TIME);
return ;
}
if(0 != pfnUnicodeStrcmp((const S8*)g_szPlxBrowBMEditInputURL,(const S8*)jumpToBuffer))
g_bSelBooMarkChanged = TRUE;
pfnUnicodeStrcpy((S8*)g_szPlxBrowBMEditInputURL,(const S8*)jumpToBuffer);
pfnUnicodeStrcpy((S8*)jumpToBuffer,(const S8*)"");
}
bBMWaitExKeyEndFlag = FALSE;
GoBacknHistory(1);
}
/****************************************************************************
* Function void plxBrowBMEditInputRskFunc(void)
* Purpose
* Params
* Return
* Remarks
\****************************************************************************/
void plxBrowBMEditInputRskFunc(void)
{
bBMWaitExKeyEndFlag = FALSE;
GoBackHistory();
}
#if 0
/****************************************************************************
* Function static void EntryPlxBrowBookMarkEditMenu(void)
* Purpose entry the bookmark edit menu screen
* Params
* Return
* Remarks
\****************************************************************************/
static void EntryPlxBrowBookMarkEditMenu(void)
{
plxBrowCreateBookMarkEditMenu();
if (NULL == g_hPlxBrowBookMarkEditMenu)
return;
plxBrowModifyBookMarkEditMenu();
PlxSetDMenuDispInfo(0, IMG_ID_PLX_BROW_BOOKMARK, 0,0, 0,0);
PlxShowDMenu(g_hPlxBrowBookMarkEditMenu, SCR_ID_PLX_BROW_BOOKMARK_EDIT_MENU, STR_ID_PLX_BROW_BOOKMARK_EDIT_SCRTITLE,
plxBrowBookMarkEditMenuNty,EntryPlxBrowBookMarkEditMenu);
// ClearKeyHandler(KEY_END,KEY_EVENT_DOWN);
SetKeyHandler(BookMarkKeyEndHandler,KEY_END,KEY_EVENT_DOWN);
}
/****************************************************************************
* Function static int plxBrowCreateBookMarkEditMenu(void)
* Purpose
* Params
* Return
* Remarks
\****************************************************************************/
static int plxBrowCreateBookMarkEditMenu(void)
{
if(NULL != g_hPlxBrowBookMarkEditMenu)
return 0;
g_hPlxBrowBookMarkEditMenu = PlxCreateDMenu(0);
if (NULL == g_hPlxBrowBookMarkEditMenu)
{
return -1; //create menu failed
}
PlxInsertDMenuItem(g_hPlxBrowBookMarkEditMenu, -1, MF_ENABLED, DMENU_ID_PLX_BROW_BOOKMARK_EDIT_SAVE,
(const char *)get_string(STR_ID_PLX_BROW_BOOKMARK_EDIT_SAVE), IMG_GLOBAL_L1); //use bookmark imgage
PlxInsertDMenuItem(g_hPlxBrowBookMarkEditMenu, -1, MF_ENABLED, DMENU_ID_PLX_BROW_BOOKMARK_EDIT_CURRENTPAGE,
(const char *)get_string(STR_ID_PLX_BROW_BOOKMARK_EDIT_CURRENTPAGE), IMG_GLOBAL_L2);
return 0;
}
/****************************************************************************
* Function static void plxBrowModifyBookMarkEditMenu(void)
* Purpose
* Params
* Return
* Remarks
\****************************************************************************/
//no menu to modify
static void plxBrowModifyBookMarkEditMenu(void)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -