📄 menu.c
字号:
tcolor = Osd_GetTextColor();
len=strlen(menuItem->DisplayText());
Osd_SetTextColor(menuItem->SelForeColor, menuItem->SelBackColor);
Osd_DrawStr(menuItem->XPos, menuItem->YPos, menuItem->DisplayText());
Osd_SetTextColor(CP_GrayColor, CP_GrayColor);
for(i = len+menuItem->XPos; i < OsdWindowWidth-2; i ++)
Osd_DrawChar(i, menuItem->YPos, 0x00);
Osd_SetTextColor(tcolor&0xf0, tcolor&0x0f);
}
else // full text
{ //BYTE i;
BYTE xPos;
#define len itemIndex
//len=strlen(menuItem->DisplayText());
len=menuItem->DisplayText()[1];
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_SetTextColor(menuItem->SelForeColor, menuItem->SelBackColor); //tony
Osd_DrawPropStr(xPos, menuItem->YPos, menuItem->DisplayText());
if (menuItem->DrawItemMethod!=DWI_CenterText) // full text
{
Osd_SetTextColor(CP_BlueColor,CP_BlueColor);
for (i=1; i<xPos; i++)
Osd_DrawChar(i, menuItem->YPos, 0x00); // fill space
for (i=xPos+len; i<OsdWindowWidth-1; i++)
Osd_DrawChar(i, menuItem->YPos, 0x00);
}
#undef len
}
}
//=========================================================================
// draw menu item display value
void DrawOsdMenuItemValue(BYTE itemIndex, DrawValueType *valueItem)
{
if (valueItem==DisplayValueNull)
return;
while(1)
{
if (valueItem->DrawNumber)
{
// if(!FactoryModeFlag)?? WHY
//Osd_SetTextColor(valueItem->DrawNumber->ForeColor,valueItem->DrawNumber->BackColor);
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)
{
BYTE OsdTimeNumberScale = 1;
//if(!OsdTimeDrawNumberFlag)
//{
// itemIndex=0;
#if Multi_Number
{ NumberType *number;
BYTE i;
number=numberItem->DisplayNumber;
if (itemIndex==MenuItemIndex)//Vick Add
{
Osd_SetTextColor(numberItem->SelForeColor,numberItem->SelBackColor);
}
else{
Osd_SetTextColor(numberItem->ForeColor,numberItem->BackColor);
}
if (number)
{
#define drawItem (number+i)
#define xPos itemIndex
while (1)
{ xPos=drawItem->XPos;
if (xPos==0)
{ xPos=(OsdWindowWidth-4)/2-1;
}
Osd_DrawNum(xPos, drawItem->YPos, drawItem->GetValue());
if (drawItem->Flags&dwiEnd)
break;
i++;
}
#undef xPos
#undef drawItem
}
}
#else
if (itemIndex==MenuItemIndex)//Vick Add
Osd_SetTextColor(numberItem->SelForeColor,numberItem->SelBackColor);
else
Osd_SetTextColor(numberItem->ForeColor,numberItem->BackColor);
#define xPos itemIndex
xPos=numberItem->XPos;
if (xPos==0)
{ xPos=(OsdWindowWidth-4)/2-1;
}
// if (MenuPageIndex==FactoryMenu)//Vick mask
// { if (CurrentMenuItem.DisplayValue.DrawNumber==numberItem)
// Osd_SetTextColor(numberItem->ForeColor, numberItem->BackColor);
// }
/*
if (OsdTimeDrawNumberFlag){
OsdTimeNumberScale = 6; //tony
OsdTimeDrawNumberFlag = FALSE;
} */
if (numberItem->Flags&dwiHex)
Osd_DrawHex(xPos, numberItem->YPos, numberItem->GetValue());
else
//Osd_DrawNum(xPos, numberItem->YPos, numberItem->GetValue());
Osd_DrawNum(xPos, numberItem->YPos, numberItem->GetValue());
#undef xPos
#endif
//}
//----------------------------------
/*else{
OsdTimeDrawNumberFlag = FALSE;
Osd_DrawNum(numberItem->XPos, numberItem->YPos, numberItem->GetValue());
if(!FactoryModeFlag && MenuPageIndex!=FactoryMenu)
Osd_DrawChar(numberItem->XPos+4, numberItem->YPos,'S');
}*/
}
//=========================================================================
// draw guage
void DrawOsdMenuItemGuage(BYTE itemIndex, DrawGuageType *gaugeItem)
{ itemIndex=0;
Osd_SetTextColor(CP_SoftGrassGreenColor,CP_SoftLowGreenColor);
#if Multi_Gauge
// if (itemIndex==MenuItemIndex)//Vick Add
// Osd_SetTextColor(gaugeItem->SelForeColor,gaugeItem->SelBackColor);
/// else
// Osd_SetTextColor(gaugeItem->ForeColor,gaugeItem->BackColor);
{ BYTE i;
GaugeType *gauge;
gauge=gaugeItem->DisplayGauge;
if (gauge)
{ i=0;
#define drawItem (gauge+i)
#define xPos itemIndex
while (1)
{ xPos=drawItem->XPos;
if (xPos==0)
{ xPos=(OsdWindowWidth-gaugeItem->Length)/2;
}
Osd_DrawGuage(xPos, drawItem->YPos, gaugeItem->Length, drawItem->GetValue());
if (drawItem->Flags&dwiEnd)
break;
i++;
}
#undef xPos
#undef drawItem
}
}
#else
// if (itemIndex==MenuItemIndex)//Vick Add
// Osd_SetTextColor(gaugeItem->SelForeColor,gaugeItem->SelBackColor);
// else
Osd_SetTextColor(gaugeItem->ForeColor,gaugeItem->BackColor);
#define xPos itemIndex
xPos=gaugeItem->XPos;
if (xPos==0)
{ xPos=(OsdWindowWidth-gaugeItem->Length)/2;
}
Osd_DrawGuage(xPos, gaugeItem->YPos, gaugeItem->Length, gaugeItem->GetValue());
#undef xPos
#endif
}
void DrawFullCenterText(BYTE xPos, BYTE yPos, BYTE *str)
{ BYTE i, len;
if (xPos==0)
{ 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);
}
void DrawPropFullCenterText(BYTE xPos, BYTE yPos, BYTE *str)
{ BYTE i, len;
if (xPos==0)
{ 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_DrawPropStr(xPos, yPos, str);
}
//=========================================================================
// draw radio
void DrawOsdMenuItemRadioGroup(BYTE itemIndex, DrawRadioGroupType *radioItem)
{ RadioTextType *radioText;
BYTE i=0;
// itemIndex=itemIndex;
radioText=radioItem->RadioText;
if (radioText)
{
if (radioItem->GetValue) { i=radioItem->GetValue(); }
if(radioItem->Flags)
{
radioText +=i;
// printData("draw I %d", i);
i=0;
}
if(radioItem->Flags&dwiIcon)
{
if(!itemIndex)
Osd_SetTextColor(radioItem->SelForeColor,radioItem->SelBackColor);
else
Osd_SetTextColor(radioItem->ForeColor,radioItem->BackColor);
}
else Osd_SetTextColor(radioItem->ForeColor,radioItem->BackColor);
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==MenuItemIndex)
// Osd_SetTextColor(radioText->SelForeColor,radioText->SelBackColor);
// else
// Osd_SetTextColor(radioText->ForeColor,radioText->BackColor);
// }
if( radioItem->Flags&dwiNormalFont)
DrawFullCenterText(radioText->XPos, radioText->YPos, radioText->DisplayText());
else if(radioItem->Flags&dwiIcon)
Osd_DrawStr(radioText->XPos, radioText->YPos, radioText->DisplayText());
else
DrawPropFullCenterText(radioText->XPos, radioText->YPos, radioText->DisplayText());
}
if (radioText->Flags&dwiEnd)
break;
radioText ++;
i--;
}
}
}
void DrawTimingInfo(void)
{ WORD freq;
// BYTE xPos=8,OffSet=3;
BYTE xPos=20,OffSet=4;
#if 0
Osd_SetTextColor(CP_BlueColor, CP_GrayColor); //vick change
if (FactoryModeFlag)
{ if (BLTime>235926000ul) // 655365*3600
freq=0xFFFF;
else
freq=(DWORD)BLTime/3600;
Osd_Draw4Num(15, 0, freq);
// Osd_DrawStr(3, 0, DateText());
// Osd_DrawStr(2, 1, PanelNameText());
// Osd_DrawStr(2, 0, VersionDateText());
}
else
#endif
{
freq=HFreq(SrcHPeriod);
// Osd_DrawNum(4, 9, freq/10);
// Osd_DrawStr(4, 9, HFreqText());
// Osd_DrawStr(8, 9, "KHz");
Osd_SetTextColor(CP_BlackColor, CP_GreenColor);//very Green
/*if (mStar_ReadWord(SPRHDC_H)>1000){
xPos = 20;
OffSet = 4;
}
*/
DrawLeftAlignNum(xPos, 2, mStar_ReadWord(SPRHDC_H)&0xfffe);
Osd_DrawChar(xPos+OffSet, 2, 'x'); //X
DrawLeftAlignNum(xPos+OffSet+1, 2, mStar_ReadWord(SPRVDC_H));
freq=VFreq(freq, SrcVTotal);
Osd_DrawNum(xPos+OffSet+4, 2, (freq+5)/10);
Osd_DrawStr(xPos+OffSet+8, 2, "Hz");
}
}
void SaveUserPrefSetting(BYTE menuPageIndex)
{
if(!FactoryModeFlag)
{
if (menuPageIndex==MainMenu)//BriConMenu
{
NVRam_WriteByte(nvrMonitorAddr(Brightness), UserPrefBrightness);
NVRam_WriteByte(nvrMonitorAddr(Contrast), UserPrefContrast);
NVRam_WriteByte(nvrMonitorAddr(Gamma), UserPrefGammaDef);
NVRam_WriteByte(nvrMonitorAddr(ColorTemp), UserPrefColorTemp);
}
else if (menuPageIndex==PictureMenu)//ImageSetMenu)
{
NVRam_WriteByte(nvrModeAddr(Phase), UserPrefPhase);
NVRam_WriteWord(nvrModeAddr(HTotal), UserPrefHTotal);
NVRam_WriteWord(nvrModeAddr(HStart), UserPrefHStart);
NVRam_WriteWord(nvrModeAddr(VStart), UserPrefVStart);
NVRam_WriteWord(nvrModeAddr(AutoTimes), UserPrefAutoTimes);
NVRam_WriteWord(nvrMonitorAddr(Sharpness), UserPrefSharpness);
}
else if (menuPageIndex==OsdSetMenu)
{
NVRam_WriteByte(nvrMonitorAddr(OsdHStart), UserPrefOsdHStart);
NVRam_WriteByte(nvrMonitorAddr(OsdVStart), UserPrefOsdVStart);
/////////////////////////////////////////////////////////
//NVRam_WriteByte(UserOsdHStartAddr, UserPrefOsdHStart);
//NVRam_WriteByte(UserOsdVStartAddr, UserPrefOsdVStart);
/////////////////////////////////////////////////////////
NVRam_WriteByte(nvrMonitorAddr(OsdSize), UserPrefOsdSize); //tony
NVRam_WriteByte(nvrMonitorAddr(OsdTime), UserPrefOsdTime); //tony
NVRam_WriteByte(nvrMonitorAddr(Transult), UserPrefTransultDef); //tony
}
else if(menuPageIndex==MiscellaneousMenu || menuPageIndex==VolMenu)
{NVRam_WriteByte(nvrMonitorAddr(Volume), UserPrefVolume);
//printData("save UserPrefVolume %d",UserPrefVolume);
}
else if (menuPageIndex==TUserColorMenu)
{
SaveUserKSetting();
// UserPrefColorTemp = CTEMP_USER;
SaveMonitorColorTempPart();
}
else if (menuPageIndex==LanguageMenu)
{
NVRam_WriteByte(nvrMonitorAddr(Language), UserPrefLanguage);
}
}
else if (menuPageIndex==FactoryMenu)
{
WriteAdcOffsetGainValue();
//printMsg("FactoryMenu saving");
}
Clr_SaveSettingFlag();
/*
if (MenuPageIndex==MainMenu)
{
if(!FactoryModeFlag)
{
if (menuPageIndex==MainMenu)//BriConMenu
{
NVRam_WriteByte(nvrMonitorAddr(Brightness), UserPrefBrightness);
NVRam_WriteByte(nvrMonitorAddr(Contrast), UserPrefContrast);
}
else if (menuPageIndex==PictureMenu)//ImageSetMenu)
{
NVRam_WriteByte(nvrModeAddr(Phase), UserPrefPhase);
NVRam_WriteWord(nvrModeAddr(HTotal), UserPrefHTotal);
NVRam_WriteWord(nvrModeAddr(HStart), UserPrefHStart);
NVRam_WriteWord(nvrModeAddr(VStart), UserPrefVStart);
}
else if (menuPageIndex==OsdSetMenu)
{
NVRam_WriteByte(nvrMonitorAddr(OsdHStart), UserPrefOsdHStart);
NVRam_WriteByte(nvrMonitorAddr(OsdVStart), UserPrefOsdVStart);
NVRam_WriteByte(nvrMonitorAddr(OsdSize), UserPrefOsdSize); //tony
NVRam_WriteByte(nvrMonitorAddr(OsdTime), UserPrefOsdTime); //tony
}
else if(menuPageIndex==MiscellaneousMenu)
{NVRam_WriteByte(nvrMonitorAddr(Volume), UserPrefVolume);
//printData("save UserPrefVolume %d",UserPrefVolume);
}
}
}
else if (MenuPageIndex==RootMenu)
{ if (menuPageIndex==BriteMenu)
{ NVRam_WriteByte(nvrMonitorAddr(Brightness), UserPrefBright
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -