📄 o_device_switch.c
字号:
extern UINT16 __NEAR wDeviceIdCurrent;
static MS_OP _VScrollListOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
MsOp = VScrollListOperation(pThis, MsOp, lParam);
// Post processing
switch(MsOp)
{
case MS_OP_INIT:
MS_SEND_OP_OBJECT(pThis, MS_OP_REFRESH, REFRESH_LIST_DISPLAY_FIRST_ITEM);
break;
case MS_OP_REFRESH:
{
//MS_DESCRIPTOR_VSCROLL_LIST *pDescriptorScroll = ((MS_DESCRIPTOR_VSCROLL_LIST *)pThis->mpDescriptor);
MSO_VLIST __NEAR* pList = (MSO_VLIST __NEAR*) MS_FindDescendant(pThis, ((MS_DESCRIPTOR_VSCROLL_LIST *)pThis->mpDescriptor)->mpDescriptorVList);
UINT16 wCount;
UINT16 wNum;
UINT16 wTotal;
UINT16 wDeviceID;
UINT16 wBtnNum;
MSO_DEVICE_BUTTON __NEAR* pButton;
if(REFRESH_LIST_DISPLAY_FIRST_ITEM == lParam)
pList->moParam.mwFirstDisplayItem = 0;
wTotal = pList->moParam.mwTotalItems;
wNum = pList->moParam.mcNumVisibleItems;
wBtnNum = pList->moParam.mwFirstDisplayItem;
wNum = MIN(wTotal -pList->moParam.mwFirstDisplayItem, wNum);
if (0 == wBtnNum)
wDeviceID = 0;
else
wDeviceID = _GetDeviceIndex((MSO_OBJECT __NEAR*)pList, wBtnNum-1) + 1;
// Remove all existing items in the browser list.
MS_SendOperation((MSO_OBJECT __NEAR*)pList, MS_OP_EMPTY, 0);
for(wCount = 0; wCount < wNum; wCount++)
{
MS_DESCRIPTOR * poDescriptor ;
switch (DeviceManager_GetDeviceType(wDeviceID))
{
case DEVICE_TYPE_DISC:
poDescriptor = (MS_DESCRIPTOR *)&oDescriptorDiscBtn;
break;
#ifdef FTA_SUPPORT
case DEVICE_TYPE_FTA:
poDescriptor = (MS_DESCRIPTOR *)&oDescriptorFTABtn;
break;
#endif
case DEVICE_TYPE_USB:
poDescriptor = (MS_DESCRIPTOR *)&oDescriptorUSBBtn;
break;
case DEVICE_TYPE_SD:
poDescriptor = (MS_DESCRIPTOR *)&oDescriptorSDBtn;
break;
case DEVICE_TYPE_MMC:
poDescriptor = (MS_DESCRIPTOR *)&oDescriptorMMCBtn;
break;
case DEVICE_TYPE_MS:
case DEVICE_TYPE_MSPRO: //low level only can detect it as "ms" be cache it.
poDescriptor = (MS_DESCRIPTOR *)&oDescriptorMSBtn;
break;
case DEVICE_TYPE_CF:
poDescriptor = (MS_DESCRIPTOR *)&oDescriptorCFBtn;
break;
case DEVICE_TYPE_SM:
poDescriptor = (MS_DESCRIPTOR *)&oDescriptorSMBtn;
break;
case DEVICE_TYPE_XD:
poDescriptor = (MS_DESCRIPTOR *)&oDescriptorXDBtn;
break;
default:
poDescriptor = (MS_DESCRIPTOR *)NULL;
wNum++;
break;
}
if (NULL != poDescriptor)
{
pButton = (MSO_DEVICE_BUTTON __NEAR*)OVLIST_CreateAndAppendItem(pList,poDescriptor);
pButton->moParam.mwDeviceIndex = wDeviceID;
pButton->moParam.mwBtnNum = wBtnNum++;
MS_SEND_OP_OBJECT(pButton, MS_OP_INIT, 0);
if (wDeviceIdCurrent == wDeviceID)
MS_SetSelected(pButton);
}
wDeviceID ++;
}
MS_DisplayAddObject(pThis);
if(!MS_IS_FOCUS_ON_LASTITEM(pList))
MS_ScreenSetFocusObject(((MSO_CONTAINER __NEAR*)pList)->mpOlist);
else
{
MSO_OBJECT __NEAR* pObject = ((MSO_CONTAINER __NEAR*)pList)->mpOlist;
while(NULL != pObject->mpNext)
pObject = pObject->mpNext;
MS_ScreenSetFocusObject(pObject);
}
break;
}
default:
break;
}
return MsOp;
}
/***************************************************************************************
* Function : _VListOperation
*
* In : pThis = Pointer to the subtitle scroll list (MSO_VSCROLL_LIST) object.
*
* MsOp = Operation ID.
*
* lParam = Parameter associated with an MS_OP if any.
*
* Out : None.
*
* Return : ID of the operation that is to be propagated once processing is done,
* otherwise MS_OP_NONE.
*
* Desc :
****************************************************************************************/
static MS_OP _VListOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
MSO_VLIST __NEAR* pList = (MSO_VLIST __NEAR*)pThis;
MsOp = VListOperation(pThis, MsOp, lParam);
switch(MsOp)
{
case MS_OP_REFRESH:
case MS_OP_INIT:
{
pList->moParam.mwTotalItems = (UINT16)DeviceManager_GetNumberDevices();
pList->moParam.mcNumVisibleItems = NBR_DEVICE_BUTTON_MAX;
pList->moParam.mcItemOffset = LIST_BUTTON_OFFSET;
}
break;
default:
break;
}
return MsOp;
}
/***************************************************************************************
* Function : _ButtonOperation
*
* In : pThis = Pointer to the subtitle scroll list (MSO_VSCROLL_LIST) object.
*
* MsOp = Operation ID.
*
* lParam = Parameter associated with an MS_OP if any.
*
* Out : None.
*
* Return : ID of the operation that is to be propagated once processing is done,
* otherwise MS_OP_NONE.
*
* Desc : This function processes all operations/events of the subtitle scroll list
* (MSO_VSCROLL_LIST) object represented by the
* oDescriptorVScrollList descriptor.
****************************************************************************************/
#define DeviceId(_pThis_) ( ((MSO_DEVICE_BUTTON __NEAR*)pThis)->moParam.mwDeviceIndex)
static MS_OP _ButtonOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
MsOp = OBUTTON_Operation(pThis, MsOp, lParam);
switch(MsOp)
{
case MS_OP_MENU_SELECT_DEVICE:
//if (DeviceManager_GetCurrentDeviceId() != ((MSO_DEVICE_BUTTON __NEAR*)pThis)->moParam.mwDeviceIndex)
if (DeviceManager_IsAllowedContructDevice(DeviceId(pThis)))
{
#ifdef FTA_SUPPORT
if (DEVICE_FTA != DeviceId(pThis))
#endif
MS_SEND_OP(MS_OP_MSG_DEVICE_LOADING, DeviceId(pThis));
MS_SEND_OP(MS_OP_MENU_ENABLE_USE_OP, 0);
// Destruct the action engines first, then destruct the device
//MS_SEND_OP(MS_OP_MENU_ACTION_ENGINES_DESTRUCT, 0);
//DeviceManager_ContructDevice(DeviceId(pThis));
MS_SEND_OP(MS_OP_MENU_SET_REQUESTED_DEVICE, DeviceId(pThis));
// Disable the user operations during caching
return MS_OP_MENU_SELECT_DEVICE;
}
else
{
PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_NOW);
}
return MS_OP_NONE;
default:
break;
}
return MsOp;
}
// TODO: Inclusde the check mark inside the text object and remove this function
BOOL _ButtonFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
OBUTTON_FillOSDSeg(pThis, pAbsArea);
if (MS_IsSelected(pThis))
{
OSDR_FillOsdSegBitmap( BMP_FG_MARK_CHECK,
pAbsArea,
(AREA_DEVICE_BUTTON_W - 8),
(AREA_DEVICE_BUTTON_H / 2),
ALIGN_H_RIGHT, ALIGN_V_CENTER,
NULL_EXPANSION, NULL_EXPANSION);
}
return 0;
}
/***************************************************************************************
* Utility functions
****************************************************************************************/
/***************************************************************************************
* Function : _GetDeviceIndex
*
* In : pThis = Pointer to the Device v list (MSO_VLIST) object.
*
* wBtnNum = button number in vlist.
*
* Out : None.
*
* Return : the button 's device index,
*
****************************************************************************************/
static UINT16 _GetDeviceIndex(MSO_OBJECT __NEAR* pThis, UINT16 wBtnNum)
{
//#define pList ((MSO_VLIST __NEAR*) pThis)
MSO_VLIST __NEAR* pList = ((MSO_VLIST __NEAR*) pThis);
MSO_DEVICE_BUTTON __NEAR* pButton = (MSO_DEVICE_BUTTON __NEAR*)((MSO_CONTAINER __NEAR*)pList)->mpOlist;
while (NULL != pButton)
{
if (wBtnNum == pButton->moParam.mwBtnNum)
return pButton->moParam.mwDeviceIndex;
pButton = (MSO_DEVICE_BUTTON __NEAR*)((MSO_OBJECT __NEAR*)pButton)->mpNext;
}
return NULL_INDEX;
}
static UINT16 _ComputeVScrollListHigh(void)
{
UINT16 wNumBtn = MIN(DeviceManager_GetNumberDevices(),NBR_DEVICE_BUTTON_MAX);
return ((AREA_DEVICE_BUTTON_H + LIST_BUTTON_OFFSET) * wNumBtn)- LIST_BUTTON_OFFSET + (VSCROLL_LIST_YPADDING <<1);
}
#endif //D_GUI_COMPONENT_DEVICE_SWITCH
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -