📄 menu.c
字号:
#include <stdlib.h>
#include <string.h>
#include "types.h"
#include "board.h"
#include "global.h"
#include "keypaddef.h"
#include "menudef.h"
#include "keypad.h"
#include "ms_rwreg.h"
#include "msosd.h"
#include "menufunc.h"
#include "menustr.h"
#include "menutbl.h"
#include "ms_reg.h"
#include "debug.h"
#include "misc.h"
#include "nvram.h"
#include "adjust.h"
#include "userpref.h"
#include "mcu.h"
#if Dual_Input_Icon_Enable
#include "Mstar.h"
#include "Power.h"
#endif
#define menuDebug 1
#if menuDebug
#define Out_i printData
#define Out_s printMsg
#else
#define Out_i
#define Out_s
#endif
#define CurrentMenu tblMenus[MenuPageIndex]
#define PrevMenuPage CurrentMenu.PrevPage
#define CurrentMenuItems CurrentMenu.MenuItems
#define MenuItemCount CurrentMenu.ItemCount
#define CurrentMenuItem CurrentMenu.MenuItems[MenuItemIndex]
#define NextMenuPage CurrentMenuItem.NextPage
#define CurrentMenuItemFunc CurrentMenuItem.KeyFunction
#define KeyEvent CurrentMenuItem.KeyEvents[KeypadButton]
#define MenuItemDisplayValue CurrentMenuItem.DisplayValue
//========================================================================
BYTE ToEnterFactoryKeyCounter=0;
Bool ToEnterFactoryFlag;
extern BYTE OsdFontColor;
//extern WORD BLTime;
extern void Osd_SetTextColor(BYTE foreColor, BYTE backColor);
extern BYTE Osd_GetTextColor(void);
extern void DrawLeftAlignNum(BYTE xPos, BYTE yPos, WORD value);
extern void WriteAdcOffsetGainValue(void);
//====================================
extern void mStar_AutoDVI(void);
extern void mStar_SetupInputPort(void);
//========================================================================
//========================================================================
BYTE code tSpace3[]=
{//12345678901234567890
" "
};
//========================================================================
BYTE MenuPageIndex=0;
BYTE MenuItemIndex=0;
BYTE TurboKeyCounter=0;
//FENDY ADD FOR HPC OSD
BYTE StauIndex0=0;
BYTE StauIndex1=1;
BYTE StauIndex2=0;
BYTE i;
Bool DDCSwitchEnable=FALSE;
//========================================================================
void SaveUserPrefSetting(BYTE menuPageIndex);
Bool ExecuteKeyEvent(MenuItemActionType menuAction);
void DrawOsdMenu(void);
void DrawOsdMenuItem(BYTE drawIndex, MenuItemType *menuItem);
void DrawOsdMenuItemText(BYTE itemIndex, MenuItemType *menuItem);
void DrawOsdMenuItemValue(BYTE itemIndex, DrawValueType *valueItem);
void DrawOsdMenuItemNumberGuage(BYTE itemIndex, DrawNumberType *mumberItem);
void DrawOsdMenuItemNumber(BYTE itemIndex, DrawNumberType *numberItem);
void DrawOsdMenuItemGuage(BYTE itemIndex, DrawGuageType *guageItem);
void DrawOsdMenuItemRadioGroup(BYTE itemIndex, DrawRadioGroupType *RadioItem);
void DrawTimingInfo(void);
extern Bool AutoColorTempAdjust(BYTE ColorTemp);
BYTE moveX, moveY;//vick for moving menu
////////////////////////////////zwtan modify for hpc new osd
BYTE code Space[]=
{//12345678901234567890
"\x2F"
};
BYTE code tLeftSpace[]=
{//12345678901234567890
"\x7b\x2f\x2F\x2F\x2F\x2F\x2F\x2F\x2F\x2F\x2F\x2F"
};
BYTE code tSpace_Mid[]=
{//12345678901234567890
"\x7F"
};
BYTE code tTopLine[]=
{//12345678901234567890
"\x7C\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7E\x80\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7D\x7E"
};
BYTE code RightSpace[]=
{//12345678901234567890
"\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f"
};
BYTE code tUnderLeftSpace[]=
{//12345678901234567890
"\x81\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82"
};
BYTE code tUnderSpace_Mid[]=
{//12345678901234567890
"\x83"
};
BYTE code UnderRightSpace[]=
{//12345678901234567890
"\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82\x82"
};
///////////////////////////////////////
BYTE code LeftWintransitionspace[]=
{
"\xe7\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6"
};
BYTE code RightWintransitionspace1[]=
{
"\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6"
};
BYTE code RightWintransitionspace[]=
{
"\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6\xe6"
};
BYTE code LeftWinButtonTopIcon[]=
{
"\xd0\xd1\xd1\xd1\xd1\xd1\xd1\xd1\xd1\xd1\xd2"
};
BYTE code LeftWinButtonTop1Icon[]=
{
"\xe3\xe4\xe4\xe4\xe4\xe4\xe4\xe4\xe4\xe4\xe5"
};
BYTE code LeftWinButtonDownIcon[]=
{
"\xd4\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xd5\xe2"
};
BYTE code LeftWinButtonDown1Icon[]=
{
"\xE8\xE9\xE9\xE9\xE9\xE9\xE9\xE9\xE9\xE9\xEA"
};
BYTE code LeftWinButtonLeftIcon[]=
{
"\x84"
};
BYTE code LeftWinButtonRightIcon[]=
{
"\xd3"
};
BYTE code LeftWinButtonTop1first[]=
{
"\xe7"
};
BYTE code RightSpace14[]=
{
"\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f"
};
BYTE code HalfSpace[]=
{
"\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01"
};
BYTE code Button_IntSpace7[]=
{
"\x2f\x2f\x2f\x2f\x2f\x2f\x2f"
};
BYTE code Button_IntSpace9[]=
{
"\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f\x2f"
};
//////////////////////////////////////////
void DynamicLoadFont(BYTE addr, MenuFontType *menuFonts)
{
if(MenuPageIndex==LanguageMenu)
Osd_DynamicLoadFont(addr, (BYTE*)(menuFonts->Fonts), menuFonts->FontCount);
else
Osd_DynamicLoadFont(addr, (BYTE*)((menuFonts+UserPrefLanguage)->Fonts), (menuFonts+UserPrefLanguage)->FontCount);
}
void DrawLeftWindow(void)
{
Osd_SetTextColor(CP_SoftGrassGreenColor, CP_BlackColor);
Osd_DrawStr(0x00,0x00, tTopLine);
for (i=1; i<3; i++) // Left side
{
if (i==1)
Osd_SetTextColor(CP_GreenColor, CP_BlackColor);
else
Osd_SetTextColor(CP_GreenColor, CP_SoftLowGreenColor);
Osd_DrawStr(0x00, i, tLeftSpace);
if (i==1)
Osd_SetTextColor(CP_SoftGrassGreenColor, CP_BlackColor);
else
Osd_SetTextColor(CP_SoftGrassGreenColor, CP_SoftLowGreenColor);
Osd_DrawStr(0x0C, i, tSpace_Mid);
Osd_SetTextColor(CP_GreenColor, CP_SoftLowGreenColor);
Osd_DrawStr(0x0D, i, RightSpace);
if (i==1)
Osd_SetTextColor(CP_SoftGrassGreenColor, CP_BlackColor);
else
Osd_SetTextColor(CP_SoftGrassGreenColor, CP_SoftLowGreenColor);
Osd_DrawStr(0x28, i, tSpace_Mid);
}
for (i=3; i<OsdWindowHeight-1; i++) // Left side
{
Osd_SetTextColor(CP_SoftLowGreenColor, CP_BlackColor);
Osd_DrawStr(0x00, i, tLeftSpace);
Osd_SetTextColor(CP_SoftGrassGreenColor, CP_SoftLowGreenColor);
Osd_DrawStr(0x0C, i, tSpace_Mid);
Osd_SetTextColor(CP_SoftLowGreenColor, CP_BlackColor);
Osd_DrawStr(0x0D, i, RightSpace);
Osd_SetTextColor(CP_SoftGrassGreenColor, CP_SoftLowGreenColor);
Osd_DrawStr(0x28, i, tSpace_Mid);
}
Osd_SetTextColor(CP_SoftLowGreenColor, CP_SoftLowGreenColor);
Osd_DrawStr(0x00, OsdWindowHeight-1, tUnderLeftSpace);
Osd_SetTextColor(CP_SoftGrassGreenColor, CP_SoftLowGreenColor);
Osd_DrawStr(0x0C, OsdWindowHeight-1, tUnderSpace_Mid);
Osd_SetTextColor(CP_SoftLowGreenColor, CP_SoftLowGreenColor);
Osd_DrawStr(0x0D, OsdWindowHeight-1, UnderRightSpace);
Osd_SetTextColor(CP_SoftGrassGreenColor, CP_SoftLowGreenColor);
Osd_DrawStr(0x28,OsdWindowHeight-1, tUnderSpace_Mid);
Osd_SetTextColor(CP_GreenColor, CP_SeaBlueColor);
Osd_DrawStr(0,3, LeftWintransitionspace);
Osd_DrawStr(0x0D,3, RightWintransitionspace);
}
void ClearWindow1(void)
{BYTE i;
mStar_WriteOSDByte(SUBW0C, 0x01);
mStar_WriteOSDByte(SW0HST, 0x0D);
mStar_WriteOSDByte(SW0HEND, 0x27);
mStar_WriteOSDByte(SW0VST, 0x04);
mStar_WriteOSDByte(SW0VEND,0x0E);
mStar_WriteOSDByte(SUBW0A, 0x00);
Osd_SetTextColor(CP_SoftLowGreenColor, CP_SoftLowGreenColor);
for (i=4; i<OsdWindowHeight-1; i++) // RIFHT side 2 4 6 8 10 12 14
Osd_DrawStr(13, i, RightSpace);
if(MenuPageIndex==LanguageMenu||MenuPageIndex==OsdSetMenu)
{ Osd_SetTextColor(CP_GreenColor, CP_SeaBlueColor);
Osd_DrawStr(0x0D,3, RightWintransitionspace);
}
}
void Draw_SUBWindow2(void)
{
mStar_WriteOSDByte(SUBW2C, 0x03);
mStar_WriteOSDByte(SW2HST, 0x01);
mStar_WriteOSDByte(SW2HEND, 0x0B);
mStar_WriteOSDByte(SW2VST, 0x01);
mStar_WriteOSDByte(SW2VEND,0x0E);
mStar_WriteOSDByte(SUBW2A, 0x00);
}
void Draw_SUBWindow1(void)
{
mStar_WriteOSDByte(SUBW1C, 0x03);
mStar_WriteOSDByte(SW1HST, 0x0D);
mStar_WriteOSDByte(SW1HEND, 0x27);
mStar_WriteOSDByte(SW1VST, 0x01);
mStar_WriteOSDByte(SW1VEND,0x0E);
mStar_WriteOSDByte(SUBW1A, 0x00);
}
void DrawButton_LEFT(BYTE item)
{
Osd_SetTextColor(CP_GrassGreenColor,CP_SoftGrassGreenColor);
Osd_DrawStr(1, 4+item*2,LeftWinButtonLeftIcon);
Osd_DrawStr(4, 4+item*2,Button_IntSpace7);//FENDY ADD this for ..
Osd_SetTextColor(CP_GreenColor, CP_SeaBlueColor);
if(item==0)
{
Osd_DrawStr(1, 3+item*2,LeftWinButtonTop1Icon);
}
else
{
Osd_DrawStr(1, 3+item*2,LeftWinButtonTopIcon);
}
Osd_DrawStr(0x0B,4+item*2,LeftWinButtonRightIcon);
//if (item==5)
// Osd_DrawStr(1, 5+item*2,LeftWinButtonDown1Icon);
// else
Osd_DrawStr(1, 5+item*2,LeftWinButtonDownIcon);
}
void ClearButton_LEFT(BYTE item)
{
Osd_SetTextColor(CP_SoftLowGreenColor, CP_SoftGrassGreenColor);
Osd_DrawStr(1, 4+item*2,Space);
Osd_DrawStr(4, 4+item*2,Button_IntSpace7);//FENDY ADD this for ..
if(item==0)
{ Osd_SetTextColor(CP_GreenColor, CP_SeaBlueColor);
Osd_DrawStr(0, 3+item*2,LeftWintransitionspace);
}
else
{
Osd_SetTextColor(CP_SoftLowGreenColor, CP_SoftGrassGreenColor);
Osd_DrawStr(0, 3+item*2,tLeftSpace);
}
Osd_SetTextColor(CP_SoftLowGreenColor, CP_SoftGrassGreenColor);
Osd_DrawStr(0x0B,4+item*2,Space);
if (item==5)
Osd_DrawStr(0, 5+item*2,tUnderLeftSpace);
else
Osd_DrawStr(0, 5+item*2,tLeftSpace);
}
void DrawButton_RIGHT(BYTE item)
{
BYTE xOffset,yOffset;
if(MenuPageIndex==LanguageMenu&&item>=4)
{xOffset=14;yOffset=4;}
else
{xOffset=0;yOffset=0;}
Osd_SetTextColor(CP_GrassGreenColor,CP_SoftGrassGreenColor);
Osd_DrawStr(13+xOffset, 4+(item-yOffset)*2,LeftWinButtonLeftIcon);
Osd_DrawStr(14+xOffset, 4+(item-yOffset)*2,Button_IntSpace9);//fendy add
Osd_SetTextColor(CP_GreenColor, CP_SeaBlueColor);
if(item==0||(MenuPageIndex==LanguageMenu&&item==4))
{
Osd_DrawStr(13+xOffset, 3+(item-yOffset)*2,LeftWinButtonTop1Icon);
}
else
{
Osd_DrawStr(13+xOffset, 3+(item-yOffset)*2,LeftWinButtonTopIcon);
}
Osd_DrawStr(23+xOffset,4+(item-yOffset)*2,LeftWinButtonRightIcon);
//if (item==5)
// Osd_DrawStr(1, 5+item*2,LeftWinButtonDown1Icon);
// else
Osd_DrawStr(13+xOffset, 5+(item-yOffset)*2,LeftWinButtonDownIcon);
}
void ClearButton_RIGHT(BYTE item)
{
BYTE xOffset,yOffset;
if(MenuPageIndex==LanguageMenu&&item>=4)
{xOffset=14;yOffset=4;}
else
{xOffset=0;yOffset=0;}
Osd_SetTextColor(CP_SoftLowGreenColor, CP_BlackColor);
Osd_DrawStr(13+xOffset, 4+(item-yOffset)*2,Space);
Osd_DrawStr(14+xOffset, 4+(item-yOffset)*2,Button_IntSpace9);//fendy add
if(item==0||(MenuPageIndex==LanguageMenu&&item==4))
{ Osd_SetTextColor(CP_GreenColor, CP_SeaBlueColor);
Osd_DrawStr(13+xOffset, 3+(item-yOffset)*2,RightWintransitionspace1);
}
else
{
Osd_SetTextColor(CP_SoftLowGreenColor, CP_SoftLowGreenColor);
Osd_DrawStr(13+xOffset, 3+(item-yOffset)*2,tLeftSpace);
}
Osd_SetTextColor(CP_SoftLowGreenColor, CP_SoftLowGreenColor);
Osd_DrawStr(23+xOffset,4+(item-yOffset)*2,Space);
if (item==5)
{
Osd_DrawStr(13+xOffset, 5+(item-yOffset)*2,tUnderLeftSpace);
Osd_DrawStr(13+xOffset, 15,Space);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -