📄 menu.c
字号:
#if TV_ENABLE
case MIA_ChannelUp:
case MIA_ChannelDown:
Set_ShowSourceFlag();
if(!IsTVInUse())
break;
SetAudioMute();
Power_TurnOffPanel();
if(menuAction==MIA_ChannelUp)
ChannelUp();
else
ChannelDown();
processEvent=FALSE;
break;
case MIA_IR_QuickBack:
if(!IsTVInUse())
break;
TV_SelectPreChannel();
g_ucMenuPageIndex=ShowTVChannelMenu;
g_ucMenuItemIndex=0;
menuAction=MIA_RedrawMenu;
processEvent=TRUE;
break;
case MIA_IR_Sound_MODE:
if(!IsTVInUse())
break;
AdjustSoundMode(MIA_IncValue);
menuAction=MIA_RedrawMenu;
g_ucMenuPageIndex=ShowTVChannelMenu;
g_ucMenuItemIndex=0;
processEvent=TRUE;
break;
#if TV_SYSTEM!=TV_NTSC
case MIA_Searchup:
g_bManualScanDirection=1;
TV_ChannelManualScanInit();
return FALSE;// DISABLE OSD TIME RESET
case MIA_Searchdown:
g_bManualScanDirection=0;
TV_ChannelManualScanInit();
return FALSE;// DISABLE OSD TIME RESET
#endif
case MIA_IR_ChromaSwitch:
if(!IsTVInUse())
break;
AdjustChromaMode(MIA_IncValue);
menuAction=MIA_RedrawMenu;
g_ucMenuPageIndex=ShowTVChannelMenu;
g_ucMenuItemIndex=0;
processEvent=TRUE;
break;
case MIA_AutoSerach:
TV_ChannelAutoScanInit();
return FALSE;// DISABLE OSD TIME RESET
case MIA_IRKEY_0:
case MIA_IRKEY_1:
case MIA_IRKEY_2:
case MIA_IRKEY_3:
case MIA_IRKEY_4:
case MIA_IRKEY_5:
case MIA_IRKEY_6:
case MIA_IRKEY_7:
case MIA_IRKEY_8:
case MIA_IRKEY_9:
irAdjustNumKey(IRKeyToNumber(menuAction));
menuAction=MIA_RedrawMenu;
processEvent=TRUE;
break;
case MIA_IRKEY_100:
irNumInputMode();
menuAction=MIA_RedrawMenu;
processEvent=TRUE;
break;
#endif
#if VGA_ENABLE
case MIA_Auto:
if (FreeRunModeFlag )
break;
menuAction=MIA_RedrawMenu;
g_ucMenuPageIndex=AutoMenu;
g_ucMenuItemIndex=0;
processEvent=TRUE;
break;
#endif
default:
return FALSE;
break;
}
}
return TRUE;
}
//=========================================================================
void DrawOsdMenu(void)
{ BOOL redrawFlags;
BYTE ucBank;
ucBank = msReadByte( BK0_00_REGBK);
msWriteByte(BK0_00_REGBK, REG_BANK_SCALER);
Clr_DynamiccaptionFlag();
if (CurrentMenu.Flags&mpbInvisible)
Osd_Hide();
else
{
BYTE i;
// setup osd window & position
redrawFlags=FALSE;
if (CurrentMenu.XSize!=OsdWindowWidth || CurrentMenu.YSize!=OsdWindowHeight ||
!(msReadOSDByte(OSD_0C_IOSDC1)&MWIN_B))
redrawFlags=TRUE;
if (redrawFlags)
{
Osd_Hide();
Osd_SetWindowSize(CurrentMenu.XSize, CurrentMenu.YSize);
//Clr_ReverseYFlag();
//Clr_ReverseXFlag();
//g_VideoSetting.OsdHStart=98;
//g_VideoSetting.OsdVStart=95;
if (FactoryModeFlag)
Osd_SetPosition(10, 10);
else if (CurrentMenu.Flags&mpbSetItemTop)
{
Osd_SetPosition((99-g_VideoSetting.Scaling*15), 5);
msWriteByte(BK0_63_OSD_CTL, 0x0F);
}
else if(CurrentMenu.Flags&mpbGame)
{
Osd_SetPosition(50, 60);
msWriteByte(BK0_63_OSD_CTL, 0x00);
}
else
{ Osd_SetPosition(50, 50);
msWriteByte(BK0_63_OSD_CTL, 0x03);
}
if (g_ucMenuPageIndex==MuteMenu)
Osd_SetPosition((2+g_VideoSetting.Scaling*15), 5);
#if CALENDAR_ENABLE
if (g_ucMenuPageIndex==CalendarMenu)
msWriteByte(BK0_63_OSD_CTL, 0x0F);
#endif
if (g_ucMenuPageIndex==VolumeMenu)
Osd_SetPosition(50, 98);
for (i=0; i<MenuItemCount; i++)
DrawOsdMenuItem(i, &CurrentMenu.MenuItems[i]);
DrawOsdMenuItem(g_ucMenuItemIndex, &CurrentMenu.MenuItems[g_ucMenuItemIndex]);//ZWTAN 20050711
if (FactoryModeFlag)
Osd_DrawChar(0, 0, 'F');
Osd_Show();
}
else
{
for (i=0; i<MenuItemCount; i++)
DrawOsdMenuItem(i, &CurrentMenu.MenuItems[i]);
DrawOsdMenuItem(g_ucMenuItemIndex, &CurrentMenu.MenuItems[g_ucMenuItemIndex]);
Osd_Show();
}
}
msWriteByte(BK0_00_REGBK, ucBank);
}
//=========================================================================
// draw menu item
void DrawOsdMenuItem(BYTE itemIndex, MenuItemType *menuItem)
{
if (menuItem->Flags&mibInvisible)
return;
if (menuItem->Flags&mibFactoryItem && !FactoryModeFlag)
return;
if (menuItem->Flags&mibTVItem&& !IsTVInUse())
return;
if (menuItem->Flags&mibVGADisable&& IsVGAInUse())
return;
if (menuItem->Flags&mibVGAItem&& !IsVGAInUse())
return;
if (menuItem->Flags&mibVGAItem&& IsVGAInUse() && SyncLossState())
return;
if (menuItem->Flags&mibSelectable && itemIndex==g_ucMenuItemIndex)
Osd_SetTextColor(menuItem->SelForeColor, menuItem->SelBackColor);
else
Osd_SetTextColor(menuItem->ForeColor, menuItem->BackColor);
DrawOsdMenuItemText(itemIndex, menuItem);
if (&CurrentMenuItem==menuItem || menuItem->Flags&mibDrawValue)
{
if (&(menuItem->DisplayValue))
DrawOsdMenuItemValue(itemIndex, (menuItem->DisplayValue));//->DisplayValue);
}
}
//=========================================================================
// draw menu item display text
void DrawOsdMenuItemText(BYTE itemIndex, MenuItemType *menuItem)
{
if (menuItem->DisplayText==NULL)
return;
if (menuItem->DrawItemMethod==DWI_Icon || menuItem->DrawItemMethod==DWI_Text)
{
#ifdef Multi_language
if (IsVGAInUse()&&g_ucMenuPageIndex==PictureMenu&&itemIndex == 3)
Osd_DrawStr(menuItem->XPos, menuItem->YPos-1, menuItem->DisplayText());
else
#endif
Osd_DrawStr(menuItem->XPos, menuItem->YPos, menuItem->DisplayText());
}
else // full text
{
BYTE i;
BYTE xPos;
#define len itemIndex
len=strlen(menuItem->DisplayText());
if (menuItem->DrawItemMethod==DWI_FullText)
xPos=menuItem->XPos;
else if (menuItem->DrawItemMethod==DWI_FullCenterText || menuItem->DrawItemMethod==DWI_CenterText)
xPos=(OsdWindowWidth-len)/2; // get center position
Osd_DrawStr(xPos, menuItem->YPos, menuItem->DisplayText());
if (menuItem->DrawItemMethod!=DWI_CenterText) // full text
{
for (i=0; i<xPos; i++)
Osd_DrawChar(i, menuItem->YPos, ' '); // fill space
for (i=xPos+len; i<OsdWindowWidth; i++)
Osd_DrawChar(i, menuItem->YPos, ' ');
}
#undef len
}
}
//=========================================================================
// draw menu item display value
void DrawOsdMenuItemValue(BYTE itemIndex, DrawValueType *valueItem)
{
while(1)
{
if (valueItem->DrawNumber)
DrawOsdMenuItemNumber(itemIndex, valueItem->DrawNumber);
if (valueItem->DrawGuage)
DrawOsdMenuItemGuage(itemIndex, valueItem->DrawGuage);
if (valueItem->DrawRadioGroup)
DrawOsdMenuItemRadioGroup(itemIndex, valueItem->DrawRadioGroup);
if(valueItem->Flags&dwiEnd)
break;
valueItem++;
}
}
//=========================================================================
// draw number
void DrawOsdMenuItemNumber(BYTE itemIndex, DrawNumberType *numberItem)
{
if (itemIndex==g_ucMenuItemIndex)//Vick Add
Osd_SetTextColor(numberItem->SelForeColor,numberItem->SelBackColor);
else
Osd_SetTextColor(numberItem->ForeColor,numberItem->BackColor);
#define xPos itemIndex
xPos=numberItem->XPos;
if (xPos==0xFF)
{
xPos=(OsdWindowWidth-4)/2-1;
}
if (numberItem->Flags&dwiHex)
Osd_DrawHex(xPos, numberItem->YPos, numberItem->GetValue());
else
Osd_DrawNum(xPos, numberItem->YPos, numberItem->GetValue());
#undef xPos
}
//=========================================================================
// draw guage
void DrawOsdMenuItemGuage(BYTE itemIndex, DrawGuageType *gaugeItem)
{
if (itemIndex==g_ucMenuItemIndex)
Osd_SetTextColor(gaugeItem->SelForeColor,gaugeItem->SelBackColor);
else
Osd_SetTextColor(gaugeItem->ForeColor,gaugeItem->BackColor);
#define xPos itemIndex
xPos=gaugeItem->XPos;
if (xPos==0xFF)
{
xPos=(OsdWindowWidth-gaugeItem->Length)/2;
}
Osd_DrawGuage(xPos, gaugeItem->YPos, gaugeItem->Length, gaugeItem->GetValue());
#undef xPos
}
void DrawFullCenterText(BYTE xPos, BYTE yPos, BYTE *str)
{
BYTE i, len;
if (xPos==0xFF)
{
len=strlen(str);
xPos=(OsdWindowWidth-len)/2;
for (i=2; i<xPos; i++)
Osd_DrawChar(i, yPos, ' ');
for (i=xPos+len; i<OsdWindowWidth-2; i++)
Osd_DrawChar(i, yPos, ' ');
}
Osd_DrawStr(xPos, yPos, str);
}
//=========================================================================
// draw radio
void DrawOsdMenuItemRadioGroup(BYTE itemIndex, DrawRadioGroupType *radioItem)
{
RadioTextType *radioText;
BYTE i=0;
radioText=radioItem->RadioText;
if (radioText)
{
if (radioItem->GetValue)
i=radioItem->GetValue();
if(radioItem->Flags&dwiSingleRadioItem)
{
radioText +=i;
i=0;
}
while (1)
{ // set high color
if (radioText->DisplayText)
{
if(radioItem->Flags&dwiValueSelectRadioItemColor)
{
if(!i)
Osd_SetTextColor(radioText->SelForeColor,radioText->SelBackColor);
else
Osd_SetTextColor(radioText->ForeColor,radioText->BackColor);
}
else
{
if (itemIndex==g_ucMenuItemIndex)
{
Osd_SetTextColor(radioText->SelForeColor,radioText->SelBackColor);
}
else
{
Osd_SetTextColor(radioText->ForeColor,radioText->BackColor);
}
}
#ifdef Multi_language
if (IsVGAInUse()&&g_ucMenuPageIndex==PictureMenu&&itemIndex == 3)
DrawFullCenterText(radioText->XPos, radioText->YPos-1, radioText->DisplayText());
else
#endif
DrawFullCenterText(radioText->XPos, radioText->YPos, radioText->DisplayText());
}
if (radioText->Flags&dwiEnd)
break;
radioText ++;
i--;
}
}
}
BYTE GetPrevItem(MenuItemType *menuItem)
{ signed char i;
if (g_ucMenuItemIndex)
{ for (i=g_ucMenuItemIndex-1; i>=0; i--)
{
if (menuItem[i].Flags&mibVGADisable && IsVGAInUse())
continue;
if (menuItem[i].Flags&mibFactoryItem && !FactoryModeFlag)
continue;
if (menuItem[i].Flags&mibTVItem && !IsTVInUse())
continue;
if (menuItem[i].Flags&mibVGAItem&& !IsVGAInUse())
continue;
if (menuItem[i].Flags&mibConditionEnableItem&& !EnableTimeFlag)
continue;
if (menuItem[i].Flags&mibVGAItem&& IsVGAInUse() && SyncLossState())
continue;
if (menuItem[i].Flags&mibSelectable)
return i;
}
}
for (i=MenuItemCount-1; i>=0; i--)
{
if (menuItem[i].Flags&mibVGADisable && IsVGAInUse())
continue;
if (menuItem[i].Flags&mibFactoryItem && !FactoryModeFlag)
continue;
if (menuItem[i].Flags&mibConditionEnableItem&& !EnableTimeFlag)
continue;
if (menuItem[i].Flags&mibTVItem && !IsTVInUse())
continue;
if (menuItem[i].Flags&mibVGAItem&& !IsVGAInUse())
continue;
if (menuItem[i].Flags&mibVGAItem&& IsVGAInUse() && SyncLossState())
continue;
if (menuItem[i].Flags&mibSelectable)
return i;
}
return g_ucMenuItemIndex;
}
BYTE GetNextItem(MenuItemType *menuItem)
{
BYTE i;
if (g_ucMenuItemIndex<MenuItemCount-1) // current item is not last item.
{
for (i=g_ucMenuItemIndex+1; i<MenuItemCount; i++)
{
if (menuItem[i].Flags&mibVGADisable && IsVGAInUse())
continue;
if (menuItem[i].Flags&mibFactoryItem && !FactoryModeFlag)
continue;
if (menuItem[i].Flags&mibConditionEnableItem&& !EnableTimeFlag)
continue;
if (menuItem[i].Flags&mibTVItem && !IsTVInUse())
continue;
if (menuItem[i].Flags&mibVGAItem&& !IsVGAInUse())
continue;
if (menuItem[i].Flags&mibVGAItem&& IsVGAInUse() && SyncLossState())
continue;
if (menuItem[i].Flags&mibSelectable)
return i;
}
}
for (i=0; i<g_ucMenuItemIndex; i++)
{
if (menuItem[i].Flags&mibVGADisable && IsVGAInUse())
continue;
if (menuItem[i].Flags&mibFactoryItem && !FactoryModeFlag)
continue;
if (menuItem[i].Flags&mibConditionEnableItem&& !EnableTimeFlag)
continue;
if (menuItem[i].Flags&mibTVItem && !IsTVInUse())
continue;
if (menuItem[i].Flags&mibVGAItem&& !IsVGAInUse())
continue;
if (menuItem[i].Flags&mibVGAItem&& IsVGAInUse() && SyncLossState())
continue;
if (menuItem[i].Flags&mibSelectable)
return i;
}
return g_ucMenuItemIndex;
}
BYTE GetMenuItemIndex(BYTE g_ucMenuPageIndex)
{
g_ucMenuPageIndex=g_ucMenuPageIndex;
return 0;
}
void DrawShowSourcemenu(void)
{
if(FactoryModeFlag)
g_ucMenuPageIndex=FactoryRootMenu;
else
{
#if TV_ENABLE
if(IsTVInUse())
g_ucMenuPageIndex=ShowTVChannelMenu;
else
#endif
g_ucMenuPageIndex=ShowSourceMenu;
}
g_ucMenuItemIndex=0;
ExecuteKeyEvent(MIA_RedrawMenu);
ResetOsdTimer();
}
void ReDrawCurrentOSDItem(BYTE item)
{
DrawOsdMenuItem(item, &CurrentMenu.MenuItems[item]);
}
void MenuStatusCHK(void)
{
if (g_ucMenuPageIndex!=RootMenu)
return;
#if VGA_ENABLE
if(IsVGAInUse())
return;
#endif
Clr_DynamiccaptionFlag();
if (!(g_VdInfo.wVideoStatus &VD_HSYNC_LOCKED))
{
DrawShowSourcemenu();
g_ucOsdCounter=0;
}
else
{
if (g_VideoSetting.MuteStatus)
{
g_ucMenuPageIndex=MuteMenu;
g_ucMenuItemIndex=0;
ExecuteKeyEvent(MIA_RedrawMenu);
g_ucOsdCounter=0;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -