📄 menufunc.c
字号:
#include <string.h>
#include "types.h"
#include "board.h"
#include "global.h"
#include "keypaddef.h"
#include "menudef.h"
#include "adjust.h"
#include "ms_reg.h"
#include "debug.h"
#include "msosd.h"
#include "power.h"
#include "misc.h"
#include "autofunc.h"
#include "nvram.h"
#include "userpref.h"
#include "mstar.h"
#include "ms_rwreg.h"
#include "mcu.h"
#include "menustr.h"
#include "menu.h"
#include "Gamma.h"
void SaveUserPref(void);
void Read9300KSetting(void);
void Read6500KSetting(void);
void Read5800KSetting(void);//fendy add
void ReadUserKSetting(void); //vick add
void Save9300KSetting(void);
void Save6500KSetting(void);
void Save5800KSetting(void);//fendy
void SaveUserKSetting(void);//vick add
void SaveMonitorColorTempPart(void);
void SetColorTemp(BYTE ColorTemp);
idata Bool OsdTimeDrawGuageFlag=FALSE; //tony
idata Bool OsdTranDrawGuageFlag=FALSE; //tony
Bool AutoColorTempAdjust(BYTE ColorTemp);
extern Bool ExecuteKeyEvent(MenuItemActionType menuAction);
void WriteAdcOffsetGainValue(void);
//Bool MuteVolume(void);
extern void ClearWindow1(void);
extern Bool SaveAdjColorTemp(BYTE ColorTemp);
////////////////////zwtan modyfy for direct new osd 20050307
Bool SetSChineseLanguage(void)
{
if(UserPrefLanguage==LANG_SChinese)
return FALSE;
UserPrefLanguage=LANG_SChinese;
NVRam_WriteByte(nvrMonitorAddr(Language), UserPrefLanguage);
Set_ReloadFontFlag();
return TRUE;
}
Bool SetTChineseLanguage(void)
{
if(UserPrefLanguage==LANG_TChinese)
return FALSE;
UserPrefLanguage=LANG_TChinese;
NVRam_WriteByte(nvrMonitorAddr(Language), UserPrefLanguage);
Set_ReloadFontFlag();
return TRUE;
}
Bool SetJapaneseLanguage(void)
{
if(UserPrefLanguage==LANG_Japanese)
return FALSE;
UserPrefLanguage=LANG_Japanese;
NVRam_WriteByte(nvrMonitorAddr(Language), UserPrefLanguage);
Set_ReloadFontFlag();
return TRUE;
}
Bool SetEnglishLanguage(void)
{
if(UserPrefLanguage==LANG_English)
return FALSE;
UserPrefLanguage=LANG_English;
NVRam_WriteByte(nvrMonitorAddr(Language), UserPrefLanguage);
Set_ReloadFontFlag();
Set_ReloadFontFlag();
return TRUE;
}
Bool SetItalianLanguage(void)
{
if(UserPrefLanguage==LANG_Italian)
return FALSE;
UserPrefLanguage=LANG_Italian;
NVRam_WriteByte(nvrMonitorAddr(Language), UserPrefLanguage);
Set_ReloadFontFlag();
return TRUE;
}
Bool SetFranceLanguage(void)
{
if(UserPrefLanguage==LANG_France)
return FALSE;
UserPrefLanguage=LANG_France;
NVRam_WriteByte(nvrMonitorAddr(Language), UserPrefLanguage);
Set_ReloadFontFlag();
return TRUE;
}
Bool SetGermanLanguage(void)
{
if(UserPrefLanguage==LANG_German)
return FALSE;
UserPrefLanguage=LANG_German;
NVRam_WriteByte(nvrMonitorAddr(Language), UserPrefLanguage);
Set_ReloadFontFlag();
return TRUE;
}
Bool SetSpanishLanguage(void)
{
if(UserPrefLanguage==LANG_Spanish)
return FALSE;
UserPrefLanguage=LANG_Spanish;
NVRam_WriteByte(nvrMonitorAddr(Language), UserPrefLanguage);
Set_ReloadFontFlag();
return TRUE;
}
void Adjust_SelectIcon(BYTE selectvalum)
{
Osd_SetTextColor(CP_BlackColor, CP_SoftLowGreenColor);
Osd_DrawPropStr(28, 10,ONText());
Osd_DrawPropStr(34, 10,OFFText());
Osd_SetTextColor(CP_RedColor, CP_SoftLowGreenColor);
if(selectvalum)
Osd_DrawPropStr(28, 10,ONText());
else
Osd_DrawPropStr(34, 10,OFFText());
}
WORD DecIncValue(MenuItemActionType action, WORD value, WORD minValue, WORD maxValue, BYTE step)
{ if (action==MIA_IncValue || action==MIA_InvDecValue)
{ if (value>=maxValue)
return value;
minValue=value+step;
if (minValue>maxValue)
minValue=maxValue;
value=minValue;
}
else // Decrease value
{ if (value<=minValue)
return value;
maxValue=value-step;
if (maxValue<minValue)
maxValue=minValue;
value=maxValue;
}
return value;
}
WORD GetScale100Value(WORD value, WORD minValue, WORD maxValue)
{ maxValue=maxValue-minValue;
value=value-minValue;
if (value>650)
{ value/=2;
maxValue/=2;
}
value=((WORD)value*100+maxValue/2)/maxValue;
printData("value=%d", value);
return value;
}
Bool EnterOsdTimeMuteMenu(void)
{
if (OsdTimeOfflag)
Adjust_SelectIcon(0);
else
Adjust_SelectIcon(1);
return TRUE;
}
//WORD GetOsdTimeValue(void)
//{
// OsdTimeDrawNumberFlag = TRUE;
// return GetScale100Value(UserPrefOsdTime, MinOsdTime, MaxOsdTime);
//}
WORD GetOsdTimeValue1(void)
{ OsdTimeDrawGuageFlag = TRUE;
return UserPrefOsdTime;
// return GetScale100Value(UserPrefOsdTime, MinOsdTime, MaxOsdTime);
}
Bool OsdTimeAdjust(MenuItemActionType action)// on off osd time
{
if (action==MIA_DecValue)
if(!OsdTimeOfflag)
{
Adjust_SelectIcon(0);
Set_OsdTimeOfflag();
UserPrefOsdTime=0;
NVRam_WriteByte(nvrMonitorAddr(OsdTime), UserPrefOsdTime);
}
if (action==MIA_IncValue)
if(OsdTimeOfflag)
{
Adjust_SelectIcon(1);
Clr_OsdTimeOffFlag();
UserPrefOsdTime=DefOsdTime;
NVRam_WriteByte(nvrMonitorAddr(OsdTime), UserPrefOsdTime);
}
NVRam_WriteByte(nvrMonitorAddr(MonitorFlag), MonitorFlags);
return TRUE;
}
WORD GetOSDTransultValue(void)
{ OsdTranDrawGuageFlag=TRUE;
return UserPrefTransultDef;
}
void Osd_setOsdTranslucent(BYTE value)
{
switch(value)
{case No_Translucent:
// Set_TranslucentOffFlag();
mStar_WriteByte(BLENDC,0x00);
mStar_WriteByte(BLENDL,0x00);
break;
case Translucent_1:
mStar_WriteByte(BLENDC,0x05);
mStar_WriteByte(BLENDL,0x01);//0-8
break;
case Translucent_2:
mStar_WriteByte(BLENDC,0x05);
mStar_WriteByte(BLENDL,0x02);//0-8
break;
case Translucent_3:
mStar_WriteByte(BLENDC,0x05);
mStar_WriteByte(BLENDL,0x03);//0-8
break;
case Translucent_4:
mStar_WriteByte(BLENDC,0x05);
mStar_WriteByte(BLENDL,0x04);//0-8
break;
case Translucent_5:
mStar_WriteByte(BLENDC,0x05);
mStar_WriteByte(BLENDL,0x05);//0-8
break;
case Translucent_6:
mStar_WriteByte(BLENDC,0x05);
mStar_WriteByte(BLENDL,0x06);//0-8
break;
case Translucent_7:
mStar_WriteByte(BLENDC,0x05);
mStar_WriteByte(BLENDL,0x07);//0-8
break;
}
}
Bool Osd_AdjustOsdTranslucent(MenuItemActionType action)
{ WORD tempValue;
tempValue=DecIncValue(action, UserPrefTransultDef, 0, 7, 1);
if (tempValue==UserPrefTransultDef)
return FALSE;
UserPrefTransultDef=tempValue;
Osd_setOsdTranslucent(UserPrefTransultDef);
NVRam_WriteByte(nvrMonitorAddr(OsdTime), UserPrefTransultDef);
// printData("UserPrefOsdTime3 %d" , UserPrefOsdTime);
return TRUE;
}
///////////////////
//====fendy
void ModeAdjust_SelectIcon(BYTE selectvalum)
{
Osd_SetTextColor(CP_BlackColor, CP_SoftLowGreenColor);
Osd_DrawPropStr(26, 4,TextModeText());
Osd_DrawPropStr(32, 4,PictureModeText());
Osd_SetTextColor(CP_RedColor, CP_SoftLowGreenColor);
if(selectvalum)
Osd_DrawPropStr(26, 4,TextModeText());
else
Osd_DrawPropStr(32, 4,PictureModeText());
}
//===
Bool ModeAdjust(MenuItemActionType action)
{
if (action==MIA_IncValue)
UserPrefPictureMode++;
if(UserPrefPictureMode==Res_720x400)
{
ModeAdjust_SelectIcon(1);
UserPrefPictureMode=Res_640x400;
if (SrcModeIndex==2)
Set_InputTimingChangeFlag();
}
if (action==MIA_DecValue)
if(UserPrefPictureMode==Res_640x400)
{
ModeAdjust_SelectIcon(0);
UserPrefPictureMode=Res_720x400;
if (SrcModeIndex==4)
Set_InputTimingChangeFlag();
}
NVRam_WriteByte(nvrMonitorAddr(PictureMode), UserPrefPictureMode);
return TRUE;
}
////////////////////zwtan modyfy for direct new osd 20050307
Bool EnablePowerDownCounter(void)
{ PowerDownCounter=PowerDownCounterTimeOut;
// Set_ForcePowerSavingFlag();
return TRUE;
}
Bool PowerOffSystem(void)
{ printMsg("turn off");
Power_TurnOffLed();
Power_PowerOffSystem();
Clr_PowerOnFlag();
Clr_FactoryModeFlag();
Disable_SerialPort();//zwtan 20050201
if (DoBurninModeFlag)
{ Clr_DoBurninModeFlag();
mStar_WriteByte(FWC, 0); // disable background color function.
mStar_WriteOSDByte(GCCTRL,0x00);//disable gradually
}
Set_PowerStatusFlag(); //for save forestatus before hard poweroff
NVRam_WriteByte(nvrMonitorAddr(MonitorFlag), MonitorFlags);
// printData("Power off %x" ,MonitorFlags);
#if 1 //tony
mStar_AdjustVolume(MinVol);
hw_SetMute(); // nelson
Delay1ms(1);
//hw_ClrMute(); // nelson
#endif
return TRUE;
}
Bool PowerOnSystem(void)
{ printMsg("turn on");
Power_PowerOnSystem();
Power_TurnOnGreenLed();
Set_PowerOnFlag();
// Enable_SerialPort(); //junjian mask 20051029
if(FactoryModeFlag){
UserPrefLanguage = 0;//tony
}
Clr_PowerStatusFlag();
NVRam_WriteByte(nvrMonitorAddr(MonitorFlag), MonitorFlags);
#if 1 //tony
if(MuteVolumeFlag){
mStar_AdjustVolume(MinVol);
hw_SetMute(); // nelson
Delay1ms(1);
//hw_ClrMute(); // nelson
}
else {
hw_SetMute();
Delay1ms(1);
hw_ClrMute(); //nelson
mStar_AdjustVolume(UserPrefVolume);
}
#endif
return TRUE;
}
Bool EnterRootMenu(void)
{ return TRUE;
}
//================================================================================
//================================================================================
//================================================================================
Bool AdjustContrast(MenuItemActionType action)
{ WORD tempValue;
tempValue=DecIncValue(action, UserPrefContrast, MinContrastValue, MaxContrastValue, 1);
if (tempValue==UserPrefContrast)
return FALSE;
UserPrefContrast=tempValue;
mStar_AdjustContrast(UserPrefContrast);
NVRam_WriteByte(nvrMonitorAddr(Contrast), UserPrefContrast);
return TRUE;
}
/*
WORD GetFactory9300KContrastValue(void)
{return GetScale100Value(UserPrefContrast9300K, MinContrastValue, MaxContrastValue);
}
WORD GetFactory6500KContrastValue(void)
{return GetScale100Value(UserPrefContrast6500K, MinContrastValue, MaxContrastValue);
}
*/
//================================================
//====================================================
Bool AdjustBrightness(MenuItemActionType action)
{ WORD tempValue;
//tempValue=DecIncValue(action, UserPrefBrightness, MinBrightnessValue, MaxBrightnessValue, 1);
tempValue=DecIncValue(action, UserPrefBrightness, 0, 100, 1);
if (tempValue==UserPrefBrightness)
return FALSE;
UserPrefBrightness=tempValue;
mStar_AdjustBrightness(UserPrefBrightness);
NVRam_WriteByte(nvrMonitorAddr(Brightness), UserPrefBrightness);
return TRUE;
}
/*
WORD GetFactory9300KBrightnessValue(void)
{return UserPrefBrightness9300K;
}
WORD GetFactory6500KBrightnessValue(void)
{return UserPrefBrightness6500K;
}*/
//====================================================
Bool AdjustFocus(MenuItemActionType action)
{ WORD tempValue;
tempValue=DecIncValue(action, UserPrefPhase, 0, 63, 1);
if (tempValue==UserPrefPhase)
return FALSE;
UserPrefPhase=tempValue;
mStar_AdjustPhase(UserPrefPhase);
NVRam_WriteByte(nvrModeAddr(Phase), UserPrefPhase);
return TRUE;
}
WORD GetFocusValue(void)
{ return GetScale100Value(UserPrefPhase, 0, 63);
//return UserPrefPhase;
}
//====================================================
#define MaxClock (StandardModeHTotal+60)
#define MinClock (StandardModeHTotal-60)
Bool AdjustClock(MenuItemActionType action)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -