📄 vremote.c
字号:
/**********************************************************************/
/*************** MTK CONFIDENTIAL & COPYRIGHTED ****************/
/*************** ****************/
/*************** $Modtime:: 03/05/15 5:23p $ ****************/
/*************** $Revision: 2.0 $ ****************/
/*************** ****************/
/*************** Description : Virtual Remote ****************/
/*************** Control ****************/
/*************** ****************/
/*************** Company : MediaTek Inc. ****************/
/*************** Programmer : Chi-hung Chen ****************/
/**********************************************************************/
#include "general.h"
#define VRMT_NOMENU_ITEM
#ifdef PLAYER_VRMT
#pragma NOAREGS
typedef struct structVremote
{
/* Byte 1 */
BYTE bState:4;
BYTE bPosition:4;
/* Byte 2 */
BYTE bMenuType;
} strucVremote;
typedef struct structFocusItem
{
BYTE bIRKey;
BYTE bUpLink;
BYTE bDownLink;
BYTE bLeftLink;
BYTE bRightLink;
WORD wStartX;
WORD wStartY;
WORD wEndX;
WORD wEndY;
} strucFocusItem;
#define VRBUTTON_BLACK_INDEX 12
#define VRBUTTON_GRAY_INDEX 7
#define VRBUTTON_WHITE_INDEX 15
#define VRBUTTON_HILI_INDEX1 3
#define VRBUTTON_HILI_INDEX2 4
static xdata strucVremote _rVremote;
// Define each focus item according to their position.
// Positions are as below:
// 0 | 1 | 2
// --+--+--
// 3 | 4 | 5
// --+--+--
// 6 | 7 | 8
//
#define OFSX0 25
#define OFSW0 (-18)
#define OFSY0 25
#define OFSH0 (-22)
#define OFSX1 4
#define OFSW1 (-6)
#define OFSY1 2
#define OFSH1 (-8)
#define OFSX2 (-4)
#define OFSW2 (-26)
#define OFSY2 25
#define OFSH2 (-20)
#define OFSX3 2
#define OFSW3 (-5)
#define OFSY3 2
#define OFSH3 (-6)
#define OFSX4 (-2)
#define OFSW4 9
#define OFSY4 (-5)
#define OFSH4 8
#define OFSX5 9
#define OFSW5 (-10)
#define OFSY5 2
#define OFSH5 (-6)
#define OFSX6 25
#define OFSW6 (-18)
#define OFSY6 (-6)
#define OFSH6 (-28)
#define OFSX7 4
#define OFSW7 (-6)
#define OFSY7 4
#define OFSH7 (-6)
#define OFSX8 (-2)
#define OFSW8 (-28)
#define OFSY8 (-4)
#define OFSH8 (-30)
#define DISH_BLOCK_WIDTH 68
#define DISH_BLOCK_HEIGHT 68
code strucFocusItem _rFocusItem[VRMT_MAX_NO_OF_FOCUS_ITEM]=
{
{IR_SR, 1, 3, 3, 1, VRMT_DISH_STARTX+OFSX0,VRMT_DISH_STARTY+OFSY0,VRMT_DISH_STARTX+DISH_BLOCK_WIDTH+OFSX0+OFSW0,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT+OFSY0+OFSH0},//pos 0
{IR_PAUSE, 1, 4, 0, 2, VRMT_DISH_STARTX+DISH_BLOCK_WIDTH+OFSX1,VRMT_DISH_STARTY+OFSY1,VRMT_DISH_STARTX+DISH_BLOCK_WIDTH*2+OFSX1+OFSW1,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT+OFSY1+OFSH1},//pos 1
{IR_SF, 1, 5, 1, 5, VRMT_DISH_STARTX+DISH_BLOCK_WIDTH*2+OFSX2,VRMT_DISH_STARTY+OFSY2,VRMT_DISH_STARTX+DISH_BLOCK_WIDTH*3+OFSX2+OFSW2,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT+OFSY2+OFSH2},//pos 2
{IR_FR, 0, 6, 3, 4, VRMT_DISH_STARTX+OFSX3,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT+OFSY3,VRMT_DISH_STARTX+DISH_BLOCK_WIDTH+OFSX3+OFSW3,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT*2+OFSY3+OFSH3},//pos 3
{IR_PLAY_RESUME, 1, 7, 3, 5, VRMT_DISH_STARTX+DISH_BLOCK_WIDTH+OFSX4,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT+OFSY4,VRMT_DISH_STARTX+DISH_BLOCK_WIDTH*2+OFSX4+OFSW4,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT*2+OFSY4+OFSH4},//pos 4
{IR_FF, 2, 8, 4, 5, VRMT_DISH_STARTX+DISH_BLOCK_WIDTH*2+OFSX5,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT+OFSY5,VRMT_DISH_STARTX+DISH_BLOCK_WIDTH*3+OFSX5+OFSW5,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT*2+OFSY5+OFSH5},//pos 5
{IR_PREV, 3, 7, 3, 7, VRMT_DISH_STARTX+OFSX6,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT*2+OFSY6,VRMT_DISH_STARTX+DISH_BLOCK_WIDTH+OFSX6+OFSW6,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT*3+OFSY6+OFSH6},//pos 6
{IR_STOP, 4, 7, 6, 8, VRMT_DISH_STARTX+DISH_BLOCK_WIDTH+OFSX7,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT*2+OFSY7,VRMT_DISH_STARTX+DISH_BLOCK_WIDTH*2+OFSX7+OFSW7,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT*3+OFSY7+OFSH7},//pos 7
{IR_NEXT, 5, 7, 7, 5, VRMT_DISH_STARTX+DISH_BLOCK_WIDTH*2+OFSX8,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT*2+OFSY8,VRMT_DISH_STARTX+DISH_BLOCK_WIDTH*3+OFSX8+OFSW8,VRMT_DISH_STARTY+DISH_BLOCK_HEIGHT*3+OFSY8+OFSH8},//pos 8
};
enum {
VRMT_POS_0,
VRMT_POS_1,
VRMT_POS_2,
VRMT_POS_3
};
enum {
VRMT_MENU_TYPE_DVD,
VRMT_MENU_TYPE_NONE
};
enum {
VRMT_STATE_INIT,
VRMT_STATE_WAIT_TIMEOUT,
VRMT_STATE_NORMAL
};
/*********************************************************************
Function : void vVRMTRedrawAll()
Description : completely redraw whole V-Remote. WB_VRMT_ITEM
Parameter : none
Return : none
**********************************************************************/
void vVRMTRedrawAll() large
{
BYTE bTmp;
//Clean WB , Draw Background
//Draw play key
_wStartX=VRMT_DISH_STARTX; //10;
_wStartY=VRMT_DISH_STARTY; //100
_wEndX=210;
_wEndY=210;
vPasteBmp(WB_VRMT_ITEM, BMP_NEW_VRMT);
// if bPosition is < 9
if(_rVremote.bPosition < 9) //in key dish
{
// highlight (change color)
_wStartX = _rFocusItem[_rVremote.bPosition].wStartX;
_wStartY = _rFocusItem[_rVremote.bPosition].wStartY;
_wEndX = _rFocusItem[_rVremote.bPosition].wEndX;
_wEndY = _rFocusItem[_rVremote.bPosition].wEndY;
// vRectangle(WB_VRMT_ITEM,2,15,FALSE,0); //test
vChgColRep(WB_VRMT_ITEM, VRBUTTON_BLACK_INDEX, VRBUTTON_HILI_INDEX1); // hi light a button
vChgColRep(WB_VRMT_ITEM, VRBUTTON_GRAY_INDEX, VRBUTTON_HILI_INDEX2); // hi light a button
}
//Draw Menu item and highlight if necessary.
if((_rVremote.bMenuType == VRMT_MENU_TYPE_NONE))
{
vSetMsgCol4(WB_VRMT_ITEM, 0, 9, 1, 9);
}
else
{
vSetMsgCol4(WB_VRMT_ITEM, 0, 9, 8, 3);
}
}
/*********************************************************************
Function : void vVremoteInit(BYTE fgInit) large
Description : Initial function when go into v-remote state.
Parameter :
Return :
**********************************************************************/
void vVremoteInit(BYTE fgInit) large
{
BYTE bTmp;
//Popup the vremote whiteboard
/* change OSD mode to user mode */
vOsdShowWb(OSD_WB_USER);
#ifdef BBK_NEW_INDICATOR
vWBDisable(WB_NORMAL_INITMSG);
#endif
/* set menu type */
if (fgIsDvdPlay())
{
_rVremote.bMenuType = VRMT_MENU_TYPE_DVD;
}
else if (fgIsIsoPlay())
{
vSetExitInputState();
return;
}
else
{
_rVremote.bMenuType = VRMT_MENU_TYPE_NONE;
}
//create vremote whiteboard
vCreateWB(WB_VRMT_ITEM, TRUE);
vSetWBTcColor(WB_VRMT_ITEM);
//set blend level for background color.
vSetTcPal(WB_VRMT_ITEM, VRBUTTON_BLACK_INDEX, BLEND_2, NEWUICOLOR_PANEL_GRAY);
vSetTcPal(WB_VRMT_ITEM, VRBUTTON_GRAY_INDEX, BLEND_1, TRUECOLOR_WHITE);
vSetTcPal(WB_VRMT_ITEM, VRBUTTON_WHITE_INDEX, BLEND_3, TRUECOLOR_WHITE);
// set idx 0 as transparent color.
vSetTransEn(WB_VRMT_ITEM,0);
//set message color of v-remote
vSetMsgCol4(WB_VRMT_ITEM, 0, 9, 8, 3);
//draw whole background ??
//vDrawBorderWB(WB_VRMT_ITEM, 0);
_rVremote.bState = VRMT_STATE_INIT;
_rVremote.bPosition = VRMT_INIT_POSI;
vVRMTRedrawAll();
//enable vremote whiteboard
vEnableWB(WB_VRMT_ITEM);
return;
}
/*********************************************************************
Function : void vVRMTSelectFocus(BYTE bPosition)
Description : In Vremote, highlight one item.
Parameter : bPosition is the position id within virtual remote controller.
Return :
**********************************************************************/
void vVRMTSelectFocus(BYTE bPosition) large
{
WORD wMsgIdx;
BYTE bTmp;
switch(bPosition)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
_wStartX = _rFocusItem[bPosition].wStartX;
_wStartY = _rFocusItem[bPosition].wStartY;
_wEndX = _rFocusItem[bPosition].wEndX;
_wEndY = _rFocusItem[bPosition].wEndY;
// vRectangle(WB_VRMT_ITEM,2,11,FALSE,0); //for test
vChgColRep(WB_VRMT_ITEM, VRBUTTON_BLACK_INDEX, VRBUTTON_HILI_INDEX1); // hi light a button
vChgColRep(WB_VRMT_ITEM, VRBUTTON_GRAY_INDEX, VRBUTTON_HILI_INDEX2); // hi light a button
break;
default:
break;
}
}
/*********************************************************************
Function : void vVRMTUnselectFocus(BYTE bPosition)
Description : In Vremote, disable one item's highlight.
Parameter : bPosition is the position in the vremote.
Return :
**********************************************************************/
void vVRMTUnselectFocus(BYTE bPosition)
{
WORD wMsgIdx;
switch(bPosition)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
_wStartX = _rFocusItem[bPosition].wStartX;
_wStartY = _rFocusItem[bPosition].wStartY;
_wEndX = _rFocusItem[bPosition].wEndX;
_wEndY = _rFocusItem[bPosition].wEndY;
//vRectangle(WB_VRMT_ITEM,2,11,FALSE,0); //for test
vChgColRep(WB_VRMT_ITEM, VRBUTTON_HILI_INDEX1, VRBUTTON_BLACK_INDEX); //resume a button
vChgColRep(WB_VRMT_ITEM, VRBUTTON_HILI_INDEX2, VRBUTTON_GRAY_INDEX); //resume a button
break;
default:
break;
}
}
/*********************************************************************
Function : BOOL fgVremoteState(void) large
Description : State machine when vremote input state.
Parameter :
Return :
**********************************************************************/
BOOL fgVremoteState(void) large
{
BYTE bPbcState;
BOOL fgRet = TRUE;
switch (_bIRKey)
{
case IR_UP:
if(_rVremote.bPosition != _rFocusItem[_rVremote.bPosition].bUpLink)
{
if((_rVremote.bMenuType != VRMT_MENU_TYPE_NONE)||(_rFocusItem[_rVremote.bPosition].bUpLink!=11))
{
vVRMTUnselectFocus(_rVremote.bPosition);
_rVremote.bPosition = _rFocusItem[_rVremote.bPosition].bUpLink;
vVRMTSelectFocus(_rVremote.bPosition);
}
}
break;
case IR_LEFT:
if(_rVremote.bPosition != _rFocusItem[_rVremote.bPosition].bLeftLink)
{
vVRMTUnselectFocus(_rVremote.bPosition);
_rVremote.bPosition = _rFocusItem[_rVremote.bPosition].bLeftLink;
vVRMTSelectFocus(_rVremote.bPosition);
}
break;
case IR_RIGHT:
if(_rVremote.bPosition != _rFocusItem[_rVremote.bPosition].bRightLink)
{
vVRMTUnselectFocus(_rVremote.bPosition);
_rVremote.bPosition = _rFocusItem[_rVremote.bPosition].bRightLink;
vVRMTSelectFocus(_rVremote.bPosition);
}
break;
case IR_DOWN:
if(_rVremote.bPosition != _rFocusItem[_rVremote.bPosition].bDownLink)
{
vVRMTUnselectFocus(_rVremote.bPosition);
_rVremote.bPosition = _rFocusItem[_rVremote.bPosition].bDownLink;
vVRMTSelectFocus(_rVremote.bPosition);
}
break;
case IR_ENTER:
//case IR_PLAY:
case IR_PLAY_ENTER:
_bIRKey = _rFocusItem[_rVremote.bPosition].bIRKey;
fgRet = FALSE;
if(_bIRKey==IR_GOTO)
{
vSetExitInputState();
}
else if(_bIRKey==IR_PAUSE_STEP)
{
bPbcState = bSharedInfo(SI_PBC_STATE);
if ((bPbcState == SV_PAUSE) || (bPbcState == SV_STEP))
{
_bIRKey = IR_STEP;
}
else
{
_bIRKey = IR_PAUSE;
}
}
else if(_bIRKey==IR_ANGLE)
{
#if 0 //honnow...
vSendUopCmd(UOP_NEXT_AGL, 0, 0, 0);
if (!fgIsAngleShow())
{
vIrSetTimeOut(IR_TIMEOUT_ANGLE);
_rVremote.bState = VRMT_STATE_WAIT_TIMEOUT;
}
fgRet = TRUE;
#endif
}
else if(_bIRKey==IR_PLAY_RESUME)
{
if(bSharedInfo(SI_HLI_STATE)==SV_ON)
//bywhy 2003/07/08
// _bIRKey = IR_ENTER;
/* if in trick mode, back to normal play first */
if (fgIsTrickPlay(bSharedInfo(SI_PBC_STATE)))
{
_bIRKey = IR_PLAY;
}
else
{
_bIRKey = IR_ENTER;
}
//buwhy end
}
break;
case IR_PLAY:
case IR_FF:
case IR_FR:
case IR_SF:
case IR_SR:
case IR_NEXT:
case IR_PREV:
case IR_PAUSE:
case IR_PAUSE_STEP:
case IR_DISPLAY:
case IR_OSD_LANGUAGE:
case IR_AUDIO:
case IR_SUB_TITLE:
case IR_ANGLE:
#ifdef PORTABLEDVD
case IR_SHIFT: //_bVRMTState
#endif
#ifdef SUPPORT_DVD_AUDIO //BillDen
case IR_PREV_DLIST:
case IR_NEXT_DLIST:
#endif
//case IR_TIME_OUT:
fgRet = FALSE;
break;
case IR_TIME_OUT:
#if 0 //honnow...
if(_rVremote.bState == VRMT_STATE_WAIT_TIMEOUT)
{
_rVremote.bState = VRMT_STATE_NORMAL;
if (!fgIsAngleShow())
vOsdShowAngle(OSD_ANGLE_CLEAR, 0, 0);
}
else
{
fgRet = FALSE;
}
#else
fgRet = FALSE;
#endif
break;
// case IR_ANGLE:
// vSendUopCmd(UOP_NEXT_AGL, 0, 0, 0);
// vIrSetTimeOut(IR_TIMEOUT_ANGLE);
// break;
case IR_VRMT:
#ifdef GUI_CANCEL_BUTTON
case IR_CANCEL:
#endif
vSetExitInputState();
break;
default:
fgRet = FALSE;
vSetExitInputState();
break;
}
return (fgRet);
}
/*********************************************************************
Function : void vVremoteExit(void) large
Description : Exit function when exiting vremote input mode.
Parameter :
Return :
**********************************************************************/
void vVremoteExit(void) large
{
vDeleteWB(WB_VRMT_ITEM);
/* restore OSD mode */
vOsdShowWb(OSD_WB_RESTORE);
#ifdef BBK_NEW_INDICATOR
vWBEnable(WB_NORMAL_INITMSG);
#endif
#ifdef PORTABLEDVD
_bVRMTState = EV_NORMAL_STATE;
#endif
return;
}
#else
//dummy functions
void vVremoteInit(BYTE fgInit) large { return; }
BOOL fgVremoteState(void) large { return (FALSE); }
void vVremoteExit(void) large { return; }
//void vVremoteHandleUpdate(BYTE bItem, BYTE bVal) large { return; }
//void vVremoteUsrPbcChange(void) large { return; }
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -